@chaibuilder/sdk 4.0.0-beta.7 → 4.0.0-beta.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/README.md +1 -3
- package/dist/{2SSKDMRQ-DDOgISWg.cjs → 2SSKDMRQ-DHv4u_0i.cjs} +1 -1
- package/dist/{2SSKDMRQ-hL7THuKW.js → 2SSKDMRQ-DewwiCoQ.js} +2 -2
- package/dist/{AP7HFJJL-BsLQ13V_.js → AP7HFJJL-ComnZw7J.js} +1 -1
- package/dist/{AP7HFJJL-tcAhVllC.cjs → AP7HFJJL-cz754qhG.cjs} +1 -1
- package/dist/{IconPicker-FLSVAZxx.js → IconPicker-2H9IGKMS.js} +2 -2
- package/dist/{IconPicker-J1KLNrSB.cjs → IconPicker-U0Z2dWeR.cjs} +1 -1
- package/dist/{WDYDFRGG-BTj8AXV6.cjs → WDYDFRGG-BfRX3M58.cjs} +1 -1
- package/dist/{WDYDFRGG-Yi0eNS2V.js → WDYDFRGG-vy7nMYD4.js} +2 -2
- package/dist/{active-in-another-tab-Dozn833d.js → active-in-another-tab-5hn17Jeq.js} +3 -3
- package/dist/{active-in-another-tab-BtAiatqq.cjs → active-in-another-tab-ijahI5qu.cjs} +1 -1
- package/dist/{add-new-language-page-DD-CAoAQ.js → add-new-language-page-DmOyPy0u.js} +4 -4
- package/dist/{add-new-language-page-9AMizlES.cjs → add-new-language-page-vmNKNx-e.cjs} +1 -1
- package/dist/{add-new-page-uZKCk9eB.js → add-new-page-NHScAQn8.js} +2 -2
- package/dist/{add-new-page-BS9vPnFG.cjs → add-new-page-XDuCkOyb.cjs} +1 -1
- package/dist/{ai-panel-content-PovaKJaj.cjs → ai-panel-content-BDqW16AW.cjs} +1 -1
- package/dist/{ai-panel-content-CK4XOkEh.js → ai-panel-content-CHJ0JcQI.js} +4 -4
- package/dist/{ai-panel-default-lang-BtLjUl9d.js → ai-panel-default-lang-BIomgsN0.js} +4 -4
- package/dist/{ai-panel-default-lang-B37k5ADH.cjs → ai-panel-default-lang-HeYWpbMu.cjs} +2 -2
- package/dist/{ai-panel-other-lang-CdQmASqv.cjs → ai-panel-other-lang-BMelEs3p.cjs} +1 -1
- package/dist/{ai-panel-other-lang-Dp1MNaLi.js → ai-panel-other-lang-CbAgG-qX.js} +3 -3
- package/dist/{ai-prompt-input-BT-mEdTX.js → ai-prompt-input-BH8LOVT4.js} +2 -2
- package/dist/{ai-prompt-input-Dtym4w8J.cjs → ai-prompt-input-C_GG6nwq.cjs} +1 -1
- package/dist/{ai-translation-prompt-B-lH7emI.cjs → ai-translation-prompt-CkHaFv5I.cjs} +1 -1
- package/dist/{ai-translation-prompt-B17GK1QR.js → ai-translation-prompt-DxsNw8YR.js} +2 -2
- package/dist/{code-display-DloSPyPr.cjs → code-display-9Onx6RCq.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-oa1j0ri7.js} +1 -1
- package/dist/{code-editor-EZT2pMsU.js → code-editor-CGBAc-A6.js} +1 -1
- package/dist/{code-editor-CUeNiMzA.cjs → code-editor-GV8ibQ4h.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-DMZOc36k.cjs → continue-editing-in-this-client-DKHP0pq8.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CS7C6h9Q.js → continue-editing-in-this-client-Da8ab_9d.js} +3 -3
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +1 -90
- package/dist/core.js +22 -34
- package/dist/css-import-modal-B4j26_cO.cjs +13 -0
- package/dist/{css-import-modal-s7t5gZQo.js → css-import-modal-CcZVLsF9.js} +5 -4
- package/dist/{delete-design-token-Mbw_6sYI.cjs → delete-design-token-3-WwqXMO.cjs} +1 -1
- package/dist/{delete-design-token-C1smbx4E.js → delete-design-token-DzINIVtO.js} +1 -1
- package/dist/{delete-page-B7J3t0FN.cjs → delete-page-B7ODELqM.cjs} +1 -1
- package/dist/{delete-page-2GfBi8Iv.js → delete-page-DwZDMwfI.js} +3 -3
- package/dist/{design-token-usage-DyO3xM-F.js → design-token-usage-DQf180Lg.js} +2 -2
- package/dist/{design-token-usage-BoGOULG8.cjs → design-token-usage-Dy08kcIc.cjs} +1 -1
- package/dist/{digital-asset-manager-DDk2ucTE.cjs → digital-asset-manager-C7subULa.cjs} +1 -1
- package/dist/{digital-asset-manager-Cz3Nlrzl.js → digital-asset-manager-CDy9kHZO.js} +4 -4
- package/dist/{duplicate-page-Dw3U4wTT.cjs → duplicate-page-CWQ9aMd9.cjs} +1 -1
- package/dist/{duplicate-page-BwAY4Ssm.js → duplicate-page-DTnSztlr.js} +4 -4
- package/dist/{dynamic-page-selector-CvBFyX2F.cjs → dynamic-page-selector-DJuxLcsM.cjs} +1 -1
- package/dist/{dynamic-page-selector-sViJuQlU.js → dynamic-page-selector-DYW3ov_u.js} +3 -3
- package/dist/{image-editor-AIsccrqC.cjs → image-editor-C4H3AkZK.cjs} +1 -1
- package/dist/{image-editor-BgGQuESa.js → image-editor-DLeSST0K.js} +1 -1
- package/dist/{index-RYr8kQdI.js → index-BK0xWO1z.js} +5132 -5602
- package/dist/{index-BwH1mRm_.cjs → index-BRJCj7c_.cjs} +2 -2
- package/dist/index-Bm8iS2OH.cjs +160 -0
- package/dist/{index-B7eWP_hB.js → index-D5d4QDq7.js} +19 -21
- package/dist/{json-diff-viewer-Svw-kbhe.js → json-diff-viewer-BYHieVod.js} +3 -3
- package/dist/{json-diff-viewer-B2A78udz.cjs → json-diff-viewer-g6SY62bl.cjs} +1 -1
- package/dist/{lang-panel-Bnc-9wkM.js → lang-panel-BG1GMn-1.js} +4 -4
- package/dist/{lang-panel-AmEkoWid.cjs → lang-panel-Dm1eOO2J.cjs} +1 -1
- package/dist/{manage-design-tokens-BBkh1t4w.js → manage-design-tokens-BdWQUHhw.js} +3 -3
- package/dist/{manage-design-tokens-B2fG80bi.cjs → manage-design-tokens-XWs_B6jo.cjs} +1 -1
- package/dist/{mark-as-template-0CPzZnk-.js → mark-as-template-D2XxagVO.js} +3 -3
- package/dist/{mark-as-template-CE6tRoQy.cjs → mark-as-template-DUFnfVM3.cjs} +1 -1
- package/dist/{nested-path-selector-content-SmfjElr-.cjs → nested-path-selector-content-CQOx2L9C.cjs} +1 -1
- package/dist/{nested-path-selector-content-kGznHufl.js → nested-path-selector-content-Wd6-Eql0.js} +2 -2
- package/dist/{no-language-page-content-DXsAPDZd.js → no-language-page-content-BOv6TZIk.js} +3 -3
- package/dist/{no-language-page-content-B4bQLc4K.cjs → no-language-page-content-C11uF6hs.cjs} +1 -1
- package/dist/{no-language-page-dialog-BC8NHzK2.cjs → no-language-page-dialog-CY5XhXsC.cjs} +1 -1
- package/dist/{no-language-page-dialog-BpPqmw9a.js → no-language-page-dialog-DIXyKRJq.js} +2 -2
- package/dist/{page-creator-Bazn6yH4.js → page-creator-WX9lMrJY.js} +4 -4
- package/dist/{page-creator-82qTbBj4.cjs → page-creator-zSUFF4eT.cjs} +1 -1
- package/dist/{page-lock-CRFyqKZE.js → page-lock-D9miLZjm.js} +2 -2
- package/dist/{page-lock-D2iFZDUK.cjs → page-lock-DGhR_url.cjs} +1 -1
- package/dist/{page-locked-dialog-GKfQEOmk.js → page-locked-dialog-CNCUCcvH.js} +3 -3
- package/dist/{page-locked-dialog-xLqvKzax.cjs → page-locked-dialog-DTLnbfuP.cjs} +1 -1
- package/dist/{page-manager-new-DItY2hjd.js → page-manager-new-BFFOLh-l.js} +4 -4
- package/dist/{page-manager-new-Bn2QKjbf.cjs → page-manager-new-Dd2c-Q_O.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-Dc4ky-qV.cjs → page-manager-search-and-filter-BKdQUJ2W.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-CPa8IXdd.js → page-manager-search-and-filter-C1IWF_4d.js} +3 -3
- package/dist/page-revisions-content-D0cflnj1.cjs +1 -0
- package/dist/{page-revisions-content-CH-PZK0O.js → page-revisions-content-DHapiLck.js} +75 -67
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +2 -1
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-CSJCFElu.js → publish-pages-content-Bd2zJHtK.js} +4 -4
- package/dist/{publish-pages-content-BzJDObqr.cjs → publish-pages-content-BqLcnKry.cjs} +1 -1
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-CX_JkRJn.js} +78 -78
- package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
- package/dist/render.d.ts +2 -1
- package/dist/{rte-widget-modal-BfXcA7OP.cjs → rte-widget-modal-DiB5BjH1.cjs} +1 -1
- package/dist/{rte-widget-modal-5T81P_hg.js → rte-widget-modal-RS8PMKOn.js} +7 -7
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +1 -163
- package/dist/runtime.js +71 -72
- package/dist/{save-to-lib-MtWKSVeN.js → save-to-lib--6ZXHEbC.js} +3 -3
- package/dist/{save-to-lib-DGAdSa-0.cjs → save-to-lib-BXJvaC1N.cjs} +1 -1
- package/dist/{selected-block-display-DLt_nMn9.cjs → selected-block-display-BfpJda4h.cjs} +1 -1
- package/dist/{selected-block-display-CB1-hVR5.js → selected-block-display-CUnCqXQw.js} +3 -3
- package/dist/{seo-panel-CRzzw4FW.js → seo-panel-Bs-FcY1A.js} +3 -3
- package/dist/{seo-panel-_kGXE9MC.cjs → seo-panel-CQITMfZ6.cjs} +1 -1
- package/dist/{shared-json-ld-CXukkDeS.js → shared-json-ld-7EujD341.js} +3 -3
- package/dist/{shared-json-ld-DoRgzDPC.cjs → shared-json-ld-DDXXi-Mj.cjs} +1 -1
- package/dist/{slug-input-Dp187Tiy.cjs → slug-input-CsVJAr7r.cjs} +1 -1
- package/dist/{slug-input-CeEQ0zyv.js → slug-input-DoEIq5rs.js} +2 -2
- package/dist/{take-over-request-C9J3_rev.js → take-over-request-C14kJ356.js} +3 -3
- package/dist/{take-over-request-CXuakFBm.cjs → take-over-request-D5Oo3MPo.cjs} +1 -1
- package/dist/{theme-panel-footer-DvwsyHNQ.js → theme-panel-footer-Dvknelm8.js} +3 -3
- package/dist/{theme-panel-footer-CWZ0qs13.cjs → theme-panel-footer-Eeibz2JA.cjs} +1 -1
- package/dist/{translation-warning-modal-DEt_ExQp.cjs → translation-warning-modal-CPzdHzqq.cjs} +1 -1
- package/dist/{translation-warning-modal-_aBp5ZZQ.js → translation-warning-modal-YlzP2XoO.js} +2 -2
- package/dist/{unmark-as-template-BYL5naYx.cjs → unmark-as-template-BGDwuCnv.cjs} +1 -1
- package/dist/{unmark-as-template-JN-cDUV_.js → unmark-as-template-CPJvQk7L.js} +3 -3
- package/dist/{unpublish-page-B06iZEIO.cjs → unpublish-page-BMowW5wT.cjs} +1 -1
- package/dist/{unpublish-page-DqwBY2yI.js → unpublish-page-DlFHLlmI.js} +3 -3
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +43 -43
- package/dist/{web-preview-h39D3TUh.js → web-preview-BUnv3jIc.js} +2 -2
- package/dist/{web-preview-wRgRY3Tv.cjs → web-preview-D8GQHCjs.cjs} +1 -1
- package/package.json +8 -7
- package/dist/css-import-modal-kHB0ramf.cjs +0 -13
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/index-xYnNKovy.cjs +0 -160
- package/dist/page-revisions-content-CcLFI4YK.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as a, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { B as g } from "./register-chai-top-bar-
|
|
3
|
-
import { n as le, a9 as re, aa as ie, a2 as de, ab as y, Q as ce, D as q, d as G, e as j, f as L, p as z, q as
|
|
4
|
-
import { ar as R, as as A, A as b, aw as
|
|
5
|
-
import { useQuery as pe, useQueryClient as O, useMutation as
|
|
2
|
+
import { B as g } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
+
import { n as le, a9 as re, aa as ie, a2 as de, ab as y, Q as ce, D as q, d as G, e as j, f as L, p as z, q as $, r as oe, s as ue, t as me, v as U, ac as he } from "./index-BK0xWO1z.js";
|
|
4
|
+
import { ar as R, as as A, A as b, aw as H, az as fe, ap as I, ax as C, ay as w } from "./index-D5d4QDq7.js";
|
|
5
|
+
import { useQuery as pe, useQueryClient as O, useMutation as Q } from "@tanstack/react-query";
|
|
6
6
|
import { format as D, formatDistanceToNow as xe } from "date-fns";
|
|
7
7
|
import { isEmpty as ge } from "lodash-es";
|
|
8
|
-
import { FileJson as Ne, CloudOff as be, Undo2 as
|
|
8
|
+
import { FileJson as Ne, CloudOff as be, Undo2 as J, Trash as P, X as ye, Rocket as ve, Save as we, MoreHorizontal as De } from "lucide-react";
|
|
9
9
|
import * as v from "react";
|
|
10
10
|
import { useEffect as F, startTransition as Se, useState as Ee, Suspense as Ce, lazy as Re } from "react";
|
|
11
11
|
function Ae(t) {
|
|
@@ -22,7 +22,7 @@ function Ae(t) {
|
|
|
22
22
|
}
|
|
23
23
|
const Ie = () => {
|
|
24
24
|
const t = R(), s = A(), n = O();
|
|
25
|
-
return
|
|
25
|
+
return Q({
|
|
26
26
|
mutationFn: async (i) => await s(t, {
|
|
27
27
|
action: b.DELETE_PAGE_REVISION,
|
|
28
28
|
data: { revisionId: i }
|
|
@@ -35,10 +35,14 @@ const Ie = () => {
|
|
|
35
35
|
});
|
|
36
36
|
}, Oe = () => {
|
|
37
37
|
const t = R(), s = A(), n = O();
|
|
38
|
-
return
|
|
39
|
-
mutationFn: async ({
|
|
38
|
+
return Q({
|
|
39
|
+
mutationFn: async ({
|
|
40
|
+
revisionId: i,
|
|
41
|
+
discardCurrent: r,
|
|
42
|
+
pageId: d
|
|
43
|
+
}) => await s(t, {
|
|
40
44
|
action: b.RESTORE_PAGE_REVISION,
|
|
41
|
-
data: { revisionId: i, discardCurrent:
|
|
45
|
+
data: { revisionId: i, discardCurrent: r, ...d && { pageId: d } }
|
|
42
46
|
}),
|
|
43
47
|
onSuccess: () => {
|
|
44
48
|
n.invalidateQueries({
|
|
@@ -46,7 +50,7 @@ const Ie = () => {
|
|
|
46
50
|
});
|
|
47
51
|
}
|
|
48
52
|
});
|
|
49
|
-
}, ke = Re(() => import("./json-diff-viewer-
|
|
53
|
+
}, ke = Re(() => import("./json-diff-viewer-BYHieVod.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ a("div", { className: "flex items-center gap-1 rounded-full bg-amber-500/10 px-1.5 py-0.5 text-xs text-amber-600", children: [
|
|
50
54
|
/* @__PURE__ */ a("span", { className: "relative flex h-2 w-2", children: [
|
|
51
55
|
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
|
|
52
56
|
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
|
|
@@ -66,22 +70,22 @@ const Ie = () => {
|
|
|
66
70
|
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Unsaved changes" })
|
|
67
71
|
] }) : /* @__PURE__ */ e("span", { className: "rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600", children: t });
|
|
68
72
|
function Me({ compare: t, setCompare: s }) {
|
|
69
|
-
const { data: n } =
|
|
73
|
+
const { data: n } = H(), { saveState: i } = ce(), [r] = fe();
|
|
70
74
|
if (!n) return null;
|
|
71
|
-
const d = !!t.find((
|
|
72
|
-
var
|
|
73
|
-
return (
|
|
74
|
-
}),
|
|
75
|
+
const d = !!t.find((u) => {
|
|
76
|
+
var l;
|
|
77
|
+
return (l = u == null ? void 0 : u.uid) == null ? void 0 : l.startsWith("draft:");
|
|
78
|
+
}), o = t.length >= 2 && !d, m = i === "UNSAVED";
|
|
75
79
|
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50", children: [
|
|
76
80
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-1", children: [
|
|
77
81
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-sm font-medium leading-none", children: [
|
|
78
82
|
/* @__PURE__ */ e(N, { tag: "draft" }),
|
|
79
83
|
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: "Currently editing" })
|
|
80
84
|
] }) }),
|
|
81
|
-
/* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(
|
|
85
|
+
/* @__PURE__ */ e("div", { className: "flex items-center pl-2 text-[11px] text-muted-foreground", children: !ge(r.lastSaved) && /* @__PURE__ */ a("span", { children: [
|
|
82
86
|
"Last updated",
|
|
83
87
|
" ",
|
|
84
|
-
xe(new Date(
|
|
88
|
+
xe(new Date(r.lastSaved), {
|
|
85
89
|
addSuffix: !0
|
|
86
90
|
})
|
|
87
91
|
] }) }),
|
|
@@ -91,9 +95,9 @@ function Me({ compare: t, setCompare: s }) {
|
|
|
91
95
|
K,
|
|
92
96
|
{
|
|
93
97
|
checked: d,
|
|
94
|
-
disabled:
|
|
98
|
+
disabled: o,
|
|
95
99
|
onChange: () => {
|
|
96
|
-
s(d ? t.filter((
|
|
100
|
+
s(d ? t.filter((u) => u.uid !== `draft:${n == null ? void 0 : n.id}`) : [
|
|
97
101
|
...t,
|
|
98
102
|
{ uid: `draft:${n == null ? void 0 : n.id}`, label: "draft", item: { createdAt: Date.now() } }
|
|
99
103
|
]);
|
|
@@ -117,22 +121,22 @@ function V({
|
|
|
117
121
|
isLatest: s,
|
|
118
122
|
onRestore: n,
|
|
119
123
|
onDelete: i,
|
|
120
|
-
revisionNumber:
|
|
124
|
+
revisionNumber: r,
|
|
121
125
|
compare: d,
|
|
122
|
-
setCompare:
|
|
126
|
+
setCompare: o,
|
|
123
127
|
pageId: m
|
|
124
128
|
}) {
|
|
125
|
-
const { data:
|
|
129
|
+
const { data: u } = I(t.currentEditor), l = (u == null ? void 0 : u.name) || "Unknown", f = !!d.find((h) => {
|
|
126
130
|
var x;
|
|
127
131
|
return s ? (x = h == null ? void 0 : h.uid) == null ? void 0 : x.startsWith("live") : (h == null ? void 0 : h.uid) === t.uid;
|
|
128
132
|
}), S = d.length >= 2 && !f;
|
|
129
133
|
return /* @__PURE__ */ a("div", { className: "relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50", children: [
|
|
130
134
|
/* @__PURE__ */ a("div", { className: "flex-1 space-y-3", children: [
|
|
131
135
|
/* @__PURE__ */ e("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ a("p", { className: "flex items-center gap-1 text-xs leading-none", children: [
|
|
132
|
-
/* @__PURE__ */ e(N, { tag: s ? "live" : `#${
|
|
136
|
+
/* @__PURE__ */ e(N, { tag: s ? "live" : `#${r}` }),
|
|
133
137
|
t.type === "published" ? "Published" : "Draft",
|
|
134
138
|
" by ",
|
|
135
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children:
|
|
139
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold", children: l })
|
|
136
140
|
] }) }),
|
|
137
141
|
/* @__PURE__ */ a("div", { className: "flex items-center gap-x-3", children: [
|
|
138
142
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: t.type === "published" ? /* @__PURE__ */ e(N, { tag: "published" }) : /* @__PURE__ */ e(N, { tag: "draft" }) }),
|
|
@@ -146,12 +150,12 @@ function V({
|
|
|
146
150
|
checked: f,
|
|
147
151
|
disabled: S,
|
|
148
152
|
onChange: () => {
|
|
149
|
-
|
|
153
|
+
o(
|
|
150
154
|
f ? d.filter((h) => s ? h.uid !== `live:${m}` : h.uid !== t.uid) : [
|
|
151
155
|
...d,
|
|
152
156
|
{
|
|
153
157
|
uid: s ? `live:${m}` : t.uid,
|
|
154
|
-
label: s ? "live" : `#${
|
|
158
|
+
label: s ? "live" : `#${r}`,
|
|
155
159
|
item: t
|
|
156
160
|
}
|
|
157
161
|
].sort((h, x) => new Date(h.item.createdAt).getTime() - new Date(x.item.createdAt).getTime())
|
|
@@ -162,16 +166,16 @@ function V({
|
|
|
162
166
|
] });
|
|
163
167
|
}
|
|
164
168
|
function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
165
|
-
const [i,
|
|
169
|
+
const [i, r] = Ee(!1), [d, o] = t;
|
|
166
170
|
if (t.length === 0) return null;
|
|
167
|
-
const m = ({ tab:
|
|
168
|
-
/* @__PURE__ */ e(N, { tag:
|
|
171
|
+
const m = ({ tab: u }) => /* @__PURE__ */ a("span", { className: "flex items-center justify-between rounded border border-blue-100 p-1 font-medium", children: [
|
|
172
|
+
/* @__PURE__ */ e(N, { tag: u.label }),
|
|
169
173
|
/* @__PURE__ */ e(
|
|
170
174
|
"button",
|
|
171
175
|
{
|
|
172
176
|
className: "z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",
|
|
173
177
|
style: { lineHeight: 1 },
|
|
174
|
-
onClick: () => s(t.filter((
|
|
178
|
+
onClick: () => s(t.filter((l) => l.uid !== u.uid)),
|
|
175
179
|
"aria-label": "Remove selection 1",
|
|
176
180
|
children: /* @__PURE__ */ e(ye, { className: "h-3 w-3" })
|
|
177
181
|
}
|
|
@@ -182,7 +186,7 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
|
182
186
|
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "Compare" }),
|
|
183
187
|
d && /* @__PURE__ */ e(m, { tab: d }),
|
|
184
188
|
/* @__PURE__ */ e("span", { className: "font-medium leading-tight text-gray-600", children: "with" }),
|
|
185
|
-
|
|
189
|
+
o ? /* @__PURE__ */ e(m, { tab: o }) : /* @__PURE__ */ e("span", { className: "rounded border px-1 text-xs text-muted-foreground", children: "Choose another" })
|
|
186
190
|
] }),
|
|
187
191
|
/* @__PURE__ */ a("div", { className: "flex items-center justify-end gap-2 pb-0.5 pt-2", children: [
|
|
188
192
|
/* @__PURE__ */ e(
|
|
@@ -201,7 +205,7 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
|
201
205
|
size: "sm",
|
|
202
206
|
className: "h-6 gap-1 rounded px-2 text-xs leading-none",
|
|
203
207
|
variant: "default",
|
|
204
|
-
onClick: () =>
|
|
208
|
+
onClick: () => r(!0),
|
|
205
209
|
disabled: t.length < 2,
|
|
206
210
|
children: [
|
|
207
211
|
/* @__PURE__ */ e(Ne, { className: "h-2.5 w-2.5" }),
|
|
@@ -214,7 +218,7 @@ function _e({ compare: t, setCompare: s, pageId: n }) {
|
|
|
214
218
|
Ce,
|
|
215
219
|
{
|
|
216
220
|
fallback: /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-4", children: /* @__PURE__ */ e("span", { className: "text-sm", children: "Loading diff viewer..." }) }),
|
|
217
|
-
children: /* @__PURE__ */ e(ke, { open: i, onOpenChange:
|
|
221
|
+
children: /* @__PURE__ */ e(ke, { open: i, onOpenChange: r, compare: t })
|
|
218
222
|
}
|
|
219
223
|
)
|
|
220
224
|
] });
|
|
@@ -242,13 +246,13 @@ function Ue({ revision: t, onRestore: s, onDelete: n }) {
|
|
|
242
246
|
] }) }),
|
|
243
247
|
/* @__PURE__ */ a(me, { align: "end", className: "text-xs", children: [
|
|
244
248
|
/* @__PURE__ */ e(C, { permission: w.RESTORE_REVISION, children: /* @__PURE__ */ a(U, { onClick: s, className: "cursor-pointer text-sm", children: [
|
|
245
|
-
/* @__PURE__ */ e(
|
|
249
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
246
250
|
/* @__PURE__ */ e("span", { children: "Restore this version" })
|
|
247
251
|
] }) }),
|
|
248
252
|
/* @__PURE__ */ e(C, { permission: w.DELETE_REVISION, children: t.uid !== "current" && /* @__PURE__ */ a(p, { children: [
|
|
249
253
|
/* @__PURE__ */ e(he, {}),
|
|
250
254
|
/* @__PURE__ */ a(U, { onClick: n, className: "cursor-pointer text-destructive", children: [
|
|
251
|
-
/* @__PURE__ */ e(
|
|
255
|
+
/* @__PURE__ */ e(P, { className: "mr-2 h-4 w-4" }),
|
|
252
256
|
/* @__PURE__ */ e("span", { children: "Delete this version" })
|
|
253
257
|
] })
|
|
254
258
|
] }) })
|
|
@@ -260,15 +264,15 @@ function Fe({
|
|
|
260
264
|
onOpenChange: s,
|
|
261
265
|
revision: n,
|
|
262
266
|
onRestore: i,
|
|
263
|
-
isRestoring:
|
|
267
|
+
isRestoring: r
|
|
264
268
|
}) {
|
|
265
|
-
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""),
|
|
269
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
|
|
266
270
|
return n ? /* @__PURE__ */ e(
|
|
267
271
|
q,
|
|
268
272
|
{
|
|
269
273
|
open: t,
|
|
270
274
|
onOpenChange: (m) => {
|
|
271
|
-
|
|
275
|
+
r || s(m);
|
|
272
276
|
},
|
|
273
277
|
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
274
278
|
/* @__PURE__ */ a(j, { children: [
|
|
@@ -280,23 +284,23 @@ function Fe({
|
|
|
280
284
|
" ",
|
|
281
285
|
D(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
282
286
|
" by ",
|
|
283
|
-
|
|
287
|
+
o
|
|
284
288
|
] })
|
|
285
289
|
] }),
|
|
286
290
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "How would you like to handle your current edits?" }) }),
|
|
287
|
-
/* @__PURE__ */ a(
|
|
288
|
-
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled:
|
|
291
|
+
/* @__PURE__ */ a($, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
292
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => i(!1), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
289
293
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
290
294
|
"Saving as draft..."
|
|
291
295
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
292
296
|
/* @__PURE__ */ e(be, { className: "mr-2 h-4 w-4" }),
|
|
293
297
|
"Save as draft"
|
|
294
298
|
] }) }),
|
|
295
|
-
/* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled:
|
|
299
|
+
/* @__PURE__ */ e(g, { variant: "default", className: "sm:flex-1", onClick: () => i(!0), disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
296
300
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
297
301
|
"Discarding current..."
|
|
298
302
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
299
|
-
/* @__PURE__ */ e(
|
|
303
|
+
/* @__PURE__ */ e(J, { className: "mr-2 h-4 w-4" }),
|
|
300
304
|
"Discard current"
|
|
301
305
|
] }) })
|
|
302
306
|
] })
|
|
@@ -309,15 +313,15 @@ function Ve({
|
|
|
309
313
|
onOpenChange: s,
|
|
310
314
|
revision: n,
|
|
311
315
|
onDelete: i,
|
|
312
|
-
isDeleting:
|
|
316
|
+
isDeleting: r
|
|
313
317
|
}) {
|
|
314
|
-
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""),
|
|
318
|
+
const { data: d } = I((n == null ? void 0 : n.currentEditor) || ""), o = (d == null ? void 0 : d.name) || "Unknown";
|
|
315
319
|
return n ? /* @__PURE__ */ e(
|
|
316
320
|
q,
|
|
317
321
|
{
|
|
318
322
|
open: t,
|
|
319
323
|
onOpenChange: (m) => {
|
|
320
|
-
|
|
324
|
+
r || s(m);
|
|
321
325
|
},
|
|
322
326
|
children: /* @__PURE__ */ a(G, { className: "sm:max-w-md", children: [
|
|
323
327
|
/* @__PURE__ */ a(j, { children: [
|
|
@@ -329,17 +333,17 @@ function Ve({
|
|
|
329
333
|
" ",
|
|
330
334
|
D(n.createdAt, "MMM d, yyyy 'at' h:mm a"),
|
|
331
335
|
" by ",
|
|
332
|
-
|
|
336
|
+
o
|
|
333
337
|
] })
|
|
334
338
|
] }),
|
|
335
339
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This action cannot be undone. Are you sure you want to proceed?" }) }),
|
|
336
|
-
/* @__PURE__ */ a(
|
|
337
|
-
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled:
|
|
338
|
-
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled:
|
|
340
|
+
/* @__PURE__ */ a($, { className: "flex flex-col gap-2 sm:flex-row", children: [
|
|
341
|
+
/* @__PURE__ */ e(g, { variant: "outline", className: "sm:flex-1", onClick: () => s(!1), disabled: r, children: "Cancel" }),
|
|
342
|
+
/* @__PURE__ */ e(g, { variant: "destructive", className: "sm:flex-1", onClick: i, disabled: r, children: r ? /* @__PURE__ */ a(p, { children: [
|
|
339
343
|
/* @__PURE__ */ e("span", { className: "mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
340
344
|
"Deleting..."
|
|
341
345
|
] }) : /* @__PURE__ */ a(p, { children: [
|
|
342
|
-
/* @__PURE__ */ e(
|
|
346
|
+
/* @__PURE__ */ e(P, { className: "mr-2 h-4 w-4" }),
|
|
343
347
|
"Delete Revision"
|
|
344
348
|
] }) })
|
|
345
349
|
] })
|
|
@@ -347,27 +351,31 @@ function Ve({
|
|
|
347
351
|
}
|
|
348
352
|
) : null;
|
|
349
353
|
}
|
|
350
|
-
function
|
|
354
|
+
function Pe({ isOpen: t }) {
|
|
351
355
|
var T, _;
|
|
352
|
-
const [s, n] = v.useState([]), [i,
|
|
356
|
+
const [s, n] = v.useState([]), [i, r] = v.useState(null), [d, o] = v.useState(!1), [m, u] = v.useState(!1), { data: l } = H(), { data: f, isFetching: S, error: h, refetch: x } = Ae(l == null ? void 0 : l.id), { mutate: B, isPending: W } = Ie(), { mutate: Y, isPending: X } = Oe(), Z = O(), { selectedLang: ee, fallbackLang: te } = le(), ae = ee || te;
|
|
353
357
|
F(() => {
|
|
354
358
|
Se(() => n([]));
|
|
355
|
-
}, [
|
|
359
|
+
}, [l == null ? void 0 : l.id]);
|
|
356
360
|
const ne = (c) => {
|
|
357
361
|
i && Y(
|
|
358
|
-
{
|
|
362
|
+
{
|
|
363
|
+
revisionId: i.uid,
|
|
364
|
+
discardCurrent: c,
|
|
365
|
+
...i.uid === "current" && (l == null ? void 0 : l.id) && { pageId: l.id }
|
|
366
|
+
},
|
|
359
367
|
{
|
|
360
368
|
onSuccess: () => {
|
|
361
|
-
|
|
369
|
+
o(!1), r(null), Z.invalidateQueries({
|
|
362
370
|
queryKey: [b.GET_DRAFT_PAGE]
|
|
363
371
|
});
|
|
364
372
|
}
|
|
365
373
|
}
|
|
366
374
|
);
|
|
367
375
|
}, k = (c) => {
|
|
368
|
-
|
|
376
|
+
r(c), o(!0);
|
|
369
377
|
}, M = (c) => {
|
|
370
|
-
|
|
378
|
+
r(c), u(!0);
|
|
371
379
|
}, se = () => {
|
|
372
380
|
i && B(i.uid, {
|
|
373
381
|
/**
|
|
@@ -375,7 +383,7 @@ function Je({ isOpen: t }) {
|
|
|
375
383
|
* delete dialog and resets the selected revision to null.
|
|
376
384
|
*/
|
|
377
385
|
onSuccess: () => {
|
|
378
|
-
|
|
386
|
+
u(!1), r(null);
|
|
379
387
|
}
|
|
380
388
|
});
|
|
381
389
|
};
|
|
@@ -384,18 +392,18 @@ function Je({ isOpen: t }) {
|
|
|
384
392
|
}, [t, x]), /* @__PURE__ */ a(p, { children: [
|
|
385
393
|
/* @__PURE__ */ a(re, { children: [
|
|
386
394
|
/* @__PURE__ */ e(ie, { children: "Revision History" }),
|
|
387
|
-
(
|
|
395
|
+
(l == null ? void 0 : l.createdAt) && /* @__PURE__ */ a("p", { className: "mt-1 text-xs text-muted-foreground", children: [
|
|
388
396
|
"Page created on ",
|
|
389
|
-
D(new Date(
|
|
397
|
+
D(new Date(l.createdAt), "MMM d, yyyy 'at' h:mm a")
|
|
390
398
|
] })
|
|
391
399
|
] }),
|
|
392
400
|
S ? /* @__PURE__ */ e(Te, {}) : h ? /* @__PURE__ */ e("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ a("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
|
|
393
|
-
/* @__PURE__ */ e(_e, { lang: ae, compare: s, setCompare: n, pageId:
|
|
401
|
+
/* @__PURE__ */ e(_e, { lang: ae, compare: s, setCompare: n, pageId: l == null ? void 0 : l.id }),
|
|
394
402
|
/* @__PURE__ */ e(Me, { compare: s, setCompare: n }),
|
|
395
403
|
(T = f == null ? void 0 : f.filter((c) => c.uid === "current")) == null ? void 0 : T.map((c, E) => /* @__PURE__ */ e(
|
|
396
404
|
V,
|
|
397
405
|
{
|
|
398
|
-
pageId:
|
|
406
|
+
pageId: l == null ? void 0 : l.id,
|
|
399
407
|
revision: c,
|
|
400
408
|
isLatest: !0,
|
|
401
409
|
onRestore: () => k(c),
|
|
@@ -409,7 +417,7 @@ function Je({ isOpen: t }) {
|
|
|
409
417
|
/* @__PURE__ */ e(de, { className: "min-h-0 flex-1", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: (_ = f == null ? void 0 : f.filter((c) => c.uid !== "current")) == null ? void 0 : _.map((c, E) => /* @__PURE__ */ e(
|
|
410
418
|
V,
|
|
411
419
|
{
|
|
412
|
-
pageId:
|
|
420
|
+
pageId: l == null ? void 0 : l.id,
|
|
413
421
|
revision: c,
|
|
414
422
|
isLatest: c.uid === "current",
|
|
415
423
|
onRestore: () => k(c),
|
|
@@ -425,7 +433,7 @@ function Je({ isOpen: t }) {
|
|
|
425
433
|
Fe,
|
|
426
434
|
{
|
|
427
435
|
open: d,
|
|
428
|
-
onOpenChange:
|
|
436
|
+
onOpenChange: o,
|
|
429
437
|
revision: i,
|
|
430
438
|
onRestore: ne,
|
|
431
439
|
isRestoring: X
|
|
@@ -435,7 +443,7 @@ function Je({ isOpen: t }) {
|
|
|
435
443
|
Ve,
|
|
436
444
|
{
|
|
437
445
|
open: m,
|
|
438
|
-
onOpenChange:
|
|
446
|
+
onOpenChange: u,
|
|
439
447
|
revision: i,
|
|
440
448
|
onDelete: se,
|
|
441
449
|
isDeleting: W
|
|
@@ -444,5 +452,5 @@ function Je({ isOpen: t }) {
|
|
|
444
452
|
] });
|
|
445
453
|
}
|
|
446
454
|
export {
|
|
447
|
-
|
|
455
|
+
Pe as default
|
|
448
456
|
};
|
package/dist/pages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BRJCj7c_.cjs");exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.PermissionChecker=e.PermissionChecker;exports.useActivePage=e.useActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiCurrentPage=e.useChaiCurrentPage;exports.useChaiUserInfo=e.useChaiUserInfo;exports.useClearAll=e.useClearAll;exports.useFallbackLang=e.useFallbackLang;exports.useFetch=e.useFetch;exports.useGotoPage=e.useGotoPage;exports.useLanguagePages=e.useLanguagePages;exports.usePageTypes=e.usePageTypes;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useUserRoleAndPermissions;exports.useWebsitePages=e.useWebsitePages;exports.useWebsiteSetting=e.useWebsiteSetting;
|
package/dist/pages.d.ts
CHANGED
|
@@ -28,8 +28,9 @@ declare type ChaiBlock<T = Record<string, any>> = {
|
|
|
28
28
|
_id: string;
|
|
29
29
|
_name?: string;
|
|
30
30
|
_parent?: string | null | undefined;
|
|
31
|
-
_type: string;
|
|
32
31
|
_libBlock?: string;
|
|
32
|
+
_type: string;
|
|
33
|
+
partialBlockId?: string;
|
|
33
34
|
} & T;
|
|
34
35
|
|
|
35
36
|
declare interface ChaiBuilderEditorProps {
|
package/dist/pages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aE as s, aT as u, aP as t, aN as i, aO as r, ax as g, aU as P, ar as l, v as h, aK as n, aZ as o, aw as c, ap as C, aV as d, k as p, as as m, aW as A, l as U, m as b, aX as k, aY as W, a_ as v, g as B, j as F } from "./index-
|
|
1
|
+
import { aE as s, aT as u, aP as t, aN as i, aO as r, ax as g, aU as P, ar as l, v as h, aK as n, aZ as o, aw as c, ap as C, aV as d, k as p, as as m, aW as A, l as U, m as b, aX as k, aY as W, a_ as v, g as B, j as F } from "./index-D5d4QDq7.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ChaiJsonInput,
|
|
4
4
|
u as ChaiWebsiteBuilder,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
-
import { B as L } from "./register-chai-top-bar-
|
|
3
|
-
import { d as K, e as Q, f as J, p as V, q as W } from "./index-
|
|
4
|
-
import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-
|
|
5
|
-
import { LanguageSelector as ae } from "./page-manager-search-and-filter-
|
|
2
|
+
import { B as L } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
+
import { d as K, e as Q, f as J, p as V, q as W } from "./index-BK0xWO1z.js";
|
|
4
|
+
import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-D5d4QDq7.js";
|
|
5
|
+
import { LanguageSelector as ae } from "./page-manager-search-and-filter-C1IWF_4d.js";
|
|
6
6
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
7
7
|
import { find as B, filter as a, map as b, keys as re, get as F, includes as C, orderBy as N, isEmpty as oe, uniq as G, first as ce, concat as ie } from "lodash-es";
|
|
8
8
|
import { Lock as de, GlobeIcon as ue, File as me, Edit as he } from "lucide-react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-DWTuRU53.cjs"),f=require("./index-Bm8iS2OH.cjs"),r=require("./index-BRJCj7c_.cjs"),U=require("./page-manager-search-and-filter-BKdQUJ2W.cjs"),F=require("@tanstack/react-query"),t=require("lodash-es"),b=require("lucide-react"),a=require("react"),M=()=>{const l=r.useApiUrl(),d=r.useFetch();return F.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>d(l,{action:r.ACTIONS.GET_CHANGES})})},G=({page:l,selectedPages:d,handleCheckboxChange:N,getPageType:y,hasSlug:h,currentOwnerId:c})=>{const x=r.useUserId(),{data:u}=r.useChaiUserInfo(c),o=c===x?null:u==null?void 0:u.name;return e.jsxs("tr",{className:"group relative border-b last:border-b-0 hover:bg-gray-50",children:[e.jsxs("td",{scope:"row",className:`flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o?"opacity-50":""}`,children:[o?e.jsx(b.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(d,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),N(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",h(l.pageType)?e.jsx(b.File,{className:"h-4 w-4"}):e.jsx(b.GlobeIcon,{className:"h-4 w-4"}),e.jsx(r.Tooltip,{content:l.name,side:"top",showTooltip:l.name.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-medium text-black",children:l.name})}),l.slug&&e.jsx(r.Tooltip,{content:l.slug,side:"top",showTooltip:l.slug.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs text-muted-foreground",children:l.slug})})]}),e.jsx("td",{className:"px-2",children:y(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:o&&e.jsxs("button",{className:"absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[e.jsx(b.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:o})," is editing this page"]})})]},l==null?void 0:l.id)},O=({onClose:l=()=>{},isPending:d,publishPage:N})=>{const y=r.useUserId(),{pageToUser:h}=r.usePageToUser(),[c,x]=a.useState([]),u=r.useFallbackLang(),[o,p]=a.useState(u),{data:T,isFetching:C}=M(),{data:m}=r.usePageTypes(),k=a.useCallback(s=>{var n;return(n=t.find(m,{key:s}))==null?void 0:n.hasSlug},[m]),j=a.useMemo(()=>t.filter(m,s=>!k(s.key)).map(s=>s.key),[k,m]),P=t.uniq(t.map(T,"lang")).filter(Boolean),i=a.useMemo(()=>t.filter(T,s=>s.pageType==="theme"?!1:o===u?s.lang===o||s.lang==="":s.lang===o),[T,o,u]),w=a.useMemo(()=>t.filter(i,s=>!j.includes(s.pageType)),[i,j]),S=a.useMemo(()=>t.filter(i,s=>j.includes(s.pageType)),[i,j]);a.useEffect(()=>{const s=t.map(t.filter(i,{online:!0}),"id");a.startTransition(()=>x(s))},[i]),a.useEffect(()=>{const s=t.filter(t.keys(h),n=>t.get(h,[n,"userId"])!==y);a.startTransition(()=>x(n=>t.filter(n,g=>!t.includes(s,g))))},[h,y]);const v=c.length===(i==null?void 0:i.length),E=s=>{x(n=>t.includes(n,s)?t.filter(n,g=>g!==s):t.concat(n,s))},B=()=>{x(v?[]:t.map(i,"id"))},I=()=>{N({ids:t.uniq(c)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(u)}})},A=s=>{if(s==="theme")return"Theme";const n=t.find(m,{key:s});return n?n==null?void 0:n.name:s},L=a.useMemo(()=>{const s=[{label:"Updated",top:"pt-2"},...t.orderBy(t.filter(w,{online:!0}),"pageType"),...t.orderBy(t.filter(S,{online:!0}),"pageType")].filter(g=>g.pageType!=="theme"),n=[{label:"Offline",top:"pt-6"},...t.orderBy(t.filter(w,{online:!1}),"pageType"),...t.orderBy(t.filter(S,{online:!1}),"pageType")];return[...s,...n]},[w,S]);return e.jsxs(f.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:"Publish changes"}),e.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),P.length>0&&e.jsx("div",{className:"my-[2px] mt-0",children:e.jsx(U.LanguageSelector,{languages:[u,...P],selectedLanguage:o,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:C?e.jsxs("div",{className:"space-y-2 px-1",children:[e.jsx("div",{className:"mt-2 h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"})]}):e.jsxs("table",{className:"w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right",children:[e.jsx("thead",{className:"sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400",children:e.jsxs("tr",{children:[e.jsxs("th",{scope:"col",className:"w-[1 50px] flex items-center gap-x-2 px-6 py-3",children:[e.jsx("input",{checked:v,onClick:s=>{s.stopPropagation(),B()},type:"checkbox",className:"mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"}),"Name"]}),e.jsx("th",{scope:"col",className:"w-[150px] px-2 py-3",children:"Type"}),e.jsx("th",{scope:"col",className:"w-[150px] px-4 py-3 text-right",children:"Status"})]})}),e.jsx("tbody",{children:t.map(L,s=>s.label?e.jsx("tr",{children:e.jsxs("td",{colSpan:3,className:`relative px-6 py-2 text-xs font-medium text-gray-800 ${s.top}`,children:[e.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:e.jsx("div",{className:"order-gray-300 w-full"})}),e.jsx("div",{className:"relative flex justify-start",children:e.jsx("span",{className:"bg-gray-50 pr-2",children:s.label})})]})},"separator"):e.jsx(G,{page:s,selectedPages:c,handleCheckboxChange:E,getPageType:A,hasSlug:k,currentOwnerId:t.get(h,[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id),"userId"])}))})]})}),e.jsxs(f.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[c.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[c.length," Page",c.length!==1?"s":""," Selected"]}),e.jsx(q.Button,{disabled:d,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(q.Button,{disabled:d||C||t.isEmpty(c),onClick:I,children:d?"Publishing...":"Publish Selected"})]})]})};exports.default=O;
|