@shopgate/engage 7.32.0-beta.5 → 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 (124) 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/widgets/ProductSlider/ProductSlider.js +1 -15
  22. package/product/components/Media/FeaturedMedia.js +7 -1
  23. package/product/components/Media/MediaImage.js +24 -23
  24. package/product/components/Media/MediaPlaceholder.js +4 -7
  25. package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
  26. package/product/components/MediaSlider/constants.js +1 -12
  27. package/product/components/ProductCard/index.js +3 -10
  28. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +2 -5
  29. package/product/components/ProductGrid/hooks.d.ts +0 -7
  30. package/product/components/ProductGrid/hooks.d.ts.map +1 -1
  31. package/product/components/ProductGrid/hooks.js +9 -10
  32. package/product/components/ProductImage/ProductImage.d.ts +42 -0
  33. package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
  34. package/product/components/ProductImage/ProductImage.js +153 -0
  35. package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
  36. package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
  37. package/product/components/ProductImage/ProductImagePlaceholder.js +9 -14
  38. package/product/components/ProductImage/constants.d.ts +7 -0
  39. package/product/components/ProductImage/constants.d.ts.map +1 -0
  40. package/product/components/ProductImage/constants.js +6 -0
  41. package/product/components/ProductImage/hooks.d.ts +8 -0
  42. package/product/components/ProductImage/hooks.d.ts.map +1 -0
  43. package/product/components/ProductImage/hooks.js +32 -0
  44. package/product/components/ProductImage/index.d.ts +3 -0
  45. package/product/components/ProductImage/index.d.ts.map +1 -0
  46. package/product/components/ProductImage/index.js +1 -201
  47. package/product/components/ProductImage/spec.js +115 -60
  48. package/product/components/ProductList/components/Item/index.js +5 -3
  49. package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
  50. package/product/components/ProductSlider/constants.d.ts +3 -0
  51. package/product/components/ProductSlider/constants.d.ts.map +1 -0
  52. package/product/components/ProductSlider/constants.js +2 -0
  53. package/product/components/ProductSlider/hooks.d.ts +7 -0
  54. package/product/components/ProductSlider/hooks.d.ts.map +1 -0
  55. package/product/components/ProductSlider/hooks.js +40 -0
  56. package/product/components/ProductSlider/index.js +4 -6
  57. package/product/components/ProductSlider/spec.js +2 -2
  58. package/product/components/Rating/index.js +2 -4
  59. package/product/helpers/index.js +29 -11
  60. package/product/hooks/index.js +3 -1
  61. package/product/hooks/useLoadProductImage.js +4 -2
  62. package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
  63. package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
  64. package/product/hooks/useShowEmptyRatingStars.js +21 -0
  65. package/product/index.js +0 -1
  66. package/settings/constants/appSettings.d.ts +3 -0
  67. package/settings/constants/appSettings.d.ts.map +1 -1
  68. package/settings/constants/appSettings.js +6 -1
  69. package/settings/constants/imageSettings.d.ts +52 -0
  70. package/settings/constants/imageSettings.d.ts.map +1 -0
  71. package/settings/constants/imageSettings.js +69 -0
  72. package/settings/helpers/index.d.ts +3 -0
  73. package/settings/helpers/index.d.ts.map +1 -0
  74. package/settings/helpers/index.js +1 -0
  75. package/settings/helpers/resolveImageSettings.d.ts +70 -0
  76. package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
  77. package/settings/helpers/resolveImageSettings.js +171 -0
  78. package/settings/helpers/toImageQuality.d.ts +7 -0
  79. package/settings/helpers/toImageQuality.d.ts.map +1 -0
  80. package/settings/helpers/toImageQuality.js +44 -0
  81. package/settings/helpers/toThumborColor.d.ts +15 -0
  82. package/settings/helpers/toThumborColor.d.ts.map +1 -0
  83. package/settings/helpers/toThumborColor.js +51 -0
  84. package/settings/hooks/index.d.ts +2 -0
  85. package/settings/hooks/index.d.ts.map +1 -0
  86. package/settings/hooks/index.js +1 -0
  87. package/settings/hooks/useImageSettings.d.ts +28 -0
  88. package/settings/hooks/useImageSettings.d.ts.map +1 -0
  89. package/settings/hooks/useImageSettings.js +39 -0
  90. package/settings/reducers/appSettings.d.ts.map +1 -1
  91. package/settings/reducers/appSettings.js +61 -7
  92. package/settings/reducers/index.d.ts +2 -2
  93. package/settings/selectors/appSettings.d.ts +39 -1
  94. package/settings/selectors/appSettings.d.ts.map +1 -1
  95. package/settings/selectors/appSettings.js +21 -1
  96. package/settings/types/appSettings.d.ts +144 -9
  97. package/settings/types/appSettings.d.ts.map +1 -1
  98. package/styles/reset/root.js +23 -4
  99. package/styles/reset/typographyCustomProps.d.ts +12 -0
  100. package/styles/reset/typographyCustomProps.d.ts.map +1 -0
  101. package/styles/reset/typographyCustomProps.js +11 -0
  102. package/styles/theme/createTheme/createTypography.js +1 -0
  103. package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
  104. package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
  105. package/product/collections/index.js +0 -1
  106. package/product/components/EffectivityDates/constants.d.ts +0 -3
  107. package/product/components/EffectivityDates/constants.d.ts.map +0 -1
  108. package/product/components/EffectivityDates/helpers.d.ts +0 -6
  109. package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
  110. package/product/components/Media/helpers.d.ts +0 -2
  111. package/product/components/Media/helpers.d.ts.map +0 -1
  112. package/product/components/ProductImage/connector.js +0 -12
  113. package/product/helpers/index.d.ts +0 -13
  114. package/product/helpers/index.d.ts.map +0 -1
  115. package/product/helpers/redirects.d.ts +0 -2
  116. package/product/helpers/redirects.d.ts.map +0 -1
  117. package/product/selectors/helpers/filterProperties.d.ts +0 -8
  118. package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
  119. package/product/selectors/helpers/index.d.ts +0 -3
  120. package/product/selectors/helpers/index.d.ts.map +0 -1
  121. package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
  122. package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
  123. package/product/selectors/product.d.ts +0 -112
  124. package/product/selectors/product.d.ts.map +0 -1
@@ -4,7 +4,7 @@ import { makeStyles } from '@shopgate/engage/styles';
4
4
  import { getProductRoute, ProductImage } from '@shopgate/engage/product';
5
5
  import PropTypes from 'prop-types';
6
6
  import { BackInStockButton } from '@shopgate/engage/back-in-stock/components';
7
- import { getThemeSettings, i18n } from '@shopgate/engage/core';
7
+ import { i18n } from '@shopgate/engage/core';
8
8
  import { useBackInStockSubscriptions } from '@shopgate/engage/back-in-stock/hooks';
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
10
  const useStyles = makeStyles()(theme => ({
@@ -77,9 +77,6 @@ const Subscription = ({
77
77
  const {
78
78
  removeBackInStockSubscription
79
79
  } = useBackInStockSubscriptions();
80
- const {
81
- ListImage: gridResolutions
82
- } = getThemeSettings('AppImages') || {};
83
80
  const currency = product.price?.currency || 'EUR';
84
81
  const defaultPrice = product.price?.unitPrice || 0;
85
82
  const specialPrice = product.price?.unitPriceStriked;
@@ -94,7 +91,7 @@ const Subscription = ({
94
91
  "aria-hidden": true,
95
92
  children: /*#__PURE__*/_jsx(ProductImage, {
96
93
  src: product.featuredImageBaseUrl,
97
- resolutions: gridResolutions
94
+ context: "list"
98
95
  })
99
96
  }), /*#__PURE__*/_jsxs("div", {
100
97
  className: classes.infoContainer,
@@ -27,7 +27,6 @@ const useStyles = makeStyles()((theme, _params, classes) => ({
27
27
  image: {
28
28
  background: theme.palette.background.emphasized,
29
29
  marginBottom: theme.spacing(1.25),
30
- height: leftColumnWidth,
31
30
  width: leftColumnWidth
32
31
  },
33
32
  content: {
@@ -218,6 +217,7 @@ export function CartItemProductLayout() {
218
217
  portalName: CART_ITEM_IMAGE,
219
218
  portalProps: portalProps,
220
219
  children: /*#__PURE__*/_jsx(ProductImage, {
220
+ context: "list",
221
221
  src: product.featuredImageBaseUrl || product.featuredImageUrl
222
222
  })
223
223
  })
@@ -22,7 +22,6 @@ const useStyles = makeStyles()((theme, _params, classes) => ({
22
22
  },
23
23
  imageColumn: {
24
24
  width: 120,
25
- height: 120,
26
25
  marginRight: theme.spacing(1),
27
26
  flexShrink: 0,
28
27
  flexGrow: 0
@@ -163,7 +162,8 @@ const CartItemProductLayoutWide = () => {
163
162
  children: [/*#__PURE__*/_jsx("div", {
164
163
  className: classes.imageColumn,
165
164
  children: /*#__PURE__*/_jsx(ProductImage, {
166
- src: product.featuredImageBaseUrl || product.featuredImageUrl
165
+ src: product.featuredImageBaseUrl || product.featuredImageUrl,
166
+ context: "list"
167
167
  })
168
168
  }), /*#__PURE__*/_jsxs("div", {
169
169
  className: classes.detailsColumn,
@@ -1,4 +1,4 @@
1
- import React, { useState, useCallback } from 'react';
1
+ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Image } from '@shopgate/engage/components';
4
4
  import connect from "./connector";
@@ -14,24 +14,20 @@ const CategoryImage = ({
14
14
  src,
15
15
  placeholderSrc
16
16
  }) => {
17
- const [showPlaceholder, setShowPlaceholder] = useState(!src);
18
- const onImageError = useCallback(() => {
19
- setShowPlaceholder(true);
20
- }, [setShowPlaceholder]);
21
- if (!showPlaceholder) {
22
- return /*#__PURE__*/_jsx(Image, {
23
- className: className,
24
- src: src,
25
- onError: onImageError
26
- });
27
- }
28
- if (!placeholderSrc) {
17
+ if (!src && !placeholderSrc) {
29
18
  return null;
30
19
  }
31
20
  return /*#__PURE__*/_jsx(Image, {
32
21
  className: className,
33
- src: placeholderSrc
34
- }, "placeholder");
22
+ src: src
23
+ // Unwrapped, so the fallback renders into the container the outer Image already provides
24
+ // rather than nesting a second aspect ratio box inside it.
25
+ ,
26
+ placeholder: placeholderSrc ? /*#__PURE__*/_jsx(Image, {
27
+ unwrapped: true,
28
+ src: placeholderSrc
29
+ }) : null
30
+ });
35
31
  };
36
32
  CategoryImage.defaultProps = {
37
33
  src: null,
@@ -0,0 +1,6 @@
1
+ export const PORTAL_PRODUCT_IMAGE: "component.product-image";
2
+ export const PORTAL_PRODUCT_MEDIA: "component.product-media";
3
+ export const PORTAL_PRODUCT_MEDIA_SECTION: "component.product-media-section";
4
+ export const PORTAL_PRODUCT_BADGES: "component.product-badges";
5
+ export const PORTAL_PRODUCT_IMAGE_SLIDER: "component.product-image-slider";
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../components/constants.js"],"names":[],"mappings":"AAAA,mCAAoC,yBAAyB,CAAC;AAC9D,mCAAoC,yBAAyB,CAAC;AAC9D,2CAA4C,iCAAiC,CAAC;AAC9E,oCAAqC,0BAA0B,CAAC;AAChE,0CAA2C,gCAAgC,CAAC"}
@@ -1,5 +1,9 @@
1
- export function getFullImageSource(src: string, { width, height }?: {
1
+ export function getFullImageSource(src: string | null, { width, height }?: {
2
2
  width: number;
3
3
  height: number;
4
+ }, settings?: {
5
+ quality?: number | undefined;
6
+ fillColor?: string | undefined;
7
+ fillTransparent?: boolean | undefined;
4
8
  }): string;
5
9
  //# sourceMappingURL=getFullImageSource.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getFullImageSource.d.ts","sourceRoot":"","sources":["../../../core/helpers/getFullImageSource.js"],"names":[],"mappings":"AA+CO,wCANI,MAAM,sBAEd;IAA0B,KAAK,EAAvB,MAAM;IACY,MAAM,EAAxB,MAAM;CACd,GAAU,MAAM,CAgDlB"}
1
+ {"version":3,"file":"getFullImageSource.d.ts","sourceRoot":"","sources":["../../../core/helpers/getFullImageSource.js"],"names":[],"mappings":"AAiEO,wCAVI,MAAM,GAAC,IAAI,sBAEnB;IAA0B,KAAK,EAAvB,MAAM;IACY,MAAM,EAAxB,MAAM;CACd,aACA;IAA0B,OAAO;IACP,SAAS;IACR,eAAe;CAC1C,GAAU,MAAM,CAyDlB"}
@@ -5,9 +5,18 @@ import "core-js/modules/web.url.to-json.js";
5
5
  import "core-js/modules/web.url-search-params.js";
6
6
  import { CONFIGURATION_COLLECTION_CREATE_EXTERNAL_IMAGE_URL } from '@shopgate/engage/core/constants';
7
7
  import { configuration } from '@shopgate/engage/core/collections';
8
- import { getProductImageSettings } from "../../product/helpers";
8
+ import { DEFAULT_IMAGE_FILL_COLOR, DEFAULT_IMAGE_FILL_TRANSPARENT, DEFAULT_IMAGE_QUALITY } from '@shopgate/engage/settings/constants/imageSettings';
9
9
  import { getImageFormat } from "./getImageFormat";
10
10
 
11
+ /**
12
+ * The settings applied when the caller passes none.
13
+ */
14
+ const defaultSettings = {
15
+ quality: DEFAULT_IMAGE_QUALITY,
16
+ fillColor: DEFAULT_IMAGE_FILL_COLOR,
17
+ fillTransparent: DEFAULT_IMAGE_FILL_TRANSPARENT
18
+ };
19
+
11
20
  /**
12
21
  * Regex to detect the "fill" query parameter
13
22
  */
@@ -43,29 +52,38 @@ const buildUrl = (baseUrl, params = {}) => {
43
52
  };
44
53
 
45
54
  /**
46
- * Returns the actual url to the image, by adding url parameters with the dimensions for img-cdn
47
- * @param {string} src Source to the image.
55
+ * Builds the url that requests an image at a given size. A src that no known image source
56
+ * recognizes is returned untouched.
57
+ * @param {string|null} src Source to the image.
48
58
  * @param {Object} dimension Dimension of the requested image.
49
59
  * @param {number} dimension.width Width in pixels.
50
60
  * @param {number} dimension.height Height in pixels.
61
+ * @param {Object} [settings] Image service settings, as resolved by useImageServiceSettings.
62
+ * @param {number} [settings.quality] Compression quality.
63
+ * @param {string} [settings.fillColor] Fill color as a hash free hex, not a CSS color.
64
+ * @param {boolean} [settings.fillTransparent] Whether transparent areas are filled too.
51
65
  * @returns {string}
52
66
  */
53
67
  export const getFullImageSource = (src, {
54
68
  width,
55
69
  height
56
- } = {}) => {
70
+ } = {}, settings = {}) => {
71
+ const {
72
+ quality,
73
+ fillColor,
74
+ fillTransparent
75
+ } = {
76
+ ...defaultSettings,
77
+ ...settings
78
+ };
57
79
  if (src && src.includes('images.shopgate.services')) {
58
- const {
59
- fillColor,
60
- quality
61
- } = getProductImageSettings();
62
80
  const format = getImageFormat();
63
81
  return buildUrl(src, {
64
82
  format,
65
83
  width,
66
84
  height,
67
85
  quality,
68
- fill: fillColor.replace('#', '')
86
+ fill: fillTransparent ? `${fillColor},1` : fillColor
69
87
  });
70
88
  }
71
89
  if (src && src.startsWith('https://img-cdn.shopgate.com') && !src.includes('?')) {
@@ -74,17 +92,14 @@ export const getFullImageSource = (src, {
74
92
  h: height,
75
93
  q: 70,
76
94
  zd: 'resize',
77
- fillc: 'FFFFFF'
95
+ // No transparency flag here - the legacy cdn only understands a plain color.
96
+ fillc: fillColor
78
97
  });
79
98
  }
80
99
 
81
100
  // Check if an extension registered an external image url handler within the config collection.
82
101
  const createUrlFn = configuration.get(CONFIGURATION_COLLECTION_CREATE_EXTERNAL_IMAGE_URL);
83
102
  if (typeof createUrlFn === 'function') {
84
- const {
85
- fillColor,
86
- quality
87
- } = getProductImageSettings();
88
103
  const format = getImageFormat();
89
104
 
90
105
  // Invoke the handler with all relevant parameters.
@@ -92,6 +107,7 @@ export const getFullImageSource = (src, {
92
107
  width,
93
108
  height,
94
109
  fillColor,
110
+ fillTransparent,
95
111
  quality,
96
112
  format
97
113
  });
@@ -40,6 +40,10 @@ export type I18nHelpers = {
40
40
  * - Get locale data by path
41
41
  */
42
42
  getPath: Function;
43
+ /**
44
+ * - Check whether a translation key resolves to a value
45
+ */
46
+ has: Function;
43
47
  /**
44
48
  * - Get locale lang code, eg de-DE
45
49
  */
@@ -1 +1 @@
1
- {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../core/helpers/i18n.js"],"names":[],"mappings":"AAyEA;;GAEG;AACH,mBAFU,WAAW,CAEM;AAMpB,oCAFM,MAAM,EAAE,CAQpB"}
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../../core/helpers/i18n.js"],"names":[],"mappings":"AA4EA;;GAEG;AACH,mBAFU,WAAW,CAEM;AAMpB,oCAFM,MAAM,EAAE,CAQpB"}
@@ -13,6 +13,7 @@ import { logger } from '@shopgate/pwa-core/helpers';
13
13
  * @property {Function} number - Number translator
14
14
  * @property {Function} getSupplementalData - Get Supplemental Data
15
15
  * @property {Function} getPath - Get locale data by path
16
+ * @property {Function} has - Check whether a translation key resolves to a value
16
17
  * @property {Function} getLang - Get locale lang code, eg de-DE
17
18
  */
18
19
 
@@ -50,6 +51,7 @@ const I18n = () => {
50
51
  this.number = getNumberFormatter(lang);
51
52
  this.getSupplementalData = () => locales.supplementalData || {};
52
53
  this.getPath = path => get(locales, path);
54
+ this.has = path => this.getPath(path) !== undefined;
53
55
  this.getLang = () => lang;
54
56
  // If component decides to act accordingly this information should be exposed.
55
57
  this.ready = true;
@@ -62,6 +64,7 @@ const I18n = () => {
62
64
  number: notReadyCb,
63
65
  getSupplementalData: notReadyCb,
64
66
  getPath: notReadyCb,
67
+ has: notReadyCb,
65
68
  getLang: notReadyCb,
66
69
  ready: false
67
70
  };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Load image hook
3
- * @param {string} src .
4
- * @returns {boolean}
3
+ * @param {string|null} src The image to preload. A falsy src is a no-op.
4
+ * @returns {boolean} Whether the image has finished loading.
5
5
  */
6
- export function useLoadImage(src: string): boolean;
6
+ export function useLoadImage(src: string | null): boolean;
7
7
  //# sourceMappingURL=useLoadImage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLoadImage.d.ts","sourceRoot":"","sources":["../../../../core/hooks/html/useLoadImage.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,kCAHW,MAAM,GACJ,OAAO,CAUnB"}
1
+ {"version":3,"file":"useLoadImage.d.ts","sourceRoot":"","sources":["../../../../core/hooks/html/useLoadImage.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,kCAHW,MAAM,GAAC,IAAI,GACT,OAAO,CAUnB"}
@@ -3,8 +3,8 @@ import { loadImage } from '@shopgate/pwa-common/helpers/html/handleDOM';
3
3
 
4
4
  /**
5
5
  * Load image hook
6
- * @param {string} src .
7
- * @returns {boolean}
6
+ * @param {string|null} src The image to preload. A falsy src is a no-op.
7
+ * @returns {boolean} Whether the image has finished loading.
8
8
  */
9
9
  export function useLoadImage(src) {
10
10
  const [loaded, setIsLoaded] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../favorites/components/Item/Item.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;QA2KY,GAAG,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAnKD,YAAY"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../../favorites/components/Item/Item.jsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;QA0KY,GAAG,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAlKD,YAAY"}
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { connect } from 'react-redux';
4
4
  import { MODAL_VARIANT_SELECT } from '@shopgate/pwa-ui-shared/Dialog/constants';
5
5
  import { ProductImage, ITEM_PATH, PriceInfo, isBaseProduct as isBaseProductSelector, isProductOrderable, hasProductVariants, ProductListEntryProvider } from '@shopgate/engage/product';
6
- import { bin2hex, showModal as showModalAction, historyPush as historyPushAction, getThemeSettings, i18n } from '@shopgate/engage/core';
6
+ import { bin2hex, showModal as showModalAction, historyPush as historyPushAction, i18n } from '@shopgate/engage/core';
7
7
  import { hasNewServices } from '@shopgate/engage/core/helpers';
8
8
  import { Link, TextLink, SurroundPortals, Typography } from '@shopgate/engage/components';
9
9
  import { makeIsRopeProductOrderable, getPreferredLocation, StockInfoLists } from '@shopgate/engage/locations';
@@ -153,9 +153,6 @@ const FavoriteItem = ({
153
153
  classes,
154
154
  cx
155
155
  } = useStyles();
156
- const {
157
- ListImage: gridResolutions
158
- } = getThemeSettings('AppImages') || {};
159
156
  const [isDisabled, setIsDisabled] = useState(!isOrderable && !hasVariants);
160
157
  const currency = product.price?.currency || 'EUR';
161
158
  const defaultPrice = product.price?.unitPrice || 0;
@@ -267,7 +264,7 @@ const FavoriteItem = ({
267
264
  children: /*#__PURE__*/_jsx(ProductImage, {
268
265
  className: cx('engage__favorites__item__image'),
269
266
  src: product.featuredImageBaseUrl,
270
- resolutions: gridResolutions
267
+ context: "list"
271
268
  })
272
269
  }), /*#__PURE__*/_jsxs("div", {
273
270
  className: cx(classes.infoContainer, 'engage__favorites__item__info-container'),
@@ -26,8 +26,8 @@ declare const _default: import("react-redux").ConnectedComponent<{
26
26
  useGetFavoriteIdsPipeline: boolean;
27
27
  };
28
28
  }, {
29
- id: string;
30
29
  name: string;
30
+ id: string;
31
31
  remove: (...args: any[]) => any;
32
32
  addToCart: (...args: any[]) => any;
33
33
  removeItem: (...args: any[]) => any;
@@ -18,10 +18,9 @@ const useStyles = makeStyles()(theme => ({
18
18
  },
19
19
  productImage: {
20
20
  flex: '0 0 auto',
21
- width: '2.5rem',
22
- height: '2.5rem',
21
+ width: 70,
23
22
  background: theme.palette.background.emphasized,
24
- marginRight: theme.spacing(2.5)
23
+ marginRight: theme.spacing(2)
25
24
  },
26
25
  productContent: {
27
26
  flexGrow: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.32.0-beta.5",
3
+ "version": "7.32.0-beta.6",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -17,13 +17,13 @@
17
17
  "scripts": {},
18
18
  "dependencies": {
19
19
  "@emotion/react": "^11.14.0",
20
- "@shopgate/native-modules": "1.0.0-beta.32",
21
- "@shopgate/pwa-common": "7.32.0-beta.5",
22
- "@shopgate/pwa-common-commerce": "7.32.0-beta.5",
23
- "@shopgate/pwa-core": "7.32.0-beta.5",
24
- "@shopgate/pwa-ui-ios": "7.32.0-beta.5",
25
- "@shopgate/pwa-ui-material": "7.32.0-beta.5",
26
- "@shopgate/pwa-ui-shared": "7.32.0-beta.5",
20
+ "@shopgate/native-modules": "1.0.0-beta.34",
21
+ "@shopgate/pwa-common": "7.32.0-beta.6",
22
+ "@shopgate/pwa-common-commerce": "7.32.0-beta.6",
23
+ "@shopgate/pwa-core": "7.32.0-beta.6",
24
+ "@shopgate/pwa-ui-ios": "7.32.0-beta.6",
25
+ "@shopgate/pwa-ui-material": "7.32.0-beta.6",
26
+ "@shopgate/pwa-ui-shared": "7.32.0-beta.6",
27
27
  "@stripe/react-stripe-js": "^1.16.5",
28
28
  "@stripe/stripe-js": "^1.44.1",
29
29
  "@virtuous/conductor": "~2.5.0",
@@ -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
  });
@@ -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, {