react-bricks 4.7.0-beta.0 → 4.7.0-beta.1

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