@orangelogic/orange-dam-content-browser-sdk 2.1.59 → 2.1.60
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.
|
@@ -11477,5 +11477,5 @@ governing permissions and limitations under the License.
|
|
|
11477
11477
|
top: 0;
|
|
11478
11478
|
width: 100vw;
|
|
11479
11479
|
z-index: var(--cx-z-index-dialog);
|
|
11480
|
-
`,Av=e=>{let{extraFields:t=[],containerId:r,loadExternalFonts:o=!0,multiSelect:i,onClose:a,onError:s,onAssetAction:l,onAssetSelected:c,onImageSelected:u,onConnectClicked:d,onTokenChanged:h,onSiteUrlChanged:p}=e;const f=(0,wv.GV)(Sv.Hb),m=(0,wv.GV)(Sv.KL),[g,v]=(0,pv.useState)(!0);(0,pv.useEffect)((()=>{o?gv().load({google:{families:["Fira Code","Fira Mono","Fira Sans","Fira Sans Condensed","Fira Sans Extra Condensed"]}}):Promise.resolve().then(n.bind(n,4781))}),[o]),(0,pv.useEffect)((()=>{h&&
|
|
11480
|
+
`,Av=e=>{let{extraFields:t=[],containerId:r,loadExternalFonts:o=!0,multiSelect:i,onClose:a,onError:s,onAssetAction:l,onAssetSelected:c,onImageSelected:u,onConnectClicked:d,onTokenChanged:h,onSiteUrlChanged:p}=e;const f=(0,wv.GV)(Sv.Hb),m=(0,wv.GV)(Sv.KL),[g,v]=(0,pv.useState)(!0);(0,pv.useEffect)((()=>{o?gv().load({google:{families:["Fira Code","Fira Mono","Fira Sans","Fira Sans Condensed","Fira Sans Extra Condensed"]}}):Promise.resolve().then(n.bind(n,4781))}),[o]),(0,pv.useEffect)((()=>{h&&h(null!==f&&void 0!==f?f:"")}),[f,h]),(0,pv.useEffect)((()=>{p&&m&&p(m)}),[m,p]);const b=(0,pv.useCallback)((()=>{v(!1),null===a||void 0===a||a()}),[a]),y=(0,pv.useMemo)((()=>({extraFields:t,onAssetAction:l,onAssetSelected:c,onImageSelected:u,onError:s,onClose:b,onConnectClicked:d})),[t,b,l,c,s,u,d]);return(0,yv.jsx)(vv.B.Provider,{value:y,children:r?(0,yv.jsx)(Cv,{multiSelect:i}):(0,yv.jsx)(Ev,{open:g,children:(0,yv.jsx)(Cv,{multiSelect:i})})})};var Tv=n(5650),Ov=n(5873),Pv=n(3943),zv=n(9063),Dv=n(5029),Rv=n(4413);class jv{static getInstance(){return jv.instance||(jv.instance=new jv),jv.instance}async fetchAssets(e){const t=await wv.M_.dispatch(zv.PG.endpoints.getAssets.initiate(e,{forceRefetch:!0}));return"data"in t?t.data:{facets:[],items:[],totalCount:0}}async fetchFolders(e){var t;const n=await wv.M_.dispatch(zv.PG.endpoints.getFolders.initiate({...e,pageSize:null!==(t=e.pageSize)&&void 0!==t?t:Rv.VH},{forceRefetch:!0}));return"data"in n?n.data:{items:[],totalCount:0}}}jv.instance=void 0;const Nv=jv.getInstance(),Iv={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 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 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 });")},open:async n=>{let{onAssetAction:r,onAssetSelected:o,onImageSelected:i,onError:a,onClose:s,onRequestToken:l,onTokenChanged:c,onConnectClicked:u,onSiteUrlChanged:d,customStorage:h,allowedExtensions:p,allowedFolders:f,allowFavorites:m,allowPin:g,allowLogout:v,allowProxy:b,allowTracking:y,availableDocTypes:x,availableRepresentativeSubtypes:w,baseUrl:S,containerId:k,ctaText:_,displayInfo:C={title:!0,dimension:!0,fileSize:!1,tags:!1},extraFields:E,lastLocationMode:A,loadExternalFonts:T,multiSelect:O,persistMode:P,pluginName:z,publicApplicationName:D,showCollections:R,showFavoriteFolder:j,showVersions:N,useSession:I,defaultGridView:M}=n;const L="object"===typeof h&&h&&"function"===typeof h.delete&&h.delete&&"function"===typeof h.get&&h.get&&"function"===typeof h.set&&h.set?h:void 0;window.OrangeDAMContentBrowser._customStorage=L;let F=k&&document.getElementById(k);if(k){if(!F)return void console.error(`Container with id ${k} is not found`)}else F=document.body;let B=F.querySelector("#cortex-asset-picker-root");B||(B=document.createElement("div"),B.id="cortex-asset-picker-root",B.style.width="100%",B.style.height="100%",B.style.display="flex",B.style.alignItems="center",B.style.justifyContent="center",B.style.position="relative",F.appendChild(B));const U=(0,e.createRoot)(B);l&&(window.OrangeDAMContentBrowser._onRequestToken=()=>l().then((e=>({token:e,siteUrl:S})))),S&&wv.M_.dispatch((0,Sv._f)(S)),l&&wv.M_.dispatch((0,Sv.Uh)(!0)),wv.M_.dispatch((0,Sv.hG)());const V="function"===typeof a&&a?a:console.log,q="function"===typeof r&&r?r:()=>{},H="function"===typeof o&&o?o:()=>{},W="function"===typeof i&&i?i:()=>{},K="function"===typeof c&&c?c:void 0,$=()=>{wv.M_.dispatch((0,Ov.ZZ)()),wv.M_.dispatch(zv.PG.util.resetApiState()),wv.M_.dispatch(Pv.A1.util.resetApiState()),wv.M_.dispatch(Dv.i.util.resetApiState()),U.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===s||void 0===s||s()};window.OrangeDAMContentBrowser._onAssetAction=q,window.OrangeDAMContentBrowser._onAssetSelected=H,window.OrangeDAMContentBrowser._onImageSelected=W,window.OrangeDAMContentBrowser._onError=V,window.OrangeDAMContentBrowser._onClose=$,U.render((0,yv.jsx)(t.Kq,{store:wv.M_,children:(0,yv.jsx)(Tv.t.Provider,{value:{allowedExtensions:p,allowedFolders:f,availableDocTypes:x,availableRepresentativeSubtypes:w,ctaText:null!==_&&void 0!==_?_:"Insert",displayInfo:C,lastLocationMode:void 0===A||!!A,persistMode:!!P,pluginInfo:{publicApplicationName:null!==D&&void 0!==D?D:"",pluginName:null!==z&&void 0!==z?z:"OrangeDAM Content Browser"},isContentBrowserPopedup:!k,showCollections:!!R,showFavoriteFolder:!!j,showVersions:!!N,useSession:I,allowPin:!!g,allowLogout:void 0===v||!!v,allowTracking:void 0===y||!!y,allowProxy:void 0===b||!!b,allowFavorites:!!m,defaultGridView:null!==M&&void 0!==M?M:""},children:(0,yv.jsx)(Av,{containerId:k,extraFields:E,loadExternalFonts:T,multiSelect:!!O,onError:V,onAssetAction:q,onAssetSelected:H,onImageSelected:W,onClose:$,onConnectClicked:u,onTokenChanged:K,onSiteUrlChanged:d})})}))},close:()=>{var e,t;null===(e=(t=window.OrangeDAMContentBrowser)._onClose)||void 0===e||e.call(t)},fetchAssets:e=>Nv.fetchAssets(e),fetchFolders:e=>Nv.fetchFolders(e),previewAsset:e=>{wv.M_.dispatch((0,Ov.DM)(e))}};window.OrangeDAMContentBrowser=Iv;const Mv=Iv})(),r=r.default})()));
|
|
11481
11481
|
//# sourceMappingURL=OrangeDAMContentBrowserSDK.min.js.map
|