diff --git a/packages/@uppy/provider-views/src/Browser.tsx b/packages/@uppy/provider-views/src/Browser.tsx index 2deffdbe9d..7cecf3d23e 100644 --- a/packages/@uppy/provider-views/src/Browser.tsx +++ b/packages/@uppy/provider-views/src/Browser.tsx @@ -24,6 +24,7 @@ type BrowserProps = { openFolder: ProviderView['openFolder'] noResultsLabel: string virtualList: boolean + utmSource: string } function Browser(props: BrowserProps) { @@ -38,6 +39,7 @@ function Browser(props: BrowserProps) { openFolder, noResultsLabel, virtualList, + utmSource, } = props const [isShiftKeyPressed, setIsShiftKeyPressed] = useState(false) @@ -88,6 +90,7 @@ function Browser(props: BrowserProps) { i18n={i18n} openFolder={openFolder} file={item} + utmSource={utmSource} /> ) diff --git a/packages/@uppy/provider-views/src/Item/index.tsx b/packages/@uppy/provider-views/src/Item/index.tsx index 094bbbf655..b94e84d3cd 100644 --- a/packages/@uppy/provider-views/src/Item/index.tsx +++ b/packages/@uppy/provider-views/src/Item/index.tsx @@ -18,10 +18,19 @@ type ItemProps = { viewType: string showTitles: boolean i18n: I18n + utmSource: string } export default function Item(props: ItemProps): h.JSX.Element { - const { viewType, toggleCheckbox, showTitles, i18n, openFolder, file } = props + const { + viewType, + toggleCheckbox, + showTitles, + i18n, + openFolder, + file, + utmSource, + } = props const restrictionError = file.type === 'folder' ? null : file.restrictionError const isDisabled = !!restrictionError && file.status !== 'checked' @@ -30,6 +39,7 @@ export default function Item(props: ItemProps): h.JSX.Element { file, openFolder, toggleCheckbox, + utmSource, i18n, viewType, @@ -54,7 +64,7 @@ export default function Item(props: ItemProps): h.JSX.Element { return ( { viewType: 'list' | 'grid' | 'unsplash' showTitles: boolean showFilter: boolean + utmSource?: string } type PassedOpts = Optional< Opts, @@ -93,6 +94,7 @@ export default class SearchProviderView { viewType: 'grid', showTitles: true, showFilter: true, + utmSource: 'Companion', } this.opts = { ...defaultOptions, ...opts } @@ -334,6 +336,7 @@ export default class SearchProviderView { isLoading={loading} i18n={i18n} virtualList={false} + utmSource={this.opts.utmSource} /> extends UIPlugin @@ -91,6 +91,7 @@ export default class Unsplash provider: this.provider, viewType: 'unsplash', showFilter: true, + utmSource: this.opts.utmSource, }) const { target } = this.opts