@sitecore-content-sdk/react 2.0.0-canary.1 → 2.0.0-canary.10

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 (113) hide show
  1. package/dist/cjs/components/Date.js +13 -11
  2. package/dist/cjs/components/DefaultEmptyFieldEditingComponents.js +2 -1
  3. package/dist/cjs/components/DesignLibrary/DesignLibrary.js +5 -9
  4. package/dist/cjs/components/DesignLibrary/DesignLibraryClientEvents.js +14 -6
  5. package/dist/cjs/components/DesignLibrary/DesignLibraryServer.js +11 -5
  6. package/dist/cjs/components/EditingScripts.js +2 -2
  7. package/dist/cjs/components/ErrorBoundary.js +10 -6
  8. package/dist/cjs/components/File.js +3 -1
  9. package/dist/cjs/components/Form.js +12 -5
  10. package/dist/cjs/components/Image.js +12 -9
  11. package/dist/cjs/components/Link.js +19 -46
  12. package/dist/cjs/components/Placeholder/AppPlaceholder.js +56 -58
  13. package/dist/cjs/components/Placeholder/ClientComponentWrapper.js +5 -9
  14. package/dist/cjs/components/Placeholder/Placeholder.js +21 -93
  15. package/dist/cjs/components/Placeholder/index.js +1 -2
  16. package/dist/cjs/components/Placeholder/placeholder-utils.js +7 -35
  17. package/dist/cjs/components/RichText.js +18 -49
  18. package/dist/cjs/components/SitecoreProvider.js +81 -33
  19. package/dist/cjs/components/Text.js +12 -8
  20. package/dist/cjs/enhancers/withAppPlaceholder.js +6 -0
  21. package/dist/cjs/enhancers/withDatasourceCheck.js +4 -3
  22. package/dist/cjs/enhancers/withEditorChromes.js +50 -15
  23. package/dist/cjs/enhancers/withEmptyFieldEditingComponent.js +8 -38
  24. package/dist/cjs/enhancers/withFieldMetadata.js +9 -39
  25. package/dist/cjs/enhancers/withPlaceholder.js +16 -52
  26. package/dist/cjs/enhancers/withSitecore.js +5 -29
  27. package/dist/cjs/index.js +9 -7
  28. package/dist/cjs/search/utils.js +2 -2
  29. package/dist/esm/components/Date.js +13 -11
  30. package/dist/esm/components/DefaultEmptyFieldEditingComponents.js +2 -1
  31. package/dist/esm/components/DesignLibrary/DesignLibrary.js +5 -9
  32. package/dist/esm/components/DesignLibrary/DesignLibraryClientEvents.js +13 -5
  33. package/dist/esm/components/DesignLibrary/DesignLibraryServer.js +11 -5
  34. package/dist/esm/components/EditingScripts.js +2 -2
  35. package/dist/esm/components/ErrorBoundary.js +10 -6
  36. package/dist/esm/components/File.js +3 -1
  37. package/dist/esm/components/Form.js +11 -4
  38. package/dist/esm/components/Image.js +12 -9
  39. package/dist/esm/components/Link.js +16 -13
  40. package/dist/esm/components/Placeholder/AppPlaceholder.js +57 -59
  41. package/dist/esm/components/Placeholder/ClientComponentWrapper.js +4 -8
  42. package/dist/esm/components/Placeholder/Placeholder.js +20 -89
  43. package/dist/esm/components/Placeholder/index.js +1 -1
  44. package/dist/esm/components/Placeholder/placeholder-utils.js +5 -32
  45. package/dist/esm/components/RichText.js +15 -16
  46. package/dist/esm/components/SitecoreProvider.js +46 -32
  47. package/dist/esm/components/Text.js +12 -8
  48. package/dist/esm/enhancers/withAppPlaceholder.js +6 -0
  49. package/dist/esm/enhancers/withDatasourceCheck.js +3 -2
  50. package/dist/esm/enhancers/withEditorChromes.js +17 -12
  51. package/dist/esm/enhancers/withEmptyFieldEditingComponent.js +5 -5
  52. package/dist/esm/enhancers/withFieldMetadata.js +6 -6
  53. package/dist/esm/enhancers/withPlaceholder.js +15 -52
  54. package/dist/esm/enhancers/withSitecore.js +6 -29
  55. package/dist/esm/index.js +4 -3
  56. package/dist/esm/search/utils.js +1 -1
  57. package/package.json +5 -5
  58. package/types/components/Date.d.ts.map +1 -1
  59. package/types/components/DefaultEmptyFieldEditingComponents.d.ts.map +1 -1
  60. package/types/components/DesignLibrary/DesignLibrary.d.ts +0 -2
  61. package/types/components/DesignLibrary/DesignLibrary.d.ts.map +1 -1
  62. package/types/components/DesignLibrary/DesignLibraryClientEvents.d.ts.map +1 -1
  63. package/types/components/DesignLibrary/DesignLibraryServer.d.ts.map +1 -1
  64. package/types/components/DesignLibrary/models.d.ts +9 -3
  65. package/types/components/DesignLibrary/models.d.ts.map +1 -1
  66. package/types/components/EditingScripts.d.ts +2 -2
  67. package/types/components/EditingScripts.d.ts.map +1 -1
  68. package/types/components/ErrorBoundary.d.ts +2 -2
  69. package/types/components/ErrorBoundary.d.ts.map +1 -1
  70. package/types/components/File.d.ts.map +1 -1
  71. package/types/components/Form.d.ts.map +1 -1
  72. package/types/components/Image.d.ts.map +1 -1
  73. package/types/components/Link.d.ts.map +1 -1
  74. package/types/components/Placeholder/AppPlaceholder.d.ts +1 -1
  75. package/types/components/Placeholder/AppPlaceholder.d.ts.map +1 -1
  76. package/types/components/Placeholder/ClientComponentWrapper.d.ts +2 -2
  77. package/types/components/Placeholder/ClientComponentWrapper.d.ts.map +1 -1
  78. package/types/components/Placeholder/Placeholder.d.ts +4 -19
  79. package/types/components/Placeholder/Placeholder.d.ts.map +1 -1
  80. package/types/components/Placeholder/index.d.ts +1 -1
  81. package/types/components/Placeholder/index.d.ts.map +1 -1
  82. package/types/components/Placeholder/models.d.ts +35 -58
  83. package/types/components/Placeholder/models.d.ts.map +1 -1
  84. package/types/components/Placeholder/placeholder-utils.d.ts +5 -13
  85. package/types/components/Placeholder/placeholder-utils.d.ts.map +1 -1
  86. package/types/components/RichText.d.ts +2 -0
  87. package/types/components/RichText.d.ts.map +1 -1
  88. package/types/components/SitecoreProvider.d.ts +43 -13
  89. package/types/components/SitecoreProvider.d.ts.map +1 -1
  90. package/types/components/Text.d.ts.map +1 -1
  91. package/types/enhancers/withAppPlaceholder.d.ts +6 -0
  92. package/types/enhancers/withAppPlaceholder.d.ts.map +1 -1
  93. package/types/enhancers/withDatasourceCheck.d.ts.map +1 -1
  94. package/types/enhancers/withEditorChromes.d.ts +4 -1
  95. package/types/enhancers/withEditorChromes.d.ts.map +1 -1
  96. package/types/enhancers/withEmptyFieldEditingComponent.d.ts +5 -3
  97. package/types/enhancers/withEmptyFieldEditingComponent.d.ts.map +1 -1
  98. package/types/enhancers/withFieldMetadata.d.ts +4 -2
  99. package/types/enhancers/withFieldMetadata.d.ts.map +1 -1
  100. package/types/enhancers/withPlaceholder.d.ts +14 -32
  101. package/types/enhancers/withPlaceholder.d.ts.map +1 -1
  102. package/types/enhancers/withSitecore.d.ts +8 -50
  103. package/types/enhancers/withSitecore.d.ts.map +1 -1
  104. package/types/index.d.ts +4 -3
  105. package/types/index.d.ts.map +1 -1
  106. package/dist/cjs/enhancers/withComponentMap.js +0 -24
  107. package/dist/cjs/enhancers/withLoadImportMap.js +0 -62
  108. package/dist/esm/enhancers/withComponentMap.js +0 -18
  109. package/dist/esm/enhancers/withLoadImportMap.js +0 -25
  110. package/types/enhancers/withComponentMap.d.ts +0 -13
  111. package/types/enhancers/withComponentMap.d.ts.map +0 -1
  112. package/types/enhancers/withLoadImportMap.d.ts +0 -28
  113. package/types/enhancers/withLoadImportMap.d.ts.map +0 -1
@@ -6,21 +6,11 @@ export type { ComponentType };
6
6
  type ErrorComponentProps = {
7
7
  [prop: string]: unknown;
8
8
  };
9
- /** Provided for the component which represents rendering data */
10
- export type ComponentProps = {
11
- [key: string]: unknown;
12
- rendering: ComponentRendering;
13
- };
14
- export interface AppComponentProps {
15
- fields: {
16
- [name: string]: Field | Item | Item[];
17
- };
18
- params: {
19
- [name: string]: string;
20
- };
21
- rendering: ComponentRendering;
22
- }
23
- export interface BasePlaceholderProps {
9
+ /**
10
+ * Base Placeholder props
11
+ * @public
12
+ */
13
+ export interface PlaceholderProps {
24
14
  /** Name of the placeholder to render. */
25
15
  name: string;
26
16
  /** Rendering data to be used when rendering the placeholder. */
@@ -57,14 +47,17 @@ export interface BasePlaceholderProps {
57
47
  * Page data.
58
48
  * This data is passed by the SitecoreProvider.
59
49
  */
60
- page: Page;
50
+ page?: Page;
61
51
  /**
62
52
  * The message that gets displayed while component is loading
63
53
  */
64
54
  componentLoadingMessage?: string;
65
55
  /**
66
- * If true, disables Suspense in ErrorBoundary for the placeholder.
67
- * @default false
56
+ * @deprecated The `disableSuspense` prop is deprecated and will be removed in version 3.0.0.
57
+ * The default value is set to `true` to avoid forcing Suspense usage across all components which could negatively impact performance metrics. Suspense can now be enabled explicitly when needed.
58
+ *
59
+ * If `false`, enables Suspense in ErrorBoundary for the components rendered by placeholder.
60
+ * @default true
68
61
  */
69
62
  disableSuspense?: boolean;
70
63
  /**
@@ -76,66 +69,50 @@ export interface BasePlaceholderProps {
76
69
  * Mutually exclusive with `render`.
77
70
  */
78
71
  renderEach?: (component: React.ReactNode, index: number) => React.ReactNode;
79
- }
80
- /**
81
- * The interface for the Placeholder component props.
82
- * @public
83
- */
84
- export interface PlaceholderProps extends BasePlaceholderProps {
85
- [key: string]: unknown;
86
72
  /**
87
- * Component Map will be used to map Sitecore component names to app implementation
88
- * When rendered within a <SitecoreProvider> component, defaults to the context componentMap.
89
- * When rendered as a server placeholder, this prop must be provided. This prop is not used in AppPlaceholder.
73
+ * Render props function that enables control over the rendering of the components in the placeholder.
74
+ * Useful for techniques like wrapping each child in a wrapper component.
90
75
  */
91
- componentMap?: ComponentMap;
76
+ render?: (components: React.ReactNode[], data: ComponentRendering[], props: PlaceholderProps) => React.ReactNode;
92
77
  /**
93
78
  * Modify final props of component (before render) provided by rendering data.
94
79
  * Can be used in case when you need to insert additional data into the component.
95
- * @param {ComponentProps} componentProps component props to be modified
96
- * @returns {ComponentProps} modified or initial props
80
+ * @param {ChildComponentProps} componentProps component props to be modified
81
+ * @returns {ChildComponentProps} modified or initial props
97
82
  */
98
- modifyComponentProps?: (componentProps: ComponentProps) => ComponentProps;
83
+ modifyComponentProps?: (componentProps: ChildComponentProps) => ChildComponentProps;
99
84
  /**
100
- * Render props function that enables control over the rendering of the components in the placeholder.
101
- * Useful for techniques like wrapping each child in a wrapper component.
85
+ * An alternative to `modifyComponentProps` that allows passing additional props to the component without modifying the CSDK Placeholder props from Sitecore.
86
+ * These props will be merged into the result of modifyComponentProps if you use both
87
+ * Make sure to not include non-serializable props here in RSC server context https://react.dev/reference/rsc/use-server#serializable-parameters-and-return-values
102
88
  */
103
- render?: (components: React.ReactNode[], data: ComponentRendering[], props: PlaceholderProps) => React.ReactNode;
104
- }
105
- /**
106
- * The interface for the AppPlaceholder component props.
107
- * @public
108
- */
109
- export interface AppPlaceholderProps extends BasePlaceholderProps {
89
+ passThroughComponentProps?: {
90
+ [key: string]: unknown;
91
+ };
110
92
  /**
111
93
  * Component Map will be used to map Sitecore component names to app implementation
112
94
  * When rendered within a <SitecoreProvider> component, defaults to the context componentMap.
113
95
  * When rendered as a server placeholder, this prop must be provided. This prop is not used in AppPlaceholder.
114
96
  */
115
- componentMap: ComponentMap;
116
- /**
117
- * Modify final props of component (before render) provided by rendering data.
118
- * Can be used in case when you need to insert additional data into the component.
119
- * @param {AppComponentProps} componentProps component props to be modified
120
- * @returns {AppComponentProps} modified or initial props
121
- */
122
- modifyComponentProps?: (componentProps: AppComponentProps) => AppComponentProps;
123
- /**
124
- * Render props function that enables control over the rendering of the components in the placeholder.
125
- * Useful for techniques like wrapping each child in a wrapper component.
126
- */
127
- render?: (components: React.ReactNode[], data: ComponentRendering[], props: AppPlaceholderProps) => React.ReactNode;
97
+ componentMap?: ComponentMap;
128
98
  }
129
- export type RenderedProps = Omit<PlaceholderProps, 'fields' | 'params' | 'name'> & {
99
+ /**
100
+ * The interface for the AppPlaceholder server-side component props.
101
+ * @public
102
+ */
103
+ export type AppPlaceholderProps = Omit<PlaceholderProps, 'componentMap' | 'page'> & Required<Pick<PlaceholderProps, 'componentMap' | 'page'>>;
104
+ export type RenderedProps = ChildComponentProps & {
130
105
  key: string;
106
+ };
107
+ export interface ChildComponentProps {
131
108
  fields: {
132
- [field: string]: unknown;
109
+ [name: string]: Field | Item | Item[];
133
110
  };
134
111
  params: {
135
- [param: string]: unknown;
112
+ [name: string]: string;
136
113
  };
137
114
  rendering: ComponentRendering;
138
- };
115
+ }
139
116
  export interface ComponentForRendering {
140
117
  component: React.ComponentType<any>;
141
118
  isEmpty: boolean;
@@ -1 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teData } from '@sitecore-content-sdk/content/layout';
4
- import { AppComponentProps, BasePlaceholderProps, ComponentForRendering, PlaceholderProps, RenderedProps } from './models';
4
+ import { ChildComponentProps, PlaceholderProps, ComponentForRendering } from './models';
5
5
  /**
6
- * Get the renderings for the specified placeholder from the rendering data.
6
+ * Get the renderings for the specified placeholder from the rendering layout data.
7
7
  * @param {ComponentRendering | RouteData } rendering rendering data
8
8
  * @param {string} name placeholder name
9
9
  * @param {boolean} isEditing whether components should be rendered in editing mode
@@ -26,20 +26,12 @@ export declare const getSXAParams: (rendering: ComponentRendering) => "" | {
26
26
  */
27
27
  export declare const renderEmptyPlaceholder: (node: React.ReactNode | React.ReactElement[]) => React.JSX.Element;
28
28
  /**
29
- * Get component props to be passed to the rendered component.
30
- * @param {PlaceholderProps} placeholderProps current placeholder props
31
- * @param {ComponentRendering} componentRendering rendering to be rendered
32
- * @param {string} renderingKey unique key to pass over to rendering props
33
- * @returns {RenderedProps} props to be passed to the rendered component
34
- */
35
- export declare const getRenderedComponentProps: (placeholderProps: PlaceholderProps, componentRendering: ComponentRendering, renderingKey: string) => RenderedProps;
36
- /**
37
- * Merge placeholder and component field and params content props.
38
- * @param {BasePlaceholderProps} placeholderProps placeholder props
29
+ * Merge specific placeholder props with component field and params content props.
30
+ * @param {PlaceholderProps} placeholderProps placeholder props
39
31
  * @param {ComponentRendering} componentRendering component rendering
40
32
  * @returns {ComponentProps} merged props
41
33
  */
42
- export declare function getAppComponentProps<T extends BasePlaceholderProps>(placeholderProps: T, componentRendering: ComponentRendering): AppComponentProps;
34
+ export declare function getChildComponentProps<T extends PlaceholderProps>(placeholderProps: T, componentRendering: ComponentRendering): ChildComponentProps;
43
35
  /**
44
36
  * Get component implemenation from the component map based on the rendering definition.
45
37
  * @param {ComponentRendering} renderingDefinition rendering data
@@ -1 +1 @@
1
- {"version":3,"file":"placeholder-utils.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/placeholder-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAuD,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGV,MAAM,sCAAsC,CAAC;AAa9C,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAElB;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,kBAAkB,GAAG,SAAS,EACzC,MAAM,MAAM,EACZ,WAAW,OAAO,yFA2CnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,kBAAkB;;CAUzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE,sBAElF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,kBAAkB,gBAAgB,EAClC,oBAAoB,kBAAkB,EACtC,cAAc,MAAM,KACnB,aAeF,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,oBAAoB,EACjE,gBAAgB,EAAE,CAAC,EACnB,kBAAkB,EAAE,kBAAkB,GACrC,iBAAiB,CAYnB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,qBAAqB,kBAAkB,EACvC,iBAAiB,MAAM,EACvB,eAAe,YAAY,EAC3B,2BAA2B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,EAC1D,4BAA4B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,KAC1D,qBA0GF,CAAC"}
1
+ {"version":3,"file":"placeholder-utils.d.ts","sourceRoot":"","sources":["../../../src/components/Placeholder/placeholder-utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAuD,MAAM,gBAAgB,CAAC;AACnG,OAAO,EACL,kBAAkB,EAClB,SAAS,EAGV,MAAM,sCAAsC,CAAC;AAa9C,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,WAAW,kBAAkB,GAAG,SAAS,EACzC,MAAM,MAAM,EACZ,WAAW,OAAO,yFA2CnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,WAAW,kBAAkB;;CAUzD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE,sBAElF,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,gBAAgB,EAC/D,gBAAgB,EAAE,CAAC,EACnB,kBAAkB,EAAE,kBAAkB,GACrC,mBAAmB,CAYrB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,qBAAqB,kBAAkB,EACvC,iBAAiB,MAAM,EACvB,eAAe,YAAY,EAC3B,2BAA2B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,EAC1D,4BAA4B,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,EAAE,KAC1D,qBA0GF,CAAC"}
@@ -21,6 +21,8 @@ export interface RichTextProps extends EditableFieldProps<RichTextProps> {
21
21
  * @default <div />
22
22
  */
23
23
  tag?: string;
24
+ /** Ref forwarded to the root element. */
25
+ ref?: React.Ref<HTMLElement>;
24
26
  }
25
27
  /**
26
28
  * The RichText component.
@@ -1 +1 @@
1
- {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/components/RichText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmC,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,kBAAkB,CAAC,aAAa,CAAC;IACtE,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,gCAAgC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA2B5C,CAAC"}
1
+ {"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/components/RichText.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,kBAAkB,CAAC,aAAa,CAAC;IACtE,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,gCAAgC;IAChC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B;AAsBD;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAI5C,CAAC"}
@@ -32,16 +32,34 @@ export interface SitecoreProviderState {
32
32
  * @param {Page} value New page value.
33
33
  * @returns {void}
34
34
  */
35
- setPage: (value: Page) => void;
35
+ setPage?: (value: Page) => void;
36
36
  /**
37
- * The current page.
37
+ * The page data.
38
38
  */
39
39
  page: Page;
40
+ /**
41
+ * The dynamic import for import map to be used in variant generation mode.
42
+ */
43
+ loadImportMap: () => Promise<ImportMapImport>;
44
+ /**
45
+ * The component map to use for rendering components.
46
+ */
47
+ componentMap: ComponentMap;
40
48
  /**
41
49
  * The API configuration defined in the `SitecoreConfig`.
42
50
  */
43
51
  api?: SitecoreProviderProps['api'];
44
52
  }
53
+ /**
54
+ * The options for the useSitecore hook.
55
+ * @public
56
+ */
57
+ export interface UseSitecoreOptions {
58
+ /**
59
+ * If set to true, the `updateContext` method will be injected into the component props.
60
+ */
61
+ updatable?: boolean;
62
+ }
45
63
  /**
46
64
  * The context for the SitecoreProvider component.
47
65
  * @public
@@ -51,17 +69,29 @@ export declare const ComponentMapReactContext: React.Context<ComponentMap>;
51
69
  export declare const ImportMapReactContext: React.Context<(() => Promise<ImportMapImport>) | undefined>;
52
70
  /**
53
71
  * The SitecoreProvider component.
72
+ * @param {SitecoreProviderProps} props - The props for the SitecoreProvider component.
73
+ * @param {SitecoreProviderProps['api']} props.api - The API configuration.
74
+ * @param {SitecoreProviderProps['page']} props.page - The page data.
75
+ * @param {SitecoreProviderProps['componentMap']} props.componentMap - The component map.
76
+ * @param {SitecoreProviderProps['loadImportMap']} props.loadImportMap - The function to load the import map.
77
+ * @param {React.ReactNode} props.children - The children to render.
78
+ * @returns {React.ReactNode} The SitecoreProvider component.
54
79
  * @public
55
80
  */
56
- export declare class SitecoreProvider extends React.Component<SitecoreProviderProps, SitecoreProviderState> {
57
- static displayName: string;
58
- constructor(props: SitecoreProviderProps);
59
- componentDidUpdate(prevProps: SitecoreProviderProps): void;
60
- /**
61
- * Update page state.
62
- * @param {Page} value New page value
63
- */
64
- setPage: (value: Page) => void;
65
- render(): React.JSX.Element;
66
- }
81
+ export declare const SitecoreProvider: {
82
+ (props: SitecoreProviderProps): React.JSX.Element;
83
+ displayName: string;
84
+ };
85
+ /**
86
+ * This hook grants acсess to the current Sitecore page and api.
87
+ * @param {UseSitecoreOptions} [options] hook options
88
+ * @example
89
+ * const EditMode = () => {
90
+ * const { page } = useSitecore();
91
+ * return <span>Edit Mode is {page.mode.isEditing ? 'active' : 'inactive'}</span>
92
+ * }
93
+ * @returns {SitecoreProviderState} The current Sitecore context, including the page and api.
94
+ * @public
95
+ */
96
+ export declare function useSitecore(options?: UseSitecoreOptions): SitecoreProviderState;
67
97
  //# sourceMappingURL=SitecoreProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SitecoreProvider.d.ts","sourceRoot":"","sources":["../../src/components/SitecoreProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,aAAa,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;OAEG;IACH,GAAG,CAAC,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;CACpC;AAED;;;GAGG;A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AAC,SAAS,CAiEpC,CAAC"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,CAAC,SAAS,CAAC;IAC9D,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAkED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAIpC,CAAC"}
@@ -12,5 +12,11 @@ export type WrapperProps = {
12
12
  page: Page;
13
13
  componentMap: ComponentMap;
14
14
  };
15
+ /**
16
+ * Provides a slot-like functionality by wrapping a component and rendering placeholders defined in the layout data.
17
+ * @param {ComponentType<T>} Component - The component to be wrapped around placeholders.
18
+ * @returns {React.ReactNode} A new component that renders the original component with placeholders.
19
+ * @public
20
+ */
15
21
  export declare const withAppPlaceholder: <T extends ComponentProps, W extends T & WrapperProps>(Component: ComponentType<T>) => (props: W) => React.JSX.Element;
16
22
  //# sourceMappingURL=withAppPlaceholder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withAppPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withAppPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,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B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,CAAC,GAAG,YAAY,EACrF,WAAW,aAAa,CAAC,CAAC,CAAC,MAEnB,OAAO,CAAC,sBAoBjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"withDatasourceCheck.d.ts","sourceRoot":"","sources":["../../src/enhancers/withDatasourceCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,mBAAmB,QAAO,GAAG,CAAC,OAI1C,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;CAC3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,0BAA0B,IAC/B,cAAc,SAAS,wBAAwB,EACpF,WAAW,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MAEV,OAAO,cAAc,wBAc5D"}
1
+ {"version":3,"file":"withDatasourceCheck.d.ts","sourceRoot":"","sources":["../../src/enhancers/withDatasourceCheck.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,eAAO,MAAM,mBAAmB,QAAO,GAAG,CAAC,OAI1C,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;CAC3E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,0BAA0B,IAC/B,cAAc,SAAS,wBAAwB,EACpF,WAAW,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MAEtC,OAAO,cAAc,wBAchC"}
@@ -4,5 +4,8 @@ import React from 'react';
4
4
  * @param {React.ComponentClass<unknown> | React.FC<unknown>} WrappedComponent - The component to wrap.
5
5
  * @public
6
6
  */
7
- export declare const withEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) => React.ComponentClass;
7
+ export declare const withEditorChromes: (WrappedComponent: React.ComponentClass<unknown> | React.FC<unknown>) => {
8
+ (props: Record<string, unknown>): React.JSX.Element;
9
+ displayName: string;
10
+ };
8
11
  //# sourceMappingURL=withEditorChromes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withEditorChromes.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEditorChromes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,KAehD,KAAK,CAAC,cAC1B,CAAC"}
1
+ {"version":3,"file":"withEditorChromes.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEditorChromes.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAGhE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,kBAAkB,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC;YAE1C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;CAoBjD,CAAC"}
@@ -9,7 +9,7 @@ export interface WithEmptyFieldEditingComponentOptions {
9
9
  */
10
10
  defaultEmptyFieldEditingComponent: React.FC;
11
11
  /**
12
- * 'true' if forward reference is needed
12
+ * 'true' if the ref prop should be explicitly accepted and forwarded
13
13
  */
14
14
  isForwardRef?: boolean;
15
15
  }
@@ -21,9 +21,11 @@ interface WithEmptyFieldEditingComponentProps<Props> {
21
21
  /**
22
22
  * Returns the passed field component or default component in case field value is empty and edit mode is 'metadata'
23
23
  * @param {ComponentType<FieldComponentProps>} FieldComponent the field component
24
- * @param {WithEmptyFieldEditingComponentProps} options the options of the HOC;
24
+ * @param {WithEmptyFieldEditingComponentOptions} options the options of the HOC;
25
25
  * @public
26
26
  */
27
- export declare function withEmptyFieldEditingComponent<FieldComponentProps extends WithEmptyFieldEditingComponentProps<FieldComponentProps>, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, options: WithEmptyFieldEditingComponentOptions): React.ForwardRefExoticComponent<React.PropsWithoutRef<FieldComponentProps> & React.RefAttributes<RefElementType>> | ((props: FieldComponentProps) => React.JSX.Element);
27
+ export declare function withEmptyFieldEditingComponent<FieldComponentProps extends WithEmptyFieldEditingComponentProps<FieldComponentProps>, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, options: WithEmptyFieldEditingComponentOptions): (props: FieldComponentProps & {
28
+ ref?: React.Ref<RefElementType>;
29
+ }) => React.JSX.Element;
28
30
  export {};
29
31
  //# sourceMappingURL=withEmptyFieldEditingComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withEmptyFieldEditingComponent.d.ts","sourceRoot":"","sources":["../../src/enhancers/withEmptyFieldEditingComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,KAAK,EAEL,aAAa,EACd,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;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c,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;CAC5E;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,mBAAmB,SAAS,mCAAmC,CAAC,mBAAmB,CAAC,EACpF,cAAc,GAAG,WAAW,EAE5B,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAClD,OAAO,EAAE,qCAAqC,WA2B7B,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,uBAgB3E"}
@@ -10,9 +10,11 @@ interface WithMetadataProps {
10
10
  /**
11
11
  * Wraps the field component with metadata markup intended to be used for chromes hydration in Pages
12
12
  * @param {ComponentType<FieldComponentProps>} FieldComponent the field component
13
- * @param {boolean} isForwardRef set to 'true' if forward reference is needed
13
+ * @param {boolean} isForwardRef set to 'true' if the ref prop should be explicitly accepted and forwarded
14
14
  * @public
15
15
  */
16
- export declare function withFieldMetadata<FieldComponentProps extends WithMetadataProps, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, isForwardRef?: boolean): React.ForwardRefExoticComponent<React.PropsWithoutRef<FieldComponentProps> & React.RefAttributes<RefElementType>> | ((props: FieldComponentProps) => React.JSX.Element);
16
+ export declare function withFieldMetadata<FieldComponentProps extends WithMetadataProps, RefElementType = HTMLElement>(FieldComponent: ComponentType<FieldComponentProps>, isForwardRef?: boolean): (props: FieldComponentProps & {
17
+ ref?: React.Ref<RefElementType>;
18
+ }) => React.JSX.Element;
17
19
  export {};
18
20
  //# sourceMappingURL=withFieldMetadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withFieldMetadata.d.ts","sourceRoot":"","sources":["../../src/enhancers/withFieldMetadata.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGzD,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACvC,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,mBAAmB,SAAS,iBAAiB,EAC7C,cAAc,GAAG,WAAW,EAC5B,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,YAAY,UAAQ,gIAkBzD,mBAAmB,wBAcnC"}
1
+ {"version":3,"file":"withFieldMetadata.d.ts","sourceRoot":"","sources":["../../src/enhancers/withFieldMetadata.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,UAAU,iBAAiB;IACzB,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;KACvC,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,mBAAmB,SAAS,iBAAiB,EAC7C,cAAc,GAAG,WAAW,EAC5B,cAAc,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAAE,YAAY,UAAQ,WAEvD,mBAAmB,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,uBA8B3E"}
@@ -1,37 +1,19 @@
1
1
  import React from 'react';
2
- import { ComponentRendering, RouteData } from '@sitecore-content-sdk/content/layout';
3
- import { PlaceholderProps } from '../components/Placeholder';
4
- export interface WithPlaceholderOptions {
5
- /**
6
- * Function to map incoming placeholder props into rendering data to use for the placeholder data.
7
- * Normally in a Content SDK component, props.rendering is passed the component data, and that is the default.
8
- * However, if your component data is in a different prop, like say 'route' in a sample app,
9
- * this lets you map that.
10
- */
11
- resolvePlaceholderDataFromProps?: (props: unknown) => ComponentRendering | RouteData;
12
- /**
13
- * Function to alter the placeholder props from within the HOC. Enables the props to be
14
- * transformed before being used by the placeholder/HOC, for example to customize the
15
- * error or missing component display
16
- */
17
- propsTransformer?: (props: PlaceholderProps) => PlaceholderProps;
18
- }
19
- export interface PlaceholderToPropMapping {
20
- /**
21
- * The name of the placeholder this component will expose
22
- */
23
- placeholder: string;
24
- /**
25
- * The name of the prop on your wrapped component that you would like the placeholder data injected on
26
- */
27
- prop: string;
28
- }
29
- export type WithPlaceholderSpec = (string | PlaceholderToPropMapping) | (string | PlaceholderToPropMapping)[];
2
+ import { ComponentType } from 'react';
3
+ import { ComponentRendering } from '@sitecore-content-sdk/content/layout';
4
+ import { Page } from '@sitecore-content-sdk/content/client';
5
+ import { ComponentMap } from '../components/sharedTypes';
6
+ import { ComponentProps } from './withAppPlaceholder';
7
+ export type WrapperProps = {
8
+ rendering: ComponentRendering;
9
+ page?: Page;
10
+ componentMap?: ComponentMap;
11
+ };
30
12
  /**
31
- * HOC to provide client-side placeholder functionality to a component.
32
- * @param {WithPlaceholderSpec} placeholders
33
- * @param {WithPlaceholderOptions} [options]
13
+ * Provides a slot-like functionality by wrapping a component in client/SSR context and rendering placeholders defined in the layout data.
14
+ * @param {ComponentType<T>} Component - The component to be wrapped around placeholders.
15
+ * @returns {React.ReactNode} A new component that renders the original component with placeholders.
34
16
  * @public
35
17
  */
36
- export declare function withPlaceholder(placeholders: WithPlaceholderSpec, options?: WithPlaceholderOptions): (WrappedComponent: React.ComponentClass<PlaceholderProps> | React.FunctionComponent<PlaceholderProps>) => (props: import("@sitecore-content-sdk/core/tools").EnhancedOmit<PlaceholderProps, keyof import("./withSitecore").WithSitecoreProps>) => React.JSX.Element;
18
+ export declare const withPlaceholder: <T extends ComponentProps, W extends T & WrapperProps>(Component: ComponentType<T>) => (props: W) => React.JSX.Element;
37
19
  //# sourceMappingURL=withPlaceholder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withPlaceholder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGrF,OAAO,EAEL,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,+BAA+B,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,kBAAkB,GAAG,SAAS,CAAC;IACrF;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,gBAAgB,CAAC;CAClE;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,GAC3B,CAAC,MAAM,GAAG,wBAAwB,CAAC,GACnC,CAAC,MAAM,GAAG,wBAAwB,CAAC,EAAE,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,mBAAmB,EACjC,OAAO,CAAC,EAAE,sBAAsB,IAG9B,kBACI,KAAK,CAAC,cAAc,CAAC,gBAAgB,CAAC,GACtC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,+JAmEhD"}
1
+ {"version":3,"file":"withPlaceholder.d.ts","sourceRoot":"","sources":["../../src/enhancers/withPlaceholder.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,kBAAkB,CAAC;IAC9B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,CAAC,GAAG,YAAY,EAClF,WAAW,aAAa,CAAC,CAAC,CAAC,MAEnB,OAAO,CAAC,sBAmBjB,CAAC"}
@@ -1,63 +1,21 @@
1
1
  import React from 'react';
2
2
  import { EnhancedOmit } from '@sitecore-content-sdk/core/tools';
3
- import { SitecoreProviderState } from '../components/SitecoreProvider';
4
- import { Page } from '@sitecore-content-sdk/content/client';
3
+ import { SitecoreProviderState, UseSitecoreOptions } from '../components/SitecoreProvider';
5
4
  /**
6
- * The options for the withSitecore HOC.
5
+ * The props that HOC will inject into the wrapped component — the full Sitecore context state.
7
6
  * @public
8
7
  */
9
- export interface WithSitecoreOptions {
10
- /**
11
- * If set to true, the `updateContext` method will be injected into the component props.
12
- */
13
- updatable?: boolean;
14
- }
8
+ export type WithSitecoreProps = SitecoreProviderState;
15
9
  /**
16
- * The props that HOC will inject.
17
- * @public
18
- */
19
- export interface WithSitecoreProps {
20
- /**
21
- * The current page context.
22
- */
23
- page: Page;
24
- /**
25
- * The API configuration defined in the `SitecoreConfig`.
26
- */
27
- api?: SitecoreProviderState['api'];
28
- /**
29
- * Method to update the page. This is only available if `updatable` is set to true.
30
- * @param {Page} value New page value.
31
- * @returns {void}
32
- */
33
- updatePage?: ((value: Page) => void) | false;
34
- }
35
- /**
36
- * The type of the props that HOC will receive.
10
+ * The type of the props that the HOC-wrapped component will receive (injected props omitted).
37
11
  * @public
38
12
  */
39
13
  export type WithSitecoreHocProps<ComponentProps> = EnhancedOmit<ComponentProps, keyof WithSitecoreProps>;
40
14
  /**
41
- * @param {WithSitecoreProviderOptions} [options]
42
- * @public
43
- */
44
- export declare function withSitecore(options?: WithSitecoreOptions): <ComponentProps extends WithSitecoreProps>(Component: React.ComponentType<ComponentProps>) => (props: WithSitecoreHocProps<ComponentProps>) => React.JSX.Element;
45
- /**
46
- * This hook grants acсess to the current Sitecore page and api.
47
- * @param {WithSitecoreOptions} [options] hook options
48
- * @example
49
- * const EditMode = () => {
50
- * const { page } = useSitecore();
51
- * return <span>Edit Mode is {page.mode.isEditing ? 'active' : 'inactive'}</span>
52
- * }
53
- * @example
54
- * const EditMode = () => {
55
- * const { page, updatePage } = useSitecore({ updatable: true });
56
- * const onClick = () => updatePage({ itemId: '123' });
57
- * return <span onClick={onClick}>Item id is {page.itemId}</span>
58
- * }
59
- * @returns {object} { api, page, updatePage }
15
+ * @deprecated `useSitecore` hook is a better practice for consuming Sitecore context in components
16
+ * @param {UseSitecoreOptions} [options] - Options for whether return page context update method alongside the rest of context
17
+ * @returns A higher-order component that injects Sitecore context into the wrapped component.
60
18
  * @public
61
19
  */
62
- export declare function useSitecore(options?: WithSitecoreOptions): WithSitecoreProps;
20
+ export declare function withSitecore(options?: UseSitecoreOptions): <ComponentProps extends Partial<SitecoreProviderState> & Pick<SitecoreProviderState, "page">>(Component: React.ComponentType<ComponentProps>) => (props: WithSitecoreHocProps<ComponentProps>) => React.JSX.Element;
63
21
  //# sourceMappingURL=withSitecore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"withSitecore.d.ts","sourceRoot":"","sources":["../../src/enhancers/withSitecore.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAEL,qBAAqB,EACtB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAG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AAC,aAAa,CAAC,cAAc,CAAC,MACT,OAAO,oBAAoB,CAAC,cAAc,CAAC,uBAcnF"}
package/types/index.d.ts CHANGED
@@ -17,13 +17,14 @@ export { DesignLibrary, DesignLibraryApp } from './components/DesignLibrary';
17
17
  export {} from './components/FEaaS/BYOCComponent';
18
18
  export { Link, LinkField, LinkFieldValue, LinkProps } from './components/Link';
19
19
  export { File, FileField } from './components/File';
20
- export { SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, } from './components/SitecoreProvider';
21
- export { withSitecore, useSitecore, WithSitecoreOptions, WithSitecoreProps, WithSitecoreHocProps, } from './enhancers/withSitecore';
20
+ export { SitecoreProvider, SitecoreProviderState, SitecoreProviderReactContext, useSitecore, } from './components/SitecoreProvider';
22
21
  export { withEditorChromes } from './enhancers/withEditorChromes';
23
- export { withPlaceholder } from './enhancers/withPlaceholder';
22
+ export { withSitecore } from './enhancers/withSitecore';
24
23
  export { withDatasourceCheck } from './enhancers/withDatasourceCheck';
25
24
  export { withFieldMetadata } from './enhancers/withFieldMetadata';
26
25
  export { withEmptyFieldEditingComponent } from './enhancers/withEmptyFieldEditingComponent';
26
+ export { withAppPlaceholder } from './enhancers/withAppPlaceholder';
27
+ export { withPlaceholder } from './enhancers/withPlaceholder';
27
28
  export { EditingScripts } from './components/EditingScripts';
28
29
  export { DefaultEmptyFieldEditingComponentText, DefaultEmptyFieldEditingComponentImage, } from './components/DefaultEmptyFieldEditingComponents';
29
30
  export { ClientEditingChromesUpdate } from './components/ClientEditingChromesUpdate';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AACh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AAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.withComponentMap = withComponentMap;
7
- const react_1 = __importDefault(require("react"));
8
- const SitecoreProvider_1 = require("../components/SitecoreProvider");
9
- const react_2 = require("react");
10
- /**
11
- * @param {React.ComponentClass<T> | React.FC<T>} Component
12
- */
13
- function withComponentMap(Component) {
14
- /**
15
- * @param {T} props - props to pass to the wrapped component
16
- * @returns {JSX.Element} - the rendered component
17
- */
18
- function WithComponentMap(props) {
19
- const context = (0, react_2.useContext)(SitecoreProvider_1.ComponentMapReactContext);
20
- return react_1.default.createElement(Component, Object.assign({}, props, { componentMap: props.componentMap || context }));
21
- }
22
- WithComponentMap.displayName = `withComponentMap(${Component.displayName || Component.name || 'Anonymous'})`;
23
- return WithComponentMap;
24
- }