@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.
- package/account/components/Profile/ProfileAddressBook.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressBook.js +13 -22
- package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressCard.js +9 -18
- package/account/components/Profile/ProfileForm.d.ts.map +1 -1
- package/account/components/Profile/ProfileForm.js +15 -42
- package/account/components/ProfileContact/ProfileContact.js +13 -21
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
- package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +40 -6
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +9 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts +32 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/_internal/initialFrontendSettings.js +43 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts +22 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.d.ts.map +1 -0
- package/admin-preview/initialization/awaitInitialFrontendSettings.js +84 -0
- package/back-in-stock/components/BackInStockButton/index.js +5 -5
- package/cart/components/CartItem/CartItemProductLayout.js +1 -0
- package/cart/components/CartItem/CartItemProductLayoutWideRemoveItem.js +7 -14
- package/cart/components/CartItems/CartItemCardReservationLabelChangeStore.js +6 -24
- package/cart/components/CartItems/CartItems.js +8 -10
- package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
- package/cart/components/CartSummaryWide/CartSummaryWide.js +2 -2
- package/cart/components/CartSummaryWide/CartSummaryWideCheckoutButton.js +9 -23
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +8 -30
- package/cart/components/PaymentBar/testUtils/mockFactories.js +4 -11
- package/category/components/CategoryImage/index.js +13 -2
- package/checkout/components/AddressBook/AddressList.js +14 -23
- package/checkout/components/Checkout/CheckoutActions.js +4 -3
- package/checkout/components/Checkout/CheckoutAddress.js +8 -0
- package/checkout/components/Checkout/CheckoutSection.js +6 -2
- package/checkout/components/CheckoutConfirmation/CheckoutConfirmation.js +6 -7
- package/checkout/components/ResponsiveBackButton/ResponsiveBackButton.js +7 -17
- package/components/Card/Card.d.ts +27 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.js +57 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +2 -0
- package/components/Card/spec.d.ts +2 -0
- package/components/Card/spec.d.ts.map +1 -0
- package/components/Card/spec.js +128 -0
- package/components/Card/useCardAppearance.d.ts +11 -0
- package/components/Card/useCardAppearance.d.ts.map +1 -0
- package/components/Card/useCardAppearance.js +22 -0
- package/components/ChipLayout/index.js +2 -4
- package/components/NavigationHandler/connector.js +1 -1
- package/components/NavigationHandler/spec.js +10 -1
- package/components/Paper/Paper.d.ts +48 -0
- package/components/Paper/Paper.d.ts.map +1 -0
- package/components/Paper/Paper.js +64 -0
- package/components/Paper/index.d.ts +3 -0
- package/components/Paper/index.d.ts.map +1 -0
- package/components/Paper/index.js +1 -0
- package/components/Paper/spec.d.ts +2 -0
- package/components/Paper/spec.d.ts.map +1 -0
- package/components/Paper/spec.js +131 -0
- package/components/RadioCard/RadioCard.d.ts.map +1 -1
- package/components/RadioCard/RadioCard.js +2 -1
- package/components/Tabs/components/Tab.d.ts.map +1 -1
- package/components/Tabs/components/Tab.js +14 -16
- package/components/Typography/Typography.d.ts +1 -1
- package/components/index.d.ts +4 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +3 -2
- package/components/v2/Button/Button.d.ts +24 -13
- package/components/v2/Button/Button.d.ts.map +1 -1
- package/components/v2/Button/Button.js +89 -37
- package/components/v2/ButtonBase/ButtonBase.d.ts +50 -10
- package/components/v2/ButtonBase/ButtonBase.d.ts.map +1 -1
- package/components/v2/ButtonBase/ButtonBase.js +153 -16
- package/components/v2/ButtonBase/hooks.d.ts +0 -1
- package/components/v2/ButtonBase/hooks.d.ts.map +1 -1
- package/components/v2/ButtonBase/hooks.js +36 -12
- package/components/v2/ButtonGroup/ButtonGroup.d.ts +11 -5
- package/components/v2/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/components/v2/ButtonGroup/ButtonGroup.js +30 -18
- package/components/v2/CircularProgress/CircularProgress.d.ts.map +1 -1
- package/components/v2/CircularProgress/CircularProgress.js +10 -5
- package/core/hooks/useNavigation.d.ts +10 -2
- package/core/hooks/useNavigation.d.ts.map +1 -1
- package/core/hooks/useNavigation.js +1 -2
- package/core/initialization/index.d.ts.map +1 -1
- package/core/initialization/index.js +24 -5
- package/core/router/conductor.d.ts +9 -0
- package/core/router/helpers.d.ts +28 -15
- package/core/router/helpers.d.ts.map +1 -1
- package/core/router/helpers.js +8 -8
- package/development/components/DevelopmentSettings/DevelopmentSettings.js +3 -3
- package/favorites/components/FavoriteButtonWide/FavoriteButtonWide.js +7 -17
- package/favorites/components/Item/Item.d.ts +1 -1
- package/favorites/components/List/List.d.ts.map +1 -1
- package/favorites/components/List/List.js +0 -1
- package/favorites/components/List/ListContent.js +4 -5
- package/favorites/components/Lists/Lists.js +4 -5
- package/filter/components/FilterPageContent/components/ApplyButton/index.js +8 -10
- package/filter/components/FilterPageContent/components/ResetButton/index.js +8 -6
- package/locations/components/ChangeLocationButton/ChangeLocationButton.js +10 -14
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotDialog.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcher.js +1 -1
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +8 -13
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherDefault.js +10 -10
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +8 -14
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherDefault.js +9 -10
- package/locations/components/ReserveForm/ReserveForm.js +6 -7
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +2 -4
- package/locations/components/StoreDetails/components/StoreDetails.js +5 -10
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +13 -21
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +5 -11
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +5 -11
- package/locations/components/StoreList/StoreSelectLocationButton.js +5 -11
- package/login/components/ForgotPassword/ForgotPassword.js +11 -23
- package/orders/components/OrderDetails/OrderDetailsAuthenticate.js +5 -7
- package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
- package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
- package/package.json +7 -7
- package/page/components/NotFound.d.ts.map +1 -1
- package/page/components/NotFound.js +7 -6
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +1 -1
- package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.js +2 -2
- package/page/components/WidgetVideo/WidgetVideo.d.ts +1 -1
- package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -1
- package/page/helpers/index.d.ts +5 -2
- package/page/helpers/index.d.ts.map +1 -1
- package/page/helpers/index.js +8 -5
- package/page/widgets/Button/Button.js +2 -3
- package/page/widgets/NestedCategoryFilter/NestedCategoryFilter.js +8 -8
- package/page/widgets/ProductList/ProductList.js +18 -14
- package/page/widgets/Video/hooks.d.ts +2 -2
- package/product/components/ProductCard/index.js +27 -14
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
- package/product/components/ProductGrid/components/Item/index.js +10 -1
- package/product/components/ProductImage/ProductImage.d.ts.map +1 -1
- package/product/components/ProductImage/ProductImage.js +7 -2
- package/product/components/ProductImage/ProductImagePlaceholder.js +3 -3
- package/product/components/ProductSlider/index.js +4 -2
- package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
- package/product/components/RelationsSlider/constants.d.ts +3 -0
- package/product/components/RelationsSlider/constants.d.ts.map +1 -0
- package/product/components/RelationsSlider/constants.js +2 -1
- package/product/components/RelationsSlider/hooks.d.ts +6 -0
- package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
- package/product/components/RelationsSlider/hooks.js +34 -0
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.d.ts.map +1 -1
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +14 -33
- package/push-opt-in/components/PushOptInModal/index.js +4 -4
- package/registration/components/Registration/RegistrationFormActions.js +4 -4
- package/reviews/components/Reviews/components/AllReviewsLink/index.js +6 -6
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +4 -3
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +28 -22
- package/reviews/components/Reviews/spec.js +5 -6
- package/settings/action-creators/appSettings.d.ts +3 -3
- package/settings/action-creators/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +40 -18
- package/settings/reducers/index.d.ts +1 -1
- package/settings/selectors/appSettings.d.ts +48 -0
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +31 -1
- package/settings/types/appSettings.d.ts +69 -0
- package/settings/types/appSettings.d.ts.map +1 -1
- package/styles/helpers/index.d.ts +1 -0
- package/styles/helpers/index.js +1 -0
- package/styles/helpers/loadFontCss.d.ts +22 -0
- package/styles/helpers/loadFontCss.d.ts.map +1 -0
- package/styles/helpers/loadFontCss.js +138 -0
- package/styles/helpers/loadThemeCss.d.ts.map +1 -1
- package/styles/helpers/loadThemeCss.js +11 -0
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.d.ts +75 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +75 -0
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
- package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
- package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createPalette.types.js +5 -1
- package/styles/theme/createTheme/createShape.d.ts +3 -0
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +3 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.js +6 -3
- package/styles/theme/createTheme/createTypography.d.ts +2 -1
- package/styles/theme/createTheme/createTypography.js +58 -18
- package/styles/theme/createTheme/index.js +1 -1
- package/styles/theme/createTheme/shadows.d.ts +11 -1
- package/styles/theme/createTheme/shadows.d.ts.map +1 -1
- package/styles/theme/createTheme/shadows.js +41 -7
- package/styles/theme/createTheme/types.d.ts +5 -1
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/index.d.ts +2 -0
- package/styles/theme/index.d.ts.map +1 -1
- package/tracking/components/CookieConsentModal/index.js +3 -4
- package/tracking/components/PrivacySettings/index.js +3 -3
- package/cart/components/PaymentBar/PaymentBarReserveButton.connector.js +0 -6
- package/cart/components/PaymentBar/PaymentBarReserveButton.js +0 -71
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.connector.js +0 -16
- package/locations/components/StoreFinder/StoreFinderGetDirectionsButton.js +0 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wDAAwD;IACvE;;OAEG;IACH,kBAAkB,EAAE,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;IACvE;;;OAGG;IACH,mBAAmB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6CAA6C,GACxD,WAAU,OAAO,CAAC,yBAAyB,CAAM,KAChD,wDAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,aAAa,OAAO,KAAG,MAQjE,CAAC;AAEF;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../page/helpers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B;;OAEG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wDAAwD;IACvE;;OAEG;IACH,kBAAkB,EAAE,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,YAAY,CAAC;IACvE;;;OAGG;IACH,mBAAmB,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACxC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,6CAA6C,GACxD,WAAU,OAAO,CAAC,yBAAyB,CAAM,KAChD,wDAyBF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,aAAa,OAAO,KAAG,MAQjE,CAAC;AAEF;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,YAAY,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mCAAmC,GAC9C,sCAAsC,kBAAkB,KACvD,MAKF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,MAAM,KAAK,MAAM,KAAG,OAAkC,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAP8B,MAAM,KAAG,OAOgB,CAAC"}
|
package/page/helpers/index.js
CHANGED
|
@@ -51,19 +51,22 @@ export const parseImageUrl = (url, useHighRes) => {
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* Retrieves the border radius based on the widget config.
|
|
54
|
+
*
|
|
55
|
+
* `default` follows the app wide corner style, so it is returned as a reference to the theme's
|
|
56
|
+
* shape variable rather than a resolved length.
|
|
54
57
|
* @param params The helper parameters.
|
|
55
58
|
* @param params.borderRadius The border radius option.
|
|
56
59
|
* @param params.borderRadiusCustom The custom border radius value.
|
|
57
|
-
* @returns The resolved border radius.
|
|
60
|
+
* @returns The resolved border radius as a CSS length.
|
|
58
61
|
*/
|
|
59
62
|
export const resolveBorderRadiusFromWidgetConfig = ({
|
|
60
63
|
borderRadius,
|
|
61
64
|
borderRadiusCustom
|
|
62
65
|
}) => {
|
|
63
|
-
if (borderRadius === 'none') return 0;
|
|
64
|
-
if (borderRadius === 'rounded') return
|
|
65
|
-
if (borderRadius === 'custom' && typeof borderRadiusCustom === 'number') return borderRadiusCustom
|
|
66
|
-
return
|
|
66
|
+
if (borderRadius === 'none') return '0';
|
|
67
|
+
if (borderRadius === 'rounded') return '16px';
|
|
68
|
+
if (borderRadius === 'custom' && typeof borderRadiusCustom === 'number') return `${borderRadiusCustom}px`;
|
|
69
|
+
return 'var(--sg-shape-borderRadius)';
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { Button } from '@shopgate/engage/components';
|
|
2
|
+
import { Button } from '@shopgate/engage/components/v2';
|
|
3
3
|
import { useWidget } from '@shopgate/engage/page/hooks';
|
|
4
4
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
5
5
|
import { useNavigation } from '@shopgate/engage/core';
|
|
@@ -46,9 +46,8 @@ const ButtonWidget = () => {
|
|
|
46
46
|
return /*#__PURE__*/_jsx("div", {
|
|
47
47
|
className: classes.root,
|
|
48
48
|
children: /*#__PURE__*/_jsx(Button, {
|
|
49
|
-
|
|
49
|
+
color: "primary",
|
|
50
50
|
onClick: handleClick,
|
|
51
|
-
wrapContent: false,
|
|
52
51
|
children: /*#__PURE__*/_jsx("span", {
|
|
53
52
|
className: classes.text,
|
|
54
53
|
children: text
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { I18n
|
|
2
|
+
import { I18n } from '@shopgate/engage/components';
|
|
3
3
|
import { bin2hex } from '@shopgate/engage/core/helpers';
|
|
4
4
|
import { CATEGORY_PATH } from '@shopgate/engage/category';
|
|
5
5
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
6
|
+
import { Button } from '@shopgate/engage/components/v2';
|
|
6
7
|
import { useRoute, usePrevious, useLocalStorage } from '@shopgate/engage/core/hooks';
|
|
7
8
|
import { router } from '@virtuous/conductor';
|
|
8
9
|
import CategoryPicker from "./components/Picker";
|
|
@@ -16,10 +17,8 @@ const useStyles = makeStyles()(theme => ({
|
|
|
16
17
|
paddingBottom: theme.spacing(2)
|
|
17
18
|
},
|
|
18
19
|
buttonContainer: {
|
|
19
|
-
padding: theme.spacing(0, 2)
|
|
20
|
-
|
|
21
|
-
button: {
|
|
22
|
-
width: '100%'
|
|
20
|
+
padding: theme.spacing(0, 2),
|
|
21
|
+
margin: theme.spacing(1, 0)
|
|
23
22
|
}
|
|
24
23
|
}));
|
|
25
24
|
|
|
@@ -142,11 +141,12 @@ const NestedCategoryFilter = () => {
|
|
|
142
141
|
className: "widget__nested-category-filter__headline"
|
|
143
142
|
}) : null, categoryPickers, /*#__PURE__*/_jsx("div", {
|
|
144
143
|
className: cx(classes.buttonContainer, 'widget__nested-category-filter__button-container'),
|
|
145
|
-
children: /*#__PURE__*/_jsx(
|
|
146
|
-
className: cx(classes.button, 'widget__nested-category-filter__CTA-button'),
|
|
144
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
147
145
|
href: `${CATEGORY_PATH}/${bin2hex(state.buttonCategoryId)}`,
|
|
146
|
+
color: "primary",
|
|
147
|
+
fullWidth: true,
|
|
148
|
+
className: "widget__nested-category-filter__CTA-button",
|
|
148
149
|
disabled: !state.buttonCategoryId,
|
|
149
|
-
flat: false,
|
|
150
150
|
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
151
151
|
string: "common.show_products",
|
|
152
152
|
className: "widget__nested-category-filter__CTA-button__text"
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import "core-js/modules/es.regexp.flags.js";
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { I18n } from '@shopgate/engage/components';
|
|
4
|
+
import { Button } from '@shopgate/engage/components/v2';
|
|
4
5
|
import { ProductGrid } from '@shopgate/engage/product/components';
|
|
5
6
|
import { useWidgetProducts } from '@shopgate/engage/page/hooks';
|
|
6
7
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
7
8
|
import { useProductListWidget } from "./hooks";
|
|
8
9
|
import WidgetHeadline from "../../components/WidgetHeadline";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const useStyles = makeStyles()({
|
|
11
|
+
const useStyles = makeStyles()(theme => ({
|
|
11
12
|
root: {
|
|
12
|
-
// Prevent that the ActionButton margin messes with the layout of the sibling widgets
|
|
13
13
|
overflow: 'hidden'
|
|
14
14
|
},
|
|
15
|
+
loadMore: {
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
margin: theme.spacing(1, 0)
|
|
18
|
+
},
|
|
15
19
|
grid: {
|
|
16
20
|
'&&': {
|
|
17
21
|
marginTop: 0
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
|
-
});
|
|
24
|
+
}));
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
27
|
* The ProductListWidget is used to display product lists.
|
|
@@ -66,16 +70,16 @@ const ProductListWidget = () => {
|
|
|
66
70
|
scope: "widgets",
|
|
67
71
|
infiniteLoad: false,
|
|
68
72
|
className: classes.grid
|
|
69
|
-
}), hasNext && showLoadMore && /*#__PURE__*/_jsx(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
}), hasNext && showLoadMore && /*#__PURE__*/_jsx("div", {
|
|
74
|
+
className: classes.loadMore,
|
|
75
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
76
|
+
variant: "text",
|
|
77
|
+
color: "secondary",
|
|
78
|
+
loading: isFetching,
|
|
79
|
+
onClick: handleFetchNext,
|
|
80
|
+
children: /*#__PURE__*/_jsx(I18n.Text, {
|
|
81
|
+
string: "common.load_more"
|
|
82
|
+
})
|
|
79
83
|
})
|
|
80
84
|
})]
|
|
81
85
|
});
|
|
@@ -41,9 +41,9 @@ export interface VideoWidgetConfig {
|
|
|
41
41
|
*/
|
|
42
42
|
export interface UseVideoWidgetResult extends Pick<VideoWidgetConfig, 'url' | 'muted' | 'loop' | 'controls' | 'autoplay' | 'link'> {
|
|
43
43
|
/**
|
|
44
|
-
* The resolved border radius
|
|
44
|
+
* The resolved border radius as a CSS length.
|
|
45
45
|
*/
|
|
46
|
-
borderRadius:
|
|
46
|
+
borderRadius: string;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Hook to access the Video widget configuration and data.
|
|
@@ -6,12 +6,20 @@ import { Link, RatingStars, DiscountBadge, SurroundPortals } from '@shopgate/eng
|
|
|
6
6
|
import { getProductRoute } from '@shopgate/engage/product';
|
|
7
7
|
import { MapPriceHint, ProductImage, OrderQuantityHint, FeaturedMedia, Swatches, ProductName, ProductBadges } from '@shopgate/engage/product/components';
|
|
8
8
|
import { PRODUCT_ITEM_DISCOUNT, PRODUCT_ITEM_PRICE } from '@shopgate/engage/category';
|
|
9
|
+
import { useSelector } from 'react-redux';
|
|
9
10
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
11
|
+
import { getProductCardNameMaxLines } from '@shopgate/engage/settings/selectors/appSettings';
|
|
10
12
|
import ProductGridPrice from "../ProductGridPrice";
|
|
11
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
14
|
const useStyles = makeStyles()(theme => ({
|
|
15
|
+
root: {
|
|
16
|
+
padding: theme.components.productCard.padding
|
|
17
|
+
},
|
|
18
|
+
image: {
|
|
19
|
+
padding: theme.components.productCard.imagePadding
|
|
20
|
+
},
|
|
13
21
|
details: {
|
|
14
|
-
padding:
|
|
22
|
+
padding: theme.components.productCard.textPadding
|
|
15
23
|
},
|
|
16
24
|
title: {
|
|
17
25
|
fontSize: theme.typography.body2.fontSize,
|
|
@@ -32,7 +40,8 @@ const location = 'productCard';
|
|
|
32
40
|
* @param {boolean} props.hidePrice Whether the price should be hidden.
|
|
33
41
|
* @param {boolean} props.hideRating Whether the rating should be hidden.
|
|
34
42
|
* @param {boolean} props.hideName Whether the name should be hidden.
|
|
35
|
-
* @param {number} props.titleRows
|
|
43
|
+
* @param {number} props.titleRows Optional override for the max number of rows for the product
|
|
44
|
+
* title
|
|
36
45
|
* @param {string} props.url Optional alternative url for the product link
|
|
37
46
|
* @return {JSX.Element}
|
|
38
47
|
*/
|
|
@@ -52,6 +61,7 @@ function ProductCard(props) {
|
|
|
52
61
|
const {
|
|
53
62
|
meta
|
|
54
63
|
} = useProductListType();
|
|
64
|
+
const productNameLines = useSelector(getProductCardNameMaxLines);
|
|
55
65
|
const showEmptyRatingStars = useShowEmptyRatingStars();
|
|
56
66
|
const showRatings = useMemo(() => {
|
|
57
67
|
if (!hideRating && product?.rating?.average > 0) {
|
|
@@ -63,7 +73,7 @@ function ProductCard(props) {
|
|
|
63
73
|
return false;
|
|
64
74
|
}, [hideRating, product, showEmptyRatingStars]);
|
|
65
75
|
return /*#__PURE__*/_jsxs(Link, {
|
|
66
|
-
className:
|
|
76
|
+
className: cx(classes.root, 'engage__product-card'),
|
|
67
77
|
href: url || getProductRoute(product.id),
|
|
68
78
|
itemProp: "item",
|
|
69
79
|
itemScope: true,
|
|
@@ -72,15 +82,18 @@ function ProductCard(props) {
|
|
|
72
82
|
state: {
|
|
73
83
|
...meta
|
|
74
84
|
},
|
|
75
|
-
children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
86
|
+
className: classes.image,
|
|
87
|
+
children: isBeta() && product.featuredMedia ? /*#__PURE__*/_jsx(FeaturedMedia, {
|
|
88
|
+
type: product.featuredMedia.type,
|
|
89
|
+
url: product.featuredMedia.url,
|
|
90
|
+
altText: product.featuredMedia.altText
|
|
91
|
+
}) : /*#__PURE__*/_jsx(ProductImage, {
|
|
92
|
+
src: product.featuredImageBaseUrl,
|
|
93
|
+
context: "list",
|
|
94
|
+
alt: product.name,
|
|
95
|
+
itemProp: "image"
|
|
96
|
+
})
|
|
84
97
|
}), /*#__PURE__*/_jsx(ProductBadges, {
|
|
85
98
|
location: location,
|
|
86
99
|
productId: product.id,
|
|
@@ -107,7 +120,7 @@ function ProductCard(props) {
|
|
|
107
120
|
className: classes.title,
|
|
108
121
|
testId: `Productname: ${product.name}`,
|
|
109
122
|
itemProp: "name",
|
|
110
|
-
rows: titleRows ||
|
|
123
|
+
rows: titleRows || productNameLines
|
|
111
124
|
}), /*#__PURE__*/_jsx(MapPriceHint, {
|
|
112
125
|
productId: product.id
|
|
113
126
|
}), /*#__PURE__*/_jsx(OrderQuantityHint, {
|
|
@@ -143,7 +156,7 @@ ProductCard.defaultProps = {
|
|
|
143
156
|
hideName: false,
|
|
144
157
|
hidePrice: false,
|
|
145
158
|
hideRating: false,
|
|
146
|
-
titleRows:
|
|
159
|
+
titleRows: null,
|
|
147
160
|
url: null
|
|
148
161
|
};
|
|
149
162
|
export default ProductCard;
|
|
@@ -8,17 +8,20 @@ import { makeStyles } from '@shopgate/engage/styles';
|
|
|
8
8
|
import ItemName from "../ItemName";
|
|
9
9
|
import ItemPrice from "../ItemPrice";
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
const useStyles = makeStyles()({
|
|
11
|
+
const useStyles = makeStyles()(theme => ({
|
|
12
12
|
root: {
|
|
13
13
|
lineHeight: 1.2,
|
|
14
14
|
':not(:empty)': {
|
|
15
|
-
padding:
|
|
15
|
+
padding: theme.components.tiles.textPadding,
|
|
16
|
+
// Floored at the favorites button overhang so a small configured inner padding
|
|
17
|
+
// can't let the button overlap the product name.
|
|
18
|
+
paddingTop: theme.components.tiles.textPaddingTop
|
|
16
19
|
}
|
|
17
20
|
},
|
|
18
21
|
quantityHint: {
|
|
19
22
|
paddingTop: 8
|
|
20
23
|
}
|
|
21
|
-
});
|
|
24
|
+
}));
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* The Product Grid Item Detail component.
|
|
@@ -3,27 +3,18 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { SurroundPortals } from '@shopgate/engage/components';
|
|
4
4
|
import { PRODUCT_ITEM_IMAGE } from '@shopgate/engage/category/constants';
|
|
5
5
|
import { ProductImage } from '@shopgate/engage/product';
|
|
6
|
-
import { makeStyles } from '@shopgate/engage/styles';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const useStyles = makeStyles()(theme => ({
|
|
9
|
-
image: {
|
|
10
|
-
background: theme.palette.background.surface
|
|
11
|
-
}
|
|
12
|
-
}));
|
|
13
6
|
|
|
14
7
|
/**
|
|
15
8
|
* The item image component.
|
|
16
9
|
* @param {Object} props The component props.
|
|
17
10
|
* @returns {JSX.Element}
|
|
18
11
|
*/
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
13
|
const ItemImage = ({
|
|
20
14
|
productId,
|
|
21
15
|
name,
|
|
22
16
|
imageUrl
|
|
23
17
|
}) => {
|
|
24
|
-
const {
|
|
25
|
-
classes
|
|
26
|
-
} = useStyles();
|
|
27
18
|
const portalProps = useMemo(() => ({
|
|
28
19
|
productId
|
|
29
20
|
}), [productId]);
|
|
@@ -31,7 +22,6 @@ const ItemImage = ({
|
|
|
31
22
|
portalName: PRODUCT_ITEM_IMAGE,
|
|
32
23
|
portalProps: portalProps,
|
|
33
24
|
children: /*#__PURE__*/_jsx(ProductImage, {
|
|
34
|
-
className: classes.image,
|
|
35
25
|
alt: name,
|
|
36
26
|
src: imageUrl,
|
|
37
27
|
context: "list",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React, { memo, useMemo } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { PRODUCT_ITEM_NAME, PRODUCT_ITEM_NAME_BEFORE, PRODUCT_ITEM_NAME_AFTER } from '@shopgate/engage/category/constants';
|
|
4
|
+
import { useSelector } from 'react-redux';
|
|
4
5
|
import { Portal } from '@shopgate/engage/components';
|
|
5
6
|
import { ProductName, ProductRatingStars } from '@shopgate/engage/product';
|
|
6
7
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
8
|
+
import { getProductTileNameMaxLines } from '@shopgate/engage/settings/selectors/appSettings';
|
|
7
9
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
10
|
const useStyles = makeStyles()(theme => ({
|
|
9
11
|
root: {
|
|
@@ -29,6 +31,7 @@ const ItemName = ({
|
|
|
29
31
|
classes,
|
|
30
32
|
cx
|
|
31
33
|
} = useStyles();
|
|
34
|
+
const productNameLines = useSelector(getProductTileNameMaxLines);
|
|
32
35
|
const portalProps = useMemo(() => ({
|
|
33
36
|
productId,
|
|
34
37
|
display
|
|
@@ -54,7 +57,8 @@ const ItemName = ({
|
|
|
54
57
|
className: cx(classes.root, 'theme__product-grid__item__item-name'),
|
|
55
58
|
portalName: PRODUCT_ITEM_NAME,
|
|
56
59
|
portalProps: portalProps,
|
|
57
|
-
testId: `Productname: ${name}
|
|
60
|
+
testId: `Productname: ${name}`,
|
|
61
|
+
rows: productNameLines
|
|
58
62
|
})]
|
|
59
63
|
});
|
|
60
64
|
};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render } from '@testing-library/react';
|
|
3
|
+
import { ProductName } from '@shopgate/engage/product';
|
|
3
4
|
import ItemName from "./index";
|
|
5
|
+
|
|
6
|
+
// Resolve selectors against an empty state so they fall back to the built-in appSettings defaults.
|
|
4
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
jest.mock('react-redux', () => ({
|
|
9
|
+
...jest.requireActual('react-redux'),
|
|
10
|
+
useSelector: selector => selector(undefined)
|
|
11
|
+
}));
|
|
5
12
|
jest.mock('@shopgate/engage/product', () => ({
|
|
6
|
-
ProductName: () => null,
|
|
13
|
+
ProductName: jest.fn(() => null),
|
|
7
14
|
ProductRatingStars: () => null
|
|
8
15
|
}));
|
|
9
16
|
jest.mock('@shopgate/engage/components');
|
|
@@ -12,10 +19,21 @@ const props = {
|
|
|
12
19
|
name: 'Foo'
|
|
13
20
|
};
|
|
14
21
|
describe('<ItemName />', () => {
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
jest.clearAllMocks();
|
|
24
|
+
});
|
|
15
25
|
it('should render with minimal props', () => {
|
|
16
26
|
const wrapper = render(/*#__PURE__*/_jsx(ItemName, {
|
|
17
27
|
...props
|
|
18
28
|
}));
|
|
19
29
|
expect(wrapper.asFragment()).toMatchSnapshot();
|
|
20
30
|
});
|
|
31
|
+
it('should clamp the name to the configured tile line count', () => {
|
|
32
|
+
render(/*#__PURE__*/_jsx(ItemName, {
|
|
33
|
+
...props
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
// The tile name line count comes from the appSettings channel; 3 is the built-in default.
|
|
37
|
+
expect(ProductName.mock.calls[0][0].rows).toBe(3);
|
|
38
|
+
});
|
|
21
39
|
});
|
|
@@ -17,7 +17,15 @@ const useStyles = makeStyles()((theme, {
|
|
|
17
17
|
position: 'relative',
|
|
18
18
|
display: 'flex',
|
|
19
19
|
flexDirection: 'column',
|
|
20
|
-
height: '100%'
|
|
20
|
+
height: '100%',
|
|
21
|
+
padding: theme.components.tiles.padding,
|
|
22
|
+
background: theme.components.tiles.backgroundColor,
|
|
23
|
+
border: theme.components.tiles.border,
|
|
24
|
+
borderRadius: theme.components.tiles.borderRadius
|
|
25
|
+
},
|
|
26
|
+
image: {
|
|
27
|
+
display: 'block',
|
|
28
|
+
padding: theme.components.tiles.imagePadding
|
|
21
29
|
},
|
|
22
30
|
itemDetails: {
|
|
23
31
|
position: 'relative',
|
|
@@ -50,6 +58,7 @@ const Item = ({
|
|
|
50
58
|
return /*#__PURE__*/_jsxs("div", {
|
|
51
59
|
className: cx(classes.root, 'theme__product-grid__item'),
|
|
52
60
|
children: [/*#__PURE__*/_jsx(Link, {
|
|
61
|
+
className: classes.image,
|
|
53
62
|
role: "none",
|
|
54
63
|
href: getProductRoute(product.id),
|
|
55
64
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductImage.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductImage/ProductImage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAMxE,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AA0BrD;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,iBAAiB,GAAG,aAAa,CAAC;IAC5F;;;OAGG;IACH,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"ProductImage.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductImage/ProductImage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAMxE,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,6CAA6C,CAAC;AA0BrD;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,iBAAiB,GAAG,aAAa,CAAC;IAC5F;;;OAGG;IACH,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC;CACjC;AAuCD;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCA4E7C,CAAC;AAEF,OAAO,EAAE,YAAY,IAAI,qBAAqB,EAAE,CAAC;oEAOX,iBAAiB;AAOvD,wBAA2C"}
|
|
@@ -28,6 +28,10 @@ const DEFAULT_PRODUCT_IMAGE_CONTEXT = 'list';
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
const useStyles = makeStyles()(theme => ({
|
|
31
|
+
rounded: {
|
|
32
|
+
borderRadius: theme.components.productImage.borderRadius,
|
|
33
|
+
overflow: 'hidden'
|
|
34
|
+
},
|
|
31
35
|
placeholderContent: {
|
|
32
36
|
position: 'absolute',
|
|
33
37
|
width: '100%',
|
|
@@ -100,6 +104,7 @@ const ProductImage = props => {
|
|
|
100
104
|
} = useStyles();
|
|
101
105
|
const theme = useTheme();
|
|
102
106
|
const showInnerShadow = useProductImageShadow();
|
|
107
|
+
const isRounded = (context || DEFAULT_PRODUCT_IMAGE_CONTEXT) === 'list';
|
|
103
108
|
|
|
104
109
|
// Image decides when to show this.
|
|
105
110
|
const placeholder = placeholderSrc ? /*#__PURE__*/_jsx(ProductImagePlaceholder, {
|
|
@@ -122,14 +127,14 @@ const ProductImage = props => {
|
|
|
122
127
|
ratio: resolved.ratio
|
|
123
128
|
} : undefined,
|
|
124
129
|
children: /*#__PURE__*/_jsx("div", {
|
|
125
|
-
className: cx(className, 'engage__product__product-image'),
|
|
130
|
+
className: cx(isRounded && classes.rounded, className, 'engage__product__product-image'),
|
|
126
131
|
children: /*#__PURE__*/_jsx(Image, {
|
|
127
132
|
...props,
|
|
128
133
|
resolutions: resolved.resolutions,
|
|
129
134
|
ratio: resolved.ratio,
|
|
130
135
|
placeholder: placeholder,
|
|
131
136
|
className: showInnerShadow ? classes.innerShadow : '',
|
|
132
|
-
backgroundColor: noBackground ? 'transparent' : theme.palette.
|
|
137
|
+
backgroundColor: noBackground ? 'transparent' : theme.palette.common.white,
|
|
133
138
|
"aria-hidden": !alt
|
|
134
139
|
})
|
|
135
140
|
})
|
|
@@ -65,14 +65,14 @@ const ProductImagePlaceholder = props => {
|
|
|
65
65
|
backgroundSize: 'contain',
|
|
66
66
|
backgroundRepeat: 'no-repeat',
|
|
67
67
|
backgroundPosition: 'center',
|
|
68
|
-
backgroundColor: noBackground ? 'transparent' : theme.palette.
|
|
68
|
+
backgroundColor: noBackground ? 'transparent' : theme.palette.common.white,
|
|
69
69
|
position: 'absolute'
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
73
|
-
backgroundColor: noBackground ? 'transparent' : theme.palette.
|
|
73
|
+
backgroundColor: noBackground ? 'transparent' : theme.palette.common.white
|
|
74
74
|
};
|
|
75
|
-
}, [srcLoaded, noBackground, theme.palette.
|
|
75
|
+
}, [srcLoaded, noBackground, theme.palette.common.white, src]);
|
|
76
76
|
const contentClasses = cx(classes.placeholderContent, {
|
|
77
77
|
[classes.innerShadow]: showInnerShadow
|
|
78
78
|
});
|
|
@@ -9,7 +9,7 @@ import { WIDGET_ID } from "./constants";
|
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const useStyles = makeStyles()({
|
|
11
11
|
container: {
|
|
12
|
-
|
|
12
|
+
padding: '8px 9px 16px !important'
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
const items = {
|
|
@@ -61,8 +61,10 @@ function ProductSlider(props) {
|
|
|
61
61
|
freeMode: !snap,
|
|
62
62
|
...swiperProps,
|
|
63
63
|
slidesPerView: slidesPerView,
|
|
64
|
+
classNames: {
|
|
65
|
+
container: classes.container
|
|
66
|
+
},
|
|
64
67
|
children: productIds.map(id => /*#__PURE__*/_jsx(Swiper.Item, {
|
|
65
|
-
className: classes.container,
|
|
66
68
|
children: /*#__PURE__*/_jsx(ProductListEntryProvider, {
|
|
67
69
|
productId: id,
|
|
68
70
|
children: /*#__PURE__*/_jsx(Item, {
|
|
@@ -6,6 +6,7 @@ import ProductCard from "../ProductCard";
|
|
|
6
6
|
import RelationsSheet from "./RelationsSheet";
|
|
7
7
|
import { useWidgetSettings, useCurrentProduct } from "../../../core";
|
|
8
8
|
import connect from "./RelationsSlider.connector";
|
|
9
|
+
import { useSlidesPerView } from "./hooks";
|
|
9
10
|
import { WIDGET_ID } from "./constants";
|
|
10
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
12
|
const useStyles = makeStyles()(theme => ({
|
|
@@ -51,12 +52,12 @@ const RelationsSliderContent = /*#__PURE__*/memo(({
|
|
|
51
52
|
hideRating,
|
|
52
53
|
titleRows,
|
|
53
54
|
showMoreButton,
|
|
54
|
-
type
|
|
55
|
-
slidesPerView = 2.3
|
|
55
|
+
type
|
|
56
56
|
} = useWidgetSettings(WIDGET_ID);
|
|
57
57
|
const {
|
|
58
58
|
productId
|
|
59
59
|
} = useCurrentProduct();
|
|
60
|
+
const slidesPerView = useSlidesPerView();
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
getRelations();
|
|
62
63
|
}, [getRelations]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../product/components/RelationsSlider/constants.js"],"names":[],"mappings":"AAAA,wBAAyB,0CAA0C,CAAC;AAEpE,sCAAuC,GAAG,CAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export const WIDGET_ID = '@shopgate/engage/product/RelationsSlider';
|
|
1
|
+
export const WIDGET_ID = '@shopgate/engage/product/RelationsSlider';
|
|
2
|
+
export const DEFAULT_SLIDES_PER_VIEW = 2.3;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the number of slides the RelationsSlider shows side by side for the active breakpoint.
|
|
3
|
+
* @returns The resolved number of slides for the active breakpoint.
|
|
4
|
+
*/
|
|
5
|
+
export declare const useSlidesPerView: () => number;
|
|
6
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../product/components/RelationsSlider/hooks.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,MA6BnC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "core-js/modules/es.array.reduce.js";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useSelector } from 'react-redux';
|
|
4
|
+
import { useWidgetSettings } from '@shopgate/engage/core/hooks';
|
|
5
|
+
import { useResponsiveValue } from '@shopgate/engage/styles';
|
|
6
|
+
import { getAreAppSettingsHydrated, getProductSliderSlidesPerView } from '@shopgate/engage/settings/selectors/appSettings';
|
|
7
|
+
import { SCREEN_SIZE_BREAKPOINTS } from '@shopgate/engage/settings/constants/appSettings';
|
|
8
|
+
import { WIDGET_ID, DEFAULT_SLIDES_PER_VIEW } from "./constants";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the number of slides the RelationsSlider shows side by side for the active breakpoint.
|
|
12
|
+
* @returns The resolved number of slides for the active breakpoint.
|
|
13
|
+
*/
|
|
14
|
+
export const useSlidesPerView = () => {
|
|
15
|
+
const areAppSettingsHydrated = useSelector(getAreAppSettingsHydrated);
|
|
16
|
+
const appSettingsSlidesPerView = useSelector(getProductSliderSlidesPerView);
|
|
17
|
+
const {
|
|
18
|
+
slidesPerView: legacySlidesPerView
|
|
19
|
+
} = useWidgetSettings(WIDGET_ID) || {};
|
|
20
|
+
const sizes = useMemo(() => {
|
|
21
|
+
if (!areAppSettingsHydrated && typeof legacySlidesPerView === 'number') {
|
|
22
|
+
return {
|
|
23
|
+
small: legacySlidesPerView
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return appSettingsSlidesPerView;
|
|
27
|
+
}, [areAppSettingsHydrated, legacySlidesPerView, appSettingsSlidesPerView]);
|
|
28
|
+
const breakpoints = useMemo(() => Object.entries(sizes).reduce((acc, [size, value]) => {
|
|
29
|
+
acc[SCREEN_SIZE_BREAKPOINTS[size]] = value;
|
|
30
|
+
return acc;
|
|
31
|
+
}, {}), [sizes]);
|
|
32
|
+
const resolved = useResponsiveValue(breakpoints);
|
|
33
|
+
return resolved || DEFAULT_SLIDES_PER_VIEW;
|
|
34
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitQuantityPicker.d.ts","sourceRoot":"","sources":["../../../../product/components/UnitQuantityPicker/UnitQuantityPicker.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"UnitQuantityPicker.d.ts","sourceRoot":"","sources":["../../../../product/components/UnitQuantityPicker/UnitQuantityPicker.jsx"],"names":[],"mappings":";AA6FA;;;GAGG;AACH;;;;;;;;;;;;;;;;;IAFa,GAAG,CAAC,OAAO,CAqMvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAjSqB,YAAY"}
|