@chaibuilder/sdk 4.0.0-beta.23 → 4.0.0-beta.25
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-SUA5eA2S.js → 2SSKDMRQ-Bk_4y8lw.js} +2 -2
- package/dist/{2SSKDMRQ-DVWVGtU8.cjs → 2SSKDMRQ-vWeQ_IyI.cjs} +1 -1
- package/dist/{AP7HFJJL-CUN5zddU.cjs → AP7HFJJL-CMPLeI6t.cjs} +1 -1
- package/dist/{AP7HFJJL-Co5bLh3I.js → AP7HFJJL-D_mI2XSw.js} +1 -1
- package/dist/{IconPicker-Bmz6vXB8.cjs → IconPicker-DB_PpKvH.cjs} +1 -1
- package/dist/{IconPicker-BZvFj3cg.js → IconPicker-jc6_JzXf.js} +1 -1
- package/dist/{WDYDFRGG-DjCIT9L-.js → WDYDFRGG-B4H3RPcp.js} +2 -2
- package/dist/{WDYDFRGG-BpSteEEf.cjs → WDYDFRGG-D7vzbPjk.cjs} +1 -1
- package/dist/{active-in-another-tab-DfRJcvAz.js → active-in-another-tab-CDhFxBU7.js} +2 -2
- package/dist/{active-in-another-tab-C8-vpt8f.cjs → active-in-another-tab-CMPHyyHE.cjs} +1 -1
- package/dist/{add-new-language-page-jZ7Pg0Fv.js → add-new-language-page-BliZ46WW.js} +3 -3
- package/dist/{add-new-language-page-B2BEmfil.cjs → add-new-language-page-IbMzbf4v.cjs} +1 -1
- package/dist/{add-new-page-DbEBB3w7.cjs → add-new-page-BJJqSKp0.cjs} +1 -1
- package/dist/{add-new-page-YZF_XF8X.js → add-new-page-DUCKfyWo.js} +2 -2
- package/dist/{ai-panel-content-Bf_ojKwt.cjs → ai-panel-content-DWOqjq3Z.cjs} +1 -1
- package/dist/{ai-panel-content-C8ecaQnv.js → ai-panel-content-GeQIaXy8.js} +3 -3
- package/dist/{ai-panel-default-lang-DokOmE_Q.cjs → ai-panel-default-lang-DGNDrfam.cjs} +2 -2
- package/dist/{ai-panel-default-lang-BC8Gq_jl.js → ai-panel-default-lang-VQsV6KB3.js} +3 -3
- package/dist/{ai-panel-other-lang-Ccx1t8pp.cjs → ai-panel-other-lang-DvXF0Nn5.cjs} +1 -1
- package/dist/{ai-panel-other-lang-BJ30SL7z.js → ai-panel-other-lang-SuC8jyfr.js} +3 -3
- package/dist/{ai-prompt-input-SfeB6a2j.js → ai-prompt-input-CB6iQAmE.js} +1 -1
- package/dist/{ai-prompt-input-ED14e6NE.cjs → ai-prompt-input-a8s-JrZb.cjs} +1 -1
- package/dist/{ai-translation-prompt-BRRzei71.js → ai-translation-prompt-CoNVDclG.js} +1 -1
- package/dist/{ai-translation-prompt-spS-OC6L.cjs → ai-translation-prompt-Qn1Sz4BI.cjs} +1 -1
- package/dist/change-password-modal-BtdsU0mm.cjs +1 -0
- package/dist/change-password-modal-CMEo8lEm.js +137 -0
- package/dist/{code-editor-CYiIxUKp.js → code-editor-CTMQr0aU.js} +1 -1
- package/dist/{code-editor-CIqswl5j.cjs → code-editor-CjatfjZe.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-B3CnmiZ2.cjs → continue-editing-in-this-client-7swLl0kq.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-vICoETHN.js → continue-editing-in-this-client-CNVJZvXQ.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.js +1 -1
- package/dist/{css-import-modal-DautOct0.js → css-import-modal-B3XY8Hzw.js} +1 -1
- package/dist/{css-import-modal-CHFZPXXQ.cjs → css-import-modal-D2RqE-V0.cjs} +1 -1
- package/dist/{delete-design-token-BmWHk_Ap.js → delete-design-token-DEyYFVHU.js} +1 -1
- package/dist/{delete-design-token-D-wGR5qS.cjs → delete-design-token-Dd3b86G7.cjs} +1 -1
- package/dist/{delete-page-Dlv8srng.js → delete-page-BSn5mRvk.js} +2 -2
- package/dist/{delete-page-D5mzl-ET.cjs → delete-page-BfsmsTek.cjs} +1 -1
- package/dist/{design-token-usage-DIszlgJK.cjs → design-token-usage-BY8meqAt.cjs} +1 -1
- package/dist/{design-token-usage-hl29qR_q.js → design-token-usage-f20BdlHE.js} +1 -1
- package/dist/{digital-asset-manager-v2LfDXwR.cjs → digital-asset-manager-Pi0YiB35.cjs} +1 -1
- package/dist/{digital-asset-manager-o_bNl9qj.js → digital-asset-manager-iXt27NlP.js} +3 -3
- package/dist/{duplicate-page-BjqgghN0.js → duplicate-page-BuVub6uY.js} +3 -3
- package/dist/{duplicate-page-CEuF8dll.cjs → duplicate-page-g5hiQkrZ.cjs} +1 -1
- package/dist/{dynamic-page-selector-BWC7kHJ1.js → dynamic-page-selector-NZ-rKLo3.js} +2 -2
- package/dist/{dynamic-page-selector-D4EWs4Qd.cjs → dynamic-page-selector-z6UGEjk1.cjs} +1 -1
- package/dist/{get-chai-builder-theme-DDVRJQ6Z.js → get-chai-builder-theme-CHXhAcdV.js} +1 -1
- package/dist/{get-chai-builder-theme-BApShjRz.cjs → get-chai-builder-theme-CMypjJk8.cjs} +1 -1
- package/dist/{image-editor-B1-bjvPd.js → image-editor--WT9183_.js} +1 -1
- package/dist/{image-editor-2h5axNuk.cjs → image-editor-C6cZZNbB.cjs} +1 -1
- package/dist/index-BGGNVIKx.cjs +5 -0
- package/dist/{index-DWGTiEak.cjs → index-CfsIhbT2.cjs} +11 -11
- package/dist/{index-BvluH-oT.js → index-ckjNCVor.js} +990 -978
- package/dist/{index-BN6yEl-H.js → index-iRqgNs2O.js} +897 -891
- package/dist/{json-diff-viewer-WX0GIjq-.js → json-diff-viewer-DAQ-qSHk.js} +2 -2
- package/dist/{json-diff-viewer-BjCIlzd7.cjs → json-diff-viewer-DheqS084.cjs} +1 -1
- package/dist/{lang-panel-C4x7bcyb.js → lang-panel-DRDPvY1i.js} +3 -3
- package/dist/{lang-panel--yfjRDE2.cjs → lang-panel-oLc-QyU4.cjs} +1 -1
- package/dist/{manage-design-tokens-DhdwhzQu.cjs → manage-design-tokens-Hu25ejcC.cjs} +1 -1
- package/dist/{manage-design-tokens-CRwsErkx.js → manage-design-tokens-rEzXQJRW.js} +2 -2
- package/dist/{mark-as-template-DpZSFrLK.js → mark-as-template-BNbn5zQG.js} +2 -2
- package/dist/{mark-as-template-BH0W9p2G.cjs → mark-as-template-DEThYoS6.cjs} +1 -1
- package/dist/{nested-path-selector-content-BDQmZzlf.js → nested-path-selector-content-BERhs6_L.js} +1 -1
- package/dist/{nested-path-selector-content-CHYz7cdB.cjs → nested-path-selector-content-Dz3-bNqT.cjs} +1 -1
- package/dist/{no-language-page-content-D0lcCseQ.js → no-language-page-content-CPVIz5rC.js} +2 -2
- package/dist/{no-language-page-content-D7btm8zX.cjs → no-language-page-content-CrUkIrUJ.cjs} +1 -1
- package/dist/{no-language-page-dialog-sYOmLnpY.cjs → no-language-page-dialog-964r8feg.cjs} +1 -1
- package/dist/{no-language-page-dialog-BdW7oXvt.js → no-language-page-dialog-DPDJ6gkQ.js} +2 -2
- package/dist/{page-creator-O_QpbMlB.js → page-creator-CDcfL4al.js} +3 -3
- package/dist/{page-creator-B-jBAGZl.cjs → page-creator-kvymje2i.cjs} +1 -1
- package/dist/{page-lock-CmQKpw1U.js → page-lock-BpUGSiCT.js} +2 -2
- package/dist/{page-lock-BrVqfmVm.cjs → page-lock-gOE-Tt7g.cjs} +1 -1
- package/dist/{page-locked-dialog-BjeJOXuN.js → page-locked-dialog-UQeYxWz1.js} +2 -2
- package/dist/{page-locked-dialog-ChHVSk7X.cjs → page-locked-dialog-aJFtoEzq.cjs} +1 -1
- package/dist/{page-manager-new-B90zLpRY.cjs → page-manager-new-DBomYOFT.cjs} +1 -1
- package/dist/{page-manager-new-wcsdorbd.js → page-manager-new-Dg02OZtc.js} +22 -22
- package/dist/{page-manager-search-and-filter-DY_NsetM.js → page-manager-search-and-filter-CCTh5gkC.js} +2 -2
- package/dist/{page-manager-search-and-filter-Bb_Zfpsj.cjs → page-manager-search-and-filter-pWHXOgMJ.cjs} +1 -1
- package/dist/{page-revisions-content-CVpi-467.cjs → page-revisions-content-BDY8RXJW.cjs} +1 -1
- package/dist/{page-revisions-content-5h39VYXj.js → page-revisions-content-C6YjUAx9.js} +7 -7
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +1 -0
- package/dist/pages.js +12 -12
- package/dist/plugin-DH3BDqys.js +251 -0
- package/dist/{plugin-BGlQf0iy.cjs → plugin-DO5QAuc1.cjs} +13 -13
- package/dist/{publish-pages-content-rrfvXks4.js → publish-pages-content-8MQN9iLc.js} +17 -17
- package/dist/{publish-pages-content-BG1GIuIz.cjs → publish-pages-content-DjUd9oWi.cjs} +1 -1
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +4 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-29WtCMJs.js → rte-widget-modal-Bj7lxFEs.js} +1 -1
- package/dist/{rte-widget-modal-JRoPPuju.cjs → rte-widget-modal-O31cHitM.cjs} +1 -1
- package/dist/{save-to-lib-Bm7R2K7j.js → save-to-lib-BMlowHNl.js} +2 -2
- package/dist/{save-to-lib-YvzDV5ee.cjs → save-to-lib-vxpiXsok.cjs} +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-bdClAekS.cjs → selected-block-display-BjhZTfSL.cjs} +1 -1
- package/dist/{selected-block-display-BAulh0Nz.js → selected-block-display-BxHTDLna.js} +2 -2
- package/dist/{seo-panel-CT0D3I44.js → seo-panel-197ULlty.js} +2 -2
- package/dist/{seo-panel-D9wnaLG-.cjs → seo-panel-MrGhioya.cjs} +1 -1
- package/dist/{shared-json-ld-ON6LaybZ.cjs → shared-json-ld-6ovlKZ7L.cjs} +1 -1
- package/dist/{shared-json-ld-CuhqVL8H.js → shared-json-ld-B2kfIim8.js} +24 -24
- package/dist/{slug-input-DNeh6LBv.js → slug-input-CSqTWSv8.js} +1 -1
- package/dist/{slug-input-CxmcQbTR.cjs → slug-input-CV-Dvosn.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.d.ts +34 -0
- package/dist/supabase-actions.js +231 -192
- package/dist/{take-over-request-CrILj_3q.cjs → take-over-request-BFZbLBOK.cjs} +1 -1
- package/dist/{take-over-request-BmeR6t3b.js → take-over-request-Ds_-1dOv.js} +2 -2
- package/dist/{theme-panel-footer-D4oCAY2G.js → theme-panel-footer-C1f2KMBq.js} +2 -2
- package/dist/{theme-panel-footer-BMx5lGB4.cjs → theme-panel-footer-dHh8VGgj.cjs} +1 -1
- package/dist/{translation-warning-modal-BNG9m-FC.js → translation-warning-modal-DPdVK3CD.js} +1 -1
- package/dist/{translation-warning-modal-ChL7oDO1.cjs → translation-warning-modal-HD8Mlj1e.cjs} +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/{unmark-as-template-BYiyJloZ.cjs → unmark-as-template-D8wEsu9z.cjs} +1 -1
- package/dist/{unmark-as-template-CEEMIY1A.js → unmark-as-template-DLVNotM_.js} +2 -2
- package/dist/{unpublish-page-B0aY1JnO.cjs → unpublish-page-Cl2R_dfN.cjs} +1 -1
- package/dist/{unpublish-page-Bm20P3TB.js → unpublish-page-ik9a66Rz.js} +2 -2
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +23 -22
- package/dist/{web-preview-iQgiotU6.cjs → web-preview-CE39XTw0.cjs} +1 -1
- package/dist/{web-preview-BtEn4Vc-.js → web-preview-ztlGD_Xm.js} +1 -1
- package/package.json +1 -1
- package/dist/index-BJVYKKJq.cjs +0 -5
- package/dist/plugin-C-ht41UZ.js +0 -245
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as b, Fragment as F, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { d as oe } from "./index-
|
|
3
|
-
import {
|
|
2
|
+
import { d as oe } from "./index-iRqgNs2O.js";
|
|
3
|
+
import { aB as ye, aC as ge, ap as ke, k as de, T as D, aR as Ne, L as we, m as ve, g as Se, c as Le, av as Te, aS as Ae, aT as X } from "./index-ckjNCVor.js";
|
|
4
4
|
import { u as J } from "./use-page-expand-manager-Cf4MUEJw.js";
|
|
5
5
|
import { compact as ue, filter as B, isEmpty as k, uniqBy as Ce, keyBy as me, mapValues as Ee, startCase as Me, toLower as M, includes as _, get as W, find as z, map as Ue } from "lodash-es";
|
|
6
6
|
import { atom as Ie, useAtom as $e, useSetAtom as ze } from "jotai";
|
|
7
7
|
import { ExternalLink as Be, Pencil as Fe, NotepadText as Oe, MoreHorizontal as je, Lock as Ge, Edit as Re, Plus as De, ChevronRight as We, StarsIcon as He, Hash as _e, File as he } from "lucide-react";
|
|
8
|
-
import { useRef as qe, useEffect as E, useMemo as H, useState as v, useCallback as ie, startTransition as
|
|
9
|
-
import { useTranslation as
|
|
8
|
+
import { useRef as qe, useEffect as E, useMemo as H, useState as v, useCallback as ie, startTransition as Ve, Suspense as C, lazy as U } from "react";
|
|
9
|
+
import { useTranslation as Qe } from "react-i18next";
|
|
10
10
|
import { B as Xe } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
11
11
|
const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
12
12
|
B(e, (r) => {
|
|
@@ -152,7 +152,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
152
152
|
const g = ye(), { pageToUser: d } = ge(), x = W(d, [e == null ? void 0 : e.id, "userId"]), { data: h } = ke(x), c = h && g !== x ? h == null ? void 0 : h.name : null, p = de(), N = r === e.id, q = !!e.isTemplate, P = H(() => z(s, { key: e.pageType }), [s, e.pageType]);
|
|
153
153
|
let u = W(o, e == null ? void 0 : e.id);
|
|
154
154
|
u = W(u, "lang") === a ? u : null;
|
|
155
|
-
const L = a === p || !!u,
|
|
155
|
+
const L = a === p || !!u, T = (u == null ? void 0 : u.name) || (e == null ? void 0 : e.name) || "No name";
|
|
156
156
|
let w = (u == null ? void 0 : u.slug) || (e == null ? void 0 : e.slug) || "";
|
|
157
157
|
const O = w + (e != null && e.dynamic ? `/${P == null ? void 0 : P.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
|
|
158
158
|
if (w.startsWith("/") && !f) {
|
|
@@ -180,7 +180,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
180
180
|
/* @__PURE__ */ t(tt, { page: e }),
|
|
181
181
|
!e.isPartialGroup && /* @__PURE__ */ t(st, { isOnline: u ? u.online : e.online }),
|
|
182
182
|
!e.isPartialGroup && /* @__PURE__ */ t(nt, { page: e, pageType: P }),
|
|
183
|
-
/* @__PURE__ */ t(D, { content:
|
|
183
|
+
/* @__PURE__ */ t(D, { content: T, side: "top", showTooltip: T.length > 35, children: /* @__PURE__ */ t("span", { className: "max-w-[40%] truncate font-medium text-black", children: T }) }),
|
|
184
184
|
(w || e.dynamic) && /* @__PURE__ */ t(D, { content: O, side: "top", showTooltip: !0, children: /* @__PURE__ */ b("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
|
|
185
185
|
w,
|
|
186
186
|
e.dynamic && (P == null ? void 0 : P.dynamicSlug) && /* @__PURE__ */ b("span", { className: "text-xs text-gray-500", children: [
|
|
@@ -271,8 +271,8 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
271
271
|
}
|
|
272
272
|
)
|
|
273
273
|
] }, x.id)) });
|
|
274
|
-
}, at = U(() => import("./page-manager-search-and-filter-
|
|
275
|
-
const { t: s } =
|
|
274
|
+
}, at = U(() => import("./page-manager-search-and-filter-CCTh5gkC.js")), lt = U(() => import("./add-new-page-DUCKfyWo.js")), ot = U(() => import("./delete-page-BSn5mRvk.js")), it = U(() => import("./duplicate-page-BuVub6uY.js")), ct = U(() => import("./mark-as-template-BNbn5zQG.js")), dt = U(() => import("./unmark-as-template-DLVNotM_.js")), ut = U(() => import("./unpublish-page-ik9a66Rz.js")), Nt = ({ close: e }) => {
|
|
275
|
+
const { t: s } = Qe(), { languages: r, setSelectedLang: n } = oe(), { data: o } = ve(), { data: a, isFetching: f } = Se(), [g, d] = Le(), { updateForSelectedPage: x, expandPagesOnSearch: h } = J(null), c = de(), p = g.get("page"), [N, q] = v(""), [P, u] = v(null), [L, T] = v(null), [w, O] = v(null), [j, G] = v(null), [i, I] = v(""), [K, Z] = v(null), [ee, te] = v(null), [y, V] = v(c), [pe, Pe] = v(!1), ne = ze(Te), R = pe && y !== c, { data: $, isFetching: be } = Ae(y), se = ie(
|
|
276
276
|
(m) => {
|
|
277
277
|
var l;
|
|
278
278
|
return (l = z(o, { key: m })) == null ? void 0 : l.hasSlug;
|
|
@@ -284,9 +284,9 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
284
284
|
}, [c, n]), E(() => {
|
|
285
285
|
const m = g.get("lang");
|
|
286
286
|
if (m) {
|
|
287
|
-
const l = r,
|
|
288
|
-
|
|
289
|
-
le && y !== m ?
|
|
287
|
+
const l = r, A = r[0] ?? c, le = l.includes(m);
|
|
288
|
+
Ve(() => {
|
|
289
|
+
le && y !== m ? V(m) : !le && y !== A && V(A);
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
292
|
}, []), E(() => {
|
|
@@ -297,8 +297,8 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
297
297
|
if (p && !f && !z(a, { id: p })) {
|
|
298
298
|
const l = z(a, { slug: "/" });
|
|
299
299
|
if (l) {
|
|
300
|
-
const
|
|
301
|
-
X(
|
|
300
|
+
const A = new URLSearchParams({ page: l.id });
|
|
301
|
+
X(A, d);
|
|
302
302
|
} else
|
|
303
303
|
X(new URLSearchParams({}), d, !0);
|
|
304
304
|
}
|
|
@@ -307,18 +307,18 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
307
307
|
}, [p, f, S, x]), E(() => {
|
|
308
308
|
!k(N) && !k(S) && h(S);
|
|
309
309
|
}, [N, S, h]);
|
|
310
|
-
const { setSelectedLang:
|
|
310
|
+
const { setSelectedLang: Q } = oe(), re = ie(
|
|
311
311
|
(m) => {
|
|
312
312
|
const l = new URLSearchParams({ page: m });
|
|
313
|
-
y !== c ? (l.set("lang", y),
|
|
313
|
+
y !== c ? (l.set("lang", y), Q(y)) : Q(""), X(l, d), e();
|
|
314
314
|
},
|
|
315
|
-
[e, d,
|
|
315
|
+
[e, d, Q, y, c]
|
|
316
316
|
), ae = (m, l) => {
|
|
317
|
-
var
|
|
317
|
+
var A;
|
|
318
318
|
if (l)
|
|
319
319
|
switch (m) {
|
|
320
320
|
case "add":
|
|
321
|
-
|
|
321
|
+
T(l);
|
|
322
322
|
break;
|
|
323
323
|
case "select":
|
|
324
324
|
re(l);
|
|
@@ -328,7 +328,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
328
328
|
edit: !0,
|
|
329
329
|
id: l == null ? void 0 : l.id,
|
|
330
330
|
primaryPage: l == null ? void 0 : l.primaryPage
|
|
331
|
-
}) :
|
|
331
|
+
}) : T(l);
|
|
332
332
|
break;
|
|
333
333
|
case "delete":
|
|
334
334
|
u(l);
|
|
@@ -348,7 +348,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
348
348
|
case "addLanguagePage":
|
|
349
349
|
ne({
|
|
350
350
|
edit: !1,
|
|
351
|
-
primaryPage: ((
|
|
351
|
+
primaryPage: ((A = l == null ? void 0 : l.page) == null ? void 0 : A.id) || "",
|
|
352
352
|
preselectedLang: (l == null ? void 0 : l.language) || y
|
|
353
353
|
});
|
|
354
354
|
break;
|
|
@@ -364,7 +364,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
364
364
|
setSearch: q,
|
|
365
365
|
languages: [c, ...r],
|
|
366
366
|
selectedLanguage: y,
|
|
367
|
-
setSelectedLanguage:
|
|
367
|
+
setSelectedLanguage: V,
|
|
368
368
|
selectedPageType: i,
|
|
369
369
|
setSelectedPageType: I,
|
|
370
370
|
onAddPage: (m) => ae("add", m),
|
|
@@ -396,7 +396,7 @@ const ce = (e, s) => !e || !Array.isArray(e) ? [] : k(s) ? e : ue(
|
|
|
396
396
|
closePanel: e,
|
|
397
397
|
editPage: re,
|
|
398
398
|
addEditPage: L,
|
|
399
|
-
setAddEditPage:
|
|
399
|
+
setAddEditPage: T
|
|
400
400
|
}
|
|
401
401
|
) }),
|
|
402
402
|
P && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(ot, { page: P, onClose: () => u(null) }) }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a, Fragment as k } from "react/jsx-runtime";
|
|
2
2
|
import { B as m, z as E } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
-
import { x as g, y as b, z as y, S as L, A as F, B as I, E as N } from "./index-
|
|
4
|
-
import { k as j, L as T, m as $, A as B } from "./index-
|
|
3
|
+
import { x as g, y as b, z as y, S as L, A as F, B as I, E as N } from "./index-iRqgNs2O.js";
|
|
4
|
+
import { k as j, L as T, m as $, A as B } from "./index-ckjNCVor.js";
|
|
5
5
|
import { u as G } from "./use-page-expand-manager-Cf4MUEJw.js";
|
|
6
6
|
import { useQueryClient as D } from "@tanstack/react-query";
|
|
7
7
|
import { isEmpty as w, filter as x, map as S, get as o } from "lodash-es";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DWTuRU53.cjs"),n=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DWTuRU53.cjs"),n=require("./index-CfsIhbT2.cjs"),f=require("./index-BGGNVIKx.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),C=require("@tanstack/react-query"),s=require("lodash-es"),d=require("lucide-react"),S=require("react"),g=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:i})=>{const{t:a}=g.useTranslation(),[r,o]=S.useState(""),{data:c}=f.usePageTypes(),u=t=>{if(!r)return!0;const x=r.toLowerCase(),m=j=>String(s.get(t,j,"")).toLowerCase().includes(x);return m("name")||m("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:i,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||a("All")}),e.jsx(d.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(d.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:a("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>o(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:a("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:a("No matching page types found")})]})]})},T=({search:l,setSearch:i})=>{const{t:a}=g.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:a("Search Pages")}),e.jsx(d.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:a("Search pages"),value:l,onChange:r=>i(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]})},E=({pages:l})=>{const{t:i}=g.useTranslation(),{expandAll:a,collapseAll:r,expandedPages:o}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>a(l),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:i("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:o.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:i("Collapse All")})]})]})},b=({languages:l,selectedLanguage:i,setSelectedLanguage:a})=>{const r=f.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(o=>e.jsxs(h.Button,{variant:i===o?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i===o?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>a(o.toLowerCase()),children:[o===r&&e.jsx(d.Star,{size:4,className:`p-0.5 ${i===r?"fill-white":"fill-black"}`}),f.LANGUAGES[o]||""]},o))})},y=()=>{const{t:l}=g.useTranslation(),i=C.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>i.invalidateQueries({queryKey:[f.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(d.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:i,setSearch:a,languages:r,onAddPage:o,selectedLanguage:c,setSelectedLanguage:u,selectedPageType:p,setSelectedPageType:t,showUntranslatedPages:x,setShowUntranslatedPages:m})=>{const{t:j}=g.useTranslation(),v=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:p,setSelectedPageType:t}),e.jsx(T,{search:i,setSearch:a}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:o,className:"rounded px-3 font-normal",children:[e.jsx(d.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:j("Add Page")})]}),!v&&e.jsx(y,{})]}),v?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(b,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{u(N),m(x&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>m(!x),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:x?e.jsx(d.FilterXIcon,{}):e.jsx(d.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:j("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=b;exports.default=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DWTuRU53.cjs"),i=require("./index-DWGTiEak.cjs"),c=require("./index-BJVYKKJq.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-BjCIlzd7.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.useChaiCurrentPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.useChaiCurrentPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:q,fallbackLang:P}=i.useLanguages(),U=q||P;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DWTuRU53.cjs"),i=require("./index-CfsIhbT2.cjs"),c=require("./index-BGGNVIKx.cjs"),y=require("@tanstack/react-query"),S=require("date-fns"),B=require("lodash-es"),f=require("lucide-react"),g=require("react");function L(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const w=L(g);function Q(s){const n=c.useApiUrl(),t=c.useFetch();return y.useQuery({queryKey:[c.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:c.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const z=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async r=>await n(s,{action:c.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=c.useApiUrl(),n=c.useFetch(),t=y.useQueryClient();return y.useMutation({mutationFn:async({revisionId:r,discardCurrent:l,pageId:d})=>await n(s,{action:c.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:r,discardCurrent:l,...d&&{pageId:d}}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=g.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-DheqS084.cjs"))),b=({tag:s})=>s==="draft"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(f.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(f.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=c.useChaiCurrentPage(),{saveState:r}=i.useSavePage(),[l]=c.usePageEditInfo();if(!t)return null;const d=!!s.find(x=>{var a;return(a=x==null?void 0:x.uid)==null?void 0:a.startsWith("draft:")}),u=s.length>=2&&!d,m=r==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(b,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!B.isEmpty(l.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",S.formatDistanceToNow(new Date(l.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(b,{tag:"unsaved"}):null})]}),e.jsx(O,{checked:d,disabled:u,onChange:()=>{n(d?s.filter(x=>x.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(i.Skeleton,{className:"h-4 w-3/4"}),e.jsx(i.Skeleton,{className:"h-3 w-1/2"}),e.jsx(i.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(i.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:r,revisionNumber:l,compare:d,setCompare:u,pageId:m}){const{data:x}=c.useChaiUserInfo(s.currentEditor),a=(x==null?void 0:x.name)||"Unknown",p=!!d.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),D=d.length>=2&&!p;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(b,{tag:n?"live":`#${l}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:a})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(b,{tag:"published"}):e.jsx(b,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:S.format(s.createdAt,"MMM d, yyyy, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(c.PermissionChecker,{permissions:[c.PAGES_PERMISSIONS.RESTORE_REVISION,c.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:r})})}),e.jsx(O,{checked:p,disabled:D,onChange:()=>{u(p?d.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...d,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${l}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function A({tab:s,onRemove:n}){return e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(b,{tag:s.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.uid),"aria-label":"Remove selection",children:e.jsx(f.X,{className:"h-3 w-3"})})]})}function W({compare:s,setCompare:n,pageId:t}){const[r,l]=g.useState(!1),[d,u]=s;if(s.length===0)return null;const m=x=>n(s.filter(a=>a.uid!==x));return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),d&&e.jsx(A,{tab:d,onRemove:m}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),u?e.jsx(A,{tab:u,onRemove:m}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(N.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>l(!0),disabled:s.length<2,children:[e.jsx(f.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),r&&(s==null?void 0:s.length)>1&&t&&e.jsx(g.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:r,onOpenChange:l,compare:s})})]})}function O({checked:s,disabled:n,onChange:t,label:r="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:r})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(i.DropdownMenu,{children:[e.jsx(i.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(N.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(f.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(i.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(i.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(c.PermissionChecker,{permission:c.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(i.DropdownMenuSeparator,{}),e.jsxs(i.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:r,isRestoring:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Restore Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>r(!1),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(N.Button,{variant:"default",className:"sm:flex-1",onClick:()=>r(!0),disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:r,isDeleting:l}){const{data:d}=c.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),u=(d==null?void 0:d.name)||"Unknown";return t?e.jsx(i.Dialog,{open:s,onOpenChange:m=>{l||n(m)},children:e.jsxs(i.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(i.DialogHeader,{children:[e.jsx(i.DialogTitle,{children:"Delete Revision"}),e.jsxs(i.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",S.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",u]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(i.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(N.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:l,children:"Cancel"}),e.jsx(N.Button,{variant:"destructive",className:"sm:flex-1",onClick:r,disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var R;const[n,t]=w.useState([]),[r,l]=w.useState(null),[d,u]=w.useState(!1),[m,x]=w.useState(!1),{data:a}=c.useChaiCurrentPage(),{data:p,isFetching:D,error:h,refetch:j}=Q(a==null?void 0:a.id),{mutate:T,isPending:M}=z(),{mutate:k,isPending:F}=H(),_=y.useQueryClient(),{selectedLang:q,fallbackLang:P}=i.useLanguages(),U=q||P;g.useEffect(()=>{g.startTransition(()=>t([]))},[a==null?void 0:a.id]);const G=o=>{r&&k({revisionId:r.uid,discardCurrent:o,...r.uid==="current"&&(a==null?void 0:a.id)&&{pageId:a.id}},{onSuccess:()=>{u(!1),l(null),_.invalidateQueries({queryKey:[c.ACTIONS.GET_DRAFT_PAGE]})}})},C=o=>{l(o),u(!0)},E=o=>{l(o),x(!0)},V=()=>{r&&T(r.uid,{onSuccess:()=>{x(!1),l(null)}})};return g.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(i.SheetHeader,{children:[e.jsx(i.SheetTitle,{children:"Revision History"}),(a==null?void 0:a.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",S.format(new Date(a.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),D?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:a==null?void 0:a.id}),e.jsx(J,{compare:n,setCompare:t}),(R=p==null?void 0:p.filter(o=>o.uid==="current"))==null?void 0:R.map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:!0,onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v,compare:n,setCompare:t},o.uid)),e.jsx(i.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:[...p??[]].filter(o=>o.uid!=="current").sort((o,v)=>new Date(v.createdAt).getTime()-new Date(o.createdAt).getTime()).map((o,v)=>e.jsx(I,{pageId:a==null?void 0:a.id,revision:o,isLatest:o.uid==="current",onRestore:()=>C(o),onDelete:()=>E(o),revisionNumber:v+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:d,onOpenChange:u,revision:r,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:x,revision:r,onDelete:V,isDeleting:M})]})}exports.default=ee;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { B as g } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
-
import { d as le, ab as re, ac as ie, a3 as de, ad as v, R as ce, D as G, e as j, f as q, g as L, p as
|
|
4
|
-
import { ar as C, as as A, A as y, aw as H,
|
|
3
|
+
import { d as le, ab as re, ac as ie, a3 as de, ad as v, R as ce, D as G, e as j, f as q, g as L, p as $, r as z, s as oe, t as ue, v as me, w as _, ae as he } from "./index-iRqgNs2O.js";
|
|
4
|
+
import { ar as C, as as A, A as y, aw as H, aA as fe, ap as I, ax as E, ay as D } from "./index-ckjNCVor.js";
|
|
5
5
|
import { useQuery as pe, useQueryClient as O, useMutation as J } from "@tanstack/react-query";
|
|
6
6
|
import { format as S, formatDistanceToNow as xe } from "date-fns";
|
|
7
7
|
import { isEmpty as ge } from "lodash-es";
|
|
@@ -50,7 +50,7 @@ const Ie = () => {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
}, Te = Ce(() => import("./json-diff-viewer-
|
|
53
|
+
}, Te = Ce(() => import("./json-diff-viewer-DAQ-qSHk.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
|
|
54
54
|
/* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
|
|
55
55
|
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
|
|
56
56
|
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
|
|
@@ -280,7 +280,7 @@ function Fe({
|
|
|
280
280
|
children: /* @__PURE__ */ a(j, { className: "sm:max-w-md", children: [
|
|
281
281
|
/* @__PURE__ */ a(q, { children: [
|
|
282
282
|
/* @__PURE__ */ e(L, { children: "Restore Revision" }),
|
|
283
|
-
/* @__PURE__ */ a(
|
|
283
|
+
/* @__PURE__ */ a($, { children: [
|
|
284
284
|
"You are about to restore to revision ",
|
|
285
285
|
n.uid.substring(0, 8),
|
|
286
286
|
" from",
|
|
@@ -291,7 +291,7 @@ function Fe({
|
|
|
291
291
|
] })
|
|
292
292
|
] }),
|
|
293
293
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "How would you like to handle your current edits?" }) }),
|
|
294
|
-
/* @__PURE__ */ a(
|
|
294
|
+
/* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
295
295
|
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
296
296
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
297
297
|
"Saving as draft..."
|
|
@@ -329,7 +329,7 @@ function Ve({
|
|
|
329
329
|
children: /* @__PURE__ */ a(j, { className: "sm:max-w-md", children: [
|
|
330
330
|
/* @__PURE__ */ a(q, { children: [
|
|
331
331
|
/* @__PURE__ */ e(L, { children: "Delete Revision" }),
|
|
332
|
-
/* @__PURE__ */ a(
|
|
332
|
+
/* @__PURE__ */ a($, { children: [
|
|
333
333
|
"You are about to delete revision ",
|
|
334
334
|
n.uid.substring(0, 8),
|
|
335
335
|
" from",
|
|
@@ -340,7 +340,7 @@ function Ve({
|
|
|
340
340
|
] })
|
|
341
341
|
] }),
|
|
342
342
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This action cannot be undone. Are you sure you want to proceed?" }) }),
|
|
343
|
-
/* @__PURE__ */ a(
|
|
343
|
+
/* @__PURE__ */ a(z, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
344
344
|
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: r, children: "Cancel" }),
|
|
345
345
|
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
346
346
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
package/dist/pages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BGGNVIKx.cjs");exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.SupabaseRealtimeAdapter=e.SupabaseRealtimeAdapter;exports.createRealtimeAdapter=e.createRealtimeAdapter;exports.useActivePage=e.useActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiCurrentPage=e.useChaiCurrentPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageTypes=e.usePageTypes;exports.useRealtimeAdapter=e.useRealtimeAdapter;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useUserRoleAndPermissions;exports.useWebsitePages=e.useWebsitePages;exports.useWebsiteSetting=e.useWebsiteSetting;
|
package/dist/pages.d.ts
CHANGED
package/dist/pages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aF as s, aU as t, aQ as u, aO as i, aP as r, ax as g, b1 as l, b2 as P, aV as h, ar as c, v as d, aL as n, a$ as o, aw as p, ap as b, aW as m, k as A, as as C, aX as U, l as k, m as F, a_ as L, aY as R, aZ as S, b0 as W, g as v, j as B } from "./index-ckjNCVor.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ChaiJsonInput,
|
|
4
4
|
t as ChaiWebsiteBuilder,
|
|
@@ -14,17 +14,17 @@ export {
|
|
|
14
14
|
n as useBuilderPageData,
|
|
15
15
|
o as useChaiAuth,
|
|
16
16
|
p as useChaiCurrentPage,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
b as useChaiUserInfo,
|
|
18
|
+
m as useClearAll,
|
|
19
|
+
A as useFallbackLang,
|
|
20
|
+
C as useFetch,
|
|
21
21
|
U as useGotoPage,
|
|
22
22
|
k as useLanguagePages,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
F as usePageTypes,
|
|
24
|
+
L as useRealtimeAdapter,
|
|
25
|
+
R as useReloadPage,
|
|
26
|
+
S as useUpdateActivePageMetadata,
|
|
27
|
+
W as useUserPermissions,
|
|
28
|
+
v as useWebsitePages,
|
|
29
|
+
B as useWebsiteSetting
|
|
30
30
|
};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { uniqBy as s, get as $, flatten as b, keys as v } from "lodash-es";
|
|
2
|
+
import { a as B } from "./fonts-DRly3Wzd.js";
|
|
3
|
+
import { g as _ } from "./_commonjsHelpers-C6fGbg64.js";
|
|
4
|
+
const x = {
|
|
5
|
+
fontFamily: {
|
|
6
|
+
"font-heading": "Inter",
|
|
7
|
+
"font-body": "Inter"
|
|
8
|
+
},
|
|
9
|
+
borderRadius: "10px",
|
|
10
|
+
colors: [
|
|
11
|
+
{
|
|
12
|
+
group: "Body",
|
|
13
|
+
items: {
|
|
14
|
+
background: ["#FFFFFF", "#121212"],
|
|
15
|
+
foreground: ["#121212", "#FFFFFF"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
group: "Primary",
|
|
20
|
+
items: {
|
|
21
|
+
primary: ["#2563EB", "#3B82F6"],
|
|
22
|
+
"primary-foreground": ["#FFFFFF", "#FFFFFF"]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
group: "Secondary",
|
|
27
|
+
items: {
|
|
28
|
+
secondary: ["#F3F4F6", "#374151"],
|
|
29
|
+
"secondary-foreground": ["#1F2937", "#F9FAFB"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
group: "Border, Input & Ring",
|
|
34
|
+
items: {
|
|
35
|
+
border: ["#E5E7EB", "#374151"],
|
|
36
|
+
input: ["#E5E7EB", "#374151"],
|
|
37
|
+
ring: ["#2563EB", "#3B82F6"]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
group: "Card",
|
|
42
|
+
items: {
|
|
43
|
+
card: ["#FFFFFF", "#1F2937"],
|
|
44
|
+
"card-foreground": ["#121212", "#FFFFFF"]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
group: "Popover",
|
|
49
|
+
items: {
|
|
50
|
+
popover: ["#FFFFFF", "#1F2937"],
|
|
51
|
+
"popover-foreground": ["#121212", "#FFFFFF"]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
group: "Muted",
|
|
56
|
+
items: {
|
|
57
|
+
muted: ["#F3F4F6", "#374151"],
|
|
58
|
+
"muted-foreground": ["#6B7280", "#9CA3AF"]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
group: "Accent",
|
|
63
|
+
items: {
|
|
64
|
+
accent: ["#F3F4F6", "#374151"],
|
|
65
|
+
"accent-foreground": ["#1F2937", "#FFFFFF"]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
group: "Destructive",
|
|
70
|
+
items: {
|
|
71
|
+
destructive: ["#DC2626", "#EF4444"],
|
|
72
|
+
"destructive-foreground": ["#FFFFFF", "#FFFFFF"]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}, I = {
|
|
77
|
+
fontFamily: {
|
|
78
|
+
heading: "Inter",
|
|
79
|
+
body: "Inter"
|
|
80
|
+
},
|
|
81
|
+
borderRadius: "6px",
|
|
82
|
+
colors: {
|
|
83
|
+
background: ["#FFFFFF", "#09090B"],
|
|
84
|
+
foreground: ["#09090B", "#FFFFFF"],
|
|
85
|
+
primary: ["#2563EB", "#3B82F6"],
|
|
86
|
+
"primary-foreground": ["#FFFFFF", "#FFFFFF"],
|
|
87
|
+
secondary: ["#F4F4F5", "#27272A"],
|
|
88
|
+
"secondary-foreground": ["#09090B", "#FFFFFF"],
|
|
89
|
+
muted: ["#F4F4F5", "#27272A"],
|
|
90
|
+
"muted-foreground": ["#71717A", "#A1A1AA"],
|
|
91
|
+
accent: ["#F4F4F5", "#27272A"],
|
|
92
|
+
"accent-foreground": ["#09090B", "#FFFFFF"],
|
|
93
|
+
destructive: ["#EF4444", "#7F1D1D"],
|
|
94
|
+
"destructive-foreground": ["#FFFFFF", "#FFFFFF"],
|
|
95
|
+
border: ["#E4E4E7", "#27272A"],
|
|
96
|
+
input: ["#E4E4E7", "#27272A"],
|
|
97
|
+
ring: ["#2563EB", "#3B82F6"],
|
|
98
|
+
card: ["#FFFFFF", "#09090B"],
|
|
99
|
+
"card-foreground": ["#09090B", "#FFFFFF"],
|
|
100
|
+
popover: ["#FFFFFF", "#09090B"],
|
|
101
|
+
"popover-foreground": ["#09090B", "#FFFFFF"]
|
|
102
|
+
}
|
|
103
|
+
}, q = (e) => ({
|
|
104
|
+
fontFamily: e.fontFamily ? v(e.fontFamily).reduce(
|
|
105
|
+
(r, t) => ({
|
|
106
|
+
...r,
|
|
107
|
+
[t.replace("font-", "")]: `var(--${t})`
|
|
108
|
+
}),
|
|
109
|
+
{}
|
|
110
|
+
) : {},
|
|
111
|
+
borderRadius: e.borderRadius ? {
|
|
112
|
+
lg: "var(--radius)",
|
|
113
|
+
md: "calc(var(--radius) - 2px)",
|
|
114
|
+
sm: "calc(var(--radius) - 4px)"
|
|
115
|
+
} : {},
|
|
116
|
+
colors: e.colors ? b(e.colors.map((r) => Object.entries(r.items))).reduce(
|
|
117
|
+
(r, [t]) => ({ ...r, [t]: `hsl(var(--${t}))` }),
|
|
118
|
+
{}
|
|
119
|
+
) : {}
|
|
120
|
+
});
|
|
121
|
+
function m(e) {
|
|
122
|
+
const F = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
|
|
123
|
+
let r = parseInt(F[1], 16), t = parseInt(F[2], 16), n = parseInt(F[3], 16);
|
|
124
|
+
r /= 255, t /= 255, n /= 255;
|
|
125
|
+
const o = Math.max(r, t, n), a = Math.min(r, t, n);
|
|
126
|
+
let u = 0, d = 0;
|
|
127
|
+
const g = (o + a) / 2;
|
|
128
|
+
if (o == a)
|
|
129
|
+
u = d = 0;
|
|
130
|
+
else {
|
|
131
|
+
const i = o - a;
|
|
132
|
+
switch (d = g > 0.5 ? i / (2 - o - a) : i / (o + a), o) {
|
|
133
|
+
case r:
|
|
134
|
+
u = (t - n) / i + (t < n ? 6 : 0);
|
|
135
|
+
break;
|
|
136
|
+
case t:
|
|
137
|
+
u = (n - r) / i + 2;
|
|
138
|
+
break;
|
|
139
|
+
case n:
|
|
140
|
+
u = (r - t) / i + 4;
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
u /= 6;
|
|
144
|
+
}
|
|
145
|
+
return `${Math.round(u * 360)} ${Math.round(d * 100)}% ${Math.round(g * 100)}%`;
|
|
146
|
+
}
|
|
147
|
+
const E = (e) => {
|
|
148
|
+
const r = B().find((t) => t.family === e);
|
|
149
|
+
return `"${e}", ${$(r, "fallback", "")}`;
|
|
150
|
+
}, O = ({
|
|
151
|
+
theme: e,
|
|
152
|
+
fontVariables: F = !1
|
|
153
|
+
}) => {
|
|
154
|
+
const r = e;
|
|
155
|
+
return `:root {
|
|
156
|
+
${F && e.fontFamily ? Object.entries(e.fontFamily).map(([t, n]) => `--font-${t}: ${E(n)};`).join(`
|
|
157
|
+
`) : ""}
|
|
158
|
+
${r.borderRadius ? `--radius: ${r.borderRadius};` : ""}
|
|
159
|
+
${r.colors ? Object.entries(r.colors).map(([t, n]) => `--${t}: ${m(n[0])};`).join(`
|
|
160
|
+
`) : ""}
|
|
161
|
+
}
|
|
162
|
+
.dark {
|
|
163
|
+
${r.colors ? Object.entries(r.colors).map(([t, n]) => `--${t}: ${m(n[1])};`).join(`
|
|
164
|
+
`) : ""}
|
|
165
|
+
}`;
|
|
166
|
+
}, S = (e) => !e || e.length === 0 ? "" : s(e, "family").map((F) => `<link rel="stylesheet" href="${F.url}" />`).join(`
|
|
167
|
+
`), T = (e) => !e || e.length === 0 ? [] : s(e, "family").map((F) => F.url), D = (e) => !e || e.length === 0 ? "" : s(e, "family").map((F) => `@import url("${F.url}");`).join(`
|
|
168
|
+
`), w = (e) => !e || e.length === 0 ? "" : s(e, "family").map(
|
|
169
|
+
(F) => F.src.map(
|
|
170
|
+
(r) => `@font-face {
|
|
171
|
+
font-family: "${F.family}";
|
|
172
|
+
src: url("${r.url}") format("${r.format}");
|
|
173
|
+
font-display: swap;
|
|
174
|
+
${r.fontWeight ? `font-weight: ${r.fontWeight};` : ""}
|
|
175
|
+
${r.fontStyle ? `font-style: ${r.fontStyle};` : ""}
|
|
176
|
+
${r.fontStretch ? `font-stretch: ${r.fontStretch};` : ""}
|
|
177
|
+
}`
|
|
178
|
+
).join(`
|
|
179
|
+
`)
|
|
180
|
+
).join(`
|
|
181
|
+
`);
|
|
182
|
+
var l = {}, c = {}, p;
|
|
183
|
+
function P() {
|
|
184
|
+
return p || (p = 1, (function(e) {
|
|
185
|
+
Object.defineProperty(e, "__esModule", {
|
|
186
|
+
value: !0
|
|
187
|
+
}), Object.defineProperty(e, "default", {
|
|
188
|
+
enumerable: !0,
|
|
189
|
+
get: function() {
|
|
190
|
+
return r;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
function F(t, n) {
|
|
194
|
+
return {
|
|
195
|
+
handler: t,
|
|
196
|
+
config: n
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
F.withOptions = function(t, n = () => ({})) {
|
|
200
|
+
const o = function(a) {
|
|
201
|
+
return {
|
|
202
|
+
__options: a,
|
|
203
|
+
handler: t(a),
|
|
204
|
+
config: n(a)
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
return o.__isOptionsFunction = !0, o.__pluginFunction = t, o.__configFunction = n, o;
|
|
208
|
+
};
|
|
209
|
+
const r = F;
|
|
210
|
+
})(c)), c;
|
|
211
|
+
}
|
|
212
|
+
var y;
|
|
213
|
+
function A() {
|
|
214
|
+
return y || (y = 1, (function(e) {
|
|
215
|
+
Object.defineProperty(e, "__esModule", {
|
|
216
|
+
value: !0
|
|
217
|
+
}), Object.defineProperty(e, "default", {
|
|
218
|
+
enumerable: !0,
|
|
219
|
+
get: function() {
|
|
220
|
+
return t;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
const F = /* @__PURE__ */ r(P());
|
|
224
|
+
function r(n) {
|
|
225
|
+
return n && n.__esModule ? n : {
|
|
226
|
+
default: n
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
const t = F.default;
|
|
230
|
+
})(l)), l;
|
|
231
|
+
}
|
|
232
|
+
var f, h;
|
|
233
|
+
function j() {
|
|
234
|
+
if (h) return f;
|
|
235
|
+
h = 1;
|
|
236
|
+
let e = A();
|
|
237
|
+
return f = (e.__esModule ? e : { default: e }).default, f;
|
|
238
|
+
}
|
|
239
|
+
var C = j();
|
|
240
|
+
const L = /* @__PURE__ */ _(C);
|
|
241
|
+
export {
|
|
242
|
+
O as a,
|
|
243
|
+
D as b,
|
|
244
|
+
S as c,
|
|
245
|
+
x as d,
|
|
246
|
+
I as e,
|
|
247
|
+
T as f,
|
|
248
|
+
q as g,
|
|
249
|
+
w as h,
|
|
250
|
+
L as p
|
|
251
|
+
};
|