@chaibuilder/sdk 1.2.86 → 1.2.88

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/core.d.ts CHANGED
@@ -36,11 +36,6 @@ declare type AskAiResponse = {
36
36
  error?: any;
37
37
  };
38
38
 
39
- declare interface Block {
40
- type: string;
41
- [key: string]: any;
42
- }
43
-
44
39
  export declare const BlockAttributesEditor: React_2.MemoExoticComponent<() => JSX_2.Element>;
45
40
 
46
41
  /**
@@ -77,29 +72,72 @@ export declare const ChaiBuilderCanvas: React_3.FC;
77
72
 
78
73
  /**
79
74
  * ChaiBuilder is the main entry point for the Chai Builder Studio.
80
- * @param props
81
- * @constructor
82
75
  */
83
- export declare const ChaiBuilderEditor: (props: ChaiBuilderEditorProps) => JSX_2.Element;
76
+ export declare const ChaiBuilderEditor: React_3.FC<ChaiBuilderEditorProps>;
84
77
 
85
78
  export declare interface ChaiBuilderEditorProps {
79
+ /**
80
+ * onError callback function
81
+ * @param error
82
+ */
86
83
  onError?: (error: Error) => void;
84
+ /**
85
+ * Translations object
86
+ */
87
87
  translations?: Record<string, Record<string, any>>;
88
+ /**
89
+ * onLoad callback function
90
+ * @param editorInstance
91
+ */
88
92
  onLoad?: (editorInstance: ChaiBuilderInstance) => void;
93
+ /**
94
+ * Custom layout component
95
+ */
89
96
  layout?: React_3.ComponentType;
97
+ /**
98
+ * Layout variant. Not supported with custom layout
99
+ */
90
100
  layoutVariant?: LayoutVariant;
101
+ /**
102
+ * HTML direction.
103
+ */
91
104
  htmlDir?: "ltr" | "rtl";
92
- hideSaveButton?: boolean;
105
+ /**
106
+ * Filter function for blocks to be shown in the builder
107
+ */
93
108
  filterChaiBlock?: (block: any) => boolean;
109
+ /**
110
+ * Show debug logs
111
+ */
94
112
  showDebugLogs?: boolean;
113
+ /**
114
+ * Auto save support
115
+ */
95
116
  autoSaveSupport?: boolean;
117
+ /**
118
+ * Auto save interval in seconds
119
+ */
96
120
  autoSaveInterval?: TimeInSeconds;
121
+ /**
122
+ * Breakpoints
123
+ */
97
124
  breakpoints?: Breakpoint[];
125
+ /**
126
+ * Editable
127
+ */
98
128
  editable?: boolean;
129
+ /**
130
+ * Loading state
131
+ */
99
132
  loading?: boolean;
133
+ /**
134
+ * Locale
135
+ */
100
136
  locale?: string;
101
137
  nonEditableComponent?: ReactComponentType;
102
- canvas?: React_3.FC<any>;
138
+ /**
139
+ * Canvas component. Not supported with custom layout
140
+ */
103
141
  canvasTopBarComponents?: {
104
142
  right?: ReactComponentType[];
105
143
  };
@@ -107,7 +145,6 @@ export declare interface ChaiBuilderEditorProps {
107
145
  dataBindingSupport?: boolean;
108
146
  dataProviders?: DataProvider[];
109
147
  darkMode?: boolean;
110
- dndOptions?: any;
111
148
  importHTMLSupport?: boolean;
112
149
  fetchMediaCallback?: (limit?: number, offset?: number) => Promise<any[]>;
113
150
  uploadMediaCallback?: (file: File) => Promise<{
@@ -116,23 +153,28 @@ export declare interface ChaiBuilderEditorProps {
116
153
  askAiCallBack?: (type: "styles" | "content", prompt: string, blocks: ChaiBlock[]) => Promise<AskAiResponse>;
117
154
  saveAiContextCallback?: (content: string) => Promise<true | Error>;
118
155
  aiContext?: string;
119
- getExternalPredefinedBlock?: (block: PredefinedBlock) => Promise<PredefinedBlock & {
120
- blocks: ChaiBlock[];
121
- html: string;
122
- }>;
123
156
  uiLibraries?: Omit<UILibrary, "blocks">[];
124
157
  getUILibraryBlocks?: (library: UILibrary) => Promise<UiLibraryBlock[]>;
125
158
  getUILibraryBlock?: (library: UILibrary, uiLibBlock: UiLibraryBlock) => Promise<ChaiBlock[]>;
126
- subPages?: Block[];
127
- subPagesSupport?: boolean;
128
159
  blocks?: ChaiBlock[];
129
- onSaveBlocks?: ({ blocks, providers }: any) => Promise<any>;
130
- onSavePage?: ({ blocks, providers }: SavePageData) => Promise<boolean | Error>;
131
160
  onSave?: ({ blocks, providers }: SavePageData) => Promise<boolean | Error>;
132
161
  brandingOptions?: Record<string, string>;
133
- onSaveBrandingOptions?: (brandingOptions: Record<string, any>) => Promise<boolean | Error>;
162
+ /**
163
+ * Theme configuration
164
+ */
165
+ themeConfiguration?: Record<string, string>;
166
+ /**
167
+ * onSaveStateChange callback function
168
+ * @param syncStatus
169
+ */
134
170
  onSaveStateChange?: (syncStatus: "UNSAVED" | "SAVED" | "SAVING") => void;
171
+ /**
172
+ * Preview component
173
+ */
135
174
  previewComponent?: ReactComponentType;
175
+ /**
176
+ * Sidebar components. Not supported with custom layout
177
+ */
136
178
  sideBarComponents?: {
137
179
  bottom?: ReactComponentType[];
138
180
  top?: {
@@ -141,13 +183,25 @@ export declare interface ChaiBuilderEditorProps {
141
183
  component: ReactComponentType;
142
184
  }[];
143
185
  };
186
+ /**
187
+ * Topbar components. Not supported with custom layout
188
+ */
144
189
  topBarComponents?: {
145
190
  center?: ReactComponentType[];
146
191
  left?: ReactComponentType[];
147
192
  right?: ReactComponentType[];
148
193
  };
194
+ /**
195
+ * Outline menu items
196
+ */
149
197
  outlineMenuItems?: OutlineMenuItems;
198
+ /**
199
+ * getPages callback function
200
+ */
150
201
  getPages?: () => Promise<ChaiPage[]>;
202
+ /**
203
+ * Unsplash access key
204
+ */
151
205
  unsplashAccessKey?: string;
152
206
  _flags?: Record<string, boolean>;
153
207
  }
@@ -223,9 +277,9 @@ export declare const ImportHTML: ({ parentId }: {
223
277
  parentId?: string;
224
278
  }) => JSX_2.Element;
225
279
 
226
- declare const LAYOUT_VARIANTS: Record<string, string>;
280
+ declare const LAYOUT_MODE: Record<string, string>;
227
281
 
228
- declare type LayoutVariant = keyof typeof LAYOUT_VARIANTS;
282
+ declare type LayoutVariant = keyof typeof LAYOUT_MODE;
229
283
 
230
284
  export declare const mergeClasses: (...inputs: ClassValue[]) => string;
231
285
 
@@ -240,14 +294,6 @@ declare type OutlineMenuItem = {
240
294
 
241
295
  declare type OutlineMenuItems = OutlineMenuItem[];
242
296
 
243
- declare type PredefinedBlock = {
244
- uuid: string;
245
- name: string;
246
- preview: string;
247
- blocks?: ChaiBlock[];
248
- html?: string;
249
- };
250
-
251
297
  declare type ReactComponentType = React_3.ComponentType<any>;
252
298
 
253
299
  declare type RichText = string;
@@ -358,6 +404,11 @@ export declare const useChaiBuilderMsgListener: (handler: (payload: {
358
404
  data?: any;
359
405
  }) => void) => void;
360
406
 
407
+ /**
408
+ * Custom hook to access the current state of the code editor.
409
+ * @category Hooks
410
+ * @returns The current state of the code editor from the `codeEditorAtom`.
411
+ */
361
412
  export declare const useCodeEditor: () => [CodeEditorProps, never];
362
413
 
363
414
  export declare const useCopyBlockIds: () => [Array<string>, Function];
@@ -385,7 +436,7 @@ export declare const useGetPageData: () => () => {
385
436
  blocks: any;
386
437
  };
387
438
 
388
- export declare const useHiddenBlockIds: () => (string[] | ((args_0: string[] | ((prev: string[]) => string[])) => void) | ((blockId: string) => void))[];
439
+ export declare const useHiddenBlockIds: () => readonly [string[], (args_0: string[] | ((prev: string[]) => string[])) => void, (blockId: string) => void];
389
440
 
390
441
  /**
391
442
  *
@@ -441,7 +492,8 @@ export declare const useSelectedBlocksDisplayChild: () => {
441
492
  export declare const useSelectedBreakpoints: () => [string[], Function];
442
493
 
443
494
  /**
444
- *
495
+ * @group Hooks
496
+ * @returns {TStyleBlock[]} selected styling blocks
445
497
  */
446
498
  export declare const useSelectedStylingBlocks: () => [TStyleBlock[], (args_0: TStyleBlock[] | ((prev: TStyleBlock[]) => TStyleBlock[])) => void];
447
499
 
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { m as os, n as as, i as ts, A as rs, o as is, B as ps, h as ls, l as ms, g as us, p as ds, q as cs, D as Bs, I as ks, O as ns, r as Cs, T as Ss, U as gs, s as As, j as Is, t as Ps, z as hs, a6 as ys, E as Ms, a7 as vs, G as Us, a5 as Ds, v as Es, ab as Ls, X as Rs, d as Ts, x as bs, H as fs, J as xs, k as Hs, u as Os, K as ws, L as Vs, M as _s, N as zs, P as Fs, Q as Gs, R as Ns, S as Ws, V as Zs, aa as js, W as qs, f as Js, y as Ks, Y as Qs, Z as Xs, e as Ys, a0 as $s, $ as se, _ as ee, a as oe, a4 as ae, a8 as te, a9 as re, a1 as ie, a3 as pe, a2 as le, w as me, b as ue, c as de } from "./index-PmGJgG89.js";
1
+ import { m as os, n as as, i as ts, A as rs, o as is, B as ps, h as ls, l as ms, g as us, p as ds, q as cs, D as Bs, I as ks, O as ns, r as Cs, T as Ss, U as gs, s as As, j as Is, t as Ps, z as hs, a6 as ys, E as Ms, a7 as vs, G as Us, a5 as Ds, v as Es, ab as Ls, X as Rs, d as Ts, x as bs, H as fs, J as xs, k as Hs, u as Os, K as ws, L as Vs, M as _s, N as zs, P as Fs, Q as Gs, R as Ns, S as Ws, V as Zs, aa as js, W as qs, f as Js, y as Ks, Y as Qs, Z as Xs, e as Ys, a0 as $s, $ as se, _ as ee, a as oe, a4 as ae, a8 as te, a9 as re, a1 as ie, a3 as pe, a2 as le, w as me, b as ue, c as de } from "./index-JAlLL51L.js";
2
2
  import { g as Be, c as ke } from "./iconBase-zweRWSz0.js";
3
3
  import { useTranslation as Ce } from "react-i18next";
4
4
  import { default as ge } from "i18next";
@@ -47,10 +47,10 @@ import "react-dom";
47
47
  import "prop-types";
48
48
  import "react-error-boundary";
49
49
  import "re-resizable";
50
+ import "lucide-react";
50
51
  import "@rjsf/validator-ajv8";
51
52
  import "@rjsf/core";
52
53
  import "react-arborist";
53
- import "lucide-react";
54
54
  import "himalaya";
55
55
  import "react-icons-picker";
56
56
  import "react-autosuggest";