@shopgate/engage 7.32.0-beta.3 → 7.32.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.
Files changed (166) hide show
  1. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
  2. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  3. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +23 -1
  4. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
  5. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
  6. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
  7. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +6 -0
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  9. package/components/Badge/Badge.d.ts +30 -0
  10. package/components/Badge/Badge.d.ts.map +1 -0
  11. package/components/Badge/Badge.js +48 -0
  12. package/components/Badge/index.d.ts +3 -0
  13. package/components/Badge/index.d.ts.map +1 -0
  14. package/components/Badge/index.js +1 -0
  15. package/components/Badge/spec.d.ts +2 -0
  16. package/components/Badge/spec.d.ts.map +1 -0
  17. package/components/Badge/spec.js +75 -0
  18. package/components/View/components/Content/index.d.ts.map +1 -1
  19. package/components/View/components/Content/index.js +4 -1
  20. package/components/index.d.ts +1 -0
  21. package/components/index.d.ts.map +1 -1
  22. package/components/index.js +2 -1
  23. package/core/hooks/useLocalStorage.d.ts +8 -0
  24. package/core/hooks/useLocalStorage.d.ts.map +1 -1
  25. package/core/hooks/useLocalStorage.js +22 -15
  26. package/core/initialization/fetchSettings.d.ts +12 -0
  27. package/core/initialization/fetchSettings.d.ts.map +1 -0
  28. package/core/initialization/fetchSettings.js +134 -0
  29. package/core/initialization/index.d.ts +33 -2
  30. package/core/initialization/index.d.ts.map +1 -1
  31. package/core/initialization/index.js +25 -103
  32. package/package.json +9 -9
  33. package/page/components/NotFound.d.ts +7 -0
  34. package/page/components/NotFound.d.ts.map +1 -0
  35. package/page/components/NotFound.js +1 -2
  36. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
  37. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
  38. package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
  39. package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
  40. package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
  41. package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
  42. package/page/components/WidgetRichText/index.d.ts +2 -0
  43. package/page/components/WidgetRichText/index.d.ts.map +1 -0
  44. package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
  45. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
  46. package/page/components/WidgetVideo/WidgetVideo.js +33 -39
  47. package/page/components/WidgetVideo/index.d.ts +2 -0
  48. package/page/components/WidgetVideo/index.d.ts.map +1 -0
  49. package/page/components/Widgets/Overlay.d.ts +17 -0
  50. package/page/components/Widgets/Overlay.d.ts.map +1 -0
  51. package/page/components/Widgets/Overlay.js +24 -38
  52. package/page/components/Widgets/Tooltip.d.ts +20 -0
  53. package/page/components/Widgets/Tooltip.d.ts.map +1 -0
  54. package/page/components/Widgets/Tooltip.js +6 -10
  55. package/page/components/Widgets/Widget.d.ts +32 -0
  56. package/page/components/Widgets/Widget.d.ts.map +1 -0
  57. package/page/components/Widgets/Widget.js +7 -18
  58. package/page/components/Widgets/WidgetContext.d.ts +32 -38
  59. package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
  60. package/page/components/Widgets/WidgetContext.js +2 -8
  61. package/page/components/Widgets/WidgetProvider.d.ts +25 -0
  62. package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
  63. package/page/components/Widgets/WidgetProvider.js +5 -12
  64. package/page/components/Widgets/Widgets.d.ts +16 -0
  65. package/page/components/Widgets/Widgets.d.ts.map +1 -0
  66. package/page/components/Widgets/Widgets.js +5 -12
  67. package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
  68. package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
  69. package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
  70. package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
  71. package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
  72. package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
  73. package/page/components/Widgets/constants.d.ts +5 -0
  74. package/page/components/Widgets/constants.d.ts.map +1 -0
  75. package/page/components/Widgets/constants.js +3 -1
  76. package/page/components/Widgets/events.d.ts +38 -0
  77. package/page/components/Widgets/events.d.ts.map +1 -0
  78. package/page/components/Widgets/events.js +8 -12
  79. package/page/components/Widgets/helpers.d.ts +50 -0
  80. package/page/components/Widgets/helpers.d.ts.map +1 -0
  81. package/page/components/Widgets/helpers.js +8 -13
  82. package/page/components/Widgets/hooks.d.ts +13 -0
  83. package/page/components/Widgets/hooks.d.ts.map +1 -0
  84. package/page/components/Widgets/hooks.js +13 -11
  85. package/page/components/Widgets/index.d.ts +3 -0
  86. package/page/components/Widgets/index.d.ts.map +1 -0
  87. package/page/components/Widgets/types.d.ts +111 -113
  88. package/page/components/Widgets/types.d.ts.map +1 -0
  89. package/page/components/Widgets/types.js +1 -0
  90. package/page/components/index.d.ts +5 -0
  91. package/page/components/index.d.ts.map +1 -0
  92. package/page/constants/actionTypes.d.ts +4 -0
  93. package/page/constants/actionTypes.d.ts.map +1 -0
  94. package/page/constants/index.d.ts +25 -0
  95. package/page/constants/index.d.ts.map +1 -0
  96. package/page/helpers/index.d.ts +67 -62
  97. package/page/helpers/index.d.ts.map +1 -0
  98. package/page/helpers/index.js +24 -25
  99. package/page/hooks/index.d.ts +54 -53
  100. package/page/hooks/index.d.ts.map +1 -0
  101. package/page/hooks/index.js +20 -15
  102. package/page/selectors/index.d.ts +32 -0
  103. package/page/selectors/index.d.ts.map +1 -0
  104. package/page/widgets/Video/Video.d.ts +6 -0
  105. package/page/widgets/Video/Video.d.ts.map +1 -0
  106. package/page/widgets/Video/Video.js +0 -2
  107. package/page/widgets/Video/hooks.d.ts +53 -0
  108. package/page/widgets/Video/hooks.d.ts.map +1 -0
  109. package/page/widgets/Video/hooks.js +4 -12
  110. package/page/widgets/Video/index.d.ts +2 -0
  111. package/page/widgets/Video/index.d.ts.map +1 -0
  112. package/product/components/Description/index.js +0 -2
  113. package/product/components/ProductCard/index.js +1 -0
  114. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +1 -1
  115. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +10 -0
  116. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +1 -0
  117. package/product/components/ProductGrid/components/Item/index.js +0 -1
  118. package/product/components/ProductGrid/components/Layout/index.js +17 -3
  119. package/product/components/ProductGrid/constants.d.ts +2 -0
  120. package/product/components/ProductGrid/constants.d.ts.map +1 -0
  121. package/product/components/ProductGrid/constants.js +1 -0
  122. package/product/components/ProductGrid/hooks.d.ts +18 -0
  123. package/product/components/ProductGrid/hooks.d.ts.map +1 -0
  124. package/product/components/ProductGrid/hooks.js +49 -0
  125. package/product/components/ProductGrid/index.js +3 -6
  126. package/product/components/ProductGrid/spec.js +3 -0
  127. package/product/components/ProductList/components/Layout/index.js +8 -20
  128. package/settings/reducers/appSettings.d.ts.map +1 -1
  129. package/settings/reducers/appSettings.js +8 -0
  130. package/settings/selectors/appSettings.d.ts +8 -0
  131. package/settings/selectors/appSettings.d.ts.map +1 -1
  132. package/settings/selectors/appSettings.js +6 -1
  133. package/settings/types/appSettings.d.ts +21 -0
  134. package/settings/types/appSettings.d.ts.map +1 -1
  135. package/styles/helpers/index.d.ts +1 -0
  136. package/styles/helpers/index.js +1 -0
  137. package/styles/helpers/loadThemeCss.d.ts +14 -0
  138. package/styles/helpers/loadThemeCss.d.ts.map +1 -0
  139. package/styles/helpers/loadThemeCss.js +112 -0
  140. package/styles/index.d.ts +1 -1
  141. package/styles/index.d.ts.map +1 -1
  142. package/styles/reset/root.js +1 -1
  143. package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
  144. package/styles/theme/createDefaultThemeOptions/index.js +12 -1
  145. package/styles/theme/createTheme/createComponents.types.d.ts +22 -0
  146. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  147. package/styles/theme/createTheme/createComponents.types.js +23 -1
  148. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  149. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +4 -1
  150. package/styles/theme/createTheme/index.d.ts +1 -0
  151. package/styles/theme/createTheme/index.d.ts.map +1 -1
  152. package/styles/theme/createTheme/index.js +2 -0
  153. package/styles/theme/createTheme/types.d.ts +2 -2
  154. package/styles/theme/createTheme/types.d.ts.map +1 -1
  155. package/styles/theme/createTheme/types.js +2 -3
  156. package/styles/theme/hooks/useColorScheme.d.ts +4 -3
  157. package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
  158. package/styles/theme/hooks/useColorScheme.js +4 -3
  159. package/styles/theme/index.d.ts +1 -1
  160. package/styles/theme/index.d.ts.map +1 -1
  161. package/styles/theme/providers/ColorSchemeContext.d.ts +19 -0
  162. package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
  163. package/styles/theme/providers/ColorSchemeContext.js +6 -0
  164. package/styles/theme/providers/ThemeProvider.d.ts +2 -12
  165. package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
  166. package/styles/theme/providers/ThemeProvider.js +32 -8
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Whether to consider vertical margins when calculating the overlay position.
3
+ */
4
+ export declare const CONSIDER_CONTAINER_MARGINS_ON_SCROLL_DEFAULT = false;
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,4CAA4C,QAAQ,CAAC"}
@@ -1,2 +1,4 @@
1
- // Whether to consider vertical margins when calculating the overlay position.
1
+ /**
2
+ * Whether to consider vertical margins when calculating the overlay position.
3
+ */
2
4
  export const CONSIDER_CONTAINER_MARGINS_ON_SCROLL_DEFAULT = false;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Names of the events that are dispatched in the context of widget preview iframe communication.
3
+ */
4
+ export type WidgetPreviewEventName = 'highlight-widget' | 'widget-clicked' | 'set-active-widget-id';
5
+ /**
6
+ * Detail payload of a widget preview event.
7
+ */
8
+ export interface WidgetPreviewEventDetail {
9
+ /**
10
+ * The code of the widget related to the event.
11
+ */
12
+ widgetCode: string;
13
+ /**
14
+ * Optional payload data related to the event.
15
+ */
16
+ payload?: unknown;
17
+ }
18
+ /**
19
+ * Handler for a widget preview event.
20
+ */
21
+ export type WidgetPreviewEventHandler = (event: CustomEvent<WidgetPreviewEventDetail>) => void;
22
+ /**
23
+ * Hook to listen for widget preview events.
24
+ * These events are dispatched in the context of iFrame communication at the widget preview.
25
+ * @param eventName Name of the listened event
26
+ * @param handler A callback function to handle the event
27
+ */
28
+ export declare const useWidgetPreviewEvent: (eventName: WidgetPreviewEventName, handler: WidgetPreviewEventHandler) => void;
29
+ /**
30
+ * Dispatches widget preview related events.
31
+ * Used to trigger iFrame postMessage events to the parent window or to react on incoming
32
+ * postMessage events from the parent window.
33
+ * @param eventName Name of the event to dispatch
34
+ * @param widgetCode Code of the widget to dispatch the event for
35
+ * @param payload Optional payload to include with the event
36
+ */
37
+ export declare const dispatchWidgetPreviewEvent: (eventName: WidgetPreviewEventName, widgetCode: string, payload?: unknown) => void;
38
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/events.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,sBAAsB,CAAC;AAEpG;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,wBAAwB,CAAC,KAAK,IAAI,CAAC;AAE/F;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,sBAAsB,EACjC,SAAS,yBAAyB,SASnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,GACrC,WAAW,sBAAsB,EACjC,YAAY,MAAM,EAClB,UAAS,OAAc,SAUxB,CAAC"}
@@ -1,26 +1,22 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
3
  /**
4
- * @typedef {"highlight-widget"|"widget-clicked"|"set-active-widget-id"} WidgetPreviewEventName
4
+ * Names of the events that are dispatched in the context of widget preview iframe communication.
5
5
  */
6
6
 
7
7
  /**
8
- * @typedef {Object} WidgetPreviewEventDetail
9
- * @property {string} widgetCode The code of the widget related to the event.
10
- * @property {any} [payload] Optional payload data related to the event.
8
+ * Detail payload of a widget preview event.
11
9
  */
12
10
 
13
11
  /**
14
- * @callback WidgetPreviewEventHandler
15
- * @param {CustomEvent<WidgetPreviewEventDetail>} event The custom event dispatched for the widget
16
- * preview.
12
+ * Handler for a widget preview event.
17
13
  */
18
14
 
19
15
  /**
20
16
  * Hook to listen for widget preview events.
21
17
  * These events are dispatched in the context of iFrame communication at the widget preview.
22
- * @param {WidgetPreviewEventName} eventName Name of the listened event
23
- * @param {WidgetPreviewEventHandler} handler A callback function to handle the event
18
+ * @param eventName Name of the listened event
19
+ * @param handler A callback function to handle the event
24
20
  */
25
21
  export const useWidgetPreviewEvent = (eventName, handler) => {
26
22
  useEffect(() => {
@@ -35,9 +31,9 @@ export const useWidgetPreviewEvent = (eventName, handler) => {
35
31
  * Dispatches widget preview related events.
36
32
  * Used to trigger iFrame postMessage events to the parent window or to react on incoming
37
33
  * postMessage events from the parent window.
38
- * @param {WidgetPreviewEventName} eventName Name of the event to dispatch
39
- * @param {string} widgetCode Code of the widget to dispatch the event for
40
- * @param {Object} [payload] Optional payload to include with the event
34
+ * @param eventName Name of the event to dispatch
35
+ * @param widgetCode Code of the widget to dispatch the event for
36
+ * @param payload Optional payload to include with the event
41
37
  */
42
38
  export const dispatchWidgetPreviewEvent = (eventName, widgetCode, payload = null) => {
43
39
  const event = new CustomEvent(`widget-preview-${eventName}`, {
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Retrieves the scroll container for the current page. Depending on the PWA mode this can be
3
+ * a scrollable article element or the window.
4
+ * @returns The scroll container element, or null if it could not be found.
5
+ */
6
+ export declare const getScrollContainer: () => HTMLElement | null;
7
+ /**
8
+ * Parameters for {@link checkScheduled}.
9
+ */
10
+ export interface ScheduledParams {
11
+ /**
12
+ * The start date of the scheduling in ISO format.
13
+ */
14
+ from?: string;
15
+ /**
16
+ * The end date of the scheduling in ISO format.
17
+ */
18
+ to?: string;
19
+ /**
20
+ * The timezone offset in minutes. If not provided, the local timezone offset will be used.
21
+ */
22
+ timezoneOffset?: number;
23
+ }
24
+ /**
25
+ * The scheduling status of a widget.
26
+ */
27
+ export interface ScheduledStatus {
28
+ /**
29
+ * Indicates if the widget is scheduled.
30
+ */
31
+ isScheduled: boolean;
32
+ /**
33
+ * Indicates if the widget is currently active within the scheduled time frame.
34
+ */
35
+ isActive: boolean;
36
+ /**
37
+ * Indicates if the scheduled time frame has expired.
38
+ */
39
+ isExpired: boolean;
40
+ }
41
+ /**
42
+ * Retrieves the scheduling status of a widget based on the provided parameters.
43
+ * @param params The parameters for the function.
44
+ * @param params.from The start date of the scheduling in ISO format.
45
+ * @param params.to The end date of the scheduling in ISO format.
46
+ * @param params.timezoneOffset The timezone offset in minutes.
47
+ * @returns An object containing the scheduling status.
48
+ */
49
+ export declare function checkScheduled({ from, to, timezoneOffset }?: ScheduledParams): ScheduledStatus;
50
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/helpers.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,WAAW,GAAG,IACwC,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,GAAE,eAAoB,GACjD,eAAe,CAqBjB"}
@@ -4,30 +4,25 @@ import { PAGE_PREVIEW_PATTERN } from '@shopgate/engage/page/constants';
4
4
  /**
5
5
  * Retrieves the scroll container for the current page. Depending on the PWA mode this can be
6
6
  * a scrollable article element or the window.
7
- * @returns {HTMLElement|null}
7
+ * @returns The scroll container element, or null if it could not be found.
8
8
  */
9
9
  export const getScrollContainer = () => document.querySelector(`.route__${PAGE_PREVIEW_PATTERN.replace(/^\/+/, '')}`);
10
10
 
11
11
  /**
12
- * @typedef {Object} ScheduledParams
13
- * @property {string} [from] The start date of the scheduling in ISO format.
14
- * @property {string} [to] The end date of the scheduling in ISO format.
15
- * @property {number} [timezoneOffset] The timezone offset in minutes. If not provided, the local
16
- * timezone offset will be used.
12
+ * Parameters for {@link checkScheduled}.
17
13
  */
18
14
 
19
15
  /**
20
- * @typedef {Object} ScheduledStatus
21
- * @property {boolean} isScheduled Indicates if the widget is scheduled.
22
- * @property {boolean} isActive Indicates if the widget is currently active within the
23
- * scheduled time frame.
24
- * @property {boolean} isExpired Indicates if the scheduled time frame has expired.
16
+ * The scheduling status of a widget.
25
17
  */
26
18
 
27
19
  /**
28
20
  * Retrieves the scheduling status of a widget based on the provided parameters.
29
- * @param {ScheduledParams} [params] The parameters for the function.
30
- * @returns {ScheduledStatus} An object containing the scheduling status.
21
+ * @param params The parameters for the function.
22
+ * @param params.from The start date of the scheduling in ISO format.
23
+ * @param params.to The end date of the scheduling in ISO format.
24
+ * @param params.timezoneOffset The timezone offset in minutes.
25
+ * @returns An object containing the scheduling status.
31
26
  */
32
27
  export function checkScheduled({
33
28
  from,
@@ -0,0 +1,13 @@
1
+ import { type WidgetsPreviewContextType } from './WidgetsPreviewContext';
2
+ /**
3
+ * Hook to handle communication with the parent window in a page preview iframe.
4
+ * @param isActive Whether the preview communication is active.
5
+ */
6
+ export declare const usePreviewIframeCommunication: (isActive?: boolean) => void;
7
+ /**
8
+ * The useWidgetsPreview hook provides access to the context that is wrapped around the Widgets
9
+ * component when it's rendered in preview mode.
10
+ * @returns The widget preview context.
11
+ */
12
+ export declare const useWidgetsPreview: () => WidgetsPreviewContextType;
13
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/hooks.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAoBjC;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GAAI,kBAAgB,SAyG7D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,yBAA8D,CAAC"}
@@ -10,9 +10,13 @@ import { getScrollContainer } from "./helpers";
10
10
  import { WidgetsPreviewContext } from "./WidgetsPreviewContext";
11
11
  import { dispatchWidgetPreviewEvent, useWidgetPreviewEvent } from "./events";
12
12
 
13
+ /**
14
+ * Message payload exchanged with the parent window in the page preview iframe.
15
+ */
16
+
13
17
  /**
14
18
  * Hook to handle communication with the parent window in a page preview iframe.
15
- * @param {boolean} isActive Whether the preview communication is active.
19
+ * @param isActive Whether the preview communication is active.
16
20
  */
17
21
  export const usePreviewIframeCommunication = (isActive = false) => {
18
22
  const dispatch = useDispatch();
@@ -37,12 +41,15 @@ export const usePreviewIframeCommunication = (isActive = false) => {
37
41
  dispatch(receivePageConfigV2({
38
42
  type: 'cms',
39
43
  slug: PAGE_PREVIEW_SLUG,
40
- data: data.payload
44
+ data: data.payload ?? {}
41
45
  }));
42
46
  } else if (data.type === 'scrollToWidget' && data.payload?.widgetCode) {
43
47
  // Parent window requested to scroll to a specific widget.
48
+ const {
49
+ widgetCode
50
+ } = data.payload;
44
51
  const scrollContainer = getScrollContainer();
45
- const target = scrollContainer.querySelector(`#widget-code-${data.payload.widgetCode}`);
52
+ const target = scrollContainer?.querySelector(`#widget-code-${widgetCode}`);
46
53
  if (scrollContainer && target) {
47
54
  let marginTop = 0;
48
55
  if (considerVerticalMargins) {
@@ -56,13 +63,13 @@ export const usePreviewIframeCommunication = (isActive = false) => {
56
63
  const actualScrollTop = Math.min(scrollOffset, maxScrollTop);
57
64
 
58
65
  // Register the target element as the active widget.
59
- dispatchWidgetPreviewEvent('set-active-widget-id', data.payload.widgetCode);
66
+ dispatchWidgetPreviewEvent('set-active-widget-id', widgetCode);
60
67
 
61
68
  /**
62
69
  * Callback to highlight the widget after scrolling.
63
70
  */
64
71
  const highlightWidget = () => {
65
- dispatchWidgetPreviewEvent('highlight-widget', data.payload.widgetCode);
72
+ dispatchWidgetPreviewEvent('highlight-widget', widgetCode);
66
73
  };
67
74
 
68
75
  // Add listener to onScrollEnd if available, otherwise use scroll event.
@@ -117,14 +124,9 @@ export const usePreviewIframeCommunication = (isActive = false) => {
117
124
  });
118
125
  };
119
126
 
120
- /**
121
- * @typedef {import('./WidgetsPreviewContext.js').WidgetsPreviewContextType}
122
- * WidgetsPreviewContextType
123
- */
124
-
125
127
  /**
126
128
  * The useWidgetsPreview hook provides access to the context that is wrapped around the Widgets
127
129
  * component when it's rendered in preview mode.
128
- * @returns {WidgetsPreviewContextType} The widget context.
130
+ * @returns The widget preview context.
129
131
  */
130
132
  export const useWidgetsPreview = () => useContext(WidgetsPreviewContext);
@@ -0,0 +1,3 @@
1
+ export { default } from './Widgets';
2
+ export { WidgetContext, type WidgetContextType } from './WidgetContext';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -2,131 +2,129 @@
2
2
  * Visibility settings for a widget.
3
3
  */
4
4
  export interface WidgetDefinitionVisibility {
5
- /**
6
- * Whether the widget is hidden.
7
- */
8
- isHidden: boolean;
9
- /**
10
- * Start date for scheduled widgets.
11
- */
12
- scheduleStartDate: string;
13
- /**
14
- * End date for scheduled widgets.
15
- */
16
- scheduleEndDate: string
5
+ /**
6
+ * Whether the widget is hidden.
7
+ */
8
+ isHidden: boolean;
9
+ /**
10
+ * Start date for scheduled widgets.
11
+ */
12
+ scheduleStartDate: string;
13
+ /**
14
+ * End date for scheduled widgets.
15
+ */
16
+ scheduleEndDate: string;
17
17
  }
18
-
19
18
  /**
20
19
  * Layout settings for a widget.
21
20
  */
22
21
  export interface WidgetDefinitionLayout {
23
- /**
24
- * Top margin for the widget.
25
- */
26
- marginTop: number;
27
- /**
28
- * Bottom margin for the widget.
29
- */
30
- marginBottom: number;
31
- /**
32
- * Left margin for the widget.
33
- */
34
- marginLeft: number;
35
- /**
36
- * Right margin for the widget.
37
- */
38
- marginRight: number;
22
+ /**
23
+ * Top margin for the widget.
24
+ */
25
+ marginTop: number;
26
+ /**
27
+ * Bottom margin for the widget.
28
+ */
29
+ marginBottom: number;
30
+ /**
31
+ * Left margin for the widget.
32
+ */
33
+ marginLeft: number;
34
+ /**
35
+ * Right margin for the widget.
36
+ */
37
+ marginRight: number;
39
38
  }
40
-
41
39
  /**
42
40
  * Definition of a API widget
43
41
  */
44
42
  export interface WidgetDefinition {
45
- /**
46
- * Unique code for the widget.
47
- */
48
- code: string;
49
- /**
50
- * Name of the widget
51
- */
52
- widgetConfigDefinitionCode: string;
53
- /**
54
- * Individual configuration for the widget.
55
- */
56
- widgetConfig: Record<string, any>;
57
- /**
58
- * Whether the widget is a legacy custom widget provided by an extension that's configured
59
- * via an HTML comment inside a HTML widget.
60
- */
61
- isCustomLegacyWidget?: boolean;
62
- /**
63
- * Visibility settings for the widget.
64
- */
65
- visibility: WidgetDefinitionVisibility;
66
- /**
67
- * Layout settings for the widget.
68
- */
69
- layout: WidgetDefinitionLayout;
70
- /**
71
- * Optional metadata for the widget (only available in preview mode)
72
- */
73
- meta?: {
74
- /**
75
- * Hidden state related data
76
- */
77
- hidden: {
78
- /**
79
- * Whether the widget is hidden.
80
- */
81
- isHidden: boolean;
82
- /**
83
- * Tooltip text for hidden related UI elements.
84
- */
85
- tooltip: string;
86
- /**
87
- * Label text for hidden related UI elements.
88
- */
89
- label: string;
90
- };
91
43
  /**
92
- * Scheduled state related data
93
- */
94
- scheduled: {
95
- /**
96
- * Indicates if the widget is scheduled.
97
- */
98
- isScheduled: boolean;
99
- /**
100
- * Indicates that the widget schedule time frame is currently active.
101
- */
102
- isActive: boolean;
103
- /**
104
- * Indicates if the scheduled time frame has expired
105
- */
106
- isExpired: boolean;
107
- /**
108
- * Tooltip text for schedule related UI elements.
109
- */
110
- tooltip: string;
111
- /**
112
- * Label text for schedule related UI elements.
113
- */
114
- label: string;
44
+ * Unique code for the widget.
45
+ */
46
+ code: string;
47
+ /**
48
+ * Name of the widget
49
+ */
50
+ widgetConfigDefinitionCode: string;
51
+ /**
52
+ * Individual configuration for the widget.
53
+ */
54
+ widgetConfig: Record<string, unknown>;
55
+ /**
56
+ * Whether the widget is a legacy custom widget provided by an extension that's configured
57
+ * via an HTML comment inside a HTML widget.
58
+ */
59
+ isCustomLegacyWidget?: boolean;
60
+ /**
61
+ * Visibility settings for the widget.
62
+ */
63
+ visibility: WidgetDefinitionVisibility;
64
+ /**
65
+ * Layout settings for the widget.
66
+ */
67
+ layout: WidgetDefinitionLayout;
68
+ /**
69
+ * Optional metadata for the widget (only available in preview mode)
70
+ */
71
+ meta?: {
72
+ /**
73
+ * Hidden state related data
74
+ */
75
+ hidden: {
76
+ /**
77
+ * Whether the widget is hidden.
78
+ */
79
+ isHidden: boolean;
80
+ /**
81
+ * Tooltip text for hidden related UI elements.
82
+ */
83
+ tooltip: string;
84
+ /**
85
+ * Label text for hidden related UI elements.
86
+ */
87
+ label: string;
88
+ };
89
+ /**
90
+ * Scheduled state related data
91
+ */
92
+ scheduled: {
93
+ /**
94
+ * Indicates if the widget is scheduled.
95
+ */
96
+ isScheduled: boolean;
97
+ /**
98
+ * Indicates that the widget schedule time frame is currently active.
99
+ */
100
+ isActive: boolean;
101
+ /**
102
+ * Indicates if the scheduled time frame has expired
103
+ */
104
+ isExpired: boolean;
105
+ /**
106
+ * Tooltip text for schedule related UI elements.
107
+ */
108
+ tooltip: string;
109
+ /**
110
+ * Label text for schedule related UI elements.
111
+ */
112
+ label: string;
113
+ };
115
114
  };
116
- }
117
115
  }
118
-
119
116
  export interface ScheduledStatus {
120
- /**
121
- * Indicates if the widget is scheduled.
122
- */
123
- isScheduled: boolean;
124
- /**
125
- * Indicates if the widget is currently hidden based on the scheduling
126
- */
127
- isHidden: boolean;
128
- /**
129
- * Indicates if the scheduled time frame has expired.
130
- */
131
- isExpired: boolean;
117
+ /**
118
+ * Indicates if the widget is scheduled.
119
+ */
120
+ isScheduled: boolean;
121
+ /**
122
+ * Indicates if the widget is currently hidden based on the scheduling
123
+ */
124
+ isHidden: boolean;
125
+ /**
126
+ * Indicates if the scheduled time frame has expired.
127
+ */
128
+ isExpired: boolean;
132
129
  }
130
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,0BAA0B,EAAE,MAAM,CAAC;IACnC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,UAAU,EAAE,0BAA0B,CAAC;IACvC;;OAEG;IACH,MAAM,EAAE,sBAAsB,CAAC;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;WAEG;QACH,MAAM,EAAE;YACN;;eAEG;YACH,QAAQ,EAAE,OAAO,CAAC;YAClB;;eAEG;YACH,OAAO,EAAE,MAAM,CAAC;YAChB;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;QACF;;WAEG;QACH,SAAS,EAAE;YACT;;eAEG;YACH,WAAW,EAAE,OAAO,CAAC;YACrB;;eAEG;YACH,QAAQ,EAAE,OAAO,CAAC;YAClB;;eAEG;YACH,SAAS,EAAE,OAAO,CAAC;YACnB;;eAEG;YACH,OAAO,EAAE,MAAM,CAAC;YAChB;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAA;CACF;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export { default as NotFound } from './NotFound';
2
+ export { default as Widgets } from './Widgets';
3
+ export { default as ResponsiveWidgetImage } from './ResponsiveWidgetImage';
4
+ export { default as WidgetRichText } from './WidgetRichText';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const REQUEST_PAGE_CONFIG_V2 = "REQUEST_PAGE_CONFIG_V2";
2
+ export declare const RECEIVE_PAGE_CONFIG_V2 = "RECEIVE_PAGE_CONFIG_V2";
3
+ export declare const ERROR_PAGE_CONFIG_V2 = "ERROR_PAGE_CONFIG_V2";
4
+ //# sourceMappingURL=actionTypes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actionTypes.d.ts","sourceRoot":"","sources":["../../../page/constants/actionTypes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,oBAAoB,yBAAyB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { PAGE_PATH, PAGE_PATTERN } from '@shopgate/pwa-common/constants/RoutePaths';
2
+ export { PAGE_PREVIEW_PATTERN } from '@shopgate/engage/admin-preview/constants';
3
+ export * from '@shopgate/pwa-common/constants/PageIDs';
4
+ export { PAGE_PATH, PAGE_PATTERN };
5
+ export * from './actionTypes';
6
+ export declare const IMPRINT_PATH = "/page/imprint";
7
+ export declare const PAYMENT_PATH = "/page/payment";
8
+ export declare const PRIVACY_PATH = "/page/privacy";
9
+ export declare const RETURN_POLICY_PATH = "/page/return_policy";
10
+ export declare const SHIPPING_PATH = "/page/shipping";
11
+ export declare const TERMS_PATH = "/page/terms";
12
+ export declare const PAGE_PREVIEW_SLUG = "page_preview";
13
+ /**
14
+ * Checks if the app is currently in page preview mode.
15
+ * @todo For backwards compatibility, this constant is still exported from the page package and
16
+ * mapped to the isAdminPreviewActive helper. It should be removed in the future. Note that this
17
+ * is a snapshot taken when this module is evaluated - consumers that can call
18
+ * isAdminPreviewActive() at usage time should do that instead.
19
+ */
20
+ export declare const IS_PAGE_PREVIEW_ACTIVE: boolean;
21
+ /**
22
+ * One hour in milliseconds
23
+ */
24
+ export declare const PAGE_STATE_LIFETIME = 3600000;
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/constants/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAEhF,cAAc,wCAAwC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AACnC,cAAc,eAAe,CAAC;AAE9B,eAAO,MAAM,YAAY,kBAAyB,CAAC;AACnD,eAAO,MAAM,YAAY,kBAAyB,CAAC;AACnD,eAAO,MAAM,YAAY,kBAAyB,CAAC;AACnD,eAAO,MAAM,kBAAkB,wBAA+B,CAAC;AAC/D,eAAO,MAAM,aAAa,mBAA0B,CAAC;AACrD,eAAO,MAAM,UAAU,gBAAuB,CAAC;AAE/C,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,SAAyB,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,mBAAmB,UAAU,CAAC"}