@chaibuilder/sdk 4.0.0-beta.49 → 4.0.0-beta.51
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 +35 -52
- package/dist/{2SSKDMRQ-CjvuNdPo.cjs → 2SSKDMRQ-BSYe_xPq.cjs} +1 -1
- package/dist/{2SSKDMRQ-Dvf9zadl.js → 2SSKDMRQ-Dv-C_YAA.js} +3 -3
- package/dist/{AP7HFJJL-DYFttFoI.cjs → AP7HFJJL-BJolKJBt.cjs} +1 -1
- package/dist/{AP7HFJJL-q4dJdyFs.js → AP7HFJJL-DhdVstVC.js} +1 -1
- package/dist/{IconPicker-Bf163F7t.js → IconPicker-BBkl0T8b.js} +13 -13
- package/dist/{IconPicker-JWhYq2Gp.cjs → IconPicker-C0WWlb8t.cjs} +1 -1
- package/dist/{WDYDFRGG-O9GIrtX0.js → WDYDFRGG-CJs2MxSq.js} +4 -4
- package/dist/{WDYDFRGG-BEksfGMC.cjs → WDYDFRGG-DRt6Zg7Q.cjs} +1 -1
- package/dist/{actions-registery-BHbZHkE3.cjs → actions-registery-CLL3KrNv.cjs} +2 -2
- package/dist/{actions-registery-gJb_wq2F.js → actions-registery-CrGIlqUX.js} +88 -88
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{add-new-language-page-BfUp5Ua2.cjs → add-new-language-page-ByMSfRcN.cjs} +1 -1
- package/dist/{add-new-language-page-CRR93tLq.js → add-new-language-page-DtVoDNfI.js} +35 -35
- package/dist/{add-new-page-B8NGK6WS.cjs → add-new-page-CnuChfJz.cjs} +1 -1
- package/dist/add-new-page-DanzzvYo.js +31 -0
- package/dist/{ai-panel-default-lang-BXYQye3N.js → ai-panel-default-lang-BaPz2d_6.js} +35 -35
- package/dist/{ai-panel-default-lang-VhgmHFoQ.cjs → ai-panel-default-lang-CoIQSz_Y.cjs} +2 -2
- package/dist/{ai-panel-other-lang-DaCf-cq4.js → ai-panel-other-lang--i-5z4e2.js} +22 -22
- package/dist/{ai-panel-other-lang-Ds0EXeUC.cjs → ai-panel-other-lang-ChlMVodg.cjs} +1 -1
- package/dist/{ai-prompt-input-7iWk72w5.js → ai-prompt-input-BQi0VDJC.js} +77 -77
- package/dist/{ai-prompt-input-nZ5_Dm7X.cjs → ai-prompt-input-BT5426AB.cjs} +1 -1
- package/dist/{ai-translation-prompt-1OUs1P7n.js → ai-translation-prompt-BN78s33t.js} +8 -8
- package/dist/{ai-translation-prompt-B16cK-1Q.cjs → ai-translation-prompt-BQPaekp3.cjs} +1 -1
- package/dist/{apply-binding-CBSjMYSk.cjs → apply-binding-Cjh1kqMO.cjs} +1 -1
- package/dist/{apply-binding-vAuN-TGV.js → apply-binding-v_W4uR3U.js} +28 -28
- package/dist/{plugin-BSjgGgwo.js → chai-theme-helpers-BEf2rwE4.js} +83 -83
- package/dist/chai-theme-helpers-q3nwoNht.cjs +22 -0
- package/dist/{change-password-modal-D5eXjiYq.cjs → change-password-modal-DHUrrKw7.cjs} +1 -1
- package/dist/{change-password-modal-CdvJR1Ln.js → change-password-modal-pEp-nMNb.js} +30 -30
- package/dist/{code-display-DdWcOQ_i.js → code-display-BaLKScgW.js} +5 -5
- package/dist/{code-display-BR-gij5j.cjs → code-display-i7jb2kmw.cjs} +1 -1
- package/dist/{code-editor-CyLjDiEp.js → code-editor-CRoniyP0.js} +12 -12
- package/dist/{code-editor-SWbfFj1E.cjs → code-editor-gwFRjQ2_.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +0 -5
- package/dist/core.js +49 -49
- package/dist/{css-import-modal-Be47CBJn.js → css-import-modal-B3qxX9Iv.js} +14 -14
- package/dist/{css-import-modal-Bdwgd05S.cjs → css-import-modal-nAB5FSwn.cjs} +2 -2
- package/dist/{delete-page-C99K2qzS.js → delete-page-DbawNFf7.js} +13 -13
- package/dist/{delete-page-DLohaU-U.cjs → delete-page-YP1HEAoD.cjs} +1 -1
- package/dist/{digital-asset-manager-BZMb6sC7.js → digital-asset-manager-DTD5mf24.js} +388 -357
- package/dist/digital-asset-manager-kJnuMqpw.cjs +1 -0
- package/dist/{duplicate-page-D5Gtvqdv.cjs → duplicate-page-CxqW_EO7.cjs} +1 -1
- package/dist/{duplicate-page-CDc2X0eW.js → duplicate-page-DnRb1y6K.js} +19 -19
- package/dist/{dynamic-page-selector-DZHhX008.cjs → dynamic-page-selector-2EqJhUrB.cjs} +1 -1
- package/dist/{dynamic-page-selector-DvNBXo6o.js → dynamic-page-selector-D6VLDIN9.js} +17 -17
- package/dist/{get-chai-builder-tailwind-config-7CxFxEYL.cjs → get-chai-builder-tailwind-config-DNp8Vhme.cjs} +1 -1
- package/dist/{get-chai-builder-tailwind-config-DC4sDOYK.js → get-chai-builder-tailwind-config-k8l5sdcw.js} +3 -3
- package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-DLpviqPJ.js} +1 -1
- package/dist/get-chai-builder-theme-Du4ARJlw.cjs +1 -0
- package/dist/{image-editor-DwhTYkVR.cjs → image-editor-BQcOGsli.cjs} +1 -1
- package/dist/{image-editor-BBvvi9Vm.js → image-editor-CMf731xL.js} +15 -15
- package/dist/index-BYrRPW_c.cjs +5 -0
- package/dist/index-D-r_K4yA.cjs +160 -0
- package/dist/{index-OuHV9Ann.js → index-DPV6NiJ-.js} +5894 -6049
- package/dist/index-DqzFD1CG.js +4861 -0
- package/dist/{mark-as-template-CP_F9ZQ4.js → mark-as-template-D7jqSCXw.js} +28 -28
- package/dist/{mark-as-template-B9yLcasI.cjs → mark-as-template-DyB56HzI.cjs} +1 -1
- package/dist/{nested-path-selector-content-DmtCI3q9.js → nested-path-selector-content-dwSikrsV.js} +2 -2
- package/dist/{nested-path-selector-content-aTdu-o0e.cjs → nested-path-selector-content-g9_Tq_sR.cjs} +1 -1
- package/dist/no-language-page-content-BRITuyfN.js +43 -0
- package/dist/{no-language-page-content-C-MCdPXt.cjs → no-language-page-content-ZvMNVY-Y.cjs} +1 -1
- package/dist/{no-language-page-dialog-D4QIAHnE.cjs → no-language-page-dialog-Cndq8xRP.cjs} +1 -1
- package/dist/no-language-page-dialog-D7L9nVb9.js +10 -0
- package/dist/page-creator-BAIbU14q.js +652 -0
- package/dist/page-creator-qL3-M8g3.cjs +1 -0
- package/dist/{page-manager-new-ah6QYar2.cjs → page-manager-new-By3eGO3i.cjs} +1 -1
- package/dist/{page-manager-new-ttsrxdW9.js → page-manager-new-YRG89y4f.js} +63 -63
- package/dist/page-manager-search-and-filter-BbdgOU9V.cjs +1 -0
- package/dist/page-manager-search-and-filter-Cllju4CV.js +184 -0
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +0 -15
- package/dist/pages.js +20 -21
- package/dist/{publish-pages-content-KZVMHT6V.js → publish-pages-content-CG5LBUnY.js} +48 -48
- package/dist/{publish-pages-content-BrajJUcP.cjs → publish-pages-content-DxMiBxNU.cjs} +1 -1
- package/dist/{register-chai-top-bar-DyW9GPzV.cjs → register-chai-top-bar-CCssW5dL.cjs} +1 -1
- package/dist/{register-chai-top-bar-D6GjnauV.js → register-chai-top-bar-DWmJ2efT.js} +11 -11
- package/dist/render.cjs +1 -1
- package/dist/render.js +54 -54
- package/dist/{rte-widget-modal-CiTwsXTr.cjs → rte-widget-modal-CsTqFJc_.cjs} +1 -1
- package/dist/{rte-widget-modal-IU8JzPuZ.js → rte-widget-modal-DoeTMRtX.js} +2 -2
- package/dist/runtime-client.cjs +1 -1
- package/dist/runtime-client.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-CidmQ-wz.js → selected-block-display-Ck1kkNEi.js} +17 -28
- package/dist/{selected-block-display-CAFEOrLV.cjs → selected-block-display-DSow6N4b.cjs} +1 -1
- package/dist/seo-panel---mYZmLD.js +559 -0
- package/dist/seo-panel-mfX63fua.cjs +1 -0
- package/dist/{shared-json-ld-uvMmwCYp.js → shared-json-ld-B3I_RLE2.js} +46 -46
- package/dist/{shared-json-ld-CMH-eRUq.cjs → shared-json-ld-CGgwUOlW.cjs} +1 -1
- package/dist/{slug-input-DLWTMTsO.js → slug-input-DQ4t3-Tt.js} +5 -5
- package/dist/{slug-input-CiHC5l3r.cjs → slug-input-DaNbl597.cjs} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +2 -2
- package/dist/types.d.ts +0 -96
- package/dist/{unmark-as-template-F7TdgWjI.cjs → unmark-as-template-CZ65AE4v.cjs} +1 -1
- package/dist/{unmark-as-template-C5ovsEBP.js → unmark-as-template-DvmoTbVu.js} +11 -11
- package/dist/unpublish-page-3--vO5b0.js +28 -0
- package/dist/{unpublish-page-CUr8Xub6.cjs → unpublish-page-B46TiWlU.cjs} +1 -1
- package/dist/{unpublished-partials-modal-BhNAub_z.js → unpublished-partials-modal-DVMz3q83.js} +18 -15
- package/dist/{unpublished-partials-modal-Cv5R9-hi.cjs → unpublished-partials-modal-U5lKBOSR.cjs} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +2 -2
- package/dist/{web-preview-D9pXonAv.js → web-preview-D5o5XQo0.js} +2 -2
- package/dist/{web-preview-CuMYekVJ.cjs → web-preview-Da3RhcjQ.cjs} +1 -1
- package/package.json +1 -1
- package/dist/active-in-another-tab-B4Ur0JP7.js +0 -35
- package/dist/active-in-another-tab-BPdx4lWh.cjs +0 -1
- package/dist/add-new-page-Ppy5-y5j.js +0 -31
- package/dist/continue-editing-in-this-client-BrSvK-Ay.js +0 -25
- package/dist/continue-editing-in-this-client-Cmi-GkYZ.cjs +0 -1
- package/dist/design-token-usage-D1lWCJ3L.js +0 -114
- package/dist/design-token-usage-eY2wQ0l3.cjs +0 -1
- package/dist/digital-asset-manager-Z5aJxkq0.cjs +0 -1
- package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
- package/dist/image-compression-DPFITwOL.js +0 -37
- package/dist/image-compression-UaU7Bwqe.cjs +0 -1
- package/dist/index-BVwFJWDq.cjs +0 -5
- package/dist/index-DCJDQs1a.cjs +0 -160
- package/dist/index-LBTm1Jmk.js +0 -5199
- package/dist/json-diff-viewer-Cb1CmRqP.cjs +0 -8
- package/dist/json-diff-viewer-DG6qMOBS.js +0 -261
- package/dist/lang-panel-B3USOxGq.js +0 -216
- package/dist/lang-panel-DxoJ0v4y.cjs +0 -1
- package/dist/manage-design-tokens-6YGIctip.js +0 -446
- package/dist/manage-design-tokens-modal-BSSCXH8Y.cjs +0 -1
- package/dist/manage-design-tokens-modal-CzsnN49F.js +0 -161
- package/dist/manage-design-tokens-udLBvkHA.cjs +0 -1
- package/dist/no-language-page-content-D8t5dfgh.js +0 -43
- package/dist/no-language-page-dialog-C_fHI2zI.js +0 -10
- package/dist/page-creator-Cz_ah-qE.cjs +0 -1
- package/dist/page-creator-DKEkuGCO.js +0 -796
- package/dist/page-lock-CwZKJ4IE.js +0 -30
- package/dist/page-lock-DdCvtA-I.cjs +0 -1
- package/dist/page-locked-dialog-CrTDBoC4.cjs +0 -1
- package/dist/page-locked-dialog-DqLlooUz.js +0 -136
- package/dist/page-manager-search-and-filter-D7AupT6_.cjs +0 -1
- package/dist/page-manager-search-and-filter-bsqZ6wnI.js +0 -210
- package/dist/page-revisions-content-B6hsIla7.cjs +0 -1
- package/dist/page-revisions-content-C5O8_Fms.js +0 -459
- package/dist/plugin-DHpuZZXz.cjs +0 -22
- package/dist/save-to-lib-DMnv7ENo.js +0 -429
- package/dist/save-to-lib-Dc700Aop.cjs +0 -1
- package/dist/seo-panel-Br8gxDxu.js +0 -789
- package/dist/seo-panel-CMY-adM-.cjs +0 -2
- package/dist/take-over-request-IRLgF1dG.cjs +0 -1
- package/dist/take-over-request-KdR1_h_K.js +0 -64
- package/dist/translation-warning-modal-CLZ9tC1F.cjs +0 -1
- package/dist/translation-warning-modal-CzNt6LDO.js +0 -27
- package/dist/unpublish-page-0fR1o0b7.js +0 -28
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as L } from "@tanstack/react-query";
|
|
3
|
+
import { get as o, isEmpty as v, filter as u, map as k } from "lodash-es";
|
|
4
|
+
import { Star as P, Plus as z, ListFilter as F, Search as S, ChevronsUpDown as I, ChevronsDownUp as G, RefreshCw as U } from "lucide-react";
|
|
5
|
+
import { useState as $, useMemo as j, useEffect as B } from "react";
|
|
6
|
+
import { useTranslation as g } from "react-i18next";
|
|
7
|
+
import { B as p, z as A } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
8
|
+
import { S as D, z as M, A as R, E as b, F as w, G as y, H as N } from "./index-DPV6NiJ-.js";
|
|
9
|
+
import { f as W, L as q, h as K, ag as Q } from "./index-DqzFD1CG.js";
|
|
10
|
+
import { u as _ } from "./use-page-expand-manager-Cf4MUEJw.js";
|
|
11
|
+
const H = ({ selectedPageType: t, setSelectedPageType: r }) => {
|
|
12
|
+
const { t: n } = g(), [i, l] = $(""), { data: c } = K(), f = j(
|
|
13
|
+
() => c.some((a) => !["page", "global"].includes(o(a, "key", ""))),
|
|
14
|
+
[c]
|
|
15
|
+
);
|
|
16
|
+
if (B(() => {
|
|
17
|
+
!f && t !== "all" && r("all");
|
|
18
|
+
}, [f, t, r]), !f) return null;
|
|
19
|
+
const d = (a) => {
|
|
20
|
+
if (!i) return !0;
|
|
21
|
+
const h = i.toLowerCase(), x = (E) => String(o(a, E, "")).toLowerCase().includes(h);
|
|
22
|
+
return x("name") || x("key");
|
|
23
|
+
}, m = c.find((a) => a.key === t);
|
|
24
|
+
return /* @__PURE__ */ s(D, { onValueChange: r, value: t, children: [
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
M,
|
|
27
|
+
{
|
|
28
|
+
className: `${t === "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`,
|
|
29
|
+
children: /* @__PURE__ */ s("div", { className: "flex w-full items-center justify-between gap-x-1.5", children: [
|
|
30
|
+
/* @__PURE__ */ e("span", { className: "max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight", children: (m == null ? void 0 : m.name) || n("All") }),
|
|
31
|
+
/* @__PURE__ */ e(
|
|
32
|
+
F,
|
|
33
|
+
{
|
|
34
|
+
className: `${t !== "all" ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
] })
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ s(R, { children: [
|
|
41
|
+
/* @__PURE__ */ e("div", { className: "sticky top-0 z-10 bg-white pb-2", children: /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
42
|
+
/* @__PURE__ */ e(S, { strokeWidth: 2, className: "absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400" }),
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
A,
|
|
45
|
+
{
|
|
46
|
+
placeholder: n("Search page types..."),
|
|
47
|
+
className: "h-8 w-full rounded border pl-8 text-xs shadow-none",
|
|
48
|
+
value: i,
|
|
49
|
+
onChange: (a) => l(a.target.value),
|
|
50
|
+
onKeyDown: (a) => a.stopPropagation()
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] }) }),
|
|
54
|
+
/* @__PURE__ */ e(b, { value: "all", children: n("All") }),
|
|
55
|
+
!v(u(c, (a) => a.hasSlug && d(a))) && /* @__PURE__ */ s(C, { children: [
|
|
56
|
+
/* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: n("Pages") }),
|
|
57
|
+
k(
|
|
58
|
+
[...u(c, (a) => a.hasSlug && d(a))].sort(
|
|
59
|
+
(a, h) => o(a, "name", "").localeCompare(o(h, "name", ""))
|
|
60
|
+
),
|
|
61
|
+
(a) => /* @__PURE__ */ e(b, { value: o(a, "key"), children: o(a, "name") }, o(a, "key"))
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
!v(u(c, (a) => !a.hasSlug && d(a))) && /* @__PURE__ */ s(C, { children: [
|
|
65
|
+
/* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: n("Partials") }),
|
|
66
|
+
k(
|
|
67
|
+
[...u(c, (a) => !a.hasSlug && d(a))].sort(
|
|
68
|
+
(a, h) => o(a, "name", "").localeCompare(o(h, "name", ""))
|
|
69
|
+
),
|
|
70
|
+
(a) => /* @__PURE__ */ e(b, { value: o(a, "key"), children: o(a, "name") }, o(a, "key"))
|
|
71
|
+
)
|
|
72
|
+
] }),
|
|
73
|
+
v(u(c, d)) && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: n("No matching page types found") })
|
|
74
|
+
] })
|
|
75
|
+
] });
|
|
76
|
+
}, O = ({ search: t, setSearch: r }) => {
|
|
77
|
+
const { t: n } = g();
|
|
78
|
+
return /* @__PURE__ */ s("div", { className: "relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5", children: [
|
|
79
|
+
/* @__PURE__ */ e("label", { htmlFor: "page-search-input", className: "sr-only", children: n("Search Pages") }),
|
|
80
|
+
/* @__PURE__ */ e(
|
|
81
|
+
S,
|
|
82
|
+
{
|
|
83
|
+
className: `${t ? "fill-sky-50 text-sky-500" : ""} pointer-events-none h-4 w-4 text-muted-foreground`,
|
|
84
|
+
"aria-hidden": "true"
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
A,
|
|
89
|
+
{
|
|
90
|
+
id: "page-search-input",
|
|
91
|
+
placeholder: n("Search pages"),
|
|
92
|
+
value: t,
|
|
93
|
+
onChange: (i) => r(i.target.value),
|
|
94
|
+
className: "border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",
|
|
95
|
+
autoComplete: "off",
|
|
96
|
+
autoFocus: !0
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] });
|
|
100
|
+
}, T = ({ pages: t }) => {
|
|
101
|
+
const { t: r } = g(), { expandAll: n, collapseAll: i, expandedPages: l } = _(null);
|
|
102
|
+
return /* @__PURE__ */ s("div", { className: "flex gap-1", children: [
|
|
103
|
+
/* @__PURE__ */ s(w, { children: [
|
|
104
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(p, { variant: "outline", size: "icon", onClick: () => n(t), className: "rounded p-1 text-gray-500", children: /* @__PURE__ */ e(I, {}) }) }),
|
|
105
|
+
/* @__PURE__ */ e(N, { children: r("Expand All") })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ s(w, { children: [
|
|
108
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
|
|
109
|
+
p,
|
|
110
|
+
{
|
|
111
|
+
disabled: l.length === 0,
|
|
112
|
+
variant: "outline",
|
|
113
|
+
size: "icon",
|
|
114
|
+
onClick: () => i(),
|
|
115
|
+
className: "rounded p-1 text-gray-500",
|
|
116
|
+
children: /* @__PURE__ */ e(G, {})
|
|
117
|
+
}
|
|
118
|
+
) }),
|
|
119
|
+
/* @__PURE__ */ e(N, { children: r("Collapse All") })
|
|
120
|
+
] })
|
|
121
|
+
] });
|
|
122
|
+
}, le = ({ languages: t, selectedLanguage: r, setSelectedLanguage: n }) => {
|
|
123
|
+
const i = W();
|
|
124
|
+
return /* @__PURE__ */ e("div", { className: "scrollbar-hide flex gap-1 overflow-x-auto pb-1", children: t.map((l) => /* @__PURE__ */ s(
|
|
125
|
+
p,
|
|
126
|
+
{
|
|
127
|
+
variant: r === l ? "default" : "outline",
|
|
128
|
+
size: "sm",
|
|
129
|
+
className: `h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${r === l ? "bg-black text-white hover:bg-black" : "text-gray-500"}`,
|
|
130
|
+
onClick: () => n(l.toLowerCase()),
|
|
131
|
+
children: [
|
|
132
|
+
l === i && /* @__PURE__ */ e(P, { size: 4, className: `p-0.5 ${r === i ? "fill-white" : "fill-black"}` }),
|
|
133
|
+
q[l] || ""
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
l
|
|
137
|
+
)) });
|
|
138
|
+
}, V = () => {
|
|
139
|
+
const { t } = g(), r = L();
|
|
140
|
+
return /* @__PURE__ */ s(w, { children: [
|
|
141
|
+
/* @__PURE__ */ e(y, { asChild: !0, children: /* @__PURE__ */ e(
|
|
142
|
+
p,
|
|
143
|
+
{
|
|
144
|
+
size: "sm",
|
|
145
|
+
variant: "ghost",
|
|
146
|
+
onClick: () => r.invalidateQueries({ queryKey: [Q.GET_WEBSITE_PAGES] }),
|
|
147
|
+
className: "mt-1 h-6 w-6",
|
|
148
|
+
children: /* @__PURE__ */ e(U, {})
|
|
149
|
+
}
|
|
150
|
+
) }),
|
|
151
|
+
/* @__PURE__ */ e(N, { side: "bottom", children: t("Refresh pages list") })
|
|
152
|
+
] });
|
|
153
|
+
}, oe = ({
|
|
154
|
+
pages: t,
|
|
155
|
+
search: r,
|
|
156
|
+
setSearch: n,
|
|
157
|
+
languages: i,
|
|
158
|
+
onAddPage: l,
|
|
159
|
+
selectedLanguage: c,
|
|
160
|
+
setSelectedLanguage: f,
|
|
161
|
+
selectedPageType: d,
|
|
162
|
+
setSelectedPageType: m,
|
|
163
|
+
showUntranslatedPages: a,
|
|
164
|
+
setShowUntranslatedPages: h
|
|
165
|
+
}) => {
|
|
166
|
+
const { t: x } = g();
|
|
167
|
+
return /* @__PURE__ */ s("div", { className: "space-y-3 border-b border-b-gray-200 px-4 pb-1", children: [
|
|
168
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-x-2", children: [
|
|
169
|
+
/* @__PURE__ */ e(H, { selectedPageType: d, setSelectedPageType: m }),
|
|
170
|
+
/* @__PURE__ */ e(O, { search: r, setSearch: n }),
|
|
171
|
+
/* @__PURE__ */ e(T, { pages: t }),
|
|
172
|
+
/* @__PURE__ */ s(p, { variant: "default", onClick: l, className: "rounded px-3 font-normal", children: [
|
|
173
|
+
/* @__PURE__ */ e(z, { strokeWidth: 2, className: "stroke-white stroke-[3]" }),
|
|
174
|
+
/* @__PURE__ */ e("span", { className: "font-normal text-white", children: x("Add Page") })
|
|
175
|
+
] }),
|
|
176
|
+
/* @__PURE__ */ e(V, {})
|
|
177
|
+
] }),
|
|
178
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between gap-2" })
|
|
179
|
+
] });
|
|
180
|
+
};
|
|
181
|
+
export {
|
|
182
|
+
le as LanguageSelector,
|
|
183
|
+
oe as default
|
|
184
|
+
};
|
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-BYrRPW_c.cjs");exports.ChaiAiPanel=e.AiPanelContent;exports.ChaiJsonInput=e.SmartJsonInput;exports.ChaiWebsiteBuilder=e.ChaiWebsiteBuilder;exports.ImagePicker=e.ImagePicker;exports.LanguageSwitcher=e.LanguageSwitcher;exports.NestedPathSelector=e.NestedPathSelector;exports.SupabaseRealtimeAdapter=e.SupabaseRealtimeAdapter;exports.createRealtimeAdapter=e.createRealtimeAdapter;exports.useActivePage=e.useCurrentActivePage;exports.useApiUrl=e.useApiUrl;exports.useBuilderFetch=e.useBuilderFetch;exports.useBuilderPageData=e.useBuilderPageData;exports.useChaiAuth=e.useChaiAuth;exports.useChaiPrimaryPage=e.usePrimaryPage;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.usePageAllData=e.usePageAllData;exports.usePageTypes=e.usePageTypes;exports.useRealtimeAdapter=e.useRealtimeAdapter;exports.useReloadPage=e.useReloadPage;exports.useUpdateActivePageMetadata=e.useUpdateActivePageMetadata;exports.useUserPermissions=e.useCheckUserAccess;exports.useWebsitePages=e.useWebsitePrimaryPages;exports.useWebsiteSetting=e.useWebsiteSetting;
|
package/dist/pages.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
2
|
import { JSX } from 'react/jsx-runtime';
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
3
|
import { RealtimeClient } from '@supabase/supabase-js';
|
|
5
4
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
6
5
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
@@ -256,7 +255,6 @@ declare interface ChaiBuilderEditorProps {
|
|
|
256
255
|
* temporary props. Not to be used in production
|
|
257
256
|
*/
|
|
258
257
|
flags?: {
|
|
259
|
-
librarySite?: boolean;
|
|
260
258
|
copyPaste?: boolean;
|
|
261
259
|
exportCode?: boolean;
|
|
262
260
|
darkMode?: boolean;
|
|
@@ -266,11 +264,7 @@ declare interface ChaiBuilderEditorProps {
|
|
|
266
264
|
gotoSettings?: boolean;
|
|
267
265
|
dragAndDrop?: boolean;
|
|
268
266
|
validateStructure?: boolean;
|
|
269
|
-
designTokens?: boolean;
|
|
270
267
|
ai?: boolean;
|
|
271
|
-
revisions?: boolean;
|
|
272
|
-
sharedJsonLD?: boolean;
|
|
273
|
-
resetSeoToDefault?: boolean;
|
|
274
268
|
};
|
|
275
269
|
structureRules?: StructureRule[];
|
|
276
270
|
designTokens?: ChaiDesignTokens;
|
|
@@ -462,8 +456,6 @@ declare type ChaiWebsiteBuilderProps = {
|
|
|
462
456
|
onLogout?: (reason?: string) => void;
|
|
463
457
|
getAccessToken?: () => Promise<string>;
|
|
464
458
|
currentUser: LoggedInUser | null;
|
|
465
|
-
websocket?: any;
|
|
466
|
-
realtimeAdapter?: RealtimeAdapter;
|
|
467
459
|
} & Pick<ChaiBuilderEditorProps, "onError" | "translations" | "locale" | "htmlDir" | "autoSave" | "autoSaveActionsCount" | "fallbackLang" | "languages" | "themePresets" | "flags" | "structureRules">;
|
|
468
460
|
|
|
469
461
|
declare type ChaiWebsiteSetting = {
|
|
@@ -567,13 +559,6 @@ declare type NestedPathSelectorProps = {
|
|
|
567
559
|
disabled?: boolean;
|
|
568
560
|
};
|
|
569
561
|
|
|
570
|
-
export declare const PermissionChecker: ({ permission, permissions, children, fallback, }: {
|
|
571
|
-
permission?: string;
|
|
572
|
-
permissions?: string[];
|
|
573
|
-
fallback?: React.ReactNode;
|
|
574
|
-
children: React.ReactNode;
|
|
575
|
-
}) => ReactNode;
|
|
576
|
-
|
|
577
562
|
/**
|
|
578
563
|
* Presence state structure
|
|
579
564
|
*/
|
package/dist/pages.js
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aR as s, ax as t, aJ as u, aw as i, aQ as r, av as g, aX as l, aW as P, aK as h, ai as d, aV as o, ar as A, aT as c, aq as n, ao as p, aL as m, f as C, aj as b, aM as R, g as S, aN as U, h as L, aS as W, aO as f, aP as v, aU as B, b as F, e as I } from "./index-DqzFD1CG.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ChaiAiPanel,
|
|
4
4
|
t as ChaiJsonInput,
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
u as ChaiWebsiteBuilder,
|
|
6
|
+
i as ImagePicker,
|
|
7
7
|
r as LanguageSwitcher,
|
|
8
8
|
g as NestedPathSelector,
|
|
9
|
-
l as
|
|
10
|
-
P as
|
|
11
|
-
h as
|
|
12
|
-
|
|
13
|
-
o as
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
n as
|
|
17
|
-
A as useChaiPrimaryPage,
|
|
9
|
+
l as SupabaseRealtimeAdapter,
|
|
10
|
+
P as createRealtimeAdapter,
|
|
11
|
+
h as useActivePage,
|
|
12
|
+
d as useApiUrl,
|
|
13
|
+
o as useBuilderFetch,
|
|
14
|
+
A as useBuilderPageData,
|
|
15
|
+
c as useChaiAuth,
|
|
16
|
+
n as useChaiPrimaryPage,
|
|
18
17
|
p as useChaiUserInfo,
|
|
19
18
|
m as useClearAll,
|
|
20
19
|
C as useFallbackLang,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
b as useFetch,
|
|
21
|
+
R as useGotoPage,
|
|
22
|
+
S as useLanguagePages,
|
|
23
|
+
U as usePageAllData,
|
|
24
|
+
L as usePageTypes,
|
|
25
|
+
W as useRealtimeAdapter,
|
|
26
|
+
f as useReloadPage,
|
|
28
27
|
v as useUpdateActivePageMetadata,
|
|
29
28
|
B as useUserPermissions,
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
F as useWebsitePages,
|
|
30
|
+
I as useWebsiteSetting
|
|
32
31
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { find as I, filter as a, map as b, keys as K, get as U, includes as C, orderBy as N, isEmpty as Q, uniq as A, first as J, concat as V } from "lodash-es";
|
|
3
|
+
import { Lock as W, GlobeIcon as X, File as Y, Edit as Z } from "lucide-react";
|
|
4
|
+
import { useState as F, useCallback as ee, useMemo as p, useEffect as G, startTransition as B } from "react";
|
|
5
|
+
import { B as j } from "./register-chai-top-bar-DWmJ2efT.js";
|
|
6
|
+
import { e as te, f as se, g as le, o as ae, q as ne } from "./index-DPV6NiJ-.js";
|
|
7
|
+
import { ai as re, aj as oe, ag as D, am as O, an as ce, f as ie, h as de, ao as ue, T as q, ap as he } from "./index-DqzFD1CG.js";
|
|
8
|
+
import { LanguageSelector as me } from "./page-manager-search-and-filter-Cllju4CV.js";
|
|
9
|
+
import { useQuery as ge } from "@tanstack/react-query";
|
|
10
10
|
const pe = () => {
|
|
11
|
-
const s =
|
|
12
|
-
return
|
|
13
|
-
queryKey: [
|
|
14
|
-
queryFn: async () => d(s, { action:
|
|
11
|
+
const s = re(), d = oe();
|
|
12
|
+
return ge({
|
|
13
|
+
queryKey: [D.GET_CHANGES],
|
|
14
|
+
queryFn: async () => d(s, { action: D.GET_CHANGES })
|
|
15
15
|
});
|
|
16
16
|
}, fe = ({ page: s, selectedPages: d, handleCheckboxChange: k, getPageType: f, hasSlug: h, currentOwnerId: r }) => {
|
|
17
|
-
const u = O(), { data: i } =
|
|
17
|
+
const u = O(), { data: i } = ue(r), o = r === u ? null : i == null ? void 0 : i.name;
|
|
18
18
|
return /* @__PURE__ */ n("tr", { className: "group relative border-b last:border-b-0 hover:bg-gray-50", children: [
|
|
19
19
|
/* @__PURE__ */ n(
|
|
20
20
|
"td",
|
|
@@ -22,10 +22,10 @@ const pe = () => {
|
|
|
22
22
|
scope: "row",
|
|
23
23
|
className: `flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o ? "opacity-50" : ""}`,
|
|
24
24
|
children: [
|
|
25
|
-
o ? /* @__PURE__ */ t(
|
|
25
|
+
o ? /* @__PURE__ */ t(W, { className: "h-4 w-4 fill-red-200 text-red-500" }) : /* @__PURE__ */ t(
|
|
26
26
|
"input",
|
|
27
27
|
{
|
|
28
|
-
checked:
|
|
28
|
+
checked: C(d, s == null ? void 0 : s.id),
|
|
29
29
|
onClick: (x) => {
|
|
30
30
|
x.stopPropagation(), k(s == null ? void 0 : s.id);
|
|
31
31
|
},
|
|
@@ -34,16 +34,16 @@ const pe = () => {
|
|
|
34
34
|
}
|
|
35
35
|
),
|
|
36
36
|
" ",
|
|
37
|
-
h(s.pageType) ? /* @__PURE__ */ t(
|
|
38
|
-
/* @__PURE__ */ t(
|
|
39
|
-
s.slug && /* @__PURE__ */ t(
|
|
37
|
+
h(s.pageType) ? /* @__PURE__ */ t(Y, { className: "h-4 w-4" }) : /* @__PURE__ */ t(X, { className: "h-4 w-4" }),
|
|
38
|
+
/* @__PURE__ */ t(q, { content: s.name, side: "top", showTooltip: s.name.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-medium text-black", children: s.name }) }),
|
|
39
|
+
s.slug && /* @__PURE__ */ t(q, { content: s.slug, side: "top", showTooltip: s.slug.length > 25, children: /* @__PURE__ */ t("span", { className: "max-w-[200px] truncate font-mono text-xs text-muted-foreground", children: s.slug }) })
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
43
|
/* @__PURE__ */ t("td", { className: "px-2", children: f(s == null ? void 0 : s.pageType) }),
|
|
44
|
-
/* @__PURE__ */ t("td", { className: "px-4 text-right", children:
|
|
44
|
+
/* @__PURE__ */ t("td", { className: "px-4 text-right", children: J(s.changes) || "" }),
|
|
45
45
|
/* @__PURE__ */ t($, { children: o && /* @__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: [
|
|
46
|
-
/* @__PURE__ */ t(
|
|
46
|
+
/* @__PURE__ */ t(Z, { size: 12, className: "stroke-[3]" }),
|
|
47
47
|
" ",
|
|
48
48
|
/* @__PURE__ */ t("span", { className: "font-medium", children: o }),
|
|
49
49
|
" is editing this page"
|
|
@@ -55,65 +55,65 @@ const pe = () => {
|
|
|
55
55
|
isPending: d,
|
|
56
56
|
publishPage: k
|
|
57
57
|
}) => {
|
|
58
|
-
const f = O(), { pageToUser: h } =
|
|
58
|
+
const f = O(), { pageToUser: h } = ce(), [r, u] = F([]), i = ie(), [o, x] = F(i), { data: T, isFetching: v } = pe(), { data: g } = de(), w = ee((e) => {
|
|
59
59
|
var l;
|
|
60
|
-
return (l =
|
|
60
|
+
return (l = I(g, { key: e })) == null ? void 0 : l.hasSlug;
|
|
61
61
|
}, [g]), y = p(
|
|
62
62
|
() => a(g, (e) => !w(e.key)).map((e) => e.key),
|
|
63
63
|
[w, g]
|
|
64
|
-
), E =
|
|
64
|
+
), E = A(b(T, "lang")).filter(Boolean), c = p(
|
|
65
65
|
() => a(T, (e) => e.pageType === "theme" || e.pageType === "design_tokens" ? !1 : o === i ? e.lang === o || e.lang === "" : e.lang === o),
|
|
66
66
|
[T, o, i]
|
|
67
67
|
), S = p(
|
|
68
68
|
() => a(c, (e) => !y.includes(e.pageType)),
|
|
69
69
|
[c, y]
|
|
70
|
-
),
|
|
70
|
+
), P = p(
|
|
71
71
|
() => a(c, (e) => y.includes(e.pageType)),
|
|
72
72
|
[c, y]
|
|
73
73
|
);
|
|
74
|
-
|
|
74
|
+
G(() => {
|
|
75
75
|
const e = b(a(c, { online: !0 }), "id");
|
|
76
|
-
|
|
77
|
-
}, [c]),
|
|
78
|
-
const e = a(
|
|
79
|
-
|
|
76
|
+
B(() => u(e));
|
|
77
|
+
}, [c]), G(() => {
|
|
78
|
+
const e = a(K(h), (l) => U(h, [l, "userId"]) !== f);
|
|
79
|
+
B(() => u((l) => a(l, (m) => !C(e, m))));
|
|
80
80
|
}, [h, f]);
|
|
81
|
-
const
|
|
82
|
-
u((l) =>
|
|
81
|
+
const L = r.length === (c == null ? void 0 : c.length), _ = (e) => {
|
|
82
|
+
u((l) => C(l, e) ? a(l, (m) => m !== e) : V(l, e));
|
|
83
83
|
}, H = () => {
|
|
84
|
-
u(
|
|
84
|
+
u(L ? [] : b(c, "id"));
|
|
85
85
|
}, z = () => {
|
|
86
86
|
k(
|
|
87
|
-
{ ids:
|
|
87
|
+
{ ids: A(r) },
|
|
88
88
|
{
|
|
89
89
|
onSuccess: () => {
|
|
90
|
-
s(),
|
|
90
|
+
s(), he("CENTER_CENTER"), x(i);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
94
|
}, M = (e) => {
|
|
95
95
|
if (e === "theme") return "Theme";
|
|
96
|
-
const l =
|
|
96
|
+
const l = I(g, { key: e });
|
|
97
97
|
return l ? l == null ? void 0 : l.name : e;
|
|
98
98
|
}, R = p(() => {
|
|
99
99
|
const e = [
|
|
100
100
|
{ label: "Updated", top: "pt-2" },
|
|
101
101
|
...N(a(S, { online: !0 }), "pageType"),
|
|
102
|
-
...N(a(
|
|
102
|
+
...N(a(P, { online: !0 }), "pageType")
|
|
103
103
|
].filter((m) => m.pageType !== "theme" && m.pageType !== "design_tokens"), l = [
|
|
104
104
|
{ label: "Offline", top: "pt-6" },
|
|
105
105
|
...N(a(S, { online: !1 }), "pageType"),
|
|
106
|
-
...N(a(
|
|
106
|
+
...N(a(P, { online: !1 }), "pageType")
|
|
107
107
|
];
|
|
108
108
|
return [...e, ...l];
|
|
109
|
-
}, [S,
|
|
110
|
-
return /* @__PURE__ */ n(
|
|
111
|
-
/* @__PURE__ */ n(
|
|
112
|
-
/* @__PURE__ */ t(
|
|
113
|
-
/* @__PURE__ */ t(
|
|
109
|
+
}, [S, P]);
|
|
110
|
+
return /* @__PURE__ */ n(te, { className: "flex max-h-[80%] max-w-4xl flex-col", children: [
|
|
111
|
+
/* @__PURE__ */ n(se, { children: [
|
|
112
|
+
/* @__PURE__ */ t(le, { children: "Publish changes" }),
|
|
113
|
+
/* @__PURE__ */ t(ae, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
|
|
114
114
|
] }),
|
|
115
115
|
E.length > 0 && /* @__PURE__ */ t("div", { className: "my-[2px] mt-0", children: /* @__PURE__ */ t(
|
|
116
|
-
|
|
116
|
+
me,
|
|
117
117
|
{
|
|
118
118
|
languages: [i, ...E],
|
|
119
119
|
selectedLanguage: o,
|
|
@@ -131,7 +131,7 @@ const pe = () => {
|
|
|
131
131
|
/* @__PURE__ */ t(
|
|
132
132
|
"input",
|
|
133
133
|
{
|
|
134
|
-
checked:
|
|
134
|
+
checked: L,
|
|
135
135
|
onClick: (e) => {
|
|
136
136
|
e.stopPropagation(), H();
|
|
137
137
|
},
|
|
@@ -157,20 +157,20 @@ const pe = () => {
|
|
|
157
157
|
handleCheckboxChange: _,
|
|
158
158
|
getPageType: M,
|
|
159
159
|
hasSlug: w,
|
|
160
|
-
currentOwnerId:
|
|
160
|
+
currentOwnerId: U(h, [(e == null ? void 0 : e.primaryPage) || (e == null ? void 0 : e.id), "userId"])
|
|
161
161
|
}
|
|
162
162
|
)
|
|
163
163
|
) })
|
|
164
164
|
] }) }),
|
|
165
|
-
/* @__PURE__ */ n(
|
|
165
|
+
/* @__PURE__ */ n(ne, { className: "mt-10 flex items-center justify-center", children: [
|
|
166
166
|
r.length > 0 && /* @__PURE__ */ n("span", { className: "text-center text-sm text-muted-foreground", children: [
|
|
167
167
|
r.length,
|
|
168
168
|
" Page",
|
|
169
169
|
r.length !== 1 ? "s" : "",
|
|
170
170
|
" Selected"
|
|
171
171
|
] }),
|
|
172
|
-
/* @__PURE__ */ t(
|
|
173
|
-
/* @__PURE__ */ t(
|
|
172
|
+
/* @__PURE__ */ t(j, { disabled: d, variant: "outline", onClick: s, children: "Cancel" }),
|
|
173
|
+
/* @__PURE__ */ t(j, { disabled: d || v || Q(r), onClick: z, children: d ? "Publishing..." : "Publish Selected" })
|
|
174
174
|
] })
|
|
175
175
|
] });
|
|
176
176
|
};
|
|
@@ -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"),t=require("lodash-es"),b=require("lucide-react"),a=require("react"),q=require("./register-chai-top-bar-CCssW5dL.cjs"),f=require("./index-D-r_K4yA.cjs"),r=require("./index-BYrRPW_c.cjs"),U=require("./page-manager-search-and-filter-BbdgOU9V.cjs"),F=require("@tanstack/react-query"),M=()=>{const l=r.useApiUrl(),u=r.useFetch();return F.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>u(l,{action:r.ACTIONS.GET_CHANGES})})},G=({page:l,selectedPages:u,handleCheckboxChange:N,getPageType:y,hasSlug:h,currentOwnerId:c})=>{const x=r.useUserId(),{data:d}=r.useChaiUserInfo(c),o=c===x?null: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 ${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(u,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:u,publishPage:N})=>{const y=r.useUserId(),{pageToUser:h}=r.usePageToUser(),[c,x]=a.useState([]),d=r.useFallbackLang(),[o,p]=a.useState(d),{data:T,isFetching:C}=M(),{data:g}=r.usePageTypes(),k=a.useCallback(s=>{var n;return(n=t.find(g,{key:s}))==null?void 0:n.hasSlug},[g]),j=a.useMemo(()=>t.filter(g,s=>!k(s.key)).map(s=>s.key),[k,g]),P=t.uniq(t.map(T,"lang")).filter(Boolean),i=a.useMemo(()=>t.filter(T,s=>s.pageType==="theme"||s.pageType==="design_tokens"?!1:o===d?s.lang===o||s.lang==="":s.lang===o),[T,o,d]),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,m=>!t.includes(s,m))))},[h,y]);const v=c.length===(i==null?void 0:i.length),E=s=>{x(n=>t.includes(n,s)?t.filter(n,m=>m!==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(d)}})},A=s=>{if(s==="theme")return"Theme";const n=t.find(g,{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(m=>m.pageType!=="theme"&&m.pageType!=="design_tokens"),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:[d,...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:u,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(q.Button,{disabled:u||C||t.isEmpty(c),onClick:I,children:u?"Publishing...":"Publish Selected"})]})]})};exports.default=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const i=require("lodash-es"),n=require("react"),B=require("jotai"),P=require("jotai/utils"),a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const i=require("lodash-es"),n=require("react"),B=require("jotai"),P=require("jotai/utils"),a=require("react/jsx-runtime"),D=require("@radix-ui/react-icons"),q=require("react-i18next"),L=require("class-variance-authority"),H=require("clsx"),V=require("tailwind-merge"),U=require("@radix-ui/react-slot");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=$(n);function o(...e){return V.twMerge(H.clsx(e))}const y=u.forwardRef(({className:e,type:t,...r},s)=>a.jsx("input",{type:t,className:o("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...r}));y.displayName="Input";const M=L.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),p=u.forwardRef(({className:e,variant:t,size:r,asChild:s=!1,...l},b)=>{const g=s?U.Slot:"button";return a.jsx(g,{className:o(M({variant:t,size:r,className:e})),ref:b,...l})});p.displayName="Button";const d={},z=(e,t)=>{d[e]={id:e,component:t,type:"widget"}},G=(e,t)=>{d[e]={id:e,component:t,type:"field"}},W=(e,t)=>{d[e]={id:e,component:t,type:"template"}},J=e=>Object.values(d).filter(t=>t.type===e).reduce((t,r)=>(t[r.id]=r.component,t),{}),m={},K=(e,t)=>{i.has(m,e)&&console.warn(`Add block tab with id ${e} already registered`),i.set(m,e,{id:e,...t})},X=()=>n.useMemo(()=>i.values(m),[]),v={},_=(e,t)=>{if(v[e])throw new Error(`Flag ${e} already exists`);v[e]={key:e,value:!1,...t}},Y=e=>{Object.entries(e).forEach(([t,r])=>{if(v[t])throw new Error(`Flag ${t} already exists`);_(t,r)})},Q=()=>v,j=P.atomWithStorage("chai-feature-flags",[]),E=e=>{const[t]=B.useAtom(j);return t.includes(e)},Z=e=>{const[t,r]=B.useAtom(j);return()=>{t.includes(e)?r(t.filter(l=>l!==e)):r([...t,e])}},ee=({flagKey:e,children:t})=>E(e)?t:null;let S={};const te=(e,t)=>{S[e]={...t,id:e}},re=e=>S[e],ae=()=>i.values(S),se=L.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),T=u.forwardRef(({className:e,variant:t,...r},s)=>a.jsx("div",{ref:s,role:"alert",className:o(se({variant:t}),e),...r}));T.displayName="Alert";const ne=u.forwardRef(({className:e,...t},r)=>a.jsx("h5",{ref:r,className:o("mb-1 font-medium leading-none tracking-tight",e),...t}));ne.displayName="AlertTitle";const A=u.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:o("text-sm [&_p]:leading-relaxed",e),...t}));A.displayName="AlertDescription";const ie=({close:e,onSelect:t,mode:r="image"})=>{const[s,l]=n.useState(""),[b,g]=n.useState(!1),[k,C]=n.useState(!1),[w,f]=n.useState(null),O=async x=>{if(!x.trim()){C(!1),f("Please enter a URL");return}try{g(!0),f(null),C(!0),f(null)}catch{C(!1),f("Error validating URL")}finally{g(!1)}},{t:h}=q.useTranslation();return a.jsxs("div",{className:"flex w-96 flex-col gap-4 p-4",children:[a.jsx("h2",{className:"text-xl font-semibold",children:h(`${r.charAt(0).toUpperCase()+r.slice(1)} Manager`)}),w&&a.jsxs(T,{variant:"destructive",children:[a.jsx(D.ExclamationTriangleIcon,{className:"h-4 w-4"}),a.jsx(A,{children:w})]}),a.jsxs("div",{className:"flex flex-col gap-4",children:[a.jsx(y,{placeholder:h(`Enter ${r} URL`),value:s,onChange:x=>l(x.target.value),onKeyUp:()=>O(s)}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(p,{variant:"outline",onClick:e,children:h("Cancel")}),a.jsx(p,{onClick:()=>t({id:"dam-id",url:s,width:600,height:400,description:"This is image description"}),disabled:!k||b,children:h("Insert")})]})]})]})},I={component:ie},oe=e=>{I.component=e},le=()=>n.useMemo(()=>I.component,[]);let N=async e=>e;const ce=e=>{N=e},ue=async e=>await N(e);let F=null;const de=e=>{F=e},ge=()=>n.useMemo(()=>F,[]),fe=()=>{F=null},c={},he=(e,t)=>{i.has(c,e)&&console.warn(`Panel ${e} already registered. Overriding...`),i.set(c,e,{id:e,...t})},pe=e=>n.useMemo(()=>i.filter(i.values(c),t=>t.position===e),[e,c]),me=()=>a.jsx("div",{}),R={component:me},ve=e=>{R.component=e},be=()=>n.useMemo(()=>R.component,[]);exports.ADD_BLOCK_TABS=m;exports.Alert=T;exports.AlertDescription=A;exports.Button=p;exports.CHAI_BUILDER_PANELS=c;exports.IfChaiFeatureFlag=ee;exports.Input=y;exports.RJSF_EXTENSIONS=d;exports.buttonVariants=M;exports.cn=o;exports.getChaiLibrary=re;exports.getPreImportHTML=ue;exports.registerChaiAddBlockTab=K;exports.registerChaiBlockSettingField=G;exports.registerChaiBlockSettingTemplate=W;exports.registerChaiBlockSettingWidget=z;exports.registerChaiFeatureFlag=_;exports.registerChaiFeatureFlags=Y;exports.registerChaiLibrary=te;exports.registerChaiMediaManager=oe;exports.registerChaiPreImportHTMLHook=ce;exports.registerChaiSaveToLibrary=de;exports.registerChaiSidebarPanel=he;exports.registerChaiTopBar=ve;exports.resetSaveToLibrary=fe;exports.useChaiAddBlockTabs=X;exports.useChaiBlockSettingComponents=J;exports.useChaiFeatureFlag=E;exports.useChaiFeatureFlags=Q;exports.useChaiLibraries=ae;exports.useChaiSidebarPanels=pe;exports.useMediaManagerComponent=le;exports.useSaveToLibraryComponent=ge;exports.useToggleChaiFeatureFlag=Z;exports.useTopBarComponent=be;
|
|
@@ -4,14 +4,14 @@ import { useMemo as i, useState as u } from "react";
|
|
|
4
4
|
import { useAtom as R } from "jotai";
|
|
5
5
|
import { atomWithStorage as U } from "jotai/utils";
|
|
6
6
|
import { jsx as a, jsxs as g } from "react/jsx-runtime";
|
|
7
|
+
import { ExclamationTriangleIcon as j } from "@radix-ui/react-icons";
|
|
8
|
+
import { useTranslation as H } from "react-i18next";
|
|
7
9
|
import { cva as S } from "class-variance-authority";
|
|
8
|
-
import { clsx as
|
|
9
|
-
import { twMerge as
|
|
10
|
-
import { Slot as
|
|
11
|
-
import { ExclamationTriangleIcon as z } from "@radix-ui/react-icons";
|
|
12
|
-
import { useTranslation as G } from "react-i18next";
|
|
10
|
+
import { clsx as $ } from "clsx";
|
|
11
|
+
import { twMerge as z } from "tailwind-merge";
|
|
12
|
+
import { Slot as G } from "@radix-ui/react-slot";
|
|
13
13
|
function l(...e) {
|
|
14
|
-
return
|
|
14
|
+
return z($(e));
|
|
15
15
|
}
|
|
16
16
|
const _ = o.forwardRef(
|
|
17
17
|
({ className: e, type: t, ...r }, s) => /* @__PURE__ */ a(
|
|
@@ -54,7 +54,7 @@ const W = S(
|
|
|
54
54
|
}
|
|
55
55
|
), C = o.forwardRef(
|
|
56
56
|
({ className: e, variant: t, size: r, asChild: s = !1, ...n }, h) => /* @__PURE__ */ a(
|
|
57
|
-
s ?
|
|
57
|
+
s ? G : "button",
|
|
58
58
|
{
|
|
59
59
|
className: l(W({ variant: t, size: r, className: e })),
|
|
60
60
|
ref: h,
|
|
@@ -144,11 +144,11 @@ const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
|
|
|
144
144
|
} finally {
|
|
145
145
|
v(!1);
|
|
146
146
|
}
|
|
147
|
-
}, { t: d } =
|
|
147
|
+
}, { t: d } = H();
|
|
148
148
|
return /* @__PURE__ */ g("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
|
|
149
149
|
/* @__PURE__ */ a("h2", { className: "text-xl font-semibold", children: d(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
|
|
150
150
|
F && /* @__PURE__ */ g(L, { variant: "destructive", children: [
|
|
151
|
-
/* @__PURE__ */ a(
|
|
151
|
+
/* @__PURE__ */ a(j, { className: "h-4 w-4" }),
|
|
152
152
|
/* @__PURE__ */ a(I, { children: F })
|
|
153
153
|
] }),
|
|
154
154
|
/* @__PURE__ */ g("div", { className: "flex flex-col gap-4", children: [
|
|
@@ -203,8 +203,8 @@ export {
|
|
|
203
203
|
C as B,
|
|
204
204
|
m as C,
|
|
205
205
|
L as D,
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
I as E,
|
|
207
|
+
l as F,
|
|
208
208
|
W as G,
|
|
209
209
|
xe as I,
|
|
210
210
|
p as R,
|