@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.50
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 +0 -5
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-DRvGNTLs.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-DqIyZppU.js} +2 -2
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BWwvxG86.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DlUIW-7z.js} +1 -1
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-N7kNyI7H.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-SsaVMSIa.js} +2 -2
- package/dist/{active-in-another-tab-B4Ur0JP7.js → active-in-another-tab-3S4Tzg0v.js} +1 -1
- package/dist/{active-in-another-tab-BPdx4lWh.cjs → active-in-another-tab-C83x4jHw.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-BnPnQ-3A.js} +1 -1
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-QIaeQ_fJ.cjs} +1 -1
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-Ddoy3kTu.cjs} +1 -1
- package/dist/{add-new-page-Ppy5-y5j.js → add-new-page-aLHfIIHC.js} +1 -1
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BOCTOIH_.js} +3 -3
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-FNeOfRkj.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang-C2j7qGZx.js} +3 -3
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-DgRzCQGx.cjs} +1 -1
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-SJnya_UU.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-p5KHwgCW.js} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BTEXWPQq.js} +1 -1
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-Dhh-bNJr.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-BkBFwrxi.js} +1 -1
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-BwBRdCeD.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BrSvK-Ay.js → continue-editing-in-this-client-DTmWmAee.js} +1 -1
- package/dist/{continue-editing-in-this-client-Cmi-GkYZ.cjs → continue-editing-in-this-client-DgtsPYZ4.cjs} +1 -1
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-BNZclrjF.cjs} +1 -1
- package/dist/{delete-page-C99K2qzS.js → delete-page-BYh290jY.js} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-BINMP8H4.js} +1 -1
- package/dist/{digital-asset-manager-Z5aJxkq0.cjs → digital-asset-manager-DnNRvKt8.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-B_j9rgxU.js} +1 -1
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-DgxKd840.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-B2HE4wRM.js} +1 -1
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-CDuWB_Yw.cjs} +1 -1
- package/dist/{index-BVwFJWDq.cjs → index-CzBSRTj0.cjs} +3 -3
- package/dist/{index-LBTm1Jmk.js → index-nzqILA37.js} +17 -17
- package/dist/{json-diff-viewer-Cb1CmRqP.cjs → json-diff-viewer-3C7leKFH.cjs} +1 -1
- package/dist/{json-diff-viewer-DG6qMOBS.js → json-diff-viewer-CMw5W_Li.js} +1 -1
- package/dist/{lang-panel-DxoJ0v4y.cjs → lang-panel-DIdkbjDj.cjs} +1 -1
- package/dist/{lang-panel-B3USOxGq.js → lang-panel-S3dD5t_t.js} +2 -2
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-6kAFYYpY.cjs} +1 -1
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-BP6ltrws.js} +1 -1
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-HjxRSjI0.cjs} +1 -1
- package/dist/{no-language-page-content-D8t5dfgh.js → no-language-page-content-MPJjIXir.js} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-CoRH5H9v.cjs} +1 -1
- package/dist/{no-language-page-dialog-C_fHI2zI.js → no-language-page-dialog-D06JM3cU.js} +2 -2
- package/dist/{page-creator-DKEkuGCO.js → page-creator-Cu6i7LZ1.js} +134 -134
- package/dist/page-creator-QCmVlpyE.cjs +1 -0
- package/dist/{page-lock-DdCvtA-I.cjs → page-lock-D5BkmYCP.cjs} +1 -1
- package/dist/{page-lock-CwZKJ4IE.js → page-lock-csXU_vk5.js} +2 -2
- package/dist/{page-locked-dialog-CrTDBoC4.cjs → page-locked-dialog-BfmE52P5.cjs} +1 -1
- package/dist/{page-locked-dialog-DqLlooUz.js → page-locked-dialog-o9eCXo2g.js} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-CwYu8Am_.js} +2 -2
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-KUeOWmce.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-D7AupT6_.cjs → page-manager-search-and-filter-BE7w_2hv.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-bsqZ6wnI.js → page-manager-search-and-filter-BwxrJZgv.js} +1 -1
- package/dist/{page-revisions-content-C5O8_Fms.js → page-revisions-content-DmXFnqRE.js} +2 -2
- package/dist/{page-revisions-content-B6hsIla7.cjs → page-revisions-content-qIljNtcN.cjs} +1 -1
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-BmaVd0qz.js} +2 -2
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-gMEMzV-_.cjs} +1 -1
- package/dist/{save-to-lib-DMnv7ENo.js → save-to-lib-CPqQG37K.js} +1 -1
- package/dist/{save-to-lib-Dc700Aop.cjs → save-to-lib-DMPQDhKe.cjs} +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-C7iOI7Wd.js} +1 -1
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-CSYAaqzP.cjs} +1 -1
- package/dist/{seo-panel-CMY-adM-.cjs → seo-panel-CgDo_uDs.cjs} +1 -1
- package/dist/{seo-panel-Br8gxDxu.js → seo-panel-DUVBUbG3.js} +1 -1
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-Clk0cKIp.cjs} +1 -1
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-nS_mdAYR.js} +1 -1
- package/dist/{take-over-request-KdR1_h_K.js → take-over-request-Bjyi22us.js} +1 -1
- package/dist/{take-over-request-IRLgF1dG.cjs → take-over-request-GdscXVYh.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-BStQtwjr.js} +1 -1
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-D_-Bbbl_.cjs} +1 -1
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-CGZWa57H.cjs} +1 -1
- package/dist/{unpublish-page-0fR1o0b7.js → unpublish-page-Dsqk_IA1.js} +1 -1
- package/dist/{web-preview-D9pXonAv.js → web-preview-_TrLPhaZ.js} +1 -1
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-e2NMKzzH.cjs} +1 -1
- package/package.json +1 -1
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as n, Fragment as We } from "react/jsx-runtime";
|
|
2
2
|
import { z as Y, h as ye, B as W } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { j as os, p as z, X as ee, Y as se, P as
|
|
3
|
+
import { j as os, p as z, X as ee, Y as se, P as ae, C as ne, k as le, l as G, m as I, ax as cs, d as us } from "./index-OuHV9Ann.js";
|
|
4
4
|
import { useState as y, useRef as ms, useEffect as ze, useMemo as B, startTransition as Oe } from "react";
|
|
5
5
|
import { r as te, S as hs, c as Be } from "./slug-input-DLWTMTsO.js";
|
|
6
6
|
import { isEmpty as Ie, startCase as de, filter as ps, find as ge, groupBy as ds, pick as fs, set as P } from "lodash-es";
|
|
7
7
|
import { ChevronDown as re, Search as ie, Check as R } from "lucide-react";
|
|
8
|
-
import { aq as Re, ar as Ue, A as oe, k as gs, as as ys, e as vs, f as Ns, g as Ss, ax as bs, L as xs } from "./index-
|
|
8
|
+
import { aq as Re, ar as Ue, A as oe, k as gs, as as ys, e as vs, f as Ns, g as Ss, ax as bs, L as xs } from "./index-nzqILA37.js";
|
|
9
9
|
import { useQuery as qe } from "@tanstack/react-query";
|
|
10
10
|
import { toast as E } from "sonner";
|
|
11
11
|
import { g as $e } from "./get-seo-defaults-9zHebckY.js";
|
|
12
12
|
function ws({
|
|
13
|
-
value:
|
|
13
|
+
value: a,
|
|
14
14
|
onChange: o,
|
|
15
15
|
placeholder: v = "Enter custom slug part",
|
|
16
16
|
dynamicPattern: p,
|
|
17
17
|
onValidationChange: i
|
|
18
18
|
}) {
|
|
19
|
-
const [g, u] = y(null), m = ms(null), [f, C] = y(p +
|
|
19
|
+
const [g, u] = y(null), m = ms(null), [f, C] = y(p + a);
|
|
20
20
|
ze(() => {
|
|
21
|
-
C(p +
|
|
22
|
-
}, [
|
|
21
|
+
C(p + a);
|
|
22
|
+
}, [a, p]);
|
|
23
23
|
const F = (S) => {
|
|
24
24
|
const b = S.target.value;
|
|
25
25
|
if (!b.startsWith(p)) {
|
|
@@ -27,8 +27,8 @@ function ws({
|
|
|
27
27
|
C(U), o(O);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
const t = b.substring(p.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(),
|
|
31
|
-
|
|
30
|
+
const t = b.substring(p.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), l = (t.match(/\./g) || []).length, d = l <= 1;
|
|
31
|
+
l > 1 ? u("Invalid slug. Only one dot (.) is allowed in the slug") : u(null), i && i(d);
|
|
32
32
|
const N = p + t;
|
|
33
33
|
C(N), o(t);
|
|
34
34
|
}, x = () => {
|
|
@@ -46,8 +46,8 @@ function ws({
|
|
|
46
46
|
b.setSelectionRange(t, t);
|
|
47
47
|
}, 0);
|
|
48
48
|
};
|
|
49
|
-
return /* @__PURE__ */ s("div", { children: /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ s("div", { children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
50
|
+
/* @__PURE__ */ n("p", { className: "mb-2 text-xs text-gray-500", children: [
|
|
51
51
|
`${p}`,
|
|
52
52
|
" is a dynamic segment of slug"
|
|
53
53
|
] }),
|
|
@@ -66,7 +66,7 @@ function ws({
|
|
|
66
66
|
g && /* @__PURE__ */ s("div", { className: "mt-1 text-xs text-red-500", children: g })
|
|
67
67
|
] }) });
|
|
68
68
|
}
|
|
69
|
-
const ce = ({ children:
|
|
69
|
+
const ce = ({ children: a, onWheel: o, ...v }) => /* @__PURE__ */ s(os, { ...v, onWheel: (i) => {
|
|
70
70
|
try {
|
|
71
71
|
i.preventDefault();
|
|
72
72
|
const g = i.currentTarget;
|
|
@@ -75,9 +75,9 @@ const ce = ({ children: l, onWheel: o, ...v }) => /* @__PURE__ */ s(os, { ...v,
|
|
|
75
75
|
i.preventDefault();
|
|
76
76
|
}
|
|
77
77
|
o && o(i);
|
|
78
|
-
}, children:
|
|
78
|
+
}, children: a }), fe = (...a) => a.filter(Boolean).join(" ");
|
|
79
79
|
function Cs({
|
|
80
|
-
pages:
|
|
80
|
+
pages: a,
|
|
81
81
|
selectedParentId: o,
|
|
82
82
|
onChange: v,
|
|
83
83
|
className: p,
|
|
@@ -86,15 +86,15 @@ function Cs({
|
|
|
86
86
|
}) {
|
|
87
87
|
const [u, m] = y(!1), [f, C] = y(""), F = ye("enable-add-page-dropdown");
|
|
88
88
|
F || (p = "w-full rounded-md border border-gray-300 px-3 py-2");
|
|
89
|
-
const x = B(() => !
|
|
89
|
+
const x = B(() => !a || a.length === 0 ? [] : a.filter((d) => !Ie(d.slug)).filter((d) => d.slug !== "/").sort((d, N) => d.slug.localeCompare(N.slug)), [a]), $ = B(() => {
|
|
90
90
|
if (!f.trim()) return x;
|
|
91
|
-
const
|
|
91
|
+
const l = f.toLowerCase();
|
|
92
92
|
return x.filter(
|
|
93
|
-
(d) => d.name.toLowerCase().includes(
|
|
93
|
+
(d) => d.name.toLowerCase().includes(l) || d.slug.toLowerCase().includes(l)
|
|
94
94
|
);
|
|
95
|
-
}, [x, f]), S = (
|
|
96
|
-
if (
|
|
97
|
-
const d =
|
|
95
|
+
}, [x, f]), S = (l) => Math.max(0, (l.match(/\//g) || []).length - 1), b = (l) => " ".repeat(l), h = (l) => {
|
|
96
|
+
if (l === "/") return "/";
|
|
97
|
+
const d = l.split("/").filter(Boolean);
|
|
98
98
|
if (d.length <= 1) {
|
|
99
99
|
const N = d[0] || "";
|
|
100
100
|
return `/${te(N)}`;
|
|
@@ -102,13 +102,13 @@ function Cs({
|
|
|
102
102
|
return `/${te(d[d.length - 1])}`;
|
|
103
103
|
}, t = () => {
|
|
104
104
|
if (!o || o === "none") return "None";
|
|
105
|
-
const
|
|
106
|
-
return
|
|
105
|
+
const l = x.find((d) => d.id === o);
|
|
106
|
+
return l ? `${l.name} (${h(l.slug)})` : "None";
|
|
107
107
|
};
|
|
108
|
-
return /* @__PURE__ */
|
|
108
|
+
return /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
109
109
|
/* @__PURE__ */ s(z, { htmlFor: i, className: "text-sm", children: "Parent" }),
|
|
110
|
-
F ? /* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */
|
|
110
|
+
F ? /* @__PURE__ */ n(ee, { open: u, onOpenChange: m, children: [
|
|
111
|
+
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ n(
|
|
112
112
|
W,
|
|
113
113
|
{
|
|
114
114
|
id: i,
|
|
@@ -122,8 +122,8 @@ function Cs({
|
|
|
122
122
|
]
|
|
123
123
|
}
|
|
124
124
|
) }),
|
|
125
|
-
/* @__PURE__ */ s(
|
|
126
|
-
/* @__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__ */
|
|
125
|
+
/* @__PURE__ */ s(ae, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ne, { shouldFilter: !1, children: [
|
|
126
|
+
/* @__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: [
|
|
127
127
|
/* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
128
128
|
/* @__PURE__ */ s(
|
|
129
129
|
Y,
|
|
@@ -131,14 +131,14 @@ function Cs({
|
|
|
131
131
|
placeholder: "Search pages...",
|
|
132
132
|
className: "h-8 pl-8 text-xs",
|
|
133
133
|
value: f,
|
|
134
|
-
onChange: (
|
|
134
|
+
onChange: (l) => C(l.target.value)
|
|
135
135
|
}
|
|
136
136
|
)
|
|
137
137
|
] }) }) }),
|
|
138
|
-
/* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */ s(
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ n(ce, { className: "max-h-[300px] overflow-y-auto", children: [
|
|
139
|
+
/* @__PURE__ */ s(le, { children: "No pages found." }),
|
|
140
|
+
/* @__PURE__ */ n(G, { children: [
|
|
141
|
+
/* @__PURE__ */ n(
|
|
142
142
|
I,
|
|
143
143
|
{
|
|
144
144
|
value: "none",
|
|
@@ -152,22 +152,22 @@ function Cs({
|
|
|
152
152
|
]
|
|
153
153
|
}
|
|
154
154
|
),
|
|
155
|
-
$.map((
|
|
156
|
-
const d = b(S(
|
|
155
|
+
$.map((l) => {
|
|
156
|
+
const d = b(S(l.slug)), N = h(l.slug), O = /* @__PURE__ */ n("span", { className: "flex items-center text-sm", children: [
|
|
157
157
|
d,
|
|
158
|
-
|
|
159
|
-
/* @__PURE__ */
|
|
158
|
+
l.name,
|
|
159
|
+
/* @__PURE__ */ n("span", { className: "text-xs text-gray-500", children: [
|
|
160
160
|
" (",
|
|
161
161
|
N,
|
|
162
162
|
")"
|
|
163
163
|
] })
|
|
164
164
|
] });
|
|
165
|
-
return /* @__PURE__ */
|
|
165
|
+
return /* @__PURE__ */ n(
|
|
166
166
|
I,
|
|
167
167
|
{
|
|
168
|
-
value:
|
|
168
|
+
value: l.id,
|
|
169
169
|
onSelect: () => {
|
|
170
|
-
v(
|
|
170
|
+
v(l.id), m(!1), C("");
|
|
171
171
|
},
|
|
172
172
|
className: "flex cursor-pointer items-center justify-between whitespace-pre-wrap",
|
|
173
173
|
children: [
|
|
@@ -177,45 +177,45 @@ function Cs({
|
|
|
177
177
|
{
|
|
178
178
|
className: fe(
|
|
179
179
|
"mr-2 h-4 w-4 shrink-0",
|
|
180
|
-
o ===
|
|
180
|
+
o === l.id ? "opacity-100" : "opacity-0"
|
|
181
181
|
)
|
|
182
182
|
}
|
|
183
183
|
)
|
|
184
184
|
]
|
|
185
185
|
},
|
|
186
|
-
|
|
186
|
+
l.id
|
|
187
187
|
);
|
|
188
188
|
})
|
|
189
189
|
] })
|
|
190
190
|
] })
|
|
191
191
|
] }) })
|
|
192
|
-
] }) : /* @__PURE__ */
|
|
192
|
+
] }) : /* @__PURE__ */ n(
|
|
193
193
|
"select",
|
|
194
194
|
{
|
|
195
195
|
id: i,
|
|
196
196
|
value: o || "none",
|
|
197
|
-
onChange: (
|
|
197
|
+
onChange: (l) => v(l.target.value),
|
|
198
198
|
className: p,
|
|
199
199
|
"data-testid": "parent-page-selector",
|
|
200
200
|
children: [
|
|
201
201
|
/* @__PURE__ */ s("option", { value: "none", children: "None" }),
|
|
202
|
-
x.map((
|
|
203
|
-
const d = S(
|
|
204
|
-
return (g == null ? void 0 : g.id) ===
|
|
202
|
+
x.map((l) => {
|
|
203
|
+
const d = S(l.slug), N = d > 0 ? b(d) : "", O = h(l.slug);
|
|
204
|
+
return (g == null ? void 0 : g.id) && (g.id === l.id || l.slug.startsWith(g.slug + "/")) ? null : /* @__PURE__ */ n("option", { value: l.id, children: [
|
|
205
205
|
N,
|
|
206
|
-
|
|
206
|
+
l.name,
|
|
207
207
|
" (",
|
|
208
208
|
O,
|
|
209
209
|
")"
|
|
210
|
-
] },
|
|
210
|
+
] }, l.id);
|
|
211
211
|
})
|
|
212
212
|
]
|
|
213
213
|
}
|
|
214
214
|
)
|
|
215
215
|
] });
|
|
216
216
|
}
|
|
217
|
-
const ks = (...
|
|
218
|
-
templates:
|
|
217
|
+
const ks = (...a) => a.filter(Boolean).join(" "), Ls = ({
|
|
218
|
+
templates: a,
|
|
219
219
|
selectedTemplateId: o,
|
|
220
220
|
onSelectTemplate: v,
|
|
221
221
|
isLoading: p = !1
|
|
@@ -223,36 +223,36 @@ const ks = (...l) => l.filter(Boolean).join(" "), Ls = ({
|
|
|
223
223
|
const [i, g] = y(""), [u, m] = y(!1), [f, C] = y(""), F = ye("enable-add-page-dropdown");
|
|
224
224
|
if (ze(() => {
|
|
225
225
|
if (o) {
|
|
226
|
-
const h =
|
|
226
|
+
const h = a.find((t) => t.id === o);
|
|
227
227
|
Oe(() => g((h == null ? void 0 : h.preview) || ""));
|
|
228
228
|
} else
|
|
229
229
|
Oe(() => g(""));
|
|
230
|
-
}, [o,
|
|
230
|
+
}, [o, a]), p)
|
|
231
231
|
return /* @__PURE__ */ s("div", { className: "flex h-fit items-center justify-center text-sm text-gray-500", children: "Loading templates..." });
|
|
232
|
-
if (
|
|
232
|
+
if (a.length === 0)
|
|
233
233
|
return null;
|
|
234
234
|
const x = {};
|
|
235
|
-
|
|
235
|
+
a.forEach((h) => {
|
|
236
236
|
const t = h.libraryName;
|
|
237
237
|
x[t] || (x[t] = []), x[t].push(h);
|
|
238
238
|
});
|
|
239
239
|
const $ = Object.entries(x).reduce(
|
|
240
|
-
(h, [t,
|
|
241
|
-
const d =
|
|
240
|
+
(h, [t, l]) => {
|
|
241
|
+
const d = l.filter(
|
|
242
242
|
(N) => N.name.toLowerCase().includes(f.toLowerCase()) || t.toLowerCase().includes(f.toLowerCase())
|
|
243
243
|
);
|
|
244
244
|
return d.length > 0 && (h[t] = d), h;
|
|
245
245
|
},
|
|
246
246
|
{}
|
|
247
|
-
), S =
|
|
248
|
-
return /* @__PURE__ */
|
|
249
|
-
F ? /* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */
|
|
247
|
+
), S = a.find((h) => h.id === o), b = S ? de(S.name) : "No Template";
|
|
248
|
+
return /* @__PURE__ */ n("div", { className: "space-y-4", children: [
|
|
249
|
+
F ? /* @__PURE__ */ n(ee, { open: u, onOpenChange: m, children: [
|
|
250
|
+
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ n(W, { variant: "outline", role: "combobox", className: "w-full justify-between", children: [
|
|
251
251
|
b,
|
|
252
252
|
/* @__PURE__ */ s(re, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
253
253
|
] }) }),
|
|
254
|
-
/* @__PURE__ */ s(
|
|
255
|
-
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */
|
|
254
|
+
/* @__PURE__ */ s(ae, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ne, { shouldFilter: !1, children: [
|
|
255
|
+
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
256
256
|
/* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
257
257
|
/* @__PURE__ */ s(
|
|
258
258
|
Y,
|
|
@@ -264,34 +264,34 @@ const ks = (...l) => l.filter(Boolean).join(" "), Ls = ({
|
|
|
264
264
|
}
|
|
265
265
|
)
|
|
266
266
|
] }) }),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */ s(
|
|
269
|
-
Object.entries($).map(([h, t]) => /* @__PURE__ */ s(G, { heading: h, children: t.map((
|
|
267
|
+
/* @__PURE__ */ n(ce, { className: "max-h-[300px] overflow-y-auto", children: [
|
|
268
|
+
/* @__PURE__ */ s(le, { children: "No templates found." }),
|
|
269
|
+
Object.entries($).map(([h, t]) => /* @__PURE__ */ s(G, { heading: h, children: t.map((l) => /* @__PURE__ */ n(
|
|
270
270
|
I,
|
|
271
271
|
{
|
|
272
|
-
value:
|
|
272
|
+
value: l.id,
|
|
273
273
|
onSelect: () => {
|
|
274
|
-
v(
|
|
274
|
+
v(l.id), m(!1), C("");
|
|
275
275
|
},
|
|
276
276
|
className: "flex cursor-pointer items-center justify-between",
|
|
277
277
|
children: [
|
|
278
|
-
de(
|
|
278
|
+
de(l.name),
|
|
279
279
|
/* @__PURE__ */ s(
|
|
280
280
|
R,
|
|
281
281
|
{
|
|
282
282
|
className: ks(
|
|
283
283
|
"mr-2 h-4 w-4",
|
|
284
|
-
o ===
|
|
284
|
+
o === l.id ? "opacity-100" : "opacity-0"
|
|
285
285
|
)
|
|
286
286
|
}
|
|
287
287
|
)
|
|
288
288
|
]
|
|
289
289
|
},
|
|
290
|
-
|
|
290
|
+
l.id
|
|
291
291
|
)) }, h))
|
|
292
292
|
] })
|
|
293
293
|
] }) })
|
|
294
|
-
] }) : /* @__PURE__ */
|
|
294
|
+
] }) : /* @__PURE__ */ n(
|
|
295
295
|
"select",
|
|
296
296
|
{
|
|
297
297
|
className: "w-full rounded-md border border-gray-300 px-3 py-2",
|
|
@@ -299,38 +299,38 @@ const ks = (...l) => l.filter(Boolean).join(" "), Ls = ({
|
|
|
299
299
|
onChange: (h) => v(h.target.value),
|
|
300
300
|
children: [
|
|
301
301
|
/* @__PURE__ */ s("option", { value: "", children: "No Template" }),
|
|
302
|
-
Object.entries(x).map(([h, t]) => /* @__PURE__ */ s("optgroup", { label: h, children: t.map((
|
|
302
|
+
Object.entries(x).map(([h, t]) => /* @__PURE__ */ s("optgroup", { label: h, children: t.map((l) => /* @__PURE__ */ s("option", { value: l.id, children: de(l.name) }, l.id)) }, h))
|
|
303
303
|
]
|
|
304
304
|
}
|
|
305
305
|
),
|
|
306
|
-
i && /* @__PURE__ */
|
|
306
|
+
i && /* @__PURE__ */ n("div", { className: "mt-3 overflow-hidden rounded border", children: [
|
|
307
307
|
/* @__PURE__ */ s("div", { className: "max-h-[200px] overflow-auto", children: /* @__PURE__ */ s("img", { src: i, alt: "Template Preview", className: "w-full object-contain" }) }),
|
|
308
308
|
/* @__PURE__ */ s("div", { className: "border-t bg-gray-50 p-2 text-xs text-gray-500", children: "Template preview" })
|
|
309
309
|
] })
|
|
310
310
|
] });
|
|
311
311
|
}, Ts = () => {
|
|
312
|
-
const
|
|
312
|
+
const a = Re(), o = Ue();
|
|
313
313
|
return qe({
|
|
314
314
|
queryKey: [oe.GET_LIBRARIES],
|
|
315
315
|
staleTime: "static",
|
|
316
|
-
queryFn: async () => await o(
|
|
316
|
+
queryFn: async () => await o(a, { action: oe.GET_LIBRARIES }) || []
|
|
317
317
|
});
|
|
318
|
-
}, js = (
|
|
318
|
+
}, js = (a) => {
|
|
319
319
|
const o = Re(), v = Ue();
|
|
320
320
|
return qe({
|
|
321
|
-
queryKey: [oe.GET_TEMPLATES_BY_TYPE,
|
|
321
|
+
queryKey: [oe.GET_TEMPLATES_BY_TYPE, a],
|
|
322
322
|
staleTime: "static",
|
|
323
|
-
enabled: !!
|
|
323
|
+
enabled: !!a,
|
|
324
324
|
queryFn: async () => {
|
|
325
325
|
const p = await v(o, {
|
|
326
326
|
action: oe.GET_TEMPLATES_BY_TYPE,
|
|
327
|
-
data: { pageType:
|
|
327
|
+
data: { pageType: a }
|
|
328
328
|
});
|
|
329
|
-
return (
|
|
329
|
+
return (a ? ps(p, { pageType: a }) : p) || [];
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
|
-
}, Ds = (
|
|
333
|
-
const { data: o = [], isLoading: v } = js(
|
|
332
|
+
}, Ds = (a) => {
|
|
333
|
+
const { data: o = [], isLoading: v } = js(a), { data: p = [], isLoading: i } = Ts(), g = B(() => v || i ? [] : o.map((m) => {
|
|
334
334
|
const f = ge(p, { id: m.library });
|
|
335
335
|
return {
|
|
336
336
|
...m,
|
|
@@ -343,20 +343,20 @@ const ks = (...l) => l.filter(Boolean).join(" "), Ls = ({
|
|
|
343
343
|
groupedData: u,
|
|
344
344
|
isLoading: v || i
|
|
345
345
|
};
|
|
346
|
-
}, V = (...
|
|
347
|
-
function _s({ addEditPage:
|
|
346
|
+
}, V = (...a) => a.filter(Boolean).join(" ");
|
|
347
|
+
function _s({ addEditPage: a, close: o, closePanel: v }) {
|
|
348
348
|
var Ae, Fe;
|
|
349
|
-
const { data: p } = gs(), i = B(() => p ?? [], [p]), g = ys(), u = !!(
|
|
349
|
+
const { data: p } = gs(), i = B(() => p ?? [], [p]), g = ys(), u = !!(a != null && a.id), { data: m } = vs(), { mutate: f, isPending: C } = Ns(), { mutate: F, isPending: x } = Ss(), [$, S] = y(null), [b, h] = y(!0), [t, l] = y((a == null ? void 0 : a.pageType) ?? "page"), { hasPermission: d } = cs(), N = d(bs.CHANGE_PAGE_TYPE), [O, U] = y(!1), [_e, Ve] = y(""), { selectedLang: Ge, fallbackLang: Ye } = us(), ve = Ge || Ye, [M, X] = y(""), [Ne, H] = y(!1), Se = B(() => {
|
|
350
350
|
const e = i.find((c) => c.key === t);
|
|
351
351
|
return (e == null ? void 0 : e.hasSlug) === !1;
|
|
352
|
-
}, [t, i]), [k, Me] = y((
|
|
352
|
+
}, [t, i]), [k, Me] = y((a == null ? void 0 : a.parent) ?? ""), [q, be] = y((a == null ? void 0 : a.name) ?? ""), [T, xe] = y((a == null ? void 0 : a.dynamic) ?? !1), [j, K] = y(T ? "" : ((a == null ? void 0 : a.slug) ?? "").split("/").pop() || ""), [we, Ce] = y((a == null ? void 0 : a.dynamicSlugCustom) ?? ""), [ke, Qe] = y(!0), [He, ue] = y(!1), [me, Ke] = y(""), { data: Le, isLoading: Xe } = Ds(t), Q = C || x, Te = ye("enable-add-page-dropdown"), he = B(() => !u || !(a != null && a.id) || !m ? null : m.find((e) => e.id === a.id), [u, a == null ? void 0 : a.id, m]), Ze = (he == null ? void 0 : he.online) || !1, Je = B(() => !u || !(a != null && a.id) || !m ? !1 : m.some((e) => e.parent === a.id), [u, a == null ? void 0 : a.id, m]), r = i.find((e) => e.key === t), _ = (e) => {
|
|
353
353
|
if (u && t !== e) {
|
|
354
354
|
Ve(e), U(!0), X(""), H(!1);
|
|
355
355
|
return;
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
l(e), X(""), H(!1);
|
|
358
358
|
}, je = () => {
|
|
359
|
-
|
|
359
|
+
l(_e), U(!1), xe(!1);
|
|
360
360
|
}, Pe = (e) => {
|
|
361
361
|
xe(e), e ? K("") : Ce("");
|
|
362
362
|
}, Ee = (e) => {
|
|
@@ -371,7 +371,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
371
371
|
K(j ? `${j}` : "");
|
|
372
372
|
}, es = (e) => {
|
|
373
373
|
Ke(e);
|
|
374
|
-
}, ss = () => q.trim() ? T && !Ie(j) ? (S("Slug must be empty when using dynamic slug"), !1) : T && !ke ? (S("Dynamic slug is invalid"), !1) : !0 : (E.error("Name is required"), !1),
|
|
374
|
+
}, ss = () => q.trim() ? T && !Ie(j) ? (S("Slug must be empty when using dynamic slug"), !1) : T && !ke ? (S("Dynamic slug is invalid"), !1) : !0 : (E.error("Name is required"), !1), as = () => {
|
|
375
375
|
const e = {
|
|
376
376
|
pageType: r == null ? void 0 : r.key,
|
|
377
377
|
name: q,
|
|
@@ -379,7 +379,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
379
379
|
hasSlug: !1
|
|
380
380
|
};
|
|
381
381
|
u ? F(
|
|
382
|
-
{ id:
|
|
382
|
+
{ id: a == null ? void 0 : a.id, name: q },
|
|
383
383
|
{
|
|
384
384
|
onSuccess: () => {
|
|
385
385
|
E.success((r == null ? void 0 : r.name) + " updated successfully"), o();
|
|
@@ -390,12 +390,12 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
390
390
|
o(), g(c.page.id, v);
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
|
-
},
|
|
393
|
+
}, ns = (e, c) => {
|
|
394
394
|
if (!e.trim() && !T)
|
|
395
395
|
return S("Child page slug is required"), !1;
|
|
396
396
|
const D = te(c), w = Be(D, e);
|
|
397
397
|
return Object.keys(xs).some((J) => w === `/${J}` || (w == null ? void 0 : w.startsWith(`/${J}/`))) ? (S("Slugs cannot start with a language code for primary page"), !1) : !0;
|
|
398
|
-
},
|
|
398
|
+
}, ls = (e, c) => {
|
|
399
399
|
const D = te(c), w = Be(D, e), L = {
|
|
400
400
|
pageType: t,
|
|
401
401
|
name: q,
|
|
@@ -412,7 +412,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
412
412
|
if (T && (L.dynamicSlugCustom = we), u) {
|
|
413
413
|
const A = fs(L, ["pageType", "parent", "name", "slug", "dynamic", "dynamicSlugCustom"]);
|
|
414
414
|
F(
|
|
415
|
-
{ id:
|
|
415
|
+
{ id: a == null ? void 0 : a.id, ...A },
|
|
416
416
|
{
|
|
417
417
|
onSuccess: () => {
|
|
418
418
|
E.success("Page updated successfully"), o();
|
|
@@ -440,7 +440,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
440
440
|
};
|
|
441
441
|
if (u)
|
|
442
442
|
F(
|
|
443
|
-
{ id:
|
|
443
|
+
{ id: a == null ? void 0 : a.id, ...e },
|
|
444
444
|
{
|
|
445
445
|
onSuccess: () => {
|
|
446
446
|
E.success("Page updated successfully"), o();
|
|
@@ -461,14 +461,14 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
461
461
|
}, De = (e) => {
|
|
462
462
|
if (e.preventDefault(), S(null), !!ss()) {
|
|
463
463
|
if (!(r != null && r.hasSlug)) {
|
|
464
|
-
|
|
464
|
+
as();
|
|
465
465
|
return;
|
|
466
466
|
}
|
|
467
467
|
if (k && k !== "none") {
|
|
468
468
|
const c = m == null ? void 0 : m.find((w) => w.id === k), D = (c == null ? void 0 : c.slug) || "";
|
|
469
|
-
if (!
|
|
469
|
+
if (!ns(j, D))
|
|
470
470
|
return;
|
|
471
|
-
|
|
471
|
+
ls(j, D);
|
|
472
472
|
} else
|
|
473
473
|
ts();
|
|
474
474
|
}
|
|
@@ -479,11 +479,11 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
479
479
|
partialsType: i.filter((c) => c.hasSlug === !1 && e(c))
|
|
480
480
|
};
|
|
481
481
|
}, [i, M]);
|
|
482
|
-
return r != null && r.hasSlug ? /* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
482
|
+
return r != null && r.hasSlug ? /* @__PURE__ */ n("form", { onSubmit: De, className: "mx-auto w-full max-w-md space-y-4", children: [
|
|
483
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
484
484
|
/* @__PURE__ */ s(z, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
|
|
485
|
-
Te ? /* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */
|
|
485
|
+
Te ? /* @__PURE__ */ n(ee, { open: Ne, onOpenChange: H, children: [
|
|
486
|
+
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ n(
|
|
487
487
|
W,
|
|
488
488
|
{
|
|
489
489
|
variant: "outline",
|
|
@@ -499,8 +499,8 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
499
499
|
]
|
|
500
500
|
}
|
|
501
501
|
) }),
|
|
502
|
-
/* @__PURE__ */ s(
|
|
503
|
-
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ s(ae, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ne, { shouldFilter: !1, children: [
|
|
503
|
+
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
504
504
|
/* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
505
505
|
/* @__PURE__ */ s(
|
|
506
506
|
Y,
|
|
@@ -512,9 +512,9 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
512
512
|
}
|
|
513
513
|
)
|
|
514
514
|
] }) }),
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */ s(
|
|
517
|
-
u ? Se ? /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ n(ce, { className: "overflow-y-auto", children: [
|
|
516
|
+
/* @__PURE__ */ s(le, { children: "No page type found." }),
|
|
517
|
+
u ? Se ? /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ n(
|
|
518
518
|
I,
|
|
519
519
|
{
|
|
520
520
|
value: e.key,
|
|
@@ -531,7 +531,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
531
531
|
]
|
|
532
532
|
},
|
|
533
533
|
e.key
|
|
534
|
-
)) }) : /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */
|
|
534
|
+
)) }) : /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */ n(
|
|
535
535
|
I,
|
|
536
536
|
{
|
|
537
537
|
value: e.key,
|
|
@@ -548,8 +548,8 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
548
548
|
]
|
|
549
549
|
},
|
|
550
550
|
e.key
|
|
551
|
-
)) }) : /* @__PURE__ */
|
|
552
|
-
pe.length > 0 && /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */
|
|
551
|
+
)) }) : /* @__PURE__ */ n(We, { children: [
|
|
552
|
+
pe.length > 0 && /* @__PURE__ */ s(G, { heading: "Pages", children: pe.map((e) => /* @__PURE__ */ n(
|
|
553
553
|
I,
|
|
554
554
|
{
|
|
555
555
|
value: e.key,
|
|
@@ -567,7 +567,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
567
567
|
},
|
|
568
568
|
e.key
|
|
569
569
|
)) }),
|
|
570
|
-
Z.length > 0 && /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */
|
|
570
|
+
Z.length > 0 && /* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ n(
|
|
571
571
|
I,
|
|
572
572
|
{
|
|
573
573
|
value: e.key,
|
|
@@ -596,21 +596,21 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
596
596
|
disabled: u && !N,
|
|
597
597
|
onChange: (e) => _(e.target.value),
|
|
598
598
|
className: `w-full rounded-md border border-gray-300 px-3 py-2 ${u && !N ? "cursor-not-allowed text-gray-500" : ""}`,
|
|
599
|
-
children: u ? Se ? /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ s("optgroup", { label: "Pages", children: i.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */
|
|
599
|
+
children: u ? Se ? /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ s("optgroup", { label: "Pages", children: i.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }) : /* @__PURE__ */ n(We, { children: [
|
|
600
600
|
/* @__PURE__ */ s("optgroup", { label: "Pages", children: i.filter((e) => e.hasSlug !== !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) }),
|
|
601
601
|
/* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
|
|
602
602
|
] })
|
|
603
603
|
}
|
|
604
604
|
),
|
|
605
|
-
O && /* @__PURE__ */
|
|
605
|
+
O && /* @__PURE__ */ n("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
|
|
606
606
|
/* @__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?" }),
|
|
607
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ n("div", { className: "mt-2 flex gap-2", children: [
|
|
608
608
|
/* @__PURE__ */ s(W, { variant: "outline", size: "sm", onClick: () => U(!1), children: "Cancel" }),
|
|
609
609
|
/* @__PURE__ */ s(W, { variant: "default", size: "sm", onClick: je, children: "Confirm" })
|
|
610
610
|
] })
|
|
611
611
|
] })
|
|
612
612
|
] }),
|
|
613
|
-
!u && (r == null ? void 0 : r.hasSlug) && Le.length > 0 && /* @__PURE__ */
|
|
613
|
+
!u && (r == null ? void 0 : r.hasSlug) && Le.length > 0 && /* @__PURE__ */ n("div", { className: "space-y-1", children: [
|
|
614
614
|
/* @__PURE__ */ s(z, { className: "mb-1 block text-sm", children: "Template" }),
|
|
615
615
|
/* @__PURE__ */ s(
|
|
616
616
|
Ls,
|
|
@@ -628,10 +628,10 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
628
628
|
pages: m,
|
|
629
629
|
selectedParentId: k,
|
|
630
630
|
onChange: Ee,
|
|
631
|
-
currentPage:
|
|
631
|
+
currentPage: a
|
|
632
632
|
}
|
|
633
633
|
),
|
|
634
|
-
/* @__PURE__ */
|
|
634
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
635
635
|
/* @__PURE__ */ s(z, { htmlFor: "name", className: "text-sm", children: "Name" }),
|
|
636
636
|
/* @__PURE__ */ s(
|
|
637
637
|
Y,
|
|
@@ -645,8 +645,8 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
645
645
|
}
|
|
646
646
|
)
|
|
647
647
|
] }),
|
|
648
|
-
(r == null ? void 0 : r.dynamicSegments) && k && k !== "none" && /* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
648
|
+
(r == null ? void 0 : r.dynamicSegments) && k && k !== "none" && /* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
649
|
+
/* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
|
|
650
650
|
/* @__PURE__ */ s(
|
|
651
651
|
"input",
|
|
652
652
|
{
|
|
@@ -670,7 +670,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
670
670
|
}
|
|
671
671
|
) }) })
|
|
672
672
|
] }),
|
|
673
|
-
(!(r != null && r.dynamicSegments) || !T) && /* @__PURE__ */
|
|
673
|
+
(!(r != null && r.dynamicSegments) || !T) && /* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
674
674
|
/* @__PURE__ */ s(z, { htmlFor: "slug", className: "text-sm", children: "Slug" }),
|
|
675
675
|
/* @__PURE__ */ s(
|
|
676
676
|
hs,
|
|
@@ -678,7 +678,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
678
678
|
value: j,
|
|
679
679
|
onChange: (e) => {
|
|
680
680
|
var c;
|
|
681
|
-
K(e), u && e !== (((c =
|
|
681
|
+
K(e), u && e !== (((c = a == null ? void 0 : a.slug) == null ? void 0 : c.split("/").pop()) || "") ? ue(!!(Ze || Je)) : ue(!1);
|
|
682
682
|
},
|
|
683
683
|
placeholder: k && k !== "none" ? "Enter page slug" : t === "page" ? "Leave empty for home page" : "Required - e.g. your-slug",
|
|
684
684
|
parentSlug: k && k !== "none" ? (Fe = m == null ? void 0 : m.find((e) => e.id === k)) == null ? void 0 : Fe.slug : void 0,
|
|
@@ -686,7 +686,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
688
|
$ && /* @__PURE__ */ s("p", { className: "text-xs text-red-500", children: $ }),
|
|
689
|
-
He && /* @__PURE__ */ s("div", { className: "mt-4 rounded-md border border-amber-200 bg-amber-50 p-3", children: /* @__PURE__ */
|
|
689
|
+
He && /* @__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: [
|
|
690
690
|
/* @__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(
|
|
691
691
|
"path",
|
|
692
692
|
{
|
|
@@ -695,7 +695,7 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
695
695
|
clipRule: "evenodd"
|
|
696
696
|
}
|
|
697
697
|
) }) }),
|
|
698
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ n("div", { className: "flex-1", children: [
|
|
699
699
|
/* @__PURE__ */ s("h3", { className: "text-sm font-medium text-amber-800", children: "Slug Change Warning" }),
|
|
700
700
|
/* @__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." }) })
|
|
701
701
|
] })
|
|
@@ -712,11 +712,11 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
712
712
|
children: u ? Q ? "Updating..." : "Update page" : Q ? "Creating..." : "Create Page"
|
|
713
713
|
}
|
|
714
714
|
)
|
|
715
|
-
] }) : /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
715
|
+
] }) : /* @__PURE__ */ n("form", { onSubmit: De, className: "mx-auto w-full max-w-md space-y-4", children: [
|
|
716
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
717
717
|
/* @__PURE__ */ s(z, { htmlFor: "pageType", className: "text-sm", children: "Type" }),
|
|
718
|
-
Te ? /* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */
|
|
718
|
+
Te ? /* @__PURE__ */ n(ee, { open: Ne, onOpenChange: H, children: [
|
|
719
|
+
/* @__PURE__ */ s(se, { asChild: !0, children: /* @__PURE__ */ n(
|
|
720
720
|
W,
|
|
721
721
|
{
|
|
722
722
|
variant: "outline",
|
|
@@ -732,8 +732,8 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
732
732
|
]
|
|
733
733
|
}
|
|
734
734
|
) }),
|
|
735
|
-
/* @__PURE__ */ s(
|
|
736
|
-
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */
|
|
735
|
+
/* @__PURE__ */ s(ae, { className: "w-[var(--radix-popover-trigger-width)] p-0", align: "start", children: /* @__PURE__ */ n(ne, { shouldFilter: !1, children: [
|
|
736
|
+
/* @__PURE__ */ s("div", { className: "sticky top-0 z-10 bg-white px-3 py-2", children: /* @__PURE__ */ n("div", { className: "relative", children: [
|
|
737
737
|
/* @__PURE__ */ s(ie, { strokeWidth: 2, className: "absolute left-2 top-2 h-4 w-4 text-gray-400" }),
|
|
738
738
|
/* @__PURE__ */ s(
|
|
739
739
|
Y,
|
|
@@ -745,9 +745,9 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
745
745
|
}
|
|
746
746
|
)
|
|
747
747
|
] }) }),
|
|
748
|
-
/* @__PURE__ */
|
|
749
|
-
/* @__PURE__ */ s(
|
|
750
|
-
/* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */
|
|
748
|
+
/* @__PURE__ */ n(ce, { className: "max-h-[200px] overflow-y-auto", children: [
|
|
749
|
+
/* @__PURE__ */ s(le, { children: "No page type found." }),
|
|
750
|
+
/* @__PURE__ */ s(G, { heading: "Partials", children: Z.map((e) => /* @__PURE__ */ n(
|
|
751
751
|
I,
|
|
752
752
|
{
|
|
753
753
|
value: e.key,
|
|
@@ -775,16 +775,16 @@ function _s({ addEditPage: l, close: o, closePanel: v }) {
|
|
|
775
775
|
children: /* @__PURE__ */ s("optgroup", { label: "Partials", children: i.filter((e) => e.hasSlug === !1).map((e) => /* @__PURE__ */ s("option", { value: e.key, children: e.name }, e.key)) })
|
|
776
776
|
}
|
|
777
777
|
),
|
|
778
|
-
O && /* @__PURE__ */
|
|
778
|
+
O && /* @__PURE__ */ n("div", { className: "mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3", children: [
|
|
779
779
|
/* @__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?" }),
|
|
780
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ n("div", { className: "mt-2 flex gap-2", children: [
|
|
781
781
|
/* @__PURE__ */ s(W, { variant: "outline", size: "sm", onClick: () => U(!1), children: "Cancel" }),
|
|
782
782
|
/* @__PURE__ */ s(W, { variant: "default", size: "sm", onClick: je, children: "Confirm" })
|
|
783
783
|
] })
|
|
784
784
|
] }),
|
|
785
785
|
/* @__PURE__ */ s("p", { className: "text-xs text-gray-500", children: (Ae = i.find((e) => e.key === t)) == null ? void 0 : Ae.helpText })
|
|
786
786
|
] }),
|
|
787
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ n("div", { className: "space-y-0.5", children: [
|
|
788
788
|
/* @__PURE__ */ s(z, { htmlFor: "name", className: "text-sm", children: "Name" }),
|
|
789
789
|
/* @__PURE__ */ s(Y, { id: "name", value: q, onChange: (e) => be(e.target.value), required: !0, "aria-required": "true" })
|
|
790
790
|
] }),
|