@paroicms/admin-ui 1.85.0 → 1.85.1

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.
@@ -2288,7 +2288,7 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
2288
2288
  mutation useFTextImage($input: UseFTextImageInput!) {
2289
2289
  useFTextImage(input: $input) { source variant }
2290
2290
  }
2291
- `;function Koe(){const[e]=Rr(Voe);return f.useCallback(Ar(n=>e({variables:{input:n}}),n=>uA(n.useFTextImage)),[e])}function uA(e){return{source:JSON.parse(e.source),variant:JSON.parse(e.variant)}}const Rg=f.createContext(void 0);function qoe({children:e}){const n=f.useRef({plugins:new Map,pluginsStatus:"notLoaded",afterInitListeners:[],hooks:new Map});return E.jsx(Rg.Provider,{value:n.current,children:e})}function Goe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");return n=>{var t;return(t=e.plugins.get(n))==null?void 0:t.plugin}}function Yoe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");return(n,t)=>Woe(e,n,t)}async function Woe(e,n,t){const{plugins:a,pluginsStatus:r,afterInitListeners:i}=e;if(r!=="notLoaded"){if(n.find(c=>!a.has(c.pluginName)))throw new Error("Inconsistant plugins");return}e.pluginsStatus="loading";for(const c of n)a.set(c.pluginName,{...c});const l=(c,p)=>{i.push({listener:c,loadingPlugin:p})},u=await Promise.all(n.map(c=>Qoe(e,c,t,l)));for(let c=0;c<n.length;c++){const p=n[c],h=u[c];if(h){const g=a.get(p.pluginName);if(!g)throw new Error(`unknown plugin: '${p.pluginName}'`);g.plugin=h}}e.pluginsStatus="initialized"}function Joe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");const[n,t]=f.useState((e==null?void 0:e.pluginsStatus)==="ready"),a=cA(),r=e.afterInitListeners.map(i=>({listener:i.listener,createService:()=>a(i.loadingPlugin.pluginName)}));return ba(async()=>{if(e.pluginsStatus!=="initialized"){t(!0);return}e.pluginsStatus="afterInit";for(const{listener:i,createService:l}of r)await i(l());e.pluginsStatus="ready",t(!0)},[]),n}async function Qoe(e,n,t,a){const{pluginName:r,adminUiPluginBaseUrl:i}=n;try{const u=await import(`${i}/admin-ui-plugin.mjs`);if(!u.default||!("init"in u.default)||!("create"in u.default))throw new Error(`[${r}] invalid plugin`);const c=Xoe(e,n,t,p=>a(p,n));return await u.default.init(c),u.default}catch(l){zi.error(`Failed loading plugin '${r}'`,l)}}function Xoe(e,n,t,a){return{logger:zi,themeConf:t.themeConf,publicSiteUrl:t.publicSiteUrl,configuration:n.conf??{},pluginBaseUrl:n.adminUiPluginBaseUrl,registerHook(r,i,l){const u=e.hooks.get(r);if(u){if(u.replace||l!=null&&l.replace)throw new Error(`[${r}] hook already registered`);u.handlers.push(i)}else e.hooks.set(r,{name:r,handlers:[i],replace:l==null?void 0:l.replace})},addAfterInitListener:a}}function cA(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");const n=eG(),t=m0(),{themeConf:a,siteSchema:r}=la(),i=pi(),l=Hoe(),u=Koe(),c=lA(),p=zoe(),h=Oa();return g=>{const v=e.plugins.get(g);if(!v)throw new Error(`Plugin '${g}' not found`);const y={themeConf:a,publicSiteUrl:t.publicSiteUrl,logger:zi,configuration:v.conf??{},pluginBaseUrl:v.adminUiPluginBaseUrl,createModalDialog:$oe,useAdminUiImage:async(w,C)=>{try{return await l({mediaId:typeof w=="string"?w:w.mediaId,...C})}catch{}},useFTextImage:async(w,C)=>{try{return await u({mediaId:typeof w=="string"?w:w.mediaId,...C})}catch{}},showToast:h,executeHook(w,C){const O=e.hooks.get(w);return O?O.handlers.map(x=>x(y,C)):[]},openDocumentEdition(w,C){var P;const O=ka(w),x=rc(r,C),D=To({documentType:x,language:O.language,documentNodeId:O.nodeId},(P=x.adminUi)==null?void 0:P.defaultTab);i(D)},async searchDocuments({searchString:w,language:C,limit:O,offset:x,sorting:D}){const P=O??10;return(await c({queryString:w,language:C??n(),limit:P,offset:x??0,sorting:D})).items.map(T=>({id:T.lNodeId,title:T.title,url:T.url,typeName:T.typeName,ready:T.ready,publishDate:T.publishDate}))},async getDocument(w){const C=await p(w);if(!C)return;const{document:O,node:x}=C;return{id:w,title:O.title,typeName:x.typeName}}};return y}}function dA({fieldType:e,initialValue:n,uploadMedia:t}){const{pluginName:a}=e;if(!a)throw new Error("invalid call to PluginComponent");const r=Ul(),i=f.useRef(null),l=f.useRef(void 0),u=cA(),[c,p]=f.useState("initializing"),{setModifiedValue:h,cancelModifiedValue:g}=Vl(e.name),v=Qo(),y=Goe(),w=f.useRef(n);return f.useEffect(()=>{l.current&&l.current.pluginInst.setLanguage(r)},[r]),f.useEffect(()=>{w.current=n,l.current&&l.current.contentLanguage===v&&l.current.initialValue!==n&&(g(),l.current.initialValue=n,l.current.pluginInst.setValue(n))},[n,v]),f.useEffect(()=>{p("initializing");const C=i.current;if(!C||l.current)return;const O=y(a);if(!O){zi.error(`Error in plugin ${a}: plugin not found`),p("error");return}let x;try{x=O.create({...u(a),fieldType:e,setModifiedValue:D=>{typeof D=="function"||Pae(w.current,D,e)?h(D??null):g()},cancelModifiedValue:g,language:r,contentLanguage:v,initialValue:w.current,uploadMedia:t?async D=>{const P=await t(D);return P==null?void 0:P.source}:void 0})}catch(D){zi.error(`Error in plugin ${a}:`,D),p("error");return}return C.appendChild(x.element),l.current={pluginInst:x,detach:()=>{C.removeChild(x.element),x.dispose()},contentLanguage:v,initialValue:w.current},p("ready"),()=>{l.current&&(l.current.detach(),l.current=void 0)}},[e,v]),{status:c,containerRef:i,pluginInstRef:l}}function Zoe(e){if(S_(e.value))throw new Error(`Field "${e.fieldType.name}" should not have a gallery`);const{status:n,containerRef:t}=dA({fieldType:e.fieldType,initialValue:e.value});return n==="error"?E.jsxs("div",{children:['Error in plugin "',e.fieldType.pluginName,'"']}):E.jsx("div",{ref:t})}function ele(e){var T;const{fieldType:n,value:t,nodeId:a}=e,{pluginName:r}=n;if(!r)throw new Error("invalid call to PluginComponent");const i=Qo(),l=dO(),u=hO({apiUrl:$l,replace:!1,nodeId:a}),c=mO({}),{uploadLimitManager:p}=xa(),h=lr(N=>N.appLayout),g=h==="mobile",{value:v,gallery:y}=sg(t);if(y===void 0)throw new Error(`missing handle in value of field "${n.name}"`);const w=pO({acceptFilter:c,mediaHandle:y.h,getMedias:l,httpUploadMedia:u,limitManager:p}),C=async N=>{const[k]=await w.uploadFiles([N]);return await w.refreshMedias(),k},{status:O,containerRef:x,pluginInstRef:D}=dA({fieldType:n,initialValue:v,uploadMedia:C});if(O==="error")return E.jsxs("div",{children:['Error in plugin "',e.fieldType.pluginName,'"']});const P=(T=D.current)==null?void 0:T.pluginInst.insertMedia,M=P?N=>P(N.source):void 0;return E.jsxs("div",{className:ge("PluginWithGallery",{mobile:h==="mobile"}),children:[E.jsx("div",{className:"PluginWithGallery-pluginWrap",ref:x}),E.jsx("div",{className:"PluginWithGallery-gallery",children:O==="ready"&&E.jsx(iA,{handle:y.h,apiUrl:$l,onMediaAction:M,direction:g?"row":"column",isMobile:g,contentLanguage:i,uploadHandler:w})})]})}function tle(e){const{fieldType:n}=e;return n.withGallery?E.jsx(ele,{...e}):E.jsx(Zoe,{...e})}function fA(e){const n=Fn(),{l10nPrefix:t,nodeId:a,areSiteFields:r}=e,i=lr(u=>u.appLayout),l=Qo();return({fieldType:u,value:c})=>{if(u.pluginName)return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(tle,{fieldType:u,value:c,nodeId:a},u.name)]},`${u.name}-wrap`);const{value:p}=sg(c);if(u.storedAs==="mediaHandle"&&u.dataType==="media")return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(MR,{nodeId:a,mediaHandle:fT(p),accept:u.accept,refuse:u.refuse,apiUrl:$l,contentLanguage:l},u.name)]},`${u.name}-wrap`);if(u.storedAs==="mediaHandle"&&u.dataType==="gallery")return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(Moe,{isMobile:i==="mobile",nodeId:a,handle:fT(p),accept:u.accept,refuse:u.refuse,apiUrl:$l,contentLanguage:l},u.name)]},`${u.name}-wrap`);if(u.storedAs==="labeling"){if(p!==void 0&&!ug(p))throw new Error(`Invalid value for field type '${u.name}' (expected 'labeling', got '${p}')`);return E.jsx(Bie,{fieldType:u,value:p,l10nPrefix:t},u.name)}if(u.dataType==="number")return E.jsx(gie,{fieldType:u,value:b_(p),l10nPrefix:t},u.name);if(u.dataType==="string")return u.multiline||u.renderAs==="html"?E.jsx(vie,{fieldType:u,value:gf(p),l10nPrefix:t},u.name):E.jsx(wie,{fieldType:u,value:gf(p),l10nPrefix:t},u.name);if(u.dataType==="boolean")return E.jsx(Vae,{fieldType:u,value:w_(p),l10nPrefix:t},u.name);if(u.dataType==="dateTime")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="date")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="time")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="json")return r&&u.name==="access"?E.jsx($ae,{fieldType:u,value:p,l10nPrefix:t},u.name):E.jsx(yie,{fieldType:u,value:p,l10nPrefix:t},u.name);throw new Error(`invalid field type '${u.dataType}'`)}}function nle({fieldValues:e,fieldTypes:n,createFieldOptions:t}){const a=fA(t);return E.jsx("div",{className:"ColumnWithGap",children:n.map(r=>a({fieldType:r,value:e[r.name]}))})}function rle({fieldTypes:e,fieldValues:n,...t}){return E.jsx(nle,{fieldTypes:e,fieldValues:n,createFieldOptions:t})}function pA({className:e,lNodeId:n,nodeType:t}){const[a,r]=f.useState(),i=Iae(),l=Oae(),{getModifiedValues:u}=xa();if(Ig("shouldRefresh",async()=>{const p=n,h=await l(p);r({values:h,id:p})},[n],{useEffect:!0}),hd(async()=>{const p=u();return p?(await i({values:p,...ka(n)}),!0):!1}),!a||n!==a.id)return E.jsx("div",{className:e,children:E.jsx(Bi,{})});if(!t.fields)throw new Error("should have fields here");const{nodeId:c}=ka(n);return E.jsx("div",{className:ge("MainContent",e),children:E.jsx(rle,{nodeId:c,fieldTypes:t.fields,fieldValues:a.values,l10nPrefix:`siteSchema.nodeTypes.${t.typeName}.fields`})})}function gs(e){const{top:n,children:t,className:a,topClassName:r,mainClassName:i,scrollable:l,biggerOnMobile:u}=e;return E.jsxs("div",{className:ge("WithTopBar",a,{biggerOnMobile:u}),children:[E.jsx("div",{className:ge("_topBar WithTopBar-top",r),children:n}),E.jsx("div",{className:ge("WithTopBar-main",i,{Scrollable:l}),children:t})]})}function ale(e){const{siteSchema:n}=la(),t=MM({lNodeId:e.documentId,limit:zq(n,e.documentType)});return E.jsx(fc,{uploadLimitManager:t,children:E.jsx(ile,{...e})},e.documentId)}function ile({className:e,...n}){return Ng({i18nSavedToastKey:"document.savedToast"}),E.jsx(gs,{className:e,top:E.jsx(Cae,{...n}),scrollable:!0,biggerOnMobile:!0,children:E.jsx(ole,{...n})})}function ole({className:e,documentId:n,documentType:t}){const a=xa();if(!(!Qf(t)||!t.fields))return E.jsx(fc,{parentScope:a,children:E.jsx(pA,{className:e,nodeType:t,lNodeId:n})})}const lle=_n`
2291
+ `;function Koe(){const[e]=Rr(Voe);return f.useCallback(Ar(n=>e({variables:{input:n}}),n=>uA(n.useFTextImage)),[e])}function uA(e){return{source:JSON.parse(e.source),variant:JSON.parse(e.variant)}}const Rg=f.createContext(void 0);function qoe({children:e}){const n=f.useRef({plugins:new Map,pluginsStatus:"notLoaded",afterInitListeners:[],hooks:new Map});return E.jsx(Rg.Provider,{value:n.current,children:e})}function Goe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");return n=>{var t;return(t=e.plugins.get(n))==null?void 0:t.plugin}}function Yoe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");return(n,t)=>Woe(e,n,t)}async function Woe(e,n,t){const{plugins:a,pluginsStatus:r,afterInitListeners:i}=e;if(r!=="notLoaded"){if(n.find(c=>!a.has(c.pluginName)))throw new Error("Inconsistant plugins");return}e.pluginsStatus="loading";for(const c of n)a.set(c.pluginName,{...c});const l=(c,p)=>{i.push({listener:c,loadingPlugin:p})},u=await Promise.all(n.map(c=>Qoe(e,c,t,l)));for(let c=0;c<n.length;c++){const p=n[c],h=u[c];if(h){const g=a.get(p.pluginName);if(!g)throw new Error(`unknown plugin: '${p.pluginName}'`);g.plugin=h}}e.pluginsStatus="initialized"}function Joe(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");const[n,t]=f.useState((e==null?void 0:e.pluginsStatus)==="ready"),a=cA(),r=e.afterInitListeners.map(i=>({listener:i.listener,createService:()=>a(i.loadingPlugin.pluginName)}));return ba(async()=>{if(e.pluginsStatus!=="initialized"){t(!0);return}e.pluginsStatus="afterInit";for(const{listener:i,createService:l}of r)await i(l());e.pluginsStatus="ready",t(!0)},[]),n}async function Qoe(e,n,t,a){const{pluginName:r,adminUiPluginBaseUrl:i}=n;try{const u=await import(`${i}/admin-ui-plugin.mjs`);if(!u.default||!("init"in u.default)||!("create"in u.default))throw new Error(`[${r}] invalid plugin`);const c=Xoe(e,n,t,p=>a(p,n));return await u.default.init(c),u.default}catch(l){zi.error(`Failed loading plugin '${r}'`,l)}}function Xoe(e,n,t,a){return{logger:zi,fqdn:t.fqdn,publicSiteUrl:t.publicSiteUrl,themeConf:t.themeConf,configuration:n.conf??{},pluginBaseUrl:n.adminUiPluginBaseUrl,registerHook(r,i,l){const u=e.hooks.get(r);if(u){if(u.replace||l!=null&&l.replace)throw new Error(`[${r}] hook already registered`);u.handlers.push(i)}else e.hooks.set(r,{name:r,handlers:[i],replace:l==null?void 0:l.replace})},addAfterInitListener:a}}function cA(){const e=f.useContext(Rg);if(!e)throw new Error("Missing plugins context parent");const n=eG(),t=m0(),{themeConf:a,siteSchema:r}=la(),i=pi(),l=Hoe(),u=Koe(),c=lA(),p=zoe(),h=Oa();return g=>{const v=e.plugins.get(g);if(!v)throw new Error(`Plugin '${g}' not found`);const y={fqdn:t.fqdn,publicSiteUrl:t.publicSiteUrl,themeConf:a,logger:zi,configuration:v.conf??{},pluginBaseUrl:v.adminUiPluginBaseUrl,createModalDialog:$oe,useAdminUiImage:async(w,C)=>{try{return await l({mediaId:typeof w=="string"?w:w.mediaId,...C})}catch{}},useFTextImage:async(w,C)=>{try{return await u({mediaId:typeof w=="string"?w:w.mediaId,...C})}catch{}},showToast:h,executeHook(w,C){const O=e.hooks.get(w);return O?O.handlers.map(x=>x(y,C)):[]},openDocumentEdition(w,C){var P;const O=ka(w),x=rc(r,C),D=To({documentType:x,language:O.language,documentNodeId:O.nodeId},(P=x.adminUi)==null?void 0:P.defaultTab);i(D)},async searchDocuments({searchString:w,language:C,limit:O,offset:x,sorting:D}){const P=O??10;return(await c({queryString:w,language:C??n(),limit:P,offset:x??0,sorting:D})).items.map(T=>({id:T.lNodeId,title:T.title,url:T.url,typeName:T.typeName,ready:T.ready,publishDate:T.publishDate}))},async getDocument(w){const C=await p(w);if(!C)return;const{document:O,node:x}=C;return{id:w,title:O.title,typeName:x.typeName}}};return y}}function dA({fieldType:e,initialValue:n,uploadMedia:t}){const{pluginName:a}=e;if(!a)throw new Error("invalid call to PluginComponent");const r=Ul(),i=f.useRef(null),l=f.useRef(void 0),u=cA(),[c,p]=f.useState("initializing"),{setModifiedValue:h,cancelModifiedValue:g}=Vl(e.name),v=Qo(),y=Goe(),w=f.useRef(n);return f.useEffect(()=>{l.current&&l.current.pluginInst.setLanguage(r)},[r]),f.useEffect(()=>{w.current=n,l.current&&l.current.contentLanguage===v&&l.current.initialValue!==n&&(g(),l.current.initialValue=n,l.current.pluginInst.setValue(n))},[n,v]),f.useEffect(()=>{p("initializing");const C=i.current;if(!C||l.current)return;const O=y(a);if(!O){zi.error(`Error in plugin ${a}: plugin not found`),p("error");return}let x;try{x=O.create({...u(a),fieldType:e,setModifiedValue:D=>{typeof D=="function"||Pae(w.current,D,e)?h(D??null):g()},cancelModifiedValue:g,language:r,contentLanguage:v,initialValue:w.current,uploadMedia:t?async D=>{const P=await t(D);return P==null?void 0:P.source}:void 0})}catch(D){zi.error(`Error in plugin ${a}:`,D),p("error");return}return C.appendChild(x.element),l.current={pluginInst:x,detach:()=>{C.removeChild(x.element),x.dispose()},contentLanguage:v,initialValue:w.current},p("ready"),()=>{l.current&&(l.current.detach(),l.current=void 0)}},[e,v]),{status:c,containerRef:i,pluginInstRef:l}}function Zoe(e){if(S_(e.value))throw new Error(`Field "${e.fieldType.name}" should not have a gallery`);const{status:n,containerRef:t}=dA({fieldType:e.fieldType,initialValue:e.value});return n==="error"?E.jsxs("div",{children:['Error in plugin "',e.fieldType.pluginName,'"']}):E.jsx("div",{ref:t})}function ele(e){var T;const{fieldType:n,value:t,nodeId:a}=e,{pluginName:r}=n;if(!r)throw new Error("invalid call to PluginComponent");const i=Qo(),l=dO(),u=hO({apiUrl:$l,replace:!1,nodeId:a}),c=mO({}),{uploadLimitManager:p}=xa(),h=lr(N=>N.appLayout),g=h==="mobile",{value:v,gallery:y}=sg(t);if(y===void 0)throw new Error(`missing handle in value of field "${n.name}"`);const w=pO({acceptFilter:c,mediaHandle:y.h,getMedias:l,httpUploadMedia:u,limitManager:p}),C=async N=>{const[k]=await w.uploadFiles([N]);return await w.refreshMedias(),k},{status:O,containerRef:x,pluginInstRef:D}=dA({fieldType:n,initialValue:v,uploadMedia:C});if(O==="error")return E.jsxs("div",{children:['Error in plugin "',e.fieldType.pluginName,'"']});const P=(T=D.current)==null?void 0:T.pluginInst.insertMedia,M=P?N=>P(N.source):void 0;return E.jsxs("div",{className:ge("PluginWithGallery",{mobile:h==="mobile"}),children:[E.jsx("div",{className:"PluginWithGallery-pluginWrap",ref:x}),E.jsx("div",{className:"PluginWithGallery-gallery",children:O==="ready"&&E.jsx(iA,{handle:y.h,apiUrl:$l,onMediaAction:M,direction:g?"row":"column",isMobile:g,contentLanguage:i,uploadHandler:w})})]})}function tle(e){const{fieldType:n}=e;return n.withGallery?E.jsx(ele,{...e}):E.jsx(Zoe,{...e})}function fA(e){const n=Fn(),{l10nPrefix:t,nodeId:a,areSiteFields:r}=e,i=lr(u=>u.appLayout),l=Qo();return({fieldType:u,value:c})=>{if(u.pluginName)return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(tle,{fieldType:u,value:c,nodeId:a},u.name)]},`${u.name}-wrap`);const{value:p}=sg(c);if(u.storedAs==="mediaHandle"&&u.dataType==="media")return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(MR,{nodeId:a,mediaHandle:fT(p),accept:u.accept,refuse:u.refuse,apiUrl:$l,contentLanguage:l},u.name)]},`${u.name}-wrap`);if(u.storedAs==="mediaHandle"&&u.dataType==="gallery")return E.jsxs("div",{children:[E.jsx("span",{className:"FieldLabel",children:n(`${t}.${u.name}.label`,u.name)}),E.jsx(Moe,{isMobile:i==="mobile",nodeId:a,handle:fT(p),accept:u.accept,refuse:u.refuse,apiUrl:$l,contentLanguage:l},u.name)]},`${u.name}-wrap`);if(u.storedAs==="labeling"){if(p!==void 0&&!ug(p))throw new Error(`Invalid value for field type '${u.name}' (expected 'labeling', got '${p}')`);return E.jsx(Bie,{fieldType:u,value:p,l10nPrefix:t},u.name)}if(u.dataType==="number")return E.jsx(gie,{fieldType:u,value:b_(p),l10nPrefix:t},u.name);if(u.dataType==="string")return u.multiline||u.renderAs==="html"?E.jsx(vie,{fieldType:u,value:gf(p),l10nPrefix:t},u.name):E.jsx(wie,{fieldType:u,value:gf(p),l10nPrefix:t},u.name);if(u.dataType==="boolean")return E.jsx(Vae,{fieldType:u,value:w_(p),l10nPrefix:t},u.name);if(u.dataType==="dateTime")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="date")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="time")return E.jsx(OS,{value:gf(p),fieldType:u,l10nPrefix:t},u.name);if(u.dataType==="json")return r&&u.name==="access"?E.jsx($ae,{fieldType:u,value:p,l10nPrefix:t},u.name):E.jsx(yie,{fieldType:u,value:p,l10nPrefix:t},u.name);throw new Error(`invalid field type '${u.dataType}'`)}}function nle({fieldValues:e,fieldTypes:n,createFieldOptions:t}){const a=fA(t);return E.jsx("div",{className:"ColumnWithGap",children:n.map(r=>a({fieldType:r,value:e[r.name]}))})}function rle({fieldTypes:e,fieldValues:n,...t}){return E.jsx(nle,{fieldTypes:e,fieldValues:n,createFieldOptions:t})}function pA({className:e,lNodeId:n,nodeType:t}){const[a,r]=f.useState(),i=Iae(),l=Oae(),{getModifiedValues:u}=xa();if(Ig("shouldRefresh",async()=>{const p=n,h=await l(p);r({values:h,id:p})},[n],{useEffect:!0}),hd(async()=>{const p=u();return p?(await i({values:p,...ka(n)}),!0):!1}),!a||n!==a.id)return E.jsx("div",{className:e,children:E.jsx(Bi,{})});if(!t.fields)throw new Error("should have fields here");const{nodeId:c}=ka(n);return E.jsx("div",{className:ge("MainContent",e),children:E.jsx(rle,{nodeId:c,fieldTypes:t.fields,fieldValues:a.values,l10nPrefix:`siteSchema.nodeTypes.${t.typeName}.fields`})})}function gs(e){const{top:n,children:t,className:a,topClassName:r,mainClassName:i,scrollable:l,biggerOnMobile:u}=e;return E.jsxs("div",{className:ge("WithTopBar",a,{biggerOnMobile:u}),children:[E.jsx("div",{className:ge("_topBar WithTopBar-top",r),children:n}),E.jsx("div",{className:ge("WithTopBar-main",i,{Scrollable:l}),children:t})]})}function ale(e){const{siteSchema:n}=la(),t=MM({lNodeId:e.documentId,limit:zq(n,e.documentType)});return E.jsx(fc,{uploadLimitManager:t,children:E.jsx(ile,{...e})},e.documentId)}function ile({className:e,...n}){return Ng({i18nSavedToastKey:"document.savedToast"}),E.jsx(gs,{className:e,top:E.jsx(Cae,{...n}),scrollable:!0,biggerOnMobile:!0,children:E.jsx(ole,{...n})})}function ole({className:e,documentId:n,documentType:t}){const a=xa();if(!(!Qf(t)||!t.fields))return E.jsx(fc,{parentScope:a,children:E.jsx(pA,{className:e,nodeType:t,lNodeId:n})})}const lle=_n`
2292
2292
  mutation CreateDocumentOnNode(
2293
2293
  $nodeId: ID!
2294
2294
  $language: String!
@@ -2955,7 +2955,7 @@ query GetInitialData($fieldNames: [String!]!, $language: String){
2955
2955
  adminUiPluginBaseUrl
2956
2956
  confJson
2957
2957
  }
2958
- }`;function Qme(){const{refetch:e}=Za(Jme,{skip:!0});return f.useCallback(ei(n=>e(n),n=>{const{siteConstants:t,homeRoutingCluster:a,siteFieldValues:r,authAccount:i}=n,{preferences:l,...u}=i;return{authAccount:u,preferences:l,siteConstants:{...t,siteSchema:JSON.parse(t.siteSchema)},homeRoutingCluster:JSON.parse(a),siteFieldValues:JSON.parse(r),plugins:n.plugins.map(c=>({pluginName:c.pluginName,adminUiPluginBaseUrl:c.adminUiPluginBaseUrl,conf:c.confJson?JSON.parse(c.confJson):void 0}))}}),[e])}function Xme(){const e=cg(),n=Qme(),t=lr(v=>v.setInitialData),a=lr(v=>v.setHomeRoutingCluster),r=lr(v=>v.setSiteFieldValues),i=lr(v=>v.setAuthAccount),l=lr(v=>v.setPreferences),u=m0(),c=Ul(),[p,h]=f.useState(!1),g=Yoe();return ba(async()=>{try{h(!1);const v=await n({fieldNames:["title"],language:c});t({cmsVersion:v.siteConstants.cmsVersion,siteSchema:v.siteConstants.siteSchema,themeConf:v.siteConstants.themeConf,siteConfiguration:v.siteConstants.siteConfiguration}),a(v.homeRoutingCluster),r(v.siteFieldValues),i(v.authAccount),l(v.authAccount.special?Xq():v.preferences),Yme(v.siteConstants.siteSchema.l10n,v.siteConstants.siteSchema.languages),await g(v.plugins,{themeConf:v.siteConstants.themeConf,publicSiteUrl:u.publicSiteUrl}),h(!0)}catch(v){e.error(v),vi.emit("fatalError",`Unexpected error: ${ec(v)}`)}},[c]),p?E.jsx(HB,{router:Ace()}):E.jsx(Bi,{})}var Zme={root:"p-card p-component",header:"p-card-header",title:"p-card-title",subTitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer",body:"p-card-body"},ehe=`
2958
+ }`;function Qme(){const{refetch:e}=Za(Jme,{skip:!0});return f.useCallback(ei(n=>e(n),n=>{const{siteConstants:t,homeRoutingCluster:a,siteFieldValues:r,authAccount:i}=n,{preferences:l,...u}=i;return{authAccount:u,preferences:l,siteConstants:{...t,siteSchema:JSON.parse(t.siteSchema)},homeRoutingCluster:JSON.parse(a),siteFieldValues:JSON.parse(r),plugins:n.plugins.map(c=>({pluginName:c.pluginName,adminUiPluginBaseUrl:c.adminUiPluginBaseUrl,conf:c.confJson?JSON.parse(c.confJson):void 0}))}}),[e])}function Xme(){const e=cg(),n=Qme(),t=lr(v=>v.setInitialData),a=lr(v=>v.setHomeRoutingCluster),r=lr(v=>v.setSiteFieldValues),i=lr(v=>v.setAuthAccount),l=lr(v=>v.setPreferences),u=m0(),c=Ul(),[p,h]=f.useState(!1),g=Yoe();return ba(async()=>{try{h(!1);const v=await n({fieldNames:["title"],language:c});t({cmsVersion:v.siteConstants.cmsVersion,siteSchema:v.siteConstants.siteSchema,themeConf:v.siteConstants.themeConf,siteConfiguration:v.siteConstants.siteConfiguration}),a(v.homeRoutingCluster),r(v.siteFieldValues),i(v.authAccount),l(v.authAccount.special?Xq():v.preferences),Yme(v.siteConstants.siteSchema.l10n,v.siteConstants.siteSchema.languages),await g(v.plugins,{fqdn:u.fqdn,publicSiteUrl:u.publicSiteUrl,themeConf:v.siteConstants.themeConf}),h(!0)}catch(v){e.error(v),vi.emit("fatalError",`Unexpected error: ${ec(v)}`)}},[c]),p?E.jsx(HB,{router:Ace()}):E.jsx(Bi,{})}var Zme={root:"p-card p-component",header:"p-card-header",title:"p-card-title",subTitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer",body:"p-card-body"},ehe=`
2959
2959
  @layer primereact {
2960
2960
  .p-card-header img {
2961
2961
  width: 100%;
@@ -2996,7 +2996,8 @@ query GetInitialData($fieldNames: [String!]!, $language: String){
2996
2996
  }
2997
2997
  `;function she(){const[e]=Rr(lhe);return f.useCallback(Ar(e),[e])}function uhe(){const[e,n]=f.useState(!1),[t,a]=f.useState(),r=she(),i=ihe(),l=cg(),u=Oa(),c=lr(h=>h.publicConstants);ba(async()=>{try{const h=await i();a(h)}catch(h){l.error("Failed to fetch migration info",h)}},[i]);const p=async()=>{try{await r(),n(!0),u("Site schema migration completed successfully!",{severity:"success"}),setTimeout(()=>{window.location.reload()},2e3)}catch(h){l.error("Migration failed",h),u(`Migration failed: ${ec(h)}`,{severity:"error"})}};return E.jsx("div",{className:"Middle",children:E.jsx("div",{className:"MigrationApp",children:E.jsxs(MO,{title:"Site Migration Required",className:"p-3",children:[E.jsx(xx,{severity:"warn",text:"This site uses an outdated schema format and requires migration before it can be used normally.",className:"mb-3"}),t&&E.jsxs("div",{className:"mb-3 p-3 border-1 border-300 border-round",children:[E.jsx("div",{className:"text-sm text-600 mb-2",children:"Site Schema Version Information:"}),E.jsxs("div",{className:"grid",children:[E.jsxs("div",{className:"col-12 md:col-6",children:[E.jsx("div",{className:"text-sm text-color-secondary",children:"Current Version:"}),E.jsx("div",{className:"font-semibold",children:t.currentSiteSchemaVersion})]}),E.jsxs("div",{className:"col-12 md:col-6",children:[E.jsx("div",{className:"text-sm text-color-secondary",children:"Target Version:"}),E.jsx("div",{className:"font-semibold",children:t.targetSiteSchemaVersion})]})]})]}),e?E.jsx(xx,{severity:"success",text:"Migration completed successfully! The page will reload shortly.",className:"mb-3"}):E.jsx(Aa,{label:"Run Site Migration",action:p,className:"p-button-lg",style:{marginBottom:"1rem"}}),c&&E.jsxs("div",{className:"text-sm text-color-secondary mt-4",children:["Site: ",c.publicSiteUrl]})]})})})}const che=_n`
2998
2998
  query {
2999
- publicSiteConstants {
2999
+ publicSiteConstants {
3000
+ fqdn
3000
3001
  publicSiteUrl
3001
3002
  platformAuthUrl
3002
3003
  faviconThumb
@@ -3005,7 +3006,7 @@ query GetInitialData($fieldNames: [String!]!, $language: String){
3005
3006
  siteStatus
3006
3007
  }
3007
3008
  }
3008
- `;function dhe(){const{refetch:e}=Za(che,{skip:!0});return f.useCallback(ei(e,n=>fhe(n.publicSiteConstants)),[e])}function fhe(e){return{publicSiteUrl:e.publicSiteUrl,platformAuthUrl:e.platformAuthUrl??void 0,faviconThumb:e.faviconThumb?JSON.parse(e.faviconThumb):void 0,adminUiFaviconThumb:e.adminUiFaviconThumb?JSON.parse(e.adminUiFaviconThumb):void 0,languageWithLabels:e.languageWithLabels,siteStatus:phe(e.siteStatus)}}function phe(e){if(e==="ready"||e==="migration")return e;throw new Error(`Invalid site status: "${e}"`)}function dj(e){return new URLSearchParams(window.location.search).has(e)}function RO(e){return new URLSearchParams(window.location.search).get(e)??void 0}function D9(...e){const n=window.location.search,t=new URLSearchParams(n);return e.map(a=>t.get(a)??void 0)}function fj(e){const n=e?new URLSearchParams(e):void 0;history.replaceState(null,"",n?`${EC}?${n.toString()}`:EC)}const mhe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%20width='30px'%20height='30px'%3e%3cpath%20fill='%23FFC107'%20d='M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z'%20/%3e%3cpath%20fill='%23FF3D00'%20d='M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z'%20/%3e%3cpath%20fill='%234CAF50'%20d='M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z'%20/%3e%3cpath%20fill='%231976D2'%20d='M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z'%20/%3e%3c/svg%3e";function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},sh.apply(null,arguments)}function Ox(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,a=Array(n);t<n;t++)a[t]=e[t];return a}function hhe(e){if(Array.isArray(e))return Ox(e)}function ghe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pj(e,n){if(e){if(typeof e=="string")return Ox(e,n);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ox(e,n):void 0}}function vhe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3009
+ `;function dhe(){const{refetch:e}=Za(che,{skip:!0});return f.useCallback(ei(e,n=>fhe(n.publicSiteConstants)),[e])}function fhe(e){return{fqdn:e.fqdn,publicSiteUrl:e.publicSiteUrl,platformAuthUrl:e.platformAuthUrl??void 0,faviconThumb:e.faviconThumb?JSON.parse(e.faviconThumb):void 0,adminUiFaviconThumb:e.adminUiFaviconThumb?JSON.parse(e.adminUiFaviconThumb):void 0,languageWithLabels:e.languageWithLabels,siteStatus:phe(e.siteStatus)}}function phe(e){if(e==="ready"||e==="migration")return e;throw new Error(`Invalid site status: "${e}"`)}function dj(e){return new URLSearchParams(window.location.search).has(e)}function RO(e){return new URLSearchParams(window.location.search).get(e)??void 0}function D9(...e){const n=window.location.search,t=new URLSearchParams(n);return e.map(a=>t.get(a)??void 0)}function fj(e){const n=e?new URLSearchParams(e):void 0;history.replaceState(null,"",n?`${EC}?${n.toString()}`:EC)}const mhe="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2048%2048'%20width='30px'%20height='30px'%3e%3cpath%20fill='%23FFC107'%20d='M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z'%20/%3e%3cpath%20fill='%23FF3D00'%20d='M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z'%20/%3e%3cpath%20fill='%234CAF50'%20d='M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z'%20/%3e%3cpath%20fill='%231976D2'%20d='M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z'%20/%3e%3c/svg%3e";function sh(){return sh=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},sh.apply(null,arguments)}function Ox(e,n){(n==null||n>e.length)&&(n=e.length);for(var t=0,a=Array(n);t<n;t++)a[t]=e[t];return a}function hhe(e){if(Array.isArray(e))return Ox(e)}function ghe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function pj(e,n){if(e){if(typeof e=="string")return Ox(e,n);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Ox(e,n):void 0}}function vhe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
3009
3010
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yhe(e){return hhe(e)||ghe(e)||pj(e)||vhe()}function ng(e){"@babel/helpers - typeof";return ng=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},ng(e)}function bhe(e,n){if(ng(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var a=t.call(e,n);if(ng(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function whe(e){var n=bhe(e,"string");return ng(n)=="symbol"?n:n+""}function She(e,n,t){return(n=whe(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Che(e){if(Array.isArray(e))return e}function Ehe(e,n){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var a,r,i,l,u=[],c=!0,p=!1;try{if(i=(t=t.call(e)).next,n!==0)for(;!(c=(a=i.call(t)).done)&&(u.push(a.value),u.length!==n);c=!0);}catch(h){p=!0,r=h}finally{try{if(!c&&t.return!=null&&(l=t.return(),Object(l)!==l))return}finally{if(p)throw r}}return u}}function xhe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3010
3011
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function I9(e,n){return Che(e)||Ehe(e,n)||pj(e,n)||xhe()}var Ohe={root:"p-accordion p-component",accordiontab:{root:function(n){var t=n.selected;return ge("p-accordion-tab",{"p-accordion-tab-active":t})},content:"p-accordion-content",header:function(n){var t=n.selected,a=n.getTabProp,r=n.tab;return ge("p-accordion-header",{"p-highlight":t,"p-disabled":a(r,"disabled")})},headeraction:"p-accordion-header-link",headericon:"p-accordion-toggle-icon",headertitle:"p-accordion-header-text",toggleablecontent:"p-toggleable-content",transition:"p-toggleable-content"}},Dhe=`
3011
3012
  @layer primereact {
package/dist/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <meta name="robots" content="noindex, nofollow" />
7
- <script type="module" crossorigin src="/adm/assets/index-DH29Xt4X.js"></script>
7
+ <script type="module" crossorigin src="/adm/assets/index-DlXkMcOB.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/adm/assets/index-CX2j4bcA.css">
9
9
  </head>
10
10
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@paroicms/admin-ui",
3
3
  "type": "module",
4
- "version": "1.85.0",
4
+ "version": "1.85.1",
5
5
  "description": "Admin UI for ParoiCMS",
6
6
  "repository": {
7
7
  "type": "git",
@@ -36,11 +36,11 @@
36
36
  "devDependencies": {
37
37
  "@apollo/client": "~3.13.8",
38
38
  "@paroi/use-async-effect": "~1.0.0",
39
- "@paroicms/internal-anywhere-lib": "1.35.3",
40
- "@paroicms/public-admin-ui-lib": "0.29.3",
41
- "@paroicms/public-anywhere-lib": "0.37.1",
39
+ "@paroicms/internal-anywhere-lib": "1.35.4",
40
+ "@paroicms/public-admin-ui-lib": "0.29.4",
41
+ "@paroicms/public-anywhere-lib": "0.37.2",
42
42
  "@paroicms/react-ui": "0.4.1",
43
- "@paroicms/ui-logger": "1.15.1",
43
+ "@paroicms/ui-logger": "1.15.2",
44
44
  "@testing-library/jest-dom": "~6.9.1",
45
45
  "@testing-library/react": "~16.3.0",
46
46
  "@testing-library/user-event": "~14.6.1",