@orangelogic/orange-dam-content-browser-sdk 2.3.1 → 2.3.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.
@@ -2457,7 +2457,7 @@
2457
2457
  font-size: clamp(1rem, 2cqw, 3rem);
2458
2458
  }
2459
2459
  }
2460
- `,Cne=({onCancel:e})=>{const t=vne();return f5.useEffect(()=>{Dte(Tte).then(e=>{e&&t(ine(e))}).catch(()=>{})}),K.jsx(_ne,{onCancel:e,children:K.jsx(Ene,{variant:"h4",children:"Trying to restore your previous session"})})},Sne=({onCancel:e})=>{const t=yne(lne);return K.jsx(_ne,{onCancel:e,children:K.jsxs(Ene,{variant:"h4",children:["Requesting login url from",K.jsx("cx-typography",{variant:"body1",style:{overflowWrap:"break-word",lineBreak:"anywhere"},children:t})]})})},Tne=({onCancel:e})=>{const t=yne(hne),{pluginInfo:n}=f5.useContext(p9),{onAppAuthUrlCopied:i}=f5.useContext(Z7),r=f5.useRef(null),[o,a]=f5.useState(!1);return f5.useEffect(()=>{customElements.whenDefined("cx-copy-button").then(()=>{a(!0)})},[]),f5.useEffect(()=>{if(!o)return;const e=r.current;e&&(e.writeToClipboard=i)},[o,i]),K.jsxs(_ne,{footer:K.jsxs("cx-space",{spacing:"small",direction:"vertical",children:[K.jsx("cx-typography",{className:"footer__title",variant:"body2",children:K.jsx("span",{style:{fontWeight:"var(--cx-font-weight-semibold)"},children:"I was not redirected automatically?"})}),K.jsx("cx-typography",{variant:"body2",children:"Copy the URL and open it in a new tab"}),K.jsx("br",{}),K.jsx("cx-typography",{variant:"body3",children:K.jsxs("cx-space",{spacing:"3x-small",direction:"horizontal",wrap:"nowrap",alignItems:"center",justifyContent:"center",children:[K.jsx("a",{id:"OL-redirect-url",href:t,target:"_blank",rel:"noopener noreferrer",style:{minWidth:0,flexShrink:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--cx-color-primary-600)"},children:t}),K.jsx("cx-copy-button",{ref:r,size:"small",from:"OL-redirect-url[href]"})]})})]}),onCancel:e,children:[K.jsxs(Ene,{variant:"h4",children:["Please authorize the ",n.pluginName," plugin"]}),K.jsxs("cx-typography",{variant:"body2",children:["You will be automatically redirected to authorize ",n.pluginName," ",n.publicApplicationName?`in ${n.publicApplicationName}`:""]})]})},kne=()=>{const e=vne(),t=yne(une),n=f5.useCallback(()=>{e(pne())},[e]);return f5.useMemo(()=>{switch(t){case"unauthenticated":return K.jsx(xne,{});case"restoreSession":return K.jsx(Cne,{onCancel:n});case"requestLogin":return K.jsx(Sne,{onCancel:n});case"waitForAuthorize":return K.jsx(Tne,{onCancel:n})}},[t,n])},Ine=W7.div`
2460
+ `,Cne=({onCancel:e})=>{const t=vne(),n=yne(dne);return f5.useEffect(()=>{n||Dte(Tte).then(e=>{e&&t(ine(e))}).catch(()=>{})}),K.jsx(_ne,{onCancel:e,children:K.jsx(Ene,{variant:"h4",children:"Trying to restore your previous session"})})},Sne=({onCancel:e})=>{const t=yne(lne);return K.jsx(_ne,{onCancel:e,children:K.jsxs(Ene,{variant:"h4",children:["Requesting login url from",K.jsx("cx-typography",{variant:"body1",style:{overflowWrap:"break-word",lineBreak:"anywhere"},children:t})]})})},Tne=({onCancel:e})=>{const t=yne(hne),{pluginInfo:n}=f5.useContext(p9),{onAppAuthUrlCopied:i}=f5.useContext(Z7),r=f5.useRef(null),[o,a]=f5.useState(!1);return f5.useEffect(()=>{customElements.whenDefined("cx-copy-button").then(()=>{a(!0)})},[]),f5.useEffect(()=>{if(!o)return;const e=r.current;e&&(e.writeToClipboard=i)},[o,i]),K.jsxs(_ne,{footer:K.jsxs("cx-space",{spacing:"small",direction:"vertical",children:[K.jsx("cx-typography",{className:"footer__title",variant:"body2",children:K.jsx("span",{style:{fontWeight:"var(--cx-font-weight-semibold)"},children:"I was not redirected automatically?"})}),K.jsx("cx-typography",{variant:"body2",children:"Copy the URL and open it in a new tab"}),K.jsx("br",{}),K.jsx("cx-typography",{variant:"body3",children:K.jsxs("cx-space",{spacing:"3x-small",direction:"horizontal",wrap:"nowrap",alignItems:"center",justifyContent:"center",children:[K.jsx("a",{id:"OL-redirect-url",href:t,target:"_blank",rel:"noopener noreferrer",style:{minWidth:0,flexShrink:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"var(--cx-color-primary-600)"},children:t}),K.jsx("cx-copy-button",{ref:r,size:"small",from:"OL-redirect-url[href]"})]})})]}),onCancel:e,children:[K.jsxs(Ene,{variant:"h4",children:["Please authorize the ",n.pluginName," plugin"]}),K.jsxs("cx-typography",{variant:"body2",children:["You will be automatically redirected to authorize ",n.pluginName," ",n.publicApplicationName?`in ${n.publicApplicationName}`:""]})]})},kne=()=>{const e=vne(),t=yne(une),n=f5.useCallback(()=>{e(pne())},[e]);return f5.useMemo(()=>{switch(t){case"unauthenticated":return K.jsx(xne,{});case"restoreSession":return K.jsx(Cne,{onCancel:n});case"requestLogin":return K.jsx(Sne,{onCancel:n});case"waitForAuthorize":return K.jsx(Tne,{onCancel:n})}},[t,n])},Ine=W7.div`
2461
2461
  background-color: var(--cx-color-neutral-0);
2462
2462
  display: ${({open:e})=>e?"block":"none"};
2463
2463
  height: 100vh;
@@ -2466,7 +2466,7 @@
2466
2466
  top: 0;
2467
2467
  width: 100vw;
2468
2468
  z-index: var(--cx-z-index-dialog);
2469
- `,Mne=({extraFields:e=[],containerId:t,loadExternalFonts:n=!0,multiSelect:i,onClose:r,onError:o,getPinnedState:a,onAssetAction:s,onAssetSelected:l,onAppAuthUrlCopied:c,onImageSelected:u,onPinAsset:d,onConnectClicked:h,onTokenChanged:p,onUnpinAsset:f,onSiteUrlChanged:m,assetsPickerRef:g})=>{const v=yne(ane),y=yne(sne),b=yne(lne),[A,w]=f5.useState(!0);f5.useEffect(()=>{n?K7.load({google:{families:["Fira Code:400","Fira Mono:400","Fira Sans:300,400,600","Fira Sans Condensed:300,400,600","Fira Sans Extra Condensed:300,400,600"]}}):Promise.resolve().then(()=>iie)},[n]),f5.useEffect(()=>{p&&p(null!=y?y:"")},[y,p]),f5.useEffect(()=>{m&&m(null!=b?b:"")},[b,m]);const x=f5.useCallback(()=>{w(!1),null==r||r()},[r]),_=f5.useMemo(()=>({extraFields:e,getPinnedState:a,onAssetAction:s,onAssetSelected:l,onAppAuthUrlCopied:c,onImageSelected:u,onPinAsset:d,onError:o,onClose:x,onConnectClicked:h,onUnpinAsset:f}),[e,a,s,l,c,u,d,o,x,h,f]);let E=K.jsx(kne,{});if(v){const e=K.jsx(wne,{ref:g,accessToken:y,siteUrl:b,multiSelect:i});E=t?e:K.jsx(Ine,{open:A,children:e})}return K.jsx(Z7.Provider,{value:_,children:K.jsx(f5.Suspense,{fallback:K.jsx("cx-content-browser-loader",{}),children:E})})},Pne=['[aria-modal="true"]',"dialog[open]",".ui-dialog",".modal.show",".modal.in",'[data-focus-lock-disabled="false"]'].join(",");function Rne(e){var t;return null!=(t=e.ownerDocument.defaultView)?t:window}function Bne(e){if(!e||!e.isConnected)return!1;const t=Rne(e);if(!(e instanceof t.HTMLElement))return!1;const n=t.getComputedStyle(e);if("hidden"===n.visibility||"none"===n.display)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function One(e=document){var t;const n=null!=(t=e.defaultView)?t:window,i=e.activeElement,r=i instanceof n.HTMLElement?i.closest(Pne):null,o=r&&Bne(r)&&r||(0===(a=Array.from(e.querySelectorAll(Pne)).filter(Bne)).length?null:a.reduce((e,t)=>{const n=parseInt(Rne(e).getComputedStyle(e).zIndex,10)||0,i=parseInt(Rne(t).getComputedStyle(t).zIndex,10)||0;return i!==n?i>n?t:e:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING?t:e}));var a;return o?function(e){var t;const n=e.ownerDocument,i=null!=(t=n.defaultView)?t:window;let r=e;for(;r&&r!==n.body&&r!==n.documentElement;){const e=i.getComputedStyle(r);if(e.transform&&"none"!==e.transform||e.perspective&&"none"!==e.perspective||e.filter&&"none"!==e.filter||/transform|perspective|filter/.test(e.willChange||"")||/paint|layout|strict|content/.test(e.contain||""))return!0;r=r.parentElement}return!1}(o)?(console.warn("[ContentBrowserSDK] An active modal was detected, but it establishes a CSS containing block that would clip the picker overlay. Falling back to document.body. Pass `containerId` (an element inside the modal) to embed the picker correctly."),null):o:null}globalThis.addEventListener("cx-unauthorized",Vte);const Dne=f5.createRef(),Lne={help:()=>{console.log("/* Orange DAM Content Browser SDK Example */\n window.OrangeDAMContentBrowser.open({\n onAssetSelected: (assets) => {\n // Callback function triggered when assets are selected\n console.log(assets);\n window.open(assets[0]?.imageUrl, '_blank');\n },\n onError: (errorMessage, error) => {\n // Callback function triggered when an error occurs\n console.error(errorMessage, error);\n },\n onClose: () => {\n // Callback function triggered when the browser is closed\n window.alert('Content Browser is closing');\n },\n getPinnedState: (recordId) => {\n // Callback function to get the pinned state of an asset\n return localStorage.getItem(`pinned:${recordId}`) === 'true';\n },\n onPinAsset: async (recordId) => {\n // Callback function triggered when an asset is pinned\n localStorage.setItem(`pinned:${recordId}`, 'true');\n },\n onUnpinAsset: async (recordId) => {\n // Callback function triggered when an asset is unpinned\n localStorage.removeItem(`pinned:${recordId}`);\n },\n containerId: \"\", // ID of the container to attach the browser; opens in a popup if blank\n extraFields: ['coreField.OriginalFileName', 'document.CortexPath'], // Additional fields to retrieve from the assets\n baseUrl: \"\", // Default base URL to pre-fill in the content browser\n displayInfo: {\n title: true, // Whether to display the asset title\n dimension: true, // Whether to display the asset dimensions\n fileSize: false, // Whether to display the file size\n tags: false, // Whether to display the asset tags\n },\n publicApplicationName: \"\", // Public name of the DAM to display on the login screen\n pluginName: \"OrangeDAM Content Browser\", // Name of the plugin to display on the login screen\n ctaText: \"Insert\", // Text to display on the insert button\n ctaTextTransform: \"capitalize\", // Text transform: 'none', 'uppercase', 'lowercase', 'capitalize' (default: 'capitalize')\n persistMode: true, // Whether the browser remains open after selecting an asset\n availableDocTypes: ['Images*', 'Videos*', 'Audio*', 'Others*'], // An array of available OrangeDAM asset types to filter the assets. The available doc types will be configured in OL Platform. If not provided, all doc types will be available. \n availableRepresentativeSubtypes: ['Other'], // Array of supported subtypes for representative images\n showCollections: true, // Whether to show collections in the content browser\n lastLocationMode: true, // Whether to open the last selected folder on load\n allowTracking: true, // Whether to enable tracking parameters for asset URLs\n allowFormatDialogPin: true, // Whether to show pin/unpin actions in format dialog\n });")},open:e=>U(null,[e],function*({onAssetAction:e,getPinnedState:t,onAssetSelected:n,onAppAuthUrlCopied:i,onImageSelected:r,onError:o,onClose:a,onPinAsset:s,onRequestToken:l,onTokenChanged:c,onUnpinAsset:u,onConnectClicked:d,onSiteUrlChanged:h,customStorage:p,allowedExtensions:f,allowedFolders:m,allowFavorites:g,allowFormatDialogPin:v,allowPin:y,allowLogout:b,allowProxy:A,allowTracking:w,availableDocTypes:x,availableRepresentativeSubtypes:_,baseUrl:E,containerId:C,ctaText:S,ctaTextTransform:T,displayInfo:k={title:!0,dimension:!0,fileSize:!1,tags:!1},extraFields:I,lastLocationMode:M,loadExternalFonts:P,multiSelect:R,persistMode:B,pluginName:O,publicApplicationName:D,showCollections:L,showFavoriteFolder:N,showVersions:z,useSession:F,defaultGridView:j}){var H;const Q="object"==typeof p&&p&&"function"==typeof p.delete&&p.delete&&"function"==typeof p.get&&p.get&&"function"==typeof p.set&&p.set?p:void 0;window.OrangeDAMContentBrowser._customStorage=Q;let V=C&&document.getElementById(C);if(C){if(!V)return void console.error(`Container with id ${C} is not found`)}else V=null!=(H=One())?H:document.body;let G=V.querySelector("#cortex-asset-picker-root");G||(G=document.createElement("div"),G.id="cortex-asset-picker-root",G.style.width="100%",G.style.height="100%",G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.position="relative",V.appendChild(G));const W=P5.createRoot(G);l&&(window.OrangeDAMContentBrowser._onRequestToken=()=>l().then(e=>({token:e,siteUrl:E}))),E&&gne.dispatch(nne(E)),l&&gne.dispatch(rne(!0)),gne.dispatch(mne());const q="function"==typeof o&&o?o:console.log,$="function"==typeof e&&e?e:()=>{},X="function"==typeof n&&n?n:()=>{},Y="function"==typeof i&&i?i:e=>U(null,null,function*(){yield navigator.clipboard.writeText(e)}),Z="function"==typeof r&&r?r:()=>{},J="function"==typeof c&&c?c:void 0,ee="function"==typeof t&&t?t:()=>!1,te="function"==typeof s&&s?s:void 0,ne="function"==typeof u&&u?u:void 0,ie=()=>{W.unmount(),window.OrangeDAMContentBrowser._onAssetSelected=void 0,window.OrangeDAMContentBrowser._onImageSelected=void 0,window.OrangeDAMContentBrowser._onError=void 0,window.OrangeDAMContentBrowser._onClose=void 0,window.OrangeDAMContentBrowser._customStorage=void 0,null==a||a()};window.OrangeDAMContentBrowser._onAssetAction=$,window.OrangeDAMContentBrowser._onAssetSelected=X,window.OrangeDAMContentBrowser._onImageSelected=Z,window.OrangeDAMContentBrowser._onError=q,window.OrangeDAMContentBrowser._onClose=ie,W.render(K.jsx(q5,{store:gne,children:K.jsx(p9.Provider,{value:{allowedExtensions:f,allowedFolders:m,availableDocTypes:x,availableRepresentativeSubtypes:_,ctaText:null!=S?S:"Insert",ctaTextTransform:null!=T?T:"capitalize",displayInfo:k,lastLocationMode:void 0===M||!!M,persistMode:!!B,pluginInfo:{publicApplicationName:null!=D?D:"",pluginName:null!=O?O:"OrangeDAM Content Browser"},isContentBrowserPopedup:!C,showCollections:!!L,showFavoriteFolder:!1!==N,showVersions:!!z,useSession:F,allowPin:!!y,allowFormatDialogPin:!!v,allowLogout:void 0===b||!!b,allowTracking:void 0===w||!!w,allowProxy:void 0===A||!!A,allowFavorites:!!g,defaultGridView:null!=j?j:""},children:K.jsx(Mne,{containerId:C,extraFields:I,loadExternalFonts:P,multiSelect:!!R,onError:q,getPinnedState:ee,onAssetAction:$,onAssetSelected:X,onAppAuthUrlCopied:Y,onImageSelected:Z,onPinAsset:te,onClose:ie,onConnectClicked:d,onTokenChanged:J,onUnpinAsset:ne,onSiteUrlChanged:h,assetsPickerRef:Dne})})}))}),close:()=>{var e,t;null==(t=(e=window.OrangeDAMContentBrowser)._onClose)||t.call(e)},fetchAssets:e=>{var t;return null==(t=Dne.current)?void 0:t.fetchAssets(e)},fetchFolders:e=>{var t;return null==(t=Dne.current)?void 0:t.fetchFolders(e)},previewAsset:e=>{var t;return null==(t=Dne.current)?void 0:t.selectAsset(e)}};globalThis.OrangeDAMContentBrowser=Lne;const Nne={svg:as`<svg
2469
+ `,Mne=({extraFields:e=[],containerId:t,loadExternalFonts:n=!0,multiSelect:i,onClose:r,onError:o,getPinnedState:a,onAssetAction:s,onAssetSelected:l,onAppAuthUrlCopied:c,onImageSelected:u,onPinAsset:d,onConnectClicked:h,onTokenChanged:p,onUnpinAsset:f,onSiteUrlChanged:m,assetsPickerRef:g})=>{const v=yne(ane),y=yne(sne),b=yne(lne),[A,w]=f5.useState(!0);f5.useEffect(()=>{n?K7.load({google:{families:["Fira Code:400","Fira Mono:400","Fira Sans:300,400,600","Fira Sans Condensed:300,400,600","Fira Sans Extra Condensed:300,400,600"]}}):Promise.resolve().then(()=>iie)},[n]),f5.useEffect(()=>{p&&p(null!=y?y:"")},[y,p]),f5.useEffect(()=>{m&&m(null!=b?b:"")},[b,m]);const x=f5.useCallback(()=>{w(!1),null==r||r()},[r]),_=f5.useMemo(()=>({extraFields:e,getPinnedState:a,onAssetAction:s,onAssetSelected:l,onAppAuthUrlCopied:c,onImageSelected:u,onPinAsset:d,onError:o,onClose:x,onConnectClicked:h,onUnpinAsset:f}),[e,a,s,l,c,u,d,o,x,h,f]);let E=K.jsx(kne,{});if(v){const e=K.jsx(wne,{ref:g,accessToken:y,siteUrl:b,multiSelect:i});E=t?e:K.jsx(Ine,{open:A,children:e})}return K.jsx(Z7.Provider,{value:_,children:K.jsx(f5.Suspense,{fallback:K.jsx("cx-content-browser-loader",{}),children:E})})},Pne=['[aria-modal="true"]',"dialog[open]",".ui-dialog",".modal.show",".modal.in",'[data-focus-lock-disabled="false"]'].join(",");function Rne(e){var t;return null!=(t=e.ownerDocument.defaultView)?t:window}function Bne(e){if(!e||!e.isConnected)return!1;const t=Rne(e);if(!(e instanceof t.HTMLElement))return!1;const n=t.getComputedStyle(e);if("hidden"===n.visibility||"none"===n.display)return!1;const i=e.getBoundingClientRect();return i.width>0&&i.height>0}function One(e=document){var t;const n=null!=(t=e.defaultView)?t:window,i=e.activeElement,r=i instanceof n.HTMLElement?i.closest(Pne):null,o=r&&Bne(r)&&r||(0===(a=Array.from(e.querySelectorAll(Pne)).filter(Bne)).length?null:a.reduce((e,t)=>{const n=parseInt(Rne(e).getComputedStyle(e).zIndex,10)||0,i=parseInt(Rne(t).getComputedStyle(t).zIndex,10)||0;return i!==n?i>n?t:e:t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING?t:e}));var a;return o?function(e){var t;const n=e.ownerDocument,i=null!=(t=n.defaultView)?t:window;let r=e;for(;r&&r!==n.body&&r!==n.documentElement;){const e=i.getComputedStyle(r);if(e.transform&&"none"!==e.transform||e.perspective&&"none"!==e.perspective||e.filter&&"none"!==e.filter||/transform|perspective|filter/.test(e.willChange||"")||/paint|layout|strict|content/.test(e.contain||""))return!0;r=r.parentElement}return!1}(o)?(console.warn("[ContentBrowserSDK] An active modal was detected, but it establishes a CSS containing block that would clip the picker overlay. Falling back to document.body. Pass `containerId` (an element inside the modal) to embed the picker correctly."),null):o:null}globalThis.addEventListener("cx-unauthorized",Vte);const Dne=f5.createRef(),Lne={help:()=>{console.log("/* Orange DAM Content Browser SDK Example */\n window.OrangeDAMContentBrowser.open({\n onAssetSelected: (assets) => {\n // Callback function triggered when assets are selected\n console.log(assets);\n window.open(assets[0]?.imageUrl, '_blank');\n },\n onError: (errorMessage, error) => {\n // Callback function triggered when an error occurs\n console.error(errorMessage, error);\n },\n onClose: () => {\n // Callback function triggered when the browser is closed\n window.alert('Content Browser is closing');\n },\n getPinnedState: (recordId) => {\n // Callback function to get the pinned state of an asset\n return localStorage.getItem(`pinned:${recordId}`) === 'true';\n },\n onPinAsset: async (recordId) => {\n // Callback function triggered when an asset is pinned\n localStorage.setItem(`pinned:${recordId}`, 'true');\n },\n onUnpinAsset: async (recordId) => {\n // Callback function triggered when an asset is unpinned\n localStorage.removeItem(`pinned:${recordId}`);\n },\n containerId: \"\", // ID of the container to attach the browser; opens in a popup if blank\n extraFields: ['coreField.OriginalFileName', 'document.CortexPath'], // Additional fields to retrieve from the assets\n baseUrl: \"\", // Default base URL to pre-fill in the content browser\n displayInfo: {\n title: true, // Whether to display the asset title\n dimension: true, // Whether to display the asset dimensions\n fileSize: false, // Whether to display the file size\n tags: false, // Whether to display the asset tags\n },\n publicApplicationName: \"\", // Public name of the DAM to display on the login screen\n pluginName: \"OrangeDAM Content Browser\", // Name of the plugin to display on the login screen\n ctaText: \"Insert\", // Text to display on the insert button\n ctaTextTransform: \"capitalize\", // Text transform: 'none', 'uppercase', 'lowercase', 'capitalize' (default: 'capitalize')\n persistMode: true, // Whether the browser remains open after selecting an asset\n availableDocTypes: ['Images*', 'Videos*', 'Audio*', 'Others*'], // An array of available OrangeDAM asset types to filter the assets. The available doc types will be configured in OL Platform. If not provided, all doc types will be available. \n availableRepresentativeSubtypes: ['Other'], // Array of supported subtypes for representative images\n showCollections: true, // Whether to show collections in the content browser\n lastLocationMode: true, // Whether to open the last selected folder on load\n allowTracking: true, // Whether to enable tracking parameters for asset URLs\n allowFormatDialogPin: true, // Whether to show pin/unpin actions in format dialog\n });")},open:e=>U(null,[e],function*({onAssetAction:e,getPinnedState:t,onAssetSelected:n,onAppAuthUrlCopied:i,onImageSelected:r,onError:o,onClose:a,onPinAsset:s,onRequestToken:l,onTokenChanged:c,onUnpinAsset:u,onConnectClicked:d,onSiteUrlChanged:h,customStorage:p,allowedExtensions:f,allowedFolders:m,allowFavorites:g,allowFormatDialogPin:v,allowPin:y,allowLogout:b,allowProxy:A,allowTracking:w,availableDocTypes:x,availableRepresentativeSubtypes:_,baseUrl:E,containerId:C,ctaText:S,ctaTextTransform:T,displayInfo:k={title:!0,dimension:!0,fileSize:!1,tags:!1},extraFields:I,lastLocationMode:M,loadExternalFonts:P,multiSelect:R,persistMode:B,pluginName:O,publicApplicationName:D,showCollections:L,showFavoriteFolder:N,showVersions:z,useSession:F,defaultGridView:j}){var H;const Q="object"==typeof p&&p&&"function"==typeof p.delete&&p.delete&&"function"==typeof p.get&&p.get&&"function"==typeof p.set&&p.set?p:void 0;window.OrangeDAMContentBrowser._customStorage=Q;let V=C&&document.getElementById(C);if(C){if(!V)return void console.error(`Container with id ${C} is not found`)}else V=null!=(H=One())?H:document.body;let G=V.querySelector("#cortex-asset-picker-root");G||(G=document.createElement("div"),G.id="cortex-asset-picker-root",G.style.width="100%",G.style.height="100%",G.style.display="flex",G.style.alignItems="center",G.style.justifyContent="center",G.style.position="relative",V.appendChild(G));const W=P5.createRoot(G);l&&(window.OrangeDAMContentBrowser._onRequestToken=()=>l().then(e=>({token:e,siteUrl:E}))),E&&gne.dispatch(nne(E)),l&&gne.dispatch(rne(!0)),F&&gne.dispatch(ine(F)),gne.dispatch(mne());const q="function"==typeof o&&o?o:console.log,$="function"==typeof e&&e?e:()=>{},X="function"==typeof n&&n?n:()=>{},Y="function"==typeof i&&i?i:e=>U(null,null,function*(){yield navigator.clipboard.writeText(e)}),Z="function"==typeof r&&r?r:()=>{},J="function"==typeof c&&c?c:void 0,ee="function"==typeof t&&t?t:()=>!1,te="function"==typeof s&&s?s:void 0,ne="function"==typeof u&&u?u:void 0,ie=()=>{W.unmount(),window.OrangeDAMContentBrowser._onAssetSelected=void 0,window.OrangeDAMContentBrowser._onImageSelected=void 0,window.OrangeDAMContentBrowser._onError=void 0,window.OrangeDAMContentBrowser._onClose=void 0,window.OrangeDAMContentBrowser._customStorage=void 0,null==a||a()};window.OrangeDAMContentBrowser._onAssetAction=$,window.OrangeDAMContentBrowser._onAssetSelected=X,window.OrangeDAMContentBrowser._onImageSelected=Z,window.OrangeDAMContentBrowser._onError=q,window.OrangeDAMContentBrowser._onClose=ie,W.render(K.jsx(q5,{store:gne,children:K.jsx(p9.Provider,{value:{allowedExtensions:f,allowedFolders:m,availableDocTypes:x,availableRepresentativeSubtypes:_,ctaText:null!=S?S:"Insert",ctaTextTransform:null!=T?T:"capitalize",displayInfo:k,lastLocationMode:void 0===M||!!M,persistMode:!!B,pluginInfo:{publicApplicationName:null!=D?D:"",pluginName:null!=O?O:"OrangeDAM Content Browser"},isContentBrowserPopedup:!C,showCollections:!!L,showFavoriteFolder:!1!==N,showVersions:!!z,useSession:F,allowPin:!!y,allowFormatDialogPin:!!v,allowLogout:void 0===b||!!b,allowTracking:void 0===w||!!w,allowProxy:void 0===A||!!A,allowFavorites:!!g,defaultGridView:null!=j?j:""},children:K.jsx(Mne,{containerId:C,extraFields:I,loadExternalFonts:P,multiSelect:!!R,onError:q,getPinnedState:ee,onAssetAction:$,onAssetSelected:X,onAppAuthUrlCopied:Y,onImageSelected:Z,onPinAsset:te,onClose:ie,onConnectClicked:d,onTokenChanged:J,onUnpinAsset:ne,onSiteUrlChanged:h,assetsPickerRef:Dne})})}))}),close:()=>{var e,t;null==(t=(e=window.OrangeDAMContentBrowser)._onClose)||t.call(e)},fetchAssets:e=>{var t;return null==(t=Dne.current)?void 0:t.fetchAssets(e)},fetchFolders:e=>{var t;return null==(t=Dne.current)?void 0:t.fetchFolders(e)},previewAsset:e=>{var t;return null==(t=Dne.current)?void 0:t.selectAsset(e)}};globalThis.OrangeDAMContentBrowser=Lne;const Nne={svg:as`<svg
2470
2470
  xmlns="http://www.w3.org/2000/svg"
2471
2471
  aria-label="Mailchimp"
2472
2472
  role="img"
package/build/index.mjs CHANGED
@@ -32599,7 +32599,9 @@ const ResponsiveTypography = dt("cx-typography")`
32599
32599
  `;
32600
32600
  const RestoreSession = ({ onCancel }) => {
32601
32601
  const dispatch = useAppDispatch();
32602
+ const currentSession = useAppSelector(applySessionSelector);
32602
32603
  reactExports.useEffect(() => {
32604
+ if (currentSession) return;
32603
32605
  getData(USE_SESSION).then((storedSession) => {
32604
32606
  if (storedSession) {
32605
32607
  dispatch(setUseSession(storedSession));
@@ -33024,6 +33026,9 @@ const ContentBrowser = {
33024
33026
  if (onRequestToken) {
33025
33027
  store.dispatch(setUseHeaders(true));
33026
33028
  }
33029
+ if (useSession) {
33030
+ store.dispatch(setUseSession(useSession));
33031
+ }
33027
33032
  store.dispatch(initAuthInfoFromCache());
33028
33033
  const errorHandler = typeof onError === "function" && !!onError ? onError : console.log;
33029
33034
  const assetActionHandler = typeof onAssetAction === "function" && !!onAssetAction ? onAssetAction : () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangelogic/orange-dam-content-browser-sdk",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "OrangeDAM Content Browser SDK source code",
5
5
  "main": "./build/OrangeDAMContentBrowserSDK.min.js",
6
6
  "module": "./build/index.mjs",