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

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 (205) hide show
  1. package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
  2. package/account/components/Profile/ProfileAddressBook.js +13 -22
  3. package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
  4. package/account/components/Profile/ProfileAddressCard.js +9 -18
  5. package/account/components/Profile/ProfileForm.d.ts.map +1 -1
  6. package/account/components/Profile/ProfileForm.js +15 -42
  7. package/account/components/ProfileContact/ProfileContact.js +13 -21
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  9. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +40 -6
  10. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +9 -2
  11. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  12. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
  13. package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
  14. package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
  15. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
  16. package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
  17. package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
  18. package/back-in-stock/components/BackInStockButton/index.js +5 -5
  19. package/cart/components/CartItem/CartItemProductLayout.js +1 -0
  20. package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
  21. package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
  22. package/cart/components/CartItems/CartItems.js +8 -10
  23. package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
  24. package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
  25. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
  26. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
  27. package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
  28. package/category/components/CategoryImage/index.js +13 -2
  29. package/checkout/components/AddressBook/AddressList.js +14 -23
  30. package/checkout/components/Checkout/CheckoutActions.js +4 -3
  31. package/checkout/components/Checkout/CheckoutAddress.js +8 -0
  32. package/checkout/components/Checkout/CheckoutSection.js +6 -2
  33. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
  34. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
  35. package/components/Card/Card.d.ts +27 -0
  36. package/components/Card/Card.d.ts.map +1 -0
  37. package/components/Card/Card.js +57 -0
  38. package/components/Card/index.d.ts +4 -0
  39. package/components/Card/index.d.ts.map +1 -0
  40. package/components/Card/index.js +2 -0
  41. package/components/Card/spec.d.ts +2 -0
  42. package/components/Card/spec.d.ts.map +1 -0
  43. package/components/Card/spec.js +128 -0
  44. package/components/Card/useCardAppearance.d.ts +11 -0
  45. package/components/Card/useCardAppearance.d.ts.map +1 -0
  46. package/components/Card/useCardAppearance.js +22 -0
  47. package/components/ChipLayout/index.js +2 -4
  48. package/components/NavigationHandler/connector.js +1 -1
  49. package/components/NavigationHandler/spec.js +10 -1
  50. package/components/Paper/Paper.d.ts +48 -0
  51. package/components/Paper/Paper.d.ts.map +1 -0
  52. package/components/Paper/Paper.js +64 -0
  53. package/components/Paper/index.d.ts +3 -0
  54. package/components/Paper/index.d.ts.map +1 -0
  55. package/components/Paper/index.js +1 -0
  56. package/components/Paper/spec.d.ts +2 -0
  57. package/components/Paper/spec.d.ts.map +1 -0
  58. package/components/Paper/spec.js +131 -0
  59. package/components/RadioCard/RadioCard.d.ts.map +1 -1
  60. package/components/RadioCard/RadioCard.js +2 -1
  61. package/components/Tabs/components/Tab.d.ts.map +1 -1
  62. package/components/Tabs/components/Tab.js +14 -16
  63. package/components/Typography/Typography.d.ts +1 -1
  64. package/components/index.d.ts +4 -1
  65. package/components/index.d.ts.map +1 -1
  66. package/components/index.js +3 -2
  67. package/components/v2/Button/Button.d.ts +24 -13
  68. package/components/v2/Button/Button.d.ts.map +1 -1
  69. package/components/v2/Button/Button.js +89 -37
  70. package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
  71. package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
  72. package/components/v2/ButtonBase/ButtonBase.js +153 -16
  73. package/components/v2/ButtonBase/hooks.d.ts +0 -1
  74. package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
  75. package/components/v2/ButtonBase/hooks.js +36 -12
  76. package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
  77. package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  78. package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
  79. package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
  80. package/components/v2/CircularProgress/CircularProgress.js +10 -5
  81. package/core/hooks/useNavigation.d.ts +10 -2
  82. package/core/hooks/useNavigation.d.ts.map +1 -1
  83. package/core/hooks/useNavigation.js +1 -2
  84. package/core/initialization/index.d.ts.map +1 -1
  85. package/core/initialization/index.js +24 -5
  86. package/core/router/conductor.d.ts +9 -0
  87. package/core/router/helpers.d.ts +28 -15
  88. package/core/router/helpers.d.ts.map +1 -1
  89. package/core/router/helpers.js +8 -8
  90. package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
  91. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
  92. package/favorites/components/Item/Item.d.ts +1 -1
  93. package/favorites/components/List/List.d.ts.map +1 -1
  94. package/favorites/components/List/List.js +0 -1
  95. package/favorites/components/List/ListContent.js +4 -5
  96. package/favorites/components/Lists/Lists.js +4 -5
  97. package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
  98. package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
  99. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
  100. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
  101. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
  102. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
  103. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
  104. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
  105. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
  106. package/locations/components/ReserveForm/ReserveForm.js +6 -7
  107. package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
  108. package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
  109. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
  110. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
  111. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
  112. package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
  113. package/login/components/ForgotPassword/ForgotPassword.js +11 -23
  114. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
  115. package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
  116. package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
  117. package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
  118. package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
  119. package/package.json +7 -7
  120. package/page/components/NotFound.d.ts.map +1 -1
  121. package/page/components/NotFound.js +7 -6
  122. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
  123. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
  124. package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
  125. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
  126. package/page/helpers/index.d.ts +5 -2
  127. package/page/helpers/index.d.ts.map +1 -1
  128. package/page/helpers/index.js +8 -5
  129. package/page/widgets/Button/Button.js +2 -3
  130. package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
  131. package/page/widgets/ProductList/ProductList.js +18 -14
  132. package/page/widgets/Video/hooks.d.ts +2 -2
  133. package/product/components/ProductCard/index.js +27 -14
  134. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
  135. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
  136. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
  137. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
  138. package/product/components/ProductGrid/components/Item/index.js +10 -1
  139. package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
  140. package/product/components/ProductImage/ProductImage.js +7 -2
  141. package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
  142. package/product/components/ProductSlider/index.js +4 -2
  143. package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
  144. package/product/components/RelationsSlider/constants.d.ts +3 -0
  145. package/product/components/RelationsSlider/constants.d.ts.map +1 -0
  146. package/product/components/RelationsSlider/constants.js +2 -1
  147. package/product/components/RelationsSlider/hooks.d.ts +6 -0
  148. package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
  149. package/product/components/RelationsSlider/hooks.js +34 -0
  150. package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
  151. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
  152. package/push-opt-in/components/PushOptInModal/index.js +4 -4
  153. package/registration/components/Registration/RegistrationFormActions.js +4 -4
  154. package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
  155. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
  156. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
  157. package/reviews/components/Reviews/spec.js +5 -6
  158. package/settings/action-creators/appSettings.d.ts +3 -3
  159. package/settings/action-creators/appSettings.d.ts.map +1 -1
  160. package/settings/reducers/appSettings.d.ts.map +1 -1
  161. package/settings/reducers/appSettings.js +40 -18
  162. package/settings/reducers/index.d.ts +1 -1
  163. package/settings/selectors/appSettings.d.ts +48 -0
  164. package/settings/selectors/appSettings.d.ts.map +1 -1
  165. package/settings/selectors/appSettings.js +31 -1
  166. package/settings/types/appSettings.d.ts +69 -0
  167. package/settings/types/appSettings.d.ts.map +1 -1
  168. package/styles/helpers/index.d.ts +1 -0
  169. package/styles/helpers/index.js +1 -0
  170. package/styles/helpers/loadFontCss.d.ts +22 -0
  171. package/styles/helpers/loadFontCss.d.ts.map +1 -0
  172. package/styles/helpers/loadFontCss.js +138 -0
  173. package/styles/helpers/loadThemeCss.d.ts.map +1 -1
  174. package/styles/helpers/loadThemeCss.js +11 -0
  175. package/styles/index.d.ts +1 -1
  176. package/styles/index.d.ts.map +1 -1
  177. package/styles/theme/createTheme/createComponents.types.d.ts +75 -0
  178. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  179. package/styles/theme/createTheme/createComponents.types.js +75 -0
  180. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  181. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
  182. package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
  183. package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
  184. package/styles/theme/createTheme/createPalette.types.js +5 -1
  185. package/styles/theme/createTheme/createShape.d.ts +3 -0
  186. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  187. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
  188. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  189. package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
  190. package/styles/theme/createTheme/createTypography.d.ts +2 -1
  191. package/styles/theme/createTheme/createTypography.js +58 -18
  192. package/styles/theme/createTheme/index.js +1 -1
  193. package/styles/theme/createTheme/shadows.d.ts +11 -1
  194. package/styles/theme/createTheme/shadows.d.ts.map +1 -1
  195. package/styles/theme/createTheme/shadows.js +41 -7
  196. package/styles/theme/createTheme/types.d.ts +5 -1
  197. package/styles/theme/createTheme/types.d.ts.map +1 -1
  198. package/styles/theme/index.d.ts +2 -0
  199. package/styles/theme/index.d.ts.map +1 -1
  200. package/tracking/components/CookieConsentModal/index.js +3 -4
  201. package/tracking/components/PrivacySettings/index.js +3 -3
  202. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
  203. package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
  204. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
  205. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
@@ -4,7 +4,8 @@ import { i18n, hasNewServices } from '@shopgate/engage/core/helpers';
4
4
  import { UIEvents } from '@shopgate/engage/core';
5
5
  import { useWidgetSettings } from '@shopgate/engage/core/hooks';
6
6
  import { makeStyles, useTheme } from '@shopgate/engage/styles';
7
- import { RippleButton, QuantityInput } from '@shopgate/engage/components';
7
+ import { QuantityInput } from '@shopgate/engage/components';
8
+ import { Button } from '@shopgate/engage/components/v2';
8
9
  import { broadcastLiveMessage } from '@shopgate/engage/a11y/helpers';
9
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
11
  const useStyles = makeStyles()((theme, {
@@ -76,10 +77,8 @@ const useStyles = makeStyles()((theme, {
76
77
  },
77
78
  button: {
78
79
  width: sizeValue,
79
- ' &&': {
80
- minWidth: sizeValue,
81
- padding: 0
82
- },
80
+ minWidth: sizeValue,
81
+ padding: 0,
83
82
  height: sizeValue,
84
83
  fontSize: `${Math.floor(sizeValue / 28 * 100)}%`,
85
84
  '&:not(:disabled)': {
@@ -91,25 +90,13 @@ const useStyles = makeStyles()((theme, {
91
90
  })
92
91
  }
93
92
  },
94
- buttonRipple: {
95
- padding: 0
96
- },
97
93
  buttonNoRadiusLeft: {
98
- ' &&': {
99
- borderTopLeftRadius: 0,
100
- borderBottomLeftRadius: 0
101
- }
94
+ borderTopLeftRadius: 0,
95
+ borderBottomLeftRadius: 0
102
96
  },
103
97
  buttonNoRadiusRight: {
104
- ' &&': {
105
- borderTopRightRadius: 0,
106
- borderBottomRightRadius: 0
107
- }
108
- },
109
- disabled: {
110
- ' > div': {
111
- padding: 0
112
- }
98
+ borderTopRightRadius: 0,
99
+ borderBottomRightRadius: 0
113
100
  }
114
101
  };
115
102
  });
@@ -251,13 +238,10 @@ const UnitQuantityPicker = ({
251
238
  className: classes.backdrop
252
239
  }), /*#__PURE__*/_jsxs("div", {
253
240
  className: cx(classes.root, className),
254
- children: [/*#__PURE__*/_jsx(RippleButton, {
255
- type: "secondary",
241
+ children: [/*#__PURE__*/_jsx(Button, {
242
+ color: "primary",
256
243
  disabled: !allowDecrement || disabled,
257
- rippleClassName: classes.buttonRipple,
258
- className: cx(classes.button, classes.buttonNoRadiusRight, {
259
- [classes.disabled]: !allowDecrement || disabled
260
- }),
244
+ className: cx(classes.button, classes.buttonNoRadiusRight),
261
245
  onClick: handleDecrement,
262
246
  "aria-label": i18n.text('product.decrease_quantity'),
263
247
  children: "-"
@@ -282,13 +266,10 @@ const UnitQuantityPicker = ({
282
266
  onKeyDown: handleKeyDown,
283
267
  ref: inputRef
284
268
  })]
285
- }), /*#__PURE__*/_jsx(RippleButton, {
286
- type: "secondary",
269
+ }), /*#__PURE__*/_jsx(Button, {
270
+ color: "primary",
287
271
  disabled: !allowIncrement || disabled,
288
- rippleClassName: classes.buttonRipple,
289
- className: cx(classes.button, classes.buttonNoRadiusLeft, {
290
- [classes.disabled]: !allowIncrement || disabled
291
- }),
272
+ className: cx(classes.button, classes.buttonNoRadiusLeft),
292
273
  onClick: handleIncrement,
293
274
  "aria-label": i18n.text('product.increase_quantity'),
294
275
  children: "+"
@@ -2,7 +2,8 @@ import React, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import throttle from 'lodash/throttle';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
- import { Grid, I18n, Button, Modal, Typography } from '@shopgate/engage/components';
5
+ import { Grid, I18n, Modal, Typography } from '@shopgate/engage/components';
6
+ import { Button, ButtonBase } from '@shopgate/engage/components/v2';
6
7
  import { appConfig } from '@shopgate/engage';
7
8
  import pushImage from "./push-opt-in.svg";
8
9
  import connect from "./connector";
@@ -127,14 +128,13 @@ const PushOptInModal = ({
127
128
  id: "pushOptInDialogMessage"
128
129
  }), /*#__PURE__*/_jsx(Button, {
129
130
  onClick: handleAllowPushOptIn,
130
- type: "primary",
131
+ color: "secondary",
131
132
  className: cx(classes.button, 'push-opt-in-modal__button-allow'),
132
133
  children: /*#__PURE__*/_jsx(I18n.Text, {
133
134
  string: modalButtonAllow || 'pushOptInModal.buttonAllow'
134
135
  })
135
- }), /*#__PURE__*/_jsx(Button, {
136
+ }), /*#__PURE__*/_jsx(ButtonBase, {
136
137
  onClick: handleDenyPushOptIn,
137
- type: "plain",
138
138
  className: cx(classes.button, 'push-opt-in-modal__button-deny'),
139
139
  children: /*#__PURE__*/_jsx(I18n.Text, {
140
140
  string: modalButtonDeny || 'pushOptInModal.buttonDeny',
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { i18n, isIOSTheme } from '@shopgate/engage/core';
4
4
  import { makeStyles } from '@shopgate/engage/styles';
5
- import { RippleButton } from '@shopgate/engage/components';
5
+ import { Button } from '@shopgate/engage/components/v2';
6
6
  import { useRegistration } from "../../hooks";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const useStyles = makeStyles()(theme => ({
@@ -15,7 +15,6 @@ const useStyles = makeStyles()(theme => ({
15
15
  } : null)
16
16
  },
17
17
  submitButton: {
18
- width: '100%',
19
18
  marginTop: 8
20
19
  }
21
20
  }));
@@ -48,8 +47,9 @@ const RegisterFormActions = ({
48
47
  }, [guestRegistrationEditMode, isGuest, orderNeedsPayment]);
49
48
  return /*#__PURE__*/_jsx("div", {
50
49
  className: classes.submitButtonContainer,
51
- children: /*#__PURE__*/_jsx(RippleButton, {
52
- type: "secondary",
50
+ children: /*#__PURE__*/_jsx(Button, {
51
+ color: "primary",
52
+ fullWidth: true,
53
53
  onClick: handleSubmit,
54
54
  disabled: isLocked,
55
55
  className: classes.submitButton,
@@ -4,17 +4,15 @@ import { bin2hex } from '@shopgate/pwa-common/helpers/data';
4
4
  import { I18n } from '@shopgate/engage/components';
5
5
  import { ITEM_PATH } from '@shopgate/pwa-common-commerce/product/constants/index';
6
6
  import { REVIEW_PREVIEW_COUNT } from '@shopgate/pwa-common-commerce/reviews/constants';
7
- import ButtonLink from '@shopgate/pwa-ui-shared/ButtonLink';
7
+ import { Button } from '@shopgate/engage/components/v2';
8
8
  import { makeStyles } from '@shopgate/engage/styles';
9
9
  import connect from "./connector";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const useStyles = makeStyles()(theme => ({
11
+ const useStyles = makeStyles()(() => ({
12
12
  container: {
13
13
  display: 'flex',
14
14
  justifyContent: 'flex-end',
15
- textAlign: 'right',
16
- marginTop: theme.spacing(-1),
17
- marginBottom: theme.spacing(-2)
15
+ textAlign: 'right'
18
16
  }
19
17
  }));
20
18
 
@@ -33,7 +31,9 @@ const AllReviewsLink = props => {
33
31
  return /*#__PURE__*/_jsx("div", {
34
32
  className: cx(classes.container, 'engage__reviews__all-reviews-link'),
35
33
  "data-test-id": "showAllReviewsButton",
36
- children: /*#__PURE__*/_jsx(ButtonLink, {
34
+ children: /*#__PURE__*/_jsx(Button, {
35
+ variant: "text",
36
+ color: "primary",
37
37
  href: `${ITEM_PATH}/${bin2hex(props.productId)}/reviews`,
38
38
  children: /*#__PURE__*/_jsx(I18n.Text, {
39
39
  string: "reviews.button_all",
@@ -4,7 +4,7 @@ import { I18n } from '@shopgate/engage/components';
4
4
  import { i18n } from '@shopgate/engage/core/helpers';
5
5
  import { ITEM_PATH } from '@shopgate/pwa-common-commerce/product/constants';
6
6
  import { bin2hex } from '@shopgate/pwa-common/helpers/data';
7
- import ButtonLink from '@shopgate/pwa-ui-shared/ButtonLink';
7
+ import { Button } from '@shopgate/engage/components/v2';
8
8
 
9
9
  /**
10
10
  * Link to add a review.
@@ -16,9 +16,10 @@ const WriteReviewLink = ({
16
16
  }) => /*#__PURE__*/_jsx("div", {
17
17
  "data-test-id": "writeReview",
18
18
  className: "engage__reviews__write-review-link",
19
- children: /*#__PURE__*/_jsx(ButtonLink, {
19
+ children: /*#__PURE__*/_jsx(Button, {
20
+ variant: "text",
21
+ color: "primary",
20
22
  href: `${ITEM_PATH}/${bin2hex(productId)}/write_review`,
21
- noGap: true,
22
23
  "aria-label": i18n.text('reviews.button_add'),
23
24
  children: /*#__PURE__*/_jsx(I18n.Text, {
24
25
  string: "reviews.button_add"
@@ -1,9 +1,17 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
3
  import WriteReviewLink from "./index";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ const mockPush = jest.fn();
6
+ jest.mock('@shopgate/engage/core/hooks/useNavigation', () => ({
7
+ useNavigation: () => ({
8
+ push: mockPush,
9
+ replace: jest.fn()
10
+ })
11
+ }));
4
12
 
5
13
  /* eslint-disable react/prop-types */
6
- import { jsx as _jsx } from "react/jsx-runtime";
14
+
7
15
  jest.mock('@shopgate/engage/components', () => ({
8
16
  I18n: {
9
17
  Text: ({
@@ -13,23 +21,6 @@ jest.mock('@shopgate/engage/components', () => ({
13
21
  })
14
22
  }
15
23
  }));
16
- jest.mock('@shopgate/pwa-ui-shared/ButtonLink', () => {
17
- function ButtonLink(props) {
18
- const {
19
- children,
20
- href,
21
- noGap,
22
- ...rest
23
- } = props;
24
- return /*#__PURE__*/_jsx("a", {
25
- href: href,
26
- ...rest,
27
- "data-no-gap": String(noGap),
28
- children: children
29
- });
30
- }
31
- return ButtonLink;
32
- });
33
24
 
34
25
  /**
35
26
  * Creates component.
@@ -39,13 +30,28 @@ const createComponent = () => render(/*#__PURE__*/_jsx(WriteReviewLink, {
39
30
  productId: "foo"
40
31
  }));
41
32
  describe('<WriteReviewLink>', () => {
33
+ beforeEach(() => {
34
+ jest.clearAllMocks();
35
+ jest.useFakeTimers();
36
+ });
37
+ afterEach(() => {
38
+ jest.useRealTimers();
39
+ });
42
40
  it('should render when current product is set', () => {
43
41
  createComponent();
44
- const link = screen.getByRole('link', {
42
+ expect(screen.getByText('reviews.button_add')).toBeTruthy();
43
+ });
44
+
45
+ // The button renders as an anchor on web builds only, so the navigation itself is the contract.
46
+ it('should navigate to the write review route when pressed', () => {
47
+ createComponent();
48
+ fireEvent.click(screen.getByRole('button', {
45
49
  name: 'reviews.button_add'
50
+ }));
51
+ jest.runAllTimers();
52
+ expect(mockPush).toHaveBeenCalledWith({
53
+ pathname: '/item/666f6f/write_review'
46
54
  });
47
- expect(link).toHaveAttribute('href', '/item/666f6f/write_review');
48
- expect(screen.getByText('reviews.button_add')).toBeTruthy();
49
55
  });
50
56
  });
51
57
 
@@ -40,7 +40,6 @@ jest.mock('@shopgate/engage/components', () => ({
40
40
  })
41
41
  }
42
42
  }));
43
- jest.mock('@shopgate/pwa-ui-shared/ButtonLink', () => 'a');
44
43
 
45
44
  // Mock the getter of the hasReviews key inside the app config, so that we can turn it off later
46
45
  jest.resetModules();
@@ -66,7 +65,7 @@ describe('<Reviews />', () => {
66
65
  expect(screen.getByTestId('reviews-header')).toBeTruthy();
67
66
  expect(screen.getByTestId('reviews-list')).toBeTruthy();
68
67
  expect(screen.getByTestId('reviews-info')).toBeTruthy();
69
- expect(screen.queryByRole('link', {
68
+ expect(screen.queryByRole('button', {
70
69
  name: 'reviews.button_all'
71
70
  })).toBeNull();
72
71
  });
@@ -74,15 +73,15 @@ describe('<Reviews />', () => {
74
73
  createComponent(mockedStateWithAll);
75
74
  expect(screen.getByTestId('reviews-header')).toBeTruthy();
76
75
  expect(screen.getByTestId('reviews-list')).toBeTruthy();
77
- expect(screen.getByRole('link', {
76
+ expect(screen.getByRole('button', {
78
77
  name: 'reviews.button_all'
79
- })).toHaveAttribute('href', '/item/666f6f/reviews');
78
+ })).toBeTruthy();
80
79
  });
81
80
  it('should render reviews, header, but no all reviews link', () => {
82
81
  createComponent(mockedStateWithTwoReviews);
83
82
  expect(screen.getByTestId('reviews-header')).toBeTruthy();
84
83
  expect(screen.getByTestId('reviews-list')).toBeTruthy();
85
- expect(screen.queryByRole('link', {
84
+ expect(screen.queryByRole('button', {
86
85
  name: 'reviews.button_all'
87
86
  })).toBeNull();
88
87
  });
@@ -94,7 +93,7 @@ describe('<Reviews />', () => {
94
93
  expect(container.firstChild).toBeNull();
95
94
  expect(screen.queryByTestId('reviews-header')).toBeNull();
96
95
  expect(screen.queryByTestId('reviews-list')).toBeNull();
97
- expect(screen.queryByRole('link', {
96
+ expect(screen.queryByRole('button', {
98
97
  name: 'reviews.button_all'
99
98
  })).toBeNull();
100
99
  });
@@ -1,12 +1,12 @@
1
- import type { AppSettings } from '../types/appSettings';
1
+ import type { AppSettingsPayload } from '../types/appSettings';
2
2
  /**
3
3
  * Creates the dispatched RECEIVE_APP_SETTINGS action object.
4
4
  * @param settings A list of app settings.
5
5
  * @returns The dispatched action object.
6
6
  */
7
- export declare const receiveAppSettings: (settings: AppSettings) => {
7
+ export declare const receiveAppSettings: (settings: AppSettingsPayload) => {
8
8
  type: string;
9
- settings: AppSettings;
9
+ settings: import("../types/appSettings").DeepPartial<import("../types/appSettings").AppSettings>;
10
10
  };
11
11
  export type ReceiveAppSettingsAction = ReturnType<typeof receiveAppSettings>;
12
12
  //# sourceMappingURL=appSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/action-creators/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,WAAW;;;CAGtD,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/action-creators/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,kBAAkB;;;CAG7D,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/reducers/appSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAa/E,KAAK,iBAAiB,GAAG,wBAAwB,GAAG,aAAa,CAAC;AAQlE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBA+ClC,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,gBAAgB,EAAE,iBAAiB,CAgC5D,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/reducers/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAa/E,KAAK,iBAAiB,GAAG,wBAAwB,GAAG,aAAa,CAAC;AAQlE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBA4DlC,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,gBAAgB,EAAE,iBAAiB,CAmC7D,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,6 +1,4 @@
1
1
  import _merge from "lodash/merge";
2
- import _cloneDeep from "lodash/cloneDeep";
3
- import { produce } from 'immer';
4
2
  import { RECEIVE_APP_SETTINGS } from "../constants/appSettings";
5
3
  import { DEFAULT_IMAGE_FILL_COLOR, DEFAULT_IMAGE_FILL_TRANSPARENT, DEFAULT_IMAGE_QUALITY, DEFAULT_SHOW_INNER_SHADOW } from "../constants/imageSettings";
6
4
  // Deliberately not exported from the "helpers" barrel - they normalize values on their way into
@@ -45,8 +43,27 @@ export const DEFAULT_APP_SETTINGS = {
45
43
  },
46
44
  rating: {
47
45
  showEmptyStars: false
46
+ },
47
+ card: {
48
+ productName: {
49
+ maxLines: 3
50
+ }
51
+ },
52
+ tile: {
53
+ productName: {
54
+ maxLines: 3
55
+ }
56
+ }
57
+ },
58
+ cards: {
59
+ style: 'shadow',
60
+ shadow: {
61
+ size: 'medium'
48
62
  }
49
63
  },
64
+ typography: {
65
+ variants: {}
66
+ },
50
67
  images: {
51
68
  quality: DEFAULT_IMAGE_QUALITY,
52
69
  // Already in the image service's format, so the unhydrated path needs no conversion.
@@ -70,35 +87,40 @@ export const DEFAULT_APP_SETTINGS = {
70
87
  */
71
88
  const appSettings = (state, action = {
72
89
  type: ''
73
- }) => produce(state ?? DEFAULT_APP_SETTINGS, draft => {
90
+ }) => {
74
91
  if (isReceiveAppSettingsAction(action)) {
75
92
  const {
76
- images
93
+ images,
94
+ typography
77
95
  } = action.settings ?? {};
78
96
 
79
- // A cleared branch is replaced outright, then kept out of the merge below. Merging the defaults
80
- // in would only add to it, leaving whatever an earlier payload configured in place.
81
- if (images === null) {
82
- draft.images = _cloneDeep(DEFAULT_APP_SETTINGS.images);
83
- } else if (images?.product === null) {
84
- draft.images.product = _cloneDeep(DEFAULT_APP_SETTINGS.images.product);
85
- }
86
-
87
- // Deep merged so a partial payload keeps the defaults for whatever the source omits.
88
- _merge(draft, {
97
+ // Merged over the defaults rather than over the current state, so a field an incoming payload
98
+ // omits falls back to its default instead of keeping the value of an earlier one. The admin
99
+ // preview needs that: it stops sending a shadow size once the card style isn't `shadow`, and it
100
+ // clears a whole branch by sending a null.
101
+ const nextState = _merge({}, DEFAULT_APP_SETTINGS, {
89
102
  ...action.settings,
103
+ // A cleared branch is mapped to undefined, which merge skips, so the defaults it started from
104
+ // stay in place. A null would be written into the slice like any other value.
90
105
  images: images === null ? undefined : {
91
106
  ...images,
92
107
  product: images?.product ?? undefined
108
+ },
109
+ typography: typography === null ? undefined : {
110
+ ...typography,
111
+ variants: typography?.variants ?? undefined
93
112
  }
113
+ }, {
114
+ isHydrated: true
94
115
  });
95
116
 
96
117
  // Converted on the way in, so the slice holds wire ready values and every image url does not
97
118
  // pay for it. Unconditional, because an empty string or a null reaches here like any other
98
119
  // value - both converters are idempotent.
99
- draft.images.fillColor = toThumborColor(draft.images.fillColor);
100
- draft.images.quality = toImageQuality(draft.images.quality);
101
- draft.isHydrated = true;
120
+ nextState.images.fillColor = toThumborColor(nextState.images.fillColor);
121
+ nextState.images.quality = toImageQuality(nextState.images.quality);
122
+ return nextState;
102
123
  }
103
- });
124
+ return state ?? DEFAULT_APP_SETTINGS;
125
+ };
104
126
  export default appSettings;
@@ -5,7 +5,7 @@ export declare const settings: import("redux").Reducer<{
5
5
  appSettings: import("../types/appSettings").AppSettingsSlice;
6
6
  }, ({
7
7
  type: string;
8
- settings: import("../types/appSettings").AppSettings;
8
+ settings: import("../types/appSettings").DeepPartial<import("../types/appSettings").AppSettings>;
9
9
  } | import("redux").UnknownAction) | import("redux").Action<string>, Partial<{
10
10
  config: Object | undefined;
11
11
  shopSettings: Object | undefined;
@@ -87,4 +87,52 @@ export declare const getImageSettings: ((state: AppSettingsState) => import("../
87
87
  }> & {
88
88
  clearCache: () => void;
89
89
  };
90
+ /**
91
+ * Selects the max number of lines a product card name is clamped to.
92
+ */
93
+ export declare const getProductCardNameMaxLines: ((state: AppSettingsState) => number) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => number, {
94
+ clearCache: () => void;
95
+ }> & {
96
+ clearCache: () => void;
97
+ };
98
+ /**
99
+ * Selects the max number of lines a product tile name is clamped to.
100
+ */
101
+ export declare const getProductTileNameMaxLines: ((state: AppSettingsState) => number) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => number, {
102
+ clearCache: () => void;
103
+ }> & {
104
+ clearCache: () => void;
105
+ };
106
+ /**
107
+ * Selects the themed card settings (style and shadow size).
108
+ */
109
+ export declare const getCardSettings: ((state: AppSettingsState) => import("../types/appSettings").CardSettings) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => import("../types/appSettings").CardSettings, {
110
+ clearCache: () => void;
111
+ }> & {
112
+ clearCache: () => void;
113
+ };
114
+ /**
115
+ * Selects the effective card shadow size. `none` unless the shadow style is selected.
116
+ */
117
+ export declare const getCardShadowSize: ((state: AppSettingsState) => import("../../styles").ShadowSize) & import("reselect").OutputSelectorFields<(args_0: import("../types/appSettings").CardSettings) => import("../../styles").ShadowSize, {
118
+ clearCache: () => void;
119
+ }> & {
120
+ clearCache: () => void;
121
+ };
122
+ /**
123
+ * Selects the typography settings.
124
+ */
125
+ export declare const getTypographySettings: ((state: AppSettingsState) => import("../types/appSettings").TypographySettings) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => import("../types/appSettings").TypographySettings, {
126
+ clearCache: () => void;
127
+ }> & {
128
+ clearCache: () => void;
129
+ };
130
+ /**
131
+ * Selects the font stylesheets to load, global file first and without duplicates.
132
+ */
133
+ export declare const getTypographyFontCssUrls: ((state: AppSettingsState) => string[]) & import("reselect").OutputSelectorFields<(args_0: import("../types/appSettings").TypographySettings) => string[], {
134
+ clearCache: () => void;
135
+ }> & {
136
+ clearCache: () => void;
137
+ };
90
138
  //# sourceMappingURL=appSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/selectors/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBACR,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;CAGrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAG7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;CAGjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;CAGzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAG5B,CAAC"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/selectors/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBACR,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;CAGrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;CAG7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;CAGjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;CAGzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAG5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;CAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;CAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;CAG3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;CAG7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;CAGjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC"}
@@ -45,4 +45,34 @@ export const getShowEmptyRatingStars = createSelector(getAppSettingsState, appSe
45
45
  /**
46
46
  * Selects the image settings.
47
47
  */
48
- export const getImageSettings = createSelector(getAppSettingsState, appSettings => appSettings.images);
48
+ export const getImageSettings = createSelector(getAppSettingsState, appSettings => appSettings.images);
49
+
50
+ /**
51
+ * Selects the max number of lines a product card name is clamped to.
52
+ */
53
+ export const getProductCardNameMaxLines = createSelector(getAppSettingsState, appSettings => appSettings.product.card.productName.maxLines);
54
+
55
+ /**
56
+ * Selects the max number of lines a product tile name is clamped to.
57
+ */
58
+ export const getProductTileNameMaxLines = createSelector(getAppSettingsState, appSettings => appSettings.product.tile.productName.maxLines);
59
+
60
+ /**
61
+ * Selects the themed card settings (style and shadow size).
62
+ */
63
+ export const getCardSettings = createSelector(getAppSettingsState, appSettings => appSettings.cards);
64
+
65
+ /**
66
+ * Selects the effective card shadow size. `none` unless the shadow style is selected.
67
+ */
68
+ export const getCardShadowSize = createSelector(getCardSettings, cards => cards.style === 'shadow' ? cards.shadow.size : 'none');
69
+
70
+ /**
71
+ * Selects the typography settings.
72
+ */
73
+ export const getTypographySettings = createSelector(getAppSettingsState, appSettings => appSettings.typography);
74
+
75
+ /**
76
+ * Selects the font stylesheets to load, global file first and without duplicates.
77
+ */
78
+ export const getTypographyFontCssUrls = createSelector(getTypographySettings, typography => Array.from(new Set([typography.fontCssUrl].concat(Object.values(typography.variants).map(variant => variant?.fontCssUrl)).filter(url => typeof url === 'string' && url.length > 0))));
@@ -1,3 +1,12 @@
1
+ import type { ShadowSize, TypographyVariant } from '@shopgate/engage/styles/theme';
2
+ export type { ShadowSize, TypographyVariant };
3
+ /**
4
+ * Recursively optional variant of `T`. The settings sources send only what a merchant configured,
5
+ * and the admin preview additionally prunes the fields its visibility conditions hide.
6
+ */
7
+ export type DeepPartial<T> = {
8
+ [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
9
+ };
1
10
  export interface AppSettingsState {
2
11
  settings: {
3
12
  appSettings: AppSettingsSlice;
@@ -23,6 +32,20 @@ export type ProductColumns = PerScreenSize;
23
32
  export interface ProductGridSettings {
24
33
  columns: ProductColumns;
25
34
  }
35
+ /**
36
+ * Name-clamping shared by the card and tile product surfaces.
37
+ */
38
+ export interface ProductNameSettings {
39
+ /** Max number of lines the product name is clamped to before an ellipsis. */
40
+ maxLines: number;
41
+ }
42
+ /**
43
+ * Drop shadow of the card surface.
44
+ */
45
+ export interface ShadowSettings {
46
+ /** Which preset elevation to draw. `none` renders no shadow at all. */
47
+ size: ShadowSize;
48
+ }
26
49
  /**
27
50
  * Number of slides to render side by side, keyed by screen size. Fractional values are allowed.
28
51
  */
@@ -49,6 +72,25 @@ export interface ProductSettings {
49
72
  grid: ProductGridSettings;
50
73
  slider: ProductSliderSettings;
51
74
  rating: ProductRatingSettings;
75
+ /** Product cards (sliders, relations, live shopping). */
76
+ card: {
77
+ productName: ProductNameSettings;
78
+ };
79
+ /** Product grid tiles. */
80
+ tile: {
81
+ productName: ProductNameSettings;
82
+ };
83
+ }
84
+ /**
85
+ * The visual style of the card surface.
86
+ */
87
+ export type CardStyle = 'shadow' | 'border' | 'flat';
88
+ /**
89
+ * Settings for the themed card surface (checkout sections, address cards, sliders).
90
+ */
91
+ export interface CardSettings {
92
+ style: CardStyle;
93
+ shadow: ShadowSettings;
52
94
  }
53
95
  /**
54
96
  * An aspect ratio expressed as width and height parts. Only the proportion matters -
@@ -171,7 +213,34 @@ export interface AppSettings {
171
213
  * Settings for images that are served through the image service.
172
214
  */
173
215
  images: ImageSettings;
216
+ cards: CardSettings;
217
+ typography: TypographySettings;
174
218
  }
219
+ /**
220
+ * A font stylesheet to load. The file carries the `@font-face` rules and points its target at the
221
+ * new family itself, e.g. `:root { --sg-typography-h1-fontFamily: 'Recoleta'; }`.
222
+ */
223
+ export interface FontCssSettings {
224
+ /**
225
+ * Absolute url of the stylesheet.
226
+ */
227
+ fontCssUrl?: string;
228
+ }
229
+ /**
230
+ * Typography settings. The top level file applies to everything, a variant entry only to that
231
+ * variant. Variant files are loaded after the global one, so they win at equal specificity.
232
+ */
233
+ export interface TypographySettings extends FontCssSettings {
234
+ /**
235
+ * Per variant font stylesheets, keyed by typography variant.
236
+ */
237
+ variants: Partial<Record<TypographyVariant, FontCssSettings>>;
238
+ }
239
+ /**
240
+ * What a settings source actually sends. Every field is optional, so the reducer fills the gaps
241
+ * from its defaults instead of leaving consumers with undefined.
242
+ */
243
+ export type AppSettingsPayload = DeepPartial<AppSettings>;
175
244
  /**
176
245
  * The stored app settings slice. Extends the raw {@link AppSettings} values
177
246
  * with metadata that is derived by the reducer rather than supplied by a
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/types/appSettings.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,WAAW,EAAE,gBAAgB,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE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