@shopgate/engage 7.32.0-beta.7 → 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 (149) 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 +8 -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 +7 -0
  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/CartSummaryWide/CartSummaryWide.js +2 -2
  23. package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
  24. package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
  25. package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
  26. package/category/components/CategoryImage/index.js +13 -2
  27. package/checkout/components/AddressBook/AddressList.js +14 -23
  28. package/checkout/components/Checkout/CheckoutActions.js +4 -3
  29. package/checkout/components/Checkout/CheckoutAddress.js +8 -0
  30. package/checkout/components/Checkout/CheckoutSection.js +6 -2
  31. package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
  32. package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
  33. package/components/Card/Card.js +1 -1
  34. package/components/ChipLayout/index.js +2 -4
  35. package/components/NavigationHandler/connector.js +1 -1
  36. package/components/NavigationHandler/spec.js +10 -1
  37. package/components/Paper/Paper.d.ts +1 -2
  38. package/components/Paper/Paper.d.ts.map +1 -1
  39. package/components/Tabs/components/Tab.d.ts.map +1 -1
  40. package/components/Tabs/components/Tab.js +14 -16
  41. package/components/Typography/Typography.d.ts +1 -1
  42. package/components/v2/Button/Button.d.ts +24 -13
  43. package/components/v2/Button/Button.d.ts.map +1 -1
  44. package/components/v2/Button/Button.js +89 -37
  45. package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
  46. package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
  47. package/components/v2/ButtonBase/ButtonBase.js +153 -16
  48. package/components/v2/ButtonBase/hooks.d.ts +0 -1
  49. package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
  50. package/components/v2/ButtonBase/hooks.js +36 -12
  51. package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
  52. package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
  53. package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
  54. package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
  55. package/components/v2/CircularProgress/CircularProgress.js +10 -5
  56. package/core/hooks/useNavigation.d.ts +10 -2
  57. package/core/hooks/useNavigation.d.ts.map +1 -1
  58. package/core/hooks/useNavigation.js +1 -2
  59. package/core/initialization/index.d.ts.map +1 -1
  60. package/core/initialization/index.js +24 -5
  61. package/core/router/conductor.d.ts +9 -0
  62. package/core/router/helpers.d.ts +28 -15
  63. package/core/router/helpers.d.ts.map +1 -1
  64. package/core/router/helpers.js +8 -8
  65. package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
  66. package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
  67. package/favorites/components/List/List.d.ts.map +1 -1
  68. package/favorites/components/List/List.js +0 -1
  69. package/favorites/components/List/ListContent.js +4 -5
  70. package/favorites/components/Lists/Lists.js +4 -5
  71. package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
  72. package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
  73. package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
  74. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
  75. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
  76. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
  77. package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
  78. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
  79. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
  80. package/locations/components/ReserveForm/ReserveForm.js +6 -7
  81. package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
  82. package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
  83. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
  84. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
  85. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
  86. package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
  87. package/login/components/ForgotPassword/ForgotPassword.js +11 -23
  88. package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
  89. package/package.json +7 -7
  90. package/page/components/NotFound.d.ts.map +1 -1
  91. package/page/components/NotFound.js +7 -6
  92. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
  93. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
  94. package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
  95. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
  96. package/page/helpers/index.d.ts +5 -2
  97. package/page/helpers/index.d.ts.map +1 -1
  98. package/page/helpers/index.js +8 -5
  99. package/page/widgets/Button/Button.js +2 -3
  100. package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
  101. package/page/widgets/ProductList/ProductList.js +18 -14
  102. package/page/widgets/Video/hooks.d.ts +2 -2
  103. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
  104. package/product/components/ProductGrid/components/Item/index.js +3 -2
  105. package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
  106. package/product/components/ProductImage/ProductImage.js +7 -2
  107. package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
  108. package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
  109. package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
  110. package/push-opt-in/components/PushOptInModal/index.js +4 -4
  111. package/registration/components/Registration/RegistrationFormActions.js +4 -4
  112. package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
  113. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
  114. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
  115. package/reviews/components/Reviews/spec.js +5 -6
  116. package/settings/reducers/appSettings.d.ts.map +1 -1
  117. package/settings/reducers/appSettings.js +9 -1
  118. package/settings/selectors/appSettings.d.ts +16 -0
  119. package/settings/selectors/appSettings.d.ts.map +1 -1
  120. package/settings/selectors/appSettings.js +11 -1
  121. package/settings/types/appSettings.d.ts +23 -2
  122. package/settings/types/appSettings.d.ts.map +1 -1
  123. package/styles/helpers/index.d.ts +1 -0
  124. package/styles/helpers/index.js +1 -0
  125. package/styles/helpers/loadFontCss.d.ts +22 -0
  126. package/styles/helpers/loadFontCss.d.ts.map +1 -0
  127. package/styles/helpers/loadFontCss.js +138 -0
  128. package/styles/helpers/loadThemeCss.d.ts.map +1 -1
  129. package/styles/helpers/loadThemeCss.js +11 -0
  130. package/styles/theme/createTheme/createComponents.types.d.ts +25 -0
  131. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  132. package/styles/theme/createTheme/createComponents.types.js +25 -0
  133. package/styles/theme/createTheme/createShape.d.ts +2 -3
  134. package/styles/theme/createTheme/createShape.d.ts.map +1 -1
  135. package/styles/theme/createTheme/createShape.js +1 -2
  136. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
  137. package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
  138. package/styles/theme/createTheme/createThemeFromColorScheme.js +4 -2
  139. package/styles/theme/createTheme/createTypography.d.ts +2 -1
  140. package/styles/theme/createTheme/createTypography.js +58 -18
  141. package/styles/theme/createTheme/index.js +1 -1
  142. package/styles/theme/index.d.ts +1 -0
  143. package/styles/theme/index.d.ts.map +1 -1
  144. package/tracking/components/CookieConsentModal/index.js +3 -4
  145. package/tracking/components/PrivacySettings/index.js +3 -3
  146. package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
  147. package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
  148. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
  149. package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
@@ -5,6 +5,7 @@ export { setViewportHeight } from "./setViewportHeight";
5
5
  export { toggleBodyScroll } from "./toggleBodyScroll";
6
6
  export { loadCustomStyles } from "./loadCustomStyles";
7
7
  export { loadThemeCss } from "./loadThemeCss";
8
+ export { loadFontCss } from "./loadFontCss";
8
9
  export * from "./color";
9
10
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
10
11
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -7,6 +7,7 @@ export { toggleBodyScroll } from "./toggleBodyScroll";
7
7
  export { initCSSCustomProps, initCSSCustomPropsFallback } from "./initCSSCustomProperties";
8
8
  export { loadCustomStyles } from "./loadCustomStyles";
9
9
  export { loadThemeCss } from "./loadThemeCss";
10
+ export { loadFontCss } from "./loadFontCss";
10
11
  export * from "./color";
11
12
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
12
13
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Syncs the font css links in the document with the passed urls. Tags for urls that are no longer
3
+ * configured are removed, and the remaining ones end up in the dom in the order they were passed -
4
+ * so the global file, passed first, stays above the per variant ones however they were ordered
5
+ * before.
6
+ *
7
+ * Idempotent by design: the admin preview re-sends the app settings while a merchant edits them, so
8
+ * this runs again on every settings update. A tag that is already in place is left untouched, and a
9
+ * tag for a url that is still configured is moved rather than recreated, which would re-request the
10
+ * file.
11
+ *
12
+ * A url is only ever loaded once. Configuring the same file globally and for a variant is normal,
13
+ * and a second link tag for it would apply the same `@font-face` rules twice.
14
+ *
15
+ * Resolves once every newly added file settled, and never rejects - a font file is not guaranteed
16
+ * to exist and must not be able to block app start.
17
+ * @param urls The font css urls to load, in cascade order. Duplicates are dropped, keeping the
18
+ * first occurrence so the cascade order is preserved.
19
+ * @returns A promise that resolves once the new files settled.
20
+ */
21
+ export declare const loadFontCss: (urls?: string[]) => Promise<void>;
22
+ //# sourceMappingURL=loadFontCss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadFontCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadFontCss.ts"],"names":[],"mappings":"AAmGA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,WAAW,GAAU,OAAM,MAAM,EAAO,KAAG,OAAO,CAAC,IAAI,CAqCnE,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
2
+ const REQUEST_TIMEOUT = 3000;
3
+ const LINK_TAG_CLASS = 'font-css';
4
+ const URL_ATTRIBUTE = 'data-font-css-url';
5
+ const INSERTION_POINT_SELECTOR = 'meta[name="font-css-insertion-point"]';
6
+
7
+ /**
8
+ * Reads the font css links that are currently in the document, in document order.
9
+ * @returns The link tags.
10
+ */
11
+ const getExistingTags = () => Array.from(document.querySelectorAll(`link.${LINK_TAG_CLASS}`));
12
+
13
+ /**
14
+ * Inserts a tag after the passed sibling, or appends it when there is none.
15
+ * @param tag The tag to insert.
16
+ * @param sibling The node to insert after.
17
+ */
18
+ const insertAfter = (tag, sibling) => {
19
+ if (!sibling) {
20
+ document.head.appendChild(tag);
21
+ return;
22
+ }
23
+ sibling.parentNode?.insertBefore(tag, sibling.nextSibling);
24
+ };
25
+
26
+ /**
27
+ * Loads a single font css file and inserts its link after the passed sibling. The font css
28
+ * insertion point sits between the emotion one and the theme css one, so these files override the
29
+ * custom properties that theme initialization generates while the theme css file still overrides
30
+ * them in turn. Falls back to appending when the meta is absent.
31
+ *
32
+ * A link applies at its position in the dom rather than at the time it finished loading, so the
33
+ * timeout below only decides how long app start waits - never which styles win. The tag is left in
34
+ * place when it hits, so the file still applies once it eventually loads.
35
+ * @param href The url to load.
36
+ * @param sibling The node to insert after.
37
+ * @returns The inserted link tag and a promise that settles on load, error or timeout.
38
+ */
39
+ const loadOne = (href, sibling) => {
40
+ const linkTag = document.createElement('link');
41
+ linkTag.rel = 'stylesheet';
42
+ linkTag.type = 'text/css';
43
+ linkTag.href = href;
44
+ linkTag.className = LINK_TAG_CLASS;
45
+ linkTag.setAttribute(URL_ATTRIBUTE, href);
46
+ const settled = new Promise(resolve => {
47
+ let done = false;
48
+ let timeout;
49
+
50
+ /**
51
+ * Resolves the promise once, whichever of load / error / timeout comes first.
52
+ */
53
+ const settle = () => {
54
+ if (done) {
55
+ return;
56
+ }
57
+ done = true;
58
+ clearTimeout(timeout);
59
+ resolve();
60
+ };
61
+ linkTag.onload = settle;
62
+ linkTag.onerror = () => {
63
+ withScope(scope => {
64
+ scope.setLevel(SentrySeverity.Error);
65
+ scope.setExtra('fontCssUrl', href);
66
+ captureMessage('Fetching font css failed');
67
+ });
68
+ settle();
69
+ };
70
+ timeout = setTimeout(() => {
71
+ withScope(scope => {
72
+ scope.setLevel(SentrySeverity.Warning);
73
+ scope.setExtra('fontCssUrl', href);
74
+ scope.setExtra('timeout', REQUEST_TIMEOUT);
75
+ captureMessage('Fetching font css took too long');
76
+ });
77
+ settle();
78
+ }, REQUEST_TIMEOUT);
79
+ });
80
+ insertAfter(linkTag, sibling);
81
+ return {
82
+ linkTag,
83
+ settled
84
+ };
85
+ };
86
+
87
+ /**
88
+ * Syncs the font css links in the document with the passed urls. Tags for urls that are no longer
89
+ * configured are removed, and the remaining ones end up in the dom in the order they were passed -
90
+ * so the global file, passed first, stays above the per variant ones however they were ordered
91
+ * before.
92
+ *
93
+ * Idempotent by design: the admin preview re-sends the app settings while a merchant edits them, so
94
+ * this runs again on every settings update. A tag that is already in place is left untouched, and a
95
+ * tag for a url that is still configured is moved rather than recreated, which would re-request the
96
+ * file.
97
+ *
98
+ * A url is only ever loaded once. Configuring the same file globally and for a variant is normal,
99
+ * and a second link tag for it would apply the same `@font-face` rules twice.
100
+ *
101
+ * Resolves once every newly added file settled, and never rejects - a font file is not guaranteed
102
+ * to exist and must not be able to block app start.
103
+ * @param urls The font css urls to load, in cascade order. Duplicates are dropped, keeping the
104
+ * first occurrence so the cascade order is preserved.
105
+ * @returns A promise that resolves once the new files settled.
106
+ */
107
+ export const loadFontCss = async (urls = []) => {
108
+ const wanted = Array.from(new Set(urls));
109
+ const wantedUrls = new Set(wanted);
110
+ const kept = new Map();
111
+ getExistingTags().forEach(tag => {
112
+ const url = tag.getAttribute(URL_ATTRIBUTE) || '';
113
+ if (wantedUrls.has(url) && !kept.has(url)) {
114
+ kept.set(url, tag);
115
+ return;
116
+ }
117
+ tag.remove();
118
+ });
119
+ let sibling = document.querySelector(INSERTION_POINT_SELECTOR);
120
+ const pending = [];
121
+ wanted.forEach(url => {
122
+ const existing = kept.get(url);
123
+ if (existing) {
124
+ if (existing.previousElementSibling !== sibling) {
125
+ insertAfter(existing, sibling);
126
+ }
127
+ sibling = existing;
128
+ return;
129
+ }
130
+ const {
131
+ linkTag,
132
+ settled
133
+ } = loadOne(url, sibling);
134
+ sibling = linkTag;
135
+ pending.push(settled);
136
+ });
137
+ await Promise.all(pending);
138
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"loadThemeCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadThemeCss.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAgF1C,CAAC"}
1
+ {"version":3,"file":"loadThemeCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadThemeCss.ts"],"names":[],"mappings":"AAuCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAqF1C,CAAC"}
@@ -1,9 +1,16 @@
1
1
  import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
2
2
  import { appConfig } from '@shopgate/engage';
3
+ import { isFrontendSettingsAdminPreviewActive } from '@shopgate/engage/admin-preview/helpers';
3
4
  const REQUEST_TIMEOUT = 3000;
4
5
  const LINK_TAG_ID = 'theme-css';
5
6
  const INSERTION_POINT_SELECTOR = 'meta[name="theme-css-insertion-point"]';
6
7
 
8
+ /**
9
+ * Temporary switch. Set to false to load the theme css file in the frontend settings preview
10
+ * again, or remove it together with the guard in loadThemeCss and the import above.
11
+ */
12
+ const SKIP_IN_FRONTEND_SETTINGS_PREVIEW = true;
13
+
7
14
  /**
8
15
  * Inserts the link at the theme css insertion point, which the html template declares between the
9
16
  * emotion insertion point and the preview one. That position is what makes the cascade order
@@ -36,6 +43,10 @@ const insertLinkTag = linkTag => {
36
43
  * @returns A promise that resolves once the file settled.
37
44
  */
38
45
  export const loadThemeCss = () => new Promise(resolve => {
46
+ if (SKIP_IN_FRONTEND_SETTINGS_PREVIEW && isFrontendSettingsAdminPreviewActive()) {
47
+ resolve();
48
+ return;
49
+ }
39
50
  const {
40
51
  themeCssUrl: href
41
52
  } = appConfig;
@@ -205,6 +205,7 @@ export declare const componentsSchema: {
205
205
  };
206
206
  readonly cards: {
207
207
  readonly vars: {
208
+ readonly borderRadius: "";
208
209
  readonly backgroundColor: "";
209
210
  readonly borderWidth: "";
210
211
  readonly borderColor: "";
@@ -221,13 +222,22 @@ export declare const componentsSchema: {
221
222
  };
222
223
  readonly tiles: {
223
224
  readonly vars: {
225
+ readonly borderRadius: "";
224
226
  readonly backgroundColor: "";
227
+ readonly borderWidth: "";
228
+ readonly borderColor: "";
229
+ readonly border: "";
225
230
  readonly padding: "";
226
231
  readonly textPadding: "";
227
232
  readonly textPaddingTop: "";
228
233
  readonly imagePadding: "";
229
234
  };
230
235
  };
236
+ readonly productImage: {
237
+ readonly vars: {
238
+ readonly borderRadius: "";
239
+ };
240
+ };
231
241
  };
232
242
  /**
233
243
  * Default component tokens.
@@ -238,6 +248,11 @@ export declare const componentsSchema: {
238
248
  * - functions get proper `Theme` typing
239
249
  */
240
250
  export declare const componentsDefaults: {
251
+ button: {
252
+ vars: {
253
+ borderRadius: string;
254
+ };
255
+ };
241
256
  border: {
242
257
  vars: {
243
258
  light: string;
@@ -340,6 +355,7 @@ export declare const componentsDefaults: {
340
355
  };
341
356
  cards: {
342
357
  vars: {
358
+ borderRadius: string;
343
359
  backgroundColor: (t: Theme) => string;
344
360
  borderWidth: number;
345
361
  borderColor: string;
@@ -356,13 +372,22 @@ export declare const componentsDefaults: {
356
372
  };
357
373
  tiles: {
358
374
  vars: {
375
+ borderRadius: string;
359
376
  backgroundColor: string;
377
+ borderWidth: number;
378
+ borderColor: string;
379
+ border: string;
360
380
  padding: number;
361
381
  textPadding: number;
362
382
  textPaddingTop: string;
363
383
  imagePadding: number;
364
384
  };
365
385
  };
386
+ productImage: {
387
+ vars: {
388
+ borderRadius: string;
389
+ };
390
+ };
366
391
  };
367
392
  /** Internal defaults type (must cover full schema). */
368
393
  export type ComponentsDefaults = ComponentsOverrideFromSchema<typeof componentsSchema, Theme>;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createComponents.types.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createComponents.types.ts"],"names":[],"mappings":"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"}
@@ -193,6 +193,7 @@ export const componentsSchema = {
193
193
  },
194
194
  cards: {
195
195
  vars: {
196
+ borderRadius: '',
196
197
  backgroundColor: '',
197
198
  borderWidth: '',
198
199
  borderColor: '',
@@ -209,12 +210,21 @@ export const componentsSchema = {
209
210
  },
210
211
  tiles: {
211
212
  vars: {
213
+ borderRadius: '',
212
214
  backgroundColor: '',
215
+ borderWidth: '',
216
+ borderColor: '',
217
+ border: '',
213
218
  padding: '',
214
219
  textPadding: '',
215
220
  textPaddingTop: '',
216
221
  imagePadding: ''
217
222
  }
223
+ },
224
+ productImage: {
225
+ vars: {
226
+ borderRadius: ''
227
+ }
218
228
  }
219
229
  };
220
230
 
@@ -227,6 +237,11 @@ export const componentsSchema = {
227
237
  * - functions get proper `Theme` typing
228
238
  */
229
239
  export const componentsDefaults = {
240
+ button: {
241
+ vars: {
242
+ borderRadius: 'var(--sg-shape-borderRadius, 4px)'
243
+ }
244
+ },
230
245
  border: {
231
246
  vars: {
232
247
  light: '#F2F2F2',
@@ -329,6 +344,7 @@ export const componentsDefaults = {
329
344
  },
330
345
  cards: {
331
346
  vars: {
347
+ borderRadius: 'var(--sg-shape-borderRadius)',
332
348
  backgroundColor: t => t.palette.background.surface,
333
349
  borderWidth: 0,
334
350
  borderColor: 'transparent',
@@ -345,12 +361,21 @@ export const componentsDefaults = {
345
361
  },
346
362
  tiles: {
347
363
  vars: {
364
+ borderRadius: 'var(--sg-shape-borderRadius)',
348
365
  backgroundColor: 'transparent',
366
+ borderWidth: 0,
367
+ borderColor: 'transparent',
368
+ border: 'var(--sg-components-tiles-borderWidth) solid var(--sg-components-tiles-borderColor)',
349
369
  padding: 0,
350
370
  textPadding: 8,
351
371
  textPaddingTop: 'max(var(--sg-components-tiles-textPadding), 16px)',
352
372
  imagePadding: 0
353
373
  }
374
+ },
375
+ productImage: {
376
+ vars: {
377
+ borderRadius: 'var(--sg-shape-borderRadius)'
378
+ }
354
379
  }
355
380
  };
356
381
 
@@ -1,9 +1,8 @@
1
1
  export interface Shape {
2
- borderRadius: number | string;
3
2
  /**
4
- * Corner radius of cards (product cards, content cards).
3
+ * The app wide corner style. Every rounded surface derives from it.
5
4
  */
6
- cardsBorderRadius: number | string;
5
+ borderRadius: number | string;
7
6
  }
8
7
  export type ShapeOptions = Partial<Shape>;
9
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"createShape.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createShape.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B;;OAEG;IACH,iBAAiB,EAAE,MAAM,GAAG,MAAM,CAAC;CACpC;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAO1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,KAAK,CAKrE"}
1
+ {"version":3,"file":"createShape.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createShape.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;CAC/B;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAM1C;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,GAAE,YAAiB,GAAG,KAAK,CAKrE"}
@@ -1,6 +1,5 @@
1
1
  const shape = {
2
- borderRadius: 4,
3
- cardsBorderRadius: 10
2
+ borderRadius: 4
4
3
  };
5
4
 
6
5
  /**
@@ -30,8 +30,10 @@ export declare const contrastColor: (color: string) => string;
30
30
  /**
31
31
  * Creates a theme object for a given color scheme (light or dark).
32
32
  * @param colorScheme The color scheme options.
33
+ * @param cssVarPrefix The theme's css variable prefix. Typography references some of the properties
34
+ * that are generated from it later, so it has to compose the same names.
33
35
  * @returns A theme object for the given color scheme.
34
36
  */
35
- declare const createThemeFromColorScheme: (colorScheme: ColorSchemeOptions) => ColorSchemeTheme;
37
+ declare const createThemeFromColorScheme: (colorScheme: ColorSchemeOptions, cssVarPrefix?: string) => ColorSchemeTheme;
36
38
  export default createThemeFromColorScheme;
37
39
  //# sourceMappingURL=createThemeFromColorScheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createThemeFromColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createThemeFromColorScheme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAcpE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,MAAM,EACb,aAAa,MAAM,GAAG,MAAM,KAC3B,MAAkH,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,KACZ,MAA4D,CAAC;AAEhE;;;;GAIG;AACH,QAAA,MAAM,0BAA0B,GAAI,aAAa,kBAAkB,KAAG,gBA4BrE,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
1
+ {"version":3,"file":"createThemeFromColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createThemeFromColorScheme.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAcpE;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAChB,OAAO,MAAM,EACb,aAAa,MAAM,GAAG,MAAM,KAC3B,MAAkH,CAAC;AAEtH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GACjB,OAAO,MAAM,EACb,cAAa,MAAM,GAAG,MAAY,KACjC,MAAuF,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,OAAO,MAAM,KACZ,MAA4D,CAAC;AAEhE;;;;;;GAMG;AACH,QAAA,MAAM,0BAA0B,GAC9B,aAAa,kBAAkB,EAC/B,eAAe,MAAM,KACpB,gBA4BF,CAAC;AAEF,eAAe,0BAA0B,CAAC"}
@@ -50,9 +50,11 @@ export const contrastColor = color => `oklch(from ${color} var(--__l) 0 h / var(
50
50
  /**
51
51
  * Creates a theme object for a given color scheme (light or dark).
52
52
  * @param colorScheme The color scheme options.
53
+ * @param cssVarPrefix The theme's css variable prefix. Typography references some of the properties
54
+ * that are generated from it later, so it has to compose the same names.
53
55
  * @returns A theme object for the given color scheme.
54
56
  */
55
- const createThemeFromColorScheme = colorScheme => {
57
+ const createThemeFromColorScheme = (colorScheme, cssVarPrefix) => {
56
58
  const {
57
59
  palette: paletteInput = {},
58
60
  typography: typographyInput = {},
@@ -60,7 +62,7 @@ const createThemeFromColorScheme = colorScheme => {
60
62
  shape: shapeInput = {}
61
63
  } = colorScheme;
62
64
  const palette = createPalette(paletteInput);
63
- const typography = createTypography(palette, typographyInput);
65
+ const typography = createTypography(palette, typographyInput, cssVarPrefix);
64
66
  const components = createComponents(componentsInput);
65
67
  const shape = createShape(shapeInput);
66
68
  const theme = {
@@ -51,5 +51,6 @@ export interface TypographyOptions
51
51
 
52
52
  export default function createTypography(
53
53
  palette: Palette,
54
- typography: TypographyOptions | ((palette: Palette) => TypographyOptions)
54
+ typography: TypographyOptions | ((palette: Palette) => TypographyOptions),
55
+ cssVarPrefix?: string
55
56
  ): Typography;
@@ -1,19 +1,41 @@
1
1
  import _merge from "lodash/merge";
2
- import { isDev } from '@shopgate/engage/core/helpers';
2
+ // Imported from the defining modules rather than a barrel: this module runs at import time in
3
+ // every spec that touches the theme, and specs that replace a barrel with a partial mock would
4
+ // leave these undefined.
5
+ import { isDev } from '@shopgate/pwa-common/helpers/environment';
6
+ import { themeConfig } from '@shopgate/pwa-common/helpers/config';
7
+ const {
8
+ fontWeight: buttonFontWeight = 600,
9
+ textTransform: buttonTextTransform
10
+ } = themeConfig?.variables?.buttonBase ?? {};
3
11
  const caseAllCaps = {
4
12
  textTransform: 'uppercase'
5
13
  };
14
+ const caseButton = {
15
+ textTransform: buttonTextTransform === 'uppercase' ? 'uppercase' : 'none'
16
+ };
6
17
  const defaultFontFamily = '"Roboto", "Helvetica", "Arial", sans-serif';
7
18
 
19
+ /**
20
+ * Builds the prefix of the custom properties that cssVarsParser derives from the `typography` keys.
21
+ * Mirrors how the parser composes a name, so a theme configured with a different `cssVarPrefix`
22
+ * references the properties it actually emits.
23
+ * @param {string} cssVarPrefix The theme's css variable prefix.
24
+ * @returns {string} The prefix, e.g. `--sg-typography`.
25
+ */
26
+ const typographyVarPrefix = cssVarPrefix => `--${cssVarPrefix ? `${cssVarPrefix}-` : ''}typography`;
27
+
8
28
  /**
9
29
  * Creates the typography object for the theme.
10
30
  * @param {Object} palette The theme palette.
11
31
  * @param {Object|Function} typography The typography options or a function that returns them.
32
+ * @param {string} [cssVarPrefix] The theme's css variable prefix, matching the one cssVarsParser
33
+ * generates the properties with. Defaults to the `sg` default of createTheme.
12
34
  * @returns {Object} The typography object.
13
35
  * @see @link{https://material.io/design/typography/the-type-system.html}
14
36
  * @see @link{https://material.io/design/typography/understanding-typography.html}
15
37
  */
16
- export default function createTypography(palette, typography) {
38
+ export default function createTypography(palette, typography, cssVarPrefix = 'sg') {
17
39
  const {
18
40
  fontFamily = defaultFontFamily,
19
41
  // The default font size of the Material Specification.
@@ -37,6 +59,23 @@ export default function createTypography(palette, typography) {
37
59
  }
38
60
  }
39
61
  const coef = fontSize / 14;
62
+ const fontWeights = {
63
+ fontWeightLight,
64
+ fontWeightRegular,
65
+ fontWeightMedium,
66
+ fontWeightBold
67
+ };
68
+
69
+ /**
70
+ * Builds a reference to one of the shared font weight custom properties. The property itself is
71
+ * emitted by cssVarsParser from `typography.fontWeight*`, so overriding it on `:root` (admin css,
72
+ * live preview, an extension) cascades into every variant that uses that token. The resolved
73
+ * weight stays as the fallback, so the variant still renders when the property is absent.
74
+ * @param {string} token One of `fontWeightLight`, `fontWeightRegular`, `fontWeightMedium`,
75
+ * `fontWeightBold`.
76
+ * @returns {string} The css var reference.
77
+ */
78
+ const fontWeightVar = token => `var(${typographyVarPrefix(cssVarPrefix)}-${token}, ${fontWeights[token]})`;
40
79
 
41
80
  /**
42
81
  * Calculates a rem value for a passed pixel value.
@@ -47,34 +86,35 @@ export default function createTypography(palette, typography) {
47
86
 
48
87
  /**
49
88
  * Creates a typography variant object.
50
- * @param {number} fontWeight The font weight to use for the variant.
89
+ * @param {string} fontWeightToken The name of the shared font weight token to use, e.g.
90
+ * `fontWeightBold`. The variant references it as a custom property instead of inlining its value.
51
91
  * @param {number} size Font size in pixels.
52
92
  * @param {number} lineHeight Line height as a unitless number.
53
93
  * @param {Object} casing Casing styles to apply, e.g. textTransform.
54
94
  * @returns {Object} The typography variant object.
55
95
  */
56
- const buildVariant = (fontWeight, size, lineHeight, casing) => ({
96
+ const buildVariant = (fontWeightToken, size, lineHeight, casing) => ({
57
97
  fontFamily,
58
- fontWeight,
98
+ fontWeight: fontWeightVar(fontWeightToken),
59
99
  fontSize: pxToRem(size),
60
100
  lineHeight,
61
101
  ...casing,
62
102
  ...allVariants
63
103
  });
64
104
  const variants = {
65
- h1: buildVariant(fontWeightBold, 34, 1.15),
66
- h2: buildVariant(fontWeightBold, 22, 1.3),
67
- h3: buildVariant(fontWeightMedium, 20, 1.35),
68
- h4: buildVariant(fontWeightMedium, 18, 1.4),
69
- h5: buildVariant(fontWeightMedium, 16, 1.5),
70
- h6: buildVariant(fontWeightMedium, 14, 1.5),
71
- subtitle1: buildVariant(fontWeightRegular, 16, 1.75),
72
- subtitle2: buildVariant(fontWeightMedium, 14, 1.57),
73
- body1: buildVariant(fontWeightRegular, 16, 1.5),
74
- body2: buildVariant(fontWeightRegular, 14, 1.43),
75
- button: buildVariant(fontWeightMedium, 14, 1.75, caseAllCaps),
76
- caption: buildVariant(fontWeightRegular, 12, 1.66),
77
- overline: buildVariant(fontWeightRegular, 12, 2.66, caseAllCaps)
105
+ h1: buildVariant('fontWeightBold', 34, 1.15),
106
+ h2: buildVariant('fontWeightBold', 22, 1.3),
107
+ h3: buildVariant('fontWeightMedium', 20, 1.35),
108
+ h4: buildVariant('fontWeightMedium', 18, 1.4),
109
+ h5: buildVariant('fontWeightMedium', 16, 1.5),
110
+ h6: buildVariant('fontWeightMedium', 14, 1.5),
111
+ subtitle1: buildVariant('fontWeightRegular', 16, 1.75),
112
+ subtitle2: buildVariant('fontWeightMedium', 14, 1.57),
113
+ body1: buildVariant('fontWeightRegular', 16, 1.5),
114
+ body2: buildVariant('fontWeightRegular', 14, 1.43),
115
+ button: buildVariant(buttonFontWeight > fontWeightMedium ? 'fontWeightBold' : 'fontWeightMedium', 16, 1.75, caseButton),
116
+ caption: buildVariant('fontWeightRegular', 12, 1.66),
117
+ overline: buildVariant('fontWeightRegular', 12, 2.66, caseAllCaps)
78
118
  };
79
119
  return _merge({
80
120
  pxToRem,
@@ -38,7 +38,7 @@ export const createTheme = (options = {}) => {
38
38
  palette: {
39
39
  mode: type
40
40
  }
41
- }, defaultScheme, scheme));
41
+ }, defaultScheme, scheme), cssVarPrefix);
42
42
  return acc;
43
43
  }, {});
44
44
  const getColorSchemeSelector = createGetColorSchemeSelector(colorSchemeSelector);
@@ -1,6 +1,7 @@
1
1
  export { default as ThemeProvider } from './providers/ThemeProvider';
2
2
  export { createTheme } from './createTheme';
3
3
  export { type ShadowSize } from './createTheme/shadows';
4
+ export type { Variant as TypographyVariant } from './createTheme/createTypography';
4
5
  export type { Theme, Breakpoint, PaletteColorsWithMain, ColorSchemeName, } from './createTheme';
5
6
  export { useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, } from './hooks';
6
7
  export { withTheme, type WithThemeProps } from './hocs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnF,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -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, Link, ConditionalWrapper, Typography } from '@shopgate/engage/components';
5
+ import { Grid, I18n, Modal, Link, ConditionalWrapper, Typography } from '@shopgate/engage/components';
6
+ import { Button } from '@shopgate/engage/components/v2';
6
7
  import { appConfig } from '@shopgate/engage';
7
8
  import connect from "./connector";
8
9
  import cookieImage from "./tracking-opt-in.svg";
@@ -164,21 +165,19 @@ const CookieConsentModal = ({
164
165
  className: classes.buttonWrapper,
165
166
  children: [/*#__PURE__*/_jsx(Button, {
166
167
  onClick: handleAcceptAllCookies,
167
- type: "primary",
168
+ color: "secondary",
168
169
  className: cx(classes.button, 'cookie-consent-modal__button-accept-all'),
169
170
  children: /*#__PURE__*/_jsx(I18n.Text, {
170
171
  string: modalButtonAcceptAll || 'cookieConsentModal.buttonAcceptAll'
171
172
  })
172
173
  }), showRequiredCookiesButton ? /*#__PURE__*/_jsx(Button, {
173
174
  onClick: handleAcceptRequiredCookies,
174
- type: "simple",
175
175
  className: cx(classes.button, 'cookie-consent-modal__button-accept-required'),
176
176
  children: /*#__PURE__*/_jsx(I18n.Text, {
177
177
  string: modalButtonOnlyRequired || 'cookieConsentModal.modalButtonOnlyRequired'
178
178
  })
179
179
  }) : null, /*#__PURE__*/_jsx(Button, {
180
180
  onClick: handleOpenPrivacySettings,
181
- type: "simple",
182
181
  className: cx(classes.button, 'cookie-consent-modal__button-open-settings'),
183
182
  children: /*#__PURE__*/_jsx(I18n.Text, {
184
183
  string: modalButtonConfigureSettings || 'cookieConsentModal.buttonConfigure'