@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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/README.md +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-DCJDQs1a.cjs"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-BVwFJWDq.cjs"),H=require("@tanstack/react-query");function K(t,r){const o=O.useApiUrl(),n=O.useFetch(),d=p.startsWith(t.uid,"draft:")||p.startsWith(r.uid,"live:");return H.useQuery({queryKey:["revision-comparison",t.uid,r.uid],queryFn:async()=>{if(!t.uid||!r.uid)throw new Error("Both revision IDs are required for comparison");const l=h=>h==="draft"||h==="live"?h:"revision",s=h=>p.replace(h.uid,`${h.label}:`,"");return await n(o,{action:O.ACTIONS.GET_COMPARE_DATA,data:{versions:{version1:{type:l(t.label),id:s(t)},version2:{type:l(r.label),id:s(r)}}}})},enabled:!!t.uid&&!!r.uid,staleTime:d?0:1/0,refetchOnMount:d?"always":!1,gcTime:d?0:void 0})}const V=({version:t})=>{const r=t==null?void 0:t.item,{data:o}=O.useChaiUserInfo(r==null?void 0:r.currentEditor),n=t.label==="live",d=t.label==="draft";return e.jsxs("span",{className:`flex min-h-8 items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${n?"border-green-500/30":d?"border-amber-500/30":"border-purple-500/30"}`,children:[e.jsx("div",{className:"h-full items-center rounded px-1.5 py-0.5 font-medium capitalize"+(n?" bg-green-500 text-green-50":d?" bg-amber-500 text-amber-50":" bg-purple-500 text-purple-50"),children:t.label}),e.jsxs("div",{className:"py-1 text-xs font-light leading-none text-gray-800",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-light opacity-90",children:d?"Currently editing":"Published by"}),!d&&e.jsx("span",{className:"pl-1 font-medium",children:(o==null?void 0:o.name)||"Unknown"})]}),(r==null?void 0:r.createdAt)&&e.jsx("div",{className:"pt-0.5 text-[10px] leading-tight",children:z.formatDate(r.createdAt,"dd MMM yyyy, h:mm a")})]})]})},F=({version:t})=>e.jsx(V,{version:t});function U(t,r,o="data.json"){const n=JSON.stringify(t,null,2),d=JSON.stringify(r,null,2),l=n.split(`
|
|
2
|
-
`),s=d.split(`
|
|
3
|
-
`);let u=`--- a/${o}
|
|
4
|
-
`;u+=`+++ b/${o}
|
|
5
|
-
`;const h=[];let c=0,x=0;for(;c<l.length||x<s.length;){const g=l[c]||"",v=s[x]||"";if(g===v)h.push(` ${g}`),c++,x++;else{let f=-1,j=-1;for(let a=c+1;a<l.length;a++)if(s[x]===l[a]){f=a;break}for(let a=x+1;a<s.length;a++)if(l[c]===s[a]){j=a;break}if(f!==-1&&(j===-1||f-c<=j-x)){for(let a=c;a<f;a++)h.push(`-${l[a]}`);c=f}else if(j!==-1){for(let a=x;a<j;a++)h.push(`+${s[a]}`);x=j}else g&&h.push(`-${g}`),v&&h.push(`+${v}`),c++,x++}}const w=l.length,J=s.length;return u+=`@@ -1,${w} +1,${J} @@
|
|
6
|
-
`,u+=h.join(`
|
|
7
|
-
`)+`
|
|
8
|
-
`,u}function D(t,r=!0,o=!1){if(p.isString(t)){const n=p.trim(t);if(p.startsWith(n,"{")||p.startsWith(n,"[")||r&&(n==="true"||n==="false"||n==="null"||/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(n)))try{const l=JSON.parse(n);return D(l,r,o)}catch{if(o)throw new Error(`Invalid JSON string: ${n}`);return{}}return t}return p.isArray(t)?p.map(t,n=>D(n,r,o)):p.isPlainObject(t)?p.mapValues(t,n=>D(n,r,o)):t}const W=t=>{switch(t){case"blocks":return"Blocks";case"seo":return"SEO";case"tracking":return"Tracking";default:return t}},_=(t,r)=>{if(!t||!r)return[{key:"blocks",label:"Blocks"}];const o=Object.keys(t),n=Object.keys(r);return o.filter(s=>n.includes(s)).map(s=>({key:s,label:W(s)})).filter(s=>s.key.length>0)},P=(t,r=3)=>{const o=new Set;t.map((s,u)=>({change:s,index:u})).filter(({change:s})=>s.type!=="normal").map(({index:s})=>s).forEach(s=>{const u=Math.max(0,s-r),h=Math.min(t.length-1,s+r);for(let c=u;c<=h;c++)o.add(c)});const d=[];let l=-1;return t.forEach((s,u)=>{if(o.has(u)){if(l!==-1&&u-l>1){const h=t[l].lineNumber!=null?t[l].lineNumber+1:l+2,c=t[u].lineNumber!=null?t[u].lineNumber-1:u;d.push({content:e.jsx(m.Badge,{className:"pointer-events-none w-60 -translate-x-1/2 cursor-default border-none bg-transparent py-1 shadow-none",children:e.jsxs("span",{className:"rounded border border-border bg-muted px-3 py-1 text-xs font-light leading-none text-muted-foreground",children:["No changes from ",h," to ",c," line"]})})})}d.push(s),l=u}}),d};function G({open:t,compare:r,onOpenChange:o}){const n=r[0],d=r[1],[l,s]=b.useState(null),[u,h]=b.useState("split"),[c,x]=b.useState(!1),[w,J]=b.useState(!0),[g,v]=b.useState("blocks"),{data:f,isLoading:j}=K(n,d),{leftData:a,rightData:k,options:B}=b.useMemo(()=>{var y,R;const i=(y=f==null?void 0:f.version1)==null?void 0:y[g],C=(R=f==null?void 0:f.version2)==null?void 0:R[g],S=D(i),T=D(C),q=_(f==null?void 0:f.version1,f==null?void 0:f.version2);return{leftData:S,rightData:T,options:q}},[f,g]),$=b.useMemo(()=>!a||!k?"":U(a,k),[a,k]),A=b.useMemo(()=>{if(!$)return[];try{return M.parseDiff($)}catch(i){return console.error("Failed to parse diff:",i),[]}},[$]),I=async(i,C)=>{try{await navigator.clipboard.writeText(JSON.stringify(i,null,2)),s(C),setTimeout(()=>s(null),2e3)}catch(S){console.error("Failed to copy:",S)}},E=i=>JSON.stringify(i,null,2);return e.jsx(m.Dialog,{open:t,onOpenChange:o,children:e.jsxs(m.DialogContent,{className:"flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-6",children:[e.jsx(m.DialogHeader,{className:"pb-4 pt-0",children:e.jsxs(m.DialogTitle,{className:"flex items-center justify-between gap-2 leading-none",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N.FileJson,{className:"h-5 w-5"}),"Compare","",B.map(i=>e.jsx("div",{className:`cursor-pointer rounded-full border px-2.5 py-1 text-xs leading-none ${g===i.key?"border-blue-500 bg-blue-500 text-white":"border-gray-600 text-gray-600 hover:bg-gray-200"}`,onClick:()=>v(i.key),children:i.label},i.key))]}),e.jsx("div",{className:"flex flex-1 items-center justify-end pr-8",children:e.jsxs("div",{className:"flex w-max items-center justify-end gap-2 rounded-md border px-1.5 py-1",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{disabled:c,checked:c?!0:u==="split",onCheckedChange:i=>h(i?"split":"unified")}),e.jsx("label",{className:"text-sm",children:"Split View"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{checked:c,onCheckedChange:i=>x(i)}),e.jsx("label",{className:"text-sm",children:"Show Raw Data"})]}),e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx(m.Switch,{checked:w,onCheckedChange:i=>J(i)}),e.jsx("label",{className:"text-sm",children:"Hide Common Data"})]})]})})]})}),j?e.jsx("div",{className:"flex h-full w-full items-center justify-center",children:e.jsx(N.Loader,{className:"h-6 w-6 animate-spin text-primary"})}):e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsxs("div",{className:"relative min-h-0 flex-1",children:[e.jsxs("div",{className:"absolute -top-5 z-50 mt-0.5 flex w-full items-center justify-between gap-2",children:[e.jsx("div",{className:"flex w-1/2 items-center justify-center gap-2",children:e.jsx(F,{version:n})}),e.jsx("div",{className:"flex w-1/2 items-center justify-center gap-2",children:e.jsx(F,{version:d})})]}),c?e.jsxs("div",{className:"grid h-full grid-cols-2 gap-3 rounded-lg border",children:[e.jsxs("div",{className:"relative flex min-h-0 flex-col border-r",children:[e.jsx("div",{className:"absolute -top-4 right-4 z-50",children:e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>I(a,"left"),children:[l==="left"?e.jsx(N.Check,{className:"text-green-500"}):e.jsx(N.Copy,{}),"Copy"]})}),e.jsx(m.ScrollArea,{className:"flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:E(a)})})]}),e.jsxs("div",{className:"relative flex min-h-0 flex-col",children:[e.jsx("div",{className:"absolute -top-4 right-4 z-50",children:e.jsxs(L.Button,{variant:"outline",size:"sm",onClick:()=>I(k,"right"),children:[l==="right"?e.jsx(N.Check,{className:"text-green-500"}):e.jsx(N.Copy,{}),"Copy"]})}),e.jsx(m.ScrollArea,{className:"flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900",children:e.jsx("pre",{className:"whitespace-pre-wrap font-mono text-xs",children:E(k)})})]})]}):e.jsx(m.ScrollArea,{className:"h-full overflow-y-auto rounded-lg border bg-slate-50 text-xs dark:bg-slate-900",children:A.length===0?e.jsx("div",{className:"flex h-full items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-muted-foreground",children:[e.jsx(N.FileJson,{className:"mx-auto mb-2 h-8 w-8 opacity-50"}),e.jsx("p",{children:"No differences found or unable to parse diff"})]})}):e.jsx("div",{children:A.map((i,C)=>e.jsx("div",{className:"relative mb-4",children:e.jsx(M.Diff,{viewType:u,diffType:i.type,hunks:i.hunks,className:"rounded-lg text-xs",children:S=>S.map((T,q)=>{const y=w?P(T.changes):T.changes;return(y==null?void 0:y.length)===0?e.jsx("div",{className:"absolute h-full w-full border-l pt-64 text-center font-sans text-sm",children:e.jsx("span",{children:"No difference found"})}):e.jsx(M.Hunk,{hunk:{...T,changes:y}},q)})},w?"hide-common-data":"show-common-data")},C))})})]})})]})})}exports.default=G;
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { D as U, e as V, f as _, g as G, af as $, a7 as A, B as P } from "./index-OuHV9Ann.js";
|
|
3
|
-
import { B as R } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
|
-
import { formatDate as Q } from "date-fns";
|
|
5
|
-
import { startsWith as T, replace as W, isString as X, trim as Y, isArray as Z, map as ee, isPlainObject as te, mapValues as re } from "lodash-es";
|
|
6
|
-
import { FileJson as z, Loader as ne, Check as F, Copy as H } from "lucide-react";
|
|
7
|
-
import { useState as D, useMemo as I } from "react";
|
|
8
|
-
import { parseDiff as se, Diff as le, Hunk as ae } from "react-diff-view";
|
|
9
|
-
import { aq as ie, ar as oe, A as ce, ao as de } from "./index-LBTm1Jmk.js";
|
|
10
|
-
import { useQuery as fe } from "@tanstack/react-query";
|
|
11
|
-
function me(t, n) {
|
|
12
|
-
const o = ie(), s = oe(), d = T(t.uid, "draft:") || T(n.uid, "live:");
|
|
13
|
-
return fe({
|
|
14
|
-
queryKey: ["revision-comparison", t.uid, n.uid],
|
|
15
|
-
queryFn: async () => {
|
|
16
|
-
if (!t.uid || !n.uid)
|
|
17
|
-
throw new Error("Both revision IDs are required for comparison");
|
|
18
|
-
const l = (m) => m === "draft" || m === "live" ? m : "revision", r = (m) => W(m.uid, `${m.label}:`, "");
|
|
19
|
-
return await s(o, {
|
|
20
|
-
action: ce.GET_COMPARE_DATA,
|
|
21
|
-
data: {
|
|
22
|
-
versions: {
|
|
23
|
-
version1: { type: l(t.label), id: r(t) },
|
|
24
|
-
version2: { type: l(n.label), id: r(n) }
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
},
|
|
29
|
-
enabled: !!t.uid && !!n.uid,
|
|
30
|
-
staleTime: d ? 0 : 1 / 0,
|
|
31
|
-
refetchOnMount: d ? "always" : !1,
|
|
32
|
-
gcTime: d ? 0 : void 0
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const he = ({ version: t }) => {
|
|
36
|
-
const n = t == null ? void 0 : t.item, { data: o } = de(n == null ? void 0 : n.currentEditor), s = t.label === "live", d = t.label === "draft";
|
|
37
|
-
return /* @__PURE__ */ u(
|
|
38
|
-
"span",
|
|
39
|
-
{
|
|
40
|
-
className: `flex min-h-8 items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${s ? "border-green-500/30" : d ? "border-amber-500/30" : "border-purple-500/30"}`,
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ e(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
className: "h-full items-center rounded px-1.5 py-0.5 font-medium capitalize" + (s ? " bg-green-500 text-green-50" : d ? " bg-amber-500 text-amber-50" : " bg-purple-500 text-purple-50"),
|
|
46
|
-
children: t.label
|
|
47
|
-
}
|
|
48
|
-
),
|
|
49
|
-
/* @__PURE__ */ u("div", { className: "py-1 text-xs font-light leading-none text-gray-800", children: [
|
|
50
|
-
/* @__PURE__ */ u("div", { children: [
|
|
51
|
-
/* @__PURE__ */ e("span", { className: "font-light opacity-90", children: d ? "Currently editing" : "Published by" }),
|
|
52
|
-
!d && /* @__PURE__ */ e("span", { className: "pl-1 font-medium", children: (o == null ? void 0 : o.name) || "Unknown" })
|
|
53
|
-
] }),
|
|
54
|
-
(n == null ? void 0 : n.createdAt) && /* @__PURE__ */ e("div", { className: "pt-0.5 text-[10px] leading-tight", children: Q(n.createdAt, "dd MMM yyyy, h:mm a") })
|
|
55
|
-
] })
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
}, K = ({ version: t }) => /* @__PURE__ */ e(he, { version: t });
|
|
60
|
-
function ue(t, n, o = "data.json") {
|
|
61
|
-
const s = JSON.stringify(t, null, 2), d = JSON.stringify(n, null, 2), l = s.split(`
|
|
62
|
-
`), r = d.split(`
|
|
63
|
-
`);
|
|
64
|
-
let f = `--- a/${o}
|
|
65
|
-
`;
|
|
66
|
-
f += `+++ b/${o}
|
|
67
|
-
`;
|
|
68
|
-
const m = [];
|
|
69
|
-
let c = 0, p = 0;
|
|
70
|
-
for (; c < l.length || p < r.length; ) {
|
|
71
|
-
const g = l[c] || "", N = r[p] || "";
|
|
72
|
-
if (g === N)
|
|
73
|
-
m.push(` ${g}`), c++, p++;
|
|
74
|
-
else {
|
|
75
|
-
let h = -1, x = -1;
|
|
76
|
-
for (let a = c + 1; a < l.length; a++)
|
|
77
|
-
if (r[p] === l[a]) {
|
|
78
|
-
h = a;
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
for (let a = p + 1; a < r.length; a++)
|
|
82
|
-
if (l[c] === r[a]) {
|
|
83
|
-
x = a;
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
if (h !== -1 && (x === -1 || h - c <= x - p)) {
|
|
87
|
-
for (let a = c; a < h; a++)
|
|
88
|
-
m.push(`-${l[a]}`);
|
|
89
|
-
c = h;
|
|
90
|
-
} else if (x !== -1) {
|
|
91
|
-
for (let a = p; a < x; a++)
|
|
92
|
-
m.push(`+${r[a]}`);
|
|
93
|
-
p = x;
|
|
94
|
-
} else
|
|
95
|
-
g && m.push(`-${g}`), N && m.push(`+${N}`), c++, p++;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const y = l.length, O = r.length;
|
|
99
|
-
return f += `@@ -1,${y} +1,${O} @@
|
|
100
|
-
`, f += m.join(`
|
|
101
|
-
`) + `
|
|
102
|
-
`, f;
|
|
103
|
-
}
|
|
104
|
-
function S(t, n = !0, o = !1) {
|
|
105
|
-
if (X(t)) {
|
|
106
|
-
const s = Y(t);
|
|
107
|
-
if (T(s, "{") || T(s, "[") || n && (s === "true" || s === "false" || s === "null" || /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(s)))
|
|
108
|
-
try {
|
|
109
|
-
const l = JSON.parse(s);
|
|
110
|
-
return S(l, n, o);
|
|
111
|
-
} catch {
|
|
112
|
-
if (o)
|
|
113
|
-
throw new Error(`Invalid JSON string: ${s}`);
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
|
-
return t;
|
|
117
|
-
}
|
|
118
|
-
return Z(t) ? ee(t, (s) => S(s, n, o)) : te(t) ? re(t, (s) => S(s, n, o)) : t;
|
|
119
|
-
}
|
|
120
|
-
const pe = (t) => {
|
|
121
|
-
switch (t) {
|
|
122
|
-
case "blocks":
|
|
123
|
-
return "Blocks";
|
|
124
|
-
case "seo":
|
|
125
|
-
return "SEO";
|
|
126
|
-
case "tracking":
|
|
127
|
-
return "Tracking";
|
|
128
|
-
default:
|
|
129
|
-
return t;
|
|
130
|
-
}
|
|
131
|
-
}, ge = (t, n) => {
|
|
132
|
-
if (!t || !n) return [{ key: "blocks", label: "Blocks" }];
|
|
133
|
-
const o = Object.keys(t), s = Object.keys(n);
|
|
134
|
-
return o.filter((r) => s.includes(r)).map((r) => ({ key: r, label: pe(r) })).filter((r) => r.key.length > 0);
|
|
135
|
-
}, xe = (t, n = 3) => {
|
|
136
|
-
const o = /* @__PURE__ */ new Set();
|
|
137
|
-
t.map((r, f) => ({ change: r, index: f })).filter(({ change: r }) => r.type !== "normal").map(({ index: r }) => r).forEach((r) => {
|
|
138
|
-
const f = Math.max(0, r - n), m = Math.min(t.length - 1, r + n);
|
|
139
|
-
for (let c = f; c <= m; c++)
|
|
140
|
-
o.add(c);
|
|
141
|
-
});
|
|
142
|
-
const d = [];
|
|
143
|
-
let l = -1;
|
|
144
|
-
return t.forEach((r, f) => {
|
|
145
|
-
if (o.has(f)) {
|
|
146
|
-
if (l !== -1 && f - l > 1) {
|
|
147
|
-
const m = t[l].lineNumber != null ? t[l].lineNumber + 1 : l + 2, c = t[f].lineNumber != null ? t[f].lineNumber - 1 : f;
|
|
148
|
-
d.push({
|
|
149
|
-
content: /* @__PURE__ */ e(P, { className: "pointer-events-none w-60 -translate-x-1/2 cursor-default border-none bg-transparent py-1 shadow-none", children: /* @__PURE__ */ u("span", { className: "rounded border border-border bg-muted px-3 py-1 text-xs font-light leading-none text-muted-foreground", children: [
|
|
150
|
-
"No changes from ",
|
|
151
|
-
m,
|
|
152
|
-
" to ",
|
|
153
|
-
c,
|
|
154
|
-
" line"
|
|
155
|
-
] }) })
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
d.push(r), l = f;
|
|
159
|
-
}
|
|
160
|
-
}), d;
|
|
161
|
-
};
|
|
162
|
-
function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
163
|
-
const s = n[0], d = n[1], [l, r] = D(null), [f, m] = D("split"), [c, p] = D(!1), [y, O] = D(!0), [g, N] = D("blocks"), { data: h, isLoading: x } = me(s, d), { leftData: a, rightData: w, options: q } = I(() => {
|
|
164
|
-
var b, B;
|
|
165
|
-
const i = (b = h == null ? void 0 : h.version1) == null ? void 0 : b[g], v = (B = h == null ? void 0 : h.version2) == null ? void 0 : B[g], k = S(i), C = S(v), J = ge(h == null ? void 0 : h.version1, h == null ? void 0 : h.version2);
|
|
166
|
-
return { leftData: k, rightData: C, options: J };
|
|
167
|
-
}, [h, g]), j = I(() => !a || !w ? "" : ue(a, w), [a, w]), M = I(() => {
|
|
168
|
-
if (!j) return [];
|
|
169
|
-
try {
|
|
170
|
-
return se(j);
|
|
171
|
-
} catch (i) {
|
|
172
|
-
return console.error("Failed to parse diff:", i), [];
|
|
173
|
-
}
|
|
174
|
-
}, [j]), E = async (i, v) => {
|
|
175
|
-
try {
|
|
176
|
-
await navigator.clipboard.writeText(JSON.stringify(i, null, 2)), r(v), setTimeout(() => r(null), 2e3);
|
|
177
|
-
} catch (k) {
|
|
178
|
-
console.error("Failed to copy:", k);
|
|
179
|
-
}
|
|
180
|
-
}, L = (i) => JSON.stringify(i, null, 2);
|
|
181
|
-
return /* @__PURE__ */ e(U, { open: t, onOpenChange: o, children: /* @__PURE__ */ u(V, { className: "flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-6", children: [
|
|
182
|
-
/* @__PURE__ */ e(_, { className: "pb-4 pt-0", children: /* @__PURE__ */ u(G, { className: "flex items-center justify-between gap-2 leading-none", children: [
|
|
183
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
|
|
184
|
-
/* @__PURE__ */ e(z, { className: "h-5 w-5" }),
|
|
185
|
-
"Compare",
|
|
186
|
-
"",
|
|
187
|
-
q.map((i) => /* @__PURE__ */ e(
|
|
188
|
-
"div",
|
|
189
|
-
{
|
|
190
|
-
className: `cursor-pointer rounded-full border px-2.5 py-1 text-xs leading-none ${g === i.key ? "border-blue-500 bg-blue-500 text-white" : "border-gray-600 text-gray-600 hover:bg-gray-200"}`,
|
|
191
|
-
onClick: () => N(i.key),
|
|
192
|
-
children: i.label
|
|
193
|
-
},
|
|
194
|
-
i.key
|
|
195
|
-
))
|
|
196
|
-
] }),
|
|
197
|
-
/* @__PURE__ */ e("div", { className: "flex flex-1 items-center justify-end pr-8", children: /* @__PURE__ */ u("div", { className: "flex w-max items-center justify-end gap-2 rounded-md border px-1.5 py-1", children: [
|
|
198
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 px-2 py-1", children: [
|
|
199
|
-
/* @__PURE__ */ e(
|
|
200
|
-
$,
|
|
201
|
-
{
|
|
202
|
-
disabled: c,
|
|
203
|
-
checked: c ? !0 : f === "split",
|
|
204
|
-
onCheckedChange: (i) => m(i ? "split" : "unified")
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ e("label", { className: "text-sm", children: "Split View" })
|
|
208
|
-
] }),
|
|
209
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 px-2 py-1", children: [
|
|
210
|
-
/* @__PURE__ */ e($, { checked: c, onCheckedChange: (i) => p(i) }),
|
|
211
|
-
/* @__PURE__ */ e("label", { className: "text-sm", children: "Show Raw Data" })
|
|
212
|
-
] }),
|
|
213
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 px-2 py-1", children: [
|
|
214
|
-
/* @__PURE__ */ e($, { checked: y, onCheckedChange: (i) => O(i) }),
|
|
215
|
-
/* @__PURE__ */ e("label", { className: "text-sm", children: "Hide Common Data" })
|
|
216
|
-
] })
|
|
217
|
-
] }) })
|
|
218
|
-
] }) }),
|
|
219
|
-
x ? /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center", children: /* @__PURE__ */ e(ne, { className: "h-6 w-6 animate-spin text-primary" }) }) : /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ u("div", { className: "relative min-h-0 flex-1", children: [
|
|
220
|
-
/* @__PURE__ */ u("div", { className: "absolute -top-5 z-50 mt-0.5 flex w-full items-center justify-between gap-2", children: [
|
|
221
|
-
/* @__PURE__ */ e("div", { className: "flex w-1/2 items-center justify-center gap-2", children: /* @__PURE__ */ e(K, { version: s }) }),
|
|
222
|
-
/* @__PURE__ */ e("div", { className: "flex w-1/2 items-center justify-center gap-2", children: /* @__PURE__ */ e(K, { version: d }) })
|
|
223
|
-
] }),
|
|
224
|
-
c ? /* @__PURE__ */ u("div", { className: "grid h-full grid-cols-2 gap-3 rounded-lg border", children: [
|
|
225
|
-
/* @__PURE__ */ u("div", { className: "relative flex min-h-0 flex-col border-r", children: [
|
|
226
|
-
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(R, { variant: "outline", size: "sm", onClick: () => E(a, "left"), children: [
|
|
227
|
-
l === "left" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
228
|
-
"Copy"
|
|
229
|
-
] }) }),
|
|
230
|
-
/* @__PURE__ */ e(A, { className: "flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900", children: /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap font-mono text-xs", children: L(a) }) })
|
|
231
|
-
] }),
|
|
232
|
-
/* @__PURE__ */ u("div", { className: "relative flex min-h-0 flex-col", children: [
|
|
233
|
-
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(R, { variant: "outline", size: "sm", onClick: () => E(w, "right"), children: [
|
|
234
|
-
l === "right" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
235
|
-
"Copy"
|
|
236
|
-
] }) }),
|
|
237
|
-
/* @__PURE__ */ e(A, { className: "flex-1 rounded-lg bg-slate-50 p-3 dark:bg-slate-900", children: /* @__PURE__ */ e("pre", { className: "whitespace-pre-wrap font-mono text-xs", children: L(w) }) })
|
|
238
|
-
] })
|
|
239
|
-
] }) : /* @__PURE__ */ e(A, { className: "h-full overflow-y-auto rounded-lg border bg-slate-50 text-xs dark:bg-slate-900", children: M.length === 0 ? /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ u("div", { className: "text-center text-muted-foreground", children: [
|
|
240
|
-
/* @__PURE__ */ e(z, { className: "mx-auto mb-2 h-8 w-8 opacity-50" }),
|
|
241
|
-
/* @__PURE__ */ e("p", { children: "No differences found or unable to parse diff" })
|
|
242
|
-
] }) }) : /* @__PURE__ */ e("div", { children: M.map((i, v) => /* @__PURE__ */ e("div", { className: "relative mb-4", children: /* @__PURE__ */ e(
|
|
243
|
-
le,
|
|
244
|
-
{
|
|
245
|
-
viewType: f,
|
|
246
|
-
diffType: i.type,
|
|
247
|
-
hunks: i.hunks,
|
|
248
|
-
className: "rounded-lg text-xs",
|
|
249
|
-
children: (k) => k.map((C, J) => {
|
|
250
|
-
const b = y ? xe(C.changes) : C.changes;
|
|
251
|
-
return (b == null ? void 0 : b.length) === 0 ? /* @__PURE__ */ e("div", { className: "absolute h-full w-full border-l pt-64 text-center font-sans text-sm", children: /* @__PURE__ */ e("span", { children: "No difference found" }) }) : /* @__PURE__ */ e(ae, { hunk: { ...C, changes: b } }, J);
|
|
252
|
-
})
|
|
253
|
-
},
|
|
254
|
-
y ? "hide-common-data" : "show-common-data"
|
|
255
|
-
) }, v)) }) })
|
|
256
|
-
] }) })
|
|
257
|
-
] }) });
|
|
258
|
-
}
|
|
259
|
-
export {
|
|
260
|
-
Oe as default
|
|
261
|
-
};
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s, Fragment as M } from "react/jsx-runtime";
|
|
2
|
-
import { D as j, z as F, B as A } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { D as B, e as H, f as O, g as W, o as q, p as R, q as J, d as K, v as Q, w as V, x as X, y as C } from "./index-OuHV9Ann.js";
|
|
4
|
-
import { at as Y, k as T, L as I, au as Z, j as ee, av as se, h as ae, aw as f, ax as o } from "./index-LBTm1Jmk.js";
|
|
5
|
-
import { find as G, startsWith as E, isEqual as ne, filter as te, get as D, map as le, isEmpty as ie } from "lodash-es";
|
|
6
|
-
import { AlertCircle as re, StarIcon as ce, MoreHorizontal as oe, PencilIcon as de, Power as me, TrashIcon as ue } from "lucide-react";
|
|
7
|
-
import { useState as S, useMemo as he, Suspense as L, lazy as z } from "react";
|
|
8
|
-
import { useTranslation as U } from "react-i18next";
|
|
9
|
-
import { toast as ge } from "sonner";
|
|
10
|
-
import { useSetAtom as pe } from "jotai";
|
|
11
|
-
const fe = ({ page: a, onClose: g }) => {
|
|
12
|
-
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data: t } = T(), r = G(t, { key: a == null ? void 0 : a.pageType }), x = (m) => {
|
|
13
|
-
if (m.preventDefault(), !(a != null && a.primaryPage) && Object.keys(I).some((p) => i === `/${p}` || E(i, `/${p}/`))) {
|
|
14
|
-
ge.error(l("Error"), {
|
|
15
|
-
description: l("Slugs cannot start with a language code for primary page")
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
N({ ...a, slug: i }, { onSuccess: g });
|
|
20
|
-
}, d = (a == null ? void 0 : a.lang) || "";
|
|
21
|
-
return /* @__PURE__ */ e(B, { open: !!a, onOpenChange: g, children: /* @__PURE__ */ s(H, { children: [
|
|
22
|
-
/* @__PURE__ */ s(O, { children: [
|
|
23
|
-
/* @__PURE__ */ e(W, { children: l("Change Slug") }),
|
|
24
|
-
/* @__PURE__ */ e(q, { className: "text-xs", children: /* @__PURE__ */ s(j, { variant: "destructive", className: "mt-2", children: [
|
|
25
|
-
/* @__PURE__ */ e(re, { className: "h-4 w-4" }),
|
|
26
|
-
l("Changing the slug may have impact on your SEO. Please proceed with caution.")
|
|
27
|
-
] }) })
|
|
28
|
-
] }),
|
|
29
|
-
/* @__PURE__ */ s("form", { onSubmit: x, children: [
|
|
30
|
-
/* @__PURE__ */ s("div", { className: "space-y-4 py-4 text-sm", children: [
|
|
31
|
-
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
32
|
-
/* @__PURE__ */ s("div", { children: [
|
|
33
|
-
/* @__PURE__ */ s("span", { children: [
|
|
34
|
-
l("Type"),
|
|
35
|
-
":"
|
|
36
|
-
] }),
|
|
37
|
-
/* @__PURE__ */ s("span", { className: "font-medium text-gray-600", children: [
|
|
38
|
-
" ",
|
|
39
|
-
(r == null ? void 0 : r.name) || (a == null ? void 0 : a.pageType)
|
|
40
|
-
] })
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ s("div", { children: [
|
|
43
|
-
/* @__PURE__ */ s("span", { children: [
|
|
44
|
-
l("Name"),
|
|
45
|
-
":"
|
|
46
|
-
] }),
|
|
47
|
-
/* @__PURE__ */ s("span", { className: "font-medium text-gray-600", children: [
|
|
48
|
-
" ",
|
|
49
|
-
a.name
|
|
50
|
-
] })
|
|
51
|
-
] })
|
|
52
|
-
] }),
|
|
53
|
-
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
54
|
-
/* @__PURE__ */ s(R, { htmlFor: "slug", className: "text-right", children: [
|
|
55
|
-
l("Slug"),
|
|
56
|
-
" ",
|
|
57
|
-
/* @__PURE__ */ s("small", { className: "font-light text-gray-500", children: [
|
|
58
|
-
l("Slug should start with"),
|
|
59
|
-
" /",
|
|
60
|
-
d
|
|
61
|
-
] })
|
|
62
|
-
] }),
|
|
63
|
-
/* @__PURE__ */ e(
|
|
64
|
-
F,
|
|
65
|
-
{
|
|
66
|
-
id: "slug",
|
|
67
|
-
value: i,
|
|
68
|
-
onChange: (m) => {
|
|
69
|
-
const u = m.target.value;
|
|
70
|
-
E(u, `/${d}`) && v(u);
|
|
71
|
-
},
|
|
72
|
-
className: "col-span-3",
|
|
73
|
-
required: !0,
|
|
74
|
-
pattern: "^/.*",
|
|
75
|
-
title: l("Slug must start with /"),
|
|
76
|
-
placeholder: l("Enter page slug")
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
] })
|
|
80
|
-
] }),
|
|
81
|
-
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { type: "submit", disabled: y || !E(i, `/${d}`) || ne(a == null ? void 0 : a.slug, i), children: l(y ? "Changing..." : "Change Slug") }) })
|
|
82
|
-
] })
|
|
83
|
-
] }) });
|
|
84
|
-
}, Ne = z(() => import("./delete-page-C99K2qzS.js")), ye = z(() => import("./unpublish-page-0fR1o0b7.js")), ke = () => {
|
|
85
|
-
const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data: t } = se(), { data: r } = T(), x = he(() => {
|
|
86
|
-
const n = r == null ? void 0 : r.find((h) => h.key === (t == null ? void 0 : t.pageType));
|
|
87
|
-
return t != null && t.dynamic ? n == null ? void 0 : n.dynamicSlug : "";
|
|
88
|
-
}, [r, t == null ? void 0 : t.pageType, t == null ? void 0 : t.dynamic]), [d, m] = S(null), [u, b] = S(null), [p, _] = S(null), { data: P } = ae(), $ = te(
|
|
89
|
-
D(P, "languages") || ["en"],
|
|
90
|
-
(n) => !G(N, { lang: n }) && n !== D(P, "fallbackLang")
|
|
91
|
-
);
|
|
92
|
-
return /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
93
|
-
/* @__PURE__ */ e("ul", { className: "space-y-2", children: y ? /* @__PURE__ */ s("div", { className: "w-full space-y-3 py-4", children: [
|
|
94
|
-
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
|
|
95
|
-
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
|
|
96
|
-
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" })
|
|
97
|
-
] }) : le(N, (n) => {
|
|
98
|
-
const h = n.lang, w = n.slug, k = !n.primaryPage;
|
|
99
|
-
return /* @__PURE__ */ s(M, { children: [
|
|
100
|
-
/* @__PURE__ */ s(
|
|
101
|
-
"li",
|
|
102
|
-
{
|
|
103
|
-
className: `flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${h === l ? "bg-gray-200" : "hover:bg-gray-100"}`,
|
|
104
|
-
onClick: () => v(h),
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ s("div", { className: "flex-1 gap-x-3", children: [
|
|
107
|
-
/* @__PURE__ */ s("div", { className: "flex items-center gap-x-2 text-[13px] text-slate-800", children: [
|
|
108
|
-
/* @__PURE__ */ e("div", { className: `h-2.5 w-2.5 rounded-full ${n.online ? "bg-green-300" : "bg-gray-300"}` }),
|
|
109
|
-
D(I, k ? i : h, h)
|
|
110
|
-
] }),
|
|
111
|
-
/* @__PURE__ */ s("div", { children: [
|
|
112
|
-
w && /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
|
|
113
|
-
"Slug: ",
|
|
114
|
-
/* @__PURE__ */ e("b", { className: "font-mono font-medium", children: x ? `${w}/${x}` : w })
|
|
115
|
-
] }),
|
|
116
|
-
/* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
|
|
117
|
-
"Name:",
|
|
118
|
-
/* @__PURE__ */ s("b", { className: "font-medium", children: [
|
|
119
|
-
" ",
|
|
120
|
-
n.name,
|
|
121
|
-
" "
|
|
122
|
-
] })
|
|
123
|
-
] })
|
|
124
|
-
] })
|
|
125
|
-
] }),
|
|
126
|
-
k ? /* @__PURE__ */ s("div", { className: "flex items-center gap-x-1 text-[11px] text-orange-500", children: [
|
|
127
|
-
/* @__PURE__ */ e(ce, { fill: "orange", className: "h-3 w-3" }),
|
|
128
|
-
/* @__PURE__ */ e("b", { children: " Primary" })
|
|
129
|
-
] }) : /* @__PURE__ */ e("div", { className: "flex items-center gap-x-3", children: /* @__PURE__ */ e(
|
|
130
|
-
f,
|
|
131
|
-
{
|
|
132
|
-
permissions: [
|
|
133
|
-
o.EDIT_PAGE,
|
|
134
|
-
o.DELETE_PAGE,
|
|
135
|
-
o.UNPUBLISH_PAGE
|
|
136
|
-
],
|
|
137
|
-
children: /* @__PURE__ */ s(Q, { children: [
|
|
138
|
-
/* @__PURE__ */ e(V, { asChild: !0, onClick: (c) => c.stopPropagation(), children: /* @__PURE__ */ e(A, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", children: /* @__PURE__ */ e(oe, { className: "h-4 w-4" }) }) }),
|
|
139
|
-
/* @__PURE__ */ s(X, { align: "end", className: "z-[9999] text-sm", children: [
|
|
140
|
-
/* @__PURE__ */ e(f, { permissions: [o.EDIT_PAGE], children: /* @__PURE__ */ s(
|
|
141
|
-
C,
|
|
142
|
-
{
|
|
143
|
-
className: "flex cursor-pointer items-center gap-2",
|
|
144
|
-
onClick: (c) => {
|
|
145
|
-
c.stopPropagation(), g({
|
|
146
|
-
edit: !0,
|
|
147
|
-
id: n.id,
|
|
148
|
-
primaryPage: n.primaryPage
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
children: [
|
|
152
|
-
/* @__PURE__ */ e(de, { className: "size-3" }),
|
|
153
|
-
a("Edit")
|
|
154
|
-
]
|
|
155
|
-
}
|
|
156
|
-
) }),
|
|
157
|
-
/* @__PURE__ */ e(f, { permissions: [o.UNPUBLISH_PAGE], children: (n == null ? void 0 : n.online) && /* @__PURE__ */ s(
|
|
158
|
-
C,
|
|
159
|
-
{
|
|
160
|
-
className: "flex cursor-pointer items-center gap-2",
|
|
161
|
-
onClick: (c) => {
|
|
162
|
-
c.stopPropagation(), b(n);
|
|
163
|
-
},
|
|
164
|
-
children: [
|
|
165
|
-
/* @__PURE__ */ e(me, { className: "size-3" }),
|
|
166
|
-
a("Unpublish")
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
) }),
|
|
170
|
-
/* @__PURE__ */ e(f, { permissions: [o.DELETE_PAGE], children: /* @__PURE__ */ s(
|
|
171
|
-
C,
|
|
172
|
-
{
|
|
173
|
-
className: "flex cursor-pointer items-center gap-2",
|
|
174
|
-
onClick: (c) => {
|
|
175
|
-
c.stopPropagation(), m(n);
|
|
176
|
-
},
|
|
177
|
-
children: [
|
|
178
|
-
/* @__PURE__ */ e(ue, { className: "size-3" }),
|
|
179
|
-
a("Delete")
|
|
180
|
-
]
|
|
181
|
-
}
|
|
182
|
-
) })
|
|
183
|
-
] })
|
|
184
|
-
] })
|
|
185
|
-
}
|
|
186
|
-
) })
|
|
187
|
-
]
|
|
188
|
-
},
|
|
189
|
-
n.id
|
|
190
|
-
),
|
|
191
|
-
/* @__PURE__ */ e("div", { className: "h-1 w-full border-b" })
|
|
192
|
-
] });
|
|
193
|
-
}) }),
|
|
194
|
-
/* @__PURE__ */ e(f, { permissions: [o.ADD_PAGE], children: /* @__PURE__ */ e("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ e(
|
|
195
|
-
A,
|
|
196
|
-
{
|
|
197
|
-
variant: "default",
|
|
198
|
-
size: "sm",
|
|
199
|
-
disabled: ie($),
|
|
200
|
-
onClick: () => {
|
|
201
|
-
g({
|
|
202
|
-
primaryPage: t == null ? void 0 : t.id,
|
|
203
|
-
edit: !1
|
|
204
|
-
});
|
|
205
|
-
},
|
|
206
|
-
children: a("Add new language page")
|
|
207
|
-
}
|
|
208
|
-
) }) }),
|
|
209
|
-
d && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(Ne, { page: d, onClose: () => m(null) }) }),
|
|
210
|
-
u && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(ye, { page: u, onClose: () => b(null) }) }),
|
|
211
|
-
p && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(fe, { page: p, onClose: () => _(null) }) })
|
|
212
|
-
] });
|
|
213
|
-
};
|
|
214
|
-
export {
|
|
215
|
-
ke as default
|
|
216
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DCJDQs1a.cjs"),n=require("./index-BVwFJWDq.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DLohaU-U.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-CUr8Xub6.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.usePrimaryPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,v]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,C=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[C&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${C}/${E}`:C})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),v(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>v(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
|