@chaibuilder/sdk 4.0.0-beta.36 → 4.0.0-beta.37
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/{2SSKDMRQ-rk5vFzuv.js → 2SSKDMRQ-B9Y7DUaU.js} +2 -2
- package/dist/{2SSKDMRQ-C3eivR9y.cjs → 2SSKDMRQ-Dost66qm.cjs} +1 -1
- package/dist/{AP7HFJJL-BMK2jPSi.js → AP7HFJJL-Db0-YeT-.js} +1 -1
- package/dist/{AP7HFJJL-2qWLZyWT.cjs → AP7HFJJL-DxBuLcYj.cjs} +1 -1
- package/dist/{IconPicker-B-NfypT7.cjs → IconPicker-BCYCPK5M.cjs} +1 -1
- package/dist/{IconPicker-BzQ_r0nM.js → IconPicker-CQPu4qCk.js} +1 -1
- package/dist/{WDYDFRGG-Bfra_-3l.cjs → WDYDFRGG-BLnyHnIr.cjs} +1 -1
- package/dist/{WDYDFRGG-1zoPbvu7.js → WDYDFRGG-DjIZGWcU.js} +2 -2
- package/dist/{active-in-another-tab-DkOOxZwb.cjs → active-in-another-tab-D6BuBAvD.cjs} +1 -1
- package/dist/{active-in-another-tab-Zrq6x3L9.js → active-in-another-tab-DvKdkseG.js} +4 -4
- package/dist/{add-new-language-page-alqCh26P.js → add-new-language-page-Bt-EHTdP.js} +3 -3
- package/dist/{add-new-language-page-Dsze4PNK.cjs → add-new-language-page-DXaV4Znu.cjs} +1 -1
- package/dist/{add-new-page-DtQYPRYM.cjs → add-new-page-D1X6uewl.cjs} +1 -1
- package/dist/{add-new-page-HoFoI257.js → add-new-page-JSrqASzg.js} +2 -2
- package/dist/{ai-panel-content-DZmolAf1.js → ai-panel-content-BcU74IAG.js} +3 -3
- package/dist/{ai-panel-content-DcM2BBcL.cjs → ai-panel-content-Ci6Vp7Cf.cjs} +1 -1
- package/dist/{ai-panel-default-lang-BmVJcDnH.cjs → ai-panel-default-lang-CfuUmamx.cjs} +2 -2
- package/dist/{ai-panel-default-lang-Bv8Fms5X.js → ai-panel-default-lang-CxEaZ63K.js} +4 -4
- package/dist/{ai-panel-other-lang-CCGz4Tql.js → ai-panel-other-lang-B1uL_scz.js} +3 -3
- package/dist/{ai-panel-other-lang-BGyP45jz.cjs → ai-panel-other-lang-BA1TOdh_.cjs} +1 -1
- package/dist/{ai-prompt-input-CJLPetgL.cjs → ai-prompt-input-BuP52voq.cjs} +1 -1
- package/dist/{ai-prompt-input-DO-zCSY_.js → ai-prompt-input-CrRc0Z7y.js} +1 -1
- package/dist/{ai-translation-prompt-DWj1gmKg.cjs → ai-translation-prompt-D8N5bmVu.cjs} +1 -1
- package/dist/{ai-translation-prompt-DXhM0OnM.js → ai-translation-prompt-DFX27zHM.js} +1 -1
- package/dist/{apply-binding-C0xIYKCN.cjs → apply-binding-BuwI_Uf5.cjs} +9 -9
- package/dist/{apply-binding-Bu5W9YFY.js → apply-binding-RQRSIe56.js} +91 -89
- package/dist/{change-password-modal-BcJsR8sq.cjs → change-password-modal-3rWUghQW.cjs} +1 -1
- package/dist/{change-password-modal-D4wVoj8S.js → change-password-modal-kdADAvi2.js} +4 -4
- package/dist/{code-editor-B87D8cT6.js → code-editor-ClZiD7lg.js} +1 -1
- package/dist/{code-editor-BTs3K_My.cjs → code-editor-gqdLU-rU.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BHbRZL8A.cjs → continue-editing-in-this-client-CIheMKdX.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CoZnDfgk.js → continue-editing-in-this-client-Dl72_nLZ.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +14 -14
- package/dist/{css-import-modal-DgXSYibP.cjs → css-import-modal-B2NoLsdZ.cjs} +1 -1
- package/dist/{css-import-modal-DIgM4T8d.js → css-import-modal-nJooZxLU.js} +1 -1
- package/dist/delete-page-BtG5kYkI.cjs +1 -0
- package/dist/delete-page-DNz6-CLI.js +84 -0
- package/dist/{design-token-usage-DMSy2KGp.cjs → design-token-usage-BBLfxzzo.cjs} +1 -1
- package/dist/{design-token-usage-DSpw3Kqi.js → design-token-usage-nTgxy81G.js} +1 -1
- package/dist/{digital-asset-manager-B1KUqVJc.js → digital-asset-manager-BdNe83F3.js} +3 -3
- package/dist/{digital-asset-manager-DYMrQhJ7.cjs → digital-asset-manager-CASGSQ33.cjs} +1 -1
- package/dist/{duplicate-page-Cop50Nuj.cjs → duplicate-page-C7e9snhW.cjs} +1 -1
- package/dist/{duplicate-page-Bt36erFD.js → duplicate-page-DYxGlrmd.js} +12 -12
- package/dist/{dynamic-page-selector-DxJ80Cpv.cjs → dynamic-page-selector-Cot9d5fm.cjs} +1 -1
- package/dist/{dynamic-page-selector-jMUcjGtc.js → dynamic-page-selector-Seiq-wJc.js} +2 -2
- package/dist/{image-editor-CpUpmlCT.cjs → image-editor-Cfn290vp.cjs} +1 -1
- package/dist/{image-editor-CdNLsyhd.js → image-editor-JNxRYYiG.js} +1 -1
- package/dist/{index-DZheQdw-.js → index-7OSd9ssH.js} +4922 -4677
- package/dist/{index-K4yKMKbY.js → index-CHoZEbKv.js} +1881 -1744
- package/dist/index-P-2SvZA9.cjs +160 -0
- package/dist/index-d1_bmLx3.cjs +5 -0
- package/dist/{json-diff-viewer-CivVPp1k.js → json-diff-viewer-BzXIZ79o.js} +6 -6
- package/dist/{json-diff-viewer-BisiaC_I.cjs → json-diff-viewer-CMd26XKs.cjs} +1 -1
- package/dist/{lang-panel-DoPGR_AP.cjs → lang-panel-CxmuZt3k.cjs} +1 -1
- package/dist/{lang-panel-DejZsTqE.js → lang-panel-DPhpM-pr.js} +3 -3
- package/dist/{manage-design-tokens-Cdi3Ma4y.cjs → manage-design-tokens-B_-TrQgu.cjs} +1 -1
- package/dist/{manage-design-tokens-BxXReDdA.js → manage-design-tokens-QAUcjndy.js} +2 -2
- package/dist/{manage-design-tokens-modal-DyvSsIVv.js → manage-design-tokens-modal-BpkJx1YU.js} +2 -2
- package/dist/{manage-design-tokens-modal-Dr5lwyr_.cjs → manage-design-tokens-modal-Bug5H8PT.cjs} +1 -1
- package/dist/{mark-as-template-NPUbCfae.js → mark-as-template-BEz6ecRQ.js} +2 -2
- package/dist/{mark-as-template-OqwiT2Zm.cjs → mark-as-template-mD6fOtmk.cjs} +1 -1
- package/dist/{nested-path-selector-content-D6f2I80h.cjs → nested-path-selector-content-BHPOfftZ.cjs} +1 -1
- package/dist/{nested-path-selector-content-B4p9qltN.js → nested-path-selector-content-CoovvfzI.js} +1 -1
- package/dist/{no-language-page-content-DfdMEUqE.js → no-language-page-content-BAHxTRff.js} +2 -2
- package/dist/{no-language-page-content-BGlAr__k.cjs → no-language-page-content-DvBnZrhb.cjs} +1 -1
- package/dist/{no-language-page-dialog-d1oHBURV.cjs → no-language-page-dialog-AU6R_Umm.cjs} +1 -1
- package/dist/{no-language-page-dialog-3obqd_9-.js → no-language-page-dialog-Di0PXuKT.js} +2 -2
- package/dist/{page-creator-Il_h2vl4.cjs → page-creator-D5tEK7Vm.cjs} +1 -1
- package/dist/{page-creator-4ElxexYm.js → page-creator-VvmlAgTA.js} +3 -3
- package/dist/{page-lock-s-pfopxQ.cjs → page-lock-B6d47DbD.cjs} +1 -1
- package/dist/{page-lock-CT54xDQL.js → page-lock-COOgRF1e.js} +2 -2
- package/dist/{page-locked-dialog-BORNeoXe.cjs → page-locked-dialog-BKTQmsMr.cjs} +1 -1
- package/dist/{page-locked-dialog-CBL04Nga.js → page-locked-dialog-DSWy_zpi.js} +6 -6
- package/dist/{page-manager-new-DqCkZnWY.js → page-manager-new-ABq5ZgFr.js} +29 -29
- package/dist/{page-manager-new-Bp5QkZD4.cjs → page-manager-new-xSa6-2s3.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-CUEUB4bN.js → page-manager-search-and-filter-C6p6v1qj.js} +2 -2
- package/dist/{page-manager-search-and-filter-BMPaoTAI.cjs → page-manager-search-and-filter-DXgvy0ys.cjs} +1 -1
- package/dist/{page-revisions-content-1kklUJZV.cjs → page-revisions-content-BuNpklOO.cjs} +1 -1
- package/dist/{page-revisions-content-mU05KA_O.js → page-revisions-content-CAgq7kLY.js} +10 -10
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +15 -15
- package/dist/{publish-pages-content-CpdTUAds.cjs → publish-pages-content-CX1nQ8PA.cjs} +1 -1
- package/dist/{publish-pages-content-CcV-xLsk.js → publish-pages-content-Ct7VDbNE.js} +23 -23
- package/dist/render.cjs +1 -1
- package/dist/render.js +124 -123
- package/dist/{rte-widget-modal-BCFhKLqA.cjs → rte-widget-modal-CHxO3TQR.cjs} +1 -1
- package/dist/{rte-widget-modal-DcXHaT-t.js → rte-widget-modal-iLgUdcBu.js} +1 -1
- package/dist/{save-to-lib-Uw9LqY5V.cjs → save-to-lib-C67fQ8_8.cjs} +1 -1
- package/dist/{save-to-lib-CXhaKw5V.js → save-to-lib-CAzWtI64.js} +62 -62
- package/dist/sdk.css +1 -1
- package/dist/{selected-block-display-_r5ZoSSD.js → selected-block-display-B_6-n75b.js} +2 -2
- package/dist/{selected-block-display-DZz78Kuo.cjs → selected-block-display-DqC6ZtSA.cjs} +1 -1
- package/dist/{seo-panel-CMIMJh2W.js → seo-panel-DGnUvVO2.js} +25 -25
- package/dist/{seo-panel-Cj8ky_W6.cjs → seo-panel-DQmVSmiq.cjs} +1 -1
- package/dist/{shared-json-ld-C28DLkns.cjs → shared-json-ld-BpcG0rtf.cjs} +1 -1
- package/dist/{shared-json-ld-LWZfxt-V.js → shared-json-ld-CuMx_qAL.js} +11 -11
- package/dist/{slug-input-CQu9-5GT.cjs → slug-input-DHVDl_Dv.cjs} +1 -1
- package/dist/{slug-input-BCs8-IRf.js → slug-input-DcYoeQxL.js} +1 -1
- package/dist/{take-over-request-eNwLOB2Q.js → take-over-request-B2vspYrb.js} +5 -5
- package/dist/{take-over-request-x9nLTelf.cjs → take-over-request-BJaH6pnu.cjs} +1 -1
- package/dist/{translation-warning-modal-BfFfRg7q.cjs → translation-warning-modal-BxV_8mCE.cjs} +1 -1
- package/dist/{translation-warning-modal-KLjj1aXN.js → translation-warning-modal-DEW8JWRh.js} +1 -1
- package/dist/{unmark-as-template-GdqfA8lm.cjs → unmark-as-template-BYjs9XbH.cjs} +1 -1
- package/dist/{unmark-as-template-YGONVpmY.js → unmark-as-template-DEs6DnT4.js} +2 -2
- package/dist/{unpublish-page-D-A9A9db.js → unpublish-page-D-5iWXIB.js} +2 -2
- package/dist/{unpublish-page-CmwSkit5.cjs → unpublish-page-rlnt_4EX.cjs} +1 -1
- package/dist/{unpublished-partials-modal-Bx35iokR.cjs → unpublished-partials-modal-D50Hxk6N.cjs} +1 -1
- package/dist/{unpublished-partials-modal-UTkegPmZ.js → unpublished-partials-modal-Do2HSNYq.js} +1 -1
- package/dist/{web-preview-CZVcFxwF.js → web-preview-DRp7Zk7f.js} +1 -1
- package/dist/{web-preview-D4_3nlN-.cjs → web-preview-Daz-wyo3.cjs} +1 -1
- package/package.json +1 -1
- package/dist/delete-page-DKBN4nL1.cjs +0 -1
- package/dist/delete-page-T2VWcbyP.js +0 -71
- package/dist/index-DvOWqGdC.cjs +0 -5
- package/dist/index-W4Ur56bi.cjs +0 -160
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { B as b, z as L } from "./register-chai-top-bar-D6GjnauV.js";
|
|
3
|
-
import { aF as ne, c as M, W as
|
|
4
|
-
import {
|
|
3
|
+
import { aF as ne, c as M, W as ie, X as oe, P as le, aG as ce, ax as de, aH as ue, p as P } from "./index-7OSd9ssH.js";
|
|
4
|
+
import { ap as D, aq as G, A as _, aw as me } from "./index-CHoZEbKv.js";
|
|
5
5
|
import { useQuery as K, useMutation as A, useQueryClient as pe } from "@tanstack/react-query";
|
|
6
6
|
import { useSetAtom as fe } from "jotai";
|
|
7
7
|
import { toast as N } from "sonner";
|
|
8
8
|
import { Trash2 as Y, Plus as he, ImageIcon as ge, X as be, AlertCircle as ye } from "lucide-react";
|
|
9
|
-
import { useState as h, useRef as W, useMemo as S, useEffect as
|
|
9
|
+
import { useState as h, useRef as W, useMemo as S, useEffect as I, useCallback as ke } from "react";
|
|
10
10
|
import { c as ve } from "./image-compression-DPFITwOL.js";
|
|
11
11
|
import { isEmpty as Ne, set as Be, has as Ce } from "lodash-es";
|
|
12
|
-
const
|
|
13
|
-
const a = D(),
|
|
12
|
+
const we = (r) => {
|
|
13
|
+
const a = D(), o = G();
|
|
14
14
|
return A({
|
|
15
|
-
mutationFn: async (t) =>
|
|
15
|
+
mutationFn: async (t) => o(a, {
|
|
16
16
|
action: _.UPSERT_LIBRARY_ITEM,
|
|
17
17
|
data: t
|
|
18
18
|
}),
|
|
@@ -25,8 +25,8 @@ const Ie = (r) => {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
-
},
|
|
29
|
-
const a = D(),
|
|
28
|
+
}, Ie = (r) => {
|
|
29
|
+
const a = D(), o = G();
|
|
30
30
|
return K({
|
|
31
31
|
staleTime: "static",
|
|
32
32
|
queryKey: [_.GET_LIBRARY_ITEM, r],
|
|
@@ -35,7 +35,7 @@ const Ie = (r) => {
|
|
|
35
35
|
queryFn: async () => {
|
|
36
36
|
if (!r) return null;
|
|
37
37
|
try {
|
|
38
|
-
return await
|
|
38
|
+
return await o(a, {
|
|
39
39
|
action: _.GET_LIBRARY_ITEM,
|
|
40
40
|
data: { id: r }
|
|
41
41
|
});
|
|
@@ -46,9 +46,9 @@ const Ie = (r) => {
|
|
|
46
46
|
retry: !1
|
|
47
47
|
});
|
|
48
48
|
}, Ee = (r) => {
|
|
49
|
-
const a = D(),
|
|
49
|
+
const a = D(), o = G(), t = fe(ne);
|
|
50
50
|
return A({
|
|
51
|
-
mutationFn: async (l) =>
|
|
51
|
+
mutationFn: async (l) => o(a, {
|
|
52
52
|
action: _.DELETE_LIBRARY_ITEM,
|
|
53
53
|
data: { id: l }
|
|
54
54
|
}),
|
|
@@ -69,7 +69,7 @@ const Ie = (r) => {
|
|
|
69
69
|
}, xe = ({
|
|
70
70
|
blockId: r,
|
|
71
71
|
libBlockId: a,
|
|
72
|
-
isOpen:
|
|
72
|
+
isOpen: o,
|
|
73
73
|
onClose: t,
|
|
74
74
|
blockName: l,
|
|
75
75
|
trigger: m
|
|
@@ -77,8 +77,8 @@ const Ie = (r) => {
|
|
|
77
77
|
const [u, c] = h(!1), d = M(), y = Ee(() => {
|
|
78
78
|
d([r], { _libBlockId: void 0 }), N.success("Block deleted successfully"), c(!1), t();
|
|
79
79
|
});
|
|
80
|
-
return /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */ e(
|
|
80
|
+
return /* @__PURE__ */ i(ie, { open: o, onOpenChange: (p) => !p && t(), children: [
|
|
81
|
+
/* @__PURE__ */ e(oe, { asChild: !0, children: m || /* @__PURE__ */ i(b, { type: "button", variant: "destructive", size: "sm", onClick: (p) => p.preventDefault(), disabled: u, children: [
|
|
82
82
|
/* @__PURE__ */ e(Y, { className: "mr-2 h-4 w-4" }),
|
|
83
83
|
"Delete"
|
|
84
84
|
] }) }),
|
|
@@ -88,11 +88,11 @@ const Ie = (r) => {
|
|
|
88
88
|
className: "z-[9999] w-72 p-4",
|
|
89
89
|
sideOffset: 5,
|
|
90
90
|
align: "center",
|
|
91
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ i("div", { className: "space-y-3", children: [
|
|
92
92
|
/* @__PURE__ */ e("h4", { className: "font-medium", children: "Delete Block" }),
|
|
93
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ i("p", { className: "text-sm", children: [
|
|
94
94
|
"Are you sure you want to delete the block",
|
|
95
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ i("span", { className: "font-medium", children: [
|
|
96
96
|
' "',
|
|
97
97
|
l,
|
|
98
98
|
'"'
|
|
@@ -100,7 +100,7 @@ const Ie = (r) => {
|
|
|
100
100
|
"?"
|
|
101
101
|
] }),
|
|
102
102
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "This block will be permanently removed from the library. This action cannot be undone." }),
|
|
103
|
-
/* @__PURE__ */
|
|
103
|
+
/* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
104
104
|
/* @__PURE__ */ e(b, { type: "button", variant: "outline", size: "sm", onClick: t, disabled: u, children: "Cancel" }),
|
|
105
105
|
/* @__PURE__ */ e(b, { type: "button", variant: "destructive", size: "sm", onClick: () => {
|
|
106
106
|
c(!0), y.mutate(a);
|
|
@@ -113,7 +113,7 @@ const Ie = (r) => {
|
|
|
113
113
|
}, Pe = ({
|
|
114
114
|
blockId: r,
|
|
115
115
|
libBlockId: a,
|
|
116
|
-
blockName:
|
|
116
|
+
blockName: o,
|
|
117
117
|
size: t = "sm",
|
|
118
118
|
className: l = "",
|
|
119
119
|
close: m
|
|
@@ -128,8 +128,8 @@ const Ie = (r) => {
|
|
|
128
128
|
onClose: () => {
|
|
129
129
|
c(!1), m();
|
|
130
130
|
},
|
|
131
|
-
blockName:
|
|
132
|
-
trigger: /* @__PURE__ */
|
|
131
|
+
blockName: o,
|
|
132
|
+
trigger: /* @__PURE__ */ i(
|
|
133
133
|
b,
|
|
134
134
|
{
|
|
135
135
|
type: "button",
|
|
@@ -146,7 +146,7 @@ const Ie = (r) => {
|
|
|
146
146
|
}
|
|
147
147
|
);
|
|
148
148
|
}, Le = () => {
|
|
149
|
-
const r = D(), a = G(),
|
|
149
|
+
const r = D(), a = G(), o = pe(), {
|
|
150
150
|
data: t = [],
|
|
151
151
|
isLoading: l,
|
|
152
152
|
error: m
|
|
@@ -173,7 +173,7 @@ const Ie = (r) => {
|
|
|
173
173
|
});
|
|
174
174
|
},
|
|
175
175
|
onSuccess: () => {
|
|
176
|
-
|
|
176
|
+
o.invalidateQueries({
|
|
177
177
|
queryKey: ["library-groups"]
|
|
178
178
|
}), N.success("Group created successfully");
|
|
179
179
|
},
|
|
@@ -191,7 +191,7 @@ const Ie = (r) => {
|
|
|
191
191
|
isCreating: c
|
|
192
192
|
};
|
|
193
193
|
}, _e = ({ value: r, onChange: a }) => {
|
|
194
|
-
const [
|
|
194
|
+
const [o, t] = h(!1), [l, m] = h(""), u = W(null), { groups: c } = Le(), [d, y] = h([
|
|
195
195
|
{ id: "hero", name: "Hero" },
|
|
196
196
|
{ id: "feature", name: "Feature" },
|
|
197
197
|
{ id: "footer", name: "Footer" },
|
|
@@ -231,15 +231,15 @@ const Ie = (r) => {
|
|
|
231
231
|
const B = { id: s, name: s };
|
|
232
232
|
y((E) => [...E, B]), a(B.id), m(""), t(!1);
|
|
233
233
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}, [
|
|
234
|
+
I(() => {
|
|
235
|
+
o && u.current && u.current.focus();
|
|
236
|
+
}, [o]);
|
|
237
237
|
const p = (s) => {
|
|
238
238
|
s.key === "Enter" && (s.preventDefault(), g());
|
|
239
239
|
};
|
|
240
|
-
return
|
|
240
|
+
return I(() => {
|
|
241
241
|
r && !f.some((s) => s.id === r) && a("");
|
|
242
|
-
}, [r, f, a]),
|
|
242
|
+
}, [r, f, a]), o ? /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
243
243
|
/* @__PURE__ */ e(
|
|
244
244
|
L,
|
|
245
245
|
{
|
|
@@ -250,12 +250,12 @@ const Ie = (r) => {
|
|
|
250
250
|
onKeyDown: p
|
|
251
251
|
}
|
|
252
252
|
),
|
|
253
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ i("div", { className: "flex justify-end gap-2", children: [
|
|
254
254
|
/* @__PURE__ */ e(b, { variant: "outline", size: "sm", onClick: () => t(!1), children: "Cancel" }),
|
|
255
255
|
/* @__PURE__ */ e(b, { size: "sm", onClick: g, children: "Create" })
|
|
256
256
|
] })
|
|
257
|
-
] }) : /* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
257
|
+
] }) : /* @__PURE__ */ i("div", { className: "flex gap-2", children: [
|
|
258
|
+
/* @__PURE__ */ i(
|
|
259
259
|
"select",
|
|
260
260
|
{
|
|
261
261
|
className: "w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
@@ -271,7 +271,7 @@ const Ie = (r) => {
|
|
|
271
271
|
/* @__PURE__ */ e(b, { type: "button", size: "icon", variant: "outline", onClick: () => t(!0), children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) })
|
|
272
272
|
] });
|
|
273
273
|
}, De = ({ value: r, onChange: a }) => {
|
|
274
|
-
const [
|
|
274
|
+
const [o, t] = h(!1), l = W(null), m = ke(
|
|
275
275
|
async (d) => {
|
|
276
276
|
var f;
|
|
277
277
|
const y = (f = d.target.files) == null ? void 0 : f[0];
|
|
@@ -292,16 +292,16 @@ const Ie = (r) => {
|
|
|
292
292
|
},
|
|
293
293
|
[a]
|
|
294
294
|
);
|
|
295
|
-
return /* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
296
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
297
297
|
/* @__PURE__ */ e(L, { type: "file", ref: l, onChange: m, accept: "image/*", className: "hidden" }),
|
|
298
298
|
/* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: () => {
|
|
299
299
|
var d;
|
|
300
300
|
(d = l.current) == null || d.click();
|
|
301
|
-
}, disabled:
|
|
301
|
+
}, disabled: o, className: "w-full", children: o ? /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
|
|
302
302
|
/* @__PURE__ */ e("div", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
303
303
|
"Uploading..."
|
|
304
|
-
] }) : /* @__PURE__ */
|
|
304
|
+
] }) : /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
|
|
305
305
|
/* @__PURE__ */ e(ge, { className: "h-4 w-4" }),
|
|
306
306
|
"Select image"
|
|
307
307
|
] }) }),
|
|
@@ -312,7 +312,7 @@ const Ie = (r) => {
|
|
|
312
312
|
r && /* @__PURE__ */ e("div", { className: "aspect-video h-[200px] max-h-[200px] overflow-hidden rounded-md border", children: /* @__PURE__ */ e("img", { src: r, alt: "Preview", className: "h-full w-full object-contain" }) })
|
|
313
313
|
] });
|
|
314
314
|
}, Me = (r) => {
|
|
315
|
-
const { blocks: a, close:
|
|
315
|
+
const { blocks: a, close: o, blockId: t } = r, { getPartialBlocks: l } = ce(), m = a.find((n) => n._id === t), u = m == null ? void 0 : m._libBlockId, c = !!u, d = S(() => a.some((n) => n._type === "PartialBlock" || n._type === "GlobalBlock"), [a]), y = S(() => {
|
|
316
316
|
let n = [];
|
|
317
317
|
for (const k of a)
|
|
318
318
|
if (k._type === "PartialBlock" || k._type === "GlobalBlock") {
|
|
@@ -322,25 +322,25 @@ const Ie = (r) => {
|
|
|
322
322
|
n.push(k);
|
|
323
323
|
return n;
|
|
324
324
|
}, [a, l]), [f, g] = h(""), [p, s] = h(""), [B, E] = h(""), [x, U] = h(""), [C, V] = h({}), [Q, $] = h(!1), [H, q] = h(c), [X, J] = h(!1), { hasPermission: Z } = de(), ee = Z(me.DELETE_LIBRARY_BLOCK), O = M(), te = () => {
|
|
325
|
-
O([t], { _libBlockId: void 0 }), N.success("Block delinked from library"),
|
|
325
|
+
O([t], { _libBlockId: void 0 }), N.success("Block delinked from library"), o();
|
|
326
326
|
}, {
|
|
327
|
-
data:
|
|
327
|
+
data: w,
|
|
328
328
|
isLoading: F,
|
|
329
329
|
isError: j
|
|
330
|
-
} =
|
|
331
|
-
|
|
330
|
+
} = Ie(u);
|
|
331
|
+
I(() => {
|
|
332
332
|
j && c && (J(!0), q(!1));
|
|
333
|
-
}, [j, c]),
|
|
334
|
-
|
|
335
|
-
}, [
|
|
333
|
+
}, [j, c]), I(() => {
|
|
334
|
+
w && !F && (g(w.name || ""), s(w.group || ""), E(w.description || ""), U(w.preview || ""), q(!1));
|
|
335
|
+
}, [w, F]), I(() => {
|
|
336
336
|
const n = f.trim().length >= 2, k = p.trim() !== "";
|
|
337
337
|
$(n && k);
|
|
338
338
|
}, [f, p]);
|
|
339
339
|
const re = () => {
|
|
340
340
|
const n = {};
|
|
341
341
|
return f.trim() ? f.length < 2 && (n.name = "Name must be at least 2 characters") : n.name = "Name is required", p || (n.group = "Group is required"), V(n), Object.keys(n).length === 0;
|
|
342
|
-
}, { resetLibrary: ae } = ue({ id: "" }), z =
|
|
343
|
-
c || O([t], { _libBlockId: n.id }), N.success(`Block ${c ? "updated" : "saved"} successfully`), ae(n.library),
|
|
342
|
+
}, { resetLibrary: ae } = ue({ id: "" }), z = we((n) => {
|
|
343
|
+
c || O([t], { _libBlockId: n.id }), N.success(`Block ${c ? "updated" : "saved"} successfully`), ae(n.library), o();
|
|
344
344
|
}), se = async (n) => {
|
|
345
345
|
if (n.preventDefault(), !re()) return;
|
|
346
346
|
const k = y.map((v) => (Ce(v, "_libBlockId") && delete v._libBlockId, v));
|
|
@@ -355,23 +355,23 @@ const Ie = (r) => {
|
|
|
355
355
|
...c ? { id: u } : {}
|
|
356
356
|
});
|
|
357
357
|
}, T = z.isPending;
|
|
358
|
-
return H || F ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : X ? /* @__PURE__ */
|
|
358
|
+
return H || F ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-8", children: /* @__PURE__ */ e("div", { className: "h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent" }) }) : X ? /* @__PURE__ */ i("div", { className: "space-y-4 p-6", children: [
|
|
359
359
|
/* @__PURE__ */ e("div", { className: "font-medium text-destructive", children: "Block Not Found" }),
|
|
360
360
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "This block could not be found on the server. It may have been deleted." }),
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick:
|
|
361
|
+
/* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-4", children: [
|
|
362
|
+
/* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, children: "Cancel" }),
|
|
363
363
|
/* @__PURE__ */ e(b, { onClick: te, variant: "destructive", children: "Delink Block" })
|
|
364
364
|
] })
|
|
365
|
-
] }) : /* @__PURE__ */
|
|
366
|
-
d && /* @__PURE__ */
|
|
365
|
+
] }) : /* @__PURE__ */ i("div", { children: [
|
|
366
|
+
d && /* @__PURE__ */ i("div", { className: "mb-4 flex items-start gap-2 rounded-md border border-destructive/50 bg-destructive/10 p-3 text-destructive", children: [
|
|
367
367
|
/* @__PURE__ */ e(ye, { className: "mt-0.5 h-5 w-5 flex-shrink-0" }),
|
|
368
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ i("div", { children: [
|
|
369
369
|
/* @__PURE__ */ e("p", { className: "font-medium", children: "Partial Blocks Detected" }),
|
|
370
370
|
/* @__PURE__ */ e("p", { className: "mt-1 text-xs", children: "This block contains one or more Partial Blocks. Partial blocks will be merged into the library block" })
|
|
371
371
|
] })
|
|
372
372
|
] }),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
/* @__PURE__ */
|
|
373
|
+
/* @__PURE__ */ i("form", { onSubmit: se, className: "space-y-4", children: [
|
|
374
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
375
375
|
/* @__PURE__ */ e(P, { htmlFor: "name", className: C.name ? "text-destructive" : "", children: "Name" }),
|
|
376
376
|
/* @__PURE__ */ e(
|
|
377
377
|
L,
|
|
@@ -385,12 +385,12 @@ const Ie = (r) => {
|
|
|
385
385
|
),
|
|
386
386
|
C.name && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: C.name })
|
|
387
387
|
] }),
|
|
388
|
-
/* @__PURE__ */
|
|
388
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
389
389
|
/* @__PURE__ */ e(P, { htmlFor: "group", className: C.group ? "text-destructive" : "", children: "Group" }),
|
|
390
390
|
/* @__PURE__ */ e(_e, { value: p, onChange: s }),
|
|
391
391
|
C.group && /* @__PURE__ */ e("p", { className: "text-xs text-destructive", children: C.group })
|
|
392
392
|
] }),
|
|
393
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
394
394
|
/* @__PURE__ */ e(P, { htmlFor: "description", children: "Description (optional)" }),
|
|
395
395
|
/* @__PURE__ */ e(
|
|
396
396
|
L,
|
|
@@ -403,11 +403,11 @@ const Ie = (r) => {
|
|
|
403
403
|
}
|
|
404
404
|
)
|
|
405
405
|
] }),
|
|
406
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ i("div", { className: "space-y-2", children: [
|
|
407
407
|
/* @__PURE__ */ e(P, { htmlFor: "previewImage", children: "Preview Image (optional)" }),
|
|
408
408
|
/* @__PURE__ */ e(De, { value: x, onChange: U })
|
|
409
409
|
] }),
|
|
410
|
-
/* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ i("div", { className: "flex justify-end gap-2 pt-2", children: [
|
|
411
411
|
c && ee && /* @__PURE__ */ e(
|
|
412
412
|
Pe,
|
|
413
413
|
{
|
|
@@ -415,10 +415,10 @@ const Ie = (r) => {
|
|
|
415
415
|
libBlockId: u,
|
|
416
416
|
blockName: f,
|
|
417
417
|
className: "mr-auto",
|
|
418
|
-
close:
|
|
418
|
+
close: o
|
|
419
419
|
}
|
|
420
420
|
),
|
|
421
|
-
/* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick:
|
|
421
|
+
/* @__PURE__ */ e(b, { type: "button", variant: "outline", onClick: o, disabled: T, children: "Cancel" }),
|
|
422
422
|
/* @__PURE__ */ e(b, { type: "submit", disabled: T || !Q, children: T ? "Saving..." : c ? "Update Block" : "Save Block" })
|
|
423
423
|
] })
|
|
424
424
|
] })
|