-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@uppy/unsplash,@uppy/provider-views: add utmSource option #5580
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Diff output filesdiff --git a/packages/@uppy/provider-views/lib/Browser.js b/packages/@uppy/provider-views/lib/Browser.js
index d8a3bfb..3d26a33 100644
--- a/packages/@uppy/provider-views/lib/Browser.js
+++ b/packages/@uppy/provider-views/lib/Browser.js
@@ -14,6 +14,7 @@ function Browser(props) {
openFolder,
noResultsLabel,
virtualList,
+ utmSource,
} = props;
const [isShiftKeyPressed, setIsShiftKeyPressed] = useState(false);
useEffect(() => {
@@ -54,6 +55,7 @@ function Browser(props) {
i18n: i18n,
openFolder: openFolder,
file: item,
+ utmSource: utmSource,
});
if (virtualList) {
return h(
diff --git a/packages/@uppy/provider-views/lib/Item/index.js b/packages/@uppy/provider-views/lib/Item/index.js
index dc2c3ba..6e097db 100644
--- a/packages/@uppy/provider-views/lib/Item/index.js
+++ b/packages/@uppy/provider-views/lib/Item/index.js
@@ -10,6 +10,7 @@ export default function Item(props) {
i18n,
openFolder,
file,
+ utmSource,
} = props;
const restrictionError = file.type === "folder" ? null : file.restrictionError;
const isDisabled = !!restrictionError && file.status !== "checked";
@@ -17,6 +18,7 @@ export default function Item(props) {
file,
openFolder,
toggleCheckbox,
+ utmSource,
i18n,
viewType,
showTitles,
@@ -42,7 +44,7 @@ export default function Item(props) {
GridItem,
ourProps,
h("a", {
- href: `${file.data.author.url}?utm_source=Companion&utm_medium=referral`,
+ href: `${file.data.author.url}?utm_source=${utmSource}&utm_medium=referral`,
target: "_blank",
rel: "noopener noreferrer",
className: "uppy-ProviderBrowserItem-author",
diff --git a/packages/@uppy/provider-views/lib/ProviderView/ProviderView.js b/packages/@uppy/provider-views/lib/ProviderView/ProviderView.js
index e97c090..8084c9e 100644
--- a/packages/@uppy/provider-views/lib/ProviderView/ProviderView.js
+++ b/packages/@uppy/provider-views/lib/ProviderView/ProviderView.js
@@ -382,6 +382,7 @@ export default class ProviderView {
showTitles: opts.showTitles,
i18n: this.plugin.uppy.i18n,
isLoading: loading,
+ utmSource: "Companion",
}),
h(FooterActions, {
partialTree: partialTree,
diff --git a/packages/@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js b/packages/@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js
index 16576ec..a94e343 100644
--- a/packages/@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js
+++ b/packages/@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js
@@ -25,6 +25,12 @@ const defaultState = {
currentFolderId: null,
isInputMode: true,
};
+const defaultOptions = {
+ viewType: "grid",
+ showTitles: true,
+ showFilter: true,
+ utmSource: "Companion",
+};
export default class SearchProviderView {
constructor(plugin, opts) {
this.isHandlingScroll = false;
@@ -57,11 +63,6 @@ export default class SearchProviderView {
};
this.plugin = plugin;
this.provider = opts.provider;
- const defaultOptions = {
- viewType: "grid",
- showTitles: true,
- showFilter: true,
- };
this.opts = {
...defaultOptions,
...opts,
@@ -247,6 +248,7 @@ export default class SearchProviderView {
isLoading: loading,
i18n: i18n,
virtualList: false,
+ utmSource: this.opts.utmSource,
}),
h(FooterActions, {
partialTree: partialTree,
diff --git a/packages/@uppy/unsplash/lib/Unsplash.js b/packages/@uppy/unsplash/lib/Unsplash.js
index 470f0f3..97b6951 100644
--- a/packages/@uppy/unsplash/lib/Unsplash.js
+++ b/packages/@uppy/unsplash/lib/Unsplash.js
@@ -57,6 +57,7 @@ export default class Unsplash extends UIPlugin {
provider: this.provider,
viewType: "unsplash",
showFilter: true,
+ utmSource: this.opts.utmSource,
});
const {
target, |
Murderlon
force-pushed
the
unsplash-utm-source
branch
from
January 7, 2025 14:19
4ef8909
to
99012f3
Compare
Murderlon
force-pushed
the
unsplash-utm-source
branch
from
January 7, 2025 16:42
99012f3
to
d59ab54
Compare
github-actions bot
added a commit
that referenced
this pull request
Jan 8, 2025
| Package | Version | Package | Version | | -------------------------- | ------- | -------------------------- | ------- | | @uppy/google-drive-picker | 0.3.1 | @uppy/unsplash | 4.3.0 | | @uppy/google-photos-picker | 0.3.1 | @uppy/utils | 6.1.1 | | @uppy/onedrive | 4.2.1 | @uppy/xhr-upload | 4.3.1 | | @uppy/provider-views | 4.4.0 | uppy | 4.12.0 | | @uppy/svelte | 4.3.0 | | | - @uppy/unsplash,@uppy/provider-views: add utmSource option (Merlijn Vos / #5580) - @uppy/xhr-upload: allow custom error message in onAfterResponse (Merlijn Vos / #5578) - @uppy/onedrive: fix AsyncStore import (Merlijn Vos / #5579) - @uppy/google-drive-picker,@uppy/google-photos-picker: Fix Google Picker plugins locale (Merlijn Vos / #5575)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #5564
I don't know why I suddenly need to update the
tsconfig.json
's of two other projects but otherwise the build is failing. In any case better to align the settings.