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