@chaibuilder/sdk 4.0.0-beta.7 → 4.0.0-beta.9
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 +5 -8
- package/dist/{2SSKDMRQ-hL7THuKW.js → 2SSKDMRQ-CdFBQR2o.js} +2 -2
- package/dist/{2SSKDMRQ-DDOgISWg.cjs → 2SSKDMRQ-CuQ42ST6.cjs} +1 -1
- package/dist/{AP7HFJJL-tcAhVllC.cjs → AP7HFJJL-DcnEb4BE.cjs} +1 -1
- package/dist/{AP7HFJJL-BsLQ13V_.js → AP7HFJJL-bDlWX5Yx.js} +1 -1
- package/dist/{IconPicker-FLSVAZxx.js → IconPicker-CNwplOGy.js} +2 -2
- package/dist/{IconPicker-J1KLNrSB.cjs → IconPicker-FpyYsxOf.cjs} +1 -1
- package/dist/STRINGS-BExFecZW.js +8 -0
- package/dist/STRINGS-FNnfjF5H.cjs +1 -0
- package/dist/{WDYDFRGG-BTj8AXV6.cjs → WDYDFRGG-BxLmjulP.cjs} +1 -1
- package/dist/{WDYDFRGG-Yi0eNS2V.js → WDYDFRGG-CWq7H6Qk.js} +2 -2
- package/dist/{actions-registery-CtQSSexG.cjs → actions-registery-BRgseJas.cjs} +16 -16
- package/dist/{actions-registery-DqrFhSMp.js → actions-registery-DRV8xywr.js} +180 -181
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.ts +112 -51
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-Dozn833d.js → active-in-another-tab-C392ZWQc.js} +3 -3
- package/dist/{active-in-another-tab-BtAiatqq.cjs → active-in-another-tab-DEWOFgY5.cjs} +1 -1
- package/dist/{add-new-language-page-DD-CAoAQ.js → add-new-language-page-BL2F_Cu7.js} +4 -4
- package/dist/{add-new-language-page-9AMizlES.cjs → add-new-language-page-DBWd0wDY.cjs} +1 -1
- package/dist/{add-new-page-BS9vPnFG.cjs → add-new-page-DYrQeKCi.cjs} +1 -1
- package/dist/{add-new-page-uZKCk9eB.js → add-new-page-QVlyJhn9.js} +2 -2
- package/dist/{ai-panel-content-CK4XOkEh.js → ai-panel-content-CCOluPtK.js} +4 -4
- package/dist/{ai-panel-content-PovaKJaj.cjs → ai-panel-content-DCZRBa6s.cjs} +1 -1
- package/dist/{ai-panel-default-lang-B37k5ADH.cjs → ai-panel-default-lang-C3t0elrO.cjs} +2 -2
- package/dist/{ai-panel-default-lang-BtLjUl9d.js → ai-panel-default-lang-Crz7QAxl.js} +4 -4
- package/dist/{ai-panel-other-lang-CdQmASqv.cjs → ai-panel-other-lang-BRkr4Te3.cjs} +1 -1
- package/dist/{ai-panel-other-lang-Dp1MNaLi.js → ai-panel-other-lang-DIF8PYLh.js} +4 -4
- package/dist/{ai-prompt-input-BT-mEdTX.js → ai-prompt-input-D4dqy8L2.js} +2 -2
- package/dist/{ai-prompt-input-Dtym4w8J.cjs → ai-prompt-input-Ybgvrvd6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B-lH7emI.cjs → ai-translation-prompt-Ck12Bfl6.cjs} +1 -1
- package/dist/{ai-translation-prompt-B17GK1QR.js → ai-translation-prompt-eZ4Sllva.js} +2 -2
- package/dist/{apply-binding-BvWfJCSZ.js → apply-binding-CLU6Xp4K.js} +77 -81
- package/dist/apply-binding-NvZX_rJe.cjs +1 -0
- package/dist/{code-display-DloSPyPr.cjs → code-display-9Onx6RCq.cjs} +1 -1
- package/dist/{code-display-Ck81Id9K.js → code-display-oa1j0ri7.js} +1 -1
- package/dist/{code-editor-EZT2pMsU.js → code-editor-D45h29W1.js} +1 -1
- package/dist/{code-editor-CUeNiMzA.cjs → code-editor-DH8eU4WL.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-CS7C6h9Q.js → continue-editing-in-this-client-BRrIvSrl.js} +3 -3
- package/dist/{continue-editing-in-this-client-DMZOc36k.cjs → continue-editing-in-this-client-DgZ9Q18G.cjs} +1 -1
- package/dist/core-8lkXy4lC.cjs +1 -0
- package/dist/core-BvsZwF26.js +52 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +143 -172
- package/dist/core.js +22 -34
- package/dist/{css-import-modal-s7t5gZQo.js → css-import-modal-BhLPzQH8.js} +5 -4
- package/dist/css-import-modal-C2-oVwFv.cjs +13 -0
- package/dist/{delete-design-token-C1smbx4E.js → delete-design-token-D4Q5-Xql.js} +1 -1
- package/dist/{delete-design-token-Mbw_6sYI.cjs → delete-design-token-DJSQluQ6.cjs} +1 -1
- package/dist/{delete-page-B7J3t0FN.cjs → delete-page-BxbsKhY5.cjs} +1 -1
- package/dist/{delete-page-2GfBi8Iv.js → delete-page-xHdZT-7c.js} +3 -3
- package/dist/{design-token-usage-DyO3xM-F.js → design-token-usage-7wgmVSWI.js} +2 -2
- package/dist/{design-token-usage-BoGOULG8.cjs → design-token-usage-KZ4pilLm.cjs} +1 -1
- package/dist/{digital-asset-manager-Cz3Nlrzl.js → digital-asset-manager-BmbVU7fX.js} +4 -4
- package/dist/{digital-asset-manager-DDk2ucTE.cjs → digital-asset-manager-a1fqrQVH.cjs} +1 -1
- package/dist/{duplicate-page-BwAY4Ssm.js → duplicate-page-5uIno9Yh.js} +4 -4
- package/dist/{duplicate-page-Dw3U4wTT.cjs → duplicate-page-BBTxn_o1.cjs} +1 -1
- package/dist/{dynamic-page-selector-CvBFyX2F.cjs → dynamic-page-selector-C1ef0i2I.cjs} +1 -1
- package/dist/{dynamic-page-selector-sViJuQlU.js → dynamic-page-selector-rhvhg7ol.js} +3 -3
- package/dist/{image-editor-BgGQuESa.js → image-editor-BXYZDa0s.js} +1 -1
- package/dist/{image-editor-AIsccrqC.cjs → image-editor-rqUgAO8V.cjs} +1 -1
- package/dist/{index-B7eWP_hB.js → index-Be9lAaD7.js} +421 -425
- package/dist/index-BhqugjzS.cjs +160 -0
- package/dist/index-CNEEEgTV.cjs +5 -0
- package/dist/{index-RYr8kQdI.js → index-mjuSGlPU.js} +5136 -5613
- package/dist/{json-diff-viewer-B2A78udz.cjs → json-diff-viewer-C9qmLiaq.cjs} +1 -1
- package/dist/{json-diff-viewer-Svw-kbhe.js → json-diff-viewer-aVwY7_hZ.js} +3 -3
- package/dist/{lang-panel-Bnc-9wkM.js → lang-panel-BTWk23Mw.js} +4 -4
- package/dist/{lang-panel-AmEkoWid.cjs → lang-panel-Bo1ZWYfu.cjs} +1 -1
- package/dist/{manage-design-tokens-BBkh1t4w.js → manage-design-tokens-id8bylgO.js} +4 -4
- package/dist/manage-design-tokens-lUMCgjdS.cjs +1 -0
- package/dist/{mark-as-template-CE6tRoQy.cjs → mark-as-template-BYXBDXMv.cjs} +1 -1
- package/dist/{mark-as-template-0CPzZnk-.js → mark-as-template-hv3WD852.js} +3 -3
- package/dist/{nested-path-selector-content-kGznHufl.js → nested-path-selector-content-B8z90MFF.js} +2 -2
- package/dist/{nested-path-selector-content-SmfjElr-.cjs → nested-path-selector-content-DgFFXcTD.cjs} +1 -1
- package/dist/{no-language-page-content-B4bQLc4K.cjs → no-language-page-content-6Kk8UjFX.cjs} +1 -1
- package/dist/{no-language-page-content-DXsAPDZd.js → no-language-page-content-DMACzysm.js} +3 -3
- package/dist/{no-language-page-dialog-BpPqmw9a.js → no-language-page-dialog-D4n_XYUq.js} +2 -2
- package/dist/{no-language-page-dialog-BC8NHzK2.cjs → no-language-page-dialog-mBH-fthh.cjs} +1 -1
- package/dist/{page-creator-82qTbBj4.cjs → page-creator-CGglYnYg.cjs} +1 -1
- package/dist/{page-creator-Bazn6yH4.js → page-creator-CgsOF0Eg.js} +4 -4
- package/dist/{page-lock-CRFyqKZE.js → page-lock-CUCEBnJb.js} +2 -2
- package/dist/{page-lock-D2iFZDUK.cjs → page-lock-Hsi61Mk5.cjs} +1 -1
- package/dist/{page-locked-dialog-xLqvKzax.cjs → page-locked-dialog-DSxbAMpt.cjs} +1 -1
- package/dist/{page-locked-dialog-GKfQEOmk.js → page-locked-dialog-bHvbFllT.js} +3 -3
- package/dist/{page-manager-new-Bn2QKjbf.cjs → page-manager-new-CBfFl5rL.cjs} +1 -1
- package/dist/{page-manager-new-DItY2hjd.js → page-manager-new-Cifc526h.js} +8 -8
- package/dist/{page-manager-search-and-filter-CPa8IXdd.js → page-manager-search-and-filter-CLJss6pV.js} +3 -3
- package/dist/{page-manager-search-and-filter-Dc4ky-qV.cjs → page-manager-search-and-filter-mEKl-UKh.cjs} +1 -1
- package/dist/page-revisions-content-C95dQJyx.cjs +1 -0
- package/dist/{page-revisions-content-CH-PZK0O.js → page-revisions-content-DvL4ya9g.js} +75 -67
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +146 -92
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-BzJDObqr.cjs → publish-pages-content-B-6vSkql.cjs} +1 -1
- package/dist/{publish-pages-content-CSJCFElu.js → publish-pages-content-B8-IZW_U.js} +4 -4
- package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-CX_JkRJn.js} +78 -78
- package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
- package/dist/render.cjs +1 -1
- package/dist/render.d.ts +14 -15
- package/dist/render.js +3 -3
- package/dist/{rte-widget-modal-5T81P_hg.js → rte-widget-modal-1SbY5bcQ.js} +7 -7
- package/dist/{rte-widget-modal-BfXcA7OP.cjs → rte-widget-modal-CyKwtbOG.cjs} +1 -1
- package/dist/runtime-client.cjs +1 -0
- package/dist/runtime-client.d.ts +158 -0
- package/dist/runtime-client.js +32 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.d.ts +92 -240
- package/dist/runtime.js +72 -72
- package/dist/{save-to-lib-MtWKSVeN.js → save-to-lib-BKcBfjfi.js} +3 -3
- package/dist/{save-to-lib-DGAdSa-0.cjs → save-to-lib-BmPh_Vns.cjs} +1 -1
- package/dist/{selected-block-display-CB1-hVR5.js → selected-block-display-B3hHlcLA.js} +3 -3
- package/dist/{selected-block-display-DLt_nMn9.cjs → selected-block-display-BCvTNcp2.cjs} +1 -1
- package/dist/{seo-panel-CRzzw4FW.js → seo-panel-D3EyOYij.js} +3 -3
- package/dist/{seo-panel-_kGXE9MC.cjs → seo-panel-DVClgzX9.cjs} +1 -1
- package/dist/{shared-json-ld-DoRgzDPC.cjs → shared-json-ld-BRgJTv0m.cjs} +1 -1
- package/dist/{shared-json-ld-CXukkDeS.js → shared-json-ld-DSPadwbY.js} +3 -3
- package/dist/{slug-input-Dp187Tiy.cjs → slug-input-B39SPBdP.cjs} +1 -1
- package/dist/{slug-input-CeEQ0zyv.js → slug-input-C3UrwSkt.js} +2 -2
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-C9J3_rev.js → take-over-request-DfAlPvpE.js} +3 -3
- package/dist/{take-over-request-CXuakFBm.cjs → take-over-request-Tq9-gOCV.cjs} +1 -1
- package/dist/{theme-panel-footer-DvwsyHNQ.js → theme-panel-footer-DIy4baYU.js} +3 -3
- package/dist/{theme-panel-footer-CWZ0qs13.cjs → theme-panel-footer-DQzjVBBP.cjs} +1 -1
- package/dist/{translation-warning-modal-_aBp5ZZQ.js → translation-warning-modal-BHwLZZOw.js} +2 -2
- package/dist/{translation-warning-modal-DEt_ExQp.cjs → translation-warning-modal-Ckwt5Skc.cjs} +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.d.ts +598 -0
- package/dist/types.js +1 -0
- package/dist/{unmark-as-template-BYL5naYx.cjs → unmark-as-template-BKA-sNZr.cjs} +1 -1
- package/dist/{unmark-as-template-JN-cDUV_.js → unmark-as-template-CbgifSbI.js} +3 -3
- package/dist/{unpublish-page-B06iZEIO.cjs → unpublish-page-BqzvOD76.cjs} +1 -1
- package/dist/{unpublish-page-DqwBY2yI.js → unpublish-page-DXQpAkvc.js} +3 -3
- package/dist/utils.d.ts +5 -5
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +214 -214
- package/dist/{web-preview-h39D3TUh.js → web-preview-DH7Yv-jg.js} +2 -2
- package/dist/{web-preview-wRgRY3Tv.cjs → web-preview-DShy13AM.cjs} +1 -1
- package/package.json +13 -7
- package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
- package/dist/core-Dr7QYemB.js +0 -56
- package/dist/core-Y0lXLwkq.cjs +0 -1
- package/dist/css-import-modal-kHB0ramf.cjs +0 -13
- package/dist/index-B-rSiAp_.cjs +0 -1
- package/dist/index-BwH1mRm_.cjs +0 -5
- package/dist/index-Dxfyt4d4.js +0 -39
- package/dist/index-xYnNKovy.cjs +0 -160
- package/dist/manage-design-tokens-B2fG80bi.cjs +0 -1
- package/dist/page-revisions-content-CcLFI4YK.cjs +0 -1
- package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
package/dist/pages.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ReactNode } from 'react';
|
|
|
4
4
|
import { UseMutationResult } from '@tanstack/react-query';
|
|
5
5
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
6
6
|
|
|
7
|
-
declare type
|
|
7
|
+
declare type ChaiAskAiResponse = {
|
|
8
8
|
blocks?: Array<{
|
|
9
9
|
_id: string;
|
|
10
10
|
} & Partial<ChaiBlock>>;
|
|
@@ -12,11 +12,18 @@ declare type AskAiResponse = {
|
|
|
12
12
|
error?: any;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
declare type
|
|
15
|
+
declare type ChaiBlock<T = Record<string, any>> = {
|
|
16
|
+
_id: string;
|
|
17
|
+
_name?: string;
|
|
18
|
+
_parent?: string | null | undefined;
|
|
19
|
+
_libBlock?: string;
|
|
20
|
+
_type: string;
|
|
21
|
+
partialBlockId?: string;
|
|
22
|
+
} & T;
|
|
16
23
|
|
|
17
|
-
declare type
|
|
24
|
+
declare type ChaiBlocksWithDesignTokens = Record<string, string>;
|
|
18
25
|
|
|
19
|
-
declare type
|
|
26
|
+
declare type ChaiBreakpoint = {
|
|
20
27
|
title: string;
|
|
21
28
|
content: string;
|
|
22
29
|
breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
|
|
@@ -24,14 +31,6 @@ declare type Breakpoint = {
|
|
|
24
31
|
width: number;
|
|
25
32
|
};
|
|
26
33
|
|
|
27
|
-
declare type ChaiBlock<T = Record<string, any>> = {
|
|
28
|
-
_id: string;
|
|
29
|
-
_name?: string;
|
|
30
|
-
_parent?: string | null | undefined;
|
|
31
|
-
_type: string;
|
|
32
|
-
_libBlock?: string;
|
|
33
|
-
} & T;
|
|
34
|
-
|
|
35
34
|
declare interface ChaiBuilderEditorProps {
|
|
36
35
|
children?: default_2.ReactNode;
|
|
37
36
|
/**
|
|
@@ -44,13 +43,7 @@ declare interface ChaiBuilderEditorProps {
|
|
|
44
43
|
/**
|
|
45
44
|
* User
|
|
46
45
|
*/
|
|
47
|
-
user?:
|
|
48
|
-
id: string;
|
|
49
|
-
name: string;
|
|
50
|
-
email: string;
|
|
51
|
-
avatar?: string;
|
|
52
|
-
role?: string;
|
|
53
|
-
};
|
|
46
|
+
user?: ChaiUserInfo;
|
|
54
47
|
/**
|
|
55
48
|
* Permissions
|
|
56
49
|
*/
|
|
@@ -66,19 +59,15 @@ declare interface ChaiBuilderEditorProps {
|
|
|
66
59
|
/**
|
|
67
60
|
* Theme presets
|
|
68
61
|
*/
|
|
69
|
-
themePresets?: Record<string, Partial<
|
|
70
|
-
/**
|
|
71
|
-
* Theme options
|
|
72
|
-
*/
|
|
73
|
-
themeOptions?: (defaultThemeOptions: ChaiBuilderThemeOptions) => ChaiBuilderThemeOptions;
|
|
62
|
+
themePresets?: Record<string, Partial<ChaiTheme>>[];
|
|
74
63
|
/**
|
|
75
64
|
* Theme
|
|
76
65
|
*/
|
|
77
|
-
theme?:
|
|
66
|
+
theme?: ChaiTheme;
|
|
78
67
|
/**
|
|
79
68
|
* Builder theme
|
|
80
69
|
*/
|
|
81
|
-
builderTheme?:
|
|
70
|
+
builderTheme?: ChaiTheme;
|
|
82
71
|
/**
|
|
83
72
|
* Theme panel component
|
|
84
73
|
* TODO: Move to registerChaiThemePanelComponent()
|
|
@@ -117,7 +106,7 @@ declare interface ChaiBuilderEditorProps {
|
|
|
117
106
|
/**
|
|
118
107
|
* Breakpoints
|
|
119
108
|
*/
|
|
120
|
-
breakpoints?:
|
|
109
|
+
breakpoints?: ChaiBreakpoint[];
|
|
121
110
|
/**
|
|
122
111
|
* Loading state
|
|
123
112
|
*/
|
|
@@ -129,7 +118,7 @@ declare interface ChaiBuilderEditorProps {
|
|
|
129
118
|
/**
|
|
130
119
|
* Ask AI callback
|
|
131
120
|
*/
|
|
132
|
-
askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<
|
|
121
|
+
askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<ChaiAskAiResponse>;
|
|
133
122
|
/**
|
|
134
123
|
* Get partial blocks
|
|
135
124
|
* @returns {Record<string, { type: string; name: string; description?: string }>}
|
|
@@ -151,7 +140,7 @@ declare interface ChaiBuilderEditorProps {
|
|
|
151
140
|
* onSave callback function
|
|
152
141
|
* @param saveData
|
|
153
142
|
*/
|
|
154
|
-
onSave?: ({ blocks, theme, autoSave }:
|
|
143
|
+
onSave?: ({ blocks, theme, autoSave }: ChaiSavePageData) => Promise<boolean | Error>;
|
|
155
144
|
/**
|
|
156
145
|
* onSaveStateChange callback function
|
|
157
146
|
* @param syncStatus
|
|
@@ -169,15 +158,15 @@ declare interface ChaiBuilderEditorProps {
|
|
|
169
158
|
/**
|
|
170
159
|
* Languages
|
|
171
160
|
*/
|
|
172
|
-
languages?:
|
|
161
|
+
languages?: string[];
|
|
173
162
|
/**
|
|
174
163
|
* Page Types props
|
|
175
164
|
*/
|
|
176
|
-
pageTypes?:
|
|
165
|
+
pageTypes?: ChaiPageType[];
|
|
177
166
|
/**
|
|
178
167
|
* Search page type items
|
|
179
168
|
*/
|
|
180
|
-
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<
|
|
169
|
+
searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<Pick<ChaiPage_2, "id" | "slug" | "name">[] | Error>;
|
|
181
170
|
/**
|
|
182
171
|
* Collections
|
|
183
172
|
*/
|
|
@@ -207,23 +196,14 @@ declare interface ChaiBuilderEditorProps {
|
|
|
207
196
|
designTokens?: boolean;
|
|
208
197
|
};
|
|
209
198
|
structureRules?: StructureRule[];
|
|
210
|
-
designTokens?:
|
|
211
|
-
siteWideUsage?:
|
|
199
|
+
designTokens?: ChaiDesignTokens;
|
|
200
|
+
siteWideUsage?: ChaiSiteWideUsageData;
|
|
212
201
|
/**
|
|
213
202
|
* Screen to small message component
|
|
214
203
|
*/
|
|
215
204
|
smallScreenComponent?: ReactComponentType;
|
|
216
205
|
}
|
|
217
206
|
|
|
218
|
-
declare type ChaiBuilderThemeOptions = {
|
|
219
|
-
fontFamily: false | Record<VariableKey, string>;
|
|
220
|
-
borderRadius: BorderRadiusValue;
|
|
221
|
-
colors: false | {
|
|
222
|
-
group: string;
|
|
223
|
-
items: Record<VariableKey, [HSLColor, HSLColor]>;
|
|
224
|
-
}[];
|
|
225
|
-
};
|
|
226
|
-
|
|
227
207
|
declare type ChaiCollectoin = {
|
|
228
208
|
id: string;
|
|
229
209
|
name: string;
|
|
@@ -232,9 +212,122 @@ declare type ChaiCollectoin = {
|
|
|
232
212
|
sorts?: SortOptions[];
|
|
233
213
|
};
|
|
234
214
|
|
|
215
|
+
declare interface ChaiDesignTokens {
|
|
216
|
+
[uniqueId: string]: {
|
|
217
|
+
name: string;
|
|
218
|
+
value: string;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
235
222
|
export declare const ChaiJsonInput: React.FC<SmartJsonInputProps>;
|
|
236
223
|
|
|
237
|
-
declare type
|
|
224
|
+
declare type ChaiPage = {
|
|
225
|
+
id: string;
|
|
226
|
+
slug: string;
|
|
227
|
+
lang: string;
|
|
228
|
+
name: string;
|
|
229
|
+
pageType: string;
|
|
230
|
+
blocks: ChaiBlock[];
|
|
231
|
+
createdAt: string;
|
|
232
|
+
lastSaved: string;
|
|
233
|
+
dynamic: boolean;
|
|
234
|
+
online: boolean;
|
|
235
|
+
seo: ChaiPageSeo;
|
|
236
|
+
app: string;
|
|
237
|
+
primaryPage?: string | null;
|
|
238
|
+
currentEditor?: string | null;
|
|
239
|
+
changes: object[];
|
|
240
|
+
parent?: string | null;
|
|
241
|
+
libRefId?: string | null;
|
|
242
|
+
dynamicSlugCustom?: string | null;
|
|
243
|
+
metadata?: object;
|
|
244
|
+
jsonld?: object;
|
|
245
|
+
globalJsonLds?: string[];
|
|
246
|
+
links?: string;
|
|
247
|
+
partialBlocks?: string;
|
|
248
|
+
designTokens?: ChaiDesignTokens;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
declare interface ChaiPage_2 {
|
|
252
|
+
id: string;
|
|
253
|
+
name: string;
|
|
254
|
+
slug: string;
|
|
255
|
+
pageType: string;
|
|
256
|
+
parent: string | null;
|
|
257
|
+
children?: ChaiPage_2[];
|
|
258
|
+
isTemplate?: boolean;
|
|
259
|
+
dynamic?: boolean;
|
|
260
|
+
[key: string]: any;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
declare type ChaiPageProps<T = Record<string, any>> = {
|
|
264
|
+
slug: string;
|
|
265
|
+
searchParams?: Record<string, string>;
|
|
266
|
+
} & T;
|
|
267
|
+
|
|
268
|
+
declare type ChaiPageSeo = {
|
|
269
|
+
title?: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
ogTitle?: string;
|
|
272
|
+
ogDescription?: string;
|
|
273
|
+
ogImage?: string;
|
|
274
|
+
canonicalUrl?: string;
|
|
275
|
+
noIndex?: boolean;
|
|
276
|
+
noFollow?: boolean;
|
|
277
|
+
jsonLD?: string;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
declare type ChaiPageType = {
|
|
281
|
+
key: string;
|
|
282
|
+
helpText?: string;
|
|
283
|
+
icon?: string;
|
|
284
|
+
hasSlug?: boolean;
|
|
285
|
+
name: string | (() => Promise<string>);
|
|
286
|
+
dynamicSegments?: string;
|
|
287
|
+
dynamicSlug?: string;
|
|
288
|
+
getDynamicPages?: ({ query, uuid, }: {
|
|
289
|
+
query?: string;
|
|
290
|
+
uuid?: string;
|
|
291
|
+
}) => Promise<Pick<ChaiPage, "id" | "name" | "slug" | "primaryPage">[]>;
|
|
292
|
+
search?: (query: string) => Promise<Pick<ChaiPage, "id" | "name" | "slug">[] | Error>;
|
|
293
|
+
resolveLink?: (id: string, draft?: boolean, lang?: string) => Promise<string>;
|
|
294
|
+
onCreate?: (data: Partial<ChaiPage> & {
|
|
295
|
+
id: string;
|
|
296
|
+
}) => Promise<void>;
|
|
297
|
+
onUpdate?: (data: Partial<ChaiPage> & {
|
|
298
|
+
id: string;
|
|
299
|
+
}) => Promise<void>;
|
|
300
|
+
onDelete?: (data: Pick<ChaiPage, "id">) => Promise<void>;
|
|
301
|
+
dataProvider?: (args: {
|
|
302
|
+
lang: string;
|
|
303
|
+
draft: boolean;
|
|
304
|
+
inBuilder: boolean;
|
|
305
|
+
pageProps: ChaiPageProps;
|
|
306
|
+
}) => Promise<Record<string, any>>;
|
|
307
|
+
defaultSeo?: () => Record<string, any>;
|
|
308
|
+
defaultJSONLD?: () => Record<string, any>;
|
|
309
|
+
defaultMetaTags?: () => Record<string, string>;
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
declare type ChaiSavePageData = {
|
|
313
|
+
autoSave: boolean;
|
|
314
|
+
blocks: ChaiBlock[];
|
|
315
|
+
theme?: ChaiTheme;
|
|
316
|
+
needTranslations?: boolean;
|
|
317
|
+
designTokens: ChaiDesignTokens;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
declare interface ChaiSiteWideUsageData {
|
|
321
|
+
[pageId: string]: {
|
|
322
|
+
name: string;
|
|
323
|
+
isPartial: boolean;
|
|
324
|
+
partialBlocks: string[];
|
|
325
|
+
links: string[];
|
|
326
|
+
designTokens: ChaiBlocksWithDesignTokens;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
declare type ChaiTheme = {
|
|
238
331
|
fontFamily: {
|
|
239
332
|
heading: string;
|
|
240
333
|
body: string;
|
|
@@ -260,10 +353,16 @@ declare type ChaiThemeValues = {
|
|
|
260
353
|
"card-foreground": [HexColor, HexColor];
|
|
261
354
|
popover: [HexColor, HexColor];
|
|
262
355
|
"popover-foreground": [HexColor, HexColor];
|
|
263
|
-
[key: string]: [HexColor, HexColor];
|
|
264
356
|
};
|
|
265
357
|
};
|
|
266
358
|
|
|
359
|
+
declare type ChaiUserInfo = {
|
|
360
|
+
id: string;
|
|
361
|
+
email: string;
|
|
362
|
+
name: string;
|
|
363
|
+
avatar?: string;
|
|
364
|
+
};
|
|
365
|
+
|
|
267
366
|
export declare const ChaiWebsiteBuilder: (props: ChaiWebsiteBuilderProps) => JSX.Element;
|
|
268
367
|
|
|
269
368
|
declare type ChaiWebsiteBuilderProps = {
|
|
@@ -286,22 +385,8 @@ declare type ChaiWebsiteSetting = {
|
|
|
286
385
|
appKey: string;
|
|
287
386
|
fallbackLang: string;
|
|
288
387
|
languages: string[];
|
|
289
|
-
theme:
|
|
290
|
-
designTokens:
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
declare interface DesignTokens {
|
|
294
|
-
[uniqueId: string]: {
|
|
295
|
-
name: string;
|
|
296
|
-
value: string;
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
declare type DesignTokens_2 = {
|
|
301
|
-
[token: string]: {
|
|
302
|
-
value: string;
|
|
303
|
-
name: string;
|
|
304
|
-
};
|
|
388
|
+
theme: ChaiTheme;
|
|
389
|
+
designTokens: ChaiDesignTokens;
|
|
305
390
|
};
|
|
306
391
|
|
|
307
392
|
declare type FilterOptions = {
|
|
@@ -351,17 +436,6 @@ declare type NestedPathSelectorProps = {
|
|
|
351
436
|
disabled?: boolean;
|
|
352
437
|
};
|
|
353
438
|
|
|
354
|
-
declare type PageType = {
|
|
355
|
-
key: string;
|
|
356
|
-
name: string;
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
declare type PageTypeItem = {
|
|
360
|
-
id: string;
|
|
361
|
-
name: string;
|
|
362
|
-
slug?: string;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
439
|
export declare const PermissionChecker: ({ permission, permissions, children, fallback, }: {
|
|
366
440
|
permission?: string;
|
|
367
441
|
permissions?: string[];
|
|
@@ -371,24 +445,6 @@ export declare const PermissionChecker: ({ permission, permissions, children, fa
|
|
|
371
445
|
|
|
372
446
|
declare type ReactComponentType = default_2.ComponentType<any>;
|
|
373
447
|
|
|
374
|
-
declare type SavePageData = {
|
|
375
|
-
autoSave: boolean;
|
|
376
|
-
blocks: ChaiBlock[];
|
|
377
|
-
theme?: ChaiThemeValues;
|
|
378
|
-
needTranslations?: boolean;
|
|
379
|
-
designTokens: DesignTokens;
|
|
380
|
-
};
|
|
381
|
-
|
|
382
|
-
declare interface SiteWideUsage {
|
|
383
|
-
[pageId: string]: {
|
|
384
|
-
name: string;
|
|
385
|
-
isPartial: boolean;
|
|
386
|
-
partialBlocks: string[];
|
|
387
|
-
links: string[];
|
|
388
|
-
designTokens: BlocksWithDesignTokens;
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
|
|
392
448
|
declare interface SmartJsonInputProps {
|
|
393
449
|
value: string;
|
|
394
450
|
onChange: (value: string) => void;
|
|
@@ -486,6 +542,4 @@ export declare const useWebsitePages: () => UseQueryResult<any, Error>;
|
|
|
486
542
|
|
|
487
543
|
export declare const useWebsiteSetting: () => UseQueryResult<ChaiWebsiteSetting, Error>;
|
|
488
544
|
|
|
489
|
-
declare type VariableKey = string;
|
|
490
|
-
|
|
491
545
|
export { }
|
package/dist/pages.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aE as s, aT as u, aP as t, aN as i, aO as r, ax as g, aU as P, ar as l, v as h, aK as n, aZ as o, aw as c, ap as C, aV as d, k as p, as as m, aW as A, l as U, m as b, aX as k, aY as W, a_ as v, g as B, j as F } from "./index-
|
|
1
|
+
import { aE as s, aT as u, aP as t, aN as i, aO as r, ax as g, aU as P, ar as l, v as h, aK as n, aZ as o, aw as c, ap as C, aV as d, k as p, as as m, aW as A, l as U, m as b, aX as k, aY as W, a_ as v, g as B, j as F } from "./index-Be9lAaD7.js";
|
|
2
2
|
export {
|
|
3
3
|
s as ChaiJsonInput,
|
|
4
4
|
u as ChaiWebsiteBuilder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),q=require("./register-chai-top-bar-DWTuRU53.cjs"),f=require("./index-BhqugjzS.cjs"),r=require("./index-CNEEEgTV.cjs"),U=require("./page-manager-search-and-filter-mEKl-UKh.cjs"),F=require("@tanstack/react-query"),t=require("lodash-es"),b=require("lucide-react"),a=require("react"),M=()=>{const l=r.useApiUrl(),d=r.useFetch();return F.useQuery({queryKey:[r.ACTIONS.GET_CHANGES],queryFn:async()=>d(l,{action:r.ACTIONS.GET_CHANGES})})},G=({page:l,selectedPages:d,handleCheckboxChange:N,getPageType:y,hasSlug:h,currentOwnerId:c})=>{const x=r.useUserId(),{data:u}=r.useChaiUserInfo(c),o=c===x?null:u==null?void 0:u.name;return e.jsxs("tr",{className:"group relative border-b last:border-b-0 hover:bg-gray-50",children:[e.jsxs("td",{scope:"row",className:`flex items-center gap-x-1 whitespace-nowrap px-6 py-2 text-gray-900 dark:text-white ${o?"opacity-50":""}`,children:[o?e.jsx(b.Lock,{className:"h-4 w-4 fill-red-200 text-red-500"}):e.jsx("input",{checked:t.includes(d,l==null?void 0:l.id),onClick:p=>{p.stopPropagation(),N(l==null?void 0:l.id)},type:"checkbox",className:"cursor-pointer rounded focus:outline-none focus:ring-0"})," ",h(l.pageType)?e.jsx(b.File,{className:"h-4 w-4"}):e.jsx(b.GlobeIcon,{className:"h-4 w-4"}),e.jsx(r.Tooltip,{content:l.name,side:"top",showTooltip:l.name.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-medium text-black",children:l.name})}),l.slug&&e.jsx(r.Tooltip,{content:l.slug,side:"top",showTooltip:l.slug.length>25,children:e.jsx("span",{className:"max-w-[200px] truncate font-mono text-xs text-muted-foreground",children:l.slug})})]}),e.jsx("td",{className:"px-2",children:y(l==null?void 0:l.pageType)}),e.jsx("td",{className:"px-4 text-right",children:t.first(l.changes)||""}),e.jsx(e.Fragment,{children:o&&e.jsxs("button",{className:"absolute right-0 top-0 flex h-full items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[e.jsx(b.Edit,{size:12,className:"stroke-[3]"})," ",e.jsx("span",{className:"font-medium",children:o})," is editing this page"]})})]},l==null?void 0:l.id)},O=({onClose:l=()=>{},isPending:d,publishPage:N})=>{const y=r.useUserId(),{pageToUser:h}=r.usePageToUser(),[c,x]=a.useState([]),u=r.useFallbackLang(),[o,p]=a.useState(u),{data:T,isFetching:C}=M(),{data:m}=r.usePageTypes(),k=a.useCallback(s=>{var n;return(n=t.find(m,{key:s}))==null?void 0:n.hasSlug},[m]),j=a.useMemo(()=>t.filter(m,s=>!k(s.key)).map(s=>s.key),[k,m]),P=t.uniq(t.map(T,"lang")).filter(Boolean),i=a.useMemo(()=>t.filter(T,s=>s.pageType==="theme"?!1:o===u?s.lang===o||s.lang==="":s.lang===o),[T,o,u]),w=a.useMemo(()=>t.filter(i,s=>!j.includes(s.pageType)),[i,j]),S=a.useMemo(()=>t.filter(i,s=>j.includes(s.pageType)),[i,j]);a.useEffect(()=>{const s=t.map(t.filter(i,{online:!0}),"id");a.startTransition(()=>x(s))},[i]),a.useEffect(()=>{const s=t.filter(t.keys(h),n=>t.get(h,[n,"userId"])!==y);a.startTransition(()=>x(n=>t.filter(n,g=>!t.includes(s,g))))},[h,y]);const v=c.length===(i==null?void 0:i.length),E=s=>{x(n=>t.includes(n,s)?t.filter(n,g=>g!==s):t.concat(n,s))},B=()=>{x(v?[]:t.map(i,"id"))},I=()=>{N({ids:t.uniq(c)},{onSuccess:()=>{l(),r.throwConfetti("CENTER_CENTER"),p(u)}})},A=s=>{if(s==="theme")return"Theme";const n=t.find(m,{key:s});return n?n==null?void 0:n.name:s},L=a.useMemo(()=>{const s=[{label:"Updated",top:"pt-2"},...t.orderBy(t.filter(w,{online:!0}),"pageType"),...t.orderBy(t.filter(S,{online:!0}),"pageType")].filter(g=>g.pageType!=="theme"),n=[{label:"Offline",top:"pt-6"},...t.orderBy(t.filter(w,{online:!1}),"pageType"),...t.orderBy(t.filter(S,{online:!1}),"pageType")];return[...s,...n]},[w,S]);return e.jsxs(f.DialogContent,{className:"flex max-h-[80%] max-w-4xl flex-col",children:[e.jsxs(f.DialogHeader,{children:[e.jsx(f.DialogTitle,{children:"Publish changes"}),e.jsx(f.DialogDescription,{className:"text-xs",children:"Select the pages you want to publish. Click publish when you're done."})]}),P.length>0&&e.jsx("div",{className:"my-[2px] mt-0",children:e.jsx(U.LanguageSelector,{languages:[u,...P],selectedLanguage:o,setSelectedLanguage:p})}),e.jsx("div",{className:"no-scrollbar relative -mx-4 -mt-4 h-full max-h-full overflow-y-auto",children:C?e.jsxs("div",{className:"space-y-2 px-1",children:[e.jsx("div",{className:"mt-2 h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"}),e.jsx("div",{className:"h-6 w-full animate-pulse rounded bg-gray-200"})]}):e.jsxs("table",{className:"w-full text-left text-xs text-gray-500 dark:text-gray-400 rtl:text-right",children:[e.jsx("thead",{className:"sticky top-0 z-10 border-b bg-gray-50 text-gray-700 dark:bg-gray-700 dark:text-gray-400",children:e.jsxs("tr",{children:[e.jsxs("th",{scope:"col",className:"w-[1 50px] flex items-center gap-x-2 px-6 py-3",children:[e.jsx("input",{checked:v,onClick:s=>{s.stopPropagation(),B()},type:"checkbox",className:"mt-1 cursor-pointer rounded focus:outline-none focus:ring-0"}),"Name"]}),e.jsx("th",{scope:"col",className:"w-[150px] px-2 py-3",children:"Type"}),e.jsx("th",{scope:"col",className:"w-[150px] px-4 py-3 text-right",children:"Status"})]})}),e.jsx("tbody",{children:t.map(L,s=>s.label?e.jsx("tr",{children:e.jsxs("td",{colSpan:3,className:`relative px-6 py-2 text-xs font-medium text-gray-800 ${s.top}`,children:[e.jsx("div",{className:"absolute inset-0 left-6 flex items-center",children:e.jsx("div",{className:"order-gray-300 w-full"})}),e.jsx("div",{className:"relative flex justify-start",children:e.jsx("span",{className:"bg-gray-50 pr-2",children:s.label})})]})},"separator"):e.jsx(G,{page:s,selectedPages:c,handleCheckboxChange:E,getPageType:A,hasSlug:k,currentOwnerId:t.get(h,[(s==null?void 0:s.primaryPage)||(s==null?void 0:s.id),"userId"])}))})]})}),e.jsxs(f.DialogFooter,{className:"mt-10 flex items-center justify-center",children:[c.length>0&&e.jsxs("span",{className:"text-center text-sm text-muted-foreground",children:[c.length," Page",c.length!==1?"s":""," Selected"]}),e.jsx(q.Button,{disabled:d,variant:"outline",onClick:l,children:"Cancel"}),e.jsx(q.Button,{disabled:d||C||t.isEmpty(c),onClick:I,children:d?"Publishing...":"Publish Selected"})]})]})};exports.default=O;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
-
import { B as L } from "./register-chai-top-bar-
|
|
3
|
-
import { d as K, e as Q, f as J, p as V, q as W } from "./index-
|
|
4
|
-
import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-
|
|
5
|
-
import { LanguageSelector as ae } from "./page-manager-search-and-filter-
|
|
2
|
+
import { B as L } from "./register-chai-top-bar-CX_JkRJn.js";
|
|
3
|
+
import { d as K, e as Q, f as J, p as V, q as W } from "./index-mjuSGlPU.js";
|
|
4
|
+
import { ar as X, as as Y, A as I, aA as O, aB as Z, k as ee, m as te, ap as se, T as U, t as le } from "./index-Be9lAaD7.js";
|
|
5
|
+
import { LanguageSelector as ae } from "./page-manager-search-and-filter-CLJss6pV.js";
|
|
6
6
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
7
7
|
import { find as B, filter as a, map as b, keys as re, get as F, includes as C, orderBy as N, isEmpty as oe, uniq as G, first as ce, concat as ie } from "lodash-es";
|
|
8
8
|
import { Lock as de, GlobeIcon as ue, File as me, Edit as he } from "lucide-react";
|
|
@@ -13,6 +13,56 @@ import { useTranslation as G } from "react-i18next";
|
|
|
13
13
|
function l(...e) {
|
|
14
14
|
return H(j(e));
|
|
15
15
|
}
|
|
16
|
+
const _ = o.forwardRef(
|
|
17
|
+
({ className: e, type: t, ...r }, a) => /* @__PURE__ */ s(
|
|
18
|
+
"input",
|
|
19
|
+
{
|
|
20
|
+
type: t,
|
|
21
|
+
className: l(
|
|
22
|
+
"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",
|
|
23
|
+
e
|
|
24
|
+
),
|
|
25
|
+
ref: a,
|
|
26
|
+
...r
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
_.displayName = "Input";
|
|
31
|
+
const W = S(
|
|
32
|
+
"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",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
37
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
38
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
39
|
+
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
40
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
41
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
default: "h-9 px-4 py-2",
|
|
45
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
46
|
+
lg: "h-10 rounded-md px-8",
|
|
47
|
+
icon: "h-9 w-9"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
variant: "default",
|
|
52
|
+
size: "default"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
), y = o.forwardRef(
|
|
56
|
+
({ className: e, variant: t, size: r, asChild: a = !1, ...n }, h) => /* @__PURE__ */ s(
|
|
57
|
+
a ? $ : "button",
|
|
58
|
+
{
|
|
59
|
+
className: l(W({ variant: t, size: r, className: e })),
|
|
60
|
+
ref: h,
|
|
61
|
+
...n
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
y.displayName = "Button";
|
|
16
66
|
const p = {}, de = (e, t) => {
|
|
17
67
|
p[e] = {
|
|
18
68
|
id: e,
|
|
@@ -34,9 +84,9 @@ const p = {}, de = (e, t) => {
|
|
|
34
84
|
}, fe = (e) => Object.values(p).filter((t) => t.type === e).reduce(
|
|
35
85
|
(t, r) => (t[r.id] = r.component, t),
|
|
36
86
|
{}
|
|
37
|
-
),
|
|
38
|
-
E(
|
|
39
|
-
}, pe = () => i(() => w(
|
|
87
|
+
), C = {}, me = (e, t) => {
|
|
88
|
+
E(C, e) && console.warn(`Add block tab with id ${e} already registered`), N(C, e, { id: e, ...t });
|
|
89
|
+
}, pe = () => i(() => w(C), []), f = {}, q = (e, t) => {
|
|
40
90
|
if (f[e])
|
|
41
91
|
throw new Error(`Flag ${e} already exists`);
|
|
42
92
|
f[e] = { key: e, value: !1, ...t };
|
|
@@ -44,21 +94,21 @@ const p = {}, de = (e, t) => {
|
|
|
44
94
|
Object.entries(e).forEach(([t, r]) => {
|
|
45
95
|
if (f[t])
|
|
46
96
|
throw new Error(`Flag ${t} already exists`);
|
|
47
|
-
|
|
97
|
+
q(t, r);
|
|
48
98
|
});
|
|
49
|
-
}, ve = () => f,
|
|
50
|
-
const [t] = R(
|
|
99
|
+
}, ve = () => f, B = U("chai-feature-flags", []), J = (e) => {
|
|
100
|
+
const [t] = R(B);
|
|
51
101
|
return t.includes(e);
|
|
52
102
|
}, be = (e) => {
|
|
53
|
-
const [t, r] = R(
|
|
103
|
+
const [t, r] = R(B);
|
|
54
104
|
return () => {
|
|
55
105
|
t.includes(e) ? r(t.filter((n) => n !== e)) : r([...t, e]);
|
|
56
106
|
};
|
|
57
|
-
}, xe = ({ flagKey: e, children: t }) =>
|
|
107
|
+
}, xe = ({ flagKey: e, children: t }) => J(e) ? t : null;
|
|
58
108
|
let A = {};
|
|
59
109
|
const ye = (e, t) => {
|
|
60
110
|
A[e] = { ...t, id: e };
|
|
61
|
-
}, Ce = (e) => A[e], we = () => w(A),
|
|
111
|
+
}, Ce = (e) => A[e], we = () => w(A), K = S(
|
|
62
112
|
"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",
|
|
63
113
|
{
|
|
64
114
|
variants: {
|
|
@@ -71,66 +121,16 @@ const ye = (e, t) => {
|
|
|
71
121
|
variant: "default"
|
|
72
122
|
}
|
|
73
123
|
}
|
|
74
|
-
),
|
|
75
|
-
|
|
76
|
-
const
|
|
124
|
+
), L = o.forwardRef(({ className: e, variant: t, ...r }, a) => /* @__PURE__ */ s("div", { ref: a, role: "alert", className: l(K({ variant: t }), e), ...r }));
|
|
125
|
+
L.displayName = "Alert";
|
|
126
|
+
const X = o.forwardRef(
|
|
77
127
|
({ className: e, ...t }, r) => /* @__PURE__ */ s("h5", { ref: r, className: l("mb-1 font-medium leading-none tracking-tight", e), ...t })
|
|
78
128
|
);
|
|
79
|
-
|
|
80
|
-
const L = o.forwardRef(
|
|
81
|
-
({ className: e, ...t }, r) => /* @__PURE__ */ s("div", { ref: r, className: l("text-sm [&_p]:leading-relaxed", e), ...t })
|
|
82
|
-
);
|
|
83
|
-
L.displayName = "AlertDescription";
|
|
84
|
-
const X = S(
|
|
85
|
-
"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",
|
|
86
|
-
{
|
|
87
|
-
variants: {
|
|
88
|
-
variant: {
|
|
89
|
-
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
90
|
-
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
91
|
-
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
92
|
-
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
93
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
94
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
95
|
-
},
|
|
96
|
-
size: {
|
|
97
|
-
default: "h-9 px-4 py-2",
|
|
98
|
-
sm: "h-8 rounded-md px-3 text-xs",
|
|
99
|
-
lg: "h-10 rounded-md px-8",
|
|
100
|
-
icon: "h-9 w-9"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
defaultVariants: {
|
|
104
|
-
variant: "default",
|
|
105
|
-
size: "default"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
), C = o.forwardRef(
|
|
109
|
-
({ className: e, variant: t, size: r, asChild: a = !1, ...n }, h) => /* @__PURE__ */ s(
|
|
110
|
-
a ? $ : "button",
|
|
111
|
-
{
|
|
112
|
-
className: l(X({ variant: t, size: r, className: e })),
|
|
113
|
-
ref: h,
|
|
114
|
-
...n
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
);
|
|
118
|
-
C.displayName = "Button";
|
|
129
|
+
X.displayName = "AlertTitle";
|
|
119
130
|
const I = o.forwardRef(
|
|
120
|
-
({ className: e,
|
|
121
|
-
"input",
|
|
122
|
-
{
|
|
123
|
-
type: t,
|
|
124
|
-
className: l(
|
|
125
|
-
"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",
|
|
126
|
-
e
|
|
127
|
-
),
|
|
128
|
-
ref: a,
|
|
129
|
-
...r
|
|
130
|
-
}
|
|
131
|
-
)
|
|
131
|
+
({ className: e, ...t }, r) => /* @__PURE__ */ s("div", { ref: r, className: l("text-sm [&_p]:leading-relaxed", e), ...t })
|
|
132
132
|
);
|
|
133
|
-
I.displayName = "
|
|
133
|
+
I.displayName = "AlertDescription";
|
|
134
134
|
const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
|
|
135
135
|
const [a, n] = u(""), [h, v] = u(!1), [P, b] = u(!1), [F, c] = u(null), D = async (x) => {
|
|
136
136
|
if (!x.trim()) {
|
|
@@ -147,13 +147,13 @@ const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
|
|
|
147
147
|
}, { t: d } = G();
|
|
148
148
|
return /* @__PURE__ */ g("div", { className: "flex w-96 flex-col gap-4 p-4", children: [
|
|
149
149
|
/* @__PURE__ */ s("h2", { className: "text-xl font-semibold", children: d(`${r.charAt(0).toUpperCase() + r.slice(1)} Manager`) }),
|
|
150
|
-
F && /* @__PURE__ */ g(
|
|
150
|
+
F && /* @__PURE__ */ g(L, { variant: "destructive", children: [
|
|
151
151
|
/* @__PURE__ */ s(z, { className: "h-4 w-4" }),
|
|
152
|
-
/* @__PURE__ */ s(
|
|
152
|
+
/* @__PURE__ */ s(I, { children: F })
|
|
153
153
|
] }),
|
|
154
154
|
/* @__PURE__ */ g("div", { className: "flex flex-col gap-4", children: [
|
|
155
155
|
/* @__PURE__ */ s(
|
|
156
|
-
|
|
156
|
+
_,
|
|
157
157
|
{
|
|
158
158
|
placeholder: d(`Enter ${r} URL`),
|
|
159
159
|
value: a,
|
|
@@ -162,9 +162,9 @@ const Y = ({ close: e, onSelect: t, mode: r = "image" }) => {
|
|
|
162
162
|
}
|
|
163
163
|
),
|
|
164
164
|
/* @__PURE__ */ g("div", { className: "flex justify-end gap-2", children: [
|
|
165
|
-
/* @__PURE__ */ s(
|
|
165
|
+
/* @__PURE__ */ s(y, { variant: "outline", onClick: e, children: d("Cancel") }),
|
|
166
166
|
/* @__PURE__ */ s(
|
|
167
|
-
|
|
167
|
+
y,
|
|
168
168
|
{
|
|
169
169
|
onClick: () => t({ id: "dam-id", url: a, width: 600, height: 400, description: "This is image description" }),
|
|
170
170
|
disabled: !P || h,
|
|
@@ -199,23 +199,23 @@ const Ne = (e) => {
|
|
|
199
199
|
O.component = e;
|
|
200
200
|
}, Ie = () => i(() => O.component, []);
|
|
201
201
|
export {
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
C as A,
|
|
203
|
+
y as B,
|
|
204
204
|
m as C,
|
|
205
|
-
|
|
205
|
+
L as D,
|
|
206
206
|
l as E,
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
I as F,
|
|
208
|
+
W as G,
|
|
209
209
|
xe as I,
|
|
210
210
|
p as R,
|
|
211
211
|
ue as a,
|
|
212
212
|
ge as b,
|
|
213
213
|
me as c,
|
|
214
214
|
pe as d,
|
|
215
|
-
|
|
215
|
+
q as e,
|
|
216
216
|
he as f,
|
|
217
217
|
ve as g,
|
|
218
|
-
|
|
218
|
+
J as h,
|
|
219
219
|
be as i,
|
|
220
220
|
ye as j,
|
|
221
221
|
Ce as k,
|
|
@@ -233,5 +233,5 @@ export {
|
|
|
233
233
|
Be as w,
|
|
234
234
|
Le as x,
|
|
235
235
|
Ie as y,
|
|
236
|
-
|
|
236
|
+
_ as z
|
|
237
237
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("lodash-es"),n=require("react"),B=require("jotai"),P=require("jotai/utils"),s=require("react/jsx-runtime"),L=require("class-variance-authority"),D=require("clsx"),q=require("tailwind-merge"),H=require("@radix-ui/react-slot"),V=require("@radix-ui/react-icons"),U=require("react-i18next");function $(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=$(n);function o(...e){return q.twMerge(D.clsx(e))}const y=u.forwardRef(({className:e,type:t,...r},a)=>s.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:a,...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:a=!1,...l},b)=>{const g=a?H.Slot:"button";return s.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],se=()=>i.values(S),ae=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},a)=>s.jsx("div",{ref:a,role:"alert",className:o(ae({variant:t}),e),...r}));T.displayName="Alert";const ne=u.forwardRef(({className:e,...t},r)=>s.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)=>s.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[a,l]=n.useState(""),[b,g]=n.useState(!1),[k,x]=n.useState(!1),[w,f]=n.useState(null),O=async C=>{if(!C.trim()){x(!1),f("Please enter a URL");return}try{g(!0),f(null),x(!0),f(null)}catch{x(!1),f("Error validating URL")}finally{g(!1)}},{t:h}=U.useTranslation();return s.jsxs("div",{className:"flex w-96 flex-col gap-4 p-4",children:[s.jsx("h2",{className:"text-xl font-semibold",children:h(`${r.charAt(0).toUpperCase()+r.slice(1)} Manager`)}),w&&s.jsxs(T,{variant:"destructive",children:[s.jsx(V.ExclamationTriangleIcon,{className:"h-4 w-4"}),s.jsx(A,{children:w})]}),s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx(y,{placeholder:h(`Enter ${r} URL`),value:a,onChange:C=>l(C.target.value),onKeyUp:()=>O(a)}),s.jsxs("div",{className:"flex justify-end gap-2",children:[s.jsx(p,{variant:"outline",onClick:e,children:h("Cancel")}),s.jsx(p,{onClick:()=>t({id:"dam-id",url:a,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=()=>s.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.registerBlockSettingField=G;exports.registerBlockSettingTemplate=W;exports.registerBlockSettingWidget=z;exports.registerChaiAddBlockTab=K;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.useBlockSettingComponents=J;exports.useChaiAddBlockTabs=X;exports.useChaiFeatureFlag=E;exports.useChaiFeatureFlags=Q;exports.useChaiLibraries=se;exports.useChaiSidebarPanels=pe;exports.useMediaManagerComponent=le;exports.useSaveToLibraryComponent=ge;exports.useToggleChaiFeatureFlag=Z;exports.useTopBarComponent=be;
|