@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
package/page/helpers/index.d.ts
CHANGED
|
@@ -1,84 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Configuration of the "Products" widget input.
|
|
3
|
+
*/
|
|
4
|
+
export interface ProductsWidgetInputConfig {
|
|
5
|
+
/**
|
|
6
|
+
* A search term to filter products by.
|
|
7
|
+
*/
|
|
8
|
+
searchTerm: string;
|
|
9
|
+
/**
|
|
10
|
+
* A brand to filter products by.
|
|
11
|
+
*/
|
|
12
|
+
brand: string;
|
|
13
|
+
/**
|
|
14
|
+
* A category to filter products by.
|
|
15
|
+
*/
|
|
16
|
+
category: string;
|
|
17
|
+
/**
|
|
18
|
+
* Array of product item numbers (selected via manual input).
|
|
19
|
+
*/
|
|
20
|
+
manualItemNumbers: string[];
|
|
21
|
+
/**
|
|
22
|
+
* Array of product item numbers (selected via product selector).
|
|
23
|
+
*/
|
|
24
|
+
selectorItemNumbers: string[];
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Return value of {@link getProductSearchParamsFromProductsInputConfig}.
|
|
28
|
+
*/
|
|
29
|
+
export interface GetProductSearchParamsFromProductsInputConfigReturnValue {
|
|
30
|
+
/**
|
|
31
|
+
* The type of product search to perform.
|
|
32
|
+
*/
|
|
33
|
+
productsSearchType: 'searchTerm' | 'brand' | 'category' | 'productIds';
|
|
34
|
+
/**
|
|
35
|
+
* The value to use for the product search. Can be a string or an array of strings
|
|
36
|
+
* (for product IDs).
|
|
37
|
+
*/
|
|
38
|
+
productsSearchValue: string | string[];
|
|
33
39
|
}
|
|
34
|
-
|
|
35
40
|
/**
|
|
36
41
|
* Helper to extract relevant search parameters from the widget configuration of the "Products"
|
|
37
42
|
* input.
|
|
38
|
-
*
|
|
39
43
|
* The return value can be used to e.g. parametrize the useWidgetProducts hook.
|
|
44
|
+
* @param products Config object of the "Products" input.
|
|
45
|
+
* @returns The extracted product search parameters.
|
|
40
46
|
*/
|
|
41
|
-
export declare
|
|
42
|
-
products: ProductsWidgetInputConfig
|
|
43
|
-
): GetProductSearchParamsFromProductsInputConfigReturnValue;
|
|
44
|
-
|
|
47
|
+
export declare const getProductSearchParamsFromProductsInputConfig: (products?: Partial<ProductsWidgetInputConfig>) => GetProductSearchParamsFromProductsInputConfigReturnValue;
|
|
45
48
|
/**
|
|
46
|
-
*
|
|
49
|
+
* Parses the image URL to return a high resolution version if required.
|
|
50
|
+
* @param url The original image URL.
|
|
51
|
+
* @param useHighRes Whether to return a high resolution version.
|
|
52
|
+
* @returns The parsed image URL.
|
|
47
53
|
*/
|
|
48
|
-
export declare
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
|
|
54
|
+
export declare const parseImageUrl: (url: string, useHighRes?: boolean) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Parameters for {@link resolveBorderRadiusFromWidgetConfig}.
|
|
57
|
+
*/
|
|
58
|
+
interface BorderRadiusParams {
|
|
59
|
+
/**
|
|
60
|
+
* The border radius option.
|
|
61
|
+
*/
|
|
62
|
+
borderRadius: 'default' | 'none' | 'rounded' | 'custom';
|
|
63
|
+
/**
|
|
64
|
+
* The custom border radius value.
|
|
65
|
+
*/
|
|
66
|
+
borderRadiusCustom?: number;
|
|
67
|
+
}
|
|
64
68
|
/**
|
|
65
|
-
* Retrieves the border radius based on the widget config
|
|
66
|
-
* @
|
|
69
|
+
* Retrieves the border radius based on the widget config.
|
|
70
|
+
* @param params The helper parameters.
|
|
71
|
+
* @param params.borderRadius The border radius option.
|
|
72
|
+
* @param params.borderRadiusCustom The custom border radius value.
|
|
73
|
+
* @returns The resolved border radius.
|
|
67
74
|
*/
|
|
68
|
-
export declare
|
|
69
|
-
params: BorderRadiusParams
|
|
70
|
-
)
|
|
71
|
-
|
|
75
|
+
export declare const resolveBorderRadiusFromWidgetConfig: ({ borderRadius, borderRadiusCustom }: BorderRadiusParams) => number;
|
|
72
76
|
/**
|
|
73
77
|
* Validator factory for regular expressions.
|
|
74
78
|
* @param regex The regular expression to match.
|
|
75
79
|
* @returns A function that validates if a value matches the regex.
|
|
76
80
|
*/
|
|
77
|
-
export declare
|
|
78
|
-
|
|
81
|
+
export declare const matchesRegex: (regex: RegExp) => (val: string) => boolean;
|
|
79
82
|
/**
|
|
80
83
|
* Validates if a given string is a valid HTTPS URL.
|
|
81
84
|
* @param val The string to validate.
|
|
82
85
|
* @returns True if the string is a valid HTTPS URL, false otherwise.
|
|
83
86
|
*/
|
|
84
87
|
export declare const isHttpsUrl: (val: string) => boolean;
|
|
88
|
+
export {};
|
|
89
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wDAAwD;IACvE;;OAEG;IACH,kBAAkB,EAAE,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;IACvE;;;OAGG;IACH,mBAAmB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6CAA6C,GACxD,WAAU,OAAO,CAAC,yBAAyB,CAAM,KAChD,wDAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,aAAa,OAAO,KAAG,MAQjE,CAAC;AAEF;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mCAAmC,GAC9C,sCAAsC,kBAAkB,KACvD,MAKF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,MAAM,KAAK,MAAM,KAAG,OAAkC,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAP8B,MAAM,KAAG,OAOgB,CAAC"}
|
package/page/helpers/index.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
2
|
+
* Configuration of the "Products" widget input.
|
|
5
3
|
*/
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
|
-
* @
|
|
6
|
+
* Return value of {@link getProductSearchParamsFromProductsInputConfig}.
|
|
9
7
|
*/
|
|
10
8
|
|
|
11
|
-
/* eslint-enable max-len */
|
|
12
|
-
|
|
13
9
|
/**
|
|
14
10
|
* Helper to extract relevant search parameters from the widget configuration of the "Products"
|
|
15
11
|
* input.
|
|
16
12
|
* The return value can be used to e.g. parametrize the useWidgetProducts hook.
|
|
17
|
-
* @param
|
|
18
|
-
* @returns
|
|
13
|
+
* @param products Config object of the "Products" input.
|
|
14
|
+
* @returns The extracted product search parameters.
|
|
19
15
|
*/
|
|
20
16
|
export const getProductSearchParamsFromProductsInputConfig = (products = {}) => {
|
|
21
17
|
const {
|
|
@@ -28,8 +24,7 @@ export const getProductSearchParamsFromProductsInputConfig = (products = {}) =>
|
|
|
28
24
|
const mapping = [['brand', brand], ['category', category], ['searchTerm', searchTerm], ['productIds', manualItemNumbers], ['productIds', selectorItemNumbers]];
|
|
29
25
|
|
|
30
26
|
// Pick the first non-undefined value
|
|
31
|
-
|
|
32
|
-
let [productsSearchType, productsSearchValue] = mapping.find(([, value]) => value !== undefined) || ['searchTerm', searchTerm];
|
|
27
|
+
const [productsSearchType, productsSearchValue] = mapping.find(([, value]) => value !== undefined) || ['searchTerm', searchTerm];
|
|
33
28
|
return {
|
|
34
29
|
productsSearchType,
|
|
35
30
|
productsSearchValue
|
|
@@ -38,9 +33,9 @@ export const getProductSearchParamsFromProductsInputConfig = (products = {}) =>
|
|
|
38
33
|
|
|
39
34
|
/**
|
|
40
35
|
* Parses the image URL to return a high resolution version if required.
|
|
41
|
-
* @param
|
|
42
|
-
* @param
|
|
43
|
-
* @returns
|
|
36
|
+
* @param url The original image URL.
|
|
37
|
+
* @param useHighRes Whether to return a high resolution version.
|
|
38
|
+
* @returns The parsed image URL.
|
|
44
39
|
*/
|
|
45
40
|
export const parseImageUrl = (url, useHighRes) => {
|
|
46
41
|
if (!url || !useHighRes) {
|
|
@@ -51,11 +46,15 @@ export const parseImageUrl = (url, useHighRes) => {
|
|
|
51
46
|
};
|
|
52
47
|
|
|
53
48
|
/**
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
49
|
+
* Parameters for {@link resolveBorderRadiusFromWidgetConfig}.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves the border radius based on the widget config.
|
|
54
|
+
* @param params The helper parameters.
|
|
55
|
+
* @param params.borderRadius The border radius option.
|
|
56
|
+
* @param params.borderRadiusCustom The custom border radius value.
|
|
57
|
+
* @returns The resolved border radius.
|
|
59
58
|
*/
|
|
60
59
|
export const resolveBorderRadiusFromWidgetConfig = ({
|
|
61
60
|
borderRadius,
|
|
@@ -68,15 +67,15 @@ export const resolveBorderRadiusFromWidgetConfig = ({
|
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
/**
|
|
71
|
-
* Validator factory for regular expressions
|
|
72
|
-
* @param
|
|
73
|
-
* @
|
|
70
|
+
* Validator factory for regular expressions.
|
|
71
|
+
* @param regex The regular expression to match.
|
|
72
|
+
* @returns A function that validates if a value matches the regex.
|
|
74
73
|
*/
|
|
75
74
|
export const matchesRegex = regex => val => !val || regex.test(val);
|
|
76
75
|
|
|
77
76
|
/**
|
|
78
|
-
*
|
|
79
|
-
* @param
|
|
80
|
-
* @
|
|
77
|
+
* Validates if a given string is a valid HTTPS URL.
|
|
78
|
+
* @param val The string to validate.
|
|
79
|
+
* @returns True if the string is a valid HTTPS URL, false otherwise.
|
|
81
80
|
*/
|
|
82
|
-
export const isHttpsUrl = matchesRegex(
|
|
81
|
+
export const isHttpsUrl = matchesRegex(/^\s*https:\/\/[^\s/$.?#].[^\s]*\s*$/i);
|
package/page/hooks/index.d.ts
CHANGED
|
@@ -1,60 +1,61 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
1
|
+
import { type WidgetContextType } from '@shopgate/engage/page/components/Widgets';
|
|
3
2
|
/**
|
|
4
3
|
* The useWidget hook provides access to the context that is wrapped around a widget.
|
|
5
4
|
* @returns The widget context.
|
|
6
5
|
*/
|
|
7
|
-
export declare
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
6
|
+
export declare const useWidget: <C = Record<string, unknown>>() => WidgetContextType<C>;
|
|
7
|
+
/**
|
|
8
|
+
* Options for the {@link useWidgetProducts} hook.
|
|
9
|
+
*/
|
|
10
|
+
export interface UseWidgetProductsOptions {
|
|
11
|
+
/**
|
|
12
|
+
* The search value to use for the product search.
|
|
13
|
+
*/
|
|
14
|
+
value: string;
|
|
15
|
+
/**
|
|
16
|
+
* The type of product search to perform.
|
|
17
|
+
*/
|
|
18
|
+
type: 'searchTerm' | 'productIds' | 'brand' | 'category' | 'highlights';
|
|
19
|
+
/**
|
|
20
|
+
* The number of products to return per page.
|
|
21
|
+
* @default 32
|
|
22
|
+
*/
|
|
23
|
+
limit?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Sort order for the products.
|
|
26
|
+
* @default 'relevance'
|
|
27
|
+
*/
|
|
28
|
+
sort?: 'relevance' | 'priceAsc' | 'priceDesc' | 'nameAsc' | 'nameDesc';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of the {@link useWidgetProducts} hook.
|
|
32
|
+
*/
|
|
33
|
+
export interface UseWidgetProductsResult {
|
|
34
|
+
/**
|
|
35
|
+
* Function to fetch the next page of products.
|
|
36
|
+
*/
|
|
37
|
+
fetchNext: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether there are more products to fetch.
|
|
40
|
+
*/
|
|
41
|
+
hasNext: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the products are currently being fetched.
|
|
44
|
+
*/
|
|
45
|
+
isFetching: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Number of products available in the current result set.
|
|
48
|
+
*/
|
|
49
|
+
totalResultCount: number;
|
|
50
|
+
/**
|
|
51
|
+
* Array of product results.
|
|
52
|
+
*/
|
|
53
|
+
results: unknown[];
|
|
52
54
|
}
|
|
53
|
-
|
|
54
55
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
56
|
+
* Retrieves the products for the current widget.
|
|
57
|
+
* @param options Hook options.
|
|
58
|
+
* @returns The products and a function to fetch more products.
|
|
57
59
|
*/
|
|
58
|
-
export declare
|
|
59
|
-
|
|
60
|
-
): UseWidgetProductsResult;
|
|
60
|
+
export declare const useWidgetProducts: (options?: UseWidgetProductsOptions) => UseWidgetProductsResult;
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/hooks/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAMjG;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAK,iBAAiB,CAAC,CAAC,CAC1B,CAAC;AA2CpD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;IACxE;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAS,wBAAyD,KACjE,uBAyIF,CAAC"}
|
package/page/hooks/index.js
CHANGED
|
@@ -6,21 +6,9 @@ import { transformDisplayOptions } from '@shopgate/engage/core/helpers';
|
|
|
6
6
|
import { fetchProductsByQuery } from '@shopgate/engage/product';
|
|
7
7
|
import { makeGetWidgetProducts } from "../selectors";
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {import('../components/Widgets/WidgetContext').WidgetContextType WidgetContextType}
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {import('./index').UseWidgetProductsOptions} UseWidgetProductsOptions
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {import('./index').UseWidgetProductsResult} UseWidgetProductsResult
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
9
|
/**
|
|
22
10
|
* The useWidget hook provides access to the context that is wrapped around a widget.
|
|
23
|
-
* @returns
|
|
11
|
+
* @returns The widget context.
|
|
24
12
|
*/
|
|
25
13
|
export const useWidget = () => useContext(WidgetContext);
|
|
26
14
|
const REQUEST_TYPE_MAPPING = {
|
|
@@ -31,10 +19,27 @@ const REQUEST_TYPE_MAPPING = {
|
|
|
31
19
|
category: 5
|
|
32
20
|
};
|
|
33
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Shape of the memoized widget products selector result. The underlying selector and its
|
|
24
|
+
* dependencies live in untyped JS, so the shape is described here at the consumption boundary.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Shape of the result returned by the (untyped) `fetchProductsByQuery` thunk.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Options for the {@link useWidgetProducts} hook.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Result of the {@link useWidgetProducts} hook.
|
|
37
|
+
*/
|
|
38
|
+
|
|
34
39
|
/**
|
|
35
40
|
* Retrieves the products for the current widget.
|
|
36
|
-
* @param
|
|
37
|
-
* @returns
|
|
41
|
+
* @param options Hook options.
|
|
42
|
+
* @returns The products and a function to fetch more products.
|
|
38
43
|
*/
|
|
39
44
|
export const useWidgetProducts = (options = {}) => {
|
|
40
45
|
const {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from "@shopgate/pwa-common/selectors/page";
|
|
2
|
+
export function makeGetPrivacyPolicyLink(): string | null;
|
|
3
|
+
export function makeGetPage({ type, slug, }: {
|
|
4
|
+
type?: PageType | undefined;
|
|
5
|
+
slug?: string | null | undefined;
|
|
6
|
+
}): Function;
|
|
7
|
+
export function makeGetWidgetsFromPage({ type, slug, dropzone, }: {
|
|
8
|
+
type?: PageType | undefined;
|
|
9
|
+
dropzone?: "cmsWidgetList" | undefined;
|
|
10
|
+
slug?: string | null | undefined;
|
|
11
|
+
}): Function;
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether the new CMS version 2 is enabled.
|
|
14
|
+
*/
|
|
15
|
+
export const getIsCms2Enabled: ((state: any, ...params: any) => boolean) & import("reselect").OutputSelectorFields<(args_0: boolean, args_1: boolean) => boolean, {
|
|
16
|
+
clearCache: () => void;
|
|
17
|
+
}> & {
|
|
18
|
+
clearCache: () => void;
|
|
19
|
+
};
|
|
20
|
+
export function makeGetUnifiedCMSPageData({ slug }: {
|
|
21
|
+
slug: string;
|
|
22
|
+
}): Function;
|
|
23
|
+
export function makeGetWidgetProducts(type: "searchTerm" | "productIds" | "brand" | "category" | "highlights", options: Object, id: string): Function;
|
|
24
|
+
/**
|
|
25
|
+
* List of available page types.
|
|
26
|
+
*/
|
|
27
|
+
export type PageType = "cms" | "category";
|
|
28
|
+
/**
|
|
29
|
+
* List of available dropzone types.
|
|
30
|
+
*/
|
|
31
|
+
export type DropzoneType = "cmsWidgetList";
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/selectors/index.js"],"names":[],"mappings":";AAmCO,4CAFM,MAAM,GAAC,IAAI,CAuBvB;AAyBM,6CAJJ;IAA0B,IAAI;IACD,IAAI;CACjC,YAcF;AAYM,kEANJ;IAA0B,IAAI;IACA,QAAQ;IAET,IAAI;CACjC,YAqBF;AAED;;GAEG;AACH;;;;EAIE;AASK,oDAHJ;IAAuB,IAAI,EAAnB,MAAM;CACd,YAwCF;AA2FM,4CANI,YAAY,GAAG,YAAY,GAAG,OAAO,GAAG,UAAU,GAAE,YAAY,WAEhE,MAAM,MACN,MAAM,YAkBhB;;;;uBA5NY,KAAK,GAAG,UAAU;;;;2BAKlB,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Video.d.ts","sourceRoot":"","sources":["../../../../page/widgets/Video/Video.tsx"],"names":[],"mappings":"AAGA;;GAEG;AACH,QAAA,MAAM,KAAK,mCAgBV,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { useVideoWidget } from "./hooks";
|
|
3
2
|
import WidgetVideo from "../../components/WidgetVideo";
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* The VideoWidget is used to display a video.
|
|
7
|
-
* @returns {JSX.Element}
|
|
8
6
|
*/
|
|
9
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
8
|
const Video = () => {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration of the Video widget.
|
|
3
|
+
*/
|
|
4
|
+
export interface VideoWidgetConfig {
|
|
5
|
+
/**
|
|
6
|
+
* The video URL.
|
|
7
|
+
*/
|
|
8
|
+
url: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the video should be muted.
|
|
11
|
+
*/
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the video should loop.
|
|
15
|
+
*/
|
|
16
|
+
loop?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the video should display controls.
|
|
19
|
+
*/
|
|
20
|
+
controls?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the video should autoplay.
|
|
23
|
+
*/
|
|
24
|
+
autoplay?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The border radius option.
|
|
27
|
+
*/
|
|
28
|
+
borderRadius: 'default' | 'none' | 'rounded' | 'custom';
|
|
29
|
+
/**
|
|
30
|
+
* The custom border radius value.
|
|
31
|
+
*/
|
|
32
|
+
borderRadiusCustom?: number;
|
|
33
|
+
/**
|
|
34
|
+
* The link URL.
|
|
35
|
+
*/
|
|
36
|
+
link?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolved data returned by {@link useVideoWidget}. Reuses the field docs from
|
|
40
|
+
* {@link VideoWidgetConfig} for the pass-through fields via `Pick`.
|
|
41
|
+
*/
|
|
42
|
+
export interface UseVideoWidgetResult extends Pick<VideoWidgetConfig, 'url' | 'muted' | 'loop' | 'controls' | 'autoplay' | 'link'> {
|
|
43
|
+
/**
|
|
44
|
+
* The resolved border radius value in pixels.
|
|
45
|
+
*/
|
|
46
|
+
borderRadius: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Hook to access the Video widget configuration and data.
|
|
50
|
+
* @returns The resolved Video widget data.
|
|
51
|
+
*/
|
|
52
|
+
export declare const useVideoWidget: () => UseVideoWidgetResult;
|
|
53
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../page/widgets/Video/hooks.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,iBAAiB,EACjB,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAC5D;IACC;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,oBAoBjC,CAAC"}
|
|
@@ -2,27 +2,19 @@ import { useWidget } from '@shopgate/engage/page/hooks';
|
|
|
2
2
|
import { resolveBorderRadiusFromWidgetConfig } from "../../helpers";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* @property {string} url The video URL.
|
|
7
|
-
* @property {boolean} [muted] Whether the video should be muted.
|
|
8
|
-
* @property {boolean} [loop] Whether the video should loop.
|
|
9
|
-
* @property {boolean} [controls] Whether the video should display controls.
|
|
10
|
-
* @property {boolean} [autoplay] Whether the video should autoplay.
|
|
11
|
-
* @property {number} [borderRadius] The border radius preset.
|
|
12
|
-
* @property {string} [link] The link URL.
|
|
5
|
+
* Configuration of the Video widget.
|
|
13
6
|
*/
|
|
14
7
|
|
|
15
8
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
9
|
+
* Resolved data returned by {@link useVideoWidget}. Reuses the field docs from
|
|
10
|
+
* {@link VideoWidgetConfig} for the pass-through fields via `Pick`.
|
|
18
11
|
*/
|
|
19
12
|
|
|
20
|
-
// eslint-disable-next-line valid-jsdoc
|
|
21
13
|
/**
|
|
22
14
|
* Hook to access the Video widget configuration and data.
|
|
15
|
+
* @returns The resolved Video widget data.
|
|
23
16
|
*/
|
|
24
17
|
export const useVideoWidget = () => {
|
|
25
|
-
/** @type {UseWidgetReturnType} */
|
|
26
18
|
const {
|
|
27
19
|
config
|
|
28
20
|
} = useWidget();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../page/widgets/Video/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -16,7 +16,6 @@ const useStyles = makeStyles()(theme => ({
|
|
|
16
16
|
lineHeight: 1.7,
|
|
17
17
|
overflow: 'hidden',
|
|
18
18
|
wordBreak: ['break-all', 'break-word'],
|
|
19
|
-
color: theme.palette.text.primary,
|
|
20
19
|
hyphens: 'auto',
|
|
21
20
|
' ul': {
|
|
22
21
|
listStyle: 'disc'
|
|
@@ -69,7 +68,6 @@ function Description({
|
|
|
69
68
|
variant: "h5",
|
|
70
69
|
component: "div",
|
|
71
70
|
className: cx(classes.title, 'theme__description_heading'),
|
|
72
|
-
color: "textPrimary",
|
|
73
71
|
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
74
72
|
string: "product.description_heading"
|
|
75
73
|
})
|
|
@@ -3,10 +3,16 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { SurroundPortals } from '@shopgate/engage/components';
|
|
4
4
|
import { PRODUCT_ITEM_IMAGE } from '@shopgate/engage/category/constants';
|
|
5
5
|
import { getProductImageSettings, ProductImage } from '@shopgate/engage/product';
|
|
6
|
+
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
const {
|
|
8
9
|
ListImage: gridResolutions
|
|
9
10
|
} = getProductImageSettings();
|
|
11
|
+
const useStyles = makeStyles()(theme => ({
|
|
12
|
+
image: {
|
|
13
|
+
background: theme.palette.background.surface
|
|
14
|
+
}
|
|
15
|
+
}));
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* The item image component.
|
|
@@ -18,6 +24,9 @@ const ItemImage = ({
|
|
|
18
24
|
name,
|
|
19
25
|
imageUrl
|
|
20
26
|
}) => {
|
|
27
|
+
const {
|
|
28
|
+
classes
|
|
29
|
+
} = useStyles();
|
|
21
30
|
const portalProps = useMemo(() => ({
|
|
22
31
|
productId
|
|
23
32
|
}), [productId]);
|
|
@@ -25,6 +34,7 @@ const ItemImage = ({
|
|
|
25
34
|
portalName: PRODUCT_ITEM_IMAGE,
|
|
26
35
|
portalProps: portalProps,
|
|
27
36
|
children: /*#__PURE__*/_jsx(ProductImage, {
|
|
37
|
+
className: classes.image,
|
|
28
38
|
alt: name,
|
|
29
39
|
src: imageUrl,
|
|
30
40
|
resolutions: gridResolutions,
|