@chaibuilder/pages 0.14.4 → 0.15.1
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/{2AITGKQY-DWDDkd18.cjs → 2AITGKQY-GcbF_G3s.cjs} +1 -1
- package/dist/{2AITGKQY-DtQPkxBe.js → 2AITGKQY-a-BJOrVj.js} +2 -2
- package/dist/{NCMVHL6D-CksZXXOw.js → NCMVHL6D-CCFQEIik.js} +4 -4
- package/dist/{NCMVHL6D-6CkVnw0a.cjs → NCMVHL6D-fz7uxKMS.cjs} +1 -1
- package/dist/{ZDWCUMSJ-BXQ01VPt.js → ZDWCUMSJ-B87y4E-s.js} +1 -1
- package/dist/{ZDWCUMSJ-DoM-AA0C.cjs → ZDWCUMSJ-D40Aht5l.cjs} +1 -1
- package/dist/{add-new-language-page-D8iXtyLA.js → add-new-language-page-CxNpkd0L.js} +2 -2
- package/dist/{add-new-language-page-BA73lQnm.cjs → add-new-language-page-Dyh26P7i.cjs} +1 -1
- package/dist/{add-new-page-DESlqvED.js → add-new-page-DGQqN1GO.js} +1 -1
- package/dist/{add-new-page-EOMgMSeq.cjs → add-new-page-jWn3_pZ4.cjs} +1 -1
- package/dist/{delete-page-ZvnuEow6.cjs → delete-page-Bxl1t_Ue.cjs} +1 -1
- package/dist/{delete-page-BP1Df8QL.js → delete-page-WnsCggnJ.js} +1 -1
- package/dist/{digital-asset-manager-Bb81T3mS.js → digital-asset-manager-ClyooOJY.js} +135 -135
- package/dist/{digital-asset-manager-BxWb1j_y.cjs → digital-asset-manager-DrXotZ_n.cjs} +1 -1
- package/dist/{duplicate-page-W5xbmPSC.cjs → duplicate-page-CDtfdgyJ.cjs} +1 -1
- package/dist/{duplicate-page-B1j0H7gP.js → duplicate-page-DOloolXy.js} +8 -8
- package/dist/{dynamic-page-selector-Crjyco6l.js → dynamic-page-selector-B-8TUdTG.js} +1 -1
- package/dist/{dynamic-page-selector-BZKJmSx5.cjs → dynamic-page-selector-CcYIfKlO.cjs} +1 -1
- package/dist/index-CffopOpP.cjs +5 -0
- package/dist/{index-DFvsMFVH.js → index-CguzNa4U.js} +1710 -1938
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -14
- package/dist/index.js +12 -13
- package/dist/{json-diff-viewer-BGGSLqtx.js → json-diff-viewer-CxFGgqa_.js} +6 -6
- package/dist/{json-diff-viewer-DRkE-x_z.cjs → json-diff-viewer-DcR1gbkd.cjs} +1 -1
- package/dist/{lang-panel-B3tr2uhr.js → lang-panel-Bi427DLp.js} +2 -2
- package/dist/{lang-panel-9T8dIx2p.cjs → lang-panel-XonHaLBn.cjs} +1 -1
- package/dist/{mark-as-template-DPVPRgbi.cjs → mark-as-template-BtI1QfuI.cjs} +1 -1
- package/dist/{mark-as-template-L9cHzL84.js → mark-as-template-CS68JVP8.js} +1 -1
- package/dist/{no-language-page-content-DP7gmy0s.js → no-language-page-content-C5t9cDI4.js} +1 -1
- package/dist/{no-language-page-content-Cy_D-3jE.cjs → no-language-page-content-DMqw1cTK.cjs} +1 -1
- package/dist/{page-creator-Ctn5ixJE.js → page-creator-BY2w99Ez.js} +2 -2
- package/dist/{page-creator-DDaI1HYj.cjs → page-creator-BkKT_Xy1.cjs} +1 -1
- package/dist/{page-lock-request-BKrxnEtQ.cjs → page-lock-request-CIRTswpw.cjs} +1 -1
- package/dist/{page-lock-request-CjJFJKL2.js → page-lock-request-Z1sTGi6N.js} +10 -10
- package/dist/{page-locked-by-dialog-DmsSmAY2.js → page-locked-by-dialog-B2C1M_bK.js} +1 -1
- package/dist/{page-locked-by-dialog-b25_rn2m.cjs → page-locked-by-dialog-DpBpQ0oI.cjs} +1 -1
- package/dist/{page-manager-new-EsIg6iQn.js → page-manager-new-CSqFLJBd.js} +46 -46
- package/dist/{page-manager-new-DiZVY7Me.cjs → page-manager-new-tWV46glN.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-Bt4T_dnB.js → page-manager-search-and-filter-B9VZzJQd.js} +2 -2
- package/dist/{page-manager-search-and-filter-CgY2qiXU.cjs → page-manager-search-and-filter-CwuukvKn.cjs} +1 -1
- package/dist/{page-revisions-content-DtI8CmtR.cjs → page-revisions-content-BWhJz0_7.cjs} +1 -1
- package/dist/{page-revisions-content-CsT6aF2I.js → page-revisions-content-WoIu0uan.js} +18 -18
- package/dist/{publish-pages-content-DpC7RcTw.cjs → publish-pages-content-BHDTLdGv.cjs} +1 -1
- package/dist/{publish-pages-content-KAuhOPv0.js → publish-pages-content-CkWvQGbm.js} +12 -12
- package/dist/{save-to-lib-CeWaSQdB.js → save-to-lib-AkbnWUxR.js} +13 -13
- package/dist/{save-to-lib-BGpWGHJo.cjs → save-to-lib-C0ZfwiAE.cjs} +1 -1
- package/dist/{seo-panel-JDQ_7bOx.cjs → seo-panel-CiKkn5Jp.cjs} +1 -1
- package/dist/{seo-panel-Dhhpe_7z.js → seo-panel-Gu3HZveQ.js} +34 -34
- package/dist/shared-json-ld-BPaeG1gf.cjs +1 -0
- package/dist/shared-json-ld-CsyZjZdT.js +557 -0
- package/dist/{slug-input-QxBMijHP.cjs → slug-input-B4w0Ihxn.cjs} +1 -1
- package/dist/{slug-input-hJdU8DaF.js → slug-input-BXNj3cZf.js} +1 -1
- package/dist/{theme-panel-footer-D2B7iYW2.js → theme-panel-footer-68bQaQeh.js} +1 -1
- package/dist/{theme-panel-footer-BZnPvTkM.cjs → theme-panel-footer-DnZs9SzB.cjs} +1 -1
- package/dist/{unmark-as-template-Byn2RRAp.cjs → unmark-as-template-DFxmzyx4.cjs} +1 -1
- package/dist/{unmark-as-template-Dcpkj7EZ.js → unmark-as-template-MpXMyb0Q.js} +1 -1
- package/dist/{unpublish-page-CPLlsfm4.js → unpublish-page-Bzouoco9.js} +1 -1
- package/dist/{unpublish-page-5Fi1wKXb.cjs → unpublish-page-CCPyMoaC.cjs} +1 -1
- package/dist/use-page-expand-manager-2KjeYfVS.cjs +1 -0
- package/dist/use-page-expand-manager-D6T75I11.js +184 -0
- package/dist/{web-preview-CVvxe5Ll.cjs → web-preview-B3-o8BoT.cjs} +1 -1
- package/dist/{web-preview-YuuoRaZn.js → web-preview-D9PcexXy.js} +1 -1
- package/package.json +1 -1
- package/dist/index-Qnh8Lkr0.cjs +0 -5
- package/dist/shared-json-ld-BYbdMttx.cjs +0 -1
- package/dist/shared-json-ld-BliIbNv9.js +0 -337
- package/dist/use-page-expand-manager-DkyBiNpx.js +0 -85
- package/dist/use-page-expand-manager-To-SsGy3.cjs +0 -1
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e, Fragment as I } from "react/jsx-runtime";
|
|
2
|
-
import { useLanguages as _ } from "@chaibuilder/sdk";
|
|
3
|
-
import { Tooltip as H, TooltipTrigger as M, TooltipContent as R, ScrollArea as V, Card as q, CardHeader as G, Switch as k, CardTitle as W, Button as p, AlertDialog as K, AlertDialogTrigger as Q, AlertDialogContent as $, AlertDialogHeader as X, AlertDialogTitle as Y, AlertDialogDescription as Z, AlertDialogFooter as ee, AlertDialogCancel as ae, AlertDialogAction as te, CardContent as ne, Textarea as S, Dialog as le, DialogContent as se, DialogHeader as ie, DialogTitle as re, Label as b, Input as C, Tabs as ce, TabsList as de, TabsTrigger as T, TabsContent as L } from "@chaibuilder/sdk/ui";
|
|
4
|
-
import { get as J, includes as P } from "lodash-es";
|
|
5
|
-
import { Loader as y, Plus as oe, Edit as he, Trash as me, Code as ue, Eye as pe } from "lucide-react";
|
|
6
|
-
import { useState as g, useEffect as O } from "react";
|
|
7
|
-
import { toast as ge } from "sonner";
|
|
8
|
-
import { ak as fe, al as xe, A as F, am as Ne, an as ve, ao as j, ap as E } from "./index-DFvsMFVH.js";
|
|
9
|
-
import { useQuery as we } from "@tanstack/react-query";
|
|
10
|
-
const U = () => {
|
|
11
|
-
const l = fe(), d = xe();
|
|
12
|
-
return we({
|
|
13
|
-
queryKey: [F.GET_APP_SHARED_JSONLD],
|
|
14
|
-
queryFn: async () => await d(l, { action: F.GET_APP_SHARED_JSONLD }) || [],
|
|
15
|
-
placeholderData: [],
|
|
16
|
-
staleTime: 60 * 60 * 1e3,
|
|
17
|
-
retry: 2
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
function Fe() {
|
|
21
|
-
const { data: l } = Ne(), d = J(l, "metadata", {}) || {}, [o, f] = g(J(d, "sharedJsonLD", []) || []), [m, h] = g({ show: !1, data: null }), { mutateAsync: D } = ve(), [n, i] = g(null), { data: r, isLoading: u } = U(), { mutateAsync: x } = j(), { selectedLang: v } = _(), s = async (t) => {
|
|
22
|
-
await D({ ...d, sharedJsonLD: t }), f(t), i(null);
|
|
23
|
-
}, w = async (t) => {
|
|
24
|
-
i(t);
|
|
25
|
-
let c = [...o];
|
|
26
|
-
P(o, t) ? c = c.filter((N) => N !== t) : c = [...c || [], t], await s(c);
|
|
27
|
-
}, z = async (t) => {
|
|
28
|
-
i(t);
|
|
29
|
-
try {
|
|
30
|
-
const c = r == null ? void 0 : r.filter((N) => N.id !== t);
|
|
31
|
-
await x(c), f(c), i(null);
|
|
32
|
-
} catch {
|
|
33
|
-
i(null);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return /* @__PURE__ */ a("div", { className: "rounded border bg-muted p-2", children: [
|
|
37
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-between pb-2", children: [
|
|
38
|
-
/* @__PURE__ */ a("div", { children: [
|
|
39
|
-
/* @__PURE__ */ e("div", { className: "text-xs font-medium", children: "Shared JSON-LD Templates" }),
|
|
40
|
-
/* @__PURE__ */ e("div", { className: "w-full text-xs text-gray-500", children: "Manage reusable JSON-LD schemas that can be applied across multiple pages" })
|
|
41
|
-
] }),
|
|
42
|
-
!v && /* @__PURE__ */ a(H, { delayDuration: 0, children: [
|
|
43
|
-
/* @__PURE__ */ e(
|
|
44
|
-
M,
|
|
45
|
-
{
|
|
46
|
-
type: "button",
|
|
47
|
-
disabled: u,
|
|
48
|
-
className: "rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",
|
|
49
|
-
onClick: (t) => {
|
|
50
|
-
t.stopPropagation(), h({ show: !0, data: null });
|
|
51
|
-
},
|
|
52
|
-
children: u ? /* @__PURE__ */ e(y, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(oe, { className: "h-4 w-4" })
|
|
53
|
-
}
|
|
54
|
-
),
|
|
55
|
-
/* @__PURE__ */ e(R, { children: "Add new schema" })
|
|
56
|
-
] })
|
|
57
|
-
] }),
|
|
58
|
-
/* @__PURE__ */ a(V, { className: "max-h-96 overflow-y-auto", children: [
|
|
59
|
-
/* @__PURE__ */ a("div", { className: "space-y-2", children: [
|
|
60
|
-
(!r || (r == null ? void 0 : r.length) === 0) && !u && /* @__PURE__ */ e("div", { className: "flex items-center justify-center px-2 py-4 text-xs", children: "No shared JSON-LD found" }),
|
|
61
|
-
r == null ? void 0 : r.map((t) => {
|
|
62
|
-
const c = E(t.content), N = c.isValid ? c.parsed : "", B = P(o, t.id), A = !v;
|
|
63
|
-
return /* @__PURE__ */ a(
|
|
64
|
-
q,
|
|
65
|
-
{
|
|
66
|
-
className: `relative border-gray-300 p-0 shadow-none transition-all ${n === t.id ? "pointer-events-none" : ""}`,
|
|
67
|
-
children: [
|
|
68
|
-
n === t.id && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80", children: /* @__PURE__ */ e(y, { className: "h-5 w-5 animate-spin text-primary" }) }),
|
|
69
|
-
/* @__PURE__ */ e(G, { className: "p-2", children: /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
70
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
|
|
71
|
-
A && /* @__PURE__ */ e(k, { checked: B, onCheckedChange: () => w(t.id) }),
|
|
72
|
-
/* @__PURE__ */ a("div", { children: [
|
|
73
|
-
/* @__PURE__ */ e(W, { className: "flex items-center gap-2 text-sm leading-none", children: t.name }),
|
|
74
|
-
(t == null ? void 0 : t.description) && /* @__PURE__ */ e("p", { className: "mt-1 text-xs leading-none text-muted-foreground", children: t == null ? void 0 : t.description })
|
|
75
|
-
] })
|
|
76
|
-
] }),
|
|
77
|
-
A && /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
78
|
-
/* @__PURE__ */ e(
|
|
79
|
-
p,
|
|
80
|
-
{
|
|
81
|
-
type: "button",
|
|
82
|
-
variant: "ghost",
|
|
83
|
-
size: "icon",
|
|
84
|
-
className: "h-5 w-5 p-0",
|
|
85
|
-
onClick: () => h({ show: !0, data: t }),
|
|
86
|
-
children: /* @__PURE__ */ e(he, { className: "h-4 w-4" })
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
/* @__PURE__ */ a(K, { children: [
|
|
90
|
-
/* @__PURE__ */ e(Q, { className: "flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800", children: /* @__PURE__ */ e(me, { className: "h-4 w-4" }) }),
|
|
91
|
-
/* @__PURE__ */ a($, { children: [
|
|
92
|
-
/* @__PURE__ */ a(X, { children: [
|
|
93
|
-
/* @__PURE__ */ e(Y, { children: "Delete Schema" }),
|
|
94
|
-
/* @__PURE__ */ a(Z, { children: [
|
|
95
|
-
"Are you sure you want to delete ",
|
|
96
|
-
/* @__PURE__ */ e("span", { className: "font-medium", children: t.name }),
|
|
97
|
-
"? This action cannot be undone."
|
|
98
|
-
] })
|
|
99
|
-
] }),
|
|
100
|
-
/* @__PURE__ */ a(ee, { children: [
|
|
101
|
-
/* @__PURE__ */ e(ae, { type: "button", children: "Cancel" }),
|
|
102
|
-
/* @__PURE__ */ e(
|
|
103
|
-
te,
|
|
104
|
-
{
|
|
105
|
-
type: "button",
|
|
106
|
-
onClick: () => z(t.id),
|
|
107
|
-
className: "bg-red-500 text-white hover:bg-red-600",
|
|
108
|
-
children: "Delete"
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
] })
|
|
112
|
-
] })
|
|
113
|
-
] })
|
|
114
|
-
] })
|
|
115
|
-
] }) }),
|
|
116
|
-
/* @__PURE__ */ e(ne, { className: "px-2 pb-2", children: A ? /* @__PURE__ */ e(
|
|
117
|
-
S,
|
|
118
|
-
{
|
|
119
|
-
id: t.id,
|
|
120
|
-
rows: 1,
|
|
121
|
-
readOnly: !0,
|
|
122
|
-
value: JSON.stringify(N, null, 2),
|
|
123
|
-
className: "no-scrollbar cursor-text overflow-hidden rounded-md border-none bg-gray-100/80 text-xs"
|
|
124
|
-
}
|
|
125
|
-
) : /* @__PURE__ */ a("div", { className: "flex h-20 w-full flex-col items-center justify-center rounded-lg border bg-gray-100", children: [
|
|
126
|
-
/* @__PURE__ */ e("div", { className: "max-w-xl text-center text-xs text-gray-500", children: "Not available in selected language, but available in default language." }),
|
|
127
|
-
/* @__PURE__ */ e(
|
|
128
|
-
p,
|
|
129
|
-
{
|
|
130
|
-
size: "sm",
|
|
131
|
-
variant: "outline",
|
|
132
|
-
className: "mt-2",
|
|
133
|
-
onClick: () => {
|
|
134
|
-
},
|
|
135
|
-
children: "Copy & Edit from default language"
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
] }) })
|
|
139
|
-
]
|
|
140
|
-
}
|
|
141
|
-
);
|
|
142
|
-
})
|
|
143
|
-
] }),
|
|
144
|
-
u && /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e(y, { className: "h-5 w-5 animate-spin" }) })
|
|
145
|
-
] }),
|
|
146
|
-
/* @__PURE__ */ e(
|
|
147
|
-
be,
|
|
148
|
-
{
|
|
149
|
-
data: m == null ? void 0 : m.data,
|
|
150
|
-
show: m == null ? void 0 : m.show,
|
|
151
|
-
onClose: () => {
|
|
152
|
-
h({ show: !1, data: null });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
] });
|
|
157
|
-
}
|
|
158
|
-
const be = ({
|
|
159
|
-
data: l,
|
|
160
|
-
show: d,
|
|
161
|
-
onClose: o
|
|
162
|
-
}) => /* @__PURE__ */ e(le, { open: d, onOpenChange: () => o(), children: d && /* @__PURE__ */ e(ye, { data: l, show: d, onClose: o }) }), ye = ({
|
|
163
|
-
data: l,
|
|
164
|
-
show: d,
|
|
165
|
-
onClose: o
|
|
166
|
-
}) => {
|
|
167
|
-
const [f, m] = g("edit"), [h, D] = g(""), [n, i] = g({
|
|
168
|
-
name: "",
|
|
169
|
-
content: "",
|
|
170
|
-
description: "",
|
|
171
|
-
enabledByDefaultForNewPages: !1
|
|
172
|
-
}), { data: r } = U(), { mutateAsync: u, isPending: x } = j();
|
|
173
|
-
O(() => {
|
|
174
|
-
m("edit"), i({ name: "", description: "", content: "", enabledByDefaultForNewPages: !1 }), l && i({
|
|
175
|
-
name: l.name,
|
|
176
|
-
description: l.description,
|
|
177
|
-
content: l.content,
|
|
178
|
-
enabledByDefaultForNewPages: l.enabledByDefaultForNewPages
|
|
179
|
-
});
|
|
180
|
-
}, [l, d]), O(() => {
|
|
181
|
-
const s = E(n.content);
|
|
182
|
-
D(s.isValid ? JSON.stringify(s.parsed, null, 2) : "");
|
|
183
|
-
}, [n.content]);
|
|
184
|
-
const v = async () => {
|
|
185
|
-
if (!n.name || !n.content) {
|
|
186
|
-
ge.error("Please enter a name and content");
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const s = {
|
|
190
|
-
id: l ? l.id : crypto.randomUUID(),
|
|
191
|
-
name: n.name,
|
|
192
|
-
description: n.description,
|
|
193
|
-
content: n.content
|
|
194
|
-
};
|
|
195
|
-
l ? await u([
|
|
196
|
-
...(r || []).map((w) => w.id === l.id ? s : w)
|
|
197
|
-
]) : await u([...r || [], s]), o();
|
|
198
|
-
};
|
|
199
|
-
return /* @__PURE__ */ a(se, { className: "flex max-w-xl flex-col overflow-y-auto", children: [
|
|
200
|
-
/* @__PURE__ */ e(ie, { children: /* @__PURE__ */ e(re, { children: "Add New Shared JSON-LD Schema" }) }),
|
|
201
|
-
/* @__PURE__ */ a("div", { className: "flex max-h-[75vh] flex-col space-y-2 overflow-y-auto", children: [
|
|
202
|
-
/* @__PURE__ */ a("div", { children: [
|
|
203
|
-
/* @__PURE__ */ e(b, { htmlFor: "new-name", children: "Schema Name" }),
|
|
204
|
-
/* @__PURE__ */ e(
|
|
205
|
-
C,
|
|
206
|
-
{
|
|
207
|
-
id: "new-name",
|
|
208
|
-
value: n.name,
|
|
209
|
-
onChange: (s) => i({ ...n, name: s.target.value }),
|
|
210
|
-
placeholder: "e.g., Product Schema",
|
|
211
|
-
className: "text-xs"
|
|
212
|
-
}
|
|
213
|
-
)
|
|
214
|
-
] }),
|
|
215
|
-
/* @__PURE__ */ a("div", { children: [
|
|
216
|
-
/* @__PURE__ */ e(b, { htmlFor: "new-description", children: "Description" }),
|
|
217
|
-
/* @__PURE__ */ e(
|
|
218
|
-
C,
|
|
219
|
-
{
|
|
220
|
-
id: "new-description",
|
|
221
|
-
value: n.description || "",
|
|
222
|
-
onChange: (s) => i({ ...n, description: s.target.value }),
|
|
223
|
-
placeholder: "Brief description of this schema"
|
|
224
|
-
}
|
|
225
|
-
)
|
|
226
|
-
] }),
|
|
227
|
-
/* @__PURE__ */ a("div", { children: [
|
|
228
|
-
/* @__PURE__ */ e(b, { htmlFor: "new-content", children: "JSON-LD Content" }),
|
|
229
|
-
/* @__PURE__ */ a(ce, { value: f, onValueChange: m, className: "w-full", children: [
|
|
230
|
-
/* @__PURE__ */ a("div", { className: "mb-2 flex w-full items-center justify-between", children: [
|
|
231
|
-
/* @__PURE__ */ a(de, { className: "w-max", children: [
|
|
232
|
-
/* @__PURE__ */ a(T, { value: "edit", className: "flex items-center gap-1", children: [
|
|
233
|
-
/* @__PURE__ */ e(ue, { className: "h-4 w-4" }),
|
|
234
|
-
/* @__PURE__ */ e("span", { children: "Edit" })
|
|
235
|
-
] }),
|
|
236
|
-
/* @__PURE__ */ a(T, { value: "preview", className: "flex items-center gap-1", disabled: !h, children: [
|
|
237
|
-
/* @__PURE__ */ e(pe, { className: "h-4 w-4" }),
|
|
238
|
-
/* @__PURE__ */ e("span", { children: "Preview" })
|
|
239
|
-
] })
|
|
240
|
-
] }),
|
|
241
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: f === "edit" && /* @__PURE__ */ e(
|
|
242
|
-
p,
|
|
243
|
-
{
|
|
244
|
-
type: "button",
|
|
245
|
-
variant: "outline",
|
|
246
|
-
size: "sm",
|
|
247
|
-
onClick: () => i({ ...n, content: h }),
|
|
248
|
-
disabled: !h,
|
|
249
|
-
children: "Format"
|
|
250
|
-
}
|
|
251
|
-
) })
|
|
252
|
-
] }),
|
|
253
|
-
/* @__PURE__ */ a(L, { value: "edit", children: [
|
|
254
|
-
/* @__PURE__ */ e(
|
|
255
|
-
S,
|
|
256
|
-
{
|
|
257
|
-
id: "new-content",
|
|
258
|
-
value: n.content || "{}",
|
|
259
|
-
onChange: (s) => i({ ...n, content: s.target.value }),
|
|
260
|
-
className: "font-mono text-sm",
|
|
261
|
-
placeholder: "Enter JSON-LD markup...",
|
|
262
|
-
rows: 10
|
|
263
|
-
}
|
|
264
|
-
),
|
|
265
|
-
!h && n.content ? /* @__PURE__ */ e("p", { className: "pt-px text-xs text-red-500", children: "Invalid JSON-LD" }) : /* @__PURE__ */ e("p", {})
|
|
266
|
-
] }),
|
|
267
|
-
/* @__PURE__ */ e(L, { value: "preview", children: /* @__PURE__ */ e(
|
|
268
|
-
S,
|
|
269
|
-
{
|
|
270
|
-
id: "new-content",
|
|
271
|
-
value: h || "{}",
|
|
272
|
-
className: "bg-muted font-mono text-sm",
|
|
273
|
-
placeholder: "{}",
|
|
274
|
-
rows: 10,
|
|
275
|
-
readOnly: !0
|
|
276
|
-
}
|
|
277
|
-
) })
|
|
278
|
-
] })
|
|
279
|
-
] }),
|
|
280
|
-
l && /* @__PURE__ */ a("div", { className: "flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2", children: [
|
|
281
|
-
/* @__PURE__ */ a("div", { children: [
|
|
282
|
-
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-900", children: "Apply to All Existing Pages" }),
|
|
283
|
-
/* @__PURE__ */ e("div", { className: "text-xs text-blue-700", children: "This will add this JSON-LD schema to all existing pages on your site a" })
|
|
284
|
-
] }),
|
|
285
|
-
/* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
286
|
-
/* @__PURE__ */ e(
|
|
287
|
-
p,
|
|
288
|
-
{
|
|
289
|
-
size: "sm",
|
|
290
|
-
variant: "outline",
|
|
291
|
-
onClick: () => {
|
|
292
|
-
},
|
|
293
|
-
children: "Apply to all"
|
|
294
|
-
}
|
|
295
|
-
),
|
|
296
|
-
/* @__PURE__ */ e(
|
|
297
|
-
p,
|
|
298
|
-
{
|
|
299
|
-
size: "sm",
|
|
300
|
-
variant: "ghost",
|
|
301
|
-
onClick: () => {
|
|
302
|
-
},
|
|
303
|
-
children: "Remove to all"
|
|
304
|
-
}
|
|
305
|
-
)
|
|
306
|
-
] })
|
|
307
|
-
] }),
|
|
308
|
-
/* @__PURE__ */ a("div", { className: "flex items-center justify-between pt-2", children: [
|
|
309
|
-
/* @__PURE__ */ a("div", { className: "flex items-center space-x-2", children: [
|
|
310
|
-
/* @__PURE__ */ e(
|
|
311
|
-
k,
|
|
312
|
-
{
|
|
313
|
-
id: "new-enabled",
|
|
314
|
-
checked: n.enabledByDefaultForNewPages,
|
|
315
|
-
onCheckedChange: (s) => i({ ...n, enabledByDefaultForNewPages: s })
|
|
316
|
-
}
|
|
317
|
-
),
|
|
318
|
-
/* @__PURE__ */ a(b, { htmlFor: "new-enabled", children: [
|
|
319
|
-
/* @__PURE__ */ e("div", { children: "Enabled by default for new pages" }),
|
|
320
|
-
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: "New pages will automatically include this schema" })
|
|
321
|
-
] })
|
|
322
|
-
] }),
|
|
323
|
-
/* @__PURE__ */ a("div", { className: "flex gap-2", children: [
|
|
324
|
-
/* @__PURE__ */ e(p, { disabled: x, variant: "outline", type: "button", size: "sm", onClick: () => o(), children: "Cancel" }),
|
|
325
|
-
/* @__PURE__ */ e(p, { disabled: x || !h, type: "button", size: "sm", onClick: v, children: x ? /* @__PURE__ */ a(I, { children: [
|
|
326
|
-
/* @__PURE__ */ e(y, { className: "h-4 w-4 animate-spin" }),
|
|
327
|
-
" ",
|
|
328
|
-
l ? "Updating" : "Adding"
|
|
329
|
-
] }) : l ? "Update Schema" : "Add Schema" })
|
|
330
|
-
] })
|
|
331
|
-
] })
|
|
332
|
-
] })
|
|
333
|
-
] });
|
|
334
|
-
};
|
|
335
|
-
export {
|
|
336
|
-
Fe as default
|
|
337
|
-
};
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { useAtom as A } from "jotai";
|
|
2
|
-
import { useCallback as p } from "react";
|
|
3
|
-
import { isEmpty as i, uniq as S, union as y, flatMap as P, find as O, includes as q, filter as C } from "lodash-es";
|
|
4
|
-
import { q as F } from "./index-DFvsMFVH.js";
|
|
5
|
-
const M = F("expandedPagesState", []), m = (e) => P(e, (n) => [
|
|
6
|
-
n,
|
|
7
|
-
...n.children ? m(n.children) : []
|
|
8
|
-
]), T = (e, n) => {
|
|
9
|
-
const t = (s, o = []) => {
|
|
10
|
-
for (const r of s) {
|
|
11
|
-
const d = [...o, r.id];
|
|
12
|
-
if (r.id === n)
|
|
13
|
-
return d;
|
|
14
|
-
if (r.children && r.children.length > 0) {
|
|
15
|
-
const l = t(r.children, d);
|
|
16
|
-
if (l) return l;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
21
|
-
return t(e) || [];
|
|
22
|
-
}, x = (e, n) => {
|
|
23
|
-
if (!n) return [];
|
|
24
|
-
const t = m(e), s = O(t, (o) => o.id === n);
|
|
25
|
-
if (s) {
|
|
26
|
-
if (s.parent)
|
|
27
|
-
return [...x(e, s.parent), n];
|
|
28
|
-
const o = T(e, n);
|
|
29
|
-
if (!i(o))
|
|
30
|
-
return o;
|
|
31
|
-
}
|
|
32
|
-
return [n];
|
|
33
|
-
}, b = (e) => {
|
|
34
|
-
const n = /* @__PURE__ */ new Set(), t = (s, o = []) => {
|
|
35
|
-
s.forEach((r) => {
|
|
36
|
-
const d = [...o, r.id];
|
|
37
|
-
r.shouldExpandOnSearch && d.forEach((l) => n.add(l)), r.children && !i(r.children) && t(r.children, d);
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
return t(e), Array.from(n);
|
|
41
|
-
}, W = (e) => {
|
|
42
|
-
const [n, t] = A(M), s = e ? q(n, e) : !1, o = p(() => {
|
|
43
|
-
t(
|
|
44
|
-
(a) => s ? C(a, (c) => c !== e) : [...a, e]
|
|
45
|
-
);
|
|
46
|
-
}, [t, s, e]), r = p(
|
|
47
|
-
(a, c) => {
|
|
48
|
-
if (!c || i(a)) return;
|
|
49
|
-
const h = m(a), f = x(h, c);
|
|
50
|
-
if (!Array.isArray(f) || i(f)) return;
|
|
51
|
-
const u = f.slice(0, -1);
|
|
52
|
-
i(u) || t((E) => S([...E, ...u]));
|
|
53
|
-
},
|
|
54
|
-
[t]
|
|
55
|
-
), d = p(
|
|
56
|
-
(a) => {
|
|
57
|
-
if (i(a)) return;
|
|
58
|
-
const c = b(a);
|
|
59
|
-
i(c) || t((h) => y(h, c));
|
|
60
|
-
},
|
|
61
|
-
[t]
|
|
62
|
-
), l = p((a) => {
|
|
63
|
-
if (i(a)) return;
|
|
64
|
-
const c = P(a, (h) => {
|
|
65
|
-
const f = (u) => [u.id, ...u.children ? P(u.children, f) : []];
|
|
66
|
-
return f(h);
|
|
67
|
-
});
|
|
68
|
-
t(c);
|
|
69
|
-
}, [t]), g = p(() => {
|
|
70
|
-
t([]);
|
|
71
|
-
}, [t]);
|
|
72
|
-
return {
|
|
73
|
-
isExpanded: s,
|
|
74
|
-
toggleExpanded: o,
|
|
75
|
-
updateForSelectedPage: r,
|
|
76
|
-
expandedPages: n,
|
|
77
|
-
expandPagesOnSearch: d,
|
|
78
|
-
setExpandedPages: t,
|
|
79
|
-
expandAll: l,
|
|
80
|
-
collapseAll: g
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export {
|
|
84
|
-
W as u
|
|
85
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const m=require("jotai"),p=require("react"),n=require("lodash-es"),y=require("./index-Qnh8Lkr0.cjs"),A=y.atomWithStorage("expandedPagesState",[]),E=s=>n.flatMap(s,e=>[e,...e.children?E(e.children):[]]),S=(s,e)=>{const t=(a,i=[])=>{for(const r of a){const o=[...i,r.id];if(r.id===e)return o;if(r.children&&r.children.length>0){const d=t(r.children,o);if(d)return d}}return null};return t(s)||[]},P=(s,e)=>{if(!e)return[];const t=E(s),a=n.find(t,i=>i.id===e);if(a){if(a.parent)return[...P(s,a.parent),e];const i=S(s,e);if(!n.isEmpty(i))return i}return[e]},C=s=>{const e=new Set,t=(a,i=[])=>{a.forEach(r=>{const o=[...i,r.id];r.shouldExpandOnSearch&&o.forEach(d=>e.add(d)),r.children&&!n.isEmpty(r.children)&&t(r.children,o)})};return t(s),Array.from(e)},b=s=>{const[e,t]=m.useAtom(A),a=s?n.includes(e,s):!1,i=p.useCallback(()=>{t(c=>a?n.filter(c,l=>l!==s):[...c,s])},[t,a,s]),r=p.useCallback((c,l)=>{if(!l||n.isEmpty(c))return;const h=E(c),u=P(h,l);if(!Array.isArray(u)||n.isEmpty(u))return;const f=u.slice(0,-1);n.isEmpty(f)||t(g=>n.uniq([...g,...f]))},[t]),o=p.useCallback(c=>{if(n.isEmpty(c))return;const l=C(c);n.isEmpty(l)||t(h=>n.union(h,l))},[t]),d=p.useCallback(c=>{if(n.isEmpty(c))return;const l=n.flatMap(c,h=>{const u=f=>[f.id,...f.children?n.flatMap(f.children,u):[]];return u(h)});t(l)},[t]),x=p.useCallback(()=>{t([])},[t]);return{isExpanded:a,toggleExpanded:i,updateForSelectedPage:r,expandedPages:e,expandPagesOnSearch:o,setExpandedPages:t,expandAll:d,collapseAll:x}};exports.usePageExpandManager=b;
|