@chaibuilder/pages 0.15.3 → 0.15.6
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-o6FgGSqg.cjs → 2AITGKQY-BnzAO102.cjs} +1 -1
- package/dist/{2AITGKQY-DhC0sF1x.js → 2AITGKQY-tXLat8E2.js} +2 -2
- package/dist/{NCMVHL6D-D7HU3akD.js → NCMVHL6D-BwDANa-N.js} +2 -2
- package/dist/{NCMVHL6D-BPM6RHYa.cjs → NCMVHL6D-DooF4Fqf.cjs} +1 -1
- package/dist/{ZDWCUMSJ-Cr1v3giV.js → ZDWCUMSJ-DWeYRRkj.js} +1 -1
- package/dist/{ZDWCUMSJ-NVCxv9uE.cjs → ZDWCUMSJ-DiH9kc7o.cjs} +1 -1
- package/dist/add-new-language-page-BCUrfgTy.cjs +1 -0
- package/dist/add-new-language-page-DZhjVBBf.js +401 -0
- package/dist/add-new-page-DWHANcUx.cjs +1 -0
- package/dist/add-new-page-DYuuentN.js +31 -0
- package/dist/delete-page-1dSWwUBg.js +40 -0
- package/dist/delete-page-m-Cuz7rG.cjs +1 -0
- package/dist/digital-asset-manager-BWZlrwFf.js +913 -0
- package/dist/digital-asset-manager-By_JTIbb.cjs +1 -0
- package/dist/duplicate-page-Dzs8ya8l.cjs +1 -0
- package/dist/duplicate-page-fUuBTAs7.js +133 -0
- package/dist/{dynamic-page-selector-CF9nb6i_.cjs → dynamic-page-selector-CwhL4z6F.cjs} +1 -1
- package/dist/{dynamic-page-selector-DTk4oull.js → dynamic-page-selector-X2qgdiNQ.js} +1 -1
- package/dist/image-editor-CeSSNbFY.js +108 -0
- package/dist/image-editor-CnDnY97s.cjs +1 -0
- package/dist/index-0cMGDekp.cjs +5 -0
- package/dist/{index-BuXZJnGo.js → index-Bk8tPO5R.js} +1605 -1571
- package/dist/index.cjs +1 -1
- package/dist/index.js +8 -8
- package/dist/{json-diff-viewer-zBoPBSd3.cjs → json-diff-viewer-Cfa9BjZ6.cjs} +1 -1
- package/dist/{json-diff-viewer-oyxMD3Hc.js → json-diff-viewer-Cm84g19X.js} +1 -1
- package/dist/lang-panel-CaSKOJ8G.js +225 -0
- package/dist/lang-panel-CkSfJqr8.cjs +1 -0
- package/dist/mark-as-template-Ci82hbOm.cjs +1 -0
- package/dist/mark-as-template-CwsW86Zv.js +153 -0
- package/dist/no-language-page-content-CPt4aPy9.cjs +1 -0
- package/dist/no-language-page-content-DDz81nqg.js +42 -0
- package/dist/{page-creator-BG2hc82u.cjs → page-creator-Cd2LrG4u.cjs} +1 -1
- package/dist/{page-creator-y6kl3nw5.js → page-creator-Dr566_Yf.js} +2 -2
- package/dist/page-lock-request-Bw_Wye1t.cjs +1 -0
- package/dist/page-lock-request-ECxkQMdS.js +75 -0
- package/dist/page-locked-by-dialog-AbutJT_V.cjs +1 -0
- package/dist/page-locked-by-dialog-CnkVUpjt.js +68 -0
- package/dist/page-manager-new-DLMvOata.cjs +1 -0
- package/dist/page-manager-new-DkqNLZ5C.js +354 -0
- package/dist/page-manager-search-and-filter-B98nz9xS.js +201 -0
- package/dist/page-manager-search-and-filter-CfEfWFeo.cjs +1 -0
- package/dist/{page-revisions-content-BaTqBnko.js → page-revisions-content-CBQPYFZI.js} +18 -18
- package/dist/{page-revisions-content-Tb3T6zvU.cjs → page-revisions-content-D12GEp8C.cjs} +1 -1
- package/dist/{publish-pages-content-C9CgEWo0.js → publish-pages-content-BF5yMo_L.js} +6 -6
- package/dist/{publish-pages-content-BGkEZ3GK.cjs → publish-pages-content-LNCr9tKv.cjs} +1 -1
- package/dist/{save-to-lib-DNK4GPNw.cjs → save-to-lib-C1B6tWEF.cjs} +1 -1
- package/dist/{save-to-lib-DGtyTG6H.js → save-to-lib-SpilaoOL.js} +1 -1
- package/dist/{seo-panel-CrK7z4bR.cjs → seo-panel-DkgkJUT6.cjs} +1 -1
- package/dist/{seo-panel-DESVAQM5.js → seo-panel-sbYoo746.js} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +96 -96
- package/dist/shared-json-ld-CEUgLAev.cjs +1 -0
- package/dist/shared-json-ld-D_YyVPk3.js +565 -0
- package/dist/{slug-input-DMYhARDW.cjs → slug-input-Cqj9EBju.cjs} +1 -1
- package/dist/{slug-input-DfAsMPg8.js → slug-input-Df-BG6xl.js} +1 -1
- package/dist/theme-panel-footer-B6leVWSV.js +25 -0
- package/dist/theme-panel-footer-Ca1UF5DA.cjs +1 -0
- package/dist/unmark-as-template-BOE-nKOb.cjs +1 -0
- package/dist/unmark-as-template-Cho9B4RN.js +39 -0
- package/dist/unpublish-page-BcxxZ8pr.cjs +1 -0
- package/dist/unpublish-page-Dr4qbwUx.js +27 -0
- package/dist/{web-preview-DNgPjdgZ.js → web-preview-Cq82TNaS.js} +1 -1
- package/dist/{web-preview-BcULgiw_.cjs → web-preview-ued-fdxs.cjs} +1 -1
- package/package.json +3 -4
- package/dist/add-new-language-page-8q4Ku3eg.js +0 -390
- package/dist/add-new-language-page-D3PSLiUv.cjs +0 -1
- package/dist/add-new-page-BpvpSM4X.js +0 -30
- package/dist/add-new-page-YpzILOYq.cjs +0 -1
- package/dist/delete-page-CXRJjJ4o.js +0 -38
- package/dist/delete-page-w64MO7db.cjs +0 -1
- package/dist/digital-asset-manager-B2m5T22s.js +0 -1001
- package/dist/digital-asset-manager-BGyKKd_6.cjs +0 -1
- package/dist/duplicate-page-CSQs2MOp.js +0 -120
- package/dist/duplicate-page-DB_c7V2t.cjs +0 -1
- package/dist/image-editor-D9MPdtxC.js +0 -107
- package/dist/image-editor-Da6lrqkL.cjs +0 -1
- package/dist/index-Cds1vIhw.cjs +0 -5
- package/dist/lang-panel-B_HcsPPo.js +0 -218
- package/dist/lang-panel-D2YUMeJZ.cjs +0 -1
- package/dist/mark-as-template-C4wH4UKf.cjs +0 -1
- package/dist/mark-as-template-CPEPYXg7.js +0 -146
- package/dist/no-language-page-content-CVyOpT9h.js +0 -35
- package/dist/no-language-page-content-ECt0SxFX.cjs +0 -1
- package/dist/page-lock-request-DC62b588.js +0 -64
- package/dist/page-lock-request-fGZbOFTp.cjs +0 -1
- package/dist/page-locked-by-dialog-BIC-c0Jl.cjs +0 -1
- package/dist/page-locked-by-dialog-D-vXaoga.js +0 -63
- package/dist/page-manager-new-CUfjlMed.cjs +0 -1
- package/dist/page-manager-new-Cto2r7Va.js +0 -354
- package/dist/page-manager-search-and-filter-sVnGlF46.js +0 -197
- package/dist/page-manager-search-and-filter-z2b4sgvb.cjs +0 -1
- package/dist/shared-json-ld-BMfQzOWc.js +0 -650
- package/dist/shared-json-ld-_ozYsSHn.cjs +0 -1
- package/dist/theme-panel-footer-Bj2yHtxO.cjs +0 -1
- package/dist/theme-panel-footer-RrxiDGoD.js +0 -25
- package/dist/unmark-as-template-BjetSrYF.js +0 -38
- package/dist/unmark-as-template-C8hTjRVk.cjs +0 -1
- package/dist/unpublish-page-BTPEVAkv.js +0 -26
- package/dist/unpublish-page-gtGfNOAq.cjs +0 -1
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { useLanguages as me } from "@chaibuilder/sdk";
|
|
3
|
+
import { useQuery as he, useQueryClient as ue } from "@tanstack/react-query";
|
|
4
|
+
import { ak as ge, al as pe, A as U, ap as le, au as fe, av as te, aw as se, ax as re, ay as xe, az as Ne, aA as be, g as ye, aB as ve } from "./index-Bk8tPO5R.js";
|
|
5
|
+
import { Dialog as $, DialogContent as W, DialogHeader as Y, DialogTitle as X, Alert as we, AlertDescription as Ae, Label as y, Input as G, Button as v, AlertDialog as _, AlertDialogContent as R, AlertDialogHeader as M, AlertDialogTitle as q, AlertDialogDescription as H, AlertDialogFooter as Q, AlertDialogCancel as V, AlertDialogAction as K, Tooltip as E, TooltipTrigger as J, TooltipContent as O, ScrollArea as Ce, Card as Se, CardHeader as Pe, CardTitle as Te, AlertDialogTrigger as De, CardContent as Le, Textarea as Ee } from "@chaibuilder/sdk/ui";
|
|
6
|
+
import { filter as Je, find as Oe } from "lodash-es";
|
|
7
|
+
import { Info as Fe, Loader as F, Plus as ke, Eye as je, Edit as Ge, Trash as Be } from "lucide-react";
|
|
8
|
+
import { useState as g, useEffect as Z, useMemo as z } from "react";
|
|
9
|
+
import { toast as B } from "sonner";
|
|
10
|
+
const de = () => {
|
|
11
|
+
const l = ge(), i = pe();
|
|
12
|
+
return he({
|
|
13
|
+
queryKey: [U.GET_GLOBAL_JSONLD_ITEMS],
|
|
14
|
+
queryFn: async () => i(l, { action: U.GET_GLOBAL_JSONLD_ITEMS })
|
|
15
|
+
});
|
|
16
|
+
}, Ie = ({
|
|
17
|
+
show: l,
|
|
18
|
+
onClose: i,
|
|
19
|
+
initialData: a
|
|
20
|
+
}) => /* @__PURE__ */ e($, { open: l, onOpenChange: () => i(), children: l && /* @__PURE__ */ e(ze, { show: l, onClose: i, initialData: a }) }), ze = ({
|
|
21
|
+
show: l,
|
|
22
|
+
onClose: i,
|
|
23
|
+
initialData: a
|
|
24
|
+
}) => {
|
|
25
|
+
const [d, p] = g({
|
|
26
|
+
name: "",
|
|
27
|
+
content: "",
|
|
28
|
+
description: "",
|
|
29
|
+
enabledByDefaultForNewPages: !1
|
|
30
|
+
}), [x, P] = g(!1), { data: u } = le(), { mutateAsync: C, isPending: f } = fe(), { mutateAsync: c } = te(), w = ue();
|
|
31
|
+
Z(() => {
|
|
32
|
+
p(a ? {
|
|
33
|
+
name: a.name,
|
|
34
|
+
description: a.description,
|
|
35
|
+
content: JSON.stringify(a.jsonld, null, 2),
|
|
36
|
+
enabledByDefaultForNewPages: !1
|
|
37
|
+
} : { name: "", description: "", content: "", enabledByDefaultForNewPages: !1 }), P(!1);
|
|
38
|
+
}, [l, a]);
|
|
39
|
+
const o = async () => {
|
|
40
|
+
if (!d.name || !d.content) {
|
|
41
|
+
B.error("Please enter a name and content");
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const t = re(d.content);
|
|
45
|
+
if (!t.isValid) {
|
|
46
|
+
B.error("Invalid JSON-LD content");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const N = {
|
|
50
|
+
name: d.name,
|
|
51
|
+
jsonld: t.parsed,
|
|
52
|
+
addToExistingPages: x,
|
|
53
|
+
addToNewPages: d.enabledByDefaultForNewPages,
|
|
54
|
+
description: d.description
|
|
55
|
+
};
|
|
56
|
+
a != null && a.primaryPageId && (N.primaryPage = a.primaryPageId);
|
|
57
|
+
const A = await C(N);
|
|
58
|
+
u != null && u.id && (A != null && A.id) && !(a != null && a.primaryPageId) && (await c({
|
|
59
|
+
schemaId: A.id,
|
|
60
|
+
pageId: u.id,
|
|
61
|
+
enabled: !0
|
|
62
|
+
}), w.invalidateQueries({
|
|
63
|
+
queryKey: [U.GET_LANGUAGE_PAGES, u.id]
|
|
64
|
+
})), i();
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ n(W, { className: "flex max-w-xl flex-col overflow-y-auto", children: [
|
|
67
|
+
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(X, { children: "Add New Shared JSON-LD Schema" }) }),
|
|
68
|
+
/* @__PURE__ */ n("div", { className: "flex max-h-[75vh] flex-col space-y-2 overflow-y-auto", children: [
|
|
69
|
+
(a == null ? void 0 : a.languageCode) && /* @__PURE__ */ n(we, { className: "border-blue-200 bg-blue-50", children: [
|
|
70
|
+
/* @__PURE__ */ e(Fe, { className: "h-4 w-4 text-blue-600" }),
|
|
71
|
+
/* @__PURE__ */ n(Ae, { className: "text-sm text-blue-800", children: [
|
|
72
|
+
"You are creating a ",
|
|
73
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: a.languageCode }),
|
|
74
|
+
" language version of this schema. This will be linked to the default language schema."
|
|
75
|
+
] })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ n("div", { children: [
|
|
78
|
+
/* @__PURE__ */ e(y, { htmlFor: "new-name", children: "Schema Name" }),
|
|
79
|
+
/* @__PURE__ */ e(
|
|
80
|
+
G,
|
|
81
|
+
{
|
|
82
|
+
id: "new-name",
|
|
83
|
+
value: d.name,
|
|
84
|
+
onChange: (t) => p({ ...d, name: t.target.value }),
|
|
85
|
+
placeholder: "e.g., Product Schema",
|
|
86
|
+
className: "text-xs"
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
] }),
|
|
90
|
+
/* @__PURE__ */ n("div", { children: [
|
|
91
|
+
/* @__PURE__ */ e(y, { htmlFor: "new-description", children: "Description" }),
|
|
92
|
+
/* @__PURE__ */ e(
|
|
93
|
+
G,
|
|
94
|
+
{
|
|
95
|
+
id: "new-description",
|
|
96
|
+
value: d.description || "",
|
|
97
|
+
onChange: (t) => p({ ...d, description: t.target.value }),
|
|
98
|
+
placeholder: "Brief description of this schema"
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] }),
|
|
102
|
+
/* @__PURE__ */ n("div", { children: [
|
|
103
|
+
/* @__PURE__ */ e(y, { htmlFor: "new-content", children: "JSON-LD Content" }),
|
|
104
|
+
/* @__PURE__ */ e(
|
|
105
|
+
se,
|
|
106
|
+
{
|
|
107
|
+
id: "new-content",
|
|
108
|
+
value: d.content || "{}",
|
|
109
|
+
onChange: (t) => p({ ...d, content: t }),
|
|
110
|
+
placeholder: "Enter JSON-LD markup...",
|
|
111
|
+
rows: 10
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }),
|
|
115
|
+
!(a != null && a.primaryPageId) && /* @__PURE__ */ n("div", { className: "flex flex-col gap-3 pt-2", children: [
|
|
116
|
+
/* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
|
|
117
|
+
/* @__PURE__ */ e(
|
|
118
|
+
"input",
|
|
119
|
+
{
|
|
120
|
+
type: "checkbox",
|
|
121
|
+
id: "add-to-all-existing",
|
|
122
|
+
checked: x,
|
|
123
|
+
onChange: (t) => P(t.target.checked),
|
|
124
|
+
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ n(y, { htmlFor: "add-to-all-existing", children: [
|
|
128
|
+
/* @__PURE__ */ e("div", { children: "Add to all existing pages" }),
|
|
129
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: "This schema will be added to all existing pages on your site" })
|
|
130
|
+
] })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
|
|
133
|
+
/* @__PURE__ */ e(
|
|
134
|
+
"input",
|
|
135
|
+
{
|
|
136
|
+
type: "checkbox",
|
|
137
|
+
id: "new-enabled",
|
|
138
|
+
checked: d.enabledByDefaultForNewPages,
|
|
139
|
+
onChange: (t) => p({ ...d, enabledByDefaultForNewPages: t.target.checked }),
|
|
140
|
+
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ n(y, { htmlFor: "new-enabled", children: [
|
|
144
|
+
/* @__PURE__ */ e("div", { children: "Enabled by default for new pages" }),
|
|
145
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: "New pages will automatically include this schema" })
|
|
146
|
+
] })
|
|
147
|
+
] })
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ e("div", { className: "border-t pt-3", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2", children: [
|
|
150
|
+
/* @__PURE__ */ e(v, { disabled: f, variant: "outline", type: "button", size: "sm", onClick: () => i(), children: "Cancel" }),
|
|
151
|
+
/* @__PURE__ */ e(v, { disabled: f, type: "button", size: "sm", onClick: o, children: f ? /* @__PURE__ */ n(j, { children: [
|
|
152
|
+
/* @__PURE__ */ e(F, { className: "h-4 w-4 animate-spin" }),
|
|
153
|
+
" Adding"
|
|
154
|
+
] }) : /* @__PURE__ */ n(j, { children: [
|
|
155
|
+
"Add Schema",
|
|
156
|
+
(a == null ? void 0 : a.languageCode) && ` (${a.languageCode})`
|
|
157
|
+
] }) })
|
|
158
|
+
] }) })
|
|
159
|
+
] })
|
|
160
|
+
] });
|
|
161
|
+
}, Ue = ({ id: l, onClose: i }) => /* @__PURE__ */ e($, { open: !!l, onOpenChange: () => i(), children: l && /* @__PURE__ */ e(_e, { id: l, onClose: i }) }), _e = ({ id: l, onClose: i }) => {
|
|
162
|
+
const [a, d] = g({
|
|
163
|
+
name: "",
|
|
164
|
+
content: "",
|
|
165
|
+
description: "",
|
|
166
|
+
enabledByDefaultForNewPages: !1
|
|
167
|
+
}), [p, x] = g(!1), [P, u] = g(!1), [C, f] = g(!1), { data: c } = de(), { mutateAsync: w, isPending: o } = xe(), { mutateAsync: t } = Ne(), { mutateAsync: N } = be();
|
|
168
|
+
Z(() => {
|
|
169
|
+
var m, D;
|
|
170
|
+
if (l && c) {
|
|
171
|
+
const b = c.find((L) => L.id === l);
|
|
172
|
+
b && (d({
|
|
173
|
+
name: b.name,
|
|
174
|
+
description: ((m = b.metadata) == null ? void 0 : m.description) || "",
|
|
175
|
+
content: JSON.stringify(b.jsonld, null, 2),
|
|
176
|
+
enabledByDefaultForNewPages: ((D = b.metadata) == null ? void 0 : D.addToNewPages) || !1
|
|
177
|
+
}), f(!!b.primaryPage));
|
|
178
|
+
}
|
|
179
|
+
}, [l, c]);
|
|
180
|
+
const A = async () => {
|
|
181
|
+
if (!a.name || !a.content) {
|
|
182
|
+
B.error("Please enter a name and content");
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
const m = re(a.content);
|
|
186
|
+
if (!m.isValid) {
|
|
187
|
+
B.error("Invalid JSON-LD content");
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const D = {
|
|
191
|
+
id: l,
|
|
192
|
+
name: a.name,
|
|
193
|
+
jsonld: m.parsed,
|
|
194
|
+
addToNewPages: a.enabledByDefaultForNewPages,
|
|
195
|
+
description: a.description
|
|
196
|
+
};
|
|
197
|
+
await w(D), i();
|
|
198
|
+
}, I = async () => {
|
|
199
|
+
try {
|
|
200
|
+
await t(l);
|
|
201
|
+
} finally {
|
|
202
|
+
x(!1);
|
|
203
|
+
}
|
|
204
|
+
}, T = async () => {
|
|
205
|
+
try {
|
|
206
|
+
await N(l);
|
|
207
|
+
} finally {
|
|
208
|
+
u(!1);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
return /* @__PURE__ */ n(W, { className: "flex max-w-xl flex-col overflow-y-auto", children: [
|
|
212
|
+
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(X, { children: "Edit Shared JSON-LD Schema" }) }),
|
|
213
|
+
/* @__PURE__ */ n("div", { className: "flex max-h-[75vh] flex-col space-y-2 overflow-y-auto", children: [
|
|
214
|
+
!C && /* @__PURE__ */ n("div", { className: "flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2", children: [
|
|
215
|
+
/* @__PURE__ */ n("div", { children: [
|
|
216
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium text-blue-900", children: "Manage Existing Pages" }),
|
|
217
|
+
/* @__PURE__ */ e("div", { className: "text-xs text-blue-700", children: "Add or remove this schema from all existing pages on your site" })
|
|
218
|
+
] }),
|
|
219
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
220
|
+
/* @__PURE__ */ e(v, { size: "sm", className: "text-xs", variant: "outline", onClick: () => x(!0), children: "Add to all existing" }),
|
|
221
|
+
/* @__PURE__ */ e(v, { size: "sm", variant: "ghost", className: "text-xs", onClick: () => u(!0), children: "Remove from all" })
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ n("div", { children: [
|
|
225
|
+
/* @__PURE__ */ e(y, { htmlFor: "edit-name", children: "Schema Name" }),
|
|
226
|
+
/* @__PURE__ */ e(
|
|
227
|
+
G,
|
|
228
|
+
{
|
|
229
|
+
id: "edit-name",
|
|
230
|
+
value: a.name,
|
|
231
|
+
onChange: (m) => d({ ...a, name: m.target.value }),
|
|
232
|
+
placeholder: "e.g., Product Schema",
|
|
233
|
+
className: "text-xs"
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] }),
|
|
237
|
+
/* @__PURE__ */ n("div", { children: [
|
|
238
|
+
/* @__PURE__ */ e(y, { htmlFor: "edit-description", children: "Description" }),
|
|
239
|
+
/* @__PURE__ */ e(
|
|
240
|
+
G,
|
|
241
|
+
{
|
|
242
|
+
id: "edit-description",
|
|
243
|
+
value: a.description || "",
|
|
244
|
+
onChange: (m) => d({ ...a, description: m.target.value }),
|
|
245
|
+
placeholder: "Brief description of this schema"
|
|
246
|
+
}
|
|
247
|
+
)
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ n("div", { children: [
|
|
250
|
+
/* @__PURE__ */ e(y, { htmlFor: "edit-content", children: "JSON-LD Content" }),
|
|
251
|
+
/* @__PURE__ */ e(
|
|
252
|
+
se,
|
|
253
|
+
{
|
|
254
|
+
id: "edit-content",
|
|
255
|
+
value: a.content || "{}",
|
|
256
|
+
onChange: (m) => d({ ...a, content: m }),
|
|
257
|
+
placeholder: "Enter JSON-LD markup...",
|
|
258
|
+
rows: 10
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
] }),
|
|
262
|
+
!C && /* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
|
|
263
|
+
/* @__PURE__ */ e(
|
|
264
|
+
"input",
|
|
265
|
+
{
|
|
266
|
+
type: "checkbox",
|
|
267
|
+
id: "edit-enabled",
|
|
268
|
+
checked: a.enabledByDefaultForNewPages,
|
|
269
|
+
onChange: (m) => d({ ...a, enabledByDefaultForNewPages: m.target.checked }),
|
|
270
|
+
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
271
|
+
}
|
|
272
|
+
),
|
|
273
|
+
/* @__PURE__ */ n(y, { htmlFor: "edit-enabled", children: [
|
|
274
|
+
/* @__PURE__ */ e("div", { children: "Enabled by default for new pages" }),
|
|
275
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-light text-muted-foreground", children: "New pages will automatically include this schema" })
|
|
276
|
+
] })
|
|
277
|
+
] }),
|
|
278
|
+
/* @__PURE__ */ e("div", { className: "border-t pt-3", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-end gap-2", children: [
|
|
279
|
+
/* @__PURE__ */ e(v, { disabled: o, variant: "outline", type: "button", size: "sm", onClick: () => i(), children: "Cancel" }),
|
|
280
|
+
/* @__PURE__ */ e(v, { disabled: o, type: "button", size: "sm", onClick: A, children: o ? /* @__PURE__ */ n(j, { children: [
|
|
281
|
+
/* @__PURE__ */ e(F, { className: "h-4 w-4 animate-spin" }),
|
|
282
|
+
" Updating"
|
|
283
|
+
] }) : "Update Schema" })
|
|
284
|
+
] }) })
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ e(_, { open: p, onOpenChange: x, children: /* @__PURE__ */ n(R, { children: [
|
|
287
|
+
/* @__PURE__ */ n(M, { children: [
|
|
288
|
+
/* @__PURE__ */ e(q, { children: "Add to All Existing Pages?" }),
|
|
289
|
+
/* @__PURE__ */ n(H, { children: [
|
|
290
|
+
"This will add the schema ",
|
|
291
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: a.name }),
|
|
292
|
+
" to all existing pages on your site. This action cannot be undone automatically."
|
|
293
|
+
] })
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ n(Q, { children: [
|
|
296
|
+
/* @__PURE__ */ e(V, { children: "Cancel" }),
|
|
297
|
+
/* @__PURE__ */ e(K, { onClick: I, children: "Add to All" })
|
|
298
|
+
] })
|
|
299
|
+
] }) }),
|
|
300
|
+
/* @__PURE__ */ e(_, { open: P, onOpenChange: u, children: /* @__PURE__ */ n(R, { children: [
|
|
301
|
+
/* @__PURE__ */ n(M, { children: [
|
|
302
|
+
/* @__PURE__ */ e(q, { children: "Remove from All Pages?" }),
|
|
303
|
+
/* @__PURE__ */ n(H, { children: [
|
|
304
|
+
"This will remove the schema ",
|
|
305
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: a.name }),
|
|
306
|
+
" from all existing pages on your site. This action cannot be undone automatically."
|
|
307
|
+
] })
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ n(Q, { children: [
|
|
310
|
+
/* @__PURE__ */ e(V, { children: "Cancel" }),
|
|
311
|
+
/* @__PURE__ */ e(K, { onClick: T, className: "bg-red-500 hover:bg-red-600", children: "Remove from All" })
|
|
312
|
+
] })
|
|
313
|
+
] }) })
|
|
314
|
+
] });
|
|
315
|
+
};
|
|
316
|
+
function Xe() {
|
|
317
|
+
const [l, i] = g(!1), [a, d] = g(void 0), [p, x] = g(null), [P, u] = g(null), [C, f] = g(null), { data: c, isLoading: w } = de(), { selectedLang: o } = me(), { data: t } = le(), { data: N } = ye(), { mutateAsync: A } = ve(), { mutateAsync: I } = te(), T = z(() => N == null ? void 0 : N.find((s) => !s.primaryPage && s.lang === ""), [N]), m = z(() => (T == null ? void 0 : T.globalJsonLds) || [], [T]), D = z(() => c ? Je(c, (r) => r.primaryPage === null && r.lang === "").map((r) => {
|
|
318
|
+
const h = o ? Oe(c, (S) => S.primaryPage === r.id && S.lang === o) : null;
|
|
319
|
+
return {
|
|
320
|
+
defaultSchema: r,
|
|
321
|
+
languageVersion: h,
|
|
322
|
+
// Use language version if available, otherwise use default
|
|
323
|
+
displayItem: h || r,
|
|
324
|
+
hasLanguageVersion: !!h
|
|
325
|
+
};
|
|
326
|
+
}) : [], [c, o]), [b, L] = g([]), k = b.length > 0 ? b : (t == null ? void 0 : t.globalJsonLds) || [];
|
|
327
|
+
Z(() => {
|
|
328
|
+
t != null && t.globalJsonLds && L(t.globalJsonLds);
|
|
329
|
+
}, [t == null ? void 0 : t.globalJsonLds]);
|
|
330
|
+
const oe = async (s) => {
|
|
331
|
+
if (!(t != null && t.id)) return;
|
|
332
|
+
f(s);
|
|
333
|
+
const r = k.includes(s), h = r ? k.filter((S) => S !== s) : [...k, s];
|
|
334
|
+
L(h);
|
|
335
|
+
try {
|
|
336
|
+
await I({
|
|
337
|
+
schemaId: s,
|
|
338
|
+
pageId: t.id,
|
|
339
|
+
enabled: !r
|
|
340
|
+
});
|
|
341
|
+
} catch {
|
|
342
|
+
L(t.globalJsonLds);
|
|
343
|
+
} finally {
|
|
344
|
+
f(null);
|
|
345
|
+
}
|
|
346
|
+
}, ie = async (s) => {
|
|
347
|
+
f(s);
|
|
348
|
+
try {
|
|
349
|
+
await A(s);
|
|
350
|
+
} finally {
|
|
351
|
+
f(null);
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
return /* @__PURE__ */ n("div", { className: "rounded border bg-muted p-2", children: [
|
|
355
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between pb-2", children: [
|
|
356
|
+
/* @__PURE__ */ n("div", { children: [
|
|
357
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-medium", children: "Shared JSON-LD Templates" }),
|
|
358
|
+
/* @__PURE__ */ e("div", { className: "w-full text-xs text-gray-500", children: "Manage reusable JSON-LD schemas that can be applied across multiple pages" })
|
|
359
|
+
] }),
|
|
360
|
+
!o && /* @__PURE__ */ n(E, { delayDuration: 0, children: [
|
|
361
|
+
/* @__PURE__ */ e(
|
|
362
|
+
J,
|
|
363
|
+
{
|
|
364
|
+
type: "button",
|
|
365
|
+
disabled: w,
|
|
366
|
+
className: "rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",
|
|
367
|
+
onClick: (s) => {
|
|
368
|
+
s.stopPropagation(), i(!0);
|
|
369
|
+
},
|
|
370
|
+
children: w ? /* @__PURE__ */ e(F, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(ke, { className: "h-4 w-4" })
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
/* @__PURE__ */ e(O, { children: "Add new schema" })
|
|
374
|
+
] })
|
|
375
|
+
] }),
|
|
376
|
+
/* @__PURE__ */ n(Ce, { className: "max-h-96 overflow-y-auto", children: [
|
|
377
|
+
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
378
|
+
(!c || (c == null ? void 0 : c.length) === 0) && !w && /* @__PURE__ */ e("div", { className: "flex items-center justify-center px-2 py-4 text-xs", children: "No shared JSON-LD found" }),
|
|
379
|
+
D.map(({ defaultSchema: s, displayItem: r, hasLanguageVersion: h }) => {
|
|
380
|
+
var ne, ae;
|
|
381
|
+
const S = k.includes(r.id), ee = m.includes(s.id), ce = h && o ? ee : S;
|
|
382
|
+
return /* @__PURE__ */ n(
|
|
383
|
+
Se,
|
|
384
|
+
{
|
|
385
|
+
className: `relative border-gray-300 p-0 shadow-none transition-all ${C === r.id ? "pointer-events-none" : ""}`,
|
|
386
|
+
children: [
|
|
387
|
+
C === r.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(F, { className: "h-5 w-5 animate-spin text-primary" }) }),
|
|
388
|
+
/* @__PURE__ */ e(Pe, { className: "p-2", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
389
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: [
|
|
390
|
+
(h || !o) && /* @__PURE__ */ n(E, { delayDuration: 0, children: [
|
|
391
|
+
/* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(
|
|
392
|
+
"input",
|
|
393
|
+
{
|
|
394
|
+
type: "checkbox",
|
|
395
|
+
checked: ce,
|
|
396
|
+
onChange: () => oe(s.id),
|
|
397
|
+
disabled: !!(h && o),
|
|
398
|
+
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
399
|
+
}
|
|
400
|
+
) }),
|
|
401
|
+
h && o && /* @__PURE__ */ e(O, { children: "Using the default language state" })
|
|
402
|
+
] }),
|
|
403
|
+
/* @__PURE__ */ n("div", { children: [
|
|
404
|
+
/* @__PURE__ */ n(Te, { className: "flex items-center gap-2 text-sm leading-none", children: [
|
|
405
|
+
r.name,
|
|
406
|
+
h && o && /* @__PURE__ */ n("span", { className: "text-xs font-normal text-muted-foreground", children: [
|
|
407
|
+
"(",
|
|
408
|
+
o,
|
|
409
|
+
")"
|
|
410
|
+
] })
|
|
411
|
+
] }),
|
|
412
|
+
((ne = r == null ? void 0 : r.metadata) == null ? void 0 : ne.description) && /* @__PURE__ */ e("p", { className: "mt-1 text-xs leading-none text-muted-foreground", children: (ae = r == null ? void 0 : r.metadata) == null ? void 0 : ae.description })
|
|
413
|
+
] })
|
|
414
|
+
] }),
|
|
415
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
416
|
+
/* @__PURE__ */ e("div", { className: "mx-2 h-6 w-px bg-border" }),
|
|
417
|
+
/* @__PURE__ */ n(E, { delayDuration: 0, children: [
|
|
418
|
+
/* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(
|
|
419
|
+
v,
|
|
420
|
+
{
|
|
421
|
+
type: "button",
|
|
422
|
+
variant: "ghost",
|
|
423
|
+
size: "icon",
|
|
424
|
+
className: "h-5 w-5 p-0",
|
|
425
|
+
onClick: () => u(r.id),
|
|
426
|
+
children: /* @__PURE__ */ e(je, { className: "h-4 w-4" })
|
|
427
|
+
}
|
|
428
|
+
) }),
|
|
429
|
+
/* @__PURE__ */ e(O, { children: "View schema" })
|
|
430
|
+
] }),
|
|
431
|
+
(h || !o) && /* @__PURE__ */ n(j, { children: [
|
|
432
|
+
/* @__PURE__ */ n(E, { delayDuration: 0, children: [
|
|
433
|
+
/* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(
|
|
434
|
+
v,
|
|
435
|
+
{
|
|
436
|
+
type: "button",
|
|
437
|
+
variant: "ghost",
|
|
438
|
+
size: "icon",
|
|
439
|
+
className: "h-5 w-5 p-0",
|
|
440
|
+
onClick: () => x(r.id),
|
|
441
|
+
children: /* @__PURE__ */ e(Ge, { className: "h-4 w-4" })
|
|
442
|
+
}
|
|
443
|
+
) }),
|
|
444
|
+
/* @__PURE__ */ e(O, { children: "Edit schema" })
|
|
445
|
+
] }),
|
|
446
|
+
/* @__PURE__ */ n(_, { children: [
|
|
447
|
+
/* @__PURE__ */ n(E, { delayDuration: 0, children: [
|
|
448
|
+
/* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(De, { 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(Be, { className: "h-4 w-4" }) }) }),
|
|
449
|
+
/* @__PURE__ */ e(O, { children: "Delete schema" })
|
|
450
|
+
] }),
|
|
451
|
+
/* @__PURE__ */ n(R, { children: [
|
|
452
|
+
/* @__PURE__ */ n(M, { children: [
|
|
453
|
+
/* @__PURE__ */ e(q, { children: "Delete Schema" }),
|
|
454
|
+
/* @__PURE__ */ n(H, { children: [
|
|
455
|
+
"Are you sure you want to delete",
|
|
456
|
+
" ",
|
|
457
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: r.name }),
|
|
458
|
+
"? This action cannot be undone."
|
|
459
|
+
] })
|
|
460
|
+
] }),
|
|
461
|
+
/* @__PURE__ */ n(Q, { children: [
|
|
462
|
+
/* @__PURE__ */ e(V, { type: "button", children: "Cancel" }),
|
|
463
|
+
/* @__PURE__ */ e(
|
|
464
|
+
K,
|
|
465
|
+
{
|
|
466
|
+
type: "button",
|
|
467
|
+
onClick: () => ie(r.id),
|
|
468
|
+
className: "bg-red-500 text-white hover:bg-red-600",
|
|
469
|
+
children: "Delete"
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
] })
|
|
473
|
+
] })
|
|
474
|
+
] })
|
|
475
|
+
] })
|
|
476
|
+
] })
|
|
477
|
+
] }) }),
|
|
478
|
+
!h && o && /* @__PURE__ */ e(Le, { className: "px-2 pb-2", children: /* @__PURE__ */ n("div", { className: "flex w-full flex-col items-center justify-center rounded-lg border bg-gray-100 py-3", children: [
|
|
479
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
480
|
+
/* @__PURE__ */ n("div", { className: "max-w-xl text-center text-xs text-gray-500", children: [
|
|
481
|
+
"Not available in '",
|
|
482
|
+
o,
|
|
483
|
+
"' language. Default language JSONLD will be used."
|
|
484
|
+
] }),
|
|
485
|
+
ee && /* @__PURE__ */ e("span", { className: "rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: "Enabled in default" })
|
|
486
|
+
] }),
|
|
487
|
+
/* @__PURE__ */ e(
|
|
488
|
+
v,
|
|
489
|
+
{
|
|
490
|
+
type: "button",
|
|
491
|
+
size: "sm",
|
|
492
|
+
variant: "outline",
|
|
493
|
+
className: "mt-2",
|
|
494
|
+
onClick: () => {
|
|
495
|
+
d({
|
|
496
|
+
name: s.name,
|
|
497
|
+
description: s.description || "",
|
|
498
|
+
jsonld: s.jsonld,
|
|
499
|
+
languageCode: o,
|
|
500
|
+
primaryPageId: s.id
|
|
501
|
+
}), i(!0);
|
|
502
|
+
},
|
|
503
|
+
children: "Copy & Edit from default language"
|
|
504
|
+
}
|
|
505
|
+
)
|
|
506
|
+
] }) })
|
|
507
|
+
]
|
|
508
|
+
},
|
|
509
|
+
s.id
|
|
510
|
+
);
|
|
511
|
+
})
|
|
512
|
+
] }),
|
|
513
|
+
w && /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e(F, { className: "h-5 w-5 animate-spin" }) })
|
|
514
|
+
] }),
|
|
515
|
+
/* @__PURE__ */ e(
|
|
516
|
+
Ie,
|
|
517
|
+
{
|
|
518
|
+
show: l,
|
|
519
|
+
onClose: () => {
|
|
520
|
+
i(!1), d(void 0);
|
|
521
|
+
},
|
|
522
|
+
initialData: a
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
/* @__PURE__ */ e(Ue, { id: p, onClose: () => x(null) }),
|
|
526
|
+
/* @__PURE__ */ e(
|
|
527
|
+
Re,
|
|
528
|
+
{
|
|
529
|
+
schema: c == null ? void 0 : c.find((s) => s.id === P),
|
|
530
|
+
onClose: () => u(null)
|
|
531
|
+
}
|
|
532
|
+
)
|
|
533
|
+
] });
|
|
534
|
+
}
|
|
535
|
+
const Re = ({ schema: l, onClose: i }) => /* @__PURE__ */ e($, { open: !!l, onOpenChange: i, children: /* @__PURE__ */ n(W, { className: "max-w-2xl", children: [
|
|
536
|
+
/* @__PURE__ */ e(Y, { children: /* @__PURE__ */ n(X, { className: "flex items-center gap-2", children: [
|
|
537
|
+
l == null ? void 0 : l.name,
|
|
538
|
+
(l == null ? void 0 : l.lang) && /* @__PURE__ */ n("span", { className: "text-sm font-normal text-muted-foreground", children: [
|
|
539
|
+
"(",
|
|
540
|
+
l.lang,
|
|
541
|
+
")"
|
|
542
|
+
] })
|
|
543
|
+
] }) }),
|
|
544
|
+
/* @__PURE__ */ n("div", { className: "space-y-3", children: [
|
|
545
|
+
(l == null ? void 0 : l.description) && /* @__PURE__ */ n("div", { children: [
|
|
546
|
+
/* @__PURE__ */ e("div", { className: "text-xs font-medium text-muted-foreground", children: "Description" }),
|
|
547
|
+
/* @__PURE__ */ e("div", { className: "text-sm", children: l.description })
|
|
548
|
+
] }),
|
|
549
|
+
/* @__PURE__ */ n("div", { children: [
|
|
550
|
+
/* @__PURE__ */ e("div", { className: "mb-2 text-xs font-medium text-muted-foreground", children: "JSON-LD Schema" }),
|
|
551
|
+
/* @__PURE__ */ e(
|
|
552
|
+
Ee,
|
|
553
|
+
{
|
|
554
|
+
value: JSON.stringify(l == null ? void 0 : l.jsonld, null, 2),
|
|
555
|
+
readOnly: !0,
|
|
556
|
+
className: "font-mono text-xs",
|
|
557
|
+
rows: 15
|
|
558
|
+
}
|
|
559
|
+
)
|
|
560
|
+
] })
|
|
561
|
+
] })
|
|
562
|
+
] }) });
|
|
563
|
+
export {
|
|
564
|
+
Xe as default
|
|
565
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),u=require("./index-0cMGDekp.cjs"),b=require("@chaibuilder/sdk/ui"),d=require("react"),j=e=>{if(!e)return{base:e,extension:null};const n=e.lastIndexOf(".");if(n<=0)return{base:e,extension:null};const t=e.substring(n);return{base:e.substring(0,n),extension:t}},x=e=>{if(!e)return e;const{base:n}=j(e);return n};function E(e,n){const t=(e||"").split("/").filter(Boolean);let r="",a=!0;if(n.slug==="/"){const i=t.pop()||"";if(u.LANGUAGES[i])a=!0;else{r=i;const l=t.pop()||"";a=!!u.LANGUAGES[l]}}else if(n.parent)t.length&&(r=t.pop()||"");else if(t.length){r=t.pop()||"";const i=t.pop()||"";a=!!u.LANGUAGES[i]}return{initSlug:r,prefix:a}}const v=e=>e&&x(e),C=(e,n)=>{const t=x(e||"");return!t||t==="/"?`/${n}`:`${t}/${n}`};function A({value:e,onChange:n,placeholder:t,parentSlug:r,onValidationChange:a,disabled:i=!1,fullSlug:l}){const[g,p]=d.useState(e),[o,f]=d.useState(null);d.useEffect(()=>{p(e)},[e]);const h=S=>{const c=S.target.value.replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),m=(c.match(/\./g)||[]).length,N=m<=1;m>1?f("Invalid slug. Only one dot (.) is allowed in the slug"):f(null),a&&a(N),p(c),n(c)};return s.jsxs("div",{children:[r&&s.jsx("div",{className:"mb-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Parent: ",s.jsx("span",{className:"font-mono text-gray-900",children:v(r)})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(b.Input,{disabled:i,value:g,onChange:h,placeholder:t,className:o?"border-red-500":""}),o&&s.jsx("div",{className:"mt-1 text-xs text-red-500",children:o})]}),l&&l!=="undefined"&&s.jsx("div",{className:"mt-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Complete Slug: ",s.jsx("span",{className:"font-mono text-gray-900",children:l})]})})]})}exports.SlugInput=A;exports.combineParentChildSlugs=C;exports.parseSlugForEdit=E;exports.removeSlugExtension=x;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as i, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { L as d } from "./index-
|
|
2
|
+
import { L as d } from "./index-Bk8tPO5R.js";
|
|
3
3
|
import { Input as v } from "@chaibuilder/sdk/ui";
|
|
4
4
|
import { useState as x, useEffect as C } from "react";
|
|
5
5
|
const y = (e) => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { u, a as d, t as h } from "./index-Bk8tPO5R.js";
|
|
3
|
+
import { useTheme as b, useTranslation as g } from "@chaibuilder/sdk";
|
|
4
|
+
import { Button as o } from "@chaibuilder/sdk/ui";
|
|
5
|
+
const x = () => {
|
|
6
|
+
const [e] = b(), { mutate: r, isPending: s } = u(), { mutateAsync: t, isPending: i } = d(), { t: n } = g(), l = () => {
|
|
7
|
+
t({ settings: { theme: e } });
|
|
8
|
+
}, m = async () => {
|
|
9
|
+
await t({ settings: { theme: e } }), r(
|
|
10
|
+
{ ids: ["THEME"] },
|
|
11
|
+
{
|
|
12
|
+
onSuccess: () => {
|
|
13
|
+
h("BOTTOM_RIGHT");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ c("div", { className: "flex items-center justify-center gap-x-3 border-t bg-white py-3", children: [
|
|
19
|
+
/* @__PURE__ */ a(o, { size: "sm", variant: "outline", disabled: s || i, onClick: l, children: n("Save draft") }),
|
|
20
|
+
/* @__PURE__ */ a(o, { size: "sm", disabled: s || i, onClick: m, children: n("Publish") })
|
|
21
|
+
] });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
x as default
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-0cMGDekp.cjs"),o=require("@chaibuilder/sdk"),r=require("@chaibuilder/sdk/ui"),h=()=>{const[t]=o.useTheme(),{mutate:c,isPending:i}=s.usePublishPages(),{mutateAsync:n,isPending:u}=s.useUpdateWebsiteSettings(),{t:a}=o.useTranslation(),l=()=>{n({settings:{theme:t}})},d=async()=>{await n({settings:{theme:t}}),c({ids:["THEME"]},{onSuccess:()=>{s.throwConfetti("BOTTOM_RIGHT")}})};return e.jsxs("div",{className:"flex items-center justify-center gap-x-3 border-t bg-white py-3",children:[e.jsx(r.Button,{size:"sm",variant:"outline",disabled:i||u,onClick:l,children:a("Save draft")}),e.jsx(r.Button,{size:"sm",disabled:i||u,onClick:d,children:a("Publish")})]})};exports.default=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-0cMGDekp.cjs"),d=require("@chaibuilder/sdk"),t=require("@chaibuilder/sdk/ui"),m=require("react"),p=({page:i,onClose:n})=>{const{t:a}=d.useTranslation(),[r,s]=m.useState(!1),o=u.useUnmarkAsTemplate(),l=()=>{s(!0),o.mutate(i,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:c=>{c.stopPropagation(),n()},children:a("Cancel")}),e.jsx(t.Button,{variant:"default",disabled:r,onClick:l,children:a("Unmark as template")})]})]})})};exports.default=p;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { o as p } from "./index-Bk8tPO5R.js";
|
|
3
|
+
import { useTranslation as u } from "@chaibuilder/sdk";
|
|
4
|
+
import { Dialog as d, DialogContent as g, DialogHeader as h, DialogTitle as f, DialogDescription as k, DialogFooter as D, Button as s } from "@chaibuilder/sdk/ui";
|
|
5
|
+
import { useState as x } from "react";
|
|
6
|
+
const C = ({ page: i, onClose: a }) => {
|
|
7
|
+
const { t } = u(), [r, n] = x(!1), l = p(), m = () => {
|
|
8
|
+
n(!0), l.mutate(i, {
|
|
9
|
+
onSuccess: () => {
|
|
10
|
+
n(!1), a();
|
|
11
|
+
},
|
|
12
|
+
onError: () => {
|
|
13
|
+
n(!1);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ e(d, { open: !0, onOpenChange: a, children: /* @__PURE__ */ o(g, { children: [
|
|
18
|
+
/* @__PURE__ */ o(h, { children: [
|
|
19
|
+
/* @__PURE__ */ e(f, { children: t("Unmark as template") }),
|
|
20
|
+
/* @__PURE__ */ e(k, { className: "space-y-1 py-4 text-xs text-slate-500", children: t("Are you sure you want to unmark this page as a template?") })
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ o(D, { className: r ? "pointer-events-none opacity-75" : "", children: [
|
|
23
|
+
/* @__PURE__ */ e(
|
|
24
|
+
s,
|
|
25
|
+
{
|
|
26
|
+
variant: "outline",
|
|
27
|
+
onClick: (c) => {
|
|
28
|
+
c.stopPropagation(), a();
|
|
29
|
+
},
|
|
30
|
+
children: t("Cancel")
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ e(s, { variant: "default", disabled: r, onClick: m, children: t("Unmark as template") })
|
|
34
|
+
] })
|
|
35
|
+
] }) });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
C as default
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("./index-0cMGDekp.cjs"),c=require("@chaibuilder/sdk"),s=require("@chaibuilder/sdk/ui"),d=({page:i,onClose:t})=>{const{t:e}=c.useTranslation(),{mutate:r,isPending:l}=u.useUnpublishPage(),o=async()=>{r(i,{onSuccess:t})};return n.jsx(s.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(s.DialogContent,{children:[n.jsxs(s.DialogHeader,{children:[n.jsx(s.DialogTitle,{children:e("Confirm action")}),n.jsxs(s.DialogDescription,{children:[e("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(s.DialogFooter,{children:[n.jsx(s.Button,{variant:"outline",onClick:t,children:e("Cancel")}),n.jsx(s.Button,{variant:"destructive",disabled:l,onClick:o,children:e(l?"Updating...":"Unpublish")})]})]})})};exports.default=d;
|