@shopgate/engage 7.32.0-beta.4 → 7.32.0-beta.6

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 (208) hide show
  1. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -5
  2. package/cart/components/CartItem/CartItemProductLayout.js +1 -1
  3. package/cart/components/CartItem/CartItemProductLayoutWide.js +2 -2
  4. package/category/components/CategoryImage/index.js +11 -15
  5. package/components/constants.d.ts +6 -0
  6. package/components/constants.d.ts.map +1 -0
  7. package/core/helpers/getFullImageSource.d.ts +5 -1
  8. package/core/helpers/getFullImageSource.d.ts.map +1 -1
  9. package/core/helpers/getFullImageSource.js +30 -14
  10. package/core/helpers/i18n.d.ts +4 -0
  11. package/core/helpers/i18n.d.ts.map +1 -1
  12. package/core/helpers/i18n.js +3 -0
  13. package/core/hooks/html/useLoadImage.d.ts +3 -3
  14. package/core/hooks/html/useLoadImage.d.ts.map +1 -1
  15. package/core/hooks/html/useLoadImage.js +2 -2
  16. package/favorites/components/Item/Item.d.ts.map +1 -1
  17. package/favorites/components/Item/Item.js +2 -5
  18. package/favorites/components/List/List.d.ts +1 -1
  19. package/locations/components/StoreList/StoreListProduct.js +2 -3
  20. package/package.json +8 -8
  21. package/page/components/NotFound.d.ts +7 -0
  22. package/page/components/NotFound.d.ts.map +1 -0
  23. package/page/components/NotFound.js +1 -2
  24. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
  25. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
  26. package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
  27. package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
  28. package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
  29. package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
  30. package/page/components/WidgetRichText/index.d.ts +2 -0
  31. package/page/components/WidgetRichText/index.d.ts.map +1 -0
  32. package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
  33. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
  34. package/page/components/WidgetVideo/WidgetVideo.js +33 -39
  35. package/page/components/WidgetVideo/index.d.ts +2 -0
  36. package/page/components/WidgetVideo/index.d.ts.map +1 -0
  37. package/page/components/Widgets/Overlay.d.ts +17 -0
  38. package/page/components/Widgets/Overlay.d.ts.map +1 -0
  39. package/page/components/Widgets/Overlay.js +24 -38
  40. package/page/components/Widgets/Tooltip.d.ts +20 -0
  41. package/page/components/Widgets/Tooltip.d.ts.map +1 -0
  42. package/page/components/Widgets/Tooltip.js +6 -10
  43. package/page/components/Widgets/Widget.d.ts +32 -0
  44. package/page/components/Widgets/Widget.d.ts.map +1 -0
  45. package/page/components/Widgets/Widget.js +7 -18
  46. package/page/components/Widgets/WidgetContext.d.ts +32 -38
  47. package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
  48. package/page/components/Widgets/WidgetContext.js +2 -8
  49. package/page/components/Widgets/WidgetProvider.d.ts +25 -0
  50. package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
  51. package/page/components/Widgets/WidgetProvider.js +5 -12
  52. package/page/components/Widgets/Widgets.d.ts +16 -0
  53. package/page/components/Widgets/Widgets.d.ts.map +1 -0
  54. package/page/components/Widgets/Widgets.js +5 -12
  55. package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
  56. package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
  57. package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
  58. package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
  59. package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
  60. package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
  61. package/page/components/Widgets/constants.d.ts +5 -0
  62. package/page/components/Widgets/constants.d.ts.map +1 -0
  63. package/page/components/Widgets/constants.js +3 -1
  64. package/page/components/Widgets/events.d.ts +38 -0
  65. package/page/components/Widgets/events.d.ts.map +1 -0
  66. package/page/components/Widgets/events.js +8 -12
  67. package/page/components/Widgets/helpers.d.ts +50 -0
  68. package/page/components/Widgets/helpers.d.ts.map +1 -0
  69. package/page/components/Widgets/helpers.js +8 -13
  70. package/page/components/Widgets/hooks.d.ts +13 -0
  71. package/page/components/Widgets/hooks.d.ts.map +1 -0
  72. package/page/components/Widgets/hooks.js +13 -11
  73. package/page/components/Widgets/index.d.ts +3 -0
  74. package/page/components/Widgets/index.d.ts.map +1 -0
  75. package/page/components/Widgets/types.d.ts +111 -113
  76. package/page/components/Widgets/types.d.ts.map +1 -0
  77. package/page/components/Widgets/types.js +1 -0
  78. package/page/components/index.d.ts +5 -0
  79. package/page/components/index.d.ts.map +1 -0
  80. package/page/constants/actionTypes.d.ts +4 -0
  81. package/page/constants/actionTypes.d.ts.map +1 -0
  82. package/page/constants/index.d.ts +25 -0
  83. package/page/constants/index.d.ts.map +1 -0
  84. package/page/helpers/index.d.ts +67 -62
  85. package/page/helpers/index.d.ts.map +1 -0
  86. package/page/helpers/index.js +24 -25
  87. package/page/hooks/index.d.ts +54 -53
  88. package/page/hooks/index.d.ts.map +1 -0
  89. package/page/hooks/index.js +20 -15
  90. package/page/selectors/index.d.ts +32 -0
  91. package/page/selectors/index.d.ts.map +1 -0
  92. package/page/widgets/ProductSlider/ProductSlider.js +1 -15
  93. package/page/widgets/Video/Video.d.ts +6 -0
  94. package/page/widgets/Video/Video.d.ts.map +1 -0
  95. package/page/widgets/Video/Video.js +0 -2
  96. package/page/widgets/Video/hooks.d.ts +53 -0
  97. package/page/widgets/Video/hooks.d.ts.map +1 -0
  98. package/page/widgets/Video/hooks.js +4 -12
  99. package/page/widgets/Video/index.d.ts +2 -0
  100. package/page/widgets/Video/index.d.ts.map +1 -0
  101. package/product/components/Media/FeaturedMedia.js +7 -1
  102. package/product/components/Media/MediaImage.js +24 -23
  103. package/product/components/Media/MediaPlaceholder.js +4 -7
  104. package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
  105. package/product/components/MediaSlider/constants.js +1 -12
  106. package/product/components/ProductCard/index.js +3 -10
  107. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +2 -5
  108. package/product/components/ProductGrid/constants.d.ts +2 -0
  109. package/product/components/ProductGrid/constants.d.ts.map +1 -0
  110. package/product/components/ProductGrid/constants.js +1 -0
  111. package/product/components/ProductGrid/hooks.d.ts +11 -0
  112. package/product/components/ProductGrid/hooks.d.ts.map +1 -0
  113. package/product/components/ProductGrid/hooks.js +48 -0
  114. package/product/components/ProductGrid/index.js +3 -6
  115. package/product/components/ProductGrid/spec.js +3 -0
  116. package/product/components/ProductImage/ProductImage.d.ts +42 -0
  117. package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
  118. package/product/components/ProductImage/ProductImage.js +153 -0
  119. package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
  120. package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
  121. package/product/components/ProductImage/ProductImagePlaceholder.js +9 -14
  122. package/product/components/ProductImage/constants.d.ts +7 -0
  123. package/product/components/ProductImage/constants.d.ts.map +1 -0
  124. package/product/components/ProductImage/constants.js +6 -0
  125. package/product/components/ProductImage/hooks.d.ts +8 -0
  126. package/product/components/ProductImage/hooks.d.ts.map +1 -0
  127. package/product/components/ProductImage/hooks.js +32 -0
  128. package/product/components/ProductImage/index.d.ts +3 -0
  129. package/product/components/ProductImage/index.d.ts.map +1 -0
  130. package/product/components/ProductImage/index.js +1 -201
  131. package/product/components/ProductImage/spec.js +115 -60
  132. package/product/components/ProductList/components/Item/index.js +5 -3
  133. package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
  134. package/product/components/ProductSlider/constants.d.ts +3 -0
  135. package/product/components/ProductSlider/constants.d.ts.map +1 -0
  136. package/product/components/ProductSlider/constants.js +2 -0
  137. package/product/components/ProductSlider/hooks.d.ts +7 -0
  138. package/product/components/ProductSlider/hooks.d.ts.map +1 -0
  139. package/product/components/ProductSlider/hooks.js +40 -0
  140. package/product/components/ProductSlider/index.js +4 -6
  141. package/product/components/ProductSlider/spec.js +2 -2
  142. package/product/components/Rating/index.js +2 -4
  143. package/product/helpers/index.js +29 -11
  144. package/product/hooks/index.js +3 -1
  145. package/product/hooks/useLoadProductImage.js +4 -2
  146. package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
  147. package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
  148. package/product/hooks/useShowEmptyRatingStars.js +21 -0
  149. package/product/index.js +0 -1
  150. package/settings/constants/appSettings.d.ts +3 -0
  151. package/settings/constants/appSettings.d.ts.map +1 -1
  152. package/settings/constants/appSettings.js +6 -1
  153. package/settings/constants/imageSettings.d.ts +52 -0
  154. package/settings/constants/imageSettings.d.ts.map +1 -0
  155. package/settings/constants/imageSettings.js +69 -0
  156. package/settings/helpers/index.d.ts +3 -0
  157. package/settings/helpers/index.d.ts.map +1 -0
  158. package/settings/helpers/index.js +1 -0
  159. package/settings/helpers/resolveImageSettings.d.ts +70 -0
  160. package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
  161. package/settings/helpers/resolveImageSettings.js +171 -0
  162. package/settings/helpers/toImageQuality.d.ts +7 -0
  163. package/settings/helpers/toImageQuality.d.ts.map +1 -0
  164. package/settings/helpers/toImageQuality.js +44 -0
  165. package/settings/helpers/toThumborColor.d.ts +15 -0
  166. package/settings/helpers/toThumborColor.d.ts.map +1 -0
  167. package/settings/helpers/toThumborColor.js +51 -0
  168. package/settings/hooks/index.d.ts +2 -0
  169. package/settings/hooks/index.d.ts.map +1 -0
  170. package/settings/hooks/index.js +1 -0
  171. package/settings/hooks/useImageSettings.d.ts +28 -0
  172. package/settings/hooks/useImageSettings.d.ts.map +1 -0
  173. package/settings/hooks/useImageSettings.js +39 -0
  174. package/settings/reducers/appSettings.d.ts.map +1 -1
  175. package/settings/reducers/appSettings.js +66 -4
  176. package/settings/reducers/index.d.ts +2 -2
  177. package/settings/selectors/appSettings.d.ts +46 -0
  178. package/settings/selectors/appSettings.d.ts.map +1 -1
  179. package/settings/selectors/appSettings.js +26 -1
  180. package/settings/types/appSettings.d.ts +156 -0
  181. package/settings/types/appSettings.d.ts.map +1 -1
  182. package/styles/reset/root.js +23 -4
  183. package/styles/reset/typographyCustomProps.d.ts +12 -0
  184. package/styles/reset/typographyCustomProps.d.ts.map +1 -0
  185. package/styles/reset/typographyCustomProps.js +11 -0
  186. package/styles/theme/createTheme/createTypography.js +1 -0
  187. package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
  188. package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
  189. package/product/collections/index.js +0 -1
  190. package/product/components/EffectivityDates/constants.d.ts +0 -3
  191. package/product/components/EffectivityDates/constants.d.ts.map +0 -1
  192. package/product/components/EffectivityDates/helpers.d.ts +0 -6
  193. package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
  194. package/product/components/Media/helpers.d.ts +0 -2
  195. package/product/components/Media/helpers.d.ts.map +0 -1
  196. package/product/components/ProductImage/connector.js +0 -12
  197. package/product/helpers/index.d.ts +0 -13
  198. package/product/helpers/index.d.ts.map +0 -1
  199. package/product/helpers/redirects.d.ts +0 -2
  200. package/product/helpers/redirects.d.ts.map +0 -1
  201. package/product/selectors/helpers/filterProperties.d.ts +0 -8
  202. package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
  203. package/product/selectors/helpers/index.d.ts +0 -3
  204. package/product/selectors/helpers/index.d.ts.map +0 -1
  205. package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
  206. package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
  207. package/product/selectors/product.d.ts +0 -112
  208. package/product/selectors/product.d.ts.map +0 -1
@@ -1,60 +1,61 @@
1
- import type { WidgetContextType } from '../components/Widgets/WidgetContext';
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 function useWidget<C = Record<string, any>>(): WidgetContextType<C>
8
-
9
-
10
- export type 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
- export type UseWidgetProductsResult = {
32
- /**
33
- * Function to fetch the next page of products.
34
- */
35
- fetchNext: () => void;
36
- /**
37
- * Whether there are more products to fetch.
38
- */
39
- hasNext: boolean;
40
- /**
41
- * Whether the products are currently being fetched.
42
- */
43
- isFetching: boolean;
44
- /**
45
- * Number of products available in the current result set.
46
- */
47
- totalResultCount: number;
48
- /**
49
- * Array of product results.
50
- */
51
- results: Object[];
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
- * The useWidgetProducts hook provides an easy way to retrieve products based on a search term or
56
- * other criteria.
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 function useWidgetProducts(
59
- options: UseWidgetProductsOptions
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"}
@@ -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 {WidgetContextType} The widget context.
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 {UseWidgetProductsOptions} options Hook options
37
- * @returns {UseWidgetProductsResult} The products and a function to fetch more products.
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"}
@@ -1,7 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { ProductSlider } from '@shopgate/engage/product/components';
3
3
  import { useWidgetProducts } from '@shopgate/engage/page/hooks';
4
- import { useTheme } from '@shopgate/engage/styles';
5
4
  import { useProductSliderWidget } from "./hooks";
6
5
  import WidgetHeadline from "../../components/WidgetHeadline";
7
6
 
@@ -30,7 +29,6 @@ const ProductSliderWidget = () => {
30
29
  limit: productCount,
31
30
  sort
32
31
  });
33
- const theme = useTheme();
34
32
  const productIds = useMemo(() => results?.map(result => result.id), [results]);
35
33
  if (!productIds || !productIds.length) {
36
34
  return null;
@@ -41,24 +39,12 @@ const ProductSliderWidget = () => {
41
39
  }) : null, /*#__PURE__*/_jsx(ProductSlider, {
42
40
  productIds: productIds,
43
41
  scope: "widgets",
44
- productItemProps: productItemProps,
45
- slidesPerView: 2.3
42
+ productItemProps: productItemProps
46
43
  // Improves interaction with the slider in the CMS preview iframe
47
44
  ,
48
45
  ...(isPreview ? {
49
46
  touchStartPreventDefault: true
50
47
  } : {}),
51
- breakpoints: {
52
- [theme.breakpoints.values.sm]: {
53
- slidesPerView: 3.3
54
- },
55
- [theme.breakpoints.values.md]: {
56
- slidesPerView: 4.3
57
- },
58
- [theme.breakpoints.values.lg]: {
59
- slidesPerView: 5.3
60
- }
61
- },
62
48
  ...swiperProps
63
49
  })]
64
50
  });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The VideoWidget is used to display a video.
3
+ */
4
+ declare const Video: () => import("react").JSX.Element;
5
+ export default Video;
6
+ //# sourceMappingURL=Video.d.ts.map
@@ -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
- * @typedef {Object} VideoWidgetConfig
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
- * @typedef {ReturnType< typeof import('@shopgate/engage/page/hooks')
17
- * .useWidget<VideoWidgetConfig> >} UseWidgetReturnType
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,2 @@
1
+ export { default } from './Video';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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"}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { SurroundPortals } from '@shopgate/engage/components';
3
3
  import { MEDIA_TYPE_IMAGE, MEDIA_TYPE_VIDEO } from '@shopgate/engage/product';
4
+ import { useProductImageSettings } from '@shopgate/engage/settings/hooks';
4
5
  import { PORTAL_PRODUCT_MEDIA } from "../../../components/constants";
5
6
  import MediaImage from "./MediaImage";
6
7
  import FeaturedVideo from "./FeaturedVideo";
@@ -21,11 +22,16 @@ const FeaturedMedia = ({
21
22
  altText
22
23
  }) => {
23
24
  const TypeRenderer = types[type] || MediaImage;
25
+ const {
26
+ list
27
+ } = useProductImageSettings();
24
28
  return /*#__PURE__*/_jsx(SurroundPortals, {
25
29
  portalName: PORTAL_PRODUCT_MEDIA,
26
30
  children: /*#__PURE__*/_jsx(TypeRenderer, {
27
31
  url: url,
28
- altText: altText
32
+ altText: altText,
33
+ resolutions: list.resolutions,
34
+ ratio: list.ratio
29
35
  })
30
36
  });
31
37
  };
@@ -1,14 +1,18 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import Image from '@shopgate/pwa-common/components/Image';
4
- import appConfig from '@shopgate/pwa-common/helpers/config';
5
4
  import { makeStyles } from '@shopgate/engage/styles';
6
5
  import { SurroundPortals } from "../../../components";
7
6
  import { PORTAL_PRODUCT_IMAGE } from "../../../components/constants";
8
- import { useWidgetSettings } from "../../../core";
7
+ import { useProductImageShadow } from "../ProductImage/hooks";
9
8
  import { defaultProps, propTypes } from "./props";
10
9
  import MediaPlaceholder from "./MediaPlaceholder";
10
+
11
+ /**
12
+ * The widget id the legacy inner shadow setting is configured under for this component.
13
+ */
11
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
+ const WIDGET_ID = '@shopgate/engage/product/MediaImage';
12
16
  const useStyles = makeStyles()({
13
17
  innerShadow: {
14
18
  ':after': {
@@ -33,41 +37,37 @@ const MediaImage = ({
33
37
  url,
34
38
  altText,
35
39
  className,
36
- resolutions
40
+ resolutions,
41
+ ratio
37
42
  }) => {
38
43
  const {
39
44
  classes,
40
45
  cx
41
46
  } = useStyles();
42
- const [placeholder, setPlaceholderEnabled] = useState(!url);
43
- const {
44
- showInnerShadow = !appConfig.hideProductImageShadow
45
- } = useWidgetSettings('@shopgate/engage/product/MediaImage');
46
- useEffect(() => setPlaceholderEnabled(!url), [url]);
47
+ const showInnerShadow = useProductImageShadow(WIDGET_ID);
47
48
  const mergedClassName = cx(className, {
48
49
  [classes.innerShadow]: showInnerShadow
49
50
  });
50
- if (placeholder) {
51
- return /*#__PURE__*/_jsx(SurroundPortals, {
52
- portalName: PORTAL_PRODUCT_IMAGE,
53
- children: /*#__PURE__*/_jsx(MediaPlaceholder, {
54
- className: mergedClassName
55
- })
56
- });
57
- }
58
51
  return /*#__PURE__*/_jsx(SurroundPortals, {
59
- portalName: PORTAL_PRODUCT_IMAGE,
60
- portalProps: {
52
+ portalName: PORTAL_PRODUCT_IMAGE
53
+ // Nothing is passed on without a url, so portals keep seeing what they saw before the
54
+ // placeholder moved into the Image component.
55
+ ,
56
+ portalProps: url ? {
61
57
  src: url,
62
- resolutions
63
- },
58
+ resolutions,
59
+ ratio
60
+ } : undefined,
64
61
  children: /*#__PURE__*/_jsx(Image, {
65
62
  src: url,
66
63
  resolutions: resolutions,
64
+ ratio: ratio,
67
65
  alt: altText,
68
66
  className: mergedClassName,
69
- backgroundColor: "transparent",
70
- onError: () => setPlaceholderEnabled(true),
67
+ backgroundColor: "transparent"
68
+ // Without the merged class name - it is already on the container this renders into.
69
+ ,
70
+ placeholder: /*#__PURE__*/_jsx(MediaPlaceholder, {}),
71
71
  animating: true
72
72
  })
73
73
  });
@@ -76,6 +76,7 @@ MediaImage.defaultProps = {
76
76
  url: defaultProps.url,
77
77
  altText: defaultProps.altText,
78
78
  className: defaultProps.className,
79
+ ratio: null,
79
80
  resolutions: undefined
80
81
  };
81
82
  export default MediaImage;
@@ -5,15 +5,12 @@ import { defaultProps, propTypes } from "./props";
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  const placeholderIconScale = 0.65;
7
7
  const useStyles = makeStyles()(theme => ({
8
+ // Fills the box its parent reserves rather than reserving one of its own.
8
9
  placeholderContainer: {
9
- position: 'relative',
10
+ position: 'absolute',
10
11
  width: '100%',
11
- ':before': {
12
- display: 'block',
13
- content: '""',
14
- width: '100%',
15
- paddingTop: '100%'
16
- }
12
+ height: '100%',
13
+ top: 0
17
14
  },
18
15
  placeholderContent: {
19
16
  position: 'absolute',
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { makeStyles } from '@shopgate/engage/styles';
4
+ import { useProductImageSettings } from '@shopgate/engage/settings/hooks';
4
5
  import { MediaImage as Image } from "../../../Media";
5
- import { PRODUCT_SLIDER_IMAGE_FORMATS } from "../../constants";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  const useStyles = makeStyles()({
8
8
  full: {
@@ -23,6 +23,9 @@ const MediaImage = ({
23
23
  const {
24
24
  classes
25
25
  } = useStyles();
26
+ const {
27
+ pdp
28
+ } = useProductImageSettings();
26
29
  return /*#__PURE__*/_jsx("div", {
27
30
  onClick: onClick,
28
31
  onKeyDown: onClick,
@@ -32,7 +35,8 @@ const MediaImage = ({
32
35
  children: /*#__PURE__*/_jsx(Image, {
33
36
  url: media.url,
34
37
  altText: media.altText,
35
- resolutions: PRODUCT_SLIDER_IMAGE_FORMATS
38
+ resolutions: pdp.resolutions,
39
+ ratio: pdp.ratio
36
40
  })
37
41
  });
38
42
  };
@@ -1,15 +1,4 @@
1
1
  /**
2
2
  * key in the product image collection
3
3
  */
4
- export const PRODUCT_SLIDER_IMAGE_COLLECTION_KEY = 'PRODUCT_SLIDER_IMAGES';
5
-
6
- /**
7
- * themes value for the product slider image formats
8
- */
9
- export const PRODUCT_SLIDER_IMAGE_FORMATS = [{
10
- width: 440,
11
- height: 440
12
- }, {
13
- width: 1024,
14
- height: 1024
15
- }];
4
+ export const PRODUCT_SLIDER_IMAGE_COLLECTION_KEY = 'PRODUCT_SLIDER_IMAGES';
@@ -1,12 +1,10 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { isBeta } from '@shopgate/engage/core/helpers';
4
- import { useWidgetSettings } from '@shopgate/engage/core/hooks';
5
- import { useProductListType } from '@shopgate/engage/product/hooks';
4
+ import { useProductListType, useShowEmptyRatingStars } from '@shopgate/engage/product/hooks';
6
5
  import { Link, RatingStars, DiscountBadge, SurroundPortals } from '@shopgate/engage/components';
7
6
  import { getProductRoute } from '@shopgate/engage/product';
8
7
  import { MapPriceHint, ProductImage, OrderQuantityHint, FeaturedMedia, Swatches, ProductName, ProductBadges } from '@shopgate/engage/product/components';
9
- import { getProductImageSettings } from '@shopgate/engage/product/helpers';
10
8
  import { PRODUCT_ITEM_DISCOUNT, PRODUCT_ITEM_PRICE } from '@shopgate/engage/category';
11
9
  import { makeStyles } from '@shopgate/engage/styles';
12
10
  import ProductGridPrice from "../ProductGridPrice";
@@ -54,12 +52,7 @@ function ProductCard(props) {
54
52
  const {
55
53
  meta
56
54
  } = useProductListType();
57
- const {
58
- ListImage: gridResolutions
59
- } = getProductImageSettings();
60
- const {
61
- showEmptyRatingStars = false
62
- } = useWidgetSettings('@shopgate/engage/rating');
55
+ const showEmptyRatingStars = useShowEmptyRatingStars();
63
56
  const showRatings = useMemo(() => {
64
57
  if (!hideRating && product?.rating?.average > 0) {
65
58
  return true;
@@ -85,7 +78,7 @@ function ProductCard(props) {
85
78
  altText: product.featuredMedia.altText
86
79
  }) : /*#__PURE__*/_jsx(ProductImage, {
87
80
  src: product.featuredImageBaseUrl,
88
- resolutions: gridResolutions,
81
+ context: "list",
89
82
  alt: product.name,
90
83
  itemProp: "image"
91
84
  }), /*#__PURE__*/_jsx(ProductBadges, {
@@ -2,12 +2,9 @@ import React, { useMemo, memo } from 'react';
2
2
  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
- import { getProductImageSettings, ProductImage } from '@shopgate/engage/product';
5
+ import { ProductImage } from '@shopgate/engage/product';
6
6
  import { makeStyles } from '@shopgate/engage/styles';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- const {
9
- ListImage: gridResolutions
10
- } = getProductImageSettings();
11
8
  const useStyles = makeStyles()(theme => ({
12
9
  image: {
13
10
  background: theme.palette.background.surface
@@ -37,7 +34,7 @@ const ItemImage = ({
37
34
  className: classes.image,
38
35
  alt: name,
39
36
  src: imageUrl,
40
- resolutions: gridResolutions,
37
+ context: "list",
41
38
  itemProp: "image"
42
39
  })
43
40
  });
@@ -0,0 +1,2 @@
1
+ export const WIDGET_ID: "@shopgate/engage/product/ProductGrid";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductGrid/constants.js"],"names":[],"mappings":"AAAA,wBAAyB,sCAAsC,CAAC"}
@@ -0,0 +1 @@
1
+ export const WIDGET_ID = '@shopgate/engage/product/ProductGrid';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Resolves the number of product columns for the ProductGrid, keyed by the
3
+ * active breakpoint.
4
+ *
5
+ * Precedence:
6
+ * - Once the app settings are hydrated from a source (admin sync / jsonp), they
7
+ * are authoritative everywhere.
8
+ * @returns The resolved number of columns for the active breakpoint.
9
+ */
10
+ export declare const useProductGridColumns: () => number;
11
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductGrid/hooks.ts"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAmCxC,CAAC"}