@orangelogic/orange-dam-content-browser-sdk 2.3.5 → 2.3.6-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.mjs CHANGED
@@ -5933,6 +5933,7 @@ let CxContentBrowserBrowser = class extends CortexElement {
5933
5933
  this.minQueryLength = 2;
5934
5934
  this.token = "";
5935
5935
  this.baseUrl = "";
5936
+ this.useSiteSession = false;
5936
5937
  this.searchTerm = "";
5937
5938
  this.isPersistent = false;
5938
5939
  this.collectionsOpen = false;
@@ -6125,6 +6126,7 @@ let CxContentBrowserBrowser = class extends CortexElement {
6125
6126
  selected-label=${o$5(this.folderTitle || void 0)}
6126
6127
  auto-page-size
6127
6128
  .token=${this.token}
6129
+ .api=${this.useSiteSession ? apiGetFolders : E}
6128
6130
  .baseUrl=${this.baseUrl}
6129
6131
  .form=${this.closest("form")}
6130
6132
  .firstFetchCallback=${this.handleFirstFetchCallback}
@@ -6226,6 +6228,9 @@ __decorateClass$g([
6226
6228
  __decorateClass$g([
6227
6229
  n$6({ attribute: "base-url", type: String })
6228
6230
  ], CxContentBrowserBrowser.prototype, "baseUrl", 2);
6231
+ __decorateClass$g([
6232
+ n$6({ attribute: "use-site-session", type: Boolean })
6233
+ ], CxContentBrowserBrowser.prototype, "useSiteSession", 2);
6229
6234
  __decorateClass$g([
6230
6235
  r$6()
6231
6236
  ], CxContentBrowserBrowser.prototype, "searchTerm", 2);
@@ -13625,6 +13630,26 @@ function apiGetContentBrowserParameters() {
13625
13630
  }
13626
13631
  });
13627
13632
  }
13633
+ const SITE_SESSION_EXPIRED_MESSAGE = "Your Cortex site session has expired. Sign in to the site and reopen the content browser.";
13634
+ const resolveSiteSessionUrl = (baseUrl) => {
13635
+ const url = new URL(baseUrl || window.location.origin, window.location.origin);
13636
+ if (!["http:", "https:"].includes(url.protocol) || url.origin !== window.location.origin || url.username || url.password || url.search || url.hash) {
13637
+ throw new Error("Site session mode requires an HTTP(S) baseUrl on the current page origin, without credentials, query, or fragment.");
13638
+ }
13639
+ return url.href.replace(/\/$/, "");
13640
+ };
13641
+ const getSiteSessionRequestUrl = (baseUrl, resource) => {
13642
+ const url = new URL(resource, `${resolveSiteSessionUrl(baseUrl)}/`);
13643
+ if (url.origin !== window.location.origin || url.username || url.password) {
13644
+ throw new Error("Site session requests must use the current page origin.");
13645
+ }
13646
+ for (const key of Array.from(url.searchParams.keys())) {
13647
+ if (["token", "usesession"].includes(key.toLowerCase())) {
13648
+ url.searchParams.delete(key);
13649
+ }
13650
+ }
13651
+ return url.href;
13652
+ };
13628
13653
  var nativeMin = Math.min;
13629
13654
  function baseIntersection(arrays, iteratee, comparator) {
13630
13655
  var includes = arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
@@ -13748,7 +13773,8 @@ class FetchAndMergeAssetsController {
13748
13773
  defaultSortDirection,
13749
13774
  defaultSortOrderName,
13750
13775
  token: token2,
13751
- useSession
13776
+ useSession,
13777
+ useSiteSession = false
13752
13778
  }) {
13753
13779
  __privateAdd(this, _lastGetDataParameters);
13754
13780
  __privateAdd(this, _lastMappedAvailableExtensions);
@@ -13785,10 +13811,23 @@ class FetchAndMergeAssetsController {
13785
13811
  this.defaultSelectedFacets = defaultSelectedFacets;
13786
13812
  this.defaultSortOrderName = defaultSortOrderName;
13787
13813
  this.defaultSortDirection = defaultSortDirection;
13788
- this.token = token2;
13789
- this.useSession = useSession;
13790
- http.defaults.baseURL = baseUrl;
13814
+ this.applyTransportMode(useSiteSession, baseUrl, token2, useSession);
13791
13815
  this.requestInterceptorId = http.interceptors.request.use((config) => {
13816
+ var _a3;
13817
+ if (this.useSiteSession) {
13818
+ config.baseURL = this.baseUrl;
13819
+ config.url = getSiteSessionRequestUrl(this.baseUrl, (_a3 = config.url) != null ? _a3 : "");
13820
+ config.withCredentials = true;
13821
+ config.auth = void 0;
13822
+ ["Authorization", "Token", "UseSession"].forEach((name) => config.headers.delete(name));
13823
+ config.params = __spreadValues({}, config.params);
13824
+ for (const key of Object.keys(config.params)) {
13825
+ if (["token", "usesession"].includes(key.toLowerCase())) {
13826
+ delete config.params[key];
13827
+ }
13828
+ }
13829
+ return config;
13830
+ }
13792
13831
  if (config.url && ![
13793
13832
  AssetApiEndpoint.GET_AVAILABLE_EXTENSIONS,
13794
13833
  AssetApiEndpoint.GET_ASSET_VERSION_HISTORY,
@@ -13807,8 +13846,8 @@ class FetchAndMergeAssetsController {
13807
13846
  ].includes(config.url.split("?")[0])) {
13808
13847
  return config;
13809
13848
  }
13810
- if (baseUrl) {
13811
- config.baseURL = baseUrl;
13849
+ if (this.baseUrl) {
13850
+ config.baseURL = this.baseUrl;
13812
13851
  }
13813
13852
  config.params = __spreadProps(__spreadValues({}, config.params), {
13814
13853
  Token: this.token || void 0,
@@ -13818,16 +13857,21 @@ class FetchAndMergeAssetsController {
13818
13857
  });
13819
13858
  this.responseInterceptorId = http.interceptors.response.use(
13820
13859
  (response) => {
13821
- if (response.status >= 200 && response.status < 300 && !this.isLoggedIn) {
13860
+ if (!this.useSiteSession && response.status >= 200 && response.status < 300 && !this.isLoggedIn) {
13822
13861
  this.isLoggedIn = true;
13823
13862
  this.host.requestUpdate();
13824
13863
  }
13825
13864
  return response;
13826
13865
  },
13827
13866
  (error) => __async(this, null, function* () {
13828
- var _a3;
13867
+ var _a3, _b3;
13868
+ if (this.useSiteSession && ((_a3 = error == null ? void 0 : error.response) == null ? void 0 : _a3.status) === 401) {
13869
+ this.isLoggedIn = false;
13870
+ this.host.requestUpdate();
13871
+ return Promise.reject(error);
13872
+ }
13829
13873
  const originalConfig = error == null ? void 0 : error.config;
13830
- if (((_a3 = error == null ? void 0 : error.response) == null ? void 0 : _a3.status) === 401 && originalConfig && !originalConfig._retry) {
13874
+ if (((_b3 = error == null ? void 0 : error.response) == null ? void 0 : _b3.status) === 401 && originalConfig && !originalConfig._retry) {
13831
13875
  originalConfig._retry = true;
13832
13876
  const newToken = yield this.waitForNewToken();
13833
13877
  if (!newToken) {
@@ -13858,7 +13902,43 @@ class FetchAndMergeAssetsController {
13858
13902
  }
13859
13903
  return this.pendingTokenRefresh;
13860
13904
  }
13905
+ /**
13906
+ * Site-session mode decides the transport (cookies on the Cortex origin vs. Token/UseSession
13907
+ * params), so it has to be applied to the interceptor state and base URL, not just captured once.
13908
+ */
13909
+ applyTransportMode(useSiteSession, baseUrl, token2, useSession) {
13910
+ this.useSiteSession = useSiteSession;
13911
+ this.baseUrl = useSiteSession ? resolveSiteSessionUrl(baseUrl) : baseUrl;
13912
+ this.token = useSiteSession ? "" : token2;
13913
+ this.useSession = useSiteSession ? "" : useSession;
13914
+ http.defaults.baseURL = this.baseUrl;
13915
+ }
13916
+ /**
13917
+ * `setSiteSession(...)` can flip the mode while the host stays mounted, so keep the transport in
13918
+ * step with the UI instead of serving requests through the mode the controller was built with.
13919
+ */
13920
+ updateSiteSession(useSiteSession, baseUrl, token2, useSession) {
13921
+ if (useSiteSession === this.useSiteSession) {
13922
+ return;
13923
+ }
13924
+ this.applyTransportMode(useSiteSession, baseUrl, token2, useSession);
13925
+ if (this.resolvePendingTokenRefresh) {
13926
+ this.resolvePendingTokenRefresh(null);
13927
+ this.pendingTokenRefresh = null;
13928
+ this.resolvePendingTokenRefresh = null;
13929
+ }
13930
+ this.isLoggedIn = true;
13931
+ __privateSet(this, _hasFetchedOnce, false);
13932
+ this.fetchInitialData();
13933
+ if (this.lastRequest) {
13934
+ this.fetchAndMergeAssets(this.lastRequest);
13935
+ }
13936
+ this.host.requestUpdate();
13937
+ }
13861
13938
  updateAuth(token2, useSession) {
13939
+ if (this.useSiteSession) {
13940
+ return;
13941
+ }
13862
13942
  const tokenChanged = this.token !== token2;
13863
13943
  const wasLoggedOut = !this.isLoggedIn;
13864
13944
  this.token = token2;
@@ -14028,8 +14108,8 @@ class FetchAndMergeAssetsController {
14028
14108
  }
14029
14109
  fetchAssetByID(id, options) {
14030
14110
  return __async(this, null, function* () {
14031
- var _a2, _b2, _c2, _d2, _e3, _f2, _g, _h, _i, _j, _k, _l, _m, _n;
14032
- const { allowedExtensions = [], canFavorite = false } = options != null ? options : {};
14111
+ var _a2, _b2, _c2, _d2, _e3, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o;
14112
+ const { allowedExtensions = [], canFavorite = false, simplePick = false } = options != null ? options : {};
14033
14113
  const promises = [
14034
14114
  apiGetAssetsByIDs({
14035
14115
  extraFields: [
@@ -14049,7 +14129,9 @@ class FetchAndMergeAssetsController {
14049
14129
  ],
14050
14130
  recordIds: [id]
14051
14131
  }),
14052
- apiGetAvailableProxies({
14132
+ // Simple-pick mode never offers a proxy or a transformation, so the only thing this response
14133
+ // would still supply is the preview image -- which getcontent already returns as LargeSizePreview.
14134
+ simplePick ? Promise.resolve(void 0) : apiGetAvailableProxies({
14053
14135
  assetRecordId: id
14054
14136
  })
14055
14137
  ];
@@ -14080,15 +14162,15 @@ class FetchAndMergeAssetsController {
14080
14162
  inColdStorage: Boolean(item.inColdStorage),
14081
14163
  name: (_f2 = item[FIELD_TITLE_WITH_FALLBACK]) != null ? _f2 : "",
14082
14164
  originalUrl: (_g = item[ORIGINAL_VIEW_SIZE]) != null ? _g : "",
14083
- previewUrl: (_h = proxyData == null ? void 0 : proxyData.previewUrl) != null ? _h : "",
14084
- recordId: (_i = item[FIELD_RECORD_ID]) != null ? _i : "",
14085
- scrubUrl: (_j = item[FIELD_SCRUB_URL]) != null ? _j : "",
14086
- size: (_k = item[FIELD_FILE_SIZE]) != null ? _k : "0 MB",
14087
- tags: (_l = item[FIELD_KEYWORDS]) != null ? _l : "",
14088
- width: (_m = item[FIELD_MAX_WIDTH]) != null ? _m : "0"
14165
+ previewUrl: (_i = (_h = proxyData == null ? void 0 : proxyData.previewUrl) != null ? _h : item[DEFAULT_VIEW_SIZE]) != null ? _i : "",
14166
+ recordId: (_j = item[FIELD_RECORD_ID]) != null ? _j : "",
14167
+ scrubUrl: (_k = item[FIELD_SCRUB_URL]) != null ? _k : "",
14168
+ size: (_l = item[FIELD_FILE_SIZE]) != null ? _l : "0 MB",
14169
+ tags: (_m = item[FIELD_KEYWORDS]) != null ? _m : "",
14170
+ width: (_n = item[FIELD_MAX_WIDTH]) != null ? _n : "0"
14089
14171
  },
14090
14172
  isFavorite,
14091
- proxies: ((_n = proxyData == null ? void 0 : proxyData.proxies) != null ? _n : []).filter((proxy) => {
14173
+ proxies: ((_o = proxyData == null ? void 0 : proxyData.proxies) != null ? _o : []).filter((proxy) => {
14092
14174
  var _a3;
14093
14175
  if (!allowedExtensions || allowedExtensions.length === 0) {
14094
14176
  return true;
@@ -14135,7 +14217,7 @@ class FetchAndMergeAssetsController {
14135
14217
  return __async(this, null, function* () {
14136
14218
  var _a2;
14137
14219
  const response = yield apiGetAssetLinks(__spreadProps(__spreadValues({}, payload), {
14138
- useSession: (_a2 = payload.useSession) != null ? _a2 : this.useSession
14220
+ useSession: this.useSiteSession ? void 0 : (_a2 = payload.useSession) != null ? _a2 : this.useSession
14139
14221
  }));
14140
14222
  if (!payload.useRepresentative) {
14141
14223
  return response;
@@ -14292,10 +14374,12 @@ let CxContentBrowser = class extends CortexElement {
14292
14374
  this.showFavoriteFolder = false;
14293
14375
  this.showCloseButton = false;
14294
14376
  this.useSession = "";
14377
+ this.useSiteSession = false;
14295
14378
  this.canPin = false;
14296
14379
  this.canFavorite = false;
14297
14380
  this.canPinAsset = false;
14298
14381
  this.canUseProxies = false;
14382
+ this.simplePick = false;
14299
14383
  this.canViewVersions = false;
14300
14384
  this.canTrack = false;
14301
14385
  this.canLogout = false;
@@ -14348,6 +14432,9 @@ let CxContentBrowser = class extends CortexElement {
14348
14432
  }
14349
14433
  }
14350
14434
  runFirstUpdated() {
14435
+ if (this.useSiteSession) {
14436
+ this.baseUrl = resolveSiteSessionUrl(this.baseUrl);
14437
+ }
14351
14438
  switch (this.view) {
14352
14439
  case GridView$1.Large:
14353
14440
  this.defaultPageSize = 15;
@@ -14378,7 +14465,8 @@ let CxContentBrowser = class extends CortexElement {
14378
14465
  defaultSortDirection: this.defaultSortDirection,
14379
14466
  defaultSortOrderName: this.defaultSortOrderName,
14380
14467
  token: this.token,
14381
- useSession: this.useSession
14468
+ useSession: this.useSession,
14469
+ useSiteSession: this.useSiteSession
14382
14470
  });
14383
14471
  this.requestUpdate();
14384
14472
  });
@@ -14410,7 +14498,8 @@ let CxContentBrowser = class extends CortexElement {
14410
14498
  this.selectedAssetId = id;
14411
14499
  try {
14412
14500
  const asset = yield this.fetchAndMergeAssetsController.fetchAssetByID(id, {
14413
- canFavorite: this.canFavorite
14501
+ canFavorite: this.canFavorite,
14502
+ simplePick: this.simplePick
14414
14503
  });
14415
14504
  if (!asset) {
14416
14505
  this.selectedAssetId = void 0;
@@ -14443,6 +14532,18 @@ let CxContentBrowser = class extends CortexElement {
14443
14532
  var _a2;
14444
14533
  (_a2 = this.fetchAndMergeAssetsController) == null ? void 0 : _a2.updateAuth(this.token, this.useSession);
14445
14534
  }
14535
+ handleSiteSessionChange() {
14536
+ var _a2;
14537
+ if (this.useSiteSession) {
14538
+ this.baseUrl = resolveSiteSessionUrl(this.baseUrl);
14539
+ }
14540
+ (_a2 = this.fetchAndMergeAssetsController) == null ? void 0 : _a2.updateSiteSession(
14541
+ this.useSiteSession,
14542
+ this.baseUrl,
14543
+ this.token,
14544
+ this.useSession
14545
+ );
14546
+ }
14446
14547
  handleSortOrderChange(event) {
14447
14548
  return __async(this, null, function* () {
14448
14549
  const { sortDirection, sortOrderName } = event.detail;
@@ -14606,6 +14707,16 @@ let CxContentBrowser = class extends CortexElement {
14606
14707
  }
14607
14708
  handleProxyConfirm(event) {
14608
14709
  return __async(this, null, function* () {
14710
+ var _a2;
14711
+ if (this.simplePick) {
14712
+ this.handleSelectedAsset({
14713
+ asset: event.detail.asset,
14714
+ images: [{ imageUrl: (_a2 = event.detail.asset.imageUrl) != null ? _a2 : "" }],
14715
+ selectedProxyMetadata: event.detail.selectedProxyMetadata
14716
+ });
14717
+ this.formatDialog.hide();
14718
+ return;
14719
+ }
14609
14720
  try {
14610
14721
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14611
14722
  assets: [event.detail.asset],
@@ -14730,13 +14841,16 @@ let CxContentBrowser = class extends CortexElement {
14730
14841
  });
14731
14842
  if (!isLoggedIn) {
14732
14843
  return b`
14844
+ ${n$5(this.useSiteSession && this.showCloseButton, () => b`
14845
+ <cx-content-browser-header show-close-button></cx-content-browser-header>
14846
+ `)}
14733
14847
  <cx-space class="content-browser__message" align-items="center" justify-content="center" spacing="small" direction="vertical">
14734
14848
  <cx-icon name="warning" class="content-browser__message__icon"></cx-icon>
14735
14849
  ${n$5(
14736
- this.errorMessage,
14850
+ this.useSiteSession || this.errorMessage,
14737
14851
  () => b`
14738
14852
  <cx-typography class="content-browser__message__text">
14739
- ${this.errorMessage}
14853
+ ${this.useSiteSession ? SITE_SESSION_EXPIRED_MESSAGE : this.errorMessage}
14740
14854
  </cx-typography>
14741
14855
  `,
14742
14856
  () => A$1
@@ -14753,9 +14867,10 @@ let CxContentBrowser = class extends CortexElement {
14753
14867
  favorite-folder-id=${o$5(userInfo == null ? void 0 : userInfo.favoriteFolderRecordID)}
14754
14868
  folder-id=${o$5(this.lastRequest.folderId || void 0)}
14755
14869
  folder-title=${o$5(this.folderTitle || void 0)}
14756
- token=${this.token}
14870
+ token=${this.useSiteSession ? "" : this.token}
14757
14871
  base-url=${this.baseUrl}
14758
- use-session=${this.useSession}
14872
+ use-session=${this.useSiteSession ? "" : this.useSession}
14873
+ ?use-site-session=${this.useSiteSession}
14759
14874
  ?can-favorite=${this.canFavorite}
14760
14875
  ?can-pin=${this.canPin && this.canPinLayout}
14761
14876
  ?force-overlay=${this.forceOverlay}
@@ -14777,7 +14892,7 @@ let CxContentBrowser = class extends CortexElement {
14777
14892
  avatar=${o$5(userInfo == null ? void 0 : userInfo.avatar)}
14778
14893
  full-name=${o$5(userInfo == null ? void 0 : userInfo.fullName)}
14779
14894
  folder-title=${o$5(this.folderTitle || void 0)}
14780
- ?can-logout=${this.canLogout}
14895
+ ?can-logout=${!this.useSiteSession && this.canLogout}
14781
14896
  ?show-close-button=${this.showCloseButton}
14782
14897
  ></cx-content-browser-header>
14783
14898
  <cx-content-browser-control-bar
@@ -14827,12 +14942,12 @@ let CxContentBrowser = class extends CortexElement {
14827
14942
  cta-text=${this.ctaText}
14828
14943
  cta-text-transform=${this.ctaTextTransform}
14829
14944
  variant=${this.isMobile ? ContentBrowserFormatDialogVariant.Drawer : ContentBrowserFormatDialogVariant.Dialog}
14830
- token=${this.token}
14945
+ token=${this.useSiteSession ? "" : this.token}
14831
14946
  ?can-custom-format=${!!(parameters == null ? void 0 : parameters.ATSEnabled)}
14832
14947
  ?can-favorite=${this.canFavorite}
14833
14948
  ?can-pin-asset=${this.canPinAsset}
14834
14949
  ?can-track=${this.canTrack}
14835
- ?can-use-proxies=${this.canUseProxies}
14950
+ ?can-use-proxies=${this.canUseProxies && !this.simplePick}
14836
14951
  ?can-view-versions=${this.canViewVersions}
14837
14952
  @cx-content-browser-format-dialog-version-history-open=${this.handleVersionHistoryOpen}
14838
14953
  @cx-content-browser-format-dialog-favorite-change=${this.handleFavoriteChange}
@@ -14930,6 +15045,9 @@ __decorateClass([
14930
15045
  __decorateClass([
14931
15046
  n$6({ attribute: "use-session", reflect: false, type: String })
14932
15047
  ], CxContentBrowser.prototype, "useSession", 2);
15048
+ __decorateClass([
15049
+ n$6({ attribute: "use-site-session", type: Boolean })
15050
+ ], CxContentBrowser.prototype, "useSiteSession", 2);
14933
15051
  __decorateClass([
14934
15052
  n$6({ attribute: "can-pin", reflect: true, type: Boolean })
14935
15053
  ], CxContentBrowser.prototype, "canPin", 2);
@@ -14942,6 +15060,9 @@ __decorateClass([
14942
15060
  __decorateClass([
14943
15061
  n$6({ attribute: "can-use-proxies", reflect: true, type: Boolean })
14944
15062
  ], CxContentBrowser.prototype, "canUseProxies", 2);
15063
+ __decorateClass([
15064
+ n$6({ attribute: "simple-pick", reflect: true, type: Boolean })
15065
+ ], CxContentBrowser.prototype, "simplePick", 2);
14945
15066
  __decorateClass([
14946
15067
  n$6({ attribute: "can-view-versions", reflect: true, type: Boolean })
14947
15068
  ], CxContentBrowser.prototype, "canViewVersions", 2);
@@ -15040,6 +15161,9 @@ __decorateClass([
15040
15161
  __decorateClass([
15041
15162
  watch(["token", "useSession"], { waitUntilFirstUpdate: true })
15042
15163
  ], CxContentBrowser.prototype, "handleAuthChange", 1);
15164
+ __decorateClass([
15165
+ watch("useSiteSession", { waitUntilFirstUpdate: true })
15166
+ ], CxContentBrowser.prototype, "handleSiteSessionChange", 1);
15043
15167
  CxContentBrowser = __decorateClass([
15044
15168
  customElement("cx-content-browser")
15045
15169
  ], CxContentBrowser);
@@ -29208,6 +29332,7 @@ const GlobalConfigContext = reactExports.createContext({
29208
29332
  allowLogout: true,
29209
29333
  allowTracking: true,
29210
29334
  allowProxy: false,
29335
+ simplePick: false,
29211
29336
  allowFavorites: false,
29212
29337
  allowPin: false,
29213
29338
  allowFormatDialogPin: false,
@@ -31608,6 +31733,9 @@ class Mutex {
31608
31733
  const mutex = new Mutex();
31609
31734
  const refreshAccessToken = () => __async(null, null, function* () {
31610
31735
  var _a2;
31736
+ if (store.getState()[AUTH_FEATURE_KEY].useSiteSession) {
31737
+ return null;
31738
+ }
31611
31739
  yield mutex.waitForUnlock();
31612
31740
  if (mutex.isLocked()) {
31613
31741
  yield mutex.waitForUnlock();
@@ -31616,12 +31744,18 @@ const refreshAccessToken = () => __async(null, null, function* () {
31616
31744
  const release = yield mutex.acquire();
31617
31745
  try {
31618
31746
  const authState = store.getState()[AUTH_FEATURE_KEY];
31747
+ if (authState.useSiteSession) {
31748
+ return null;
31749
+ }
31619
31750
  if (!authState.accessKey || !authState.siteUrl) {
31620
31751
  store.dispatch(logout());
31621
31752
  return null;
31622
31753
  }
31623
31754
  try {
31624
31755
  const tokenResp = yield getAccessTokenService(authState.accessKey);
31756
+ if (store.getState()[AUTH_FEATURE_KEY].useSiteSession) {
31757
+ return null;
31758
+ }
31625
31759
  if (tokenResp.accessToken) {
31626
31760
  store.dispatch(setAccessToken(tokenResp.accessToken));
31627
31761
  return tokenResp.accessToken;
@@ -31629,7 +31763,9 @@ const refreshAccessToken = () => __async(null, null, function* () {
31629
31763
  store.dispatch(logout());
31630
31764
  return null;
31631
31765
  } catch (e2) {
31632
- store.dispatch(logout());
31766
+ if (!store.getState()[AUTH_FEATURE_KEY].useSiteSession) {
31767
+ store.dispatch(logout());
31768
+ }
31633
31769
  return null;
31634
31770
  }
31635
31771
  } finally {
@@ -31662,6 +31798,14 @@ const fetchWithTimeout = (resource, options) => __async(null, null, function* ()
31662
31798
  const cortexFetch = (resource, options) => __async(null, null, function* () {
31663
31799
  const { retryWhenUnauthorize = true } = options || {};
31664
31800
  const authState = store.getState()[AUTH_FEATURE_KEY];
31801
+ if (authState.useSiteSession) {
31802
+ const headers = new Headers(options == null ? void 0 : options.headers);
31803
+ ["Authorization", "Token", "UseSession"].forEach((name) => headers.delete(name));
31804
+ return fetchWithTimeout(getSiteSessionRequestUrl(authState.siteUrl, resource), __spreadProps(__spreadValues({}, options), {
31805
+ credentials: "same-origin",
31806
+ headers
31807
+ }));
31808
+ }
31665
31809
  resource = getRequestUrl(authState.siteUrl, resource, authState.accessToken);
31666
31810
  const response = yield fetchWithTimeout(resource, options);
31667
31811
  if (retryWhenUnauthorize && !response.ok && response.status === 401) {
@@ -31740,6 +31884,14 @@ const authSlice = createSlice({
31740
31884
  name: AUTH_FEATURE_KEY,
31741
31885
  initialState,
31742
31886
  reducers: {
31887
+ setSiteSession: (state, action) => {
31888
+ if (action.payload !== void 0) {
31889
+ return __spreadProps(__spreadValues({}, initialState), { useSiteSession: true, siteUrl: action.payload, status: "authenticated" });
31890
+ }
31891
+ if (state.useSiteSession) {
31892
+ return __spreadValues({}, initialState);
31893
+ }
31894
+ },
31743
31895
  setAccessToken: (state, action) => {
31744
31896
  state.accessToken = action.payload;
31745
31897
  },
@@ -31799,6 +31951,7 @@ const authSlice = createSlice({
31799
31951
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
31800
31952
  oAuth.fulfilled,
31801
31953
  (state, { payload }) => {
31954
+ if (state.useSiteSession) return;
31802
31955
  if (payload) {
31803
31956
  const { accessKey, accessToken, siteUrl } = payload;
31804
31957
  state.accessKey = accessKey;
@@ -31810,16 +31963,18 @@ const authSlice = createSlice({
31810
31963
  }
31811
31964
  }
31812
31965
  ).addCase(oAuth.rejected, (state, action) => {
31966
+ if (state.useSiteSession) return;
31813
31967
  state.error = action.payload;
31814
31968
  state.status = "unauthenticated";
31815
31969
  deleteData(AUTH_FEATURE_ACCESS_KEY_KEY);
31816
31970
  }).addCase(oAuth.pending, (state) => {
31971
+ if (state.useSiteSession) return;
31817
31972
  state.error = "";
31818
31973
  });
31819
31974
  }
31820
31975
  });
31821
31976
  const authReducer = authSlice.reducer;
31822
- const { logout, setAccessToken, generateNonce, setSiteUrl, setUserConfigSiteUrl, setUseSession, setUseHeaders, setAuthStatus } = authSlice.actions;
31977
+ const { logout, setAccessToken, generateNonce, setSiteUrl, setUserConfigSiteUrl, setUseSession, setUseHeaders, setAuthStatus, setSiteSession } = authSlice.actions;
31823
31978
  const authenticatedSelector = (rootState) => rootState[AUTH_FEATURE_KEY].status == "authenticated";
31824
31979
  const accessTokenSelector = (rootState) => rootState[AUTH_FEATURE_KEY].accessToken;
31825
31980
  const siteUrlSelector = (rootState) => rootState[AUTH_FEATURE_KEY].siteUrl;
@@ -31829,6 +31984,7 @@ const nonceSelector = (rootState) => rootState[AUTH_FEATURE_KEY].nonce;
31829
31984
  const authStateSelector = (rootState) => rootState[AUTH_FEATURE_KEY].status;
31830
31985
  const applySessionSelector = (rootState) => rootState[AUTH_FEATURE_KEY].useSession;
31831
31986
  const applyHeadersSelector = (rootState) => !!rootState[AUTH_FEATURE_KEY].useHeaders;
31987
+ const siteSessionSelector = (rootState) => !!rootState[AUTH_FEATURE_KEY].useSiteSession;
31832
31988
  const appAuthUrlSelector = (rootState) => {
31833
31989
  const siteUrl = rootState[AUTH_FEATURE_KEY].siteUrl;
31834
31990
  return siteUrl ? getRequestUrl(siteUrl, `AppAuth?RID=${rootState[AUTH_FEATURE_KEY].nonce}`) : "";
@@ -31848,7 +32004,7 @@ const oAuth = createAsyncThunk(
31848
32004
  dispatch(generateNonce());
31849
32005
  const nonce = nonceSelector(getState());
31850
32006
  const resp = yield requestAuthorizeService(nonce != null ? nonce : "");
31851
- if (authAbortController.controller.signal.aborted) {
32007
+ if (authAbortController.controller.signal.aborted || siteSessionSelector(getState())) {
31852
32008
  throw Error(CANCEL_AUTH_MESSAGE);
31853
32009
  }
31854
32010
  const requestID = resp.requestID;
@@ -31857,6 +32013,9 @@ const oAuth = createAsyncThunk(
31857
32013
  if (callbackFn) callbackFn(popupUrl);
31858
32014
  else window.open(popupUrl, "_blank");
31859
32015
  const getAccessKeyData = yield getAccessKeyService(requestID);
32016
+ if (siteSessionSelector(getState())) {
32017
+ throw Error(CANCEL_AUTH_MESSAGE);
32018
+ }
31860
32019
  if (getAccessKeyData.accessKey) {
31861
32020
  const tokenResp = yield getAccessTokenService(getAccessKeyData.accessKey);
31862
32021
  if (tokenResp.accessToken) {
@@ -31890,12 +32049,15 @@ const oAuth = createAsyncThunk(
31890
32049
  const initAuthInfoFromCache = createAsyncThunk(
31891
32050
  `${AUTH_FEATURE_KEY}/initAuthInfoFromCache`,
31892
32051
  (_0, _1) => __async(null, [_0, _1], function* (_2, { dispatch, rejectWithValue, getState }) {
32052
+ const usingSiteSession = () => siteSessionSelector(getState());
32053
+ if (usingSiteSession()) return;
31893
32054
  dispatch(authSlice.actions.setAuthStatus("restoreSession"));
31894
32055
  const useHeaders = applyHeadersSelector(getState());
31895
32056
  const execute = () => __async(null, null, function* () {
31896
32057
  var _a2, _b2, _c2, _d2;
31897
32058
  if (useHeaders && ((_a2 = window.OrangeDAMContentBrowser) == null ? void 0 : _a2._onRequestToken)) {
31898
32059
  const result = yield (_b2 = window.OrangeDAMContentBrowser) == null ? void 0 : _b2._onRequestToken();
32060
+ if (usingSiteSession()) return true;
31899
32061
  if (result) {
31900
32062
  dispatch(
31901
32063
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -31912,6 +32074,7 @@ const initAuthInfoFromCache = createAsyncThunk(
31912
32074
  let siteUrl = siteUrlSelector(getState());
31913
32075
  if (!siteUrl) {
31914
32076
  siteUrl = (_c2 = yield getData(AUTH_FEATURE_SITE_URL_KEY)) != null ? _c2 : "";
32077
+ if (usingSiteSession()) return true;
31915
32078
  if (!siteUrl) {
31916
32079
  siteUrl = (_d2 = userConfigSiteUrlSelector(getState())) != null ? _d2 : "";
31917
32080
  }
@@ -31923,6 +32086,7 @@ const initAuthInfoFromCache = createAsyncThunk(
31923
32086
  return false;
31924
32087
  }
31925
32088
  const accessKey = yield getData(AUTH_FEATURE_ACCESS_KEY_KEY);
32089
+ if (usingSiteSession()) return true;
31926
32090
  if (accessKey) {
31927
32091
  if (useHeaders) {
31928
32092
  dispatch(
@@ -31933,6 +32097,7 @@ const initAuthInfoFromCache = createAsyncThunk(
31933
32097
  );
31934
32098
  } else {
31935
32099
  const accessToken = (yield getAccessTokenService(accessKey)).accessToken;
32100
+ if (usingSiteSession()) return true;
31936
32101
  if (accessToken) {
31937
32102
  dispatch(
31938
32103
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
@@ -31960,7 +32125,7 @@ const initAuthInfoFromCache = createAsyncThunk(
31960
32125
  } catch (exception) {
31961
32126
  return rejectWithValue(exception.message);
31962
32127
  } finally {
31963
- if (!isSuccess) {
32128
+ if (!isSuccess && !usingSiteSession()) {
31964
32129
  dispatch(logout());
31965
32130
  }
31966
32131
  }
@@ -32019,6 +32184,7 @@ function parseLegacyLastLocation(lastLocation) {
32019
32184
  const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToken, siteUrl, multiSelect }, ref) {
32020
32185
  const appDispatch = useAppDispatch();
32021
32186
  const useSession = useAppSelector(applySessionSelector);
32187
+ const useSiteSession = useAppSelector(siteSessionSelector);
32022
32188
  const {
32023
32189
  allowFavorites,
32024
32190
  allowFormatDialogPin,
@@ -32026,6 +32192,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32026
32192
  allowPin,
32027
32193
  allowProxy,
32028
32194
  allowTracking,
32195
+ simplePick,
32029
32196
  allowedExtensions,
32030
32197
  // list of allowed extensions from runtime properties. e.g. ['.jpg', '.png', '.mp4']
32031
32198
  allowedFolders,
@@ -32265,6 +32432,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32265
32432
  token: accessToken != null ? accessToken : "",
32266
32433
  "base-url": siteUrl != null ? siteUrl : "",
32267
32434
  "use-session": useSession,
32435
+ "use-site-session": useSiteSession,
32268
32436
  "extra-fields": extraFields,
32269
32437
  "error-message": "Unauthorized",
32270
32438
  "can-pin": allowPin,
@@ -32272,6 +32440,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32272
32440
  "can-favorite": allowFavorites,
32273
32441
  "can-logout": allowLogout,
32274
32442
  "can-use-proxies": allowProxy,
32443
+ "simple-pick": simplePick,
32275
32444
  "can-track": allowTracking,
32276
32445
  "can-view-versions": showVersions,
32277
32446
  "cta-text": ctaText,
@@ -32965,6 +33134,7 @@ const ContentBrowser = {
32965
33134
  allowLogout,
32966
33135
  allowProxy,
32967
33136
  allowTracking,
33137
+ simplePick,
32968
33138
  availableDocTypes,
32969
33139
  availableRepresentativeSubtypes,
32970
33140
  baseUrl,
@@ -32988,9 +33158,11 @@ const ContentBrowser = {
32988
33158
  showFavoriteFolder,
32989
33159
  showVersions,
32990
33160
  useSession,
33161
+ useSiteSession = false,
32991
33162
  defaultGridView
32992
33163
  }) {
32993
33164
  var _a2;
33165
+ const siteSessionUrl = useSiteSession ? resolveSiteSessionUrl(baseUrl) : void 0;
32994
33166
  const customStorageHandlers = typeof customStorage === "object" && !!customStorage && typeof customStorage.delete === "function" && !!customStorage.delete && typeof customStorage.get === "function" && !!customStorage.get && typeof customStorage.set === "function" && !!customStorage.set ? customStorage : void 0;
32995
33167
  window.OrangeDAMContentBrowser._customStorage = customStorageHandlers;
32996
33168
  let container = containerId && document.getElementById(containerId);
@@ -33015,23 +33187,28 @@ const ContentBrowser = {
33015
33187
  container.appendChild(pickerRoot);
33016
33188
  }
33017
33189
  const root2 = clientExports.createRoot(pickerRoot);
33018
- if (onRequestToken) {
33190
+ window.OrangeDAMContentBrowser._onRequestToken = void 0;
33191
+ if (!useSiteSession && onRequestToken) {
33019
33192
  window.OrangeDAMContentBrowser._onRequestToken = () => {
33020
33193
  return onRequestToken().then((token2) => {
33021
33194
  return { token: token2, siteUrl: baseUrl };
33022
33195
  });
33023
33196
  };
33024
33197
  }
33025
- if (baseUrl) {
33026
- store.dispatch(setUserConfigSiteUrl(baseUrl));
33198
+ if (useSiteSession) {
33199
+ abortAuthService();
33027
33200
  }
33028
- if (onRequestToken) {
33029
- store.dispatch(setUseHeaders(true));
33201
+ store.dispatch(setSiteSession(siteSessionUrl));
33202
+ if (!useSiteSession && baseUrl) {
33203
+ store.dispatch(setUserConfigSiteUrl(baseUrl));
33030
33204
  }
33031
- if (useSession) {
33205
+ store.dispatch(setUseHeaders(!useSiteSession && !!onRequestToken));
33206
+ if (!useSiteSession && useSession) {
33032
33207
  store.dispatch(setUseSession(useSession));
33033
33208
  }
33034
- store.dispatch(initAuthInfoFromCache());
33209
+ if (!useSiteSession) {
33210
+ store.dispatch(initAuthInfoFromCache());
33211
+ }
33035
33212
  const errorHandler = typeof onError === "function" && !!onError ? onError : console.log;
33036
33213
  const assetActionHandler = typeof onAssetAction === "function" && !!onAssetAction ? onAssetAction : () => {
33037
33214
  };
@@ -33082,12 +33259,13 @@ const ContentBrowser = {
33082
33259
  showCollections: !!showCollections,
33083
33260
  showFavoriteFolder: showFavoriteFolder !== false,
33084
33261
  showVersions: !!showVersions,
33085
- useSession,
33262
+ useSession: useSiteSession ? void 0 : useSession,
33086
33263
  allowPin: !!allowPin,
33087
33264
  allowFormatDialogPin: !!allowFormatDialogPin,
33088
- allowLogout: allowLogout !== void 0 ? !!allowLogout : true,
33265
+ allowLogout: !useSiteSession && (allowLogout !== void 0 ? !!allowLogout : true),
33089
33266
  allowTracking: allowTracking !== void 0 ? !!allowTracking : true,
33090
- allowProxy: allowProxy !== void 0 ? !!allowProxy : true,
33267
+ allowProxy: simplePick ? false : allowProxy !== void 0 ? !!allowProxy : true,
33268
+ simplePick: !!simplePick,
33091
33269
  allowFavorites: !!allowFavorites,
33092
33270
  defaultGridView: defaultGridView != null ? defaultGridView : ""
33093
33271
  },