react-bricks 4.6.1 → 4.7.0-alpha.0

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 (66) hide show
  1. package/astro/DynamicComponent.astro +174 -0
  2. package/astro/PageViewer.astro +56 -0
  3. package/astro/Slot.astro +40 -0
  4. package/astro/SlotViewer.astro +38 -0
  5. package/astro/TemplateViewer.astro +24 -0
  6. package/astro/index.js +2 -0
  7. package/astro/package.json +20 -0
  8. package/astro/react-bricks-astro.d.ts +1236 -0
  9. package/astro/react-bricks-astro.esm.js +2 -0
  10. package/astro/server/index.js +2 -0
  11. package/astro/server/package.json +14 -0
  12. package/astro/server/react-bricks-astro-server.d.ts +1027 -0
  13. package/astro/server/react-bricks-astro-server.esm.js +2 -0
  14. package/frontend/index.js +2 -1
  15. package/frontend/package.json +2 -2
  16. package/frontend/react-bricks-frontend.esm.js +2 -1
  17. package/index.js +2 -1
  18. package/package.json +39 -23
  19. package/react-bricks-1YD00zjF.js +2 -0
  20. package/react-bricks-BI0q6_FW.esm.js +2 -0
  21. package/react-bricks-BSHEhoDG.esm.js +2 -0
  22. package/react-bricks-BUGrDTgq.esm.js +2 -0
  23. package/react-bricks-BgfLLAM0.js +2 -0
  24. package/react-bricks-BklAG3OE.esm.js +2 -0
  25. package/react-bricks-BnMY1ZEO.js +2 -0
  26. package/react-bricks-BnRsW22a.js +2 -0
  27. package/react-bricks-Bv9phTdZ.js +2 -0
  28. package/react-bricks-C-nvbiap.js +2 -0
  29. package/react-bricks-CErfpf4g.esm.js +2 -0
  30. package/react-bricks-CI44eOAm.js +2 -0
  31. package/react-bricks-CW55gEAH.esm.js +2 -0
  32. package/react-bricks-CXY4gR9A.js +2 -0
  33. package/{react-bricks-amKwgsHP.esm.js → react-bricks-ChFEEzaf.esm.js} +2 -1
  34. package/react-bricks-ChQsE0YU.esm.js +2 -0
  35. package/react-bricks-DQcHsMAz.esm.js +2 -0
  36. package/react-bricks-DRIKzHUS.js +2 -0
  37. package/react-bricks-DS4kraXp.js +2 -0
  38. package/{react-bricks-C4Xaxf69.js → react-bricks-DamkhdwS.js} +2 -1
  39. package/react-bricks-DouXS5I0.js +2 -0
  40. package/react-bricks-DzZdqeB7.esm.js +2 -0
  41. package/react-bricks-IZZ19Kbs.esm.js +2 -0
  42. package/react-bricks-OncRrHCV.esm.js +2 -0
  43. package/react-bricks-SXPPhoTe.esm.js +2 -0
  44. package/react-bricks-Wx-oWYfO.js +2 -0
  45. package/react-bricks.d.ts +66 -43
  46. package/react-bricks.esm.js +2 -1
  47. package/rsc/client/index.js +2 -1
  48. package/rsc/client/package.json +2 -2
  49. package/rsc/client/react-bricks-rsc-client.d.ts +36 -13
  50. package/rsc/client/react-bricks-rsc-client.esm.js +2 -1
  51. package/rsc/index.js +2 -1
  52. package/rsc/package.json +2 -2
  53. package/rsc/react-bricks-rsc.d.ts +60 -37
  54. package/rsc/react-bricks-rsc.esm.js +2 -1
  55. package/react-bricks-8DGKndRH.esm.js +0 -1
  56. package/react-bricks-BI0lOdOd.js +0 -1
  57. package/react-bricks-BKgyRVXN.js +0 -1
  58. package/react-bricks-BQVp1I6D.js +0 -1
  59. package/react-bricks-C8TC7BiB.esm.js +0 -1
  60. package/react-bricks-CaxnQSIm.js +0 -1
  61. package/react-bricks-Cb_1qAfs.js +0 -1
  62. package/react-bricks-CjeZxHOb.esm.js +0 -1
  63. package/react-bricks-Cogx-YCi.esm.js +0 -1
  64. package/react-bricks-D3cMjNMP.esm.js +0 -1
  65. package/react-bricks-D8vmjvBM.js +0 -1
  66. package/react-bricks-ufYPAS2z.esm.js +0 -1
@@ -0,0 +1,1027 @@
1
+ import React from 'react';
2
+ import { Descendant, Editor, Node } from 'slate';
3
+ import { RenderElementProps, RenderLeafProps } from 'slate-react';
4
+
5
+ declare namespace types {
6
+ export const EmbedProp = "RB_PAGE_EMBED";
7
+ export const EmbedContent = "RB_PAGE_EMBED_CONTENT";
8
+ /**
9
+ * Type of Sidebar control
10
+ */
11
+ export enum SideEditPropType {
12
+ Text = "TEXT",
13
+ Textarea = "TEXTAREA",
14
+ Number = "NUMBER",
15
+ Date = "DATE",
16
+ Range = "RANGE",
17
+ Boolean = "BOOLEAN",
18
+ Select = "SELECT",
19
+ Autocomplete = "AUTOCOMPLETE",
20
+ Image = "IMAGE",
21
+ Custom = "CUSTOM",
22
+ Relationship = "RELATIONSHIP",
23
+ IconSelector = "ICON-SELECTOR"
24
+ }
25
+ /**
26
+ * How to display the options
27
+ */
28
+ export enum OptionsDisplay {
29
+ Select = "SELECT",
30
+ Radio = "RADIO",
31
+ Color = "COLOR"
32
+ }
33
+ /**
34
+ * Features for RichText: see also the new RichTextExt
35
+ */
36
+ export enum RichTextFeatures {
37
+ Bold = "BOLD",
38
+ Italic = "ITALIC",
39
+ Code = "CODE",
40
+ Highlight = "HIGHLIGHT",
41
+ Subscript = "SUB",
42
+ Superscript = "SUP",
43
+ Link = "LINK",
44
+ UnorderedList = "UL",
45
+ OrderedList = "OL",
46
+ Heading1 = "H1",
47
+ Heading2 = "H2",
48
+ Heading3 = "H3",
49
+ Heading4 = "H4",
50
+ Heading5 = "H5",
51
+ Heading6 = "H6",
52
+ Quote = "QUOTE"
53
+ }
54
+ /**
55
+ * Supported Icon Sets
56
+ */
57
+ export enum IconSets {
58
+ Lucide = "lu",
59
+ HeroIconSolid = "hi-solid",
60
+ HeroIconOutline = "hi-outline",
61
+ FontAwesome = "fa6",
62
+ Feather = "fi"
63
+ }
64
+ /**
65
+ * Page status
66
+ */
67
+ export enum PageStatus {
68
+ Draft = "DRAFT",
69
+ Published = "PUBLISHED"
70
+ }
71
+ /**
72
+ * Approval status
73
+ */
74
+ export enum EditStatus {
75
+ Merged = "MERGED",
76
+ Working = "WORKING",
77
+ MergeRequested = "MERGE_REQUESTED"
78
+ }
79
+ /**
80
+ * Device type for responsive preview (for the icon)
81
+ */
82
+ export enum DeviceType {
83
+ Desktop = "DESKTOP",
84
+ Tablet = "TABLET",
85
+ Phone = "PHONE"
86
+ }
87
+ /**
88
+ * Corner for the click-to-edit button
89
+ */
90
+ export enum ClickToEditSide {
91
+ BottomRight = "BOTTOM-RIGHT",
92
+ BottomLeft = "BOTTOM-LEFT",
93
+ TopRight = "TOP-RIGHT",
94
+ TopLeft = "TOP-LEFT",
95
+ None = "NONE"
96
+ }
97
+ export enum BlockIconsPosition {
98
+ InsideBlock = "INSIDE-BLOCK",
99
+ OutsideBlock = "OUTSIDE-BLOCK"
100
+ }
101
+ /**
102
+ * A Brick is a type of content block
103
+ */
104
+ export type Brick<T = {}> = React.FC<T> & {
105
+ schema: IBlockType<T>;
106
+ };
107
+ /**
108
+ * Bricks are types of content block
109
+ */
110
+ export type Bricks = {
111
+ [key: string]: Brick<any>;
112
+ };
113
+ /**
114
+ * A Category contains bricks
115
+ */
116
+ export type Category = {
117
+ categoryName: string;
118
+ bricks: Brick<any>[];
119
+ };
120
+ /**
121
+ * A Theme contains categories and bricks
122
+ */
123
+ export type Theme = {
124
+ themeName: string;
125
+ categories: Category[];
126
+ };
127
+ /**
128
+ * Custom role type
129
+ */
130
+ export type CustomRole = {
131
+ id: string;
132
+ name: string;
133
+ };
134
+ /**
135
+ * The type of the user passed to permission functions
136
+ */
137
+ export type PermissionUser = {
138
+ firstName: string;
139
+ lastName: string;
140
+ email: string;
141
+ isAdmin: boolean;
142
+ role: string;
143
+ customRole?: CustomRole;
144
+ };
145
+ /**
146
+ * The type of the page passed to permission functions
147
+ */
148
+ export type PermissionPage = {
149
+ slug: string;
150
+ pageType: string;
151
+ language: string;
152
+ };
153
+ /**
154
+ * The type of the brick passed to permission functions
155
+ */
156
+ export type PermissionBrick = {
157
+ name: string;
158
+ category: string;
159
+ theme: string;
160
+ tags: string[];
161
+ };
162
+ /**
163
+ * The permission functions
164
+ */
165
+ export type Permissions = {
166
+ canAddPage?: (user: PermissionUser, pageType: string) => boolean;
167
+ canAddTranslation?: (user: PermissionUser, pageType: string, language: string) => boolean;
168
+ canSeePageType?: (user: PermissionUser, pageType: string) => boolean;
169
+ canSeePage?: (user: PermissionUser, page: Omit<PermissionPage, 'language'>) => boolean;
170
+ canEditPage?: (user: PermissionUser, page: PermissionPage) => boolean;
171
+ canDeletePage?: (user: PermissionUser, page: Omit<PermissionPage, 'language'>) => boolean;
172
+ canDeleteTranslation?: (user: PermissionUser, page: PermissionPage) => boolean;
173
+ canUseBrick?: (user: PermissionUser, brick: PermissionBrick) => boolean;
174
+ };
175
+ /**
176
+ * The logged-in User
177
+ */
178
+ export type User = {
179
+ id: string;
180
+ email: string;
181
+ firstName: string;
182
+ lastName: string;
183
+ company: string;
184
+ avatarUrl?: string;
185
+ isAdmin: boolean;
186
+ token: string;
187
+ appName: string;
188
+ appId: string;
189
+ appEnv: string;
190
+ deployHookUrl?: string;
191
+ deployHookMethod?: string;
192
+ deployHookTriggerOnScheduledPublishing: boolean;
193
+ deployHookStagingUrl?: string;
194
+ deployHookStagingMethod?: string;
195
+ deployHookStagingTriggerOnScheduledPublishing: boolean;
196
+ deployHookDevUrl?: string;
197
+ deployHookDevMethod?: string;
198
+ deployHookDevTriggerOnScheduledPublishing: boolean;
199
+ eventsHookUrl?: string;
200
+ eventsHookAuthToken?: string;
201
+ canCreatePage: boolean;
202
+ canDeletePage: boolean;
203
+ canDeploy: boolean;
204
+ canDeployStaging: boolean;
205
+ canDeployDev: boolean;
206
+ canEditPageAttributes: boolean;
207
+ canEditSeo: boolean;
208
+ canApprove: boolean;
209
+ role: string;
210
+ customRole?: CustomRole;
211
+ plan: string;
212
+ isVerified: boolean;
213
+ languages: Language[];
214
+ defaultLanguage: string;
215
+ hostname: string;
216
+ useWorkingCopy: boolean;
217
+ useApprovalWorkflow: boolean;
218
+ subscription: {
219
+ maxStories: number;
220
+ collaboration: boolean;
221
+ deployHookStaging: boolean;
222
+ deployHookDev: boolean;
223
+ scheduledPublishing: boolean;
224
+ embedPages: boolean;
225
+ lockBlocks: boolean;
226
+ flexibleRoles: boolean;
227
+ advancedSeo: boolean;
228
+ eventsLog: boolean;
229
+ maxFileSize: number;
230
+ maxImageSize: number;
231
+ maxFilesBatch: number;
232
+ maxFilesConcurrency: number;
233
+ diskSpace: number;
234
+ advancedDam: boolean;
235
+ workingCopy: boolean;
236
+ approvalWorkflow: boolean;
237
+ template: boolean;
238
+ };
239
+ } | null;
240
+ /**
241
+ * Translation for a Page
242
+ */
243
+ export type Translation = {
244
+ language: string;
245
+ slug: string;
246
+ name: string;
247
+ status: PageStatus;
248
+ editStatus: EditStatus;
249
+ isLocked: boolean;
250
+ scheduledForPublishingOn: string;
251
+ };
252
+ /**
253
+ * The page editing User
254
+ */
255
+ export type EditingUser = {
256
+ id: string;
257
+ email: string;
258
+ firstName: string;
259
+ lastName: string;
260
+ company: string;
261
+ avatarUrl?: string;
262
+ };
263
+ /**
264
+ * Date and User of last edit
265
+ */
266
+ export type LastEditedBy = {
267
+ date: string;
268
+ user: EditingUser;
269
+ };
270
+ /**
271
+ * A React Bricks Page
272
+ */
273
+ export type Page = {
274
+ id: string;
275
+ type: string;
276
+ name: string;
277
+ slug: string;
278
+ meta: IMeta;
279
+ customValues?: Props;
280
+ externalData?: Props;
281
+ content: IContentBlock[];
282
+ workingContent?: IContentBlock[];
283
+ committedContent?: IContentBlock[];
284
+ authorId?: string;
285
+ author: Author;
286
+ invalidBlocksTypes?: string[];
287
+ status: PageStatus;
288
+ editStatus: EditStatus;
289
+ isLocked: boolean;
290
+ tags: string[];
291
+ category?: string;
292
+ createdAt: string;
293
+ publishedAt?: string;
294
+ scheduledForPublishingOn?: string;
295
+ language: string;
296
+ translations: Translation[];
297
+ lastEditedBy: LastEditedBy;
298
+ };
299
+ /**
300
+ * Page fields (without content)
301
+ */
302
+ export type PageValues = Omit<Page, 'content'>;
303
+ /**
304
+ * A Page with all optional fields, used for the patch
305
+ */
306
+ export type PartialPage = Partial<Page>;
307
+ /**
308
+ * Page from a list (no content)
309
+ */
310
+ export type PageFromList = Omit<Page, 'content'>;
311
+ /**
312
+ * Page from a list with pagination
313
+ */
314
+ export type PagesFromListWithPagination = {
315
+ items: PageFromList[];
316
+ pagination: {
317
+ page: number;
318
+ pageSize: number;
319
+ totalItems: number;
320
+ totalPages: number;
321
+ };
322
+ };
323
+ /**
324
+ * The Author of a Page
325
+ */
326
+ export type Author = {
327
+ id: string;
328
+ email: string;
329
+ firstName: string;
330
+ lastName: string;
331
+ avatarUrl?: string;
332
+ company?: string;
333
+ };
334
+ export type BrickStory<T = Props> = {
335
+ id: string;
336
+ name: string;
337
+ showAsBrick?: boolean;
338
+ previewImageUrl?: string;
339
+ props: T;
340
+ };
341
+ type RepeaterItemDefault = IContentBlock | Omit<IContentBlock, 'id'> | Props;
342
+ export type RepeaterItems<T = RepeaterItemDefault> = Array<T>;
343
+ /**
344
+ * A Language for i18n
345
+ */
346
+ export type Language = {
347
+ code: string;
348
+ name: string;
349
+ };
350
+ /**
351
+ * Render function for local links (should use the app's Router)
352
+ */
353
+ interface LocalLinkProps {
354
+ href: string;
355
+ target?: string;
356
+ className?: string;
357
+ activeClassName?: string;
358
+ isAdmin?: boolean;
359
+ tabIndex?: number;
360
+ }
361
+ type LocalLinkPropsReal = React.PropsWithChildren<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LocalLinkProps> & LocalLinkProps>;
362
+ export type RenderLocalLink = ({ href, target, className, activeClassName, isAdmin, tabIndex, children, }: LocalLinkPropsReal) => React.ReactElement;
363
+ /**-
364
+ * The type of Text and RichText value
365
+ */
366
+ export type TextValue = Descendant[] | string;
367
+ /**
368
+ * Props of a content block
369
+ */
370
+ export type Props = {
371
+ [key: string]: any;
372
+ };
373
+ /**
374
+ * Options passed to the fetch function
375
+ */
376
+ export type FetchOptions = {
377
+ cache?: string;
378
+ next?: {
379
+ [key: string]: any;
380
+ };
381
+ };
382
+ /**
383
+ * Interface for the Schema of a Brick
384
+ */
385
+ export interface IBlockType<T = Props> {
386
+ name: string;
387
+ label: string;
388
+ getDefaultProps?: () => Partial<T>;
389
+ hideFromAddMenu?: boolean;
390
+ sideEditProps?: Array<ISideEditProp<T> | ISideGroup<T>>;
391
+ repeaterItems?: IRepeaterItem<T>[];
392
+ newItemMenuOpen?: boolean;
393
+ groupByRepeater?: boolean;
394
+ mapExternalDataToProps?: (externalData: Props, brickProps?: T) => Partial<T>;
395
+ getData?: (page: Page, brickProps?: T, args?: any) => Promise<Partial<T>>;
396
+ getExternalData?: (page: Page, brickProps?: T, args?: any) => Promise<Partial<T>>;
397
+ playgroundLinkUrl?: string;
398
+ playgroundLinkLabel?: string;
399
+ theme?: string;
400
+ category?: string;
401
+ tags?: string[];
402
+ previewImageUrl?: string;
403
+ previewIcon?: React.ReactElement;
404
+ stories?: BrickStory<Partial<T>>[];
405
+ astroInteractivity?: 'load' | {
406
+ load: true;
407
+ } | 'idle' | {
408
+ idle: true;
409
+ } | {
410
+ idle: {
411
+ timeout: number;
412
+ };
413
+ } | 'visible' | {
414
+ visible: true;
415
+ } | {
416
+ visible: {
417
+ rootMargin: string;
418
+ };
419
+ } | {
420
+ media: string;
421
+ } | {
422
+ only: string;
423
+ };
424
+ }
425
+ /**
426
+ * Item of a Repeater
427
+ */
428
+ export interface IRepeaterItem<T = any> {
429
+ name: string;
430
+ label?: string;
431
+ itemType?: string;
432
+ itemLabel?: string;
433
+ defaultOpen?: boolean;
434
+ min?: number;
435
+ max?: number;
436
+ getDefaultProps?: () => Props;
437
+ show?: (props: T, page?: Page, user?: User) => boolean;
438
+ items?: {
439
+ type: string;
440
+ label?: string;
441
+ min?: number;
442
+ max?: number;
443
+ getDefaultProps?: () => Props;
444
+ show?: (props: T, page?: Page, user?: User) => boolean;
445
+ }[];
446
+ }
447
+ /**
448
+ * The content of a block (instance of a Brick)
449
+ */
450
+ export interface IContentBlock {
451
+ id: string;
452
+ type: string;
453
+ props: Props;
454
+ locked?: boolean;
455
+ canAddAfter?: boolean;
456
+ canAddBefore?: boolean;
457
+ canEditContent?: boolean;
458
+ }
459
+ /**
460
+ * Option of a select sidebar prop
461
+ */
462
+ export type RepeatserItems<T = RepeaterItemDefault> = Array<T>;
463
+ export interface IOption<T = any> {
464
+ value: T;
465
+ label: string;
466
+ [otherProps: string]: unknown;
467
+ }
468
+ /**
469
+ * Interface for Props of a Custom sidebar component
470
+ */
471
+ export interface ICustomKnobProps {
472
+ id: string;
473
+ value: any;
474
+ onChange: any;
475
+ isValid: boolean;
476
+ errorMessage?: string;
477
+ }
478
+ /**
479
+ * Sidebar edit Props for a Page
480
+ */
481
+ export interface ISideEditPropPage<T = Props> {
482
+ name: string;
483
+ label: string;
484
+ type: SideEditPropType;
485
+ component?: React.FC<ICustomKnobProps>;
486
+ validate?: (value: any, props?: T) => boolean | string;
487
+ show?: (props: T, page?: Page, user?: User) => boolean;
488
+ helperText?: string;
489
+ textareaOptions?: {
490
+ height?: number;
491
+ };
492
+ imageOptions?: {
493
+ maxWidth?: number;
494
+ quality?: number;
495
+ aspectRatio?: number;
496
+ };
497
+ rangeOptions?: {
498
+ min?: number;
499
+ max?: number;
500
+ step?: number;
501
+ };
502
+ selectOptions?: {
503
+ options?: IOption[];
504
+ getOptions?: (props: Props) => IOption[] | Promise<IOption[]>;
505
+ display: OptionsDisplay;
506
+ };
507
+ autocompleteOptions?: {
508
+ placeholder?: string;
509
+ getOptions: (input: string, props: Props) => any[] | Promise<any[]>;
510
+ getKey: (option: any) => string | number;
511
+ getLabel: (option: any) => string;
512
+ renderOption?: ({ option, selected, focus, }: {
513
+ option: any;
514
+ selected: boolean;
515
+ focus: boolean;
516
+ }) => React.ReactElement;
517
+ debounceTime?: number;
518
+ getNoOptionsMessage?: (input?: string) => string;
519
+ };
520
+ iconSelectorOptions?: {
521
+ iconSets?: IconSets[];
522
+ };
523
+ relationshipOptions?: {
524
+ label?: string;
525
+ references: string;
526
+ multiple: boolean;
527
+ embedValues?: boolean;
528
+ };
529
+ }
530
+ /**
531
+ * Sidebar Edit Props
532
+ */
533
+ export interface ISideEditProp<T = Props> extends ISideEditPropPage<T> {
534
+ shouldRefreshText?: boolean;
535
+ shouldRefreshStyles?: boolean;
536
+ }
537
+ /**
538
+ * A collapsible Group of sidebar Props
539
+ */
540
+ export interface ISideGroup<T = Props> {
541
+ groupName: string;
542
+ defaultOpen?: boolean;
543
+ show?: (props: T, page?: Page, user?: User) => boolean;
544
+ props: ISideEditProp<T>[] | ISideEditPropPage<T>[];
545
+ }
546
+ /**
547
+ * Image Crop interface
548
+ */
549
+ export interface ICrop {
550
+ x: number;
551
+ y: number;
552
+ width: number;
553
+ height: number;
554
+ }
555
+ /**
556
+ * Image Transform interface
557
+ */
558
+ export interface ITransform {
559
+ rotate?: number;
560
+ flip?: {
561
+ horizontal: boolean;
562
+ vertical: boolean;
563
+ };
564
+ }
565
+ /**
566
+ * Image value interface
567
+ */
568
+ export interface IImageSource {
569
+ src: string;
570
+ srcSet?: string;
571
+ type?: string;
572
+ fallbackSrc?: string;
573
+ fallbackSrcSet?: string;
574
+ fallbackType?: string;
575
+ placeholderSrc?: string;
576
+ alt?: string;
577
+ seoName?: string;
578
+ width?: number;
579
+ height?: number;
580
+ highPriority?: boolean;
581
+ hashId?: string;
582
+ crop?: ICrop;
583
+ transform?: ITransform;
584
+ }
585
+ /**
586
+ * File value interface
587
+ */
588
+ export interface IFileSource {
589
+ name: string;
590
+ url: string;
591
+ size: number;
592
+ extension: string;
593
+ pagesNum: number;
594
+ title?: string | undefined;
595
+ alt?: string | undefined;
596
+ copyright?: string | undefined;
597
+ source?: string | undefined;
598
+ }
599
+ /**
600
+ * A Color for a Select sidebar prop
601
+ */
602
+ export interface IColor {
603
+ color: string;
604
+ [propName: string]: any;
605
+ }
606
+ export interface IBrickStory {
607
+ brickName: string;
608
+ storyName: string;
609
+ locked?: boolean;
610
+ canAddAfter?: boolean;
611
+ canAddBefore?: boolean;
612
+ }
613
+ /**
614
+ * TemplateSlot type
615
+ */
616
+ export type TemplateSlot = {
617
+ slotName: string;
618
+ label: string;
619
+ min?: number;
620
+ max?: number;
621
+ allowedBlockTypes?: string[];
622
+ excludedBlockTypes?: string[];
623
+ editable?: boolean;
624
+ getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
625
+ };
626
+ /**
627
+ * Page type
628
+ */
629
+ export interface IPageType {
630
+ name: string;
631
+ pluralName: string;
632
+ isEntity?: boolean;
633
+ allowedBlockTypes?: string[];
634
+ excludedBlockTypes?: string[];
635
+ defaultLocked?: boolean;
636
+ defaultStatus?: PageStatus;
637
+ defaultFeaturedImage?: string;
638
+ getDefaultContent?: () => (string | IBrickStory | IContentBlock)[];
639
+ customFields?: Array<ISideEditPropPage | ISideGroup>;
640
+ getExternalData?: (page: Page, args?: any) => Promise<Props>;
641
+ getDefaultMeta?: (page: PageFromList, externalData: Props) => Partial<IMeta>;
642
+ metaImageAspectRatio?: number;
643
+ categories?: ICategory[];
644
+ slugPrefix?: ISlugPrefix;
645
+ template?: Array<TemplateSlot>;
646
+ headlessView?: boolean;
647
+ }
648
+ /**
649
+ * Structure returned by the cleanBlocks function
650
+ */
651
+ export interface ICleanBlocks {
652
+ blocks: IContentBlock[];
653
+ invalidBlocksTypes: string[];
654
+ }
655
+ /**
656
+ * Responsive breakpoint for preview
657
+ */
658
+ export interface ResponsiveBreakpoint {
659
+ type: DeviceType;
660
+ width: number | string;
661
+ label: string;
662
+ }
663
+ /**
664
+ * Login UI customization
665
+ */
666
+ export interface LoginUI {
667
+ sideImage?: string;
668
+ logo?: string;
669
+ logoWidth?: number;
670
+ logoHeight?: number;
671
+ welcomeText?: string;
672
+ welcomeTextStyle?: React.CSSProperties;
673
+ }
674
+ /**
675
+ * MenuItem interface
676
+ */
677
+ export interface IMenuItem {
678
+ label: string;
679
+ path?: string;
680
+ }
681
+ /**
682
+ * The ReactBricks configuration
683
+ */
684
+ export interface ReactBricksConfig {
685
+ appId: string;
686
+ apiKey: string;
687
+ environment?: string;
688
+ bricks?: types.Brick<any>[] | types.Theme[];
689
+ pageTypes?: types.IPageType[];
690
+ logo?: string;
691
+ loginUI?: LoginUI;
692
+ contentClassName?: string;
693
+ defaultTheme?: string;
694
+ renderLocalLink: types.RenderLocalLink;
695
+ navigate: (path: string) => void;
696
+ loginPath?: string;
697
+ editorPath?: string;
698
+ mediaLibraryPath?: string;
699
+ playgroundPath?: string;
700
+ appSettingsPath?: string;
701
+ previewPath?: string;
702
+ getAdminMenu?: (args: {
703
+ isAdmin: boolean;
704
+ }) => IMenuItem[];
705
+ isDarkColorMode?: boolean;
706
+ toggleColorMode?: () => void;
707
+ useCssInJs?: boolean;
708
+ appRootElement: string | HTMLElement;
709
+ clickToEditSide?: ClickToEditSide;
710
+ customFields?: Array<ISideEditPropPage | ISideGroup>;
711
+ responsiveBreakpoints?: ResponsiveBreakpoint[];
712
+ enableAutoSave?: boolean;
713
+ disableSaveIfInvalidProps?: boolean;
714
+ enablePreview?: boolean;
715
+ blockIconsPosition?: BlockIconsPosition;
716
+ enablePreviewImage?: boolean;
717
+ enablePreviewIcon?: boolean;
718
+ enableUnsplash?: boolean;
719
+ unsplashApiKey?: string;
720
+ enableDefaultEmbedBrick?: boolean;
721
+ permissions?: Permissions;
722
+ allowAccentsInSlugs?: boolean;
723
+ warningIfLowBattery?: boolean;
724
+ rtlLanguages?: Array<string>;
725
+ }
726
+ /**
727
+ * The ReactBricks context
728
+ */
729
+ export interface IReactBricksContext {
730
+ version: string;
731
+ appId: string;
732
+ apiKey: string;
733
+ environment?: string;
734
+ bricks: Bricks;
735
+ themes: types.Theme[];
736
+ pageTypes: IPageType[];
737
+ logo: string;
738
+ loginUI: LoginUI;
739
+ contentClassName: string;
740
+ defaultTheme: string;
741
+ renderLocalLink: RenderLocalLink;
742
+ navigate: (path: string) => void;
743
+ loginPath: string;
744
+ editorPath: string;
745
+ mediaLibraryPath: string;
746
+ playgroundPath: string;
747
+ appSettingsPath: string;
748
+ previewPath: string;
749
+ getAdminMenu?: (args: {
750
+ isAdmin: boolean;
751
+ }) => IMenuItem[];
752
+ isDarkColorMode?: boolean;
753
+ toggleColorMode?: () => void;
754
+ useCssInJs?: boolean;
755
+ appRootElement: string | HTMLElement;
756
+ clickToEditSide?: ClickToEditSide;
757
+ customFields?: Array<ISideEditPropPage | ISideGroup>;
758
+ responsiveBreakpoints: ResponsiveBreakpoint[];
759
+ enableAutoSave: boolean;
760
+ disableSaveIfInvalidProps: boolean;
761
+ enablePreview: boolean;
762
+ browserSupport: {
763
+ webP: boolean;
764
+ lazyLoading: boolean;
765
+ };
766
+ blockIconsPosition: BlockIconsPosition;
767
+ enablePreviewImage: boolean;
768
+ enablePreviewIcon: boolean;
769
+ enableUnsplash: boolean;
770
+ unsplashApiKey?: string;
771
+ enableDefaultEmbedBrick: boolean;
772
+ permissions?: Permissions;
773
+ allowAccentsInSlugs: boolean;
774
+ warningIfLowBattery: boolean;
775
+ isRtlLanguage: ({ language }: {
776
+ language: string;
777
+ }) => boolean;
778
+ rtlLanguages: string[];
779
+ }
780
+ /**
781
+ * The current page in Admin
782
+ */
783
+ export interface ICurrentPage {
784
+ pageId: string;
785
+ language?: string;
786
+ }
787
+ /**
788
+ * The Admin context returned from useAdminContext
789
+ */
790
+ export interface IReadAdminContext {
791
+ isAdmin: boolean;
792
+ previewMode: boolean;
793
+ currentPage: ICurrentPage;
794
+ showRichTextModal: ShowRichTextModal;
795
+ }
796
+ /**
797
+ * Opengraph type
798
+ */
799
+ export type OpenGraphType = 'article' | 'website' | 'profile' | 'book' | 'video' | 'music';
800
+ /**
801
+ * OpenGraph data
802
+ */
803
+ export type OpenGraphData = {
804
+ url?: string;
805
+ type?: OpenGraphType;
806
+ title?: string;
807
+ description?: string;
808
+ image?: types.IImageSource;
809
+ };
810
+ /**
811
+ * Twitter card type
812
+ */
813
+ export type TwitterCardType = 'summary' | 'summary_large_image' | 'app' | 'player';
814
+ /**
815
+ * Data for Twitter card
816
+ */
817
+ export type TwitterCardData = {
818
+ card?: TwitterCardType;
819
+ site?: string;
820
+ creator?: string;
821
+ title?: string;
822
+ description?: string;
823
+ image?: types.IImageSource;
824
+ };
825
+ /**
826
+ * Meta Fields type
827
+ * */
828
+ export type MetaData = {
829
+ title?: string;
830
+ description?: string;
831
+ keywords?: string;
832
+ featuredImage?: string;
833
+ image?: IImageSource;
834
+ };
835
+ /**
836
+ * Meta fields on Page
837
+ */
838
+ export interface IMeta extends MetaData {
839
+ language?: string;
840
+ openGraph?: OpenGraphData;
841
+ twitterCard?: TwitterCardData;
842
+ schemaOrg?: SchemaOrgData;
843
+ }
844
+ /**
845
+ * Category on categories (pageTypes)
846
+ */
847
+ export interface ICategory {
848
+ category?: string;
849
+ }
850
+ /**
851
+ * A RichTextExt Plugin
852
+ */
853
+ export interface RichTextPlugin {
854
+ type: 'Mark' | 'Block' | 'List';
855
+ name: string;
856
+ isInline?: boolean;
857
+ itemName?: string;
858
+ label: string;
859
+ hotKey?: string;
860
+ renderElement?: (props: RenderElementProps) => React.ReactElement;
861
+ renderItemElement?: (props: RenderElementProps) => React.ReactElement;
862
+ renderLeaf?: (props: RenderLeafProps) => React.ReactElement;
863
+ toggle: (editor: Editor, plugins: RichTextPlugin[], showRichTextModal: types.ShowRichTextModal) => void;
864
+ button?: {
865
+ icon: React.ReactElement;
866
+ isActive: (editor: Editor) => boolean;
867
+ };
868
+ enhanceEditor?: (editor: Editor) => Editor;
869
+ }
870
+ /**
871
+ * Definition for a Mark plugin
872
+ */
873
+ export interface MarkPlugin {
874
+ name: string;
875
+ label?: string;
876
+ hotKey?: string;
877
+ render: (props: RenderLeafProps) => React.ReactElement;
878
+ icon?: React.ReactElement;
879
+ }
880
+ /**
881
+ * Constructor for a Mark plugin
882
+ */
883
+ export type MarkPluginConstructor = (markPlugin: MarkPlugin) => RichTextPlugin;
884
+ /**
885
+ * Definition for a Block plugin
886
+ */
887
+ export interface BlockPlugin {
888
+ name: string;
889
+ isInline?: boolean;
890
+ itemName?: string;
891
+ label?: string;
892
+ hotKey?: string;
893
+ render: (props: RenderElementProps) => React.ReactElement;
894
+ renderItem?: (props: RenderElementProps) => React.ReactElement;
895
+ icon?: React.ReactElement;
896
+ }
897
+ export type BlockWithModalPlugin = BlockPlugin & {
898
+ getDefaultProps?: () => Props;
899
+ renderAdmin?: (props: RenderElementProps) => React.ReactElement;
900
+ renderItemAdmin?: (props: RenderElementProps) => React.ReactElement;
901
+ pluginCustomFields: Array<types.ISideEditPropPage | types.ISideGroup>;
902
+ };
903
+ /**
904
+ * Constructor for a Block plugin
905
+ */
906
+ export type BlockPluginConstructor = (blockPlugin: BlockPlugin) => RichTextPlugin;
907
+ /**
908
+ * Constructor for a Block with Modal plugin
909
+ */
910
+ export type BlockWithModalPluginConstructor = (blockPlugin: BlockWithModalPlugin) => RichTextPlugin;
911
+ /**
912
+ * Icon
913
+ */
914
+ export type Icon = {
915
+ name: string;
916
+ svg: string;
917
+ url: string;
918
+ set: string;
919
+ };
920
+ export { };
921
+ }
922
+
923
+ declare function fetchPreviewPage({ token, config, fetchOptions, }: {
924
+ token: string;
925
+ config: types.ReactBricksConfig;
926
+ fetchOptions?: types.FetchOptions;
927
+ }): Promise<types.Page>;
928
+
929
+ declare function fetchPage({ slug, language, getExternalDataArgs, config, }: {
930
+ slug: string;
931
+ language?: string;
932
+ getExternalDataArgs?: any;
933
+ config: types.ReactBricksConfig;
934
+ fetchOptions?: types.FetchOptions;
935
+ }): Promise<types.Page | null>;
936
+ declare function fetchPage(slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[], getExternalDataArgs?: any): Promise<types.Page | null>;
937
+
938
+ declare function fetchPages<T extends boolean>(apiKey: string, { type, types, tag, language, page, pageSize, sort, filterBy, usePagination, }: {
939
+ type?: string;
940
+ types?: string[];
941
+ tag?: string;
942
+ language?: string;
943
+ page?: number;
944
+ pageSize?: number;
945
+ sort?: string;
946
+ filterBy?: {
947
+ [key: string]: any;
948
+ };
949
+ usePagination: T;
950
+ }): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
951
+ declare function fetchPages(apiKey: string, { type, types, tag, language, page, pageSize, filterBy, sort, }: {
952
+ type?: string;
953
+ types?: string[];
954
+ tag?: string;
955
+ language?: string;
956
+ page?: number;
957
+ pageSize?: number;
958
+ sort?: string;
959
+ filterBy?: {
960
+ [key: string]: any;
961
+ };
962
+ }): Promise<types.PageFromList[]>;
963
+ declare function fetchPages(apiKey: string): Promise<types.PageFromList[]>;
964
+ declare function fetchPages<T extends boolean>(options: {
965
+ type?: string;
966
+ types?: string[];
967
+ tag?: string;
968
+ language?: string;
969
+ page?: number;
970
+ pageSize?: number;
971
+ sort?: string;
972
+ filterBy?: {
973
+ [key: string]: any;
974
+ };
975
+ usePagination: T;
976
+ fetchExternalData?: boolean;
977
+ getExternalDataArgs?: any;
978
+ config: types.ReactBricksConfig;
979
+ fetchOptions?: types.FetchOptions;
980
+ }): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
981
+ declare function fetchPages<T extends boolean>(options: {
982
+ type?: string;
983
+ types?: string[];
984
+ tag?: string;
985
+ language?: string;
986
+ page?: number;
987
+ pageSize?: number;
988
+ sort?: string;
989
+ filterBy?: {
990
+ [key: string]: any;
991
+ };
992
+ fetchExternalData?: boolean;
993
+ getExternalDataArgs?: any;
994
+ config: types.ReactBricksConfig;
995
+ fetchOptions?: types.FetchOptions;
996
+ }): Promise<types.PageFromList[]>;
997
+
998
+ declare const fetchTags: (apiKey: string, page?: number, pageSize?: number, options?: {
999
+ q?: string;
1000
+ language?: string;
1001
+ }, fetchOptions?: types.FetchOptions) => Promise<{
1002
+ items: string[];
1003
+ pagination: {
1004
+ page: number;
1005
+ pageSize: number;
1006
+ totalItems: number;
1007
+ totalPages: number;
1008
+ };
1009
+ }>;
1010
+
1011
+ declare const ReactBricks: ({ children }: {
1012
+ children: React.ReactNode;
1013
+ }) => React.JSX.Element;
1014
+
1015
+ declare const _default: {
1016
+ serialize: (nodes: Node[]) => string;
1017
+ serializeLight: (nodes: any[]) => string | any[];
1018
+ deserialize: (input: string) => Descendant[];
1019
+ isText: (value: any) => boolean;
1020
+ isSlateContent: (value: any) => boolean;
1021
+ };
1022
+
1023
+ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks: types.Bricks) => types.Page;
1024
+
1025
+ declare function reactbricksIntegration(configPath: string): any;
1026
+
1027
+ export { _default as Plain, ReactBricks, cleanPage, fetchPage, fetchPreviewPage as fetchPagePreview, fetchPages, fetchTags, reactbricksIntegration as reactbricks, types };