@chaibuilder/pages 0.15.6 → 0.15.8
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-BnzAO102.cjs → 2AITGKQY-BGvx_OEz.cjs} +1 -1
- package/dist/{2AITGKQY-tXLat8E2.js → 2AITGKQY-CCad8XK8.js} +2 -2
- package/dist/{NCMVHL6D-DooF4Fqf.cjs → NCMVHL6D-C_u5lHQe.cjs} +1 -1
- package/dist/{NCMVHL6D-BwDANa-N.js → NCMVHL6D-Iv9ufIUy.js} +2 -2
- package/dist/{ZDWCUMSJ-DiH9kc7o.cjs → ZDWCUMSJ-BqZPKNlU.cjs} +1 -1
- package/dist/{ZDWCUMSJ-DWeYRRkj.js → ZDWCUMSJ-DT4dg62a.js} +1 -1
- package/dist/{add-new-language-page-DZhjVBBf.js → add-new-language-page-CfH8Ernl.js} +2 -2
- package/dist/{add-new-language-page-BCUrfgTy.cjs → add-new-language-page-DlQjzp--.cjs} +1 -1
- package/dist/{add-new-page-DWHANcUx.cjs → add-new-page-DH-nv7ae.cjs} +1 -1
- package/dist/{add-new-page-DYuuentN.js → add-new-page-DX1aQA56.js} +1 -1
- package/dist/{delete-page-1dSWwUBg.js → delete-page-DE-nabXs.js} +1 -1
- package/dist/{delete-page-m-Cuz7rG.cjs → delete-page-WPGzECyJ.cjs} +1 -1
- package/dist/{digital-asset-manager-By_JTIbb.cjs → digital-asset-manager-CGLE6VEW.cjs} +1 -1
- package/dist/{digital-asset-manager-BWZlrwFf.js → digital-asset-manager-DtWIJGhf.js} +1 -1
- package/dist/{duplicate-page-fUuBTAs7.js → duplicate-page-C1r3iBDY.js} +2 -2
- package/dist/{duplicate-page-Dzs8ya8l.cjs → duplicate-page-CByLwz0z.cjs} +1 -1
- package/dist/{dynamic-page-selector-X2qgdiNQ.js → dynamic-page-selector-Bk8_xgFx.js} +1 -1
- package/dist/{dynamic-page-selector-CwhL4z6F.cjs → dynamic-page-selector-GwGV0Q6Z.cjs} +1 -1
- package/dist/{index-0cMGDekp.cjs → index-BELYt0c9.cjs} +2 -2
- package/dist/{index-Bk8tPO5R.js → index-Djepisz3.js} +15 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-diff-viewer-Cfa9BjZ6.cjs → json-diff-viewer-BUhKwjf9.cjs} +1 -1
- package/dist/{json-diff-viewer-Cm84g19X.js → json-diff-viewer-zKpzQFxw.js} +1 -1
- package/dist/{lang-panel-CkSfJqr8.cjs → lang-panel-BYF6aLAt.cjs} +1 -1
- package/dist/{lang-panel-CaSKOJ8G.js → lang-panel-CtpuO-KH.js} +2 -2
- package/dist/{mark-as-template-CwsW86Zv.js → mark-as-template-0kikl0oL.js} +1 -1
- package/dist/{mark-as-template-Ci82hbOm.cjs → mark-as-template-wRAGJGtp.cjs} +1 -1
- package/dist/{no-language-page-content-DDz81nqg.js → no-language-page-content-B1M_x_U7.js} +1 -1
- package/dist/{no-language-page-content-CPt4aPy9.cjs → no-language-page-content-DX9WXKXs.cjs} +1 -1
- package/dist/{page-creator-Dr566_Yf.js → page-creator-BDJ6iDX9.js} +2 -2
- package/dist/{page-creator-Cd2LrG4u.cjs → page-creator-DuN5JD41.cjs} +1 -1
- package/dist/{page-lock-request-ECxkQMdS.js → page-lock-request-Bc_vwJhy.js} +1 -1
- package/dist/{page-lock-request-Bw_Wye1t.cjs → page-lock-request-PRQo0DDm.cjs} +1 -1
- package/dist/{page-locked-by-dialog-CnkVUpjt.js → page-locked-by-dialog-DiKNpVwH.js} +1 -1
- package/dist/{page-locked-by-dialog-AbutJT_V.cjs → page-locked-by-dialog-Dk0G2l7a.cjs} +1 -1
- package/dist/{page-manager-new-DkqNLZ5C.js → page-manager-new-CUHqC9Og.js} +2 -2
- package/dist/{page-manager-new-DLMvOata.cjs → page-manager-new-KBhn93Yd.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-B98nz9xS.js → page-manager-search-and-filter-CJ4AK1_7.js} +1 -1
- package/dist/{page-manager-search-and-filter-CfEfWFeo.cjs → page-manager-search-and-filter-Ck5_TfNx.cjs} +1 -1
- package/dist/{page-revisions-content-D12GEp8C.cjs → page-revisions-content-Cw2cumYS.cjs} +1 -1
- package/dist/{page-revisions-content-CBQPYFZI.js → page-revisions-content-q1Ch2-IQ.js} +2 -2
- package/dist/{publish-pages-content-LNCr9tKv.cjs → publish-pages-content-B8Uuw29Q.cjs} +1 -1
- package/dist/{publish-pages-content-BF5yMo_L.js → publish-pages-content-DEHD8qkl.js} +2 -2
- package/dist/{save-to-lib-C1B6tWEF.cjs → save-to-lib-B83ZH4XX.cjs} +1 -1
- package/dist/{save-to-lib-SpilaoOL.js → save-to-lib-QEOpf_Bd.js} +1 -1
- package/dist/{seo-panel-sbYoo746.js → seo-panel-DEQfOfZs.js} +1 -1
- package/dist/{seo-panel-DkgkJUT6.cjs → seo-panel-DvDEatlO.cjs} +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.js +114 -112
- package/dist/{shared-json-ld-D_YyVPk3.js → shared-json-ld-Cyv9JitF.js} +35 -34
- package/dist/{shared-json-ld-CEUgLAev.cjs → shared-json-ld-D5F8RuF2.cjs} +1 -1
- package/dist/{slug-input-Cqj9EBju.cjs → slug-input-3vWL9FPC.cjs} +1 -1
- package/dist/{slug-input-Df-BG6xl.js → slug-input-D4e2anEs.js} +1 -1
- package/dist/{theme-panel-footer-Ca1UF5DA.cjs → theme-panel-footer-4dbLfEph.cjs} +1 -1
- package/dist/{theme-panel-footer-B6leVWSV.js → theme-panel-footer-D3Gub87c.js} +1 -1
- package/dist/{unmark-as-template-Cho9B4RN.js → unmark-as-template-BENGNo7g.js} +1 -1
- package/dist/{unmark-as-template-BOE-nKOb.cjs → unmark-as-template-Dkc7zLZr.cjs} +1 -1
- package/dist/{unpublish-page-BcxxZ8pr.cjs → unpublish-page-Cui0tgvd.cjs} +1 -1
- package/dist/{unpublish-page-Dr4qbwUx.js → unpublish-page-D5tWKVLY.js} +1 -1
- package/dist/{web-preview-Cq82TNaS.js → web-preview-CHNZZcqH.js} +1 -1
- package/dist/{web-preview-ued-fdxs.cjs → web-preview-CcPTcMio.cjs} +1 -1
- package/package.json +3 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { useLanguages as me } from "@chaibuilder/sdk";
|
|
3
3
|
import { useQuery as he, useQueryClient as ue } from "@tanstack/react-query";
|
|
4
|
-
import { ak as ge, al as
|
|
4
|
+
import { ak as ge, al as fe, A as U, ap as te, au as pe, av as se, aw as re, ax as de, ay as xe, az as Ne, aA as be, g as ye, aB as ve } from "./index-Djepisz3.js";
|
|
5
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
6
|
import { filter as Je, find as Oe } from "lodash-es";
|
|
7
7
|
import { Info as Fe, Loader as F, Plus as ke, Eye as je, Edit as Ge, Trash as Be } from "lucide-react";
|
|
8
8
|
import { useState as g, useEffect as Z, useMemo as z } from "react";
|
|
9
9
|
import { toast as B } from "sonner";
|
|
10
|
-
const
|
|
11
|
-
const l = ge(), i =
|
|
10
|
+
const oe = () => {
|
|
11
|
+
const l = ge(), i = fe();
|
|
12
12
|
return he({
|
|
13
13
|
queryKey: [U.GET_GLOBAL_JSONLD_ITEMS],
|
|
14
14
|
queryFn: async () => i(l, { action: U.GET_GLOBAL_JSONLD_ITEMS })
|
|
@@ -22,14 +22,14 @@ const de = () => {
|
|
|
22
22
|
onClose: i,
|
|
23
23
|
initialData: a
|
|
24
24
|
}) => {
|
|
25
|
-
const [d,
|
|
25
|
+
const [d, f] = g({
|
|
26
26
|
name: "",
|
|
27
27
|
content: "",
|
|
28
28
|
description: "",
|
|
29
29
|
enabledByDefaultForNewPages: !1
|
|
30
|
-
}), [x, P] = g(!1), { data: u } =
|
|
30
|
+
}), [x, P] = g(!1), { data: u } = te(), { mutateAsync: C, isPending: p } = pe(), { mutateAsync: c } = se(), w = ue();
|
|
31
31
|
Z(() => {
|
|
32
|
-
|
|
32
|
+
f(a ? {
|
|
33
33
|
name: a.name,
|
|
34
34
|
description: a.description,
|
|
35
35
|
content: JSON.stringify(a.jsonld, null, 2),
|
|
@@ -41,7 +41,7 @@ const de = () => {
|
|
|
41
41
|
B.error("Please enter a name and content");
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
-
const t =
|
|
44
|
+
const t = de(d.content);
|
|
45
45
|
if (!t.isValid) {
|
|
46
46
|
B.error("Invalid JSON-LD content");
|
|
47
47
|
return;
|
|
@@ -81,7 +81,7 @@ const de = () => {
|
|
|
81
81
|
{
|
|
82
82
|
id: "new-name",
|
|
83
83
|
value: d.name,
|
|
84
|
-
onChange: (t) =>
|
|
84
|
+
onChange: (t) => f({ ...d, name: t.target.value }),
|
|
85
85
|
placeholder: "e.g., Product Schema",
|
|
86
86
|
className: "text-xs"
|
|
87
87
|
}
|
|
@@ -94,7 +94,7 @@ const de = () => {
|
|
|
94
94
|
{
|
|
95
95
|
id: "new-description",
|
|
96
96
|
value: d.description || "",
|
|
97
|
-
onChange: (t) =>
|
|
97
|
+
onChange: (t) => f({ ...d, description: t.target.value }),
|
|
98
98
|
placeholder: "Brief description of this schema"
|
|
99
99
|
}
|
|
100
100
|
)
|
|
@@ -102,11 +102,11 @@ const de = () => {
|
|
|
102
102
|
/* @__PURE__ */ n("div", { children: [
|
|
103
103
|
/* @__PURE__ */ e(y, { htmlFor: "new-content", children: "JSON-LD Content" }),
|
|
104
104
|
/* @__PURE__ */ e(
|
|
105
|
-
|
|
105
|
+
re,
|
|
106
106
|
{
|
|
107
107
|
id: "new-content",
|
|
108
108
|
value: d.content || "{}",
|
|
109
|
-
onChange: (t) =>
|
|
109
|
+
onChange: (t) => f({ ...d, content: t }),
|
|
110
110
|
placeholder: "Enter JSON-LD markup...",
|
|
111
111
|
rows: 10
|
|
112
112
|
}
|
|
@@ -136,7 +136,7 @@ const de = () => {
|
|
|
136
136
|
type: "checkbox",
|
|
137
137
|
id: "new-enabled",
|
|
138
138
|
checked: d.enabledByDefaultForNewPages,
|
|
139
|
-
onChange: (t) =>
|
|
139
|
+
onChange: (t) => f({ ...d, enabledByDefaultForNewPages: t.target.checked }),
|
|
140
140
|
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
141
141
|
}
|
|
142
142
|
),
|
|
@@ -147,8 +147,8 @@ const de = () => {
|
|
|
147
147
|
] })
|
|
148
148
|
] }),
|
|
149
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:
|
|
151
|
-
/* @__PURE__ */ e(v, { disabled:
|
|
150
|
+
/* @__PURE__ */ e(v, { disabled: p, variant: "outline", type: "button", size: "sm", onClick: () => i(), children: "Cancel" }),
|
|
151
|
+
/* @__PURE__ */ e(v, { disabled: p, type: "button", size: "sm", onClick: o, children: p ? /* @__PURE__ */ n(j, { children: [
|
|
152
152
|
/* @__PURE__ */ e(F, { className: "h-4 w-4 animate-spin" }),
|
|
153
153
|
" Adding"
|
|
154
154
|
] }) : /* @__PURE__ */ n(j, { children: [
|
|
@@ -164,7 +164,7 @@ const de = () => {
|
|
|
164
164
|
content: "",
|
|
165
165
|
description: "",
|
|
166
166
|
enabledByDefaultForNewPages: !1
|
|
167
|
-
}), [
|
|
167
|
+
}), [f, x] = g(!1), [P, u] = g(!1), [C, p] = g(!1), { data: c } = oe(), { mutateAsync: w, isPending: o } = xe(), { mutateAsync: t } = Ne(), { mutateAsync: N } = be();
|
|
168
168
|
Z(() => {
|
|
169
169
|
var m, D;
|
|
170
170
|
if (l && c) {
|
|
@@ -174,7 +174,7 @@ const de = () => {
|
|
|
174
174
|
description: ((m = b.metadata) == null ? void 0 : m.description) || "",
|
|
175
175
|
content: JSON.stringify(b.jsonld, null, 2),
|
|
176
176
|
enabledByDefaultForNewPages: ((D = b.metadata) == null ? void 0 : D.addToNewPages) || !1
|
|
177
|
-
}),
|
|
177
|
+
}), p(!!b.primaryPage));
|
|
178
178
|
}
|
|
179
179
|
}, [l, c]);
|
|
180
180
|
const A = async () => {
|
|
@@ -182,7 +182,7 @@ const de = () => {
|
|
|
182
182
|
B.error("Please enter a name and content");
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
const m =
|
|
185
|
+
const m = de(a.content);
|
|
186
186
|
if (!m.isValid) {
|
|
187
187
|
B.error("Invalid JSON-LD content");
|
|
188
188
|
return;
|
|
@@ -249,7 +249,7 @@ const de = () => {
|
|
|
249
249
|
/* @__PURE__ */ n("div", { children: [
|
|
250
250
|
/* @__PURE__ */ e(y, { htmlFor: "edit-content", children: "JSON-LD Content" }),
|
|
251
251
|
/* @__PURE__ */ e(
|
|
252
|
-
|
|
252
|
+
re,
|
|
253
253
|
{
|
|
254
254
|
id: "edit-content",
|
|
255
255
|
value: a.content || "{}",
|
|
@@ -283,7 +283,7 @@ const de = () => {
|
|
|
283
283
|
] }) : "Update Schema" })
|
|
284
284
|
] }) })
|
|
285
285
|
] }),
|
|
286
|
-
/* @__PURE__ */ e(_, { open:
|
|
286
|
+
/* @__PURE__ */ e(_, { open: f, onOpenChange: x, children: /* @__PURE__ */ n(R, { children: [
|
|
287
287
|
/* @__PURE__ */ n(M, { children: [
|
|
288
288
|
/* @__PURE__ */ e(q, { children: "Add to All Existing Pages?" }),
|
|
289
289
|
/* @__PURE__ */ n(H, { children: [
|
|
@@ -314,7 +314,7 @@ const de = () => {
|
|
|
314
314
|
] });
|
|
315
315
|
};
|
|
316
316
|
function Xe() {
|
|
317
|
-
const [l, i] = g(!1), [a, d] = g(void 0), [
|
|
317
|
+
const [l, i] = g(!1), [a, d] = g(void 0), [f, x] = g(null), [P, u] = g(null), [C, p] = g(null), { data: c, isLoading: w } = oe(), { selectedLang: o } = me(), { data: t } = te(), { data: N } = ye(), { mutateAsync: A } = ve(), { mutateAsync: I } = se(), 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
318
|
const h = o ? Oe(c, (S) => S.primaryPage === r.id && S.lang === o) : null;
|
|
319
319
|
return {
|
|
320
320
|
defaultSchema: r,
|
|
@@ -327,9 +327,9 @@ function Xe() {
|
|
|
327
327
|
Z(() => {
|
|
328
328
|
t != null && t.globalJsonLds && L(t.globalJsonLds);
|
|
329
329
|
}, [t == null ? void 0 : t.globalJsonLds]);
|
|
330
|
-
const
|
|
330
|
+
const ie = async (s) => {
|
|
331
331
|
if (!(t != null && t.id)) return;
|
|
332
|
-
|
|
332
|
+
p(s);
|
|
333
333
|
const r = k.includes(s), h = r ? k.filter((S) => S !== s) : [...k, s];
|
|
334
334
|
L(h);
|
|
335
335
|
try {
|
|
@@ -341,14 +341,14 @@ function Xe() {
|
|
|
341
341
|
} catch {
|
|
342
342
|
L(t.globalJsonLds);
|
|
343
343
|
} finally {
|
|
344
|
-
|
|
344
|
+
p(null);
|
|
345
345
|
}
|
|
346
|
-
},
|
|
347
|
-
|
|
346
|
+
}, ce = async (s) => {
|
|
347
|
+
p(s);
|
|
348
348
|
try {
|
|
349
349
|
await A(s);
|
|
350
350
|
} finally {
|
|
351
|
-
|
|
351
|
+
p(null);
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
return /* @__PURE__ */ n("div", { className: "rounded border bg-muted p-2", children: [
|
|
@@ -377,8 +377,8 @@ function Xe() {
|
|
|
377
377
|
/* @__PURE__ */ n("div", { className: "space-y-2", children: [
|
|
378
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
379
|
D.map(({ defaultSchema: s, displayItem: r, hasLanguageVersion: h }) => {
|
|
380
|
-
var
|
|
381
|
-
const S = k.includes(r.id), ee = m.includes(s.id),
|
|
380
|
+
var ae, le;
|
|
381
|
+
const S = k.includes(r.id), ee = m.includes(s.id), ne = h && o ? ee : S;
|
|
382
382
|
return /* @__PURE__ */ n(
|
|
383
383
|
Se,
|
|
384
384
|
{
|
|
@@ -392,8 +392,8 @@ function Xe() {
|
|
|
392
392
|
"input",
|
|
393
393
|
{
|
|
394
394
|
type: "checkbox",
|
|
395
|
-
checked:
|
|
396
|
-
onChange: () =>
|
|
395
|
+
checked: ne,
|
|
396
|
+
onChange: () => ie(s.id),
|
|
397
397
|
disabled: !!(h && o),
|
|
398
398
|
className: "h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"
|
|
399
399
|
}
|
|
@@ -407,9 +407,10 @@ function Xe() {
|
|
|
407
407
|
"(",
|
|
408
408
|
o,
|
|
409
409
|
")"
|
|
410
|
-
] })
|
|
410
|
+
] }),
|
|
411
|
+
ne && /* @__PURE__ */ e("span", { className: "sr-only text-xs font-normal text-muted-foreground", children: "Enabled" })
|
|
411
412
|
] }),
|
|
412
|
-
((
|
|
413
|
+
((ae = r == null ? void 0 : r.metadata) == null ? void 0 : ae.description) && /* @__PURE__ */ e("p", { className: "mt-1 text-xs leading-none text-muted-foreground", children: (le = r == null ? void 0 : r.metadata) == null ? void 0 : le.description })
|
|
413
414
|
] })
|
|
414
415
|
] }),
|
|
415
416
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
@@ -464,7 +465,7 @@ function Xe() {
|
|
|
464
465
|
K,
|
|
465
466
|
{
|
|
466
467
|
type: "button",
|
|
467
|
-
onClick: () =>
|
|
468
|
+
onClick: () => ce(r.id),
|
|
468
469
|
className: "bg-red-500 text-white hover:bg-red-600",
|
|
469
470
|
children: "Delete"
|
|
470
471
|
}
|
|
@@ -522,7 +523,7 @@ function Xe() {
|
|
|
522
523
|
initialData: a
|
|
523
524
|
}
|
|
524
525
|
),
|
|
525
|
-
/* @__PURE__ */ e(Ue, { id:
|
|
526
|
+
/* @__PURE__ */ e(Ue, { id: f, onClose: () => x(null) }),
|
|
526
527
|
/* @__PURE__ */ e(
|
|
527
528
|
Re,
|
|
528
529
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("@chaibuilder/sdk"),G=require("@tanstack/react-query"),c=require("./index-0cMGDekp.cjs"),s=require("@chaibuilder/sdk/ui"),B=require("lodash-es"),f=require("lucide-react"),x=require("react"),E=require("sonner"),I=()=>{const t=c.useApiUrl(),d=c.useFetch();return G.useQuery({queryKey:[c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS],queryFn:async()=>d(t,{action:c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS})})},U=({show:t,onClose:d,initialData:n})=>e.jsx(s.Dialog,{open:t,onOpenChange:()=>d(),children:t&&e.jsx(_,{show:t,onClose:d,initialData:n})}),_=({show:t,onClose:d,initialData:n})=>{const[r,p]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[N,C]=x.useState(!1),{data:g}=c.useCurrentPage(),{mutateAsync:A,isPending:j}=c.useAddGlobalSchema(),{mutateAsync:u}=c.useTogglePageGlobalSchema(),v=G.useQueryClient();x.useEffect(()=>{p(n?{name:n.name,description:n.description,content:JSON.stringify(n.jsonld,null,2),enabledByDefaultForNewPages:!1}:{name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),C(!1)},[t,n]);const i=async()=>{if(!r.name||!r.content){E.toast.error("Please enter a name and content");return}const l=c.parseJSONWithPlaceholders(r.content);if(!l.isValid){E.toast.error("Invalid JSON-LD content");return}const b={name:r.name,jsonld:l.parsed,addToExistingPages:N,addToNewPages:r.enabledByDefaultForNewPages,description:r.description};n!=null&&n.primaryPageId&&(b.primaryPage=n.primaryPageId);const w=await A(b);g!=null&&g.id&&(w!=null&&w.id)&&!(n!=null&&n.primaryPageId)&&(await u({schemaId:w.id,pageId:g.id,enabled:!0}),v.invalidateQueries({queryKey:[c.ACTIONS.GET_LANGUAGE_PAGES,g.id]})),d()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[(n==null?void 0:n.languageCode)&&e.jsxs(s.Alert,{className:"border-blue-200 bg-blue-50",children:[e.jsx(f.Info,{className:"h-4 w-4 text-blue-600"}),e.jsxs(s.AlertDescription,{className:"text-sm text-blue-800",children:["You are creating a ",e.jsx("span",{className:"font-semibold",children:n.languageCode})," language version of this schema. This will be linked to the default language schema."]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:r.name,onChange:l=>p({...r,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:r.description||"",onChange:l=>p({...r,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"new-content",value:r.content||"{}",onChange:l=>p({...r,content:l}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!(n!=null&&n.primaryPageId)&&e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"add-to-all-existing",checked:N,onChange:l=>C(l.target.checked),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"add-to-all-existing",children:[e.jsx("div",{children:"Add to all existing pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"This schema will be added to all existing pages on your site"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"new-enabled",checked:r.enabledByDefaultForNewPages,onChange:l=>p({...r,enabledByDefaultForNewPages:l.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:j,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:j,type:"button",size:"sm",onClick:i,children:j?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Adding"]}):e.jsxs(e.Fragment,{children:["Add Schema",(n==null?void 0:n.languageCode)&&` (${n.languageCode})`]})})]})})]})]})},H=({id:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:()=>d(),children:t&&e.jsx(Q,{id:t,onClose:d})}),Q=({id:t,onClose:d})=>{const[n,r]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[p,N]=x.useState(!1),[C,g]=x.useState(!1),[A,j]=x.useState(!1),{data:u}=I(),{mutateAsync:v,isPending:i}=c.useUpdateGlobalSchema(),{mutateAsync:l}=c.useApplySchemaToAllPages(),{mutateAsync:b}=c.useRemoveSchemaFromAllPages();x.useEffect(()=>{var m,D;if(t&&u){const y=u.find(P=>P.id===t);y&&(r({name:y.name,description:((m=y.metadata)==null?void 0:m.description)||"",content:JSON.stringify(y.jsonld,null,2),enabledByDefaultForNewPages:((D=y.metadata)==null?void 0:D.addToNewPages)||!1}),j(!!y.primaryPage))}},[t,u]);const w=async()=>{if(!n.name||!n.content){E.toast.error("Please enter a name and content");return}const m=c.parseJSONWithPlaceholders(n.content);if(!m.isValid){E.toast.error("Invalid JSON-LD content");return}const D={id:t,name:n.name,jsonld:m.parsed,addToNewPages:n.enabledByDefaultForNewPages,description:n.description};await v(D),d()},F=async()=>{try{await l(t)}finally{N(!1)}},T=async()=>{try{await b(t)}finally{g(!1)}};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Edit Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[!A&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Manage Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"Add or remove this schema from all existing pages on your site"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",className:"text-xs",variant:"outline",onClick:()=>N(!0),children:"Add to all existing"}),e.jsx(s.Button,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>g(!0),children:"Remove from all"})]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-name",children:"Schema Name"}),e.jsx(s.Input,{id:"edit-name",value:n.name,onChange:m=>r({...n,name:m.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-description",children:"Description"}),e.jsx(s.Input,{id:"edit-description",value:n.description||"",onChange:m=>r({...n,description:m.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"edit-content",value:n.content||"{}",onChange:m=>r({...n,content:m}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!A&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"edit-enabled",checked:n.enabledByDefaultForNewPages,onChange:m=>r({...n,enabledByDefaultForNewPages:m.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"edit-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:i,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:i,type:"button",size:"sm",onClick:w,children:i?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Updating"]}):"Update Schema"})]})})]}),e.jsx(s.AlertDialog,{open:p,onOpenChange:N,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Add to All Existing Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will add the schema ",e.jsx("span",{className:"font-medium",children:n.name})," to all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,children:"Add to All"})]})]})}),e.jsx(s.AlertDialog,{open:C,onOpenChange:g,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Remove from All Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will remove the schema ",e.jsx("span",{className:"font-medium",children:n.name})," from all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:T,className:"bg-red-500 hover:bg-red-600",children:"Remove from All"})]})]})})]})};function V(){const[t,d]=x.useState(!1),[n,r]=x.useState(void 0),[p,N]=x.useState(null),[C,g]=x.useState(null),[A,j]=x.useState(null),{data:u,isLoading:v}=I(),{selectedLang:i}=M.useLanguages(),{data:l}=c.useCurrentPage(),{data:b}=c.useLanguagePages(),{mutateAsync:w}=c.useDeleteGlobalSchema(),{mutateAsync:F}=c.useTogglePageGlobalSchema(),T=x.useMemo(()=>b==null?void 0:b.find(a=>!a.primaryPage&&a.lang===""),[b]),m=x.useMemo(()=>(T==null?void 0:T.globalJsonLds)||[],[T]),D=x.useMemo(()=>u?B.filter(u,o=>o.primaryPage===null&&o.lang==="").map(o=>{const h=i?B.find(u,S=>S.primaryPage===o.id&&S.lang===i):null;return{defaultSchema:o,languageVersion:h,displayItem:h||o,hasLanguageVersion:!!h}}):[],[u,i]),[y,P]=x.useState([]),L=y.length>0?y:(l==null?void 0:l.globalJsonLds)||[];x.useEffect(()=>{l!=null&&l.globalJsonLds&&P(l.globalJsonLds)},[l==null?void 0:l.globalJsonLds]);const q=async a=>{if(!(l!=null&&l.id))return;j(a);const o=L.includes(a),h=o?L.filter(S=>S!==a):[...L,a];P(h);try{await F({schemaId:a,pageId:l.id,enabled:!o})}catch{P(l.globalJsonLds)}finally{j(null)}},z=async a=>{j(a);try{await w(a)}finally{j(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!i&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:v,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:a=>{a.stopPropagation(),d(!0)},children:v?e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(f.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!u||(u==null?void 0:u.length)===0)&&!v&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),D.map(({defaultSchema:a,displayItem:o,hasLanguageVersion:h})=>{var J,k;const S=L.includes(o.id),O=m.includes(a.id),R=h&&i?O:S;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${A===o.id?"pointer-events-none":""}`,children:[A===o.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[(h||!i)&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx("input",{type:"checkbox",checked:R,onChange:()=>q(a.id),disabled:!!(h&&i),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"})}),h&&i&&e.jsx(s.TooltipContent,{children:"Using the default language state"})]}),e.jsxs("div",{children:[e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:[o.name,h&&i&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",i,")"]})]}),((J=o==null?void 0:o.metadata)==null?void 0:J.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:(k=o==null?void 0:o.metadata)==null?void 0:k.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"mx-2 h-6 w-px bg-border"}),e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>g(o.id),children:e.jsx(f.Eye,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"View schema"})]}),(h||!i)&&e.jsxs(e.Fragment,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>N(o.id),children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Edit schema"})]}),e.jsxs(s.AlertDialog,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(f.Trash,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Delete schema"})]}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium",children:o.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>z(o.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})]})}),!h&&i&&e.jsx(s.CardContent,{className:"px-2 pb-2",children:e.jsxs("div",{className:"flex w-full flex-col items-center justify-center rounded-lg border bg-gray-100 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"max-w-xl text-center text-xs text-gray-500",children:["Not available in '",i,"' language. Default language JSONLD will be used."]}),O&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700",children:"Enabled in default"})]}),e.jsx(s.Button,{type:"button",size:"sm",variant:"outline",className:"mt-2",onClick:()=>{r({name:a.name,description:a.description||"",jsonld:a.jsonld,languageCode:i,primaryPageId:a.id}),d(!0)},children:"Copy & Edit from default language"})]})})]},a.id)})]}),v&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(U,{show:t,onClose:()=>{d(!1),r(void 0)},initialData:n}),e.jsx(H,{id:p,onClose:()=>N(null)}),e.jsx(K,{schema:u==null?void 0:u.find(a=>a.id===C),onClose:()=>g(null)})]})}const K=({schema:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:d,children:e.jsxs(s.DialogContent,{className:"max-w-2xl",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[t==null?void 0:t.name,(t==null?void 0:t.lang)&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.lang,")"]})]})}),e.jsxs("div",{className:"space-y-3",children:[(t==null?void 0:t.description)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),e.jsx("div",{className:"text-sm",children:t.description})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"JSON-LD Schema"}),e.jsx(s.Textarea,{value:JSON.stringify(t==null?void 0:t.jsonld,null,2),readOnly:!0,className:"font-mono text-xs",rows:15})]})]})]})});exports.default=V;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),M=require("@chaibuilder/sdk"),I=require("@tanstack/react-query"),c=require("./index-BELYt0c9.cjs"),s=require("@chaibuilder/sdk/ui"),G=require("lodash-es"),f=require("lucide-react"),x=require("react"),E=require("sonner"),q=()=>{const t=c.useApiUrl(),d=c.useFetch();return I.useQuery({queryKey:[c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS],queryFn:async()=>d(t,{action:c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS})})},U=({show:t,onClose:d,initialData:n})=>e.jsx(s.Dialog,{open:t,onOpenChange:()=>d(),children:t&&e.jsx(_,{show:t,onClose:d,initialData:n})}),_=({show:t,onClose:d,initialData:n})=>{const[r,p]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[N,C]=x.useState(!1),{data:g}=c.useCurrentPage(),{mutateAsync:A,isPending:j}=c.useAddGlobalSchema(),{mutateAsync:u}=c.useTogglePageGlobalSchema(),v=I.useQueryClient();x.useEffect(()=>{p(n?{name:n.name,description:n.description,content:JSON.stringify(n.jsonld,null,2),enabledByDefaultForNewPages:!1}:{name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),C(!1)},[t,n]);const i=async()=>{if(!r.name||!r.content){E.toast.error("Please enter a name and content");return}const l=c.parseJSONWithPlaceholders(r.content);if(!l.isValid){E.toast.error("Invalid JSON-LD content");return}const b={name:r.name,jsonld:l.parsed,addToExistingPages:N,addToNewPages:r.enabledByDefaultForNewPages,description:r.description};n!=null&&n.primaryPageId&&(b.primaryPage=n.primaryPageId);const w=await A(b);g!=null&&g.id&&(w!=null&&w.id)&&!(n!=null&&n.primaryPageId)&&(await u({schemaId:w.id,pageId:g.id,enabled:!0}),v.invalidateQueries({queryKey:[c.ACTIONS.GET_LANGUAGE_PAGES,g.id]})),d()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[(n==null?void 0:n.languageCode)&&e.jsxs(s.Alert,{className:"border-blue-200 bg-blue-50",children:[e.jsx(f.Info,{className:"h-4 w-4 text-blue-600"}),e.jsxs(s.AlertDescription,{className:"text-sm text-blue-800",children:["You are creating a ",e.jsx("span",{className:"font-semibold",children:n.languageCode})," language version of this schema. This will be linked to the default language schema."]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:r.name,onChange:l=>p({...r,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:r.description||"",onChange:l=>p({...r,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"new-content",value:r.content||"{}",onChange:l=>p({...r,content:l}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!(n!=null&&n.primaryPageId)&&e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"add-to-all-existing",checked:N,onChange:l=>C(l.target.checked),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"add-to-all-existing",children:[e.jsx("div",{children:"Add to all existing pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"This schema will be added to all existing pages on your site"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"new-enabled",checked:r.enabledByDefaultForNewPages,onChange:l=>p({...r,enabledByDefaultForNewPages:l.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:j,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:j,type:"button",size:"sm",onClick:i,children:j?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Adding"]}):e.jsxs(e.Fragment,{children:["Add Schema",(n==null?void 0:n.languageCode)&&` (${n.languageCode})`]})})]})})]})]})},H=({id:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:()=>d(),children:t&&e.jsx(Q,{id:t,onClose:d})}),Q=({id:t,onClose:d})=>{const[n,r]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[p,N]=x.useState(!1),[C,g]=x.useState(!1),[A,j]=x.useState(!1),{data:u}=q(),{mutateAsync:v,isPending:i}=c.useUpdateGlobalSchema(),{mutateAsync:l}=c.useApplySchemaToAllPages(),{mutateAsync:b}=c.useRemoveSchemaFromAllPages();x.useEffect(()=>{var m,D;if(t&&u){const y=u.find(P=>P.id===t);y&&(r({name:y.name,description:((m=y.metadata)==null?void 0:m.description)||"",content:JSON.stringify(y.jsonld,null,2),enabledByDefaultForNewPages:((D=y.metadata)==null?void 0:D.addToNewPages)||!1}),j(!!y.primaryPage))}},[t,u]);const w=async()=>{if(!n.name||!n.content){E.toast.error("Please enter a name and content");return}const m=c.parseJSONWithPlaceholders(n.content);if(!m.isValid){E.toast.error("Invalid JSON-LD content");return}const D={id:t,name:n.name,jsonld:m.parsed,addToNewPages:n.enabledByDefaultForNewPages,description:n.description};await v(D),d()},F=async()=>{try{await l(t)}finally{N(!1)}},T=async()=>{try{await b(t)}finally{g(!1)}};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Edit Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[!A&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Manage Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"Add or remove this schema from all existing pages on your site"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",className:"text-xs",variant:"outline",onClick:()=>N(!0),children:"Add to all existing"}),e.jsx(s.Button,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>g(!0),children:"Remove from all"})]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-name",children:"Schema Name"}),e.jsx(s.Input,{id:"edit-name",value:n.name,onChange:m=>r({...n,name:m.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-description",children:"Description"}),e.jsx(s.Input,{id:"edit-description",value:n.description||"",onChange:m=>r({...n,description:m.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"edit-content",value:n.content||"{}",onChange:m=>r({...n,content:m}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!A&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"edit-enabled",checked:n.enabledByDefaultForNewPages,onChange:m=>r({...n,enabledByDefaultForNewPages:m.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"edit-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:i,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:i,type:"button",size:"sm",onClick:w,children:i?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Updating"]}):"Update Schema"})]})})]}),e.jsx(s.AlertDialog,{open:p,onOpenChange:N,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Add to All Existing Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will add the schema ",e.jsx("span",{className:"font-medium",children:n.name})," to all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,children:"Add to All"})]})]})}),e.jsx(s.AlertDialog,{open:C,onOpenChange:g,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Remove from All Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will remove the schema ",e.jsx("span",{className:"font-medium",children:n.name})," from all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:T,className:"bg-red-500 hover:bg-red-600",children:"Remove from All"})]})]})})]})};function V(){const[t,d]=x.useState(!1),[n,r]=x.useState(void 0),[p,N]=x.useState(null),[C,g]=x.useState(null),[A,j]=x.useState(null),{data:u,isLoading:v}=q(),{selectedLang:i}=M.useLanguages(),{data:l}=c.useCurrentPage(),{data:b}=c.useLanguagePages(),{mutateAsync:w}=c.useDeleteGlobalSchema(),{mutateAsync:F}=c.useTogglePageGlobalSchema(),T=x.useMemo(()=>b==null?void 0:b.find(a=>!a.primaryPage&&a.lang===""),[b]),m=x.useMemo(()=>(T==null?void 0:T.globalJsonLds)||[],[T]),D=x.useMemo(()=>u?G.filter(u,o=>o.primaryPage===null&&o.lang==="").map(o=>{const h=i?G.find(u,S=>S.primaryPage===o.id&&S.lang===i):null;return{defaultSchema:o,languageVersion:h,displayItem:h||o,hasLanguageVersion:!!h}}):[],[u,i]),[y,P]=x.useState([]),L=y.length>0?y:(l==null?void 0:l.globalJsonLds)||[];x.useEffect(()=>{l!=null&&l.globalJsonLds&&P(l.globalJsonLds)},[l==null?void 0:l.globalJsonLds]);const z=async a=>{if(!(l!=null&&l.id))return;j(a);const o=L.includes(a),h=o?L.filter(S=>S!==a):[...L,a];P(h);try{await F({schemaId:a,pageId:l.id,enabled:!o})}catch{P(l.globalJsonLds)}finally{j(null)}},R=async a=>{j(a);try{await w(a)}finally{j(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!i&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:v,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:a=>{a.stopPropagation(),d(!0)},children:v?e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(f.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!u||(u==null?void 0:u.length)===0)&&!v&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),D.map(({defaultSchema:a,displayItem:o,hasLanguageVersion:h})=>{var k,B;const S=L.includes(o.id),O=m.includes(a.id),J=h&&i?O:S;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${A===o.id?"pointer-events-none":""}`,children:[A===o.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[(h||!i)&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx("input",{type:"checkbox",checked:J,onChange:()=>z(a.id),disabled:!!(h&&i),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"})}),h&&i&&e.jsx(s.TooltipContent,{children:"Using the default language state"})]}),e.jsxs("div",{children:[e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:[o.name,h&&i&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",i,")"]}),J&&e.jsx("span",{className:"sr-only text-xs font-normal text-muted-foreground",children:"Enabled"})]}),((k=o==null?void 0:o.metadata)==null?void 0:k.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:(B=o==null?void 0:o.metadata)==null?void 0:B.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"mx-2 h-6 w-px bg-border"}),e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>g(o.id),children:e.jsx(f.Eye,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"View schema"})]}),(h||!i)&&e.jsxs(e.Fragment,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>N(o.id),children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Edit schema"})]}),e.jsxs(s.AlertDialog,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(f.Trash,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Delete schema"})]}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium",children:o.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>R(o.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})]})}),!h&&i&&e.jsx(s.CardContent,{className:"px-2 pb-2",children:e.jsxs("div",{className:"flex w-full flex-col items-center justify-center rounded-lg border bg-gray-100 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"max-w-xl text-center text-xs text-gray-500",children:["Not available in '",i,"' language. Default language JSONLD will be used."]}),O&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700",children:"Enabled in default"})]}),e.jsx(s.Button,{type:"button",size:"sm",variant:"outline",className:"mt-2",onClick:()=>{r({name:a.name,description:a.description||"",jsonld:a.jsonld,languageCode:i,primaryPageId:a.id}),d(!0)},children:"Copy & Edit from default language"})]})})]},a.id)})]}),v&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(U,{show:t,onClose:()=>{d(!1),r(void 0)},initialData:n}),e.jsx(H,{id:p,onClose:()=>N(null)}),e.jsx(K,{schema:u==null?void 0:u.find(a=>a.id===C),onClose:()=>g(null)})]})}const K=({schema:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:d,children:e.jsxs(s.DialogContent,{className:"max-w-2xl",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[t==null?void 0:t.name,(t==null?void 0:t.lang)&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.lang,")"]})]})}),e.jsxs("div",{className:"space-y-3",children:[(t==null?void 0:t.description)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),e.jsx("div",{className:"text-sm",children:t.description})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"JSON-LD Schema"}),e.jsx(s.Textarea,{value:JSON.stringify(t==null?void 0:t.jsonld,null,2),readOnly:!0,className:"font-mono text-xs",rows:15})]})]})]})});exports.default=V;
|
|
@@ -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-BELYt0c9.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-Djepisz3.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) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-BELYt0c9.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as c, jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { u, a as d, t as h } from "./index-
|
|
2
|
+
import { u, a as d, t as h } from "./index-Djepisz3.js";
|
|
3
3
|
import { useTheme as b, useTranslation as g } from "@chaibuilder/sdk";
|
|
4
4
|
import { Button as o } from "@chaibuilder/sdk/ui";
|
|
5
5
|
const x = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import { o as p } from "./index-
|
|
2
|
+
import { o as p } from "./index-Djepisz3.js";
|
|
3
3
|
import { useTranslation as u } from "@chaibuilder/sdk";
|
|
4
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
5
|
import { useState as x } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("./index-BELYt0c9.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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("./index-BELYt0c9.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o, jsxs as l } from "react/jsx-runtime";
|
|
2
|
-
import { l as u } from "./index-
|
|
2
|
+
import { l as u } from "./index-Djepisz3.js";
|
|
3
3
|
import { useTranslation as a } from "@chaibuilder/sdk";
|
|
4
4
|
import { Dialog as h, DialogContent as d, DialogHeader as m, DialogTitle as b, DialogDescription as D, DialogFooter as f, Button as s } from "@chaibuilder/sdk/ui";
|
|
5
5
|
const g = ({ page: n, onClose: t }) => {
|
|
@@ -4,7 +4,7 @@ import { Button as s } from "@chaibuilder/sdk/ui";
|
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
5
|
import { map as p } from "lodash-es";
|
|
6
6
|
import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
|
|
7
|
-
import { p as v, T as _ } from "./index-
|
|
7
|
+
import { p as v, T as _ } from "./index-Djepisz3.js";
|
|
8
8
|
const b = [
|
|
9
9
|
{
|
|
10
10
|
title: "mobile_xs_title",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),a=require("@chaibuilder/sdk/ui"),h=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-BELYt0c9.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:l,setIframeWidth:i})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>i(s),variant:s===t?"default":"ghost",children:l}),p=()=>{const[t,s]=o.useState(1200),l=r=>s(r),[i,d]=h.useAtom(c.previewUrlAtom);if(!i)return null;const u=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,r=>o.createElement(w,{...r,setIframeWidth:l,key:r.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:u,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor","fill-rule":"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:i})]})};exports.default=p;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "Suraj Air",
|
|
4
4
|
"license": "Private",
|
|
5
5
|
"homepage": "https://chaibuilder.com",
|
|
6
|
-
"version": "0.15.
|
|
6
|
+
"version": "0.15.8",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
67
|
"@chaibuilder/runtime": "2.2.0",
|
|
68
|
-
"@chaibuilder/sdk": "3.0.
|
|
68
|
+
"@chaibuilder/sdk": "3.0.11",
|
|
69
69
|
"@types/react": "*",
|
|
70
70
|
"@types/react-dom": "*",
|
|
71
71
|
"jotai": "2.14.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
},
|
|
83
83
|
"dependencies": {
|
|
84
84
|
"@chaibuilder/runtime": "2.2.0",
|
|
85
|
-
"@chaibuilder/sdk": "3.0.
|
|
85
|
+
"@chaibuilder/sdk": "3.0.11",
|
|
86
86
|
"@mhsdesign/jit-browser-tailwindcss": "^0.4.2",
|
|
87
87
|
"@radix-ui/react-icons": "^1.3.2",
|
|
88
88
|
"@supabase/supabase-js": "2.50.3",
|