@chaibuilder/pages 0.14.0 → 0.14.2
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-BLi5HVHf.cjs → 2AITGKQY-DWDDkd18.cjs} +1 -1
- package/dist/{2AITGKQY-iyhQ7kgG.js → 2AITGKQY-DtQPkxBe.js} +2 -2
- package/dist/{NCMVHL6D-CKYg8-AM.cjs → NCMVHL6D-6CkVnw0a.cjs} +1 -1
- package/dist/{NCMVHL6D-PLvSyK5P.js → NCMVHL6D-CksZXXOw.js} +4 -4
- package/dist/{ZDWCUMSJ-CuLkdxY-.js → ZDWCUMSJ-BXQ01VPt.js} +1 -1
- package/dist/{ZDWCUMSJ-BJZ_Yi-4.cjs → ZDWCUMSJ-DoM-AA0C.cjs} +1 -1
- package/dist/{add-new-language-page--ah9yzN3.cjs → add-new-language-page-BA73lQnm.cjs} +1 -1
- package/dist/{add-new-language-page-WM_Ve2vH.js → add-new-language-page-D8iXtyLA.js} +2 -2
- package/dist/{add-new-page-Bs_NXM9x.js → add-new-page-DESlqvED.js} +1 -1
- package/dist/{add-new-page-CnUo6xzd.cjs → add-new-page-EOMgMSeq.cjs} +1 -1
- package/dist/{delete-page-D8xhYESu.js → delete-page-BP1Df8QL.js} +1 -1
- package/dist/{delete-page-Cf88UkqJ.cjs → delete-page-ZvnuEow6.cjs} +1 -1
- package/dist/{digital-asset-manager-BAFTqxsM.js → digital-asset-manager-Bb81T3mS.js} +146 -146
- package/dist/{digital-asset-manager-D_lcprwY.cjs → digital-asset-manager-BxWb1j_y.cjs} +1 -1
- package/dist/{duplicate-page-CqXTGmWt.js → duplicate-page-B1j0H7gP.js} +28 -28
- package/dist/{duplicate-page-BX1gOez-.cjs → duplicate-page-W5xbmPSC.cjs} +1 -1
- package/dist/{dynamic-page-selector-9JIQrcq5.cjs → dynamic-page-selector-BZKJmSx5.cjs} +1 -1
- package/dist/{dynamic-page-selector-0TiUnfUg.js → dynamic-page-selector-Crjyco6l.js} +1 -1
- package/dist/{index-D7kegQ3M.js → index-DFvsMFVH.js} +919 -912
- package/dist/index-Qnh8Lkr0.cjs +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +8 -8
- package/dist/{json-diff-viewer-C2GK_BDh.js → json-diff-viewer-BGGSLqtx.js} +6 -6
- package/dist/{json-diff-viewer-Be-PVOZN.cjs → json-diff-viewer-DRkE-x_z.cjs} +1 -1
- package/dist/{lang-panel-CePltxo2.cjs → lang-panel-9T8dIx2p.cjs} +1 -1
- package/dist/{lang-panel-CPFS1ssC.js → lang-panel-B3tr2uhr.js} +2 -2
- package/dist/{mark-as-template-DeB23sWR.cjs → mark-as-template-DPVPRgbi.cjs} +1 -1
- package/dist/{mark-as-template-jdwcgRIB.js → mark-as-template-L9cHzL84.js} +1 -1
- package/dist/{no-language-page-content-Dsm2H3pc.cjs → no-language-page-content-Cy_D-3jE.cjs} +1 -1
- package/dist/{no-language-page-content-DUM4KxWu.js → no-language-page-content-DP7gmy0s.js} +1 -1
- package/dist/{page-creator-BjuYmKfc.js → page-creator-Ctn5ixJE.js} +29 -29
- package/dist/{page-creator-DG0LwvL1.cjs → page-creator-DDaI1HYj.cjs} +1 -1
- package/dist/{page-lock-request-B9WPmFcd.cjs → page-lock-request-BKrxnEtQ.cjs} +1 -1
- package/dist/{page-lock-request-BceB1S-X.js → page-lock-request-CjJFJKL2.js} +3 -3
- package/dist/{page-locked-by-dialog-BEWfFLSc.js → page-locked-by-dialog-DmsSmAY2.js} +1 -1
- package/dist/{page-locked-by-dialog-2MULM3jh.cjs → page-locked-by-dialog-b25_rn2m.cjs} +1 -1
- package/dist/{page-manager-new-BONZN4c5.cjs → page-manager-new-DiZVY7Me.cjs} +1 -1
- package/dist/{page-manager-new-DV6A9WFv.js → page-manager-new-EsIg6iQn.js} +28 -28
- package/dist/{page-manager-search-and-filter-DIiowi9F.js → page-manager-search-and-filter-Bt4T_dnB.js} +2 -2
- package/dist/{page-manager-search-and-filter-3h4URMP_.cjs → page-manager-search-and-filter-CgY2qiXU.cjs} +1 -1
- package/dist/{page-revisions-content-BIxeZeND.js → page-revisions-content-CsT6aF2I.js} +7 -7
- package/dist/{page-revisions-content-CQbt25XX.cjs → page-revisions-content-DtI8CmtR.cjs} +1 -1
- package/dist/{publish-pages-content-im9dPOBM.cjs → publish-pages-content-DpC7RcTw.cjs} +1 -1
- package/dist/{publish-pages-content-CdKHrfys.js → publish-pages-content-KAuhOPv0.js} +45 -45
- package/dist/{save-to-lib-DOh-850u.cjs → save-to-lib-BGpWGHJo.cjs} +1 -1
- package/dist/{save-to-lib-DGII9CEP.js → save-to-lib-CeWaSQdB.js} +23 -23
- package/dist/{seo-panel-Bxo4f-a_.js → seo-panel-Dhhpe_7z.js} +1 -1
- package/dist/{seo-panel-2VdpoGSg.cjs → seo-panel-JDQ_7bOx.cjs} +1 -1
- package/dist/{shared-json-ld-C1OewNgp.cjs → shared-json-ld-BYbdMttx.cjs} +1 -1
- package/dist/{shared-json-ld-gbnBFljN.js → shared-json-ld-BliIbNv9.js} +1 -1
- package/dist/{slug-input-CfuQV97Z.cjs → slug-input-QxBMijHP.cjs} +1 -1
- package/dist/{slug-input-BmcGmc_i.js → slug-input-hJdU8DaF.js} +1 -1
- package/dist/{theme-panel-footer-FrY4U8zn.cjs → theme-panel-footer-BZnPvTkM.cjs} +1 -1
- package/dist/{theme-panel-footer-D3SwHqGR.js → theme-panel-footer-D2B7iYW2.js} +1 -1
- package/dist/{unmark-as-template-CihtTMOb.cjs → unmark-as-template-Byn2RRAp.cjs} +1 -1
- package/dist/{unmark-as-template-UwmCCn0u.js → unmark-as-template-Dcpkj7EZ.js} +1 -1
- package/dist/{unpublish-page-DzLtZcNw.cjs → unpublish-page-5Fi1wKXb.cjs} +1 -1
- package/dist/{unpublish-page-CNwIU6AS.js → unpublish-page-CPLlsfm4.js} +1 -1
- package/dist/{use-page-expand-manager-BCFQnVkT.js → use-page-expand-manager-DkyBiNpx.js} +9 -9
- package/dist/{use-page-expand-manager-B7JtHdg5.cjs → use-page-expand-manager-To-SsGy3.cjs} +1 -1
- package/dist/web-preview-CVvxe5Ll.cjs +1 -0
- package/dist/web-preview-YuuoRaZn.js +73 -0
- package/package.json +3 -3
- package/dist/index-LU0FTfeN.cjs +0 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as p, jsx as s, Fragment as O } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { u as J } from "./use-page-expand-manager-
|
|
4
|
-
import { compact as ie, filter as
|
|
2
|
+
import { ay as pe, f as oe, aq as be, T as q, az as ye, L as ge, h as ke, b as Ne, i as we, au as ve, aA as Se, aB as _ } from "./index-DFvsMFVH.js";
|
|
3
|
+
import { u as J } from "./use-page-expand-manager-DkyBiNpx.js";
|
|
4
|
+
import { compact as ie, filter as B, isEmpty as v, uniqBy as Ae, keyBy as ce, mapValues as Le, startCase as Te, toLower as E, includes as D, find as M, get as H, map as Ce } from "lodash-es";
|
|
5
5
|
import { useLanguages as re } from "@chaibuilder/sdk";
|
|
6
6
|
import { useAtom as Ee } from "jotai";
|
|
7
|
-
import { NotepadText as Ue, MoreHorizontal as $e, Lock as ze, Edit as Me, Plus as
|
|
7
|
+
import { NotepadText as Ue, MoreHorizontal as $e, Lock as ze, Edit as Me, Plus as Be, ChevronRight as Fe, StarsIcon as je, Globe as Ie, File as de } from "lucide-react";
|
|
8
8
|
import { useMemo as Q, lazy as U, useState as N, useCallback as ae, useEffect as z, Suspense as C } from "react";
|
|
9
9
|
const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
10
|
-
|
|
10
|
+
B(e, (r) => {
|
|
11
11
|
const t = E(n);
|
|
12
12
|
return D(E((r == null ? void 0 : r.name) || ""), t) || D(E((r == null ? void 0 : r.slug) || ""), t);
|
|
13
13
|
})
|
|
@@ -51,13 +51,13 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
51
51
|
})), De = (e, n, r, t) => {
|
|
52
52
|
if (!e || !e.length) return [];
|
|
53
53
|
let l = e;
|
|
54
|
-
if (r !== "all" && (l = ie(
|
|
54
|
+
if (r !== "all" && (l = ie(B(e, { pageType: r }))), v(n))
|
|
55
55
|
l = le(l, n);
|
|
56
56
|
else {
|
|
57
57
|
const d = le(l, n), i = Ge(e, d);
|
|
58
58
|
l = Ae([...d, ...i], "id");
|
|
59
59
|
}
|
|
60
|
-
const o = ue(Oe(l)), b = V(o, n, t), f =
|
|
60
|
+
const o = ue(Oe(l)), b = V(o, n, t), f = B(b, (d) => t(d.pageType)).sort((d, i) => (d.name || "").localeCompare(i.name || "")), x = B(b, (d) => !t(d.pageType));
|
|
61
61
|
let m = [];
|
|
62
62
|
if (r === "all") {
|
|
63
63
|
const d = ce(x, "pageType");
|
|
@@ -85,7 +85,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
85
85
|
disabled: !((t = e == null ? void 0 : e.children) != null && t.length),
|
|
86
86
|
className: `flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(l = e == null ? void 0 : e.children) != null && l.length ? "hover:text-blue-400" : "opacity-0"}`,
|
|
87
87
|
children: /* @__PURE__ */ s(
|
|
88
|
-
|
|
88
|
+
Fe,
|
|
89
89
|
{
|
|
90
90
|
size: 12,
|
|
91
91
|
className: `stroke-[4] transition-transform duration-200 ${n ? "rotate-90" : ""}`
|
|
@@ -93,13 +93,13 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
93
93
|
)
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
|
-
}, We = ({ page: e, pageType: n }) => /* @__PURE__ */ s("div", { className: "flex h-full items-center justify-center gap-x-1", children: e.dynamic ? /* @__PURE__ */ s(
|
|
96
|
+
}, We = ({ page: e, pageType: n }) => /* @__PURE__ */ s("div", { className: "flex h-full items-center justify-center gap-x-1", children: e.dynamic ? /* @__PURE__ */ s(je, { size: 12, className: "text-yellow-400" }) : n != null && n.icon ? /* @__PURE__ */ s(
|
|
97
97
|
"div",
|
|
98
98
|
{
|
|
99
99
|
className: "flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",
|
|
100
100
|
dangerouslySetInnerHTML: { __html: n.icon }
|
|
101
101
|
}
|
|
102
|
-
) : n != null && n.hasSlug ? /* @__PURE__ */ s(de, { size: 12, className: "stroke-[1] text-slate-500" }) : /* @__PURE__ */ s(Ie, { size: 12, className: "stroke-[1] text-slate-500" }) }),
|
|
102
|
+
) : n != null && n.hasSlug ? /* @__PURE__ */ s(de, { size: 12, className: "stroke-[1] text-slate-500" }) : /* @__PURE__ */ s(Ie, { size: 12, className: "stroke-[1] text-slate-500" }) }), qe = ({ isOnline: e }) => /* @__PURE__ */ s("div", { className: `h-2 w-2 rounded-full ${e ? "bg-green-300" : "bg-gray-300"}` }), _e = ({
|
|
103
103
|
page: e,
|
|
104
104
|
pageTypes: n,
|
|
105
105
|
currentPage: r,
|
|
@@ -113,12 +113,12 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
113
113
|
u = H(u, "lang") === o ? u : null;
|
|
114
114
|
const A = o === x || !!u, L = (u == null ? void 0 : u.name) || (e == null ? void 0 : e.name) || "No name";
|
|
115
115
|
let g = (u == null ? void 0 : u.slug) || (e == null ? void 0 : e.slug) || "";
|
|
116
|
-
const
|
|
116
|
+
const F = g + (e != null && e.dynamic ? `/${i == null ? void 0 : i.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
|
|
117
117
|
if (g.startsWith("/") && !b) {
|
|
118
118
|
const c = g.split("/").pop();
|
|
119
119
|
g = g.endsWith(c) && e.dynamic ? "" : `/${c}`;
|
|
120
120
|
}
|
|
121
|
-
const
|
|
121
|
+
const j = Q(() => {
|
|
122
122
|
const c = "flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]", T = `${m ? "border-primary/30 bg-primary/5" : "border-transparent hover:border-gray-200 hover:bg-gray-100"}`;
|
|
123
123
|
return A ? `${c} ${T} ${y ? "opacity-60" : ""}` : `${c} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`;
|
|
124
124
|
}, [A, m, y]);
|
|
@@ -127,13 +127,13 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
127
127
|
"div",
|
|
128
128
|
{
|
|
129
129
|
onClick: () => !e.isPartialGroup && A && t("select", e == null ? void 0 : e.id),
|
|
130
|
-
className:
|
|
130
|
+
className: j,
|
|
131
131
|
children: [
|
|
132
132
|
/* @__PURE__ */ s(Re, { page: e }),
|
|
133
|
-
!e.isPartialGroup && /* @__PURE__ */ s(
|
|
133
|
+
!e.isPartialGroup && /* @__PURE__ */ s(qe, { isOnline: u ? u.online : e.online }),
|
|
134
134
|
/* @__PURE__ */ s(We, { page: e, pageType: i }),
|
|
135
|
-
/* @__PURE__ */ s(
|
|
136
|
-
(g || e.dynamic) && /* @__PURE__ */ s(
|
|
135
|
+
/* @__PURE__ */ s(q, { content: L, side: "top", showTooltip: L.length > 35, children: /* @__PURE__ */ s("span", { className: "max-w-[40%] truncate font-medium text-black", children: L }) }),
|
|
136
|
+
(g || e.dynamic) && /* @__PURE__ */ s(q, { content: F, side: "top", showTooltip: !0, children: /* @__PURE__ */ p("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
|
|
137
137
|
g,
|
|
138
138
|
e.dynamic && (i == null ? void 0 : i.dynamicSlug) && /* @__PURE__ */ p("span", { className: "text-xs text-gray-500", children: [
|
|
139
139
|
"/",
|
|
@@ -141,7 +141,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
141
141
|
e.dynamicSlugCustom
|
|
142
142
|
] })
|
|
143
143
|
] }) }),
|
|
144
|
-
d && /* @__PURE__ */ s(
|
|
144
|
+
d && /* @__PURE__ */ s(q, { content: "Template", side: "top", children: /* @__PURE__ */ s("span", { className: "text-blue-500", children: /* @__PURE__ */ s(Ue, { size: 16 }) }) }),
|
|
145
145
|
!e.isPartialGroup && A && !y ? /* @__PURE__ */ s("div", { className: "duration absolute right-0.5 top-[3px]", children: /* @__PURE__ */ s(
|
|
146
146
|
ye,
|
|
147
147
|
{
|
|
@@ -173,7 +173,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
173
173
|
},
|
|
174
174
|
className: "absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",
|
|
175
175
|
children: [
|
|
176
|
-
/* @__PURE__ */ s(
|
|
176
|
+
/* @__PURE__ */ s(Be, { size: 12, className: "stroke-[3]" }),
|
|
177
177
|
" ",
|
|
178
178
|
/* @__PURE__ */ p("span", { className: "text-[10px]", children: [
|
|
179
179
|
"Add ",
|
|
@@ -197,7 +197,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
197
197
|
const { expandedPages: x } = J();
|
|
198
198
|
return /* @__PURE__ */ s("div", { className: "space-y-0.5", style: { paddingLeft: `${n * 10}px` }, children: e.map((m) => /* @__PURE__ */ p(O, { children: [
|
|
199
199
|
/* @__PURE__ */ s(
|
|
200
|
-
|
|
200
|
+
_e,
|
|
201
201
|
{
|
|
202
202
|
page: m,
|
|
203
203
|
pageTypes: r,
|
|
@@ -222,14 +222,14 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
222
222
|
}
|
|
223
223
|
)
|
|
224
224
|
] }, m.id)) });
|
|
225
|
-
}, He = U(() => import("./page-manager-search-and-filter-
|
|
226
|
-
const { languages: n, setSelectedLang: r } = re(), { data: t } = ke(), { data: l, isFetching: o } = Ne(), [b, f] = we(), { updateForSelectedPage: x, expandPagesOnSearch: m } = J(null), d = oe(), i = b.get("page"), [P, S] = N(""), [y, u] = N(null), [A, L] = N(null), [g,
|
|
225
|
+
}, He = U(() => import("./page-manager-search-and-filter-Bt4T_dnB.js")), Qe = U(() => import("./add-new-page-DESlqvED.js")), Ve = U(() => import("./delete-page-BP1Df8QL.js")), Je = U(() => import("./duplicate-page-B1j0H7gP.js")), Ke = U(() => import("./mark-as-template-L9cHzL84.js")), Xe = U(() => import("./unmark-as-template-Dcpkj7EZ.js")), Ye = U(() => import("./unpublish-page-CPLlsfm4.js")), ot = ({ close: e }) => {
|
|
226
|
+
const { languages: n, setSelectedLang: r } = re(), { data: t } = ke(), { data: l, isFetching: o } = Ne(), [b, f] = we(), { updateForSelectedPage: x, expandPagesOnSearch: m } = J(null), d = oe(), i = b.get("page"), [P, S] = N(""), [y, u] = N(null), [A, L] = N(null), [g, F] = N(null), [j, c] = N(null), [T, R] = N(""), [K, X] = N(null), [Y, Z] = N(null), [k, he] = N(d), [fe, xe] = N(!1), [, ee] = Ee(ve), I = fe && k !== d, { data: $, isFetching: Pe } = Se(k), te = ae(
|
|
227
227
|
(h) => {
|
|
228
228
|
var a;
|
|
229
229
|
return (a = M(t, { key: h })) == null ? void 0 : a.hasSlug;
|
|
230
230
|
},
|
|
231
231
|
[t]
|
|
232
|
-
), w = Q(() => l ? I ?
|
|
232
|
+
), w = Q(() => l ? I ? B(l, (h) => !($ != null && $[h.id])) : De(l, P, T, te) : [], [l, te, P, T, $, I]);
|
|
233
233
|
z(() => {
|
|
234
234
|
r(d);
|
|
235
235
|
}, [d, r]), z(() => {
|
|
@@ -241,9 +241,9 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
241
241
|
const a = M(l, { slug: "/" });
|
|
242
242
|
if (a) {
|
|
243
243
|
const G = new URLSearchParams({ page: a.id });
|
|
244
|
-
|
|
244
|
+
_(G, f);
|
|
245
245
|
} else
|
|
246
|
-
|
|
246
|
+
_(new URLSearchParams({}), f, !0);
|
|
247
247
|
}
|
|
248
248
|
}, [l, i, o, f]), z(() => {
|
|
249
249
|
i && !o && !v(w) && x(w, i);
|
|
@@ -253,7 +253,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
253
253
|
const { setSelectedLang: W } = re(), se = ae(
|
|
254
254
|
(h) => {
|
|
255
255
|
const a = new URLSearchParams({ page: h });
|
|
256
|
-
k !== d ? (a.set("lang", k), W(k)) : W(""),
|
|
256
|
+
k !== d ? (a.set("lang", k), W(k)) : W(""), _(a, f), e();
|
|
257
257
|
},
|
|
258
258
|
[e, f, W, k, d]
|
|
259
259
|
), ne = (h, a) => {
|
|
@@ -277,7 +277,7 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
277
277
|
u(a);
|
|
278
278
|
break;
|
|
279
279
|
case "unpublish":
|
|
280
|
-
|
|
280
|
+
F(a);
|
|
281
281
|
break;
|
|
282
282
|
case "markAsTemplate":
|
|
283
283
|
c(a);
|
|
@@ -343,8 +343,8 @@ const le = (e, n) => !e || !Array.isArray(e) ? [] : v(n) ? e : ie(
|
|
|
343
343
|
}
|
|
344
344
|
) }),
|
|
345
345
|
y && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ve, { page: y, onClose: () => u(null) }) }),
|
|
346
|
-
g && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ye, { page: g, onClose: () =>
|
|
347
|
-
|
|
346
|
+
g && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ye, { page: g, onClose: () => F(null) }) }),
|
|
347
|
+
j && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Ke, { page: j, onClose: () => c(null) }) }),
|
|
348
348
|
Y && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Xe, { page: Y, onClose: () => Z(null) }) }),
|
|
349
349
|
K && /* @__PURE__ */ s(C, { children: /* @__PURE__ */ s(Je, { page: K, onClose: () => X(null), closePanel: e }) })
|
|
350
350
|
] });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as r, Fragment as w } from "react/jsx-runtime";
|
|
2
|
-
import { f as P, L, h as F, A as I } from "./index-
|
|
3
|
-
import { u as z } from "./use-page-expand-manager-
|
|
2
|
+
import { f as P, L, h as F, A as I } from "./index-DFvsMFVH.js";
|
|
3
|
+
import { u as z } from "./use-page-expand-manager-DkyBiNpx.js";
|
|
4
4
|
import { Button as m, Tooltip as f, TooltipTrigger as v, TooltipContent as g, Select as j, SelectTrigger as $, SelectContent as G, Input as S, SelectItem as b } from "@chaibuilder/sdk/ui";
|
|
5
5
|
import { useQueryClient as T } from "@tanstack/react-query";
|
|
6
6
|
import { isEmpty as y, filter as u, map as C, get as o } from "lodash-es";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-Qnh8Lkr0.cjs"),y=require("./use-page-expand-manager-To-SsGy3.cjs"),s=require("@chaibuilder/sdk/ui"),b=require("@tanstack/react-query"),r=require("lodash-es"),c=require("lucide-react"),N=require("react"),w=({selectedPageType:n,setSelectedPageType:a})=>{const[o,l]=N.useState(""),{data:i}=m.usePageTypes(),d=t=>{if(!o)return!0;const x=o.toLowerCase(),h=p=>String(r.get(t,p,"")).toLowerCase().includes(x);return h("name")||h("key")},u=i.find(t=>t.key===n);return e.jsxs(s.Select,{onValueChange:a,value:n,children:[e.jsx(s.SelectTrigger,{className:`${n==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(u==null?void 0:u.name)||"All"}),e.jsx(c.ListFilter,{className:`${n!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(s.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(c.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(s.Input,{placeholder:"Search page types...",className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:o,onChange:t=>l(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(s.SelectItem,{value:"all",children:"All"}),!r.isEmpty(r.filter(i,t=>t.hasSlug&&d(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:"Pages"}),r.map([...r.filter(i,t=>t.hasSlug&&d(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),!r.isEmpty(r.filter(i,t=>!t.hasSlug&&d(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:"Partials"}),r.map([...r.filter(i,t=>!t.hasSlug&&d(t))].sort((t,x)=>r.get(t,"name","").localeCompare(r.get(x,"name",""))),t=>e.jsx(s.SelectItem,{value:r.get(t,"key"),children:r.get(t,"name")},r.get(t,"key")))]}),r.isEmpty(r.filter(i,d))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:"No matching page types found"})]})]})},C=({search:n,setSearch:a})=>e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:"Search Pages"}),e.jsx(c.Search,{className:`${n?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(s.Input,{id:"page-search-input",placeholder:"Search pages",value:n,onChange:o=>a(o.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]}),S=({pages:n})=>{const{expandAll:a,collapseAll:o,expandedPages:l}=y.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"outline",size:"icon",onClick:()=>a(n),className:"rounded p-1 text-gray-500",children:e.jsx(c.ChevronsUpDown,{})})}),e.jsx(s.TooltipContent,{children:"Expand All"})]}),e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{disabled:l.length===0,variant:"outline",size:"icon",onClick:()=>o(),className:"rounded p-1 text-gray-500",children:e.jsx(c.ChevronsDownUp,{})})}),e.jsx(s.TooltipContent,{children:"Collapse All"})]})]})},f=({languages:n,selectedLanguage:a,setSelectedLanguage:o})=>{const l=m.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:n.map(i=>e.jsxs(s.Button,{variant:a===i?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${a===i?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>o(i.toLowerCase()),children:[i===l&&e.jsx(c.Star,{size:4,className:`p-0.5 ${a===l?"fill-white":"fill-black"}`}),m.LANGUAGES[i]||""]},i))})},j=()=>{const n=b.useQueryClient();return e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{size:"sm",variant:"ghost",onClick:()=>n.invalidateQueries({queryKey:[m.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(c.RefreshCw,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:"Refresh pages list"})]})},k=({pages:n,search:a,setSearch:o,languages:l,onAddPage:i,selectedLanguage:d,setSelectedLanguage:u,selectedPageType:t,setSelectedPageType:x,showUntranslatedPages:h,setShowUntranslatedPages:p})=>{const g=l.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(w,{selectedPageType:t,setSelectedPageType:x}),e.jsx(C,{search:a,setSearch:o}),e.jsx(S,{pages:n}),e.jsxs(s.Button,{variant:"default",onClick:i,className:"rounded px-3 font-normal",children:[e.jsx(c.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:"Add Page"})]}),!g&&e.jsx(j,{})]}),g?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(f,{languages:l,selectedLanguage:d,setSelectedLanguage:v=>{u(v),p(h&&(l==null?void 0:l[0])!==d)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(l==null?void 0:l[0])!==d&&e.jsxs(s.Tooltip,{children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{variant:"ghost",onClick:()=>p(!h),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:h?e.jsx(c.FilterXIcon,{}):e.jsx(c.Filter,{})})}),e.jsx(s.TooltipContent,{side:"bottom",children:"Toggle Untranslated Pages"})]}),e.jsx(j,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=f;exports.default=k;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as n, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { ak as C, al as A, A as b, am as q, ax as le, aq as I, av as R, aw as w } from "./index-DFvsMFVH.js";
|
|
3
3
|
import { useQuery as re, useQueryClient as k, useMutation as G } from "@tanstack/react-query";
|
|
4
4
|
import { useLanguages as ie, useSavePage as de } from "@chaibuilder/sdk";
|
|
5
|
-
import { SheetHeader as ce, SheetTitle as oe, ScrollArea as ue, Skeleton as y, Button as g, DropdownMenu as me, DropdownMenuTrigger as he, DropdownMenuContent as fe, DropdownMenuItem as U, DropdownMenuSeparator as pe, Dialog as
|
|
5
|
+
import { SheetHeader as ce, SheetTitle as oe, ScrollArea as ue, Skeleton as y, Button as g, DropdownMenu as me, DropdownMenuTrigger as he, DropdownMenuContent as fe, DropdownMenuItem as U, DropdownMenuSeparator as pe, Dialog as j, DialogContent as L, DialogHeader as P, DialogTitle as $, DialogDescription as z, DialogFooter as H } from "@chaibuilder/sdk/ui";
|
|
6
6
|
import { format as D, formatDistanceToNow as xe } from "date-fns";
|
|
7
7
|
import { isEmpty as ge } from "lodash-es";
|
|
8
8
|
import { FileJson as Ne, MoreHorizontal as be, Undo2 as J, Trash as Q, CloudOff as ye, Rocket as ve, Save as we, X as De } from "lucide-react";
|
|
@@ -46,7 +46,7 @@ const Ae = () => {
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
}, ke = Se(() => import("./json-diff-viewer-
|
|
49
|
+
}, ke = Se(() => import("./json-diff-viewer-BGGSLqtx.js")), N = ({ tag: t }) => t === "draft" ? /* @__PURE__ */ n("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
50
|
/* @__PURE__ */ n("span", { className: "relative flex h-2 w-2", children: [
|
|
51
51
|
/* @__PURE__ */ e("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75" }),
|
|
52
52
|
/* @__PURE__ */ e("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-amber-500" })
|
|
@@ -66,7 +66,7 @@ const Ae = () => {
|
|
|
66
66
|
/* @__PURE__ */ e("span", { className: "text-[11px] leading-tight", children: "Unsaved changes" })
|
|
67
67
|
] }) : /* @__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
68
|
function Oe({ compare: t, setCompare: s }) {
|
|
69
|
-
const { data: a } =
|
|
69
|
+
const { data: a } = q(), { saveState: i } = de(), [l] = le();
|
|
70
70
|
if (!a) return null;
|
|
71
71
|
const d = !!t.find((o) => {
|
|
72
72
|
var r;
|
|
@@ -264,7 +264,7 @@ function Ue({
|
|
|
264
264
|
}) {
|
|
265
265
|
const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
|
|
266
266
|
return a ? /* @__PURE__ */ e(
|
|
267
|
-
|
|
267
|
+
j,
|
|
268
268
|
{
|
|
269
269
|
open: t,
|
|
270
270
|
onOpenChange: (m) => {
|
|
@@ -313,7 +313,7 @@ function Fe({
|
|
|
313
313
|
}) {
|
|
314
314
|
const { data: d } = I((a == null ? void 0 : a.currentEditor) || ""), u = (d == null ? void 0 : d.name) || "Unknown";
|
|
315
315
|
return a ? /* @__PURE__ */ e(
|
|
316
|
-
|
|
316
|
+
j,
|
|
317
317
|
{
|
|
318
318
|
open: t,
|
|
319
319
|
onOpenChange: (m) => {
|
|
@@ -349,7 +349,7 @@ function Fe({
|
|
|
349
349
|
}
|
|
350
350
|
function Je({ isOpen: t }) {
|
|
351
351
|
var T, _;
|
|
352
|
-
const [s, a] = v.useState([]), [i, l] = v.useState(null), [d, u] = v.useState(!1), [m, o] = v.useState(!1), { data: r } =
|
|
352
|
+
const [s, a] = v.useState([]), [i, l] = v.useState(null), [d, u] = v.useState(!1), [m, o] = v.useState(!1), { data: r } = q(), { data: f, isFetching: S, error: h, refetch: x } = Ce(r == null ? void 0 : r.id), { mutate: W, isPending: Y } = Ae(), { mutate: B, isPending: X } = Ie(), Z = k(), { selectedLang: ee, fallbackLang: te } = ie(), ne = ee || te;
|
|
353
353
|
F(() => a([]), [r == null ? void 0 : r.id]);
|
|
354
354
|
const ae = (c) => {
|
|
355
355
|
i && B(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-LU0FTfeN.cjs"),N=require("@tanstack/react-query"),O=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),y=require("date-fns"),L=require("lodash-es"),p=require("lucide-react"),b=require("react");function Q(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const v=Q(b);function z(s){const n=d.useApiUrl(),t=d.useFetch();return N.useQuery({queryKey:[d.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:d.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const B=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async l=>await n(s,{action:d.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:l}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async({revisionId:l,discardCurrent:r})=>await n(s,{action:d.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:l,discardCurrent:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=b.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-Be-PVOZN.cjs"))),g=({tag:s})=>s==="draft"?e.jsxs("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:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(p.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(p.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=d.useCurrentPage(),{saveState:l}=O.useSavePage(),[r]=d.usePageEditInfo();if(!t)return null;const c=!!s.find(u=>{var i;return(i=u==null?void 0:u.uid)==null?void 0:i.startsWith("draft:")}),x=s.length>=2&&!c,m=l==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(g,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!L.isEmpty(r.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",y.formatDistanceToNow(new Date(r.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(g,{tag:"unsaved"}):null})]}),e.jsx(A,{checked:c,disabled:x,onChange:()=>{n(c?s.filter(u=>u.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(a.Skeleton,{className:"h-4 w-3/4"}),e.jsx(a.Skeleton,{className:"h-3 w-1/2"}),e.jsx(a.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(a.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:l,revisionNumber:r,compare:c,setCompare:x,pageId:m}){const{data:u}=d.useChaiUserInfo(s.currentEditor),i=(u==null?void 0:u.name)||"Unknown",f=!!c.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),S=c.length>=2&&!f;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(g,{tag:n?"live":`#${r}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:i})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(g,{tag:"published"}):e.jsx(g,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:y.format(s.createdAt,"MMM d, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(d.PermissionChecker,{permissions:[d.PAGES_PERMISSIONS.RESTORE_REVISION,d.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:l})})}),e.jsx(A,{checked:f,disabled:S,onChange:()=>{x(f?c.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...c,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${r}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function W({compare:s,setCompare:n,pageId:t}){const[l,r]=b.useState(!1),[c,x]=s;if(s.length===0)return null;const m=({tab:u})=>e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(g,{tag:u.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.filter(i=>i.uid!==u.uid)),"aria-label":"Remove selection 1",children:e.jsx(p.X,{className:"h-3 w-3"})})]});return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),c&&e.jsx(m,{tab:c}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),x?e.jsx(m,{tab:x}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(a.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(a.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>r(!0),disabled:s.length<2,children:[e.jsx(p.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),l&&(s==null?void 0:s.length)>1&&t&&e.jsx(b.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:l,onOpenChange:r,compare:s})})]})}function A({checked:s,disabled:n,onChange:t,label:l="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:l})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(p.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(a.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(a.DropdownMenuSeparator,{}),e.jsxs(a.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:l,isRestoring:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Restore Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",y.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>l(!1),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(a.Button,{variant:"default",className:"sm:flex-1",onClick:()=>l(!0),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:l,isDeleting:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Delete Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",y.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:r,children:"Cancel"}),e.jsx(a.Button,{variant:"destructive",className:"sm:flex-1",onClick:l,disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var E,R;const[n,t]=v.useState([]),[l,r]=v.useState(null),[c,x]=v.useState(!1),[m,u]=v.useState(!1),{data:i}=d.useCurrentPage(),{data:f,isFetching:S,error:h,refetch:j}=z(i==null?void 0:i.id),{mutate:k,isPending:M}=B(),{mutate:T,isPending:F}=H(),_=N.useQueryClient(),{selectedLang:P,fallbackLang:q}=O.useLanguages(),U=P||q;b.useEffect(()=>t([]),[i==null?void 0:i.id]);const G=o=>{l&&T({revisionId:l.uid,discardCurrent:o},{onSuccess:()=>{x(!1),r(null),_.invalidateQueries({queryKey:[d.ACTIONS.GET_DRAFT_PAGE]})}})},D=o=>{r(o),x(!0)},C=o=>{r(o),u(!0)},V=()=>{l&&k(l.uid,{onSuccess:()=>{u(!1),r(null)}})};return b.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(a.SheetHeader,{children:[e.jsx(a.SheetTitle,{children:"Revision History"}),(i==null?void 0:i.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",y.format(new Date(i.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),S?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:i==null?void 0:i.id}),e.jsx(J,{compare:n,setCompare:t}),(E=f==null?void 0:f.filter(o=>o.uid==="current"))==null?void 0:E.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:!0,onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w,compare:n,setCompare:t},o.uid)),e.jsx(a.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:(R=f==null?void 0:f.filter(o=>o.uid!=="current"))==null?void 0:R.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:o.uid==="current",onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:c,onOpenChange:x,revision:l,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:u,revision:l,onDelete:V,isDeleting:M})]})}exports.default=ee;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./index-Qnh8Lkr0.cjs"),N=require("@tanstack/react-query"),O=require("@chaibuilder/sdk"),a=require("@chaibuilder/sdk/ui"),y=require("date-fns"),L=require("lodash-es"),p=require("lucide-react"),b=require("react");function Q(s){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const t in s)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(s,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:()=>s[t]})}}return n.default=s,Object.freeze(n)}const v=Q(b);function z(s){const n=d.useApiUrl(),t=d.useFetch();return N.useQuery({queryKey:[d.ACTIONS.GET_PAGE_REVISIONS,s],queryFn:async()=>await t(n,{action:d.ACTIONS.GET_PAGE_REVISIONS,data:{pageId:s}}),enabled:!!s,refetchOnMount:!0})}const B=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async l=>await n(s,{action:d.ACTIONS.DELETE_PAGE_REVISION,data:{revisionId:l}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},H=()=>{const s=d.useApiUrl(),n=d.useFetch(),t=N.useQueryClient();return N.useMutation({mutationFn:async({revisionId:l,discardCurrent:r})=>await n(s,{action:d.ACTIONS.RESTORE_PAGE_REVISION,data:{revisionId:l,discardCurrent:r}}),onSuccess:()=>{t.invalidateQueries({queryKey:["revisions"]})}})},$=b.lazy(()=>Promise.resolve().then(()=>require("./json-diff-viewer-DRkE-x_z.cjs"))),g=({tag:s})=>s==="draft"?e.jsxs("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:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-amber-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Draft"})]}):s==="live"?e.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:[e.jsxs("span",{className:"relative flex h-2 w-2",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-green-500"})]}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Live"})]}):s==="published"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-green-500/10 px-1.5 py-0.5 text-xs text-green-600",children:[e.jsx(p.Rocket,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Published"})]}):s==="unsaved"?e.jsxs("div",{className:"flex items-center gap-1 rounded-full bg-red-500/10 px-1.5 py-0.5 text-xs text-red-600",children:[e.jsx(p.Save,{className:"h-3 w-3"}),e.jsx("span",{className:"text-[11px] leading-tight",children:"Unsaved changes"})]}):e.jsx("span",{className:"rounded bg-purple-500/10 px-1.5 py-0.5 font-mono text-xs font-bold text-purple-600",children:s});function J({compare:s,setCompare:n}){const{data:t}=d.useCurrentPage(),{saveState:l}=O.useSavePage(),[r]=d.usePageEditInfo();if(!t)return null;const c=!!s.find(u=>{var i;return(i=u==null?void 0:u.uid)==null?void 0:i.startsWith("draft:")}),x=s.length>=2&&!c,m=l==="UNSAVED";return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border bg-primary/5 p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-1 text-sm font-medium leading-none",children:[e.jsx(g,{tag:"draft"}),e.jsx("span",{className:"text-xs font-bold",children:"Currently editing"})]})}),e.jsx("div",{className:"flex items-center pl-2 text-[11px] text-muted-foreground",children:!L.isEmpty(r.lastSaved)&&e.jsxs("span",{children:["Last updated"," ",y.formatDistanceToNow(new Date(r.lastSaved),{addSuffix:!0})]})}),e.jsx("div",{className:"flex items-center gap-2 pt-0.5",children:m?e.jsx(g,{tag:"unsaved"}):null})]}),e.jsx(A,{checked:c,disabled:x,onChange:()=>{n(c?s.filter(u=>u.uid!==`draft:${t==null?void 0:t.id}`):[...s,{uid:`draft:${t==null?void 0:t.id}`,label:"draft",item:{createdAt:Date.now()}}])}})]})}function K(){return e.jsx("div",{className:"mt-2 space-y-2",children:Array.from({length:5}).map((s,n)=>e.jsxs("div",{className:"flex items-start gap-3 rounded-md border p-2",children:[e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(a.Skeleton,{className:"h-4 w-3/4"}),e.jsx(a.Skeleton,{className:"h-3 w-1/2"}),e.jsx(a.Skeleton,{className:"mt-1 h-5 w-20"})]}),e.jsx(a.Skeleton,{className:"h-8 w-8 rounded-full"})]},n))})}function I({revision:s,isLatest:n,onRestore:t,onDelete:l,revisionNumber:r,compare:c,setCompare:x,pageId:m}){const{data:u}=d.useChaiUserInfo(s.currentEditor),i=(u==null?void 0:u.name)||"Unknown",f=!!c.find(h=>{var j;return n?(j=h==null?void 0:h.uid)==null?void 0:j.startsWith("live"):(h==null?void 0:h.uid)===s.uid}),S=c.length>=2&&!f;return e.jsxs("div",{className:"relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50",children:[e.jsxs("div",{className:"flex-1 space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"flex items-center gap-1 text-xs leading-none",children:[e.jsx(g,{tag:n?"live":`#${r}`}),s.type==="published"?"Published":"Draft"," by ",e.jsx("span",{className:"text-xs font-bold",children:i})]})}),e.jsxs("div",{className:"flex items-center gap-x-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:s.type==="published"?e.jsx(g,{tag:"published"}):e.jsx(g,{tag:"draft"})}),e.jsx("div",{className:"flex items-center text-[10px] text-muted-foreground",children:e.jsx("span",{className:"leading-tight",children:y.format(s.createdAt,"MMM d, h:mm a")})})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(d.PermissionChecker,{permissions:[d.PAGES_PERMISSIONS.RESTORE_REVISION,d.PAGES_PERMISSIONS.DELETE_REVISION],children:e.jsx(Y,{revision:s,onRestore:t,onDelete:l})})}),e.jsx(A,{checked:f,disabled:S,onChange:()=>{x(f?c.filter(h=>n?h.uid!==`live:${m}`:h.uid!==s.uid):[...c,{uid:n?`live:${m}`:s.uid,label:n?"live":`#${r}`,item:s}].sort((h,j)=>new Date(h.item.createdAt).getTime()-new Date(j.item.createdAt).getTime()))}})]})}function W({compare:s,setCompare:n,pageId:t}){const[l,r]=b.useState(!1),[c,x]=s;if(s.length===0)return null;const m=({tab:u})=>e.jsxs("span",{className:"flex items-center justify-between rounded border border-blue-100 p-1 font-medium",children:[e.jsx(g,{tag:u.label}),e.jsx("button",{className:"z-0 flex h-4 w-4 items-center justify-center rounded-full text-gray-400 hover:text-red-500",style:{lineHeight:1},onClick:()=>n(s.filter(i=>i.uid!==u.uid)),"aria-label":"Remove selection 1",children:e.jsx(p.X,{className:"h-3 w-3"})})]});return e.jsxs("div",{className:"mb-2 flex w-full max-w-md flex-col gap-1 rounded border bg-accent/60 p-2 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-xs",children:[e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"Compare"}),c&&e.jsx(m,{tab:c}),e.jsx("span",{className:"font-medium leading-tight text-gray-600",children:"with"}),x?e.jsx(m,{tab:x}):e.jsx("span",{className:"rounded border px-1 text-xs text-muted-foreground",children:"Choose another"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pb-0.5 pt-2",children:[e.jsx(a.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none text-gray-500",variant:"outline",onClick:()=>n([]),children:e.jsx("span",{children:" Clear"})}),e.jsxs(a.Button,{size:"sm",className:"h-6 gap-1 rounded px-2 text-xs leading-none",variant:"default",onClick:()=>r(!0),disabled:s.length<2,children:[e.jsx(p.FileJson,{className:"h-2.5 w-2.5"}),e.jsx("span",{className:"pt-0.5",children:"Show JSON Diff"})]})]}),l&&(s==null?void 0:s.length)>1&&t&&e.jsx(b.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx("span",{className:"text-sm",children:"Loading diff viewer..."})}),children:e.jsx($,{open:l,onOpenChange:r,compare:s})})]})}function A({checked:s,disabled:n,onChange:t,label:l="Compare"}){return e.jsx("div",{className:"absolute bottom-2 right-2",children:e.jsxs("label",{className:`flex cursor-pointer items-center gap-x-1 text-[11px] ${n?"opacity-50":""}`,children:[e.jsx("input",{type:"checkbox",className:"h-3 w-3 cursor-pointer rounded focus:ring-0 focus:ring-offset-0",checked:s,disabled:n,onChange:t}),e.jsx("span",{className:"select-none leading-tight",children:l})]})})}function Y({revision:s,onRestore:n,onDelete:t}){return e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"ghost",size:"icon",className:"h-5 w-5",children:[e.jsx(p.MoreHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"More options"})]})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"text-xs",children:[e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.RESTORE_REVISION,children:e.jsxs(a.DropdownMenuItem,{onClick:n,className:"cursor-pointer text-sm",children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Restore this version"})]})}),e.jsx(d.PermissionChecker,{permission:d.PAGES_PERMISSIONS.DELETE_REVISION,children:s.uid!=="current"&&e.jsxs(e.Fragment,{children:[e.jsx(a.DropdownMenuSeparator,{}),e.jsxs(a.DropdownMenuItem,{onClick:t,className:"cursor-pointer text-destructive",children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Delete this version"})]})]})})]})]})}function X({open:s,onOpenChange:n,revision:t,onRestore:l,isRestoring:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Restore Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to restore to revision ",t.uid.substring(0,8)," from"," ",y.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"How would you like to handle your current edits?"})}),e.jsxs(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>l(!1),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Saving as draft..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.CloudOff,{className:"mr-2 h-4 w-4"}),"Save as draft"]})}),e.jsx(a.Button,{variant:"default",className:"sm:flex-1",onClick:()=>l(!0),disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Discarding current..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Undo2,{className:"mr-2 h-4 w-4"}),"Discard current"]})})]})]})}):null}function Z({open:s,onOpenChange:n,revision:t,onDelete:l,isDeleting:r}){const{data:c}=d.useChaiUserInfo((t==null?void 0:t.currentEditor)||""),x=(c==null?void 0:c.name)||"Unknown";return t?e.jsx(a.Dialog,{open:s,onOpenChange:m=>{r||n(m)},children:e.jsxs(a.DialogContent,{className:"sm:max-w-md",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Delete Revision"}),e.jsxs(a.DialogDescription,{children:["You are about to delete revision ",t.uid.substring(0,8)," from"," ",y.format(t.createdAt,"MMM d, yyyy 'at' h:mm a")," by ",x]})]}),e.jsx("div",{className:"py-2",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"This action cannot be undone. Are you sure you want to proceed?"})}),e.jsxs(a.DialogFooter,{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(a.Button,{variant:"outline",className:"sm:flex-1",onClick:()=>n(!1),disabled:r,children:"Cancel"}),e.jsx(a.Button,{variant:"destructive",className:"sm:flex-1",onClick:l,disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Deleting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(p.Trash,{className:"mr-2 h-4 w-4"}),"Delete Revision"]})})]})]})}):null}function ee({isOpen:s}){var E,R;const[n,t]=v.useState([]),[l,r]=v.useState(null),[c,x]=v.useState(!1),[m,u]=v.useState(!1),{data:i}=d.useCurrentPage(),{data:f,isFetching:S,error:h,refetch:j}=z(i==null?void 0:i.id),{mutate:k,isPending:M}=B(),{mutate:T,isPending:F}=H(),_=N.useQueryClient(),{selectedLang:P,fallbackLang:q}=O.useLanguages(),U=P||q;b.useEffect(()=>t([]),[i==null?void 0:i.id]);const G=o=>{l&&T({revisionId:l.uid,discardCurrent:o},{onSuccess:()=>{x(!1),r(null),_.invalidateQueries({queryKey:[d.ACTIONS.GET_DRAFT_PAGE]})}})},D=o=>{r(o),x(!0)},C=o=>{r(o),u(!0)},V=()=>{l&&k(l.uid,{onSuccess:()=>{u(!1),r(null)}})};return b.useEffect(()=>{s&&j()},[s,j]),e.jsxs(e.Fragment,{children:[e.jsxs(a.SheetHeader,{children:[e.jsx(a.SheetTitle,{children:"Revision History"}),(i==null?void 0:i.createdAt)&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Page created on ",y.format(new Date(i.createdAt),"MMM d, yyyy 'at' h:mm a")]})]}),S?e.jsx(K,{}):h?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"Failed to load revisions. Please try again."}):e.jsxs("div",{className:"mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2",children:[e.jsx(W,{lang:U,compare:n,setCompare:t,pageId:i==null?void 0:i.id}),e.jsx(J,{compare:n,setCompare:t}),(E=f==null?void 0:f.filter(o=>o.uid==="current"))==null?void 0:E.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:!0,onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w,compare:n,setCompare:t},o.uid)),e.jsx(a.ScrollArea,{className:"min-h-0 flex-1",children:e.jsx("div",{className:"space-y-2",children:(R=f==null?void 0:f.filter(o=>o.uid!=="current"))==null?void 0:R.map((o,w)=>e.jsx(I,{pageId:i==null?void 0:i.id,revision:o,isLatest:o.uid==="current",onRestore:()=>D(o),onDelete:()=>C(o),revisionNumber:w+1,compare:n,setCompare:t},o.uid))})})]}),e.jsx(X,{open:c,onOpenChange:x,revision:l,onRestore:G,isRestoring:F}),e.jsx(Z,{open:m,onOpenChange:u,revision:l,onDelete:V,isDeleting:M})]})}exports.default=ee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./page-manager-search-and-filter-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),B=require("./page-manager-search-and-filter-CgY2qiXU.cjs"),r=require("./index-Qnh8Lkr0.cjs"),L=require("@tanstack/react-query"),h=require("@chaibuilder/sdk/ui"),t=require("lodash-es"),j=require("lucide-react"),i=require("react"),F=()=>{const l=r.useApiUrl(),u=r.useFetch();return L.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>u(l,{action:r.ACTIONS.GET_CHANGES})})},O=({page:l,selectedPages:u,handleCheckboxChange:b,getPageType:m,hasSlug:o,currentOwnerId:x})=>{const{data:d}=r.useChaiUserInfo(x),a=d==null?void 0:d.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 ${a?"opacity-50":""}`,children:[a?e.jsx(j.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(u,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),b(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",o(l.pageType)?e.jsx(j.File,{className:"h-4 w-4"}):e.jsx(j.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:m(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:a&&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(j.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:a})," is editing this page"]})})]},l==null?void 0:l.id)},G=({onClose:l=()=>{},isPending:u,publishPage:b})=>{const[m]=r.usePageUserMapping(),[o,x]=i.useState([]),d=r.useFallbackLang(),[a,p]=i.useState(d),{data:N,isFetching:T}=F(),{data:g}=r.usePageTypes(),k=i.useCallback(s=>{var n;return(n=t.find(g,{key:s}))==null?void 0:n.hasSlug},[g]),y=i.useMemo(()=>t.filter(g,s=>!k(s.key)).map(s=>s.key),[k,g]),P=t.uniq(t.map(N,"lang")).filter(Boolean),c=i.useMemo(()=>t.filter(N,s=>s.pageType==="theme"?!1:a===d?s.lang===a||s.lang==="":s.lang===a),[N,a,d]),w=i.useMemo(()=>t.filter(c,s=>!y.includes(s.pageType)),[c,y]),S=i.useMemo(()=>t.filter(c,s=>y.includes(s.pageType)),[c,y]);i.useEffect(()=>{const s=t.map(t.filter(c,{online:!0}),"id");x(s)},[c]),i.useEffect(()=>{const s=Object.keys(m);x(n=>t.filter(n,f=>!t.includes(s,f)))},[m]);const C=o.length===(c==null?void 0:c.length),v=s=>{x(n=>t.includes(n,s)?t.filter(n,f=>f!==s):t.concat(n,s))},E=()=>{x(C?[]:t.map(c,"id"))},q=()=>{b({ids:t.uniq(o)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(d)}})},M=s=>{if(s==="theme")return"Theme";const n=t.find(g,{key:s});return n?n==null?void 0:n.name:s},A=i.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(f=>f.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(h.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(h.DialogHeader,{children:[e.jsx(h.DialogTitle,{children:"Publish changes"}),e.jsx(h.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(B.LanguageSelector,{languages:[d,...P],selectedLanguage:a,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:T?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:C,onClick:s=>{s.stopPropagation(),E()},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(A,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(O,{page:s,selectedPages:o,handleCheckboxChange:v,getPageType:M,hasSlug:k,currentOwnerId:m[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id)]}))})]})}),e.jsxs(h.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[o.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[o.length," Page",o.length!==1?"s":""," Selected"]}),e.jsx(h.Button,{disabled:u,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(h.Button,{disabled:u||T||t.isEmpty(o),onClick:q,children:u?"Publishing...":"Publish Selected"})]})]})};exports.default=G;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { LanguageSelector as z } from "./page-manager-search-and-filter-
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { LanguageSelector as z } from "./page-manager-search-and-filter-Bt4T_dnB.js";
|
|
3
|
+
import { ak as R, al as _, A as L, ay as $, f as K, h as Q, aq as J, T as A, t as V } from "./index-DFvsMFVH.js";
|
|
4
4
|
import { useQuery as W } from "@tanstack/react-query";
|
|
5
5
|
import { DialogContent as X, DialogHeader as Y, DialogTitle as Z, DialogDescription as ee, DialogFooter as te, Button as F } from "@chaibuilder/sdk/ui";
|
|
6
|
-
import { find as G, filter as
|
|
7
|
-
import { Lock as
|
|
8
|
-
import { useState as
|
|
6
|
+
import { find as G, filter as a, map as y, includes as P, orderBy as b, isEmpty as se, first as le, uniq as U, concat as ne } from "lodash-es";
|
|
7
|
+
import { Lock as ae, GlobeIcon as re, File as ce, Edit as oe } from "lucide-react";
|
|
8
|
+
import { useState as O, useCallback as ie, useMemo as g, useEffect as j } from "react";
|
|
9
9
|
const de = () => {
|
|
10
10
|
const s = R(), d = _();
|
|
11
11
|
return W({
|
|
@@ -14,14 +14,14 @@ const de = () => {
|
|
|
14
14
|
});
|
|
15
15
|
}, ue = ({ page: s, selectedPages: d, handleCheckboxChange: N, getPageType: h, hasSlug: o, currentOwnerId: u }) => {
|
|
16
16
|
const { data: i } = J(u), r = i == null ? void 0 : i.name;
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
/* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ n("tr", { className: "group relative border-b last:border-b-0 hover:bg-gray-50", children: [
|
|
18
|
+
/* @__PURE__ */ n(
|
|
19
19
|
"td",
|
|
20
20
|
{
|
|
21
21
|
scope: "row",
|
|
22
22
|
className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${r ? "opacity-50" : ""}`,
|
|
23
23
|
children: [
|
|
24
|
-
r ? /* @__PURE__ */ t(
|
|
24
|
+
r ? /* @__PURE__ */ t(ae, { className: "h-4 w-4 fill-red-200 text-red-500" }) : /* @__PURE__ */ t(
|
|
25
25
|
"input",
|
|
26
26
|
{
|
|
27
27
|
checked: P(d, s == null ? void 0 : s.id),
|
|
@@ -41,47 +41,47 @@ const de = () => {
|
|
|
41
41
|
),
|
|
42
42
|
/* @__PURE__ */ t("td", { className: "px-2", children: h(s == null ? void 0 : s.pageType) }),
|
|
43
43
|
/* @__PURE__ */ t("td", { className: "px-4 text-right", children: le(s.changes) || "" }),
|
|
44
|
-
/* @__PURE__ */ t(H, { children: r && /* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ t(H, { children: r && /* @__PURE__ */ n("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: [
|
|
45
45
|
/* @__PURE__ */ t(oe, { size: 12, className: "stroke-[3]" }),
|
|
46
46
|
" ",
|
|
47
47
|
/* @__PURE__ */ t("span", { className: "font-medium", children: r }),
|
|
48
48
|
" is editing this page"
|
|
49
49
|
] }) })
|
|
50
50
|
] }, s == null ? void 0 : s.id);
|
|
51
|
-
},
|
|
51
|
+
}, ke = ({
|
|
52
52
|
onClose: s = () => {
|
|
53
53
|
},
|
|
54
54
|
isPending: d,
|
|
55
55
|
publishPage: N
|
|
56
56
|
}) => {
|
|
57
|
-
const [h] = $(), [o, u] =
|
|
57
|
+
const [h] = $(), [o, u] = O([]), i = K(), [r, x] = O(i), { data: k, isFetching: C } = de(), { data: m } = Q(), w = ie((e) => {
|
|
58
58
|
var l;
|
|
59
59
|
return (l = G(m, { key: e })) == null ? void 0 : l.hasSlug;
|
|
60
60
|
}, [m]), f = g(
|
|
61
|
-
() =>
|
|
62
|
-
[
|
|
63
|
-
), v = U(y(
|
|
64
|
-
() =>
|
|
65
|
-
[
|
|
61
|
+
() => a(m, (e) => !w(e.key)).map((e) => e.key),
|
|
62
|
+
[w, m]
|
|
63
|
+
), v = U(y(k, "lang")).filter(Boolean), c = g(
|
|
64
|
+
() => a(k, (e) => e.pageType === "theme" ? !1 : r === i ? e.lang === r || e.lang === "" : e.lang === r),
|
|
65
|
+
[k, r, i]
|
|
66
66
|
), T = g(
|
|
67
|
-
() =>
|
|
67
|
+
() => a(c, (e) => !f.includes(e.pageType)),
|
|
68
68
|
[c, f]
|
|
69
69
|
), S = g(
|
|
70
|
-
() =>
|
|
70
|
+
() => a(c, (e) => f.includes(e.pageType)),
|
|
71
71
|
[c, f]
|
|
72
72
|
);
|
|
73
|
-
|
|
74
|
-
const e = y(
|
|
73
|
+
j(() => {
|
|
74
|
+
const e = y(a(c, { online: !0 }), "id");
|
|
75
75
|
u(e);
|
|
76
|
-
}, [c]),
|
|
76
|
+
}, [c]), j(() => {
|
|
77
77
|
const e = Object.keys(h);
|
|
78
|
-
u((l) =>
|
|
78
|
+
u((l) => a(l, (p) => !P(e, p)));
|
|
79
79
|
}, [h]);
|
|
80
80
|
const E = o.length === (c == null ? void 0 : c.length), B = (e) => {
|
|
81
|
-
u((l) => P(l, e) ?
|
|
81
|
+
u((l) => P(l, e) ? a(l, (p) => p !== e) : ne(l, e));
|
|
82
82
|
}, D = () => {
|
|
83
83
|
u(E ? [] : y(c, "id"));
|
|
84
|
-
},
|
|
84
|
+
}, q = () => {
|
|
85
85
|
N(
|
|
86
86
|
{ ids: U(o) },
|
|
87
87
|
{
|
|
@@ -90,24 +90,24 @@ const de = () => {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
|
-
},
|
|
93
|
+
}, I = (e) => {
|
|
94
94
|
if (e === "theme") return "Theme";
|
|
95
95
|
const l = G(m, { key: e });
|
|
96
96
|
return l ? l == null ? void 0 : l.name : e;
|
|
97
|
-
},
|
|
97
|
+
}, M = g(() => {
|
|
98
98
|
const e = [
|
|
99
99
|
{ label: "Updated", top: "pt-2" },
|
|
100
|
-
...b(
|
|
101
|
-
...b(
|
|
100
|
+
...b(a(T, { online: !0 }), "pageType"),
|
|
101
|
+
...b(a(S, { online: !0 }), "pageType")
|
|
102
102
|
].filter((p) => p.pageType !== "theme"), l = [
|
|
103
103
|
{ label: "Offline", top: "pt-6" },
|
|
104
|
-
...b(
|
|
105
|
-
...b(
|
|
104
|
+
...b(a(T, { online: !1 }), "pageType"),
|
|
105
|
+
...b(a(S, { online: !1 }), "pageType")
|
|
106
106
|
];
|
|
107
107
|
return [...e, ...l];
|
|
108
108
|
}, [T, S]);
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ n(X, { className: "flex max-h-[80%] max-w-4xl flex-col", children: [
|
|
110
|
+
/* @__PURE__ */ n(Y, { children: [
|
|
111
111
|
/* @__PURE__ */ t(Z, { children: "Publish changes" }),
|
|
112
112
|
/* @__PURE__ */ t(ee, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
|
|
113
113
|
] }),
|
|
@@ -119,14 +119,14 @@ const de = () => {
|
|
|
119
119
|
setSelectedLanguage: x
|
|
120
120
|
}
|
|
121
121
|
) }),
|
|
122
|
-
/* @__PURE__ */ t("div", { className: "no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto", children: C ? /* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ t("div", { className: "no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto", children: C ? /* @__PURE__ */ n("div", { className: "space-y-2 px-1", children: [
|
|
123
123
|
/* @__PURE__ */ t("div", { className: "mt-2 h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
124
124
|
/* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
125
125
|
/* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" }),
|
|
126
126
|
/* @__PURE__ */ t("div", { className: "h-6 w-full animate-pulse rounded bg-gray-200" })
|
|
127
|
-
] }) : /* @__PURE__ */
|
|
128
|
-
/* @__PURE__ */ t("thead", { className: "sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: /* @__PURE__ */
|
|
129
|
-
/* @__PURE__ */
|
|
127
|
+
] }) : /* @__PURE__ */ n("table", { className: "w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right", children: [
|
|
128
|
+
/* @__PURE__ */ t("thead", { className: "sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400", children: /* @__PURE__ */ n("tr", { children: [
|
|
129
|
+
/* @__PURE__ */ n("th", { scope: "col", className: "w-[1 50px] flex items-center gap-x-2 px-6 py-3", children: [
|
|
130
130
|
/* @__PURE__ */ t(
|
|
131
131
|
"input",
|
|
132
132
|
{
|
|
@@ -144,8 +144,8 @@ const de = () => {
|
|
|
144
144
|
/* @__PURE__ */ t("th", { scope: "col", className: "w-[150px] px-4 py-3 text-right", children: "Status" })
|
|
145
145
|
] }) }),
|
|
146
146
|
/* @__PURE__ */ t("tbody", { children: y(
|
|
147
|
-
|
|
148
|
-
(e) => e.label ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */
|
|
147
|
+
M,
|
|
148
|
+
(e) => e.label ? /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ n("td", { colSpan: 3, className: `relative px-6 py-2 text-xs font-medium text-gray-800 ${e.top}`, children: [
|
|
149
149
|
/* @__PURE__ */ t("div", { className: "absolute inset-0 left-6 flex items-center", children: /* @__PURE__ */ t("div", { className: "order-gray-300 w-full" }) }),
|
|
150
150
|
/* @__PURE__ */ t("div", { className: "relative flex justify-start", children: /* @__PURE__ */ t("span", { className: "bg-gray-50 pr-2", children: e.label }) })
|
|
151
151
|
] }) }, "separator") : /* @__PURE__ */ t(
|
|
@@ -154,25 +154,25 @@ const de = () => {
|
|
|
154
154
|
page: e,
|
|
155
155
|
selectedPages: o,
|
|
156
156
|
handleCheckboxChange: B,
|
|
157
|
-
getPageType:
|
|
158
|
-
hasSlug:
|
|
157
|
+
getPageType: I,
|
|
158
|
+
hasSlug: w,
|
|
159
159
|
currentOwnerId: h[(e == null ? void 0 : e.primaryPage) || (e == null ? void 0 : e.id)]
|
|
160
160
|
}
|
|
161
161
|
)
|
|
162
162
|
) })
|
|
163
163
|
] }) }),
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
o.length > 0 && /* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ n(te, { className: "mt-10 flex items-center justify-center", children: [
|
|
165
|
+
o.length > 0 && /* @__PURE__ */ n("span", { className: "text-center text-sm text-muted-foreground", children: [
|
|
166
166
|
o.length,
|
|
167
167
|
" Page",
|
|
168
168
|
o.length !== 1 ? "s" : "",
|
|
169
169
|
" Selected"
|
|
170
170
|
] }),
|
|
171
171
|
/* @__PURE__ */ t(F, { disabled: d, variant: "outline", onClick: s, children: "Cancel" }),
|
|
172
|
-
/* @__PURE__ */ t(F, { disabled: d || C || se(o), onClick:
|
|
172
|
+
/* @__PURE__ */ t(F, { disabled: d || C || se(o), onClick: q, children: d ? "Publishing..." : "Publish Selected" })
|
|
173
173
|
] })
|
|
174
174
|
] });
|
|
175
175
|
};
|
|
176
176
|
export {
|
|
177
|
-
|
|
177
|
+
ke as default
|
|
178
178
|
};
|