@shopgate/engage 7.32.0-beta.5 → 7.32.0-beta.7

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 (196) hide show
  1. package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
  2. package/account/components/Profile/ProfileAddressCard.js +1 -0
  3. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +2 -2
  4. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  5. package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -5
  6. package/cart/components/CartItem/CartItemProductLayout.js +1 -1
  7. package/cart/components/CartItem/CartItemProductLayoutWide.js +2 -2
  8. package/cart/components/CartItems/CartItems.js +8 -10
  9. package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
  10. package/category/components/CategoryImage/index.js +11 -15
  11. package/components/Card/Card.d.ts +27 -0
  12. package/components/Card/Card.d.ts.map +1 -0
  13. package/components/Card/Card.js +57 -0
  14. package/components/Card/index.d.ts +4 -0
  15. package/components/Card/index.d.ts.map +1 -0
  16. package/components/Card/index.js +2 -0
  17. package/components/Card/spec.d.ts +2 -0
  18. package/components/Card/spec.d.ts.map +1 -0
  19. package/components/Card/spec.js +128 -0
  20. package/components/Card/useCardAppearance.d.ts +11 -0
  21. package/components/Card/useCardAppearance.d.ts.map +1 -0
  22. package/components/Card/useCardAppearance.js +22 -0
  23. package/components/Paper/Paper.d.ts +49 -0
  24. package/components/Paper/Paper.d.ts.map +1 -0
  25. package/components/Paper/Paper.js +64 -0
  26. package/components/Paper/index.d.ts +3 -0
  27. package/components/Paper/index.d.ts.map +1 -0
  28. package/components/Paper/index.js +1 -0
  29. package/components/Paper/spec.d.ts +2 -0
  30. package/components/Paper/spec.d.ts.map +1 -0
  31. package/components/Paper/spec.js +131 -0
  32. package/components/RadioCard/RadioCard.d.ts.map +1 -1
  33. package/components/RadioCard/RadioCard.js +2 -1
  34. package/components/constants.d.ts +6 -0
  35. package/components/constants.d.ts.map +1 -0
  36. package/components/index.d.ts +4 -1
  37. package/components/index.d.ts.map +1 -1
  38. package/components/index.js +3 -2
  39. package/core/helpers/getFullImageSource.d.ts +5 -1
  40. package/core/helpers/getFullImageSource.d.ts.map +1 -1
  41. package/core/helpers/getFullImageSource.js +30 -14
  42. package/core/helpers/i18n.d.ts +4 -0
  43. package/core/helpers/i18n.d.ts.map +1 -1
  44. package/core/helpers/i18n.js +3 -0
  45. package/core/hooks/html/useLoadImage.d.ts +3 -3
  46. package/core/hooks/html/useLoadImage.d.ts.map +1 -1
  47. package/core/hooks/html/useLoadImage.js +2 -2
  48. package/favorites/components/Item/Item.d.ts +1 -1
  49. package/favorites/components/Item/Item.d.ts.map +1 -1
  50. package/favorites/components/Item/Item.js +2 -5
  51. package/favorites/components/List/List.d.ts +1 -1
  52. package/locations/components/StoreList/StoreListProduct.js +2 -3
  53. package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
  54. package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
  55. package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
  56. package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
  57. package/package.json +8 -8
  58. package/page/widgets/ProductSlider/ProductSlider.js +1 -15
  59. package/product/components/Media/FeaturedMedia.js +7 -1
  60. package/product/components/Media/MediaImage.js +24 -23
  61. package/product/components/Media/MediaPlaceholder.js +4 -7
  62. package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
  63. package/product/components/MediaSlider/constants.js +1 -12
  64. package/product/components/ProductCard/index.js +29 -23
  65. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
  66. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +2 -5
  67. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
  68. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
  69. package/product/components/ProductGrid/components/Item/index.js +9 -1
  70. package/product/components/ProductGrid/hooks.d.ts +0 -7
  71. package/product/components/ProductGrid/hooks.d.ts.map +1 -1
  72. package/product/components/ProductGrid/hooks.js +9 -10
  73. package/product/components/ProductImage/ProductImage.d.ts +42 -0
  74. package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
  75. package/product/components/ProductImage/ProductImage.js +153 -0
  76. package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
  77. package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
  78. package/product/components/ProductImage/ProductImagePlaceholder.js +9 -14
  79. package/product/components/ProductImage/constants.d.ts +7 -0
  80. package/product/components/ProductImage/constants.d.ts.map +1 -0
  81. package/product/components/ProductImage/constants.js +6 -0
  82. package/product/components/ProductImage/hooks.d.ts +8 -0
  83. package/product/components/ProductImage/hooks.d.ts.map +1 -0
  84. package/product/components/ProductImage/hooks.js +32 -0
  85. package/product/components/ProductImage/index.d.ts +3 -0
  86. package/product/components/ProductImage/index.d.ts.map +1 -0
  87. package/product/components/ProductImage/index.js +1 -201
  88. package/product/components/ProductImage/spec.js +115 -60
  89. package/product/components/ProductList/components/Item/index.js +5 -3
  90. package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
  91. package/product/components/ProductSlider/constants.d.ts +3 -0
  92. package/product/components/ProductSlider/constants.d.ts.map +1 -0
  93. package/product/components/ProductSlider/constants.js +2 -0
  94. package/product/components/ProductSlider/hooks.d.ts +7 -0
  95. package/product/components/ProductSlider/hooks.d.ts.map +1 -0
  96. package/product/components/ProductSlider/hooks.js +40 -0
  97. package/product/components/ProductSlider/index.js +8 -8
  98. package/product/components/ProductSlider/spec.js +2 -2
  99. package/product/components/Rating/index.js +2 -4
  100. package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
  101. package/product/components/RelationsSlider/constants.d.ts +3 -0
  102. package/product/components/RelationsSlider/constants.d.ts.map +1 -0
  103. package/product/components/RelationsSlider/constants.js +2 -1
  104. package/product/components/RelationsSlider/hooks.d.ts +6 -0
  105. package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
  106. package/product/components/RelationsSlider/hooks.js +34 -0
  107. package/product/helpers/index.js +29 -11
  108. package/product/hooks/index.js +3 -1
  109. package/product/hooks/useLoadProductImage.js +4 -2
  110. package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
  111. package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
  112. package/product/hooks/useShowEmptyRatingStars.js +21 -0
  113. package/product/index.js +0 -1
  114. package/settings/action-creators/appSettings.d.ts +3 -3
  115. package/settings/action-creators/appSettings.d.ts.map +1 -1
  116. package/settings/constants/appSettings.d.ts +3 -0
  117. package/settings/constants/appSettings.d.ts.map +1 -1
  118. package/settings/constants/appSettings.js +6 -1
  119. package/settings/constants/imageSettings.d.ts +52 -0
  120. package/settings/constants/imageSettings.d.ts.map +1 -0
  121. package/settings/constants/imageSettings.js +69 -0
  122. package/settings/helpers/index.d.ts +3 -0
  123. package/settings/helpers/index.d.ts.map +1 -0
  124. package/settings/helpers/index.js +1 -0
  125. package/settings/helpers/resolveImageSettings.d.ts +70 -0
  126. package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
  127. package/settings/helpers/resolveImageSettings.js +171 -0
  128. package/settings/helpers/toImageQuality.d.ts +7 -0
  129. package/settings/helpers/toImageQuality.d.ts.map +1 -0
  130. package/settings/helpers/toImageQuality.js +44 -0
  131. package/settings/helpers/toThumborColor.d.ts +15 -0
  132. package/settings/helpers/toThumborColor.d.ts.map +1 -0
  133. package/settings/helpers/toThumborColor.js +51 -0
  134. package/settings/hooks/index.d.ts +2 -0
  135. package/settings/hooks/index.d.ts.map +1 -0
  136. package/settings/hooks/index.js +1 -0
  137. package/settings/hooks/useImageSettings.d.ts +28 -0
  138. package/settings/hooks/useImageSettings.d.ts.map +1 -0
  139. package/settings/hooks/useImageSettings.js +39 -0
  140. package/settings/reducers/appSettings.d.ts.map +1 -1
  141. package/settings/reducers/appSettings.js +79 -11
  142. package/settings/reducers/index.d.ts +3 -3
  143. package/settings/selectors/appSettings.d.ts +71 -1
  144. package/settings/selectors/appSettings.d.ts.map +1 -1
  145. package/settings/selectors/appSettings.js +41 -1
  146. package/settings/types/appSettings.d.ts +192 -9
  147. package/settings/types/appSettings.d.ts.map +1 -1
  148. package/styles/index.d.ts +1 -1
  149. package/styles/index.d.ts.map +1 -1
  150. package/styles/reset/root.js +23 -4
  151. package/styles/reset/typographyCustomProps.d.ts +12 -0
  152. package/styles/reset/typographyCustomProps.d.ts.map +1 -0
  153. package/styles/reset/typographyCustomProps.js +11 -0
  154. package/styles/theme/createTheme/createComponents.types.d.ts +50 -0
  155. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  156. package/styles/theme/createTheme/createComponents.types.js +50 -0
  157. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  158. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
  159. package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
  160. package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
  161. package/styles/theme/createTheme/createPalette.types.js +5 -1
  162. package/styles/theme/createTheme/createShape.d.ts +4 -0
  163. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  164. package/styles/theme/createTheme/createShape.js +2 -1
  165. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  166. package/styles/theme/createTheme/createThemeFromColorScheme.js +2 -1
  167. package/styles/theme/createTheme/createTypography.js +1 -0
  168. package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
  169. package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
  170. package/styles/theme/createTheme/shadows.d.ts +11 -1
  171. package/styles/theme/createTheme/shadows.d.ts.map +1 -1
  172. package/styles/theme/createTheme/shadows.js +41 -7
  173. package/styles/theme/createTheme/types.d.ts +5 -1
  174. package/styles/theme/createTheme/types.d.ts.map +1 -1
  175. package/styles/theme/index.d.ts +1 -0
  176. package/styles/theme/index.d.ts.map +1 -1
  177. package/product/collections/index.js +0 -1
  178. package/product/components/EffectivityDates/constants.d.ts +0 -3
  179. package/product/components/EffectivityDates/constants.d.ts.map +0 -1
  180. package/product/components/EffectivityDates/helpers.d.ts +0 -6
  181. package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
  182. package/product/components/Media/helpers.d.ts +0 -2
  183. package/product/components/Media/helpers.d.ts.map +0 -1
  184. package/product/components/ProductImage/connector.js +0 -12
  185. package/product/helpers/index.d.ts +0 -13
  186. package/product/helpers/index.d.ts.map +0 -1
  187. package/product/helpers/redirects.d.ts +0 -2
  188. package/product/helpers/redirects.d.ts.map +0 -1
  189. package/product/selectors/helpers/filterProperties.d.ts +0 -8
  190. package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
  191. package/product/selectors/helpers/index.d.ts +0 -3
  192. package/product/selectors/helpers/index.d.ts.map +0 -1
  193. package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
  194. package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
  195. package/product/selectors/product.d.ts +0 -112
  196. package/product/selectors/product.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileAddressCard.d.ts","sourceRoot":"","sources":["../../../../account/components/Profile/ProfileAddressCard.jsx"],"names":[],"mappings":";AAwEA;;GAEG;AACH;;;;;;IAFa,GAAG,CAkGf;;;;;;;;;;;;;;;;sBA1KqB,YAAY"}
1
+ {"version":3,"file":"ProfileAddressCard.d.ts","sourceRoot":"","sources":["../../../../account/components/Profile/ProfileAddressCard.jsx"],"names":[],"mappings":";AAyEA;;GAEG;AACH;;;;;;IAFa,GAAG,CAkGf;;;;;;;;;;;;;;;;sBA3KqB,YAAY"}
@@ -8,6 +8,7 @@ import iso3166 from "../../../components/Form/Builder/helpers/iso-3166-2";
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const useStyles = makeStyles()(theme => ({
10
10
  root: {
11
+ margin: '5px 5px 10px',
11
12
  padding: 16,
12
13
  display: 'flex',
13
14
  flexDirection: 'column',
@@ -1,4 +1,4 @@
1
- import type { AppSettings } from '@shopgate/engage/settings/types/appSettings';
1
+ import type { AppSettingsPayload } from '@shopgate/engage/settings/types/appSettings';
2
2
  import type { ColorSchemeName } from '@shopgate/engage/styles/theme/createTheme';
3
3
  export type CSSDeclarationValue = string | number;
4
4
  export type FrontendSettingsStyling = Record<string, Record<string, CSSDeclarationValue>>;
@@ -6,7 +6,7 @@ export type FrontendSettingsPreviewBridgeMessage = {
6
6
  type: 'receiveFrontendSettings';
7
7
  payload?: {
8
8
  styling?: FrontendSettingsStyling;
9
- appSettings?: AppSettings;
9
+ appSettings?: AppSettingsPayload;
10
10
  };
11
11
  } | {
12
12
  type: 'setColorScheme';
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../admin-preview/components/FrontendSettingsPreviewBridge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAE1F,MAAM,MAAM,oCAAoC,GAC5C;IACA,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,uBAAuB,CAAC;QAClC,WAAW,CAAC,EAAE,WAAW,CAAC;KAC3B,CAAC;CACH,GACC;IACA,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE;QACP,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;CACH,GACC;IACA,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../admin-preview/components/FrontendSettingsPreviewBridge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAEjF,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAE1F,MAAM,MAAM,oCAAoC,GAC5C;IACA,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,uBAAuB,CAAC;QAClC,WAAW,CAAC,EAAE,kBAAkB,CAAC;KAClC,CAAC;CACH,GACC;IACA,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE;QACP,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;CACH,GACC;IACA,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB,CAAC"}
@@ -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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CardList, ResponsiveContainer } from '@shopgate/engage/components';
2
+ import { ResponsiveContainer, Card } from '@shopgate/engage/components';
3
3
  import { FulfillmentSlotSwitcher } from '@shopgate/engage/locations';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
5
  import PropTypes from 'prop-types';
@@ -14,15 +14,11 @@ const useStyles = makeStyles()(theme => ({
14
14
  marginBottom: theme.spacing(-1.5)
15
15
  },
16
16
  card: {
17
- background: theme.palette.background.surface,
18
17
  marginBottom: theme.spacing(1.5),
19
18
  ':last-of-type': {
20
19
  marginBottom: 0
21
20
  },
22
- border: `1px solid ${theme.components.border.light}`,
23
- boxSizing: 'border-box',
24
- boxShadow: '0px 4px 2px rgba(0, 0, 0, 0.05)',
25
- borderRadius: 5
21
+ boxSizing: 'border-box'
26
22
  }
27
23
  }));
28
24
 
@@ -54,7 +50,8 @@ const CartItems = ({
54
50
  isDirectShipOnly
55
51
  }) => {
56
52
  const {
57
- classes
53
+ classes,
54
+ cx
58
55
  } = useStyles();
59
56
  if (!cartItems || cartItems.length === 0) {
60
57
  return null;
@@ -69,8 +66,8 @@ const CartItems = ({
69
66
  isDirectShipOnly: isDirectShipOnly,
70
67
  isCheckoutConfirmation: isCheckoutConfirmation
71
68
  })
72
- }), /*#__PURE__*/_jsxs(CardList, {
73
- className: classes.items,
69
+ }), /*#__PURE__*/_jsxs("ul", {
70
+ className: cx('ui-shared__card-list', classes.items),
74
71
  children: [!isOrderDetails ? /*#__PURE__*/_jsx(ResponsiveContainer, {
75
72
  appAlways: true,
76
73
  breakpoint: "<=xs",
@@ -87,8 +84,9 @@ const CartItems = ({
87
84
  wrapCard: true,
88
85
  className: classes.card
89
86
  })
90
- }), cartItems.map(item => /*#__PURE__*/_jsx(CardList.Item, {
87
+ }), cartItems.map(item => /*#__PURE__*/_jsx(Card, {
91
88
  className: classes.card,
89
+ component: "li",
92
90
  children: /*#__PURE__*/_jsx(CartItemProvider, {
93
91
  cartItem: item,
94
92
  isEditable: editable,
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo, useCallback } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { i18n } from '@shopgate/engage/core/helpers';
4
- import { CardList } from '@shopgate/engage/components';
4
+ import { Card } from '@shopgate/engage/components';
5
5
  import Substitution, { SubstitutionWrapper } from "../Substitution";
6
6
  import connect from "./CartItemsSubscription.connector";
7
7
 
@@ -24,8 +24,9 @@ const CartItemsSubstitution = ({
24
24
  }))), [allAllowed, cartItems, updateProductsInCart]);
25
25
  if (wrapCard) {
26
26
  return /*#__PURE__*/_jsx(SubstitutionWrapper, {
27
- children: /*#__PURE__*/_jsx(CardList.Item, {
27
+ children: /*#__PURE__*/_jsx(Card, {
28
28
  className: className,
29
+ component: "li",
29
30
  children: /*#__PURE__*/_jsx(Substitution, {
30
31
  id: "substitution-all",
31
32
  label: i18n.text('cart.allow_substitution_all'),
@@ -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,27 @@
1
+ import React from 'react';
2
+ import type { ShadowSize } from '@shopgate/engage/styles';
3
+ export type CardVariant = 'elevation' | 'outlined' | 'plain';
4
+ export interface CardOwnProps {
5
+ children?: React.ReactNode;
6
+ className?: string;
7
+ id?: string;
8
+ /** Element or component to render as. @default 'div' */
9
+ component?: React.ElementType;
10
+ /** Overrides the merchant-configured style. `plain` renders no chrome at all. */
11
+ variant?: CardVariant;
12
+ /** Overrides the configured elevation. Ignored unless the resolved variant is `elevation`. */
13
+ elevation?: number | ShadowSize;
14
+ /** Removes the rounded corners. */
15
+ square?: boolean;
16
+ }
17
+ export type CardProps = CardOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof CardOwnProps> & {
18
+ [key: `data-${string}`]: string;
19
+ };
20
+ /**
21
+ * A themed content surface built on `Paper`, reading the merchant's card settings.
22
+ */
23
+ declare const Card: React.ForwardRefExoticComponent<CardOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof CardOwnProps> & {
24
+ [key: `data-${string}`]: string;
25
+ } & React.RefAttributes<HTMLElement>>;
26
+ export default Card;
27
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../components/Card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAK1D,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B,iFAAiF;IACjF,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,mCAAmC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,SAAS,GACnB,YAAY,GACV,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,YAAY,CAAC,GAC3D;IAAE,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,CAAA;CAAE,CAAC;AAUxC;;GAEG;AACH,QAAA,MAAM,IAAI;;qCA2BR,CAAC;AAIH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,57 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { useTheme, makeStyles } from '@shopgate/engage/styles';
3
+ import Paper from "../Paper";
4
+ import { useCardAppearance } from "./useCardAppearance";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ const useStyles = makeStyles({
7
+ name: 'Card'
8
+ })((theme, {
9
+ variant
10
+ }) => ({
11
+ root: {
12
+ ...(variant !== 'plain' && {
13
+ overflow: 'hidden'
14
+ })
15
+ }
16
+ }));
17
+
18
+ /**
19
+ * A themed content surface built on `Paper`, reading the merchant's card settings.
20
+ */
21
+ const Card = /*#__PURE__*/forwardRef(({
22
+ className,
23
+ children,
24
+ id,
25
+ variant,
26
+ elevation,
27
+ square,
28
+ ...rest
29
+ }, ref) => {
30
+ const theme = useTheme();
31
+ const appearance = useCardAppearance();
32
+ const resolvedVariant = variant ?? appearance.variant;
33
+ const isPlain = resolvedVariant === 'plain';
34
+ const paperVariant = resolvedVariant === 'outlined' ? 'outlined' : 'elevation';
35
+ const {
36
+ classes,
37
+ cx
38
+ } = useStyles({
39
+ variant: resolvedVariant
40
+ });
41
+ return /*#__PURE__*/_jsx(Paper, {
42
+ ref: ref,
43
+ id: id,
44
+ variant: paperVariant,
45
+ elevation: isPlain ? 0 : elevation ?? appearance.elevation,
46
+ square: square || isPlain,
47
+ borderRadius: theme.shape.cardsBorderRadius,
48
+ background: isPlain ? 'transparent' : theme.components.cards.backgroundColor,
49
+ border: theme.components.cards.border,
50
+ shadowColor: theme.components.cards.shadowColor,
51
+ className: cx(classes.root, 'engage__card', 'ui-shared__card', className),
52
+ ...rest,
53
+ children: children
54
+ });
55
+ });
56
+ Card.displayName = 'Card';
57
+ export default Card;
@@ -0,0 +1,4 @@
1
+ export { default } from './Card';
2
+ export type { CardProps, CardVariant } from './Card';
3
+ export { useCardAppearance } from './useCardAppearance';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Card/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./Card";
2
+ export { useCardAppearance } from "./useCardAppearance";
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../components/Card/spec.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,128 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import '@testing-library/jest-dom';
4
+ import { Provider } from 'react-redux';
5
+ import { createStore } from 'redux';
6
+ import { ThemeProvider, createTheme } from '@shopgate/engage/styles';
7
+ import Card from "./Card";
8
+
9
+ // ThemeProvider resolves the active breakpoint via matchMedia, which jsdom doesn't implement.
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ Object.defineProperty(window, 'matchMedia', {
12
+ writable: true,
13
+ value: query => ({
14
+ matches: false,
15
+ media: query,
16
+ addEventListener: jest.fn(),
17
+ removeEventListener: jest.fn()
18
+ })
19
+ });
20
+ const theme = createTheme();
21
+ const styleText = () => Array.from(document.styleSheets).flatMap(sheet => {
22
+ try {
23
+ return Array.from(sheet.cssRules);
24
+ } catch {
25
+ return [];
26
+ }
27
+ }).map(rule => rule.cssText).join('');
28
+ const renderCard = (ui, cards = {
29
+ style: 'shadow',
30
+ shadow: {
31
+ size: 'medium'
32
+ }
33
+ }) => {
34
+ const store = createStore(() => ({
35
+ settings: {
36
+ appSettings: {
37
+ cards
38
+ }
39
+ }
40
+ }));
41
+ return render(/*#__PURE__*/_jsx(Provider, {
42
+ store: store,
43
+ children: /*#__PURE__*/_jsx(ThemeProvider, {
44
+ theme: theme,
45
+ children: ui
46
+ })
47
+ }));
48
+ };
49
+ describe('<Card />', () => {
50
+ it('passes id, className and children through', () => {
51
+ renderCard(/*#__PURE__*/_jsx(Card, {
52
+ id: "c1",
53
+ className: "custom",
54
+ "data-testid": "card",
55
+ children: "body"
56
+ }));
57
+ const el = screen.getByTestId('card');
58
+ expect(el).toHaveAttribute('id', 'c1');
59
+ expect(el).toHaveTextContent('body');
60
+ expect(el).toHaveClass('custom');
61
+ });
62
+ it('emits the engage__card, ui-shared__card and engage__paper classes', () => {
63
+ renderCard(/*#__PURE__*/_jsx(Card, {
64
+ "data-testid": "card",
65
+ children: "x"
66
+ }));
67
+ const el = screen.getByTestId('card');
68
+ expect(el).toHaveClass('engage__card');
69
+ expect(el).toHaveClass('ui-shared__card');
70
+ expect(el).toHaveClass('engage__paper');
71
+ });
72
+ it('draws a shadow for the configured shadow style', () => {
73
+ renderCard(/*#__PURE__*/_jsx(Card, {
74
+ "data-testid": "card",
75
+ children: "x"
76
+ }), {
77
+ style: 'shadow',
78
+ shadow: {
79
+ size: 'medium'
80
+ }
81
+ });
82
+ expect(styleText()).toContain('var(--sg-palette-shadow)');
83
+ });
84
+ it('draws the card border for the configured border style', () => {
85
+ renderCard(/*#__PURE__*/_jsx(Card, {
86
+ "data-testid": "card",
87
+ children: "x"
88
+ }), {
89
+ style: 'border',
90
+ shadow: {
91
+ size: 'none'
92
+ }
93
+ });
94
+ expect(styleText()).toContain('var(--sg-components-cards-border)');
95
+ });
96
+ it('lets an explicit variant override the configured appearance', () => {
97
+ renderCard(/*#__PURE__*/_jsx(Card, {
98
+ variant: "outlined",
99
+ "data-testid": "card",
100
+ children: "x"
101
+ }), {
102
+ style: 'shadow',
103
+ shadow: {
104
+ size: 'medium'
105
+ }
106
+ });
107
+ expect(styleText()).toContain('var(--sg-components-cards-border)');
108
+ });
109
+ it('forwards a ref to the rendered element', () => {
110
+ const ref = /*#__PURE__*/React.createRef();
111
+ renderCard(/*#__PURE__*/_jsx(Card, {
112
+ ref: ref,
113
+ "data-testid": "card",
114
+ children: "x"
115
+ }));
116
+ expect(ref.current).toBe(screen.getByTestId('card'));
117
+ });
118
+ it('renders the plain variant', () => {
119
+ renderCard(/*#__PURE__*/_jsx(Card, {
120
+ variant: "plain",
121
+ "data-testid": "card",
122
+ children: "x"
123
+ }));
124
+ const el = screen.getByTestId('card');
125
+ expect(el).toHaveClass('engage__card');
126
+ expect(el).toHaveClass('engage__paper');
127
+ });
128
+ });
@@ -0,0 +1,11 @@
1
+ import type { ShadowSize } from '@shopgate/engage/styles';
2
+ import type { CardVariant } from './Card';
3
+ /**
4
+ * Resolves the merchant-configured card appearance from app settings.
5
+ * @returns The card variant and, for the shadow style, its elevation size.
6
+ */
7
+ export declare const useCardAppearance: () => {
8
+ variant: CardVariant;
9
+ elevation: ShadowSize;
10
+ };
11
+ //# sourceMappingURL=useCardAppearance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCardAppearance.d.ts","sourceRoot":"","sources":["../../../components/Card/useCardAppearance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAQ1C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAQjF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { useSelector } from 'react-redux';
2
+ import { getCardSettings, getCardShadowSize } from '@shopgate/engage/settings/selectors/appSettings';
3
+ const VARIANT_BY_STYLE = {
4
+ shadow: 'elevation',
5
+ border: 'outlined',
6
+ flat: 'elevation'
7
+ };
8
+
9
+ /**
10
+ * Resolves the merchant-configured card appearance from app settings.
11
+ * @returns The card variant and, for the shadow style, its elevation size.
12
+ */
13
+ export const useCardAppearance = () => {
14
+ const {
15
+ style
16
+ } = useSelector(getCardSettings);
17
+ const elevation = useSelector(getCardShadowSize);
18
+ return {
19
+ variant: VARIANT_BY_STYLE[style] ?? 'elevation',
20
+ elevation
21
+ };
22
+ };
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import type { ShadowSize } from '@shopgate/engage/styles';
3
+ export type PaperVariant = 'elevation' | 'outlined';
4
+ export interface PaperOwnProps {
5
+ /** Element or component to render as. @default 'div' */
6
+ component?: React.ElementType;
7
+ /**
8
+ * Depth of the drop shadow. A number indexes `theme.shadows` (0–24), a `ShadowSize` resolves
9
+ * through `theme.shadowSizes`. Ignored unless `variant` is `elevation`. @default 1
10
+ */
11
+ elevation?: number | ShadowSize;
12
+ /** `elevation` draws a shadow, `outlined` a border instead. @default 'elevation' */
13
+ variant?: PaperVariant;
14
+ /** Removes the rounded corners. @default false */
15
+ square?: boolean;
16
+ /**
17
+ * Corner radius. The theme carries a dedicated value per surface — `shape.cardsBorderRadius` for
18
+ * cards. Ignored when `square`.
19
+ * @default theme.shape.borderRadius
20
+ */
21
+ borderRadius?: number | string;
22
+ /**
23
+ * CSS `border` shorthand, drawn only when `variant` is `outlined`.
24
+ * @default `1px solid ${theme.components.border.light}`
25
+ */
26
+ border?: string;
27
+ /**
28
+ * A key of `theme.palette.background` (`default` | `surface` | `emphasized`), or any CSS color.
29
+ * @default 'surface'
30
+ */
31
+ background?: 'default' | 'surface' | 'emphasized' | (string & NonNullable<unknown>);
32
+ /**
33
+ * CSS color the shadow is drawn in. Sets `--sg-palette-shadow` on this element. Ignored unless
34
+ * `variant` is `elevation`.
35
+ */
36
+ shadowColor?: string;
37
+ }
38
+ export type PaperProps = PaperOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof PaperOwnProps> & {
39
+ [key: `data-${string}`]: string;
40
+ };
41
+ /**
42
+ * A surface primitive that owns elevation, variant, corner radius and background — the base the
43
+ * themed `Card` composes. Settings-free; theme only.
44
+ */
45
+ declare const Paper: React.ForwardRefExoticComponent<PaperOwnProps & Omit<React.HTMLAttributes<HTMLElement>, keyof PaperOwnProps> & {
46
+ [key: `data-${string}`]: string;
47
+ } & React.RefAttributes<HTMLElement>>;
48
+ export default Paper;
49
+ //# sourceMappingURL=Paper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Paper.d.ts","sourceRoot":"","sources":["../../../components/Paper/Paper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,UAAU,CAAC;AAEpD,MAAM,WAAW,aAAa;IAC5B,wDAAwD;IACxD,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAChC,oFAAoF;IACpF,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,kDAAkD;IAClD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;IACpF;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GACpB,aAAa,GACX,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,aAAa,CAAC,GAC5D;IAAE,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,CAAA;CAAE,CAAC;AA2BxC;;;GAGG;AACH,QAAA,MAAM,KAAK;;qCAkCT,CAAC;AAIH,eAAe,KAAK,CAAC"}
@@ -0,0 +1,64 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { makeStyles } from '@shopgate/engage/styles';
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ const useStyles = makeStyles({
5
+ name: 'Paper'
6
+ })((theme, p) => {
7
+ const palette = theme.palette.background[p.background];
8
+ return {
9
+ root: {
10
+ position: 'relative',
11
+ backgroundColor: typeof palette === 'string' ? palette : p.background,
12
+ borderRadius: p.square ? 0 : p.borderRadius ?? theme.shape.borderRadius,
13
+ ...(p.variant === 'elevation' && {
14
+ boxShadow: typeof p.elevation === 'number' ? theme.shadows[p.elevation] : theme.shadowSizes[p.elevation],
15
+ ...(p.shadowColor && {
16
+ [theme.vars.palette.shadow]: p.shadowColor
17
+ })
18
+ }),
19
+ ...(p.variant === 'outlined' && {
20
+ border: p.border ?? `1px solid ${theme.components.border.light}`
21
+ })
22
+ }
23
+ };
24
+ });
25
+
26
+ /**
27
+ * A surface primitive that owns elevation, variant, corner radius and background — the base the
28
+ * themed `Card` composes. Settings-free; theme only.
29
+ */
30
+ const Paper = /*#__PURE__*/forwardRef((props, ref) => {
31
+ const {
32
+ children,
33
+ className,
34
+ component: Component = 'div',
35
+ elevation = 1,
36
+ variant = 'elevation',
37
+ square = false,
38
+ borderRadius,
39
+ border,
40
+ background = 'surface',
41
+ shadowColor,
42
+ ...restProps
43
+ } = props;
44
+ const {
45
+ classes,
46
+ cx
47
+ } = useStyles({
48
+ variant,
49
+ elevation,
50
+ square,
51
+ borderRadius,
52
+ border,
53
+ background,
54
+ shadowColor
55
+ });
56
+ return /*#__PURE__*/_jsx(Component, {
57
+ ref: ref,
58
+ className: cx(classes.root, 'engage__paper', className),
59
+ ...restProps,
60
+ children: children
61
+ });
62
+ });
63
+ Paper.displayName = 'Paper';
64
+ export default Paper;
@@ -0,0 +1,3 @@
1
+ export { default } from './Paper';
2
+ export type { PaperProps, PaperOwnProps, PaperVariant } from './Paper';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Paper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1 @@
1
+ export { default } from "./Paper";
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../../components/Paper/spec.tsx"],"names":[],"mappings":"AAEA,OAAO,2BAA2B,CAAC"}