@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
import { jsx as s, jsxs as n, Fragment as Le } from "react/jsx-runtime";
|
|
2
|
+
import { isEmpty as Fe, pick as Ke, find as De, set as P } from "lodash-es";
|
|
3
|
+
import { ChevronDown as te, Search as re, Check as O } from "lucide-react";
|
|
4
|
+
import { useState as f, useRef as Xe, useEffect as Pe, useMemo as q } from "react";
|
|
5
|
+
import { toast as E } from "sonner";
|
|
6
|
+
import { z as Q, h as $e, B as $ } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
7
|
+
import { j as Ee, p as I, Q as oe, R as ie, P as ce, C as ue, k as me, l as Y, m as B, Y as es, d as ss } from "./index-DPV6NiJ-.js";
|
|
8
|
+
import { r as ee, S as ls, c as je } from "./slug-input-DQ4t3-Tt.js";
|
|
9
|
+
import { h as ns, ak as as, b as ts, c as rs, d as os, at as is, L as cs } from "./index-DqzFD1CG.js";
|
|
10
|
+
import { g as We } from "./get-seo-defaults-9zHebckY.js";
|
|
11
|
+
function us({
|
|
12
|
+
value: l,
|
|
13
|
+
onChange: p,
|
|
14
|
+
placeholder: b = "Enter custom slug part",
|
|
15
|
+
dynamicPattern: h,
|
|
16
|
+
onValidationChange: o
|
|
17
|
+
}) {
|
|
18
|
+
const [d, i] = f(null), u = Xe(null), [D, j] = f(h + l);
|
|
19
|
+
Pe(() => {
|
|
20
|
+
j(h + l);
|
|
21
|
+
}, [l, h]);
|
|
22
|
+
const z = (y) => {
|
|
23
|
+
const v = y.target.value;
|
|
24
|
+
if (!v.startsWith(h)) {
|
|
25
|
+
const F = v.replace(h, ""), R = h + F;
|
|
26
|
+
j(R), p(F);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const c = v.substring(h.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), a = (c.match(/\./g) || []).length, m = a <= 1;
|
|
30
|
+
a > 1 ? i("Invalid slug. Only one dot (.) is allowed in the slug") : i(null), o && o(m);
|
|
31
|
+
const g = h + c;
|
|
32
|
+
j(g), p(c);
|
|
33
|
+
}, W = () => {
|
|
34
|
+
if (u.current) {
|
|
35
|
+
const y = u.current;
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
const v = h.length;
|
|
38
|
+
y.setSelectionRange(v, v);
|
|
39
|
+
}, 0);
|
|
40
|
+
}
|
|
41
|
+
}, G = (y) => {
|
|
42
|
+
const v = y.currentTarget;
|
|
43
|
+
(v.selectionStart || 0) <= h.length && setTimeout(() => {
|
|
44
|
+
const c = h.length;
|
|
45
|
+
v.setSelectionRange(c, c);
|
|
46
|
+
}, 0);
|
|
47
|
+
};
|
|
48
|
+
return /* @__PURE__ */ s("div", { children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
49
|
+
/* @__PURE__ */ n("p", { className: "mb-2 text-xs text-gray-500", children: [
|
|
50
|
+
`${h}`,
|
|
51
|
+
" is a dynamic segment of slug"
|
|
52
|
+
] }),
|
|
53
|
+
/* @__PURE__ */ s(
|
|
54
|
+
Q,
|
|
55
|
+
{
|
|
56
|
+
ref: u,
|
|
57
|
+
value: D,
|
|
58
|
+
onChange: z,
|
|
59
|
+
onFocus: W,
|
|
60
|
+
onClick: G,
|
|
61
|
+
placeholder: b,
|
|
62
|
+
className: d ? "border-red-500" : ""
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
d && /* @__PURE__ */ s("div", { className: "mt-1 text-xs text-red-500", children: d })
|
|
66
|
+
] }) });
|
|
67
|
+
}
|
|
68
|
+
const he = ({ children: l, onWheel: p, ...b }) => /* @__PURE__ */ s(Ee, { ...b, onWheel: (o) => {
|
|
69
|
+
try {
|
|
70
|
+
o.preventDefault();
|
|
71
|
+
const d = o.currentTarget;
|
|
72
|
+
d.scrollTop += o.deltaY;
|
|
73
|
+
} catch {
|
|
74
|
+
o.preventDefault();
|
|
75
|
+
}
|
|
76
|
+
p && p(o);
|
|
77
|
+
}, children: l }), ae = (...l) => l.filter(Boolean).join(" ");
|
|
78
|
+
function ms({
|
|
79
|
+
pages: l,
|
|
80
|
+
selectedParentId: p,
|
|
81
|
+
onChange: b,
|
|
82
|
+
className: h,
|
|
83
|
+
id: o = "parentPage",
|
|
84
|
+
currentPage: d
|
|
85
|
+
}) {
|
|
86
|
+
const [i, u] = f(!1), [D, j] = f(""), z = $e("enable-add-page-dropdown");
|
|
87
|
+
z || (h = "w-full rounded-md border border-gray-300 px-3 py-2");
|
|
88
|
+
const W = q(() => !l || l.length === 0 ? [] : l.filter((m) => !Fe(m.slug)).filter((m) => m.slug !== "/").sort((m, g) => m.slug.localeCompare(g.slug)), [l]), G = q(() => {
|
|
89
|
+
if (!D.trim()) return W;
|
|
90
|
+
const a = D.toLowerCase();
|
|
91
|
+
return W.filter(
|
|
92
|
+
(m) => m.name.toLowerCase().includes(a) || m.slug.toLowerCase().includes(a)
|
|
93
|
+
);
|
|
94
|
+
}, [W, D]), y = (a) => Math.max(0, (a.match(/\//g) || []).length - 1), v = (a) => " ".repeat(a), T = (a) => {
|
|
95
|
+
if (a === "/") return "/";
|
|
96
|
+
const m = a.split("/").filter(Boolean);
|
|
97
|
+
if (m.length <= 1) {
|
|
98
|
+
const g = m[0] || "";
|
|
99
|
+
return `/${ee(g)}`;
|
|
100
|
+
}
|
|
101
|
+
return `/${ee(m[m.length - 1])}`;
|
|
102
|
+
}, c = () => {
|
|
103
|
+
if (!p || p === "none") return "None";
|
|
104
|
+
const a = W.find((m) => m.id === p);
|
|
105
|
+
return a ? `${a.name} (${T(a.slug)})` : "None";
|
|
106
|
+
};
|
|
107
|
+
return /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
108
|
+
/* @__PURE__ */ s(I, { htmlFor: o, className: "text-sm", children: "Parent" }),
|
|
109
|
+
z ? /* @__PURE__ */ n(oe, { open: i, onOpenChange: u, children: [
|
|
110
|
+
/* @__PURE__ */ s(ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
111
|
+
$,
|
|
112
|
+
{
|
|
113
|
+
id: o,
|
|
114
|
+
variant: "outline",
|
|
115
|
+
role: "combobox",
|
|
116
|
+
className: ae("w-full justify-between", h),
|
|
117
|
+
"data-testid": "parent-page-selector",
|
|
118
|
+
children: [
|
|
119
|
+
c(),
|
|
120
|
+
/* @__PURE__ */ s(te, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
) }),
|
|
124
|
+
/* @__PURE__ */ s(ce, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ue, { shouldFilter: !1, children: [
|
|
125
|
+
/* @__PURE__ */ s("div", { className: "relative border-none py-2", children: /* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
126
|
+
/* @__PURE__ */ s(re, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
127
|
+
/* @__PURE__ */ s(
|
|
128
|
+
Q,
|
|
129
|
+
{
|
|
130
|
+
placeholder: "Search pages...",
|
|
131
|
+
className: "h-8 pl-8 text-xs",
|
|
132
|
+
value: D,
|
|
133
|
+
onChange: (a) => j(a.target.value)
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] }) }) }),
|
|
137
|
+
/* @__PURE__ */ n(he, { className: "max-h-[300px] overflow-y-auto", children: [
|
|
138
|
+
/* @__PURE__ */ s(me, { children: "No pages found." }),
|
|
139
|
+
/* @__PURE__ */ n(Y, { children: [
|
|
140
|
+
/* @__PURE__ */ n(
|
|
141
|
+
B,
|
|
142
|
+
{
|
|
143
|
+
value: "none",
|
|
144
|
+
onSelect: () => {
|
|
145
|
+
b(""), u(!1), j("");
|
|
146
|
+
},
|
|
147
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
148
|
+
children: [
|
|
149
|
+
/* @__PURE__ */ s("span", { children: "None" }),
|
|
150
|
+
/* @__PURE__ */ s(O, { className: ae("mr-2 h-4 w-4", p ? "opacity-0" : "opacity-100") })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
G.map((a) => {
|
|
155
|
+
const m = v(y(a.slug)), g = T(a.slug), F = /* @__PURE__ */ n("span", { className: "flex items-center text-sm", children: [
|
|
156
|
+
m,
|
|
157
|
+
a.name,
|
|
158
|
+
/* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
159
|
+
" (",
|
|
160
|
+
g,
|
|
161
|
+
")"
|
|
162
|
+
] })
|
|
163
|
+
] });
|
|
164
|
+
return /* @__PURE__ */ n(
|
|
165
|
+
B,
|
|
166
|
+
{
|
|
167
|
+
value: a.id,
|
|
168
|
+
onSelect: () => {
|
|
169
|
+
b(a.id), u(!1), j("");
|
|
170
|
+
},
|
|
171
|
+
className: "flex cursor-pointer items-center justify-between whitespace-pre-wrap",
|
|
172
|
+
children: [
|
|
173
|
+
/* @__PURE__ */ s("span", { children: F }),
|
|
174
|
+
/* @__PURE__ */ s(
|
|
175
|
+
O,
|
|
176
|
+
{
|
|
177
|
+
className: ae(
|
|
178
|
+
"mr-2 h-4 w-4 shrink-0",
|
|
179
|
+
p === a.id ? "opacity-100" : "opacity-0"
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
},
|
|
185
|
+
a.id
|
|
186
|
+
);
|
|
187
|
+
})
|
|
188
|
+
] })
|
|
189
|
+
] })
|
|
190
|
+
] }) })
|
|
191
|
+
] }) : /* @__PURE__ */ n(
|
|
192
|
+
"select",
|
|
193
|
+
{
|
|
194
|
+
id: o,
|
|
195
|
+
value: p || "none",
|
|
196
|
+
onChange: (a) => b(a.target.value),
|
|
197
|
+
className: h,
|
|
198
|
+
"data-testid": "parent-page-selector",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ s("option", { value: "none", children: "None" }),
|
|
201
|
+
W.map((a) => {
|
|
202
|
+
const m = y(a.slug), g = m > 0 ? v(m) : "", F = T(a.slug);
|
|
203
|
+
return (d == null ? void 0 : d.id) && (d.id === a.id || a.slug.startsWith(d.slug + "/")) ? null : /* @__PURE__ */ n("option", { value: a.id, children: [
|
|
204
|
+
g,
|
|
205
|
+
a.name,
|
|
206
|
+
" (",
|
|
207
|
+
F,
|
|
208
|
+
")"
|
|
209
|
+
] }, a.id);
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
const A = (...l) => l.filter(Boolean).join(" ");
|
|
217
|
+
function bs({ addEditPage: l, close: p, closePanel: b }) {
|
|
218
|
+
var Ce, ke;
|
|
219
|
+
const { data: h } = ns(), o = q(() => h ?? [], [h]), d = as(), i = !!(l != null && l.id), { data: u } = ts(), { mutate: D, isPending: j } = rs(), { mutate: z, isPending: W } = os(), [G, y] = f(null), [v, T] = f(!0), [c, a] = f((l == null ? void 0 : l.pageType) ?? "page"), { hasPermission: m } = es(), g = m(is.CHANGE_PAGE_TYPE), [F, R] = f(!1), [ze, Te] = f(""), { selectedLang: Re, fallbackLang: Ue } = ss(), pe = Re || Ue, [M, J] = f(""), [ge, H] = f(!1), fe = q(() => {
|
|
220
|
+
const e = o.find((r) => r.key === c);
|
|
221
|
+
return (e == null ? void 0 : e.hasSlug) === !1;
|
|
222
|
+
}, [c, o]), [S, Ve] = f((l == null ? void 0 : l.parent) ?? ""), [U, de] = f((l == null ? void 0 : l.name) ?? ""), [w, ye] = f((l == null ? void 0 : l.dynamic) ?? !1), [C, Z] = f(w ? "" : ((l == null ? void 0 : l.slug) ?? "").split("/").pop() || ""), [ve, Ne] = f((l == null ? void 0 : l.dynamicSlugCustom) ?? ""), [Se, Ae] = f(!0), [Ie, se] = f(!1), _ = j || W, xe = $e("enable-add-page-dropdown"), le = q(() => !i || !(l != null && l.id) || !u ? null : u.find((e) => e.id === l.id), [i, l == null ? void 0 : l.id, u]), Oe = (le == null ? void 0 : le.online) || !1, qe = q(() => !i || !(l != null && l.id) || !u ? !1 : u.some((e) => e.parent === l.id), [i, l == null ? void 0 : l.id, u]), t = o.find((e) => e.key === c), V = (e) => {
|
|
223
|
+
if (i && c !== e) {
|
|
224
|
+
Te(e), R(!0), J(""), H(!1);
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
a(e), J(""), H(!1);
|
|
228
|
+
}, be = () => {
|
|
229
|
+
a(ze), R(!1), ye(!1);
|
|
230
|
+
}, Be = (e) => {
|
|
231
|
+
ye(e), e ? Z("") : Ne("");
|
|
232
|
+
}, Ge = (e) => {
|
|
233
|
+
if (Ve(e), e && e !== "none") {
|
|
234
|
+
const r = u == null ? void 0 : u.find((N) => N.id === e), k = (r == null ? void 0 : r.slug) || "";
|
|
235
|
+
if (C.startsWith(k)) {
|
|
236
|
+
const N = C.slice(k.length).replace(/^\/+/, "");
|
|
237
|
+
Z(N);
|
|
238
|
+
} else
|
|
239
|
+
Z(C.replace(/^\/+/, ""));
|
|
240
|
+
} else
|
|
241
|
+
Z(C ? `${C}` : "");
|
|
242
|
+
}, Me = () => U.trim() ? w && !Fe(C) ? (y("Slug must be empty when using dynamic slug"), !1) : w && !Se ? (y("Dynamic slug is invalid"), !1) : !0 : (E.error("Name is required"), !1), _e = () => {
|
|
243
|
+
const e = {
|
|
244
|
+
pageType: t == null ? void 0 : t.key,
|
|
245
|
+
name: U,
|
|
246
|
+
slug: "",
|
|
247
|
+
hasSlug: !1
|
|
248
|
+
};
|
|
249
|
+
i ? z(
|
|
250
|
+
{ id: l == null ? void 0 : l.id, name: U },
|
|
251
|
+
{
|
|
252
|
+
onSuccess: () => {
|
|
253
|
+
E.success((t == null ? void 0 : t.name) + " updated successfully"), p();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
) : D(e, {
|
|
257
|
+
onSuccess: (r) => {
|
|
258
|
+
p(), d(r.page.id, b);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}, Ye = (e, r) => {
|
|
262
|
+
if (!e.trim() && !w)
|
|
263
|
+
return y("Child page slug is required"), !1;
|
|
264
|
+
const k = ee(r), N = je(k, e);
|
|
265
|
+
return Object.keys(cs).some((X) => N === `/${X}` || (N == null ? void 0 : N.startsWith(`/${X}/`))) ? (y("Slugs cannot start with a language code for primary page"), !1) : !0;
|
|
266
|
+
}, Qe = (e, r) => {
|
|
267
|
+
const k = ee(r), N = je(k, e), x = {
|
|
268
|
+
pageType: c,
|
|
269
|
+
name: U,
|
|
270
|
+
slug: N.replace(/\/$/, ""),
|
|
271
|
+
// remove trailing slashes
|
|
272
|
+
parent: S,
|
|
273
|
+
dynamic: w,
|
|
274
|
+
hasSlug: !0,
|
|
275
|
+
template: void 0,
|
|
276
|
+
tracking: {},
|
|
277
|
+
seo: {},
|
|
278
|
+
jsonLD: {}
|
|
279
|
+
};
|
|
280
|
+
if (w && (x.dynamicSlugCustom = ve), i) {
|
|
281
|
+
const L = Ke(x, ["pageType", "parent", "name", "slug", "dynamic", "dynamicSlugCustom"]);
|
|
282
|
+
z(
|
|
283
|
+
{ id: l == null ? void 0 : l.id, ...L },
|
|
284
|
+
{
|
|
285
|
+
onSuccess: () => {
|
|
286
|
+
E.success("Page updated successfully"), p();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
);
|
|
290
|
+
} else {
|
|
291
|
+
const L = De(o, { key: c });
|
|
292
|
+
L != null && L.trackingDefault && (x.tracking = L.trackingDefault);
|
|
293
|
+
const { seo: X, jsonLD: Ze } = We(L, pe);
|
|
294
|
+
P(x, "seo", X), P(x, "jsonLD", Ze), D(x, {
|
|
295
|
+
onSuccess: (Je) => {
|
|
296
|
+
p(), d(Je.page.id, b);
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}, He = () => {
|
|
301
|
+
const e = {
|
|
302
|
+
pageType: c,
|
|
303
|
+
name: U,
|
|
304
|
+
slug: C === "" ? "/" : `/${C.replace(/\/$/, "")}`,
|
|
305
|
+
template: void 0,
|
|
306
|
+
parent: null,
|
|
307
|
+
tracking: {}
|
|
308
|
+
};
|
|
309
|
+
if (i)
|
|
310
|
+
z(
|
|
311
|
+
{ id: l == null ? void 0 : l.id, ...e },
|
|
312
|
+
{
|
|
313
|
+
onSuccess: () => {
|
|
314
|
+
E.success("Page updated successfully"), p();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
else {
|
|
319
|
+
const r = De(o, { key: c });
|
|
320
|
+
r != null && r.trackingDefault && (e.tracking = r.trackingDefault);
|
|
321
|
+
const { seo: k, jsonLD: N } = We(r, pe);
|
|
322
|
+
P(e, "seo", k), P(e, "jsonLD", N), D(e, {
|
|
323
|
+
onSuccess: (x) => {
|
|
324
|
+
var L;
|
|
325
|
+
(L = x == null ? void 0 : x.page) != null && L.id && d(x.page.id, b), p();
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
}, we = (e) => {
|
|
330
|
+
if (e.preventDefault(), y(null), !!Me()) {
|
|
331
|
+
if (!(t != null && t.hasSlug)) {
|
|
332
|
+
_e();
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (S && S !== "none") {
|
|
336
|
+
const r = u == null ? void 0 : u.find((N) => N.id === S), k = (r == null ? void 0 : r.slug) || "";
|
|
337
|
+
if (!Ye(C, k))
|
|
338
|
+
return;
|
|
339
|
+
Qe(C, k);
|
|
340
|
+
} else
|
|
341
|
+
He();
|
|
342
|
+
}
|
|
343
|
+
}, { pagesType: ne, partialsType: K } = q(() => {
|
|
344
|
+
const e = (r) => M ? r.name.toLowerCase().includes(M.toLowerCase()) || r.key.toLowerCase().includes(M.toLowerCase()) : !0;
|
|
345
|
+
return {
|
|
346
|
+
pagesType: o.filter((r) => r.hasSlug !== !1 && e(r)),
|
|
347
|
+
partialsType: o.filter((r) => r.hasSlug === !1 && e(r))
|
|
348
|
+
};
|
|
349
|
+
}, [o, M]);
|
|
350
|
+
return t != null && t.hasSlug ? /* @__PURE__ */ n("form", { onSubmit: we, className: "mx-auto w-full max-w-md space-y-4", children: [
|
|
351
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
352
|
+
/* @__PURE__ */ s(I, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
|
|
353
|
+
xe ? /* @__PURE__ */ n(oe, { open: ge, onOpenChange: H, children: [
|
|
354
|
+
/* @__PURE__ */ s(ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
355
|
+
$,
|
|
356
|
+
{
|
|
357
|
+
variant: "outline",
|
|
358
|
+
role: "combobox",
|
|
359
|
+
disabled: i && !g,
|
|
360
|
+
className: A(
|
|
361
|
+
"w-full justify-between",
|
|
362
|
+
i && !g ? "cursor-not-allowed text-gray-500" : ""
|
|
363
|
+
),
|
|
364
|
+
children: [
|
|
365
|
+
(t == null ? void 0 : t.name) || "Select page type",
|
|
366
|
+
/* @__PURE__ */ s(te, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
) }),
|
|
370
|
+
/* @__PURE__ */ s(ce, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ue, { shouldFilter: !1, children: [
|
|
371
|
+
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
372
|
+
/* @__PURE__ */ s(re, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
373
|
+
/* @__PURE__ */ s(
|
|
374
|
+
Q,
|
|
375
|
+
{
|
|
376
|
+
placeholder: "Search page types...",
|
|
377
|
+
className: "h-8 pl-8 text-xs",
|
|
378
|
+
value: M,
|
|
379
|
+
onChange: (e) => J(e.target.value)
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }) }),
|
|
383
|
+
/* @__PURE__ */ n(he, { className: "overflow-y-auto", children: [
|
|
384
|
+
/* @__PURE__ */ s(me, { children: "No page type found." }),
|
|
385
|
+
i ? fe ? /* @__PURE__ */ s(Y, { heading: "Partials", children: K.map((e) => /* @__PURE__ */ n(
|
|
386
|
+
B,
|
|
387
|
+
{
|
|
388
|
+
value: e.key,
|
|
389
|
+
onSelect: () => V(e.key),
|
|
390
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
391
|
+
children: [
|
|
392
|
+
e.name,
|
|
393
|
+
/* @__PURE__ */ s(
|
|
394
|
+
O,
|
|
395
|
+
{
|
|
396
|
+
className: A("mr-2 h-4 w-4", c === e.key ? "opacity-100" : "opacity-0")
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
]
|
|
400
|
+
},
|
|
401
|
+
e.key
|
|
402
|
+
)) }) : /* @__PURE__ */ s(Y, { heading: "Pages", children: ne.map((e) => /* @__PURE__ */ n(
|
|
403
|
+
B,
|
|
404
|
+
{
|
|
405
|
+
value: e.key,
|
|
406
|
+
onSelect: () => V(e.key),
|
|
407
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
408
|
+
children: [
|
|
409
|
+
e.name,
|
|
410
|
+
/* @__PURE__ */ s(
|
|
411
|
+
O,
|
|
412
|
+
{
|
|
413
|
+
className: A("mr-2 h-4 w-4", c === e.key ? "opacity-100" : "opacity-0")
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
e.key
|
|
419
|
+
)) }) : /* @__PURE__ */ n(Le, { children: [
|
|
420
|
+
ne.length > 0 && /* @__PURE__ */ s(Y, { heading: "Pages", children: ne.map((e) => /* @__PURE__ */ n(
|
|
421
|
+
B,
|
|
422
|
+
{
|
|
423
|
+
value: e.key,
|
|
424
|
+
onSelect: () => V(e.key),
|
|
425
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
426
|
+
children: [
|
|
427
|
+
e.name,
|
|
428
|
+
/* @__PURE__ */ s(
|
|
429
|
+
O,
|
|
430
|
+
{
|
|
431
|
+
className: A("mr-2 h-4 w-4", c === e.key ? "opacity-100" : "opacity-0")
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
e.key
|
|
437
|
+
)) }),
|
|
438
|
+
K.length > 0 && /* @__PURE__ */ s(Y, { heading: "Partials", children: K.map((e) => /* @__PURE__ */ n(
|
|
439
|
+
B,
|
|
440
|
+
{
|
|
441
|
+
value: e.key,
|
|
442
|
+
onSelect: () => V(e.key),
|
|
443
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
444
|
+
children: [
|
|
445
|
+
e.name,
|
|
446
|
+
/* @__PURE__ */ s(
|
|
447
|
+
O,
|
|
448
|
+
{
|
|
449
|
+
className: A("mr-2 h-4 w-4", c === e.key ? "opacity-100" : "opacity-0")
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
e.key
|
|
455
|
+
)) })
|
|
456
|
+
] })
|
|
457
|
+
] })
|
|
458
|
+
] }) })
|
|
459
|
+
] }) : /* @__PURE__ */ s(
|
|
460
|
+
"select",
|
|
461
|
+
{
|
|
462
|
+
id: "pageType",
|
|
463
|
+
value: c,
|
|
464
|
+
disabled: i && !g,
|
|
465
|
+
onChange: (e) => V(e.target.value),
|
|
466
|
+
className: `w-full rounded-md border border-gray-300 px-3 py-2 ${i && !g ? "cursor-not-allowed text-gray-500" : ""}`,
|
|
467
|
+
children: i ? fe ? /* @__PURE__ */ s("optgroup", { label: "Partials", children: o.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ s("optgroup", { label: "Pages", children: o.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ n(Le, { children: [
|
|
468
|
+
/* @__PURE__ */ s("optgroup", { label: "Pages", children: o.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }),
|
|
469
|
+
/* @__PURE__ */ s("optgroup", { label: "Partials", children: o.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
|
|
470
|
+
] })
|
|
471
|
+
}
|
|
472
|
+
),
|
|
473
|
+
F && /* @__PURE__ */ n("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
|
|
474
|
+
/* @__PURE__ */ s("p", { className: "text-sm text-yellow-800", children: "Changing the page type may impact the page data. Are you sure you want to proceed?" }),
|
|
475
|
+
/* @__PURE__ */ n("div", { className: "mt-2 flex gap-2", children: [
|
|
476
|
+
/* @__PURE__ */ s($, { variant: "outline", size: "sm", onClick: () => R(!1), children: "Cancel" }),
|
|
477
|
+
/* @__PURE__ */ s($, { variant: "default", size: "sm", onClick: be, children: "Confirm" })
|
|
478
|
+
] })
|
|
479
|
+
] })
|
|
480
|
+
] }),
|
|
481
|
+
/* @__PURE__ */ s(
|
|
482
|
+
ms,
|
|
483
|
+
{
|
|
484
|
+
pages: u,
|
|
485
|
+
selectedParentId: S,
|
|
486
|
+
onChange: Ge,
|
|
487
|
+
currentPage: l
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
491
|
+
/* @__PURE__ */ s(I, { htmlFor: "name", className: "text-sm", children: "Name" }),
|
|
492
|
+
/* @__PURE__ */ s(
|
|
493
|
+
Q,
|
|
494
|
+
{
|
|
495
|
+
id: "name",
|
|
496
|
+
value: U,
|
|
497
|
+
onChange: (e) => de(e.target.value),
|
|
498
|
+
required: !0,
|
|
499
|
+
"aria-required": "true",
|
|
500
|
+
placeholder: "Enter page name"
|
|
501
|
+
}
|
|
502
|
+
)
|
|
503
|
+
] }),
|
|
504
|
+
(t == null ? void 0 : t.dynamicSegments) && S && S !== "none" && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
505
|
+
/* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
|
|
506
|
+
/* @__PURE__ */ s(
|
|
507
|
+
"input",
|
|
508
|
+
{
|
|
509
|
+
type: "checkbox",
|
|
510
|
+
id: "useDynamicSlug",
|
|
511
|
+
checked: w,
|
|
512
|
+
onChange: (e) => Be(e.target.checked),
|
|
513
|
+
className: "rounded border-gray-300"
|
|
514
|
+
}
|
|
515
|
+
),
|
|
516
|
+
/* @__PURE__ */ s(I, { htmlFor: "useDynamicSlug", className: "text-sm", children: "Use Dynamic Slug" })
|
|
517
|
+
] }),
|
|
518
|
+
w && /* @__PURE__ */ s("div", { className: "space-y-2", children: /* @__PURE__ */ s("div", { className: "space-y-0.5", children: /* @__PURE__ */ s(
|
|
519
|
+
us,
|
|
520
|
+
{
|
|
521
|
+
value: ve,
|
|
522
|
+
onChange: Ne,
|
|
523
|
+
dynamicPattern: (t == null ? void 0 : t.dynamicSlug) || "{{id}}",
|
|
524
|
+
placeholder: "Enter custom slug part (optional)",
|
|
525
|
+
onValidationChange: Ae
|
|
526
|
+
}
|
|
527
|
+
) }) })
|
|
528
|
+
] }),
|
|
529
|
+
(!(t != null && t.dynamicSegments) || !w) && /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
530
|
+
/* @__PURE__ */ s(I, { htmlFor: "slug", className: "text-sm", children: "Slug" }),
|
|
531
|
+
/* @__PURE__ */ s(
|
|
532
|
+
ls,
|
|
533
|
+
{
|
|
534
|
+
value: C,
|
|
535
|
+
onChange: (e) => {
|
|
536
|
+
var r;
|
|
537
|
+
Z(e), i && e !== (((r = l == null ? void 0 : l.slug) == null ? void 0 : r.split("/").pop()) || "") ? se(!!(Oe || qe)) : se(!1);
|
|
538
|
+
},
|
|
539
|
+
placeholder: S && S !== "none" ? "Enter page slug" : c === "page" ? "Leave empty for home page" : "Required - e.g. your-slug",
|
|
540
|
+
parentSlug: S && S !== "none" ? (ke = u == null ? void 0 : u.find((e) => e.id === S)) == null ? void 0 : ke.slug : void 0,
|
|
541
|
+
onValidationChange: T
|
|
542
|
+
}
|
|
543
|
+
),
|
|
544
|
+
G && /* @__PURE__ */ s("p", { className: "text-xs text-red-500", children: G }),
|
|
545
|
+
Ie && /* @__PURE__ */ s("div", { className: "mt-4 rounded-md border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */ n("div", { className: "flex items-start space-x-2", children: [
|
|
546
|
+
/* @__PURE__ */ s("div", { className: "flex-shrink-0", children: /* @__PURE__ */ s("svg", { className: "h-5 w-5 text-amber-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s(
|
|
547
|
+
"path",
|
|
548
|
+
{
|
|
549
|
+
fillRule: "evenodd",
|
|
550
|
+
d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",
|
|
551
|
+
clipRule: "evenodd"
|
|
552
|
+
}
|
|
553
|
+
) }) }),
|
|
554
|
+
/* @__PURE__ */ n("div", { className: "flex-1", children: [
|
|
555
|
+
/* @__PURE__ */ s("h3", { className: "text-sm font-medium text-amber-800", children: "Slug Change Warning" }),
|
|
556
|
+
/* @__PURE__ */ s("div", { className: "mt-1 text-sm text-amber-700", children: /* @__PURE__ */ s("p", { children: "The previous URL and any child pages will become inaccessible. You may want to set up a redirect to avoid broken links." }) })
|
|
557
|
+
] })
|
|
558
|
+
] }) })
|
|
559
|
+
] }),
|
|
560
|
+
/* @__PURE__ */ s(
|
|
561
|
+
$,
|
|
562
|
+
{
|
|
563
|
+
disabled: _ || // Disable if regular slug is invalid and we're not using dynamic slug
|
|
564
|
+
!v && (!(t != null && t.dynamicSegments) || !w) || // Disable if dynamic slug is invalid and we are using dynamic slug
|
|
565
|
+
w && !Se,
|
|
566
|
+
type: "submit",
|
|
567
|
+
className: "w-full",
|
|
568
|
+
children: i ? _ ? "Updating..." : "Update page" : _ ? "Creating..." : "Create Page"
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] }) : /* @__PURE__ */ n("form", { onSubmit: we, className: "mx-auto w-full max-w-md space-y-4", children: [
|
|
572
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
573
|
+
/* @__PURE__ */ s(I, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
|
|
574
|
+
xe ? /* @__PURE__ */ n(oe, { open: ge, onOpenChange: H, children: [
|
|
575
|
+
/* @__PURE__ */ s(ie, { asChild: !0, children: /* @__PURE__ */ n(
|
|
576
|
+
$,
|
|
577
|
+
{
|
|
578
|
+
variant: "outline",
|
|
579
|
+
role: "combobox",
|
|
580
|
+
disabled: i && !g,
|
|
581
|
+
className: A(
|
|
582
|
+
"w-full justify-between",
|
|
583
|
+
i && !g ? "cursor-not-allowed text-gray-500" : ""
|
|
584
|
+
),
|
|
585
|
+
children: [
|
|
586
|
+
(t == null ? void 0 : t.name) || "Select page type",
|
|
587
|
+
/* @__PURE__ */ s(te, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
) }),
|
|
591
|
+
/* @__PURE__ */ s(ce, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ue, { shouldFilter: !1, children: [
|
|
592
|
+
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
593
|
+
/* @__PURE__ */ s(re, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
594
|
+
/* @__PURE__ */ s(
|
|
595
|
+
Q,
|
|
596
|
+
{
|
|
597
|
+
placeholder: "Search page types...",
|
|
598
|
+
className: "h-8 pl-8 text-xs",
|
|
599
|
+
value: M,
|
|
600
|
+
onChange: (e) => J(e.target.value)
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
] }) }),
|
|
604
|
+
/* @__PURE__ */ n(he, { className: "max-h-[200px] overflow-y-auto", children: [
|
|
605
|
+
/* @__PURE__ */ s(me, { children: "No page type found." }),
|
|
606
|
+
/* @__PURE__ */ s(Y, { heading: "Partials", children: K.map((e) => /* @__PURE__ */ n(
|
|
607
|
+
B,
|
|
608
|
+
{
|
|
609
|
+
value: e.key,
|
|
610
|
+
onSelect: () => {
|
|
611
|
+
V(e.key), H(!1);
|
|
612
|
+
},
|
|
613
|
+
className: "flex cursor-pointer items-center justify-between",
|
|
614
|
+
children: [
|
|
615
|
+
e.name,
|
|
616
|
+
/* @__PURE__ */ s(O, { className: A("mr-2 h-4 w-4", c === e.key ? "opacity-100" : "opacity-0") })
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
e.key
|
|
620
|
+
)) })
|
|
621
|
+
] })
|
|
622
|
+
] }) })
|
|
623
|
+
] }) : /* @__PURE__ */ s(
|
|
624
|
+
"select",
|
|
625
|
+
{
|
|
626
|
+
id: "pageType",
|
|
627
|
+
value: c,
|
|
628
|
+
disabled: i && !g,
|
|
629
|
+
onChange: (e) => V(e.target.value),
|
|
630
|
+
className: `w-full rounded-md border border-gray-300 px-3 py-2 ${i && !g ? "cursor-not-allowed text-gray-500" : ""}`,
|
|
631
|
+
children: /* @__PURE__ */ s("optgroup", { label: "Partials", children: o.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
|
|
632
|
+
}
|
|
633
|
+
),
|
|
634
|
+
F && /* @__PURE__ */ n("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
|
|
635
|
+
/* @__PURE__ */ s("p", { className: "text-sm text-yellow-800", children: "Changing the page type may impact the page data. Are you sure you want to proceed?" }),
|
|
636
|
+
/* @__PURE__ */ n("div", { className: "mt-2 flex gap-2", children: [
|
|
637
|
+
/* @__PURE__ */ s($, { variant: "outline", size: "sm", onClick: () => R(!1), children: "Cancel" }),
|
|
638
|
+
/* @__PURE__ */ s($, { variant: "default", size: "sm", onClick: be, children: "Confirm" })
|
|
639
|
+
] })
|
|
640
|
+
] }),
|
|
641
|
+
/* @__PURE__ */ s("p", { className: "text-xs text-gray-500", children: (Ce = o.find((e) => e.key === c)) == null ? void 0 : Ce.helpText })
|
|
642
|
+
] }),
|
|
643
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
644
|
+
/* @__PURE__ */ s(I, { htmlFor: "name", className: "text-sm", children: "Name" }),
|
|
645
|
+
/* @__PURE__ */ s(Q, { id: "name", value: U, onChange: (e) => de(e.target.value), required: !0, "aria-required": "true" })
|
|
646
|
+
] }),
|
|
647
|
+
/* @__PURE__ */ s($, { disabled: _, type: "submit", className: "w-full", children: i ? _ ? "Updating..." : "Update " + (t == null ? void 0 : t.name) : _ ? "Creating..." : "Create " + (t == null ? void 0 : t.name) })
|
|
648
|
+
] });
|
|
649
|
+
}
|
|
650
|
+
export {
|
|
651
|
+
bs as default
|
|
652
|
+
};
|