@chaibuilder/sdk 4.0.0-beta.32 → 4.0.0-beta.34
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/{2SSKDMRQ-DfXKDvXk.cjs → 2SSKDMRQ-BM-tJzJS.cjs} +1 -1
- package/dist/{2SSKDMRQ-pPung-JB.js → 2SSKDMRQ-hkjhJNfh.js} +5 -5
- package/dist/{AP7HFJJL-PvPBwV6T.cjs → AP7HFJJL-MEqeM2Ns.cjs} +1 -1
- package/dist/{AP7HFJJL-CEJuc_Ox.js → AP7HFJJL-XRxLnRog.js} +1 -1
- package/dist/{IconPicker-BJHUCDn4.cjs → IconPicker-Bl4iY4Cu.cjs} +1 -1
- package/dist/{IconPicker-D_GRfhwS.js → IconPicker-D5wIkgWK.js} +1 -1
- package/dist/{WDYDFRGG-B3FrCE_j.js → WDYDFRGG-8UgG1Mx8.js} +4 -4
- package/dist/{WDYDFRGG-BPHlcLi5.cjs → WDYDFRGG-BitFxd1K.cjs} +1 -1
- package/dist/{actions-registery-Cy1lqUVI.cjs → actions-registery-Byid-s6S.cjs} +28 -28
- package/dist/{actions-registery-Bj-j1k5i.js → actions-registery-CKEzH855.js} +2245 -2067
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-C_Ma7oFU.js → active-in-another-tab-BBrqPDfn.js} +2 -2
- package/dist/{active-in-another-tab-WVYf-z5w.cjs → active-in-another-tab-BsdNjSxr.cjs} +1 -1
- package/dist/{add-new-language-page-CxW2Vuyr.cjs → add-new-language-page-BJUHnI7Z.cjs} +1 -1
- package/dist/{add-new-language-page-DtsBO739.js → add-new-language-page-DvSZenkC.js} +3 -3
- package/dist/{add-new-page-BfKt72NF.cjs → add-new-page-BI7qCsmh.cjs} +1 -1
- package/dist/add-new-page-Dd16d2mC.js +31 -0
- package/dist/{ai-panel-content-dktE9CIO.js → ai-panel-content-CLNgM3Td.js} +5 -5
- package/dist/{ai-panel-content-Dfo4jOVB.cjs → ai-panel-content-CcqF0I9F.cjs} +1 -1
- package/dist/{ai-panel-default-lang-BbUTXMbm.js → ai-panel-default-lang-BooHb2pz.js} +7 -7
- package/dist/{ai-panel-default-lang-GQCtwlPs.cjs → ai-panel-default-lang-XPtfrifL.cjs} +2 -2
- package/dist/{ai-panel-other-lang-nCUxwpLX.cjs → ai-panel-other-lang-BwnRUTSF.cjs} +1 -1
- package/dist/{ai-panel-other-lang-DIDS-mTi.js → ai-panel-other-lang-CcgIMR3N.js} +13 -13
- package/dist/{ai-prompt-input-B2q30bhR.js → ai-prompt-input-AUdUYGNa.js} +13 -13
- package/dist/{ai-prompt-input-Dws5BHhQ.cjs → ai-prompt-input-CQ5SJPkx.cjs} +1 -1
- package/dist/{ai-translation-prompt-CJVcuWrs.cjs → ai-translation-prompt-BTNGNtbf.cjs} +1 -1
- package/dist/{ai-translation-prompt-D87qk3C1.js → ai-translation-prompt-BYUh4Mnb.js} +1 -1
- package/dist/apply-binding-Bu5W9YFY.js +940 -0
- package/dist/apply-binding-C0xIYKCN.cjs +41 -0
- package/dist/{change-password-modal-CVUa60pC.cjs → change-password-modal-CYkUXUa5.cjs} +1 -1
- package/dist/{change-password-modal-PahNYs8x.js → change-password-modal-DCd1gdCm.js} +5 -5
- package/dist/{code-editor-Cim6jQVF.cjs → code-editor-BC6Z10dU.cjs} +1 -1
- package/dist/{code-editor-CWOmKcUc.js → code-editor-DWrVXxeA.js} +1 -1
- package/dist/{continue-editing-in-this-client-BYFOU3hH.js → continue-editing-in-this-client-Bdd5Ls6t.js} +2 -2
- package/dist/{continue-editing-in-this-client-CW0f2LRk.cjs → continue-editing-in-this-client-D6Wc8hEK.cjs} +1 -1
- package/dist/{core-BWQrViOY.cjs → core-czmLeR0h.cjs} +1 -1
- package/dist/{core-QlWEXm1d.js → core-nSRy3D7z.js} +16 -15
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +14 -2
- package/dist/core.js +19 -19
- package/dist/{css-import-modal-6bMTRlCg.js → css-import-modal-Cpwll5L-.js} +1 -1
- package/dist/{css-import-modal-CXulmaB4.cjs → css-import-modal-FHeYoxo2.cjs} +1 -1
- package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
- package/dist/{plugin-BSjgGgwo.js → default-theme-options-saBIkWGT.js} +114 -114
- package/dist/{delete-page-BDViv7Xm.js → delete-page-DyP68v_N.js} +15 -15
- package/dist/delete-page-PQGa6Am5.cjs +1 -0
- package/dist/{design-token-usage-D-hrcKz1.cjs → design-token-usage-CoaLw6EJ.cjs} +1 -1
- package/dist/{design-token-usage-lf7N_uOk.js → design-token-usage-dR3UlfIC.js} +14 -14
- package/dist/{digital-asset-manager-PcYficIX.js → digital-asset-manager-BNj96Pnh.js} +3 -3
- package/dist/{digital-asset-manager-CxxhsToc.cjs → digital-asset-manager-Bxkm-jdI.cjs} +1 -1
- package/dist/{duplicate-page-DfEA148D.js → duplicate-page-Cg6WnFeY.js} +6 -6
- package/dist/{duplicate-page-D2f3HvWX.cjs → duplicate-page-DV_lZ8jF.cjs} +1 -1
- package/dist/{dynamic-page-selector-Dz7D1Wdr.cjs → dynamic-page-selector-C8ax7W_D.cjs} +1 -1
- package/dist/{dynamic-page-selector-DB__KD2y.js → dynamic-page-selector-DcQiWgiL.js} +12 -12
- package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
- package/dist/{image-editor-BdW476J8.cjs → image-editor-C5rYU8Ic.cjs} +1 -1
- package/dist/{image-editor-CilPMtAC.js → image-editor-DGp2-ImI.js} +1 -1
- package/dist/{index-DsQXiNA_.js → index-94oA-Cgl.js} +3994 -3943
- package/dist/index-Bg3Prrc_.cjs +5 -0
- package/dist/index-BsloTOgy.cjs +160 -0
- package/dist/{index-IQefjAA0.js → index-CDUCqK5V.js} +1912 -1931
- package/dist/{json-diff-viewer-BPqY25PU.cjs → json-diff-viewer-CdU-gKRr.cjs} +1 -1
- package/dist/{json-diff-viewer-Ci2IbgDn.js → json-diff-viewer-CniMcSHL.js} +34 -34
- package/dist/lang-panel-Dg7eZqIm.cjs +1 -0
- package/dist/{lang-panel-DlAQr-y9.js → lang-panel-YLNZisL2.js} +13 -13
- package/dist/manage-design-tokens-Bct88PT-.js +446 -0
- package/dist/manage-design-tokens-CMf-Vk72.cjs +1 -0
- package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-CeSW9VV_.js} +9 -9
- package/dist/manage-design-tokens-modal-YPEBybz3.cjs +1 -0
- package/dist/{mark-as-template-DS-tMllK.cjs → mark-as-template-C5rPp_PV.cjs} +1 -1
- package/dist/{mark-as-template-DOZL3umP.js → mark-as-template-WJ4kUyZK.js} +7 -7
- package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-COErdW8f.cjs} +1 -1
- package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-D0hfMLC6.js} +1 -1
- package/dist/{no-language-page-content-C8W0M_Fj.js → no-language-page-content-BLnpbzwT.js} +2 -2
- package/dist/{no-language-page-content-DWtEo657.cjs → no-language-page-content-CK_K6fh9.cjs} +1 -1
- package/dist/{no-language-page-dialog-FVXkSnfT.cjs → no-language-page-dialog-BI55QXS_.cjs} +1 -1
- package/dist/{no-language-page-dialog-cpCZ9vES.js → no-language-page-dialog-gZGw3Uzp.js} +2 -2
- package/dist/page-creator-C2ZwuF6M.cjs +1 -0
- package/dist/{page-creator-CFtxeW_t.js → page-creator-hHpEaVpS.js} +183 -183
- package/dist/{page-lock-BS_ErOIW.cjs → page-lock-BN8BI4J8.cjs} +1 -1
- package/dist/{page-lock-Cthbk6Pg.js → page-lock-DMzAREda.js} +2 -2
- package/dist/{page-locked-dialog-BWXifuQ8.cjs → page-locked-dialog-B_2Hy4PJ.cjs} +1 -1
- package/dist/{page-locked-dialog-D5hmaWqw.js → page-locked-dialog-CZiVFSGf.js} +13 -13
- package/dist/page-manager-new-74gQK_vK.js +408 -0
- package/dist/page-manager-new-DLVIuTY7.cjs +1 -0
- package/dist/{page-manager-search-and-filter-jDoLrCB7.cjs → page-manager-search-and-filter-C6XNDRT7.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-iFsFJhn4.js → page-manager-search-and-filter-DYXCod2G.js} +9 -9
- package/dist/page-revisions-content-44SecMak.cjs +1 -0
- package/dist/{page-revisions-content-C1IGUurW.js → page-revisions-content-BWLkqXrw.js} +40 -40
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +35 -4
- package/dist/pages.js +15 -14
- package/dist/{publish-pages-content-BpEoA1T6.js → publish-pages-content-COHFXR-v.js} +68 -75
- package/dist/publish-pages-content-msfUAXJy.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.js +5 -5
- package/dist/{rte-widget-modal-CC1KcrAT.cjs → rte-widget-modal-ck2hWBPv.cjs} +1 -1
- package/dist/{rte-widget-modal-c3T09VeO.js → rte-widget-modal-muaFxwH1.js} +1 -1
- package/dist/runtime.cjs +6 -6
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +36 -35
- package/dist/{save-to-lib-BERYhyxq.js → save-to-lib-JBs4ml12.js} +25 -25
- package/dist/{save-to-lib-Bk59qO1r.cjs → save-to-lib-NHLFZR6b.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-C6NxfC0N.js → selected-block-display-0rlYn5jN.js} +20 -20
- package/dist/{selected-block-display-vFSCOnw8.cjs → selected-block-display-BhnCoV28.cjs} +1 -1
- package/dist/seo-panel-BLTekCWH.cjs +2 -0
- package/dist/{seo-panel-COrEJZLA.js → seo-panel-D8QdAKVh.js} +25 -25
- package/dist/shared-json-ld-CDYobqPW.cjs +1 -0
- package/dist/{shared-json-ld-DnTuCBc3.js → shared-json-ld-DclZXKU6.js} +33 -33
- package/dist/{slug-input-CAqkFZBq.js → slug-input-BOaNz0te.js} +1 -1
- package/dist/{slug-input-Curnt2n3.cjs → slug-input-D3pjtp5_.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +6 -0
- package/dist/supabase-actions.js +223 -155
- package/dist/{take-over-request-6fliSr8w.cjs → take-over-request-CF3ubryV.cjs} +1 -1
- package/dist/{take-over-request-DvmM5qTu.js → take-over-request-CbQfdDOW.js} +13 -13
- package/dist/{translation-warning-modal-kRcfrPgo.js → translation-warning-modal-Bs5qTh3p.js} +9 -9
- package/dist/{translation-warning-modal-B876S5yp.cjs → translation-warning-modal-Bseflnj4.cjs} +1 -1
- package/dist/types.d.ts +14 -2
- package/dist/{unmark-as-template-q1GblG-u.cjs → unmark-as-template-CtiOyF4c.cjs} +1 -1
- package/dist/{unmark-as-template-Dn3klZKq.js → unmark-as-template-rGzNVgFR.js} +13 -13
- package/dist/{unpublish-page-DMbcHmUV.cjs → unpublish-page-CNR43LxM.cjs} +1 -1
- package/dist/unpublish-page-DhtGUDXp.js +28 -0
- package/dist/{unpublished-partials-modal-CEFXp1D1.cjs → unpublished-partials-modal-BmKRB4Tl.cjs} +1 -1
- package/dist/{unpublished-partials-modal-Ts5ZhAK9.js → unpublished-partials-modal-j0zuOxDo.js} +3 -3
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/dist/{web-preview-B2YGL26D.js → web-preview-BCWqRDBW.js} +1 -1
- package/dist/{web-preview-C6SLwtqv.cjs → web-preview-DYyGglxW.cjs} +1 -1
- package/package.json +2 -1
- package/dist/add-new-page-DG38rI6S.js +0 -31
- package/dist/apply-binding-9XSrYzAE.cjs +0 -1
- package/dist/apply-binding-chfbBKi2.js +0 -846
- package/dist/delete-page-CdByrw3j.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/index-Bzyv7mAh.cjs +0 -5
- package/dist/index-mPCp0j2h.cjs +0 -160
- package/dist/lang-panel-jebYHYGD.cjs +0 -1
- package/dist/manage-design-tokens-BknGNAKE.cjs +0 -1
- package/dist/manage-design-tokens-Co5677WS.js +0 -428
- package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +0 -1
- package/dist/page-creator-o6yRzsVf.cjs +0 -1
- package/dist/page-manager-new-Dl5YwsMm.js +0 -418
- package/dist/page-manager-new-DpSqBzeh.cjs +0 -1
- package/dist/page-revisions-content-CeBepZEw.cjs +0 -1
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/publish-pages-content-PNsiaGI-.cjs +0 -1
- package/dist/seo-panel-0vlr_dBq.cjs +0 -2
- package/dist/shared-json-ld-C46hURIr.cjs +0 -1
- package/dist/theme-panel-footer-3ixmq107.cjs +0 -1
- package/dist/theme-panel-footer-BlsXRcEY.js +0 -26
- package/dist/unpublish-page-BbFZw0so.js +0 -28
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-BsloTOgy.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-Bg3Prrc_.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
2
|
`),s=d.split(`
|
|
3
3
|
`);let u=`--- a/${o}
|
|
4
4
|
`;u+=`+++ b/${o}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { D as V, e as _, f as q, g as G, aa as $, a6 as A, ab as P } from "./index-
|
|
2
|
+
import { D as V, e as _, f as q, g as G, aa as $, a6 as A, ab as P } from "./index-94oA-Cgl.js";
|
|
3
3
|
import { B as z } from "./register-chai-top-bar-D6GjnauV.js";
|
|
4
4
|
import { formatDate as Q } from "date-fns";
|
|
5
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
6
|
import { FileJson as B, Loader as ne, Check as F, Copy as H } from "lucide-react";
|
|
7
7
|
import { useState as D, useMemo as I } from "react";
|
|
8
|
-
import { parseDiff as se, Diff as
|
|
9
|
-
import {
|
|
8
|
+
import { parseDiff as se, Diff as le, Hunk as ae } from "react-diff-view";
|
|
9
|
+
import { as as ie, at as oe, A as ce, w as de } from "./index-CDUCqK5V.js";
|
|
10
10
|
import { useQuery as fe } from "@tanstack/react-query";
|
|
11
11
|
function me(t, n) {
|
|
12
12
|
const o = ie(), s = oe(), d = T(t.uid, "draft:") || T(n.uid, "live:");
|
|
@@ -15,13 +15,13 @@ function me(t, n) {
|
|
|
15
15
|
queryFn: async () => {
|
|
16
16
|
if (!t.uid || !n.uid)
|
|
17
17
|
throw new Error("Both revision IDs are required for comparison");
|
|
18
|
-
const
|
|
18
|
+
const l = (m) => m === "draft" || m === "live" ? m : "revision", r = (m) => W(m.uid, `${m.label}:`, "");
|
|
19
19
|
return await s(o, {
|
|
20
20
|
action: ce.GET_COMPARE_DATA,
|
|
21
21
|
data: {
|
|
22
22
|
versions: {
|
|
23
|
-
version1: { type:
|
|
24
|
-
version2: { type:
|
|
23
|
+
version1: { type: l(t.label), id: r(t) },
|
|
24
|
+
version2: { type: l(n.label), id: r(n) }
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -58,7 +58,7 @@ const he = ({ version: t }) => {
|
|
|
58
58
|
);
|
|
59
59
|
}, K = ({ version: t }) => /* @__PURE__ */ e(he, { version: t });
|
|
60
60
|
function ue(t, n, o = "data.json") {
|
|
61
|
-
const s = JSON.stringify(t, null, 2), d = JSON.stringify(n, null, 2),
|
|
61
|
+
const s = JSON.stringify(t, null, 2), d = JSON.stringify(n, null, 2), l = s.split(`
|
|
62
62
|
`), r = d.split(`
|
|
63
63
|
`);
|
|
64
64
|
let f = `--- a/${o}
|
|
@@ -67,35 +67,35 @@ function ue(t, n, o = "data.json") {
|
|
|
67
67
|
`;
|
|
68
68
|
const m = [];
|
|
69
69
|
let c = 0, p = 0;
|
|
70
|
-
for (; c <
|
|
71
|
-
const g =
|
|
70
|
+
for (; c < l.length || p < r.length; ) {
|
|
71
|
+
const g = l[c] || "", N = r[p] || "";
|
|
72
72
|
if (g === N)
|
|
73
73
|
m.push(` ${g}`), c++, p++;
|
|
74
74
|
else {
|
|
75
75
|
let h = -1, x = -1;
|
|
76
|
-
for (let
|
|
77
|
-
if (r[p] === a
|
|
78
|
-
h =
|
|
76
|
+
for (let a = c + 1; a < l.length; a++)
|
|
77
|
+
if (r[p] === l[a]) {
|
|
78
|
+
h = a;
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
|
-
for (let
|
|
82
|
-
if (
|
|
83
|
-
x =
|
|
81
|
+
for (let a = p + 1; a < r.length; a++)
|
|
82
|
+
if (l[c] === r[a]) {
|
|
83
|
+
x = a;
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
if (h !== -1 && (x === -1 || h - c <= x - p)) {
|
|
87
|
-
for (let
|
|
88
|
-
m.push(`-${a
|
|
87
|
+
for (let a = c; a < h; a++)
|
|
88
|
+
m.push(`-${l[a]}`);
|
|
89
89
|
c = h;
|
|
90
90
|
} else if (x !== -1) {
|
|
91
|
-
for (let
|
|
92
|
-
m.push(`+${r[
|
|
91
|
+
for (let a = p; a < x; a++)
|
|
92
|
+
m.push(`+${r[a]}`);
|
|
93
93
|
p = x;
|
|
94
94
|
} else
|
|
95
95
|
g && m.push(`-${g}`), N && m.push(`+${N}`), c++, p++;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
const y =
|
|
98
|
+
const y = l.length, O = r.length;
|
|
99
99
|
return f += `@@ -1,${y} +1,${O} @@
|
|
100
100
|
`, f += m.join(`
|
|
101
101
|
`) + `
|
|
@@ -106,8 +106,8 @@ function S(t, n = !0, o = !1) {
|
|
|
106
106
|
const s = Y(t);
|
|
107
107
|
if (T(s, "{") || T(s, "[") || n && (s === "true" || s === "false" || s === "null" || /^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(s)))
|
|
108
108
|
try {
|
|
109
|
-
const
|
|
110
|
-
return S(
|
|
109
|
+
const l = JSON.parse(s);
|
|
110
|
+
return S(l, n, o);
|
|
111
111
|
} catch {
|
|
112
112
|
if (o)
|
|
113
113
|
throw new Error(`Invalid JSON string: ${s}`);
|
|
@@ -140,11 +140,11 @@ const pe = (t) => {
|
|
|
140
140
|
o.add(c);
|
|
141
141
|
});
|
|
142
142
|
const d = [];
|
|
143
|
-
let
|
|
143
|
+
let l = -1;
|
|
144
144
|
return t.forEach((r, f) => {
|
|
145
145
|
if (o.has(f)) {
|
|
146
|
-
if (
|
|
147
|
-
const m = t[
|
|
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
148
|
d.push({
|
|
149
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
150
|
"No changes from ",
|
|
@@ -155,16 +155,16 @@ const pe = (t) => {
|
|
|
155
155
|
] }) })
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
d.push(r),
|
|
158
|
+
d.push(r), l = f;
|
|
159
159
|
}
|
|
160
160
|
}), d;
|
|
161
161
|
};
|
|
162
162
|
function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
163
|
-
const s = n[0], d = n[1], [
|
|
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: U } = I(() => {
|
|
164
164
|
var b, R;
|
|
165
165
|
const i = (b = h == null ? void 0 : h.version1) == null ? void 0 : b[g], v = (R = h == null ? void 0 : h.version2) == null ? void 0 : R[g], k = S(i), C = S(v), J = ge(h == null ? void 0 : h.version1, h == null ? void 0 : h.version2);
|
|
166
166
|
return { leftData: k, rightData: C, options: J };
|
|
167
|
-
}, [h, g]), j = I(() => !
|
|
167
|
+
}, [h, g]), j = I(() => !a || !w ? "" : ue(a, w), [a, w]), M = I(() => {
|
|
168
168
|
if (!j) return [];
|
|
169
169
|
try {
|
|
170
170
|
return se(j);
|
|
@@ -223,15 +223,15 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
223
223
|
] }),
|
|
224
224
|
c ? /* @__PURE__ */ u("div", { className: "grid h-full grid-cols-2 gap-3 rounded-lg border", children: [
|
|
225
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(z, { variant: "outline", size: "sm", onClick: () => E(
|
|
227
|
-
|
|
226
|
+
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(z, { variant: "outline", size: "sm", onClick: () => E(a, "left"), children: [
|
|
227
|
+
l === "left" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
228
228
|
"Copy"
|
|
229
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(
|
|
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
231
|
] }),
|
|
232
232
|
/* @__PURE__ */ u("div", { className: "relative flex min-h-0 flex-col", children: [
|
|
233
233
|
/* @__PURE__ */ e("div", { className: "absolute -top-4 right-4 z-50", children: /* @__PURE__ */ u(z, { variant: "outline", size: "sm", onClick: () => E(w, "right"), children: [
|
|
234
|
-
|
|
234
|
+
l === "right" ? /* @__PURE__ */ e(F, { className: "text-green-500" }) : /* @__PURE__ */ e(H, {}),
|
|
235
235
|
"Copy"
|
|
236
236
|
] }) }),
|
|
237
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) }) })
|
|
@@ -240,7 +240,7 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
240
240
|
/* @__PURE__ */ e(B, { className: "mx-auto mb-2 h-8 w-8 opacity-50" }),
|
|
241
241
|
/* @__PURE__ */ e("p", { children: "No differences found or unable to parse diff" })
|
|
242
242
|
] }) }) : /* @__PURE__ */ e("div", { children: M.map((i, v) => /* @__PURE__ */ e("div", { className: "relative mb-4", children: /* @__PURE__ */ e(
|
|
243
|
-
|
|
243
|
+
le,
|
|
244
244
|
{
|
|
245
245
|
viewType: f,
|
|
246
246
|
diffType: i.type,
|
|
@@ -248,7 +248,7 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
|
|
|
248
248
|
className: "rounded-lg text-xs",
|
|
249
249
|
children: (k) => k.map((C, J) => {
|
|
250
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(
|
|
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
252
|
})
|
|
253
253
|
},
|
|
254
254
|
y ? "hide-common-data" : "show-common-data"
|
|
@@ -0,0 +1 @@
|
|
|
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-BsloTOgy.cjs"),n=require("./index-Bg3Prrc_.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-PQGa6Am5.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-CNR43LxM.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=_;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as M } from "react/jsx-runtime";
|
|
2
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,
|
|
4
|
-
import {
|
|
5
|
-
import { find as
|
|
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, r as Q, s as V, t as X, v as w } from "./index-94oA-Cgl.js";
|
|
4
|
+
import { av as Y, k as T, L as I, aw as Z, j as ee, ax as se, h as ae, ay as f, az as o } from "./index-CDUCqK5V.js";
|
|
5
|
+
import { find as z, startsWith as E, isEqual as ne, filter as te, get as D, map as le, isEmpty as ie } from "lodash-es";
|
|
6
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
|
|
7
|
+
import { useState as S, useMemo as he, Suspense as L, lazy as G } from "react";
|
|
8
8
|
import { useTranslation as U } from "react-i18next";
|
|
9
9
|
import { toast as ge } from "sonner";
|
|
10
10
|
import { useSetAtom as pe } from "jotai";
|
|
11
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 =
|
|
12
|
+
const { t: l } = U(), [i, v] = S(a.slug || ""), { mutate: N, isPending: y } = Y(), { data: t } = T(), r = z(t, { key: a == null ? void 0 : a.pageType }), x = (m) => {
|
|
13
13
|
if (m.preventDefault(), !(a != null && a.primaryPage) && Object.keys(I).some((p) => i === `/${p}` || E(i, `/${p}/`))) {
|
|
14
14
|
ge.error(l("Error"), {
|
|
15
15
|
description: l("Slugs cannot start with a language code for primary page")
|
|
@@ -81,13 +81,13 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
81
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
82
|
] })
|
|
83
83
|
] }) });
|
|
84
|
-
}, Ne =
|
|
84
|
+
}, Ne = G(() => import("./delete-page-DyP68v_N.js")), ye = G(() => import("./unpublish-page-DhtGUDXp.js")), ke = () => {
|
|
85
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
86
|
const n = r == null ? void 0 : r.find((h) => h.key === (t == null ? void 0 : t.pageType));
|
|
87
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,
|
|
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
89
|
D(P, "languages") || ["en"],
|
|
90
|
-
(n) => !
|
|
90
|
+
(n) => !z(N, { lang: n }) && n !== D(P, "fallbackLang")
|
|
91
91
|
);
|
|
92
92
|
return /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
93
93
|
/* @__PURE__ */ e("ul", { className: "space-y-2", children: y ? /* @__PURE__ */ s("div", { className: "w-full space-y-3 py-4", children: [
|
|
@@ -95,7 +95,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
95
95
|
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
|
|
96
96
|
/* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" })
|
|
97
97
|
] }) : le(N, (n) => {
|
|
98
|
-
const h = n.lang,
|
|
98
|
+
const h = n.lang, C = n.slug, k = !n.primaryPage;
|
|
99
99
|
return /* @__PURE__ */ s(M, { children: [
|
|
100
100
|
/* @__PURE__ */ s(
|
|
101
101
|
"li",
|
|
@@ -109,9 +109,9 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
109
109
|
D(I, k ? i : h, h)
|
|
110
110
|
] }),
|
|
111
111
|
/* @__PURE__ */ s("div", { children: [
|
|
112
|
-
|
|
112
|
+
C && /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
|
|
113
113
|
"Slug: ",
|
|
114
|
-
/* @__PURE__ */ e("b", { className: "font-mono font-medium", children: x ? `${
|
|
114
|
+
/* @__PURE__ */ e("b", { className: "font-mono font-medium", children: x ? `${C}/${x}` : C })
|
|
115
115
|
] }),
|
|
116
116
|
/* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
|
|
117
117
|
"Name:",
|
|
@@ -159,7 +159,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
159
159
|
{
|
|
160
160
|
className: "flex cursor-pointer items-center gap-2",
|
|
161
161
|
onClick: (c) => {
|
|
162
|
-
c.stopPropagation(),
|
|
162
|
+
c.stopPropagation(), b(n);
|
|
163
163
|
},
|
|
164
164
|
children: [
|
|
165
165
|
/* @__PURE__ */ e(me, { className: "size-3" }),
|
|
@@ -207,7 +207,7 @@ const fe = ({ page: a, onClose: g }) => {
|
|
|
207
207
|
}
|
|
208
208
|
) }) }),
|
|
209
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: () =>
|
|
210
|
+
u && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(ye, { page: u, onClose: () => b(null) }) }),
|
|
211
211
|
p && /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(fe, { page: p, onClose: () => _(null) }) })
|
|
212
212
|
] });
|
|
213
213
|
};
|