@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.
Files changed (151) hide show
  1. package/README.md +5 -8
  2. package/dist/{2SSKDMRQ-hL7THuKW.js → 2SSKDMRQ-CdFBQR2o.js} +2 -2
  3. package/dist/{2SSKDMRQ-DDOgISWg.cjs → 2SSKDMRQ-CuQ42ST6.cjs} +1 -1
  4. package/dist/{AP7HFJJL-tcAhVllC.cjs → AP7HFJJL-DcnEb4BE.cjs} +1 -1
  5. package/dist/{AP7HFJJL-BsLQ13V_.js → AP7HFJJL-bDlWX5Yx.js} +1 -1
  6. package/dist/{IconPicker-FLSVAZxx.js → IconPicker-CNwplOGy.js} +2 -2
  7. package/dist/{IconPicker-J1KLNrSB.cjs → IconPicker-FpyYsxOf.cjs} +1 -1
  8. package/dist/STRINGS-BExFecZW.js +8 -0
  9. package/dist/STRINGS-FNnfjF5H.cjs +1 -0
  10. package/dist/{WDYDFRGG-BTj8AXV6.cjs → WDYDFRGG-BxLmjulP.cjs} +1 -1
  11. package/dist/{WDYDFRGG-Yi0eNS2V.js → WDYDFRGG-CWq7H6Qk.js} +2 -2
  12. package/dist/{actions-registery-CtQSSexG.cjs → actions-registery-BRgseJas.cjs} +16 -16
  13. package/dist/{actions-registery-DqrFhSMp.js → actions-registery-DRV8xywr.js} +180 -181
  14. package/dist/actions.cjs +1 -1
  15. package/dist/actions.d.ts +112 -51
  16. package/dist/actions.js +2 -2
  17. package/dist/{active-in-another-tab-Dozn833d.js → active-in-another-tab-C392ZWQc.js} +3 -3
  18. package/dist/{active-in-another-tab-BtAiatqq.cjs → active-in-another-tab-DEWOFgY5.cjs} +1 -1
  19. package/dist/{add-new-language-page-DD-CAoAQ.js → add-new-language-page-BL2F_Cu7.js} +4 -4
  20. package/dist/{add-new-language-page-9AMizlES.cjs → add-new-language-page-DBWd0wDY.cjs} +1 -1
  21. package/dist/{add-new-page-BS9vPnFG.cjs → add-new-page-DYrQeKCi.cjs} +1 -1
  22. package/dist/{add-new-page-uZKCk9eB.js → add-new-page-QVlyJhn9.js} +2 -2
  23. package/dist/{ai-panel-content-CK4XOkEh.js → ai-panel-content-CCOluPtK.js} +4 -4
  24. package/dist/{ai-panel-content-PovaKJaj.cjs → ai-panel-content-DCZRBa6s.cjs} +1 -1
  25. package/dist/{ai-panel-default-lang-B37k5ADH.cjs → ai-panel-default-lang-C3t0elrO.cjs} +2 -2
  26. package/dist/{ai-panel-default-lang-BtLjUl9d.js → ai-panel-default-lang-Crz7QAxl.js} +4 -4
  27. package/dist/{ai-panel-other-lang-CdQmASqv.cjs → ai-panel-other-lang-BRkr4Te3.cjs} +1 -1
  28. package/dist/{ai-panel-other-lang-Dp1MNaLi.js → ai-panel-other-lang-DIF8PYLh.js} +4 -4
  29. package/dist/{ai-prompt-input-BT-mEdTX.js → ai-prompt-input-D4dqy8L2.js} +2 -2
  30. package/dist/{ai-prompt-input-Dtym4w8J.cjs → ai-prompt-input-Ybgvrvd6.cjs} +1 -1
  31. package/dist/{ai-translation-prompt-B-lH7emI.cjs → ai-translation-prompt-Ck12Bfl6.cjs} +1 -1
  32. package/dist/{ai-translation-prompt-B17GK1QR.js → ai-translation-prompt-eZ4Sllva.js} +2 -2
  33. package/dist/{apply-binding-BvWfJCSZ.js → apply-binding-CLU6Xp4K.js} +77 -81
  34. package/dist/apply-binding-NvZX_rJe.cjs +1 -0
  35. package/dist/{code-display-DloSPyPr.cjs → code-display-9Onx6RCq.cjs} +1 -1
  36. package/dist/{code-display-Ck81Id9K.js → code-display-oa1j0ri7.js} +1 -1
  37. package/dist/{code-editor-EZT2pMsU.js → code-editor-D45h29W1.js} +1 -1
  38. package/dist/{code-editor-CUeNiMzA.cjs → code-editor-DH8eU4WL.cjs} +1 -1
  39. package/dist/{continue-editing-in-this-client-CS7C6h9Q.js → continue-editing-in-this-client-BRrIvSrl.js} +3 -3
  40. package/dist/{continue-editing-in-this-client-DMZOc36k.cjs → continue-editing-in-this-client-DgZ9Q18G.cjs} +1 -1
  41. package/dist/core-8lkXy4lC.cjs +1 -0
  42. package/dist/core-BvsZwF26.js +52 -0
  43. package/dist/core.cjs +1 -1
  44. package/dist/core.d.ts +143 -172
  45. package/dist/core.js +22 -34
  46. package/dist/{css-import-modal-s7t5gZQo.js → css-import-modal-BhLPzQH8.js} +5 -4
  47. package/dist/css-import-modal-C2-oVwFv.cjs +13 -0
  48. package/dist/{delete-design-token-C1smbx4E.js → delete-design-token-D4Q5-Xql.js} +1 -1
  49. package/dist/{delete-design-token-Mbw_6sYI.cjs → delete-design-token-DJSQluQ6.cjs} +1 -1
  50. package/dist/{delete-page-B7J3t0FN.cjs → delete-page-BxbsKhY5.cjs} +1 -1
  51. package/dist/{delete-page-2GfBi8Iv.js → delete-page-xHdZT-7c.js} +3 -3
  52. package/dist/{design-token-usage-DyO3xM-F.js → design-token-usage-7wgmVSWI.js} +2 -2
  53. package/dist/{design-token-usage-BoGOULG8.cjs → design-token-usage-KZ4pilLm.cjs} +1 -1
  54. package/dist/{digital-asset-manager-Cz3Nlrzl.js → digital-asset-manager-BmbVU7fX.js} +4 -4
  55. package/dist/{digital-asset-manager-DDk2ucTE.cjs → digital-asset-manager-a1fqrQVH.cjs} +1 -1
  56. package/dist/{duplicate-page-BwAY4Ssm.js → duplicate-page-5uIno9Yh.js} +4 -4
  57. package/dist/{duplicate-page-Dw3U4wTT.cjs → duplicate-page-BBTxn_o1.cjs} +1 -1
  58. package/dist/{dynamic-page-selector-CvBFyX2F.cjs → dynamic-page-selector-C1ef0i2I.cjs} +1 -1
  59. package/dist/{dynamic-page-selector-sViJuQlU.js → dynamic-page-selector-rhvhg7ol.js} +3 -3
  60. package/dist/{image-editor-BgGQuESa.js → image-editor-BXYZDa0s.js} +1 -1
  61. package/dist/{image-editor-AIsccrqC.cjs → image-editor-rqUgAO8V.cjs} +1 -1
  62. package/dist/{index-B7eWP_hB.js → index-Be9lAaD7.js} +421 -425
  63. package/dist/index-BhqugjzS.cjs +160 -0
  64. package/dist/index-CNEEEgTV.cjs +5 -0
  65. package/dist/{index-RYr8kQdI.js → index-mjuSGlPU.js} +5136 -5613
  66. package/dist/{json-diff-viewer-B2A78udz.cjs → json-diff-viewer-C9qmLiaq.cjs} +1 -1
  67. package/dist/{json-diff-viewer-Svw-kbhe.js → json-diff-viewer-aVwY7_hZ.js} +3 -3
  68. package/dist/{lang-panel-Bnc-9wkM.js → lang-panel-BTWk23Mw.js} +4 -4
  69. package/dist/{lang-panel-AmEkoWid.cjs → lang-panel-Bo1ZWYfu.cjs} +1 -1
  70. package/dist/{manage-design-tokens-BBkh1t4w.js → manage-design-tokens-id8bylgO.js} +4 -4
  71. package/dist/manage-design-tokens-lUMCgjdS.cjs +1 -0
  72. package/dist/{mark-as-template-CE6tRoQy.cjs → mark-as-template-BYXBDXMv.cjs} +1 -1
  73. package/dist/{mark-as-template-0CPzZnk-.js → mark-as-template-hv3WD852.js} +3 -3
  74. package/dist/{nested-path-selector-content-kGznHufl.js → nested-path-selector-content-B8z90MFF.js} +2 -2
  75. package/dist/{nested-path-selector-content-SmfjElr-.cjs → nested-path-selector-content-DgFFXcTD.cjs} +1 -1
  76. package/dist/{no-language-page-content-B4bQLc4K.cjs → no-language-page-content-6Kk8UjFX.cjs} +1 -1
  77. package/dist/{no-language-page-content-DXsAPDZd.js → no-language-page-content-DMACzysm.js} +3 -3
  78. package/dist/{no-language-page-dialog-BpPqmw9a.js → no-language-page-dialog-D4n_XYUq.js} +2 -2
  79. package/dist/{no-language-page-dialog-BC8NHzK2.cjs → no-language-page-dialog-mBH-fthh.cjs} +1 -1
  80. package/dist/{page-creator-82qTbBj4.cjs → page-creator-CGglYnYg.cjs} +1 -1
  81. package/dist/{page-creator-Bazn6yH4.js → page-creator-CgsOF0Eg.js} +4 -4
  82. package/dist/{page-lock-CRFyqKZE.js → page-lock-CUCEBnJb.js} +2 -2
  83. package/dist/{page-lock-D2iFZDUK.cjs → page-lock-Hsi61Mk5.cjs} +1 -1
  84. package/dist/{page-locked-dialog-xLqvKzax.cjs → page-locked-dialog-DSxbAMpt.cjs} +1 -1
  85. package/dist/{page-locked-dialog-GKfQEOmk.js → page-locked-dialog-bHvbFllT.js} +3 -3
  86. package/dist/{page-manager-new-Bn2QKjbf.cjs → page-manager-new-CBfFl5rL.cjs} +1 -1
  87. package/dist/{page-manager-new-DItY2hjd.js → page-manager-new-Cifc526h.js} +8 -8
  88. package/dist/{page-manager-search-and-filter-CPa8IXdd.js → page-manager-search-and-filter-CLJss6pV.js} +3 -3
  89. package/dist/{page-manager-search-and-filter-Dc4ky-qV.cjs → page-manager-search-and-filter-mEKl-UKh.cjs} +1 -1
  90. package/dist/page-revisions-content-C95dQJyx.cjs +1 -0
  91. package/dist/{page-revisions-content-CH-PZK0O.js → page-revisions-content-DvL4ya9g.js} +75 -67
  92. package/dist/pages.cjs +1 -1
  93. package/dist/pages.d.ts +146 -92
  94. package/dist/pages.js +1 -1
  95. package/dist/{publish-pages-content-BzJDObqr.cjs → publish-pages-content-B-6vSkql.cjs} +1 -1
  96. package/dist/{publish-pages-content-CSJCFElu.js → publish-pages-content-B8-IZW_U.js} +4 -4
  97. package/dist/{register-chai-top-bar-ESJHs5s-.js → register-chai-top-bar-CX_JkRJn.js} +78 -78
  98. package/dist/register-chai-top-bar-DWTuRU53.cjs +1 -0
  99. package/dist/render.cjs +1 -1
  100. package/dist/render.d.ts +14 -15
  101. package/dist/render.js +3 -3
  102. package/dist/{rte-widget-modal-5T81P_hg.js → rte-widget-modal-1SbY5bcQ.js} +7 -7
  103. package/dist/{rte-widget-modal-BfXcA7OP.cjs → rte-widget-modal-CyKwtbOG.cjs} +1 -1
  104. package/dist/runtime-client.cjs +1 -0
  105. package/dist/runtime-client.d.ts +158 -0
  106. package/dist/runtime-client.js +32 -0
  107. package/dist/runtime.cjs +1 -1
  108. package/dist/runtime.d.ts +92 -240
  109. package/dist/runtime.js +72 -72
  110. package/dist/{save-to-lib-MtWKSVeN.js → save-to-lib-BKcBfjfi.js} +3 -3
  111. package/dist/{save-to-lib-DGAdSa-0.cjs → save-to-lib-BmPh_Vns.cjs} +1 -1
  112. package/dist/{selected-block-display-CB1-hVR5.js → selected-block-display-B3hHlcLA.js} +3 -3
  113. package/dist/{selected-block-display-DLt_nMn9.cjs → selected-block-display-BCvTNcp2.cjs} +1 -1
  114. package/dist/{seo-panel-CRzzw4FW.js → seo-panel-D3EyOYij.js} +3 -3
  115. package/dist/{seo-panel-_kGXE9MC.cjs → seo-panel-DVClgzX9.cjs} +1 -1
  116. package/dist/{shared-json-ld-DoRgzDPC.cjs → shared-json-ld-BRgJTv0m.cjs} +1 -1
  117. package/dist/{shared-json-ld-CXukkDeS.js → shared-json-ld-DSPadwbY.js} +3 -3
  118. package/dist/{slug-input-Dp187Tiy.cjs → slug-input-B39SPBdP.cjs} +1 -1
  119. package/dist/{slug-input-CeEQ0zyv.js → slug-input-C3UrwSkt.js} +2 -2
  120. package/dist/supabase-actions.cjs +1 -1
  121. package/dist/supabase-actions.js +1 -1
  122. package/dist/{take-over-request-C9J3_rev.js → take-over-request-DfAlPvpE.js} +3 -3
  123. package/dist/{take-over-request-CXuakFBm.cjs → take-over-request-Tq9-gOCV.cjs} +1 -1
  124. package/dist/{theme-panel-footer-DvwsyHNQ.js → theme-panel-footer-DIy4baYU.js} +3 -3
  125. package/dist/{theme-panel-footer-CWZ0qs13.cjs → theme-panel-footer-DQzjVBBP.cjs} +1 -1
  126. package/dist/{translation-warning-modal-_aBp5ZZQ.js → translation-warning-modal-BHwLZZOw.js} +2 -2
  127. package/dist/{translation-warning-modal-DEt_ExQp.cjs → translation-warning-modal-Ckwt5Skc.cjs} +1 -1
  128. package/dist/types.cjs +1 -0
  129. package/dist/types.d.ts +598 -0
  130. package/dist/types.js +1 -0
  131. package/dist/{unmark-as-template-BYL5naYx.cjs → unmark-as-template-BKA-sNZr.cjs} +1 -1
  132. package/dist/{unmark-as-template-JN-cDUV_.js → unmark-as-template-CbgifSbI.js} +3 -3
  133. package/dist/{unpublish-page-B06iZEIO.cjs → unpublish-page-BqzvOD76.cjs} +1 -1
  134. package/dist/{unpublish-page-DqwBY2yI.js → unpublish-page-DXQpAkvc.js} +3 -3
  135. package/dist/utils.d.ts +5 -5
  136. package/dist/web-blocks.cjs +1 -1
  137. package/dist/web-blocks.js +214 -214
  138. package/dist/{web-preview-h39D3TUh.js → web-preview-DH7Yv-jg.js} +2 -2
  139. package/dist/{web-preview-wRgRY3Tv.cjs → web-preview-DShy13AM.cjs} +1 -1
  140. package/package.json +13 -7
  141. package/dist/apply-binding-IsUf6UWJ.cjs +0 -1
  142. package/dist/core-Dr7QYemB.js +0 -56
  143. package/dist/core-Y0lXLwkq.cjs +0 -1
  144. package/dist/css-import-modal-kHB0ramf.cjs +0 -13
  145. package/dist/index-B-rSiAp_.cjs +0 -1
  146. package/dist/index-BwH1mRm_.cjs +0 -5
  147. package/dist/index-Dxfyt4d4.js +0 -39
  148. package/dist/index-xYnNKovy.cjs +0 -160
  149. package/dist/manage-design-tokens-B2fG80bi.cjs +0 -1
  150. package/dist/page-revisions-content-CcLFI4YK.cjs +0 -1
  151. package/dist/register-chai-top-bar-BqwKw4uy.cjs +0 -1
@@ -0,0 +1,598 @@
1
+ import { default as default_2 } from 'react';
2
+ import * as React_2 from 'react';
3
+ import { RJSFSchema } from '@rjsf/utils';
4
+ import { UiSchema } from '@rjsf/utils';
5
+
6
+ export declare type ChaiAskAiResponse = {
7
+ blocks?: Array<{
8
+ _id: string;
9
+ } & Partial<ChaiBlock>>;
10
+ usage?: Record<any, number>;
11
+ error?: any;
12
+ };
13
+
14
+ export declare type ChaiAsset = {
15
+ url: string;
16
+ id?: string;
17
+ thumbnailUrl?: string;
18
+ description?: string;
19
+ width?: number;
20
+ height?: number;
21
+ };
22
+
23
+ export declare type ChaiAsyncProp<T> = T | undefined;
24
+
25
+ export declare type ChaiBlock<T = Record<string, any>> = {
26
+ _id: string;
27
+ _name?: string;
28
+ _parent?: string | null | undefined;
29
+ _libBlock?: string;
30
+ _type: string;
31
+ partialBlockId?: string;
32
+ } & T;
33
+
34
+ export declare type ChaiBlockComponentProps<BlockProps, PageData = Record<string, unknown>> = ChaiBlock<BlockProps> & {
35
+ $loading?: boolean;
36
+ blockProps: Record<string, string>;
37
+ inBuilder: boolean;
38
+ lang: string;
39
+ draft: boolean;
40
+ pageProps?: ChaiPageProps;
41
+ pageData?: PageData;
42
+ children?: default_2.ReactNode;
43
+ };
44
+
45
+ export declare interface ChaiBlockDefinition<T = Record<string, any>, K = Record<string, any>> {
46
+ component: default_2.ComponentType<ChaiBlockComponentProps<T>>;
47
+ type: string;
48
+ label: string;
49
+ group: string;
50
+ description?: string;
51
+ wrapper?: boolean;
52
+ blocks?: ChaiBlock[] | (() => ChaiBlock[]);
53
+ category?: string;
54
+ hidden?: boolean | ((parentType?: string) => boolean);
55
+ icon?: default_2.ReactNode | default_2.ComponentType;
56
+ dataProviderMode?: "live" | "mock";
57
+ dataProviderDependencies?: string[];
58
+ dataProvider?: (args: {
59
+ lang: string;
60
+ draft: boolean;
61
+ inBuilder: boolean;
62
+ block: ChaiBlock<T>;
63
+ pageProps: ChaiPageProps;
64
+ }) => K;
65
+ schema?: ChaiBlockSchema;
66
+ uiSchema?: ChaiBlockUiSchema;
67
+ i18nProps?: string[];
68
+ aiProps?: string[];
69
+ inlineEditProps?: string[];
70
+ canAcceptBlock?: (type: string) => boolean;
71
+ canDelete?: () => boolean;
72
+ canMove?: () => boolean;
73
+ canDuplicate?: () => boolean;
74
+ canBeNested?: (type: string) => boolean;
75
+ }
76
+
77
+ export declare type ChaiBlockPropSchema = RJSFSchema & {
78
+ ui?: ChaiBlockUiSchema;
79
+ default: any;
80
+ };
81
+
82
+ export declare type ChaiBlockSchema = {
83
+ properties?: Record<string, ChaiBlockPropSchema>;
84
+ allOf?: any[];
85
+ oneOf?: any[];
86
+ } & Partial<Pick<ChaiBlockPropSchema, "required" | "dependencies" | "ui" | "title" | "description" | "default">>;
87
+
88
+ export declare type ChaiBlockSchemas = {
89
+ schema: object | Omit<ChaiBlockSchema, "ui">;
90
+ uiSchema?: ChaiBlockUiSchema;
91
+ };
92
+
93
+ export declare type ChaiBlockStyles = Record<string, string>;
94
+
95
+ declare type ChaiBlocksWithDesignTokens = Record<string, string>;
96
+
97
+ export declare type ChaiBlockUiSchema = UiSchema;
98
+
99
+ export declare type ChaiBorderRadiusValue = false | string;
100
+
101
+ export declare type ChaiBreakpoint = {
102
+ title: string;
103
+ content: string;
104
+ breakpoint: "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | string;
105
+ icon: default_2.ReactNode | Element;
106
+ width: number;
107
+ };
108
+
109
+ export declare interface ChaiBuilderEditorProps {
110
+ children?: default_2.ReactNode;
111
+ /**
112
+ * Goto page callback
113
+ */
114
+ gotoPage?: ({ pageId, lang }: {
115
+ pageId: string;
116
+ lang: string;
117
+ }) => void;
118
+ /**
119
+ * User
120
+ */
121
+ user?: ChaiUserInfo;
122
+ /**
123
+ * Permissions
124
+ */
125
+ permissions?: string[] | null;
126
+ /**
127
+ * Optional pageId. If not provided, a random pageId will be generated
128
+ */
129
+ pageId?: string;
130
+ /**
131
+ * Page external data
132
+ */
133
+ pageExternalData?: Record<string, any>;
134
+ /**
135
+ * Theme presets
136
+ */
137
+ themePresets?: Record<string, Partial<ChaiTheme>>[];
138
+ /**
139
+ * Theme
140
+ */
141
+ theme?: ChaiTheme;
142
+ /**
143
+ * Builder theme
144
+ */
145
+ builderTheme?: ChaiTheme;
146
+ /**
147
+ * Theme panel component
148
+ * TODO: Move to registerChaiThemePanelComponent()
149
+ */
150
+ themePanelComponent?: ReactComponentType;
151
+ /**
152
+ * onError callback function
153
+ * @param error
154
+ */
155
+ onError?: (error: Error) => void;
156
+ /**
157
+ * Translations object
158
+ */
159
+ translations?: Record<string, Record<string, any>>;
160
+ /**
161
+ * Custom layout component
162
+ * TODO: Move to registerChaiLayoutComponent()
163
+ */
164
+ layout?: default_2.ComponentType;
165
+ /**
166
+ * HTML direction.
167
+ */
168
+ htmlDir?: "ltr" | "rtl";
169
+ /**
170
+ * Show debug logs
171
+ */
172
+ debugLogs?: boolean;
173
+ /**
174
+ * Auto save support
175
+ */
176
+ autoSave?: boolean;
177
+ /**
178
+ * Auto save interval in seconds
179
+ */
180
+ autoSaveActionsCount?: number;
181
+ /**
182
+ * Breakpoints
183
+ */
184
+ breakpoints?: ChaiBreakpoint[];
185
+ /**
186
+ * Loading state
187
+ */
188
+ loading?: boolean;
189
+ /**
190
+ * Locale
191
+ */
192
+ locale?: string;
193
+ /**
194
+ * Ask AI callback
195
+ */
196
+ askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[], lang: string) => Promise<ChaiAskAiResponse>;
197
+ /**
198
+ * Get partial blocks
199
+ * @returns {Record<string, { type: string; name: string; description?: string }>}
200
+ */
201
+ getPartialBlocks?: () => Promise<Record<string, {
202
+ type: string;
203
+ name: string;
204
+ description?: string;
205
+ }>>;
206
+ /**
207
+ * Get all blocks of a partial block
208
+ */
209
+ getPartialBlockBlocks?: (partialBlockKey: string) => Promise<ChaiBlock[]>;
210
+ /**
211
+ * Blocks for the page
212
+ */
213
+ blocks?: ChaiBlock[];
214
+ /**
215
+ * onSave callback function
216
+ * @param saveData
217
+ */
218
+ onSave?: ({ blocks, theme, autoSave }: ChaiSavePageData) => Promise<boolean | Error>;
219
+ /**
220
+ * onSaveStateChange callback function
221
+ * @param syncStatus
222
+ */
223
+ onSaveStateChange?: (syncStatus: "SAVED" | "SAVING" | "UNSAVED") => void;
224
+ /**
225
+ * Preview component
226
+ * TODO: Move to registerChaiPreviewComponent()
227
+ */
228
+ previewComponent?: ReactComponentType;
229
+ /**
230
+ * Content locale
231
+ */
232
+ fallbackLang?: string;
233
+ /**
234
+ * Languages
235
+ */
236
+ languages?: string[];
237
+ /**
238
+ * Page Types props
239
+ */
240
+ pageTypes?: ChaiPageType[];
241
+ /**
242
+ * Search page type items
243
+ */
244
+ searchPageTypeItems?: (pageTypeKey: string, query: string) => Promise<Pick<ChaiPage_2, "id" | "slug" | "name">[] | Error>;
245
+ /**
246
+ * Collections
247
+ */
248
+ collections?: ChaiCollectoin[];
249
+ /**
250
+ * Get Block Async Props
251
+ */
252
+ getBlockAsyncProps?: (args: {
253
+ block: ChaiBlock;
254
+ }) => Promise<{
255
+ [key: string]: any;
256
+ }>;
257
+ /**
258
+ * temporary props. Not to be used in production
259
+ */
260
+ flags?: {
261
+ librarySite?: boolean;
262
+ copyPaste?: boolean;
263
+ exportCode?: boolean;
264
+ darkMode?: boolean;
265
+ dataBinding?: boolean;
266
+ importHtml?: boolean;
267
+ importTheme?: boolean;
268
+ gotoSettings?: boolean;
269
+ dragAndDrop?: boolean;
270
+ validateStructure?: boolean;
271
+ designTokens?: boolean;
272
+ };
273
+ structureRules?: StructureRule[];
274
+ designTokens?: ChaiDesignTokens;
275
+ siteWideUsage?: ChaiSiteWideUsageData;
276
+ /**
277
+ * Screen to small message component
278
+ */
279
+ smallScreenComponent?: ReactComponentType;
280
+ }
281
+
282
+ export declare type ChaiClosestBlockProp<T> = T | undefined;
283
+
284
+ export declare type ChaiCollectoin = {
285
+ id: string;
286
+ name: string;
287
+ description?: string;
288
+ filters?: FilterOptions[];
289
+ sorts?: SortOptions[];
290
+ };
291
+
292
+ export declare interface ChaiCoreBlock {
293
+ blocks?: ChaiBlock[];
294
+ data: any;
295
+ props: {
296
+ [key: string]: any;
297
+ };
298
+ type: string;
299
+ _name?: string;
300
+ partialBlockId?: string;
301
+ }
302
+
303
+ export declare type ChaiCssVariableNameWithDefault = Record<CSSVariableName, any>;
304
+
305
+ export declare type ChaiDataProviderArgs<T = Record<string, any>, K = Record<string, any>> = {
306
+ block: ChaiBlock<T>;
307
+ } & K;
308
+
309
+ export declare interface ChaiDesignTokens {
310
+ [uniqueId: string]: {
311
+ name: string;
312
+ value: string;
313
+ };
314
+ }
315
+
316
+ export declare type ChaiFont = ChaiFontViaUrl | ChaiFontViaSrc;
317
+
318
+ export declare type ChaiFontViaSrc = {
319
+ family: string;
320
+ src: {
321
+ url: string;
322
+ format: string;
323
+ fontWeight?: string;
324
+ fontStyle?: string;
325
+ fontDisplay?: string;
326
+ fontStretch?: string;
327
+ }[];
328
+ fallback: string;
329
+ };
330
+
331
+ export declare type ChaiFontViaUrl = {
332
+ family: string;
333
+ url: string;
334
+ fallback: string;
335
+ };
336
+
337
+ export declare type ChaiLibrary<T = Record<string, any>> = {
338
+ id: string;
339
+ name: string;
340
+ blocks?: ChaiLibraryBlock[];
341
+ description?: string;
342
+ } & T;
343
+
344
+ export declare type ChaiLibraryBlock<T = Record<string, any>> = {
345
+ id: string;
346
+ group: string;
347
+ name: string;
348
+ preview?: string;
349
+ tags?: string[];
350
+ description?: string;
351
+ } & T;
352
+
353
+ export declare type ChaiPage = {
354
+ id: string;
355
+ slug: string;
356
+ lang: string;
357
+ name: string;
358
+ pageType: string;
359
+ blocks: ChaiBlock[];
360
+ createdAt: string;
361
+ lastSaved: string;
362
+ dynamic: boolean;
363
+ online: boolean;
364
+ seo: ChaiPageSeo;
365
+ app: string;
366
+ primaryPage?: string | null;
367
+ currentEditor?: string | null;
368
+ changes: object[];
369
+ parent?: string | null;
370
+ libRefId?: string | null;
371
+ dynamicSlugCustom?: string | null;
372
+ metadata?: object;
373
+ jsonld?: object;
374
+ globalJsonLds?: string[];
375
+ links?: string;
376
+ partialBlocks?: string;
377
+ designTokens?: ChaiDesignTokens;
378
+ };
379
+
380
+ declare interface ChaiPage_2 {
381
+ id: string;
382
+ name: string;
383
+ slug: string;
384
+ pageType: string;
385
+ parent: string | null;
386
+ children?: ChaiPage_2[];
387
+ isTemplate?: boolean;
388
+ dynamic?: boolean;
389
+ [key: string]: any;
390
+ }
391
+
392
+ export declare type ChaiPageProps<T = Record<string, any>> = {
393
+ slug: string;
394
+ searchParams?: Record<string, string>;
395
+ } & T;
396
+
397
+ declare type ChaiPageSeo = {
398
+ title?: string;
399
+ description?: string;
400
+ ogTitle?: string;
401
+ ogDescription?: string;
402
+ ogImage?: string;
403
+ canonicalUrl?: string;
404
+ noIndex?: boolean;
405
+ noFollow?: boolean;
406
+ jsonLD?: string;
407
+ };
408
+
409
+ export declare type ChaiPageType = {
410
+ key: string;
411
+ helpText?: string;
412
+ icon?: string;
413
+ hasSlug?: boolean;
414
+ name: string | (() => Promise<string>);
415
+ dynamicSegments?: string;
416
+ dynamicSlug?: string;
417
+ getDynamicPages?: ({ query, uuid, }: {
418
+ query?: string;
419
+ uuid?: string;
420
+ }) => Promise<Pick<ChaiPage, "id" | "name" | "slug" | "primaryPage">[]>;
421
+ search?: (query: string) => Promise<Pick<ChaiPage, "id" | "name" | "slug">[] | Error>;
422
+ resolveLink?: (id: string, draft?: boolean, lang?: string) => Promise<string>;
423
+ onCreate?: (data: Partial<ChaiPage> & {
424
+ id: string;
425
+ }) => Promise<void>;
426
+ onUpdate?: (data: Partial<ChaiPage> & {
427
+ id: string;
428
+ }) => Promise<void>;
429
+ onDelete?: (data: Pick<ChaiPage, "id">) => Promise<void>;
430
+ dataProvider?: (args: {
431
+ lang: string;
432
+ draft: boolean;
433
+ inBuilder: boolean;
434
+ pageProps: ChaiPageProps;
435
+ }) => Promise<Record<string, any>>;
436
+ defaultSeo?: () => Record<string, any>;
437
+ defaultJSONLD?: () => Record<string, any>;
438
+ defaultMetaTags?: () => Record<string, string>;
439
+ };
440
+
441
+ export declare type ChaiRenderBlockProps<T> = {
442
+ blockProps: Record<string, string>;
443
+ children?: React_2.ReactNode;
444
+ inBuilder: boolean;
445
+ } & T;
446
+
447
+ declare type ChaiSavePageData = {
448
+ autoSave: boolean;
449
+ blocks: ChaiBlock[];
450
+ theme?: ChaiTheme;
451
+ needTranslations?: boolean;
452
+ designTokens: ChaiDesignTokens;
453
+ };
454
+ export { ChaiSavePageData }
455
+ export { ChaiSavePageData as SavePageData }
456
+
457
+ export declare interface ChaiServerBlockDefinition<T = Record<string, any>, K = Record<string, any>> {
458
+ component: default_2.ComponentType<ChaiBlockComponentProps<T>>;
459
+ type: string;
460
+ dataProvider?: (args: {
461
+ draft: boolean;
462
+ inBuilder: boolean;
463
+ lang: string;
464
+ block: ChaiBlock<T>;
465
+ pageProps: ChaiPageProps;
466
+ }) => Promise<K>;
467
+ suspenseFallback?: default_2.ComponentType<any>;
468
+ }
469
+
470
+ export declare interface ChaiSiteWideUsageData {
471
+ [pageId: string]: {
472
+ name: string;
473
+ isPartial: boolean;
474
+ partialBlocks: string[];
475
+ links: string[];
476
+ designTokens: ChaiBlocksWithDesignTokens;
477
+ };
478
+ }
479
+
480
+ export declare type ChaiStyles = {
481
+ [key: string]: string;
482
+ };
483
+
484
+ declare type ChaiTheme = {
485
+ fontFamily: {
486
+ heading: string;
487
+ body: string;
488
+ };
489
+ borderRadius: string;
490
+ colors: {
491
+ background: [HexColor, HexColor];
492
+ foreground: [HexColor, HexColor];
493
+ primary: [HexColor, HexColor];
494
+ "primary-foreground": [HexColor, HexColor];
495
+ secondary: [HexColor, HexColor];
496
+ "secondary-foreground": [HexColor, HexColor];
497
+ muted: [HexColor, HexColor];
498
+ "muted-foreground": [HSLColor, HSLColor];
499
+ accent: [HSLColor, HSLColor];
500
+ "accent-foreground": [HSLColor, HSLColor];
501
+ destructive: [HSLColor, HSLColor];
502
+ "destructive-foreground": [HSLColor, HSLColor];
503
+ border: [HSLColor, HSLColor];
504
+ input: [HSLColor, HSLColor];
505
+ ring: [HexColor, HexColor];
506
+ card: [HexColor, HexColor];
507
+ "card-foreground": [HexColor, HexColor];
508
+ popover: [HexColor, HexColor];
509
+ "popover-foreground": [HexColor, HexColor];
510
+ };
511
+ };
512
+ export { ChaiTheme as ChaiBuilderThemeValues }
513
+ export { ChaiTheme }
514
+
515
+ export declare type ChaiThemeOptions = {
516
+ fontFamily: false | Record<VariableKey, string>;
517
+ borderRadius: ChaiBorderRadiusValue;
518
+ colors: {
519
+ group: string;
520
+ items: Record<VariableKey, [HSLColor, HSLColor]>;
521
+ }[];
522
+ };
523
+
524
+ declare type ChaiUserInfo = {
525
+ id: string;
526
+ email: string;
527
+ name: string;
528
+ avatar?: string;
529
+ };
530
+
531
+ export declare type ChaiWebsiteBuilderProps = {
532
+ hasReactQueryProvider?: boolean;
533
+ topLeftCorner?: React.FC;
534
+ apiUrl?: string;
535
+ getPreviewUrl?: (slug: string) => string;
536
+ getLiveUrl?: (slug: string) => string;
537
+ onLogout?: () => void;
538
+ getAccessToken?: () => Promise<string>;
539
+ currentUser: LoggedInUser | null;
540
+ websocket?: any;
541
+ features?: {
542
+ sharedJsonLD?: boolean;
543
+ canResetSeoToDefault?: boolean;
544
+ } & Record<string, boolean>;
545
+ } & Pick<ChaiBuilderEditorProps, "onError" | "translations" | "locale" | "htmlDir" | "autoSave" | "autoSaveActionsCount" | "fallbackLang" | "languages" | "themePresets" | "flags" | "structureRules">;
546
+
547
+ export declare type ChaiWebsiteSetting = {
548
+ appKey: string;
549
+ fallbackLang: string;
550
+ languages: string[];
551
+ theme: ChaiTheme;
552
+ designTokens: ChaiDesignTokens;
553
+ };
554
+
555
+ declare type CSSVariableName = string;
556
+
557
+ declare type FilterOptions = {
558
+ id: string;
559
+ name: string;
560
+ description?: string;
561
+ };
562
+
563
+ declare type HexColor = string;
564
+
565
+ declare type HSLColor = string;
566
+
567
+ declare type LoggedInUser = {
568
+ id: string;
569
+ email: string;
570
+ name: string;
571
+ avatar?: string;
572
+ metadata?: Record<string, any>;
573
+ };
574
+
575
+ declare type ReactComponentType = default_2.ComponentType<any>;
576
+
577
+ declare type SortOptions = {
578
+ id: string;
579
+ name: string;
580
+ description?: string;
581
+ };
582
+
583
+ declare type StructureError = {
584
+ id: string;
585
+ message: string;
586
+ severity: "error" | "warning";
587
+ blockId?: string;
588
+ };
589
+
590
+ declare type StructureRule = {
591
+ name: string;
592
+ description: string;
593
+ validate: (blocks: ChaiBlock[], tree: any[]) => StructureError[];
594
+ };
595
+
596
+ declare type VariableKey = string;
597
+
598
+ export { }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./index-xYnNKovy.cjs"),p=require("./index-BwH1mRm_.cjs"),d=require("react"),m=require("react-i18next"),g=({page:i,onClose:n})=>{const{t:a}=m.useTranslation(),[r,s]=d.useState(!1),l=p.useUnmarkAsTemplate(),c=()=>{s(!0),l.mutate(i,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:u=>{u.stopPropagation(),n()},children:a("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:r,onClick:c,children:a("Unmark as template")})]})]})})};exports.default=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DWTuRU53.cjs"),t=require("./index-BhqugjzS.cjs"),p=require("./index-CNEEEgTV.cjs"),d=require("react"),m=require("react-i18next"),g=({page:i,onClose:n})=>{const{t:a}=m.useTranslation(),[r,s]=d.useState(!1),l=p.useUnmarkAsTemplate(),c=()=>{s(!0),l.mutate(i,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:u=>{u.stopPropagation(),n()},children:a("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:r,onClick:c,children:a("Unmark as template")})]})]})})};exports.default=g;
@@ -1,7 +1,7 @@
1
1
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
- import { B as r } from "./register-chai-top-bar-ESJHs5s-.js";
3
- import { D as p, d as u, e as d, f, p as g, q as h } from "./index-RYr8kQdI.js";
4
- import { r as k } from "./index-B7eWP_hB.js";
2
+ import { B as r } from "./register-chai-top-bar-CX_JkRJn.js";
3
+ import { D as p, d as u, e as d, f, p as g, q as h } from "./index-mjuSGlPU.js";
4
+ import { r as k } from "./index-Be9lAaD7.js";
5
5
  import { useState as D } from "react";
6
6
  import { useTranslation as x } from "react-i18next";
7
7
  const j = ({ page: i, onClose: t }) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),e=require("./index-xYnNKovy.cjs"),c=require("./index-BwH1mRm_.cjs"),a=require("react-i18next"),d=({page:i,onClose:t})=>{const{t:s}=a.useTranslation(),{mutate:l,isPending:r}=c.useUnpublishPage(),u=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(o.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(o.Button,{variant:"destructive",disabled:r,onClick:u,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DWTuRU53.cjs"),e=require("./index-BhqugjzS.cjs"),c=require("./index-CNEEEgTV.cjs"),a=require("react-i18next"),d=({page:i,onClose:t})=>{const{t:s}=a.useTranslation(),{mutate:l,isPending:r}=c.useUnpublishPage(),u=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(o.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(o.Button,{variant:"destructive",disabled:r,onClick:u,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=d;
@@ -1,7 +1,7 @@
1
1
  import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
- import { B as l } from "./register-chai-top-bar-ESJHs5s-.js";
3
- import { D as c, d as u, e as d, f as h, p as m, q as b } from "./index-RYr8kQdI.js";
4
- import { s as f } from "./index-B7eWP_hB.js";
2
+ import { B as l } from "./register-chai-top-bar-CX_JkRJn.js";
3
+ import { D as c, d as u, e as d, f as h, p as m, q as b } from "./index-mjuSGlPU.js";
4
+ import { s as f } from "./index-Be9lAaD7.js";
5
5
  import { useTranslation as D } from "react-i18next";
6
6
  const v = ({ page: n, onClose: r }) => {
7
7
  const { t: i } = D(), { mutate: e, isPending: t } = f(), a = async () => {
package/dist/utils.d.ts CHANGED
@@ -3,7 +3,7 @@ import { default as default_2 } from '@tailwindcss/forms';
3
3
  import { default as default_3 } from '@tailwindcss/typography';
4
4
  import { PluginCreator } from 'tailwindcss/types/config';
5
5
 
6
- declare type BorderRadiusValue = false | string;
6
+ declare type ChaiBorderRadiusValue = false | string;
7
7
 
8
8
  /**
9
9
  * This is the tailwind plugin for chai builder
@@ -15,10 +15,10 @@ export declare const chaiBuilderPlugin: {
15
15
  config?: Partial<Config>;
16
16
  };
17
17
 
18
- declare type ChaiBuilderThemeOptions = {
18
+ declare type ChaiThemeOptions = {
19
19
  fontFamily: false | Record<VariableKey, string>;
20
- borderRadius: BorderRadiusValue;
21
- colors: false | {
20
+ borderRadius: ChaiBorderRadiusValue;
21
+ colors: {
22
22
  group: string;
23
23
  items: Record<VariableKey, [HSLColor, HSLColor]>;
24
24
  }[];
@@ -104,7 +104,7 @@ export declare const getChaiBuilderTailwindConfig: ({ content, theme }: {
104
104
  } | typeof default_2 | typeof default_3)[];
105
105
  };
106
106
 
107
- export declare const getChaiBuilderTheme: (themeOptions?: ChaiBuilderThemeOptions) => {
107
+ export declare const getChaiBuilderTheme: (themeOptions?: ChaiThemeOptions) => {
108
108
  fontFamily: {};
109
109
  borderRadius: {
110
110
  lg: string;