@blinkk/root-cms 3.1.5 → 3.1.7
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/dist/app.js +1 -1
- package/dist/{chunk-MUXSUGFF.js → chunk-NIBAHWGP.js} +2 -2
- package/dist/{chunk-ETHWZSNM.js → chunk-PLSNGCYU.js} +196 -22
- package/dist/{chunk-6CTCV2PN.js → chunk-Z2CTQVYR.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/client.js +1 -1
- package/dist/core/client.d.ts +30 -2
- package/dist/core/cron-schedule.d.ts +63 -0
- package/dist/core/plugin.d.ts +6 -1
- package/dist/core.js +1 -1
- package/dist/functions.js +2 -2
- package/dist/plugin.js +7 -5
- package/dist/richtext.js +1 -1
- package/dist/shared/embed-protocol.d.ts +19 -0
- package/dist/ui/AIPage-XPE7F5AF.js +1 -0
- package/dist/ui/AssetsPage-C3ZEENBO.js +1 -0
- package/dist/ui/CollectionPage-VQ4WJHJB.js +1 -0
- package/dist/ui/ComparePage-VKOXKID4.js +1 -0
- package/dist/ui/{DataPage-RFNGSDDN.js → DataPage-JXZ2Z3DG.js} +1 -1
- package/dist/ui/{DataSourcePage-U46CDIH2.js → DataSourcePage-X3NSUOTP.js} +1 -1
- package/dist/ui/{DocTranslationsPage-BFCM2PE3.js → DocTranslationsPage-AJGT52XQ.js} +1 -1
- package/dist/ui/DocumentPage-ZFD2KE3A.js +1 -0
- package/dist/ui/{EditDataSourcePage-NKKIF6AD.js → EditDataSourcePage-EMK3F6HD.js} +1 -1
- package/dist/ui/EditReleasePage-3IAERDSH.js +1 -0
- package/dist/ui/EmbeddedAIPage-2W5F7QFL.js +1 -0
- package/dist/ui/{EmbeddedDocumentPage-2CNQJTW5.js → EmbeddedDocumentPage-BESFW2YZ.js} +1 -1
- package/dist/ui/{ImageEditorDialog-YDKOGVJV.js → ImageEditorDialog-JDXMU2FC.js} +1 -1
- package/dist/ui/LogsPage-KCD4XZ2N.js +1 -0
- package/dist/ui/NewDataSourcePage-EZDU7HGA.js +1 -0
- package/dist/ui/NewReleasePage-FFTRUIP4.js +1 -0
- package/dist/ui/{NotFoundPage-JRYFUENW.js → NotFoundPage-JGG2NTUE.js} +1 -1
- package/dist/ui/{ProjectPage-2WIMWCSX.js → ProjectPage-HT5JKR33.js} +1 -1
- package/dist/ui/ReleasePage-OYWLGV4D.js +1 -0
- package/dist/ui/{ReleasesPage-AW6PICTQ.js → ReleasesPage-XEII7FBC.js} +1 -1
- package/dist/ui/{SettingsPage-KFLNZ356.js → SettingsPage-7GIBTPB5.js} +1 -1
- package/dist/ui/SidebarToolsPage-GQYTZDAC.js +1 -0
- package/dist/ui/{TaskPage-GZGPKIL5.js → TaskPage-SNDDYDZY.js} +1 -1
- package/dist/ui/TasksPage-CEVWOY67.js +1 -0
- package/dist/ui/{TranslationsArbPage-K272JEAA.js → TranslationsArbPage-ADRLLAIW.js} +1 -1
- package/dist/ui/{TranslationsEditPage-XWXPNKRQ.js → TranslationsEditPage-PSKA7K44.js} +1 -1
- package/dist/ui/{TranslationsPage-7KUHVTLK.js → TranslationsPage-NGCLDSK7.js} +2 -2
- package/dist/ui/{chunk-75NMQ3LW.js → chunk-3YBRRPAN.js} +1 -1
- package/dist/ui/{chunk-QLIIVG5Q.js → chunk-5F5XJPKD.js} +1 -1
- package/dist/ui/{chunk-7UHZS56B.js → chunk-6ZVMJXLE.js} +53 -53
- package/dist/ui/chunk-7OU4ERTS.js +87 -0
- package/dist/ui/chunk-A2JZYRE3.js +1 -0
- package/dist/ui/chunk-B74M7NEV.js +1 -0
- package/dist/ui/chunk-BLHXP3SR.js +3 -0
- package/dist/ui/{chunk-UJX25CXD.js → chunk-BOIY4J2R.js} +1 -1
- package/dist/ui/chunk-CEWU5VSJ.js +1 -0
- package/dist/ui/{chunk-34W6H4YG.js → chunk-CXMVFNX3.js} +1 -1
- package/dist/ui/{chunk-F7RQT4XN.js → chunk-EET5AS64.js} +1 -1
- package/dist/ui/{chunk-WASID5UU.js → chunk-GJ7ES2LA.js} +1 -1
- package/dist/ui/{chunk-2RRM4HEQ.js → chunk-H5JL376P.js} +1 -1
- package/dist/ui/{chunk-H37RXS4R.js → chunk-HKCOKHA2.js} +1 -1
- package/dist/ui/{chunk-5KSGCGYY.js → chunk-HUYP5U4K.js} +1 -1
- package/dist/ui/{chunk-NCZD5IWS.js → chunk-HWON6MV4.js} +1 -1
- package/dist/ui/{chunk-HXSB6YB2.js → chunk-I3H465Z6.js} +1 -1
- package/dist/ui/{chunk-535JU7FU.js → chunk-ILFWJKSS.js} +1 -1
- package/dist/ui/chunk-K7IG7PO2.js +1 -0
- package/dist/ui/chunk-LKTN7YVM.js +31 -0
- package/dist/ui/{chunk-PLYSJ7W5.js → chunk-LS2JH5QF.js} +1 -1
- package/dist/ui/{chunk-QFDU6FXP.js → chunk-MALK5YEV.js} +1 -1
- package/dist/ui/{chunk-YP6ZH3MT.js → chunk-MFRPYPCF.js} +1 -1
- package/dist/ui/chunk-MYPLMHFW.js +1 -0
- package/dist/ui/{chunk-RB23LLKL.js → chunk-OKNBFTYR.js} +1 -1
- package/dist/ui/{chunk-OWBT6YUM.js → chunk-P2RVKNG4.js} +1 -1
- package/dist/ui/{chunk-JBLSUM6W.js → chunk-P57AFOMR.js} +1 -1
- package/dist/ui/{chunk-HV3JJ5UT.js → chunk-PLTI4NG7.js} +1 -1
- package/dist/ui/chunk-PY4JH5SN.js +1 -0
- package/dist/ui/{chunk-44ZU5WMI.js → chunk-SBAY52SC.js} +1 -1
- package/dist/ui/{chunk-Y5EOMMNI.js → chunk-TCKR2BL4.js} +1 -1
- package/dist/ui/{chunk-WC7KMPEQ.js → chunk-TCRDGNM4.js} +1 -1
- package/dist/ui/chunk-TCWN5YRW.js +1 -0
- package/dist/ui/{chunk-DWV5J2W7.js → chunk-TZWCCNSA.js} +1 -1
- package/dist/ui/{chunk-2PTLQRTU.js → chunk-U5OXKKBN.js} +1 -1
- package/dist/ui/{chunk-XUBZH4ON.js → chunk-VZGDXWRK.js} +1 -1
- package/dist/ui/{chunk-IGZDFHVM.js → chunk-X3VDQDHP.js} +1 -1
- package/dist/ui/chunk-XBYMUPZF.js +19 -0
- package/dist/ui/{chunk-QRAFYIAW.js → chunk-XYXL5HSZ.js} +1 -1
- package/dist/ui/chunk-Y7RYSRP7.js +7 -0
- package/dist/ui/{chunk-WRA24P66.js.LEGAL.txt → chunk-Y7RYSRP7.js.LEGAL.txt} +1 -0
- package/dist/ui/chunk-YIKHJONY.js +1 -0
- package/dist/ui/chunk-Z2CRNO3I.js +1 -0
- package/dist/ui/{chunk-UCYWQEAS.js → chunk-ZD3ORGA6.js} +1 -1
- package/dist/ui/{chunk-YBHFGQ3Z.js → chunk-ZQDUWURP.js} +1 -1
- package/dist/ui/{chunk-PIJ3E47R.js → chunk-ZYSR5UIW.js} +1 -1
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +3 -3
- package/dist/ui/AIPage-25WICIOT.js +0 -1
- package/dist/ui/AssetsPage-WKTM2J2G.js +0 -1
- package/dist/ui/CollectionPage-5ZOVG7IG.js +0 -1
- package/dist/ui/ComparePage-DDIFYYTK.js +0 -1
- package/dist/ui/DocumentPage-OTBXM55S.js +0 -1
- package/dist/ui/EditReleasePage-TKNOUT7A.js +0 -1
- package/dist/ui/EmbeddedAIPage-4AX7VO3T.js +0 -1
- package/dist/ui/LogsPage-SCECIAZH.js +0 -1
- package/dist/ui/NewDataSourcePage-FAOPK2RZ.js +0 -1
- package/dist/ui/NewReleasePage-HD6T6UV2.js +0 -1
- package/dist/ui/ReleasePage-GUMEMLF6.js +0 -1
- package/dist/ui/SidebarToolsPage-3R7BQ2F7.js +0 -1
- package/dist/ui/TasksPage-G3GBTV3L.js +0 -1
- package/dist/ui/chunk-2FQMT5AB.js +0 -3
- package/dist/ui/chunk-FVWSVOOY.js +0 -1
- package/dist/ui/chunk-GCSN3YEC.js +0 -31
- package/dist/ui/chunk-N5RJIILP.js +0 -1
- package/dist/ui/chunk-NXWYS4HG.js +0 -19
- package/dist/ui/chunk-OWYV43BT.js +0 -1
- package/dist/ui/chunk-QWB6MAPJ.js +0 -7
- package/dist/ui/chunk-RN4XVVWD.js +0 -1
- package/dist/ui/chunk-T5BJNOWE.js +0 -1
- package/dist/ui/chunk-TNW2GNUR.js +0 -1
- package/dist/ui/chunk-UPN3EMUS.js +0 -1
- package/dist/ui/chunk-VPZHG7JL.js +0 -81
- package/dist/ui/chunk-WRA24P66.js +0 -7
- package/dist/ui/chunk-Z3ZJJWFT.js +0 -1
- /package/dist/ui/{ImageEditorDialog-YDKOGVJV.js.LEGAL.txt → ImageEditorDialog-JDXMU2FC.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-7UHZS56B.js.LEGAL.txt → chunk-6ZVMJXLE.js.LEGAL.txt} +0 -0
- /package/dist/ui/{chunk-VPZHG7JL.js.LEGAL.txt → chunk-7OU4ERTS.js.LEGAL.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ne}from"./chunk-44ZU5WMI.js";import{a as _e}from"./chunk-OWYV43BT.js";import{h as O}from"./chunk-N5RJIILP.js";import{a as oe,e as te,j as le}from"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import{b as F,c as H,d as S,f as A}from"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import{a as x}from"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as B}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import{b as C}from"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as ee}from"./chunk-W5DOO6ID.js";import{a as Q}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as ce}from"./chunk-QLIIVG5Q.js";import{c as ie}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{B as Y,z as Z}from"./chunk-XOWWPE7X.js";import{d as V,e as w}from"./chunk-WASID5UU.js";import{$a as q,Ca as X,Fa as k,Ga as e,Ta as K,Ua as W,V as I,W as M,a as U,ab as G,ba as $,c as E,cb as J,da as D,fb as z,j as me,qa as P,za as j}from"./chunk-WRA24P66.js";import{d as N}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";me();var R=[{value:"comfortable",label:"Comfortable",Icon:K},{value:"compact",label:"Compact",Icon:W}];function L(o){let{route:i}=V(),l=window.__ROOT_CTX.rootConfig.projectId;ce(o.collection?o.collection:"Content"),E(()=>{let c=window.__ROOT_CTX.collections,n=`root-cms::${l}::last_collection`;if(o.collection)window.localStorage.setItem(n,o.collection);else{let a=window.localStorage.getItem(n);if(a&&c[a]){i(`/cms/content/${a}`);return}if(window.__ROOT_CTX.collections.Pages){i("/cms/content/Pages");return}let s=Object.keys(window.__ROOT_CTX.collections)||[];if(s.length>0){let h=s[0];i(`/cms/content/${h}`);return}console.warn("no collections")}},[o.collection,l]);let _=window.__ROOT_CTX.collections;return e(ie,{children:e("div",{className:"CollectionPage",children:e("div",{className:"CollectionPage__layout",children:[e("div",{className:"CollectionPage__side",children:e(ne,{collections:_,activeCollectionId:o.collection,projectId:l})}),e("div",{className:"CollectionPage__main",children:o.collection&&e(L.Collection,{collection:o.collection},o.collection)})]})})})}L.Collection=o=>{let{roles:i}=Q(),l=window.firebase.user.email||"",_=ee(i,l),[c,n]=x(`root::CollectionPage:${o.collection}:orderBy`,"modifiedAt"),[a,s]=x(`root::CollectionPage:${o.collection}:showArchived`,!1),[h,m]=U(!1),t=window.__ROOT_CTX.collections[o.collection];if(!t)return route("/cms/content"),e(N,{});let d=!!t.viewOptions?.compact,[r,p]=x("root::CollectionPage:density","comfortable"),g=d?"compact":r,f=g==="compact",v=[{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"title",label:"Title (A-Z)"},{value:"titleDesc",label:"Title (Z-A)"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"modifiedAt",label:"Last modified"},{value:"modifiedAtAsc",label:"Least recently modified"},...t.sortOptions?.map(u=>({value:u.id,label:u.label}))||[]],[b,de,T]=te(o.collection,{orderBy:c,includeArchived:a}),re=b&&T.length===0,ge=!b&&T.length===0;return e(N,{children:[e(le,{collection:o.collection,opened:h,onClose:()=>m(!1)}),e("div",{className:"CollectionPage__collection",children:e("div",{className:"CollectionPage__collection__docsTab",children:[e("div",{className:"CollectionPage__collection__docsTab__header",children:[e("div",{className:"CollectionPage__collection__docsTab__header__title",children:t.name||o.collection}),e("div",{className:"CollectionPage__collection__docsTab__controls",children:[e("div",{className:"CollectionPage__collection__docsTab__controls__showArchived",children:e(X,{size:"sm",color:"dark",label:"Show archived:",checked:a,onChange:u=>s(!!u.currentTarget.checked)})}),e("div",{className:"CollectionPage__collection__docsTab__controls__sort",children:[e("div",{className:"CollectionPage__collection__docsTab__controls__sort__label",children:"Sort:"}),e(j,{size:"xs",value:c,onChange:u=>n(u||"modifiedAt"),data:v})]}),e(pe,{density:g,locked:d,onChange:p}),e("div",{className:"CollectionPage__collection__docsTab__controls__newDoc",children:e(B,{label:"You don't have access to create new documents",condition:!_,children:e(D,{color:"dark",size:"xs",leftIcon:e(z,{size:16}),onClick:()=>m(!0),disabled:!_,children:"New"})})})]})]}),e(_e,{className:"CollectionPage__collection__docsTab__content",children:re?e("div",{className:"CollectionPage__collection__docsTab__content__loading",children:e(I,{color:"gray",size:"xl"})}):ge?e("div",{class:"CollectionPage__collection__docsEmpty",children:[e("div",{class:"CollectionPage__collection__docsEmpty__title",children:"Collection is empty."}),e("div",{class:"CollectionPage__collection__docsEmpty__button",children:e(B,{label:"You don't have access to create new documents",condition:!_,children:e(D,{color:"dark",size:"xs",leftIcon:e(z,{size:16}),onClick:()=>m(!0),disabled:!_,children:"New"})})})]}):e("div",{className:"CollectionPage__collection__docsTab__content__list",children:[b&&e("div",{className:"CollectionPage__collection__docsTab__content__reloading",children:e(I,{color:"gray",size:"md"})}),e("div",{className:w("CollectionPage__collection__docsTab__content__items",b&&"CollectionPage__collection__docsTab__content__items--loading"),children:e(L.DocsList,{collection:o.collection,docs:T,compact:f,orderBy:c,onSort:n,reloadDocs:()=>de()})})]})})]})})]})};function pe(o){let l=(R.find(c=>c.value===o.density)||R[0]).Icon,_=e(M,{variant:"default",color:"gray",size:30,disabled:o.locked,"aria-label":"Change view density",children:e(l,{size:16})});return e("div",{className:"CollectionPage__collection__docsTab__controls__density",children:[e("div",{className:"CollectionPage__collection__docsTab__controls__density__label",children:"View:"}),o.locked?e(k,{label:"This collection is locked to the compact view",transition:"pop",withArrow:!0,children:_}):e(P,{position:"bottom",placement:"end",control:_,children:[e(P.Label,{children:"View density"}),R.map(c=>{let n=c.Icon,a=c.value===o.density;return e(P.Item,{icon:e(n,{size:18}),rightSection:a?e(q,{size:14,stroke:2.5}):void 0,onClick:()=>o.onChange(c.value),children:c.label},c.value)})]})]})}var se={slug:{asc:"slug",desc:"slugDesc",defaultDir:"asc"},title:{asc:"title",desc:"titleDesc",defaultDir:"asc"},created:{asc:"oldest",desc:"newest",defaultDir:"desc"},modified:{asc:"modifiedAtAsc",desc:"modifiedAt",defaultDir:"desc"}};function fe(o,i){let l=se[o];return!l||!i?null:i===l.asc?"asc":i===l.desc?"desc":null}function y(o){let i=se[o.column],l=fe(o.column,o.orderBy),_=l!==null;function c(){if(!o.onSort)return;let n;l==="asc"?n="desc":l==="desc"?n="asc":n=i.defaultDir,o.onSort(i[n])}return e("button",{type:"button",className:w("CollectionPage__collection__docsList__header__cell","CollectionPage__collection__docsList__header__cell--sortable",_&&"CollectionPage__collection__docsList__header__cell--active"),onClick:c,"aria-label":`Sort by ${o.label}`,children:[e("span",{children:o.label}),_&&(l==="asc"?e(J,{size:12,stroke:2.5}):e(G,{size:12,stroke:2.5}))]})}L.DocsList=o=>{let i=o.collection,l=window.__ROOT_CTX.collections[o.collection];if(!l)throw new Error(`could not find collection: ${i}`);let _=!!l.url,c=!!o.compact,n=o.docs||[],{getReleasesForDoc:a}=F(),s=c&&n.some(t=>a(t.id).length>0);function h(t){return _?oe({collectionId:i,slug:t}):""}function m(t){(t.action==="archive"||t.action==="copy"||t.action==="unarchive"||t.action==="delete"||t.action==="unpublish"||t.action==="locked"||t.action==="unlocked")&&o.reloadDocs()}return c?e("div",{className:w("CollectionPage__collection__docsList","CollectionPage__collection__docsList--compact",s&&"CollectionPage__collection__docsList--withRelease"),children:[e("div",{className:"CollectionPage__collection__docsList__header",children:[e("div",{className:"CollectionPage__collection__docsList__header__image"}),e(y,{column:"slug",label:"Slug",orderBy:o.orderBy,onSort:o.onSort}),e(y,{column:"title",label:"Title",orderBy:o.orderBy,onSort:o.onSort}),e("div",{className:"CollectionPage__collection__docsList__header__cell",children:"Status"}),s&&e("div",{className:"CollectionPage__collection__docsList__header__cell",children:"Release"}),e(y,{column:"created",label:"Created",orderBy:o.orderBy,onSort:o.onSort}),e(y,{column:"modified",label:"Modified",orderBy:o.orderBy,onSort:o.onSort}),e("div",{className:"CollectionPage__collection__docsList__header__controls"})]}),n.map(t=>{let d=`/cms/content/${i}/${t.slug}`,r=t.fields||{},p=C(r,l.preview?.title||"meta.title"),g=C(r,l.preview?.image||"meta.image")||l.preview?.defaultImage,f=s?a(t.id):[];return e("div",{className:"CollectionPage__collection__docsList__doc",children:[e("a",{className:"CollectionPage__collection__docsList__doc__image",href:d,children:e(A,{file:g,width:48,height:36,withPlaceholder:!g?.src})}),e("a",{className:"CollectionPage__collection__docsList__doc__docId",href:d,children:t.slug}),e("a",{className:"CollectionPage__collection__docsList__doc__title",href:d,children:p||"[UNTITLED]"}),e("div",{className:"CollectionPage__collection__docsList__doc__badges",children:e(S,{doc:t,hideReleases:!0})}),s&&e("div",{className:"CollectionPage__collection__docsList__doc__releases",children:f.map(v=>e(k,{transition:"pop",label:`In release: ${v.id}`,children:e($,{component:"a",href:`/cms/releases/${v.id}`,size:"xs",variant:"gradient",gradient:{from:"violet",to:"grape"},style:{cursor:"pointer"},children:v.id})},v.id))}),e("div",{className:"CollectionPage__collection__docsList__doc__timestamp",children:ae(t?.sys?.createdAt,t?.sys?.createdBy)}),e("div",{className:"CollectionPage__collection__docsList__doc__timestamp",children:ae(t?.sys?.modifiedAt,t?.sys?.modifiedBy)}),e("div",{className:"CollectionPage__collection__docsList__doc__controls",children:e(O,{docId:t.id,data:t,onAction:m})})]},t.id)})]}):e("div",{className:"CollectionPage__collection__docsList",children:n.map(t=>{let d=`/cms/content/${i}/${t.slug}`,r=h(t.slug),p=t.fields||{},g=C(p,l.preview?.title||"meta.title"),f=C(p,l.preview?.image||"meta.image")||l.preview?.defaultImage;return e("div",{className:"CollectionPage__collection__docsList__doc",children:[e("div",{className:"CollectionPage__collection__docsList__doc__image",children:e("a",{href:d,children:e(A,{file:f,width:120,height:90,withPlaceholder:!f?.src})})}),e("a",{className:"CollectionPage__collection__docsList__doc__content",href:d,children:[e("div",{className:"CollectionPage__collection__docsList__doc__content__header",children:[e("div",{className:"CollectionPage__collection__docsList__doc__content__header__docId",children:t.id}),e(S,{doc:t})]}),e("div",{className:"CollectionPage__collection__docsList__doc__content__title",children:g||"[UNTITLED]"}),_&&r&&e("div",{className:"CollectionPage__collection__docsList__doc__content__url",children:r})]}),e("div",{className:"CollectionPage__collection__docsList__doc__controls",children:e(O,{docId:t.id,data:t,onAction:m})})]},t.id)})})};function ae(o,i){return!o||typeof o.toMillis!="function"?e("span",{className:"CollectionPage__collection__docsList__doc__timestamp__value",children:"\u2014"}):e(H,{message:Y(o),user:i,children:e("span",{className:"CollectionPage__collection__docsList__doc__timestamp__value",children:Z(o.toMillis())})})}export{L as CollectionPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as s}from"./chunk-T5BJNOWE.js";import"./chunk-QWB6MAPJ.js";import"./chunk-VPZHG7JL.js";import"./chunk-5MV6XVGA.js";import"./chunk-NCZD5IWS.js";import{a as m}from"./chunk-QLIIVG5Q.js";import{c as d}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as t}from"./chunk-WASID5UU.js";import{Ga as a,g as i,j as p}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";p();function h(){let{query:r}=t();m("Compare");let o=i(()=>n(r.left||""),[r.left]),e=i(()=>n(r.right||""),[r.right]);return a(d,{children:a("div",{className:"ComparePage",children:o&&e?a(s,{className:"ComparePage__diff",left:o,right:e}):a("div",{className:"ComparePage__error",children:"Invalid params, double check query params."})})})}function n(r){let[o,e]=String(r).split("@");return o&&e?{docId:o,versionId:e}:null}export{h as ComparePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as qe,j as Je,k as Ye,l as G,n as Ge,o as Qe,p as Ze,q as et,s as tt}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import"./chunk-FBSBL476.js";import{a as nt}from"./chunk-NXWYS4HG.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import{c as Ue}from"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import{b as it}from"./chunk-RB23LLKL.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import"./chunk-HXSB6YB2.js";import"./chunk-N5RJIILP.js";import{b as je,c as ce,g as Xe}from"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import{a as T}from"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as fe}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as He}from"./chunk-W5DOO6ID.js";import{a as $e}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as at}from"./chunk-QLIIVG5Q.js";import{c as ot}from"./chunk-OWBT6YUM.js";import{a as Ke}from"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as E}from"./chunk-WASID5UU.js";import{$a as Ne,$b as Ae,$c as We,Fa as R,Ga as e,Gc as Ve,Ia as Se,Oa as ye,P as ke,Qa as ie,Sa as Ie,W as N,Wa as Ee,_b as Be,a as I,ad as re,ba as De,c as b,da as Y,e as w,g as z,h as D,j as ae,nb as Te,tb as Re,ub as Le,vb as Me,vc as Oe,wb as ze,za as Ce,zc as Fe}from"./chunk-WRA24P66.js";import{d as W,j as be,k as ft}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";ae();ae();async function rt(t,o){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:o})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function ct(t){let o=window.__ROOT_CTX.checks||[],n=t.docId.split("/")[0],a=o.filter(l=>!l.collections||l.collections.includes(n)),[i,c]=I({}),d=D(async l=>{c(h=>({...h,[l]:{loading:!0}}));try{let h=await rt(l,t.docId);c(_=>({..._,[l]:{loading:!1,result:h}}))}catch(h){c(_=>({..._,[l]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId]),u=D(async()=>{let l={};for(let h of a)l[h.id]={loading:!0};c(l);for(let h of a)try{let _=await rt(h.id,t.docId);c(f=>({...f,[h.id]:{loading:!1,result:_}}))}catch(_){c(f=>({...f,[h.id]:{loading:!1,error:_.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(Y,{variant:"default",size:"xs",compact:!0,leftIcon:e(Oe,{size:12}),onClick:u,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(l=>{let h=i[l.id];return e(vt,{check:l,state:h,onRun:()=>d(l.id)},l.id)})})})]})}function vt(t){let{check:o,state:n,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[o.label,n?.result&&e(xt,{status:n.result.status})]}),e(Y,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:n?.loading,onClick:a,children:"Run"})]}),o.description&&e("div",{className:"ChecksPanel__check__description",children:o.description}),n?.result&&e("div",{className:E("ChecksPanel__check__result",`ChecksPanel__check__result--${n.result.status}`),children:e(Ue,{code:n.result.message})}),n?.error&&e("div",{className:"ChecksPanel__check__error",children:n.error})]})}var Pt={success:"green",warning:"yellow",error:"red"},wt={success:Ne,warning:Se,error:re};function xt(t){let o=Pt[t.status],n=wt[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(De,{className:"ChecksPanel__statusBadge",color:o,size:"sm",variant:"filled",leftSection:e(n,{size:10}),children:a})}function st(t){let{devices:o,multiSelect:n,expandVertically:a,iframeUrl:i,localeOptions:c,selectedLocale:d,onToggleDevice:u,onToggleMultiSelect:l,onToggleExpandVertically:h,onReloadClick:_,onOpenNewTab:f,onLocaleChange:C}=t,g=o.length>0;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(R,{label:"Mobile",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("mobile")&&"active"),"aria-pressed":o.includes("mobile"),onClick:()=>u("mobile"),children:e(ze,{size:16})})}),e(R,{label:"Tablet",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("tablet")&&"active"),"aria-pressed":o.includes("tablet"),onClick:()=>u("tablet"),children:e(Me,{size:16})})}),e(R,{label:"Desktop",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("desktop")&&"active"),"aria-pressed":o.includes("desktop"),onClick:()=>u("desktop"),children:e(Re,{size:16})})}),e("div",{className:"DocumentPagePreviewBar__divider"}),e(R,{label:"Compare viewports",children:e(N,{className:E("DocumentPagePreviewBar__device",n&&"active"),role:"checkbox","aria-checked":n,onClick:l,children:e(Te,{size:16})})}),e(R,{label:"Expand",children:e(N,{className:E("DocumentPagePreviewBar__device",a&&"active"),"aria-pressed":a,disabled:!g,onClick:h,children:e(Ie,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:i})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(Ce,{data:c,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(We,{size:16,strokeWidth:1.5}),value:d,onChange:v=>{C(v)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(R,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:_,children:e(Fe,{size:16})})}),e(R,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:f,children:e(ie,{size:16})})})]})]})}ae();function lt(t){let o=t.docId.split("/")[0],n=Xe(o),a=G(),i=w(null),[c,d]=I(""),[u,l]=I([]),[h,_]=I(!1),f=w("");f.current=c;let C=w(n.schema?.fields||[]);C.current=n.schema?.fields||[];let g=w(n.schema?.types||{});g.current=n.schema?.types||{};let v=z(()=>Je(p=>{let k=p.trim();if(!k){l([]),_(!1);return}let y=a.controller?.getData()?.fields||{},L=et(k,y,C.current,g.current);l(L),_(!0)},150),[a.controller]);b(()=>{v(c)},[c,v]),Ge(()=>{f.current.trim()&&v(f.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let p=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",p),()=>window.removeEventListener("root:focus-search",p)},[]);let P=p=>{Dt(p)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(N,{size:"xs",onClick:t.onClose,title:"Close search",children:e(re,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ve,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:c,onInput:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Escape"&&t.onClose&&(p.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!h&&!c.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),h&&u.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:c}),"."]}),u.length>0&&e(W,{children:[e("div",{className:"SearchPanel__resultsCount",children:[u.length," ",u.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:u.map((p,k)=>e(bt,{result:p,onClick:()=>P(p)},`${p.deepKey}:${k}`))})]})]})]})}function bt(t){let{result:o}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:o.label}),e("div",{className:"SearchPanel__result__snippet",children:kt(o.snippet,o.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:o.fieldType}),o.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),o.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function kt(t,o){if(!o||o.length===0)return t;let n=[],a=0;for(let i of o)i.start>a&&n.push({text:t.slice(a,i.start),match:!1}),n.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&n.push({text:t.slice(a),match:!1}),n.map((i,c)=>i.match?e("mark",{children:i.text},c):e("span",{children:i.text},c))}function Dt(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let o=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Qe,{detail:o}))},350)}else if(t.richTextInline){let o=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ze,{detail:o}))},350)}}ft();ae();var Ct=be(null);function Q(t){let{className:o,localStorageId:n,children:a}=t,[i,c]=T(`root::SplitPanel:${n}`,350),[d,u]=I(!1),[l,h]=I(0),_=z(()=>new Set,[]),f=w(null),C=w(null),g={onResize:P=>(_.add(P),()=>{_.delete(P)})};if(b(()=>{let P=()=>u(!1);window.addEventListener("mouseup",P);let p=f.current;return p&&h(p.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",P)},[]),b(()=>{let P=p=>{let k=p.clientX-l;c(k),_.forEach(y=>y())};return d&&window.addEventListener("mousemove",P),()=>window.removeEventListener("mousemove",P)},[d]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let v={"--panel-size":`${i}px`};return e(Ct.Provider,{value:g,children:e("div",{className:E(o,"SplitPanel",d&&"dragging"),ref:f,style:v,children:[a[0],e("div",{className:"SplitPanel__divider",ref:C,onMouseDown:()=>u(!0)}),a[1]]})})}Q.Item=t=>e("div",{className:E("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function ve(t,o,n=""){let a=ce({collectionId:t,slug:o}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let c=`${i.toString()}${window.location.hash}`;return n?`${ce({collectionId:t,slug:o,locale:n})}?${c}`:`${a}?${c}`}function St(t,o){let n=new URL(o,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===n.origin&&i.pathname===n.pathname&&(i.searchParams.forEach((c,d)=>{n.searchParams.set(d,c)}),n.hash=i.hash)}}catch{}return n.searchParams.set("preview","true"),n.toString()}function dt(t){let o=t.collection,n=t.slug,a=`${o}/${n}`,{roles:i}=$e(),c=window.firebase.user.email||"",d=He(i,c);return e(Ye,{docId:a,readOnly:!d,children:e(yt,{...t,canEdit:d})})}function yt(t){let o=t.canEdit,n=t.collection,a=t.slug,i=`${n}/${a}`;at(i);let c=window.__ROOT_CTX.collections[n],d=G(),u=!!c?.url,[l,h]=T(`root::DocumentPage::previewVisible::${n}`,u),_=z(()=>(window.__ROOT_CTX.checks||[]).some(x=>!x.collections||x.collections.includes(n)),[n]),[f,C]=T("root::DocumentPage::checksVisible",!1),g=w(f);g.current=f;let[v,P]=T("root::DocumentPage::searchVisible",!1),p=w(v);p.current=v;let k=Ke(),[y,L]=T("root::DocumentPage::aiVisible",!1),X=w(y);X.current=y,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:f}))},[f]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:v}))},[v]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:y}))},[y]);let[A,le]=T("root::DocumentPage::searchPanelWidth",360),[O,q]=I(A),[F,K]=I(!1),Z=w(null);if(b(()=>{let S=()=>{let x=!g.current;C(()=>x),x&&(P(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",S),()=>window.removeEventListener("root:toggle-checks",S)},[]),b(()=>{let S=()=>{let x=!p.current;P(()=>x),x&&(C(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",S),()=>window.removeEventListener("root:toggle-search",S)},[]),b(()=>{let S=()=>{let x=!X.current;L(()=>x),x&&(C(()=>!1),P(()=>!1))};return window.addEventListener("root:toggle-ai",S),()=>window.removeEventListener("root:toggle-ai",S)},[]),b(()=>{if(!F)return;let S=H=>{let oe=Z.current;if(!oe)return;let pe=oe.getBoundingClientRect(),J=Math.max(240,Math.min(pe.right-H.clientX,800));q(J)},x=()=>{K(!1),q(H=>(le(()=>H),H))};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",x)}},[F]),!c)return e("div",{children:"Could not find collection."});let ee=D(()=>{if(!u)return;let S=ve(n,a),x=window.open(S,"_blank","noopener,noreferrer");x&&x.focus()},[u,n,a]),U=D(()=>{o&&d.controller&&d.controller.flush()},[o,d.controller]),$=qe(),de=D(()=>{let S=d.controller?.getData()?.fields||{};$.open({data:S,onSave:x=>{d.controller&&x&&typeof x=="object"&&(d.controller.updateKey("fields",x),d.controller.flush()),$.close()}})},[d.controller]),ue=D(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),te=D(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),me=D(()=>{L(()=>!1)},[L]);return ke([["mod+S",U],["mod+shift+F",ue],["mod+I",te]]),e(ot,{children:e("div",{className:E("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Z,children:[e(Q,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(Q.Item,{className:E("DocumentPage__side",(!u||!l)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${n}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ye,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(Y,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(Le,{size:16}),onClick:()=>U(),disabled:!o,children:"Save"})}),e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(R,{label:"Edit JSON",disabled:!o,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>de(),disabled:!o,children:e(Ee,{size:14})})})}),u&&e(W,{children:[e(R,{label:l?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>h(!l),children:l?e(Be,{size:16}):e(Ae,{size:16})})}),!l&&e(R,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ee,children:e(ie,{size:16})})})]})]})]}),e("div",{className:E("DocumentPage__side__editor",(!u||!l)&&!f&&!v&&!y&&"DocumentPage__side__editor--centered"),children:e(tt,{docId:i})})]}),e(Q.Item,{className:E("DocumentPage__main",(!u||!l)&&"DocumentPage__main--hidden"),fluid:!0,children:u&&l&&e(dt.Preview,{docId:i},i)})]}),_&&f&&e(Et,{docId:i}),v&&e(W,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>K(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${O}px`},children:e(lt,{docId:i,autoFocus:!0,onClose:()=>P(()=>!1)})})]}),k&&y&&e(It,{docId:i,onClose:me})]})})}function It(t){let[o,n]=T("root::DocumentPage::aiPanelWidth",420),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(nt,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(280,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__aiDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:l})]})}function Et(t){let[o,n]=T("root::DocumentPage::checksPanelWidth",360),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(ct,{docId:t.docId}),[t.docId]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(200,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__checksDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:l})]})}var se={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]},Pe=["mobile","tablet","desktop"],Nt="root::DocumentPage::preview::devices",Tt="root::DocumentPage::preview::device";function Rt(){try{let t=window.localStorage.getItem(Tt);if(t){let o=JSON.parse(t);if(Pe.includes(o))return[o]}}catch(t){console.error(t)}return[]}function Lt(t){let o=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${o.of(a)||t} (${t})`}dt.Preview=t=>{let o=G();if(o.loading)return null;let[n,a]=t.docId.split("/"),c=window.__ROOT_CTX.collections[n];if(!c)throw new Error(`collection not found: ${n}`);if(!c.url)return null;let d=c.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",u=je({collectionId:n,slug:a}),l=ce({collectionId:n,slug:a}),h=`${d}${u}`,[_,f]=I(h),C=z(Rt,[]),[g,v]=T(Nt,C),[P,p]=T("root::DocumentPage::preview::multiSelect",!1),[k,y]=T("root::DocumentPage::preview::expandVertically",!1),[L,X]=I({scale:1,frameHeight:0}),[A,le]=it("locale",""),O=w(new Map),q=w(new Map),F=w(null),K=w([]),Z=D(r=>{let s=q.current.get(r);return s||(s=m=>{m?O.current.set(r,m):O.current.delete(r)},q.current.set(r,s)),s},[]),ee=o.controller.getLocales()||[],U=ve(n,a,A),$=w(U);$.current=U;let de=z(()=>[{value:"",label:"Select locale"},...ee.map(r=>({value:r,label:Lt(r)}))],[ee]);function ue(r){if(document.hidden)return;let s=St(r,$.current);r.src="about:blank",window.requestAnimationFrame(()=>{r.src!==s?r.src=s:r.contentWindow.location.reload()})}function te(){O.current.forEach(r=>ue(r))}b(()=>{let r=o.controller?.onFlush(()=>{te()});return()=>{r?.()}},[]),b(()=>{O.current.forEach(r=>{r.src=U})},[A]);let me=g.length>0?g.length:1;b(()=>{let r=Array.from(O.current.values());function s(m){let V=m.currentTarget.contentWindow;if(V&&l===u&&!V.location.href.startsWith("about:blank")){let j=V.location;f(`${d}${j.pathname}`)}}return r.forEach(m=>{m.getAttribute("src")||(m.src=$.current),m.addEventListener("load",s)}),()=>{r.forEach(m=>m.removeEventListener("load",s))}},[me]);let S=D(r=>{if(P){v(s=>{if(s.includes(r)){let m=s.filter(M=>M!==r);return m.length===0&&y(!1),m}return Pe.filter(m=>m===r||s.includes(m))});return}v(s=>s.length===1&&s[0]===r?(y(!1),[]):[r])},[P,v,y]),x=D(()=>{p(r=>{let s=!r;return v(s?m=>{if(K.current=m,m.length>=2)return m;let M=m[0]||"desktop",V=M==="desktop"?"mobile":"desktop";return Pe.filter(j=>j===M||j===V)}:()=>K.current),s})},[p,v]),H=D(()=>{g.length!==0&&y(r=>!r)},[g,y]),oe=D(()=>{o.controller&&o.controller.flush().then(()=>te())},[o.controller]),pe=D(()=>{let r=ve(n,a,A),s=window.open(r,"_blank","noopener,noreferrer");s&&s.focus()},[n,a,A]),J=D(()=>{if(g.length===0){X(B=>B.scale===1&&B.frameHeight===0?B:{scale:1,frameHeight:0});return}let r=F.current;if(!r)return;let s=r.getBoundingClientRect(),m=20,M=16,V=28,j=g.length,we=Math.max(s.width-2*m-M*(j-1),0),he=Math.max(s.height-2*m-V,0),_e=0,ne=0;for(let B of g){let[_t,gt]=se[B];_e+=_t,ne=Math.max(ne,gt)}let mt=we>0&&_e>0?we/_e:1,pt=he>0&&ne>0?he/ne:1,ht=Math.min(mt,pt,1),ge=Number(ht.toFixed(4))||1,xe=Math.max(he/ge,0);X(B=>B.scale===ge&&B.frameHeight===xe?B:{scale:ge,frameHeight:xe})},[g]);b(()=>{J();let r=F.current;if(!r)return;let s=0,m=()=>{window.cancelAnimationFrame(s),s=window.requestAnimationFrame(J)},M=new window.ResizeObserver(m);return M.observe(r),window.addEventListener("resize",m),()=>{window.cancelAnimationFrame(s),M.disconnect(),window.removeEventListener("resize",m)}},[J]);let ut=g.length>0?g.map((r,s)=>({slot:s,device:r})):[{slot:0,device:null}];return e("div",{className:"DocumentPage__main__preview",children:[e(st,{devices:g,multiSelect:P,expandVertically:k,iframeUrl:_,localeOptions:de,selectedLocale:A,onToggleDevice:S,onToggleMultiSelect:x,onToggleExpandVertically:H,onReloadClick:oe,onOpenNewTab:pe,onLocaleChange:le}),e("div",{className:"DocumentPage__main__previewFrame","data-device":g.length>0?"device":"full",ref:F,children:e("div",{className:"DocumentPage__main__previewFrame__group",children:ut.map(r=>{let s=r.device,m=s?{"--iframe-width":`${se[s][0]}px`,"--iframe-height":`${k?L.frameHeight:se[s][1]}px`,"--iframe-scale":String(L.scale)}:void 0;return e("div",{className:"DocumentPage__main__previewFrame__item",style:m,children:[e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:Z(r.slot),title:"iframe preview"})}),s&&e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${s}: ${se[s].join("x")}`})]},r.slot)})})})]})};export{dt as DocumentPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as U}from"./chunk-IGZDFHVM.js";import"./chunk-WC7KMPEQ.js";import"./chunk-F7RQT4XN.js";import"./chunk-DWV5J2W7.js";import{a as z}from"./chunk-HXSB6YB2.js";import{a as N}from"./chunk-OWYV43BT.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import{d as s,f as E,g as w}from"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as I}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import{a as x,c as C}from"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as T}from"./chunk-W5DOO6ID.js";import{a as A}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import{a as h,b as f}from"./chunk-PIJ3E47R.js";import{a as g}from"./chunk-NCZD5IWS.js";import{a as $}from"./chunk-QLIIVG5Q.js";import{c as k}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as P}from"./chunk-WASID5UU.js";import{Ac as y,Fa as m,Ga as e,La as p,W as c,a as v,c as R,ca as b,j as H}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";H();function de(a){$(`Edit Release: ${a.id}`);let{route:u}=P(),[M,t]=v(null),l=x(),_=C(),{roles:d}=A(),S=window.firebase.user.email||"",o=T(d,S);R(()=>{s(a.id).then(i=>{t(i)})},[a.id]);function L(){let i=`archive-release-${a.id}`,r=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:i,title:"Archiving release",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let n=await s(a.id);t(n),f({id:i,title:"Archived release",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),l.closeModal(r),u("/cms/releases")}})}function B(){let i=`unarchive-release-${a.id}`,r=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:i,title:"Unarchiving release",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await w(a.id);let n=await s(a.id);t(n),f({id:i,title:"Unarchived release",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),l.closeModal(r),u(`/cms/releases/${a.id}`)}})}return e(k,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(z,{size:"h1",children:["Edit Release: ",a.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:M?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:B,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})})})})]})]}),e(N,{className:"EditReleasePage__form",children:e(U,{releaseId:a.id})})]})})}export{de as EditReleasePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as n}from"./chunk-FBSBL476.js";import{a}from"./chunk-NXWYS4HG.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import{b as i}from"./chunk-RB23LLKL.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as f}from"./chunk-QLIIVG5Q.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as o,c as r,e as t,j as m}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";m();function v(){f("Root AI");let[e]=i("docId"),d=t(!1);return r(()=>{d.current||(d.current=!0,n({type:"ready",docId:e||void 0}))},[e]),o("div",{className:"EmbeddedAIPage",children:o(a,{variant:"panel",docContext:e?{docId:e}:void 0})})}export{v as EmbeddedAIPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-YP6ZH3MT.js";import"./chunk-2RRM4HEQ.js";import{a}from"./chunk-HXSB6YB2.js";import"./chunk-OWYV43BT.js";import"./chunk-ATTW36EM.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as i}from"./chunk-QLIIVG5Q.js";import{c as g}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as o}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return i("Action Logs"),o(g,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as d}from"./chunk-2FQMT5AB.js";import"./chunk-535JU7FU.js";import{a as r}from"./chunk-HXSB6YB2.js";import"./chunk-JDW4UORS.js";import"./chunk-RN4XVVWD.js";import"./chunk-ATTW36EM.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import{a as o}from"./chunk-QLIIVG5Q.js";import{c as t}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as a,ca as e}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return o("New Data Source"),a(t,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-IGZDFHVM.js";import"./chunk-WC7KMPEQ.js";import"./chunk-F7RQT4XN.js";import"./chunk-DWV5J2W7.js";import{a as r}from"./chunk-HXSB6YB2.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-W5DOO6ID.js";import"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as d}from"./chunk-QLIIVG5Q.js";import{c as s}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as e,ca as a}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return d("New Release"),e(s,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as K}from"./chunk-Z3ZJJWFT.js";import{a as F}from"./chunk-XUBZH4ON.js";import{a as q}from"./chunk-F7RQT4XN.js";import{c as U}from"./chunk-VPZHG7JL.js";import{a as h}from"./chunk-HXSB6YB2.js";import{a as R}from"./chunk-OWYV43BT.js";import{g as H}from"./chunk-TNW2GNUR.js";import{d as B,h as E,k as M}from"./chunk-FVWSVOOY.js";import"./chunk-JDW4UORS.js";import{a as P}from"./chunk-UJX25CXD.js";import{c as $}from"./chunk-RN4XVVWD.js";import{a as k,c as I}from"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as j}from"./chunk-W5DOO6ID.js";import{a as W}from"./chunk-YBHFGQ3Z.js";import{b as D}from"./chunk-2PTLQRTU.js";import{a as v,b as z}from"./chunk-PIJ3E47R.js";import{a as O}from"./chunk-NCZD5IWS.js";import{a as J}from"./chunk-QLIIVG5Q.js";import{c as G}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{A as T}from"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Da as A,Fa as g,Ga as e,Jc as Y,V as w,W as C,a as u,c as x,ca as N,da as m,j as Z}from"./chunk-WRA24P66.js";import{d as y}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Z();function p(t){let[c,i]=u(!0),[a,s]=u(null),[o,l]=u(0),n=t.id;J(`Release: ${n}`);async function _(){i(!0),await D(async()=>{let r=await B(n);s(r),l(T())}),i(!1)}x(()=>{_()},[]);function d(r){console.log("onAction()",r),_()}return e(G,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(N,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:n})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(h,{size:"h1",children:["Release: ",n]}),e("div",{className:"ReleasePage__header__controls",children:e(g,{label:"Configure",children:e(C,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(Y,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(U,{className:"ReleasePage__header__description",code:a.description})]}),c?e(w,{color:"gray",size:"xl"}):e(y,{children:[a&&e(p.PublishStatus,{release:a,onAction:d}),a&&a.docIds&&a.docIds.length>0&&e(p.DocsList,{release:a},`docs-list-${o}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(p.DataSourcesList,{release:a},`data-sources-${o}`)]})]})})}p.PublishStatus=t=>{let{roles:c}=W(),i=window.firebase.user.email||"",a=j(c,i),s=t.release,[o,l]=u(!1),n=k(),_=I(),d=F({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function r(){let f=s.docIds||[],S=s.dataSourceIds||[],b=f.length+S.length;if(b===0){v({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}n.openConfirmModal({..._,title:`Publish release: ${s.id}`,children:e(O,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{Q()}})}async function Q(){l(!0),await D(async()=>{let f=`publish-release-${s.id}`,S=s.docIds?.length||0,b=s.dataSourceIds?.length||0,L=S+b;v({id:f,title:"Publishing release",message:`Publishing ${L} items...`,loading:!0,autoClose:!1}),await E(s.id),z({id:f,title:"Published release!",message:`Successfully published ${L} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),l(!1)}function V(){d.open()}async function X(){await M(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(h,{size:"h2",children:"Status"}),e(R,{children:e(A,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(K,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(P,{label:"You don't have access to publish this release",condition:!a,children:e(g,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>r(),loading:o,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(P,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(g,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>X(),disabled:!a,children:"Cancel Schedule"})})}):e(P,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(g,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>V(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};p.DocsList=t=>{let c=t.release,i=c.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(h,{size:"h2",children:"Docs"}),e(m,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${c.id}/edit`,children:"Edit"})]}),e(R,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(H,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};p.DataSourcesList=t=>{let c=t.release,i=c.dataSourceIds||[],[a,s]=u({});return x(()=>{let o=!1;async function l(){let n=await Promise.all(i.map(async d=>{let r=await $(d);return[d,r]}));if(o)return;let _={};for(let[d,r]of n)r&&(_[d]=r);s(_)}return l(),()=>{o=!0}},[i.join(",")]),e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(h,{size:"h2",children:"Data Sources"}),e(m,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${c.id}/edit`,children:"Edit"})]}),e(R,{className:"ReleasePage__DataSourcesList__items",children:i.map(o=>{let l=a[o];return e("a",{className:"ReleasePage__DataSourcesList__item",href:`/cms/data/${o}`,children:[e(q,{className:"ReleasePage__DataSourcesList__item__icon",type:l?.type}),e("div",{className:"ReleasePage__DataSourcesList__item__info",children:[e("div",{className:"ReleasePage__DataSourcesList__item__id",children:o}),l?.description&&e("div",{className:"ReleasePage__DataSourcesList__item__description",children:l.description})]})]},o)})})]})};export{p as ReleasePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-QLIIVG5Q.js";import{c as a}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-WASID5UU.js";import{Ga as e,c as d,j as l}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as g}from"./chunk-Y5EOMMNI.js";import"./chunk-XACLTYBB.js";import{a as e}from"./chunk-HXSB6YB2.js";import"./chunk-OWYV43BT.js";import"./chunk-QFDU6FXP.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import{a as i}from"./chunk-QLIIVG5Q.js";import{c as s}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as a}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function k(){return i("Tasks"),a(s,{children:a("div",{className:"TasksPage",children:[a("div",{className:"TasksPage__header",children:a(e,{size:"h1",children:"Tasks"})}),a(g,{variant:"page"})]})})}export{k as TasksPage};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-535JU7FU.js";import{a as j}from"./chunk-JDW4UORS.js";import{a as Q,c as X,e as Y}from"./chunk-RN4XVVWD.js";import{c as K}from"./chunk-ATTW36EM.js";import{b as J}from"./chunk-2PTLQRTU.js";import{a as x}from"./chunk-PIJ3E47R.js";import{d as W}from"./chunk-WASID5UU.js";import{Ga as e,a as s,c as q,da as A,e as B,ea as P,j as re,na as b,pa as $,ua as F,va as V,za as S}from"./chunk-WRA24P66.js";import{d as M}from"./chunk-KUCVLANF.js";re();var se="Enter the URL to make the HTTP request.",ne="Enter the URL of the Google Sheet, e.g. https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit#gid=SHEET_ID";function Ne(a){let{route:n}=W(),c=B(null),i=Z(),[h,d]=s(!1),[r,U]=s(i.enabled?"gsheet":"http"),[g,z]=s("map"),[v,ee]=s("GET"),[y,T]=s(!1),[w,N]=s(1),[E,H]=s("hours"),[R,C]=s(!1),[L,p]=s(""),[te,O]=s(!!a.dataSourceId),[_,G]=s(null),I="";r==="http"?I=se:r==="gsheet"&&(I=ne);async function ae(t){await J(async()=>{let o=await X(t);G(o),U(o?.type||"http"),z(o?.dataFormat||"map"),o?.cron?(T(o.cron.enabled||!1),N(o.cron.interval||1),H(o.cron.unit||"hours"),C(o.cron.autoPublish||!1)):(T(!1),N(1),H("hours"),C(!1))}),O(!1)}q(()=>{a.dataSourceId&&(O(!0),ae(a.dataSourceId))},[a.dataSourceId]);async function oe(){p("");let t=c.current;function o(l){let f=t.elements[l];return f?f.value.trim():""}let m=a.dataSourceId||o("id");if(!m){p("missing id");return}if(!j(m)){p("id is invalid (alphanumeric characters and dashes only)");return}let D=o("url");if(!D){p("missing url");return}let u={id:m,description:o("description"),type:r,url:D,previewUrl:o("previewUrl")};if(r==="http"){if(!ie(D)){p("invalid url");return}u.httpOptions={method:v};let l=o("httpHeaders");if(l&&(u.httpOptions.headers=ue(l)),v==="POST"){let f=o("httpBody");f&&(u.httpOptions.body=f)}}else if(r==="gsheet"){if(!K(D)?.spreadsheetId){p("failed to parse spreadsheet url");return}u.dataFormat=g||"map"}y?u.cron={enabled:!0,interval:w,unit:E,autoPublish:R}:u.cron={enabled:!1,interval:w,unit:E};try{G(u),d(!0),a.dataSourceId?(await Y(a.dataSourceId,u),x({title:"Saved data source",message:`Successfully updated ${m}`,autoClose:5e3}),d(!1)):(await Q(m,u),x({title:"Added data source",message:`Successfully added ${m}`,autoClose:5e3}),d(!1),n(`/cms/data/${m}`))}catch(l){console.error(l),x({title:"Failed to save data source",message:String(l),color:"red",autoClose:!1}),d(!1)}}let k=[{value:"http",label:"HTTP"}];return(i.enabled||r==="gsheet")&&k.push({value:"gsheet",label:"Google Sheet"}),e("form",{className:"DataSourceForm",ref:c,onSubmit:t=>{t.preventDefault(),oe()},children:[e($,{visible:te}),e("div",{className:"DataSourceForm__input",children:e(S,{name:"type",label:"Type",data:k,value:r,onChange:t=>U(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(F,{className:"DataSourceForm__input",name:"id",label:"ID",description:"Unique identifier for the data source. Use alphanumeric characters and dashes only, e.g. grogus-favorite-meals",size:"xs",radius:0,value:a.dataSourceId,disabled:!!a.dataSourceId}),e(b,{className:"DataSourceForm__input",name:"description",label:"Description",description:"Optional.",size:"xs",radius:0,value:_?.description}),e(F,{className:"DataSourceForm__input",name:"url",label:"URL",description:I,size:"xs",radius:0,value:_?.url}),r==="http"&&e(M,{children:[e("div",{className:"DataSourceForm__input",children:e(S,{name:"httpMethod",label:"HTTP Request Method",data:[{value:"GET",label:"GET"},{value:"POST",label:"POST"}],value:v,onChange:t=>ee(t),size:"xs",radius:0,dropdownComponent:"div"})}),e(b,{className:"DataSourceForm__input",name:"httpHeaders",label:"HTTP Request Headers",description:"Format as `HeaderName: Value`, each value on its own line.",size:"xs",radius:0,value:ce(_?.httpOptions?.headers||{})}),v==="POST"&&e(b,{className:"DataSourceForm__input",name:"httpRequestBody",label:"HTTP Request Body",size:"xs",radius:0,value:_?.httpOptions?.body})]}),r==="gsheet"&&e("div",{className:"DataSourceForm__input",children:[e(S,{name:"dataFormat",label:"Data Format",data:[{value:"map",label:"map"}],value:g,onChange:t=>z(t),size:"xs",radius:0,dropdownComponent:"div"}),g==="array"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of arrays, e.g.",e("code",{children:"[[header1, header2], [foo, bar]]"})]}),g==="map"&&e("div",{className:"DataSourceForm__input__example",children:["Data is stored as an array of maps, e.g.",e("code",{children:["[","{","header1: foo, header2: bar","}","]"]})]})]}),e("div",{className:"DataSourceForm__section",children:[e("div",{className:"DataSourceForm__section__label",children:"Sync Schedule"}),e(P,{className:"DataSourceForm__input",label:"Enable scheduled sync",checked:y,onChange:t=>T(t.currentTarget.checked),size:"xs"}),y&&e("div",{className:"DataSourceForm__cron",children:[e("div",{className:"DataSourceForm__cron__row",children:[e("span",{children:"Run every"}),e(V,{className:"DataSourceForm__cron__interval",value:w,onChange:t=>N(Number(t)||1),min:1,size:"xs",radius:0}),e(S,{className:"DataSourceForm__cron__unit",data:[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}],value:E,onChange:t=>H(t),size:"xs",radius:0,dropdownComponent:"div"})]}),e(P,{className:"DataSourceForm__input",label:"Auto-publish after sync",checked:R,onChange:t=>C(t.currentTarget.checked),size:"xs"})]})]}),e(F,{className:"DataSourceForm__input",name:"previewUrl",label:"Preview URL",description:"URL where users can preview the data source.",size:"xs",radius:0,value:_?.previewUrl}),e(A,{className:"DataSourceForm__submit",color:"blue",size:"xs",type:"submit",loading:h,children:a.buttonLabel||"Save"}),L&&e("div",{className:"DataSourceForm__error",children:["Error: ",L]})]})}function ie(a){let n,c=a.startsWith("/")?"http://localhost":void 0;try{n=new URL(a,c)}catch(i){return console.error(i),!1}return n.protocol==="http:"||n.protocol==="https:"}function ue(a){let n={};return a.split(`
|
|
2
|
-
`).forEach(i=>{let h=i.indexOf(":");if(h===-1)return;let d=i.slice(0,h).trim(),r=i.slice(h+1).trim();d&&r&&(n[d]=r)}),n}function ce(a){let n=[];for(let c in a){let i=a[c];n.push(`${c}: ${i}`)}return n.join(`
|
|
3
|
-
`)}export{Ne as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as T}from"./chunk-JDW4UORS.js";import{k as z}from"./chunk-RN4XVVWD.js";import{C as _}from"./chunk-ISUGBMXC.js";import{D as l,a as f,b as w,c as s,g as b,i as k,n as v,o as j,q as u,t as R,u as c,v as y,x as I}from"./chunk-XOWWPE7X.js";var O=["agile","airy","alert","amber","amused","ancient","aqua","arctic","astral","autumn","avid","azure","balmy","beige","big","bitter","black","blazing","blissful","blooming","blue","bold","bouncy","brainy","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","charming","cheerful","cherry","chilly","chipper","classic","clean","clear","clever","cloudy","coastal","cobalt","cold","cool","copper","coral","cosmic","cosy","cozy","crafty","creamy","crimson","crisp","cuddly","curious","dandy","dapper","daring","dark","dawn","dazzling","dear","deep","deft","delicate","dewy","dizzy","dotted","dreamy","driven","dry","dusky","dusty","eager","early","earnest","earthy","eastern","easy","ebony","elated","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","festive","fierce","fiery","fine","firm","flat","floral","flowing","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frisky","frosty","funky","funny","fuzzy","gallant","gentle","giant","gilded","glad","gleaming","glossy","glowing","gold","golden","good","graceful","grand","grassy","gray","green","groovy","gusty","handy","happy","hardy","hazy","hearty","heavy","helpful","heroic","hidden","high","holy","honest","honeyed","hopeful","humble","humming","hushed","icy","ideal","idle","indigo","inky","iron","ivory","jade","jaunty","jazzy","jolly","jovial","joyful","jubilant","juicy","jumpy","keen","kind","kindly","lacy","late","lazy","leafy","lemon","light","limber","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","luminous","lunar","lush","magenta","magic","majestic","mango","marble","maritime","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","mythic","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","northern","nosy","nutty","oaken","oceanic","odd","old","olive","onyx","opal","open","orange","orderly","pale","pastel","patient","peaceful","peach","peachy","pearly","pebbly","peppy","perky","pink","placid","plain","playful","pleasant","plucky","plum","plush","polar","polite","prime","pristine","proud","pure","purple","quaint","quick","quiet","quirky","radiant","rapid","rare","raven","ready","red","regal","restless","rich","rolling","rosy","rough","round","royal","ruby","rugged","rumbling","russet","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","scenic","secret","sepia","serene","shaggy","sharp","shimmering","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soaring","soft","solar","solid","southern","sparkly","speedy","spicy","spiffy","spotted","spry","square","starry","steady","steel","stellar","sticky","still","stony","stormy","striped","strong","sturdy","subtle","sunlit","sunny","super","supreme","swank","sweet","swift","tame","tan","tangy","tart","teal","tender","thin","thirsty","thriving","tidal","tidy","tiny","tireless","toasty","topaz","tough","tranquil","trim","tropical","true","twinkly","umber","upbeat","urban","useful","valiant","vast","velvet","verdant","vernal","vibrant","vintage","violet","vivid","wandering","warm","watchful","wavy","wee","western","whimsical","whispering","white","wholesome","wild","winding","windy","winter","wintry","wise","witty","wondrous","woody","wool","yellow","young","youthful","zany","zealous","zen","zesty","zippy"],A=["acorn","almond","alpaca","anchor","antler","apple","apricot","arrow","aspen","aurora","autumn","avocado","badger","bagel","bamboo","banana","basil","bay","bayou","beach","bear","bee","beetle","bell","berry","birch","bird","biscuit","bison","blossom","bluff","boat","bobcat","bonfire","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","canary","candle","canyon","cape","caravan","cardinal","carrot","cascade","cashew","castle","cat","cave","cedar","chair","cherry","chestnut","chickpea","chime","cinnamon","citadel","cliff","cloud","clove","clover","cocoa","comet","compass","condor","cookie","coral","cottage","cotton","cove","coyote","crane","crayon","creek","cricket","crocus","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","delta","desert","dew","diamond","dingo","dock","dogwood","dolphin","donut","dove","dragon","drift","drizzle","drum","duck","dumpling","dune","eagle","echo","eclipse","eel","egg","elder","elephant","elk","ember","ermine","estuary","evergreen","falcon","fawn","feather","fennel","fern","ferret","field","fig","finch","fir","firefly","fish","fjord","flame","flamingo","flask","flax","fleece","flicker","flower","flute","fog","forest","fossil","fountain","fox","frog","frost","galaxy","garden","gazelle","gecko","gem","geyser","ginger","glacier","glade","glen","globe","glow","goat","goose","gorge","gourd","granite","grape","grass","grotto","grove","gull","hammock","harbor","hare","harp","harvest","hat","hawk","haystack","hazel","hearth","heather","hedge","heron","hibiscus","hickory","hill","hollow","honey","horizon","horse","hummingbird","ibis","iceberg","icicle","inlet","iris","island","ivy","jackal","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","jetty","juniper","kayak","kelp","kestrel","kettle","key","kingfisher","kite","kitten","kiwi","knoll","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","lavender","leaf","ledge","lemon","lemur","leopard","lichen","lighthouse","lilac","lily","lime","lion","llama","lobster","log","loon","lotus","lynx","lyric","magnet","manatee","mango","mangrove","maple","marble","marigold","marlin","marsh","meadow","melody","melon","mermaid","mesa","meteor","minnow","mint","mirage","mist","mitten","mole","monkey","moon","moose","morel","mosaic","moss","moth","mountain","mouse","muffin","mushroom","mussel","narwhal","nautilus","nectar","needle","nest","nettle","newt","nightingale","nimbus","noodle","north","note","nutmeg","oak","oasis","oats","ocean","ocelot","octopus","olive","onion","opal","orange","orca","orchid","oriole","osprey","otter","owl","oyster","paddle","palm","panda","pansy","panther","papaya","paper","parrot","parsley","partridge","pasture","path","peach","peacock","pear","pebble","pecan","pelican","penguin","peony","pepper","petal","petunia","pheasant","phoenix","pie","pigeon","pine","pineapple","pistachio","planet","plateau","plover","plum","pond","pony","poppy","porpoise","pouch","prairie","pretzel","primrose","puffin","pumpkin","quail","quartz","queen","quill","quince","quokka","rabbit","raccoon","radish","rain","rainbow","rapids","raspberry","raven","redwood","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rooster","rose","rosemary","rowan","rye","saffron","sage","salmon","sand","sapphire","satellite","savanna","scallop","scarf","sea","seagull","seal","seed","sequoia","sesame","shark","shell","shore","shrimp","silk","silo","sky","skylark","sleet","snail","snake","snow","sock","sorbet","spark","sparrow","spider","spire","spoon","spring","sprout","spruce","squirrel","star","starfish","starling","stone","stork","storm","stream","summer","sun","sundial","sunflower","swan","swift","sycamore","tadpole","tamarind","tangerine","tea","teal","tern","terrace","thicket","thistle","thrush","thunder","tide","tiger","timber","toad","toffee","tooth","topaz","tortoise","totem","toucan","tower","tractor","trail","tree","trout","truffle","tugboat","tulip","tundra","turnip","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vanilla","vine","violet","vista","volcano","voyage","vulture","wagon","walnut","walrus","wasp","water","waterfall","wave","whale","wharf","wheat","whisker","wildcat","wildflower","willow","wind","window","winter","wisteria","wolf","wombat","wood","wren","yak","yam","yarrow","yew","yucca","zebra","zephyr","zinnia","zucchini"];var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S="YYYYMMDD";function D(e,r){let a=r?.now??new Date,o=r?.random??Math.random,t=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[p,g]=q(d);switch(p){case"date":return E(a,g||S);case"adjective":return C(O,o);case"noun":return C(A,o);case"random":return M(Y(g,6),o);default:return n}});return T(t.toLowerCase())}function q(e){let r=e.indexOf(":");return r===-1?[e.trim(),void 0]:[e.slice(0,r).trim(),e.slice(r+1)]}function Y(e,r){if(!e)return r;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:r}function C(e,r){return e[Math.floor(r()*e.length)]}function M(e,r){let a=[];for(let o=0;o<e;o++)a.push(x.charAt(Math.floor(r()*x.length)));return a.join("")}function E(e,r){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:m(e.getMonth()+1),DD:m(e.getDate()),HH:m(e.getHours()),mm:m(e.getMinutes()),ss:m(e.getSeconds())};return r.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function m(e){return e<10?`0${e}`:String(e)}var i="Releases";async function V(e,r){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await R(o,async n=>{if((await n.get(t)).exists())throw new Error(`release exists: ${e}`);await n.set(t,{...r,id:e,createdAt:y(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function G(){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,a=w(r,"Projects",e,i),o=b(a,k("createdAt","desc")),t=await j(o),n=[];return t.forEach(d=>{n.push(d.data())}),n}async function h(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e),t=await v(o);return t.exists()?t.data():null}async function K(e,r){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,r),l("release.save",{metadata:{releaseId:e}})}async function Q(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:y(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function W(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let r=await h(e);if(!r)throw new Error(`release not found: ${e}`);if(r.archivedAt)throw new Error(`release is archived: ${e}`);let a=r.docIds||[],o=r.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let t=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=s(n,"Projects",t,i,e),p=I(n);p.update(d,{publishedAt:y(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await z(o,{batch:p,commitBatch:!1}),await _(a,{batch:p,releaseId:e,publishMessage:r.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};r.description&&(g.publishMessage=r.description),l("release.publish",{metadata:g})}async function ee(e,r){let a=await h(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof r=="number"&&(r=f.fromMillis(r));let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,n=s(t,"Projects",o,i,e);await u(n,{scheduledAt:r,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:r.toMillis()}})}function re(){return D("{date}-{adjective}-{noun}")}async function ae(e){if(!await h(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{D as a,V as b,G as c,h as d,K as e,Q as f,W as g,Z as h,ee as i,re as j,ae as k};
|