react-bricks 4.0.0-beta.4 → 4.0.0-beta.5

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/react-bricks.d.ts CHANGED
@@ -1,12 +1,28 @@
1
1
  import * as React from 'react';
2
2
  import React__default from 'react';
3
- import { BaseEditor, Descendant, Editor as Editor$1, Node } from 'slate';
3
+ import { BaseEditor, Element, Descendant, Editor as Editor$1, Node } from 'slate';
4
4
  import { HistoryEditor } from 'slate-history';
5
5
  import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
6
6
  import * as react_query from 'react-query';
7
7
  import { UseQueryResult } from 'react-query';
8
8
  export { v4 as uuid } from 'uuid';
9
9
 
10
+ /**
11
+ * CustomElement for Slate
12
+ */
13
+ declare type CustomElement = {
14
+ type: string;
15
+ element?: Element;
16
+ children: CustomText[];
17
+ [key: string]: any;
18
+ };
19
+ /**
20
+ * CustomText for Slate
21
+ */
22
+ declare type CustomText = {
23
+ text?: string;
24
+ [key: string]: any;
25
+ };
10
26
  declare module 'slate' {
11
27
  interface CustomTypes {
12
28
  Editor: BaseEditor & ReactEditor & HistoryEditor;
@@ -304,14 +320,6 @@ declare namespace types {
304
320
  totalPages: number;
305
321
  };
306
322
  };
307
- export type PageWithTranslationsIdentifier = {
308
- id: string;
309
- name: string;
310
- language: string;
311
- key: string;
312
- slug: string;
313
- slugDefaultLanguage: string;
314
- };
315
323
  /**
316
324
  * The Author of a Page
317
325
  */
@@ -438,7 +446,7 @@ declare namespace types {
438
446
  type: SideEditPropType;
439
447
  component?: React__default.FC<ICustomKnobProps>;
440
448
  validate?: (value: any, props?: Props) => boolean | string;
441
- show?: (props: Props) => boolean;
449
+ show?: (props: Props, page: Page, user: User) => boolean;
442
450
  helperText?: string;
443
451
  textareaOptions?: {
444
452
  height?: number;
@@ -461,6 +469,7 @@ declare namespace types {
461
469
  label?: string;
462
470
  references: string;
463
471
  multiple: boolean;
472
+ embedValues?: boolean;
464
473
  };
465
474
  }
466
475
  /**
@@ -564,6 +573,12 @@ declare namespace types {
564
573
  getExternalData?: (page: Page, args?: any) => Promise<Props>;
565
574
  metaImageAspectRatio?: number;
566
575
  categories?: ICategory[];
576
+ slugPrefix?: {
577
+ default: string;
578
+ translations?: {
579
+ [key: string]: string;
580
+ };
581
+ };
567
582
  }
568
583
  /**
569
584
  * Structure returned by the cleanBlocks function
@@ -639,6 +654,7 @@ declare namespace types {
639
654
  unsplashApiKey?: string;
640
655
  enableDefaultEmbedBrick?: boolean;
641
656
  permissions?: Permissions;
657
+ allowAccentsInSlugs?: boolean;
642
658
  }
643
659
  /**
644
660
  * The ReactBricks context
@@ -687,6 +703,7 @@ declare namespace types {
687
703
  unsplashApiKey?: string;
688
704
  enableDefaultEmbedBrick: boolean;
689
705
  permissions?: Permissions;
706
+ allowAccentsInSlugs: boolean;
690
707
  }
691
708
  /**
692
709
  * The current page in Admin
@@ -703,6 +720,35 @@ declare namespace types {
703
720
  previewMode: boolean;
704
721
  currentPage: ICurrentPage;
705
722
  }
723
+ /**
724
+ * Opengraph type
725
+ */
726
+ export type OpenGraphType = 'article' | 'website' | 'profile' | 'book' | 'video' | 'music';
727
+ /**
728
+ * OpenGraph data
729
+ */
730
+ export type OpenGraphData = {
731
+ url: string;
732
+ type: OpenGraphType;
733
+ title: string;
734
+ description: string;
735
+ image: types.IImageSource;
736
+ };
737
+ /**
738
+ * Twitter card type
739
+ */
740
+ export type TwitterCardType = 'summary' | 'summary_large_image' | 'app' | 'player';
741
+ /**
742
+ * Data for Twitter card
743
+ */
744
+ export type TwitterCardData = {
745
+ card: TwitterCardType;
746
+ site: string;
747
+ creator: string;
748
+ title: string;
749
+ description: string;
750
+ image: types.IImageSource;
751
+ };
706
752
  /**
707
753
  * Meta Fields type
708
754
  * */
@@ -954,12 +1000,15 @@ declare const blockPluginConstructor: types.BlockPluginConstructor;
954
1000
 
955
1001
  declare const markPluginConstructor: types.MarkPluginConstructor;
956
1002
 
1003
+ /**
1004
+ * Props for PageViewer
1005
+ */
1006
+ declare const Preview: React.FC;
1007
+
957
1008
  declare const ReactBricks: React.FC<types.ReactBricksConfig & {
958
1009
  children: React.ReactNode;
959
1010
  }>;
960
1011
 
961
- declare const ReactBricksContext: React.Context<types.IReactBricksContext>;
962
-
963
1012
  /**
964
1013
  * Props for PageViewer
965
1014
  */
@@ -969,15 +1018,6 @@ interface PageViewerProps {
969
1018
  }
970
1019
  declare const PageViewer: React.FC<PageViewerProps>;
971
1020
 
972
- /**
973
- * Props for PageViewer
974
- */
975
- declare const Preview: React.FC;
976
-
977
- declare const Meta: React.FC<types.IMeta>;
978
-
979
- declare const renderMeta: React.FC<types.Page>;
980
-
981
1021
  interface JsonLdProps {
982
1022
  type: types.SchemaOrgType;
983
1023
  values: types.SchemaOrgData;
@@ -986,6 +1026,10 @@ declare const JsonLd: React__default.FC<JsonLdProps>;
986
1026
 
987
1027
  declare const renderJsonLd: React__default.FC<types.Page>;
988
1028
 
1029
+ declare const Meta: React.FC<types.IMeta>;
1030
+
1031
+ declare const renderMeta: React.FC<types.Page>;
1032
+
989
1033
  declare const usePage$1: (pageId: string, language?: string) => react_query.UseQueryResult<types.Page, unknown>;
990
1034
 
991
1035
  declare const usePage: (slug: string, language?: string) => react_query.UseQueryResult<types.Page, unknown>;
@@ -1071,40 +1115,71 @@ declare const useTagsPublic: (page?: number, pageSize?: number, options?: {
1071
1115
 
1072
1116
  declare const useReactBricksContext: () => types.IReactBricksContext;
1073
1117
 
1074
- declare const fetchPage: (slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[], getExternalDataArgs?: any) => Promise<types.Page>;
1118
+ declare function fetchPage({ slug, language, getExternalDataArgs, config, }: {
1119
+ slug: string;
1120
+ language?: string;
1121
+ getExternalDataArgs?: any;
1122
+ config: types.ReactBricksConfig;
1123
+ }): Promise<types.Page>;
1124
+ declare function fetchPage(slug: string, apiKey: string, language?: string, pageTypes?: types.IPageType[], getExternalDataArgs?: any): Promise<types.Page>;
1075
1125
 
1076
- /**
1077
- * Values returned from fetchPages
1078
- */
1079
- interface FetchPagesType {
1080
- <T extends boolean>(apiKey: string, { type, types, tag, language, page, pageSize, sort, filterBy, usePagination, }: {
1081
- type?: string;
1082
- types?: string[];
1083
- tag?: string;
1084
- language?: string;
1085
- page?: number;
1086
- pageSize?: number;
1087
- sort?: string;
1088
- filterBy?: {
1089
- [key: string]: any;
1090
- };
1091
- usePagination: T;
1092
- }): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
1093
- (apiKey: string, { type, types, tag, language, page, pageSize, filterBy, sort, }: {
1094
- type?: string;
1095
- types?: string[];
1096
- tag?: string;
1097
- language?: string;
1098
- page?: number;
1099
- pageSize?: number;
1100
- sort?: string;
1101
- filterBy?: {
1102
- [key: string]: any;
1103
- };
1104
- }): Promise<types.PageFromList[]>;
1105
- (apiKey: string): Promise<types.PageFromList[]>;
1106
- }
1107
- declare const fetchPages: FetchPagesType;
1126
+ declare function fetchPages<T extends boolean>(apiKey: string, { type, types, tag, language, page, pageSize, sort, filterBy, usePagination, }: {
1127
+ type?: string;
1128
+ types?: string[];
1129
+ tag?: string;
1130
+ language?: string;
1131
+ page?: number;
1132
+ pageSize?: number;
1133
+ sort?: string;
1134
+ filterBy?: {
1135
+ [key: string]: any;
1136
+ };
1137
+ usePagination: T;
1138
+ }): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
1139
+ declare function fetchPages(apiKey: string, { type, types, tag, language, page, pageSize, filterBy, sort, }: {
1140
+ type?: string;
1141
+ types?: string[];
1142
+ tag?: string;
1143
+ language?: string;
1144
+ page?: number;
1145
+ pageSize?: number;
1146
+ sort?: string;
1147
+ filterBy?: {
1148
+ [key: string]: any;
1149
+ };
1150
+ }): Promise<types.PageFromList[]>;
1151
+ declare function fetchPages(apiKey: string): Promise<types.PageFromList[]>;
1152
+ declare function fetchPages<T extends boolean>(options: {
1153
+ type?: string;
1154
+ types?: string[];
1155
+ tag?: string;
1156
+ language?: string;
1157
+ page?: number;
1158
+ pageSize?: number;
1159
+ sort?: string;
1160
+ filterBy?: {
1161
+ [key: string]: any;
1162
+ };
1163
+ usePagination: T;
1164
+ fetchExternalData?: boolean;
1165
+ getExternalDataArgs?: any;
1166
+ config: types.ReactBricksConfig;
1167
+ }): Promise<T extends true ? types.PagesFromListWithPagination : types.PageFromList[]>;
1168
+ declare function fetchPages<T extends boolean>(options: {
1169
+ type?: string;
1170
+ types?: string[];
1171
+ tag?: string;
1172
+ language?: string;
1173
+ page?: number;
1174
+ pageSize?: number;
1175
+ sort?: string;
1176
+ filterBy?: {
1177
+ [key: string]: any;
1178
+ };
1179
+ fetchExternalData?: boolean;
1180
+ getExternalDataArgs?: any;
1181
+ config: types.ReactBricksConfig;
1182
+ }): Promise<types.PageFromList[]>;
1108
1183
 
1109
1184
  declare const fetchTags: (apiKey: string, page?: number, pageSize?: number, options?: {
1110
1185
  q?: string;
@@ -1119,10 +1194,6 @@ declare const fetchTags: (apiKey: string, page?: number, pageSize?: number, opti
1119
1194
  };
1120
1195
  }>;
1121
1196
 
1122
- declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks: types.Bricks) => types.Page;
1123
-
1124
- declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
1125
-
1126
1197
  declare const _default: {
1127
1198
  serialize: (nodes: Node[]) => string;
1128
1199
  serializeLight: (nodes: any[]) => string | any[];
@@ -1131,6 +1202,10 @@ declare const _default: {
1131
1202
  isSlateContent: (value: any) => boolean;
1132
1203
  };
1133
1204
 
1205
+ declare const cleanPage: (page: types.Page, pageTypes: types.IPageType[], bricks: types.Bricks) => types.Page;
1206
+
1207
+ declare const getPagePlainText: (blocks: types.IContentBlock[]) => string[];
1208
+
1134
1209
  declare const plugin$d: types.RichTextPlugin;
1135
1210
 
1136
1211
  declare const plugin$c: types.RichTextPlugin;
@@ -1233,12 +1308,16 @@ interface MediaLibraryProps {
1233
1308
  }
1234
1309
  declare const MediaLibrary: React__default.FC<MediaLibraryProps>;
1235
1310
 
1311
+ /**
1312
+ * Props of Admin component
1313
+ */
1314
+ interface AdminProps extends React.PropsWithChildren {
1315
+ isLogin?: boolean;
1316
+ isPublicDesignSystem?: boolean;
1317
+ designSystemTitle?: string;
1318
+ }
1236
1319
  declare const Admin: React.FC<AdminProps>;
1237
1320
 
1238
- declare const AdminContext: React.Context<types.IAdminContext>;
1239
-
1240
- declare const Header: React.FC<HeaderProps>;
1241
-
1242
1321
  declare const Login: React.FC;
1243
1322
 
1244
1323
  declare const useAuth: () => {
@@ -1300,4 +1379,4 @@ declare const useAuth: () => {
1300
1379
  logoutUser: () => void;
1301
1380
  };
1302
1381
 
1303
- export { Admin, AdminContext, AppSettings, Editor, File$1 as File, Header, Image$1 as Image, JsonLd, Link, Login, MediaLibrary, Meta, PageViewer, _default as Plain, Playground, Preview, ReactBricks, ReactBricksContext, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, blockPluginConstructor, cleanPage, fetchPage, fetchPages, fetchTags, getPagePlainText, markPluginConstructor, index as plugins, renderJsonLd, renderMeta, types, useAdminContext, useAuth, usePage$1 as usePage, usePage as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useTagsPublic, useVisualEdit };
1382
+ export { Admin, AppSettings, Editor, File$1 as File, Image$1 as Image, JsonLd, Link, Login, MediaLibrary, Meta, PageViewer, _default as Plain, Playground, Preview, ReactBricks, Repeater, CompatibleRichText as RichText, RichText as RichTextExt, Text, blockPluginConstructor, cleanPage, fetchPage, fetchPages, fetchTags, getPagePlainText, markPluginConstructor, index as plugins, renderJsonLd, renderMeta, types, useAdminContext, useAuth, usePage$1 as usePage, usePage as usePagePublic, usePageValues, usePages, usePagesPublic, useReactBricksContext, useTagsPublic, useVisualEdit };