@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.
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +23 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +6 -0
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- package/components/Badge/Badge.d.ts +30 -0
- package/components/Badge/Badge.d.ts.map +1 -0
- package/components/Badge/Badge.js +48 -0
- package/components/Badge/index.d.ts +3 -0
- package/components/Badge/index.d.ts.map +1 -0
- package/components/Badge/index.js +1 -0
- package/components/Badge/spec.d.ts +2 -0
- package/components/Badge/spec.d.ts.map +1 -0
- package/components/Badge/spec.js +75 -0
- package/components/View/components/Content/index.d.ts.map +1 -1
- package/components/View/components/Content/index.js +4 -1
- package/components/index.d.ts +1 -0
- package/components/index.d.ts.map +1 -1
- package/components/index.js +2 -1
- package/core/hooks/useLocalStorage.d.ts +8 -0
- package/core/hooks/useLocalStorage.d.ts.map +1 -1
- package/core/hooks/useLocalStorage.js +22 -15
- package/core/initialization/fetchSettings.d.ts +12 -0
- package/core/initialization/fetchSettings.d.ts.map +1 -0
- package/core/initialization/fetchSettings.js +134 -0
- package/core/initialization/index.d.ts +33 -2
- package/core/initialization/index.d.ts.map +1 -1
- package/core/initialization/index.js +25 -103
- package/package.json +9 -9
- package/page/components/NotFound.d.ts +7 -0
- package/page/components/NotFound.d.ts.map +1 -0
- package/page/components/NotFound.js +1 -2
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
- package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
- package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
- package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
- package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
- package/page/components/WidgetRichText/index.d.ts +2 -0
- package/page/components/WidgetRichText/index.d.ts.map +1 -0
- package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
- package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
- package/page/components/WidgetVideo/WidgetVideo.js +33 -39
- package/page/components/WidgetVideo/index.d.ts +2 -0
- package/page/components/WidgetVideo/index.d.ts.map +1 -0
- package/page/components/Widgets/Overlay.d.ts +17 -0
- package/page/components/Widgets/Overlay.d.ts.map +1 -0
- package/page/components/Widgets/Overlay.js +24 -38
- package/page/components/Widgets/Tooltip.d.ts +20 -0
- package/page/components/Widgets/Tooltip.d.ts.map +1 -0
- package/page/components/Widgets/Tooltip.js +6 -10
- package/page/components/Widgets/Widget.d.ts +32 -0
- package/page/components/Widgets/Widget.d.ts.map +1 -0
- package/page/components/Widgets/Widget.js +7 -18
- package/page/components/Widgets/WidgetContext.d.ts +32 -38
- package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
- package/page/components/Widgets/WidgetContext.js +2 -8
- package/page/components/Widgets/WidgetProvider.d.ts +25 -0
- package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
- package/page/components/Widgets/WidgetProvider.js +5 -12
- package/page/components/Widgets/Widgets.d.ts +16 -0
- package/page/components/Widgets/Widgets.d.ts.map +1 -0
- package/page/components/Widgets/Widgets.js +5 -12
- package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
- package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
- package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
- package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
- package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
- package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
- package/page/components/Widgets/constants.d.ts +5 -0
- package/page/components/Widgets/constants.d.ts.map +1 -0
- package/page/components/Widgets/constants.js +3 -1
- package/page/components/Widgets/events.d.ts +38 -0
- package/page/components/Widgets/events.d.ts.map +1 -0
- package/page/components/Widgets/events.js +8 -12
- package/page/components/Widgets/helpers.d.ts +50 -0
- package/page/components/Widgets/helpers.d.ts.map +1 -0
- package/page/components/Widgets/helpers.js +8 -13
- package/page/components/Widgets/hooks.d.ts +13 -0
- package/page/components/Widgets/hooks.d.ts.map +1 -0
- package/page/components/Widgets/hooks.js +13 -11
- package/page/components/Widgets/index.d.ts +3 -0
- package/page/components/Widgets/index.d.ts.map +1 -0
- package/page/components/Widgets/types.d.ts +111 -113
- package/page/components/Widgets/types.d.ts.map +1 -0
- package/page/components/Widgets/types.js +1 -0
- package/page/components/index.d.ts +5 -0
- package/page/components/index.d.ts.map +1 -0
- package/page/constants/actionTypes.d.ts +4 -0
- package/page/constants/actionTypes.d.ts.map +1 -0
- package/page/constants/index.d.ts +25 -0
- package/page/constants/index.d.ts.map +1 -0
- package/page/helpers/index.d.ts +67 -62
- package/page/helpers/index.d.ts.map +1 -0
- package/page/helpers/index.js +24 -25
- package/page/hooks/index.d.ts +54 -53
- package/page/hooks/index.d.ts.map +1 -0
- package/page/hooks/index.js +20 -15
- package/page/selectors/index.d.ts +32 -0
- package/page/selectors/index.d.ts.map +1 -0
- package/page/widgets/Video/Video.d.ts +6 -0
- package/page/widgets/Video/Video.d.ts.map +1 -0
- package/page/widgets/Video/Video.js +0 -2
- package/page/widgets/Video/hooks.d.ts +53 -0
- package/page/widgets/Video/hooks.d.ts.map +1 -0
- package/page/widgets/Video/hooks.js +4 -12
- package/page/widgets/Video/index.d.ts +2 -0
- package/page/widgets/Video/index.d.ts.map +1 -0
- package/product/components/Description/index.js +0 -2
- package/product/components/ProductCard/index.js +1 -0
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +1 -1
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +10 -0
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +1 -0
- package/product/components/ProductGrid/components/Item/index.js +0 -1
- package/product/components/ProductGrid/components/Layout/index.js +17 -3
- package/product/components/ProductGrid/constants.d.ts +2 -0
- package/product/components/ProductGrid/constants.d.ts.map +1 -0
- package/product/components/ProductGrid/constants.js +1 -0
- package/product/components/ProductGrid/hooks.d.ts +18 -0
- package/product/components/ProductGrid/hooks.d.ts.map +1 -0
- package/product/components/ProductGrid/hooks.js +49 -0
- package/product/components/ProductGrid/index.js +3 -6
- package/product/components/ProductGrid/spec.js +3 -0
- package/product/components/ProductList/components/Layout/index.js +8 -20
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +8 -0
- package/settings/selectors/appSettings.d.ts +8 -0
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +6 -1
- package/settings/types/appSettings.d.ts +21 -0
- package/settings/types/appSettings.d.ts.map +1 -1
- package/styles/helpers/index.d.ts +1 -0
- package/styles/helpers/index.js +1 -0
- package/styles/helpers/loadThemeCss.d.ts +14 -0
- package/styles/helpers/loadThemeCss.d.ts.map +1 -0
- package/styles/helpers/loadThemeCss.js +112 -0
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/reset/root.js +1 -1
- package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.js +12 -1
- package/styles/theme/createTheme/createComponents.types.d.ts +22 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +23 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +4 -1
- package/styles/theme/createTheme/index.d.ts +1 -0
- package/styles/theme/createTheme/index.d.ts.map +1 -1
- package/styles/theme/createTheme/index.js +2 -0
- package/styles/theme/createTheme/types.d.ts +2 -2
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/createTheme/types.js +2 -3
- package/styles/theme/hooks/useColorScheme.d.ts +4 -3
- package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
- package/styles/theme/hooks/useColorScheme.js +4 -3
- package/styles/theme/index.d.ts +1 -1
- package/styles/theme/index.d.ts.map +1 -1
- package/styles/theme/providers/ColorSchemeContext.d.ts +19 -0
- package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
- package/styles/theme/providers/ColorSchemeContext.js +6 -0
- package/styles/theme/providers/ThemeProvider.d.ts +2 -12
- package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
- package/styles/theme/providers/ThemeProvider.js +32 -8
|
@@ -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"}
|
|
@@ -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
|
-
*
|
|
4
|
+
* Names of the events that are dispatched in the context of widget preview iframe communication.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
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
|
-
*
|
|
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
|
|
23
|
-
* @param
|
|
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
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
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
|
|
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
|
-
* @
|
|
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
|
-
*
|
|
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
|
|
30
|
-
* @
|
|
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
|
|
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
|
|
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',
|
|
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',
|
|
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
|
|
130
|
+
* @returns The widget preview context.
|
|
129
131
|
*/
|
|
130
132
|
export const useWidgetsPreview = () => useContext(WidgetsPreviewContext);
|
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
*
|
|
93
|
-
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
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 @@
|
|
|
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"}
|