@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.
- 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 +8 -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 +7 -0
- 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/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.js +1 -1
- 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 +1 -2
- package/components/Paper/Paper.d.ts.map +1 -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/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/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/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/ProductGrid/components/Item/components/ItemImage/index.js +1 -11
- package/product/components/ProductGrid/components/Item/index.js +3 -2
- 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/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/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +9 -1
- package/settings/selectors/appSettings.d.ts +16 -0
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +11 -1
- package/settings/types/appSettings.d.ts +23 -2
- 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/theme/createTheme/createComponents.types.d.ts +25 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +25 -0
- package/styles/theme/createTheme/createShape.d.ts +2 -3
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createShape.js +1 -2
- 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 +4 -2
- 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/index.d.ts +1 -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,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.
|
|
@@ -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",
|
|
@@ -18,9 +18,10 @@ const useStyles = makeStyles()((theme, {
|
|
|
18
18
|
display: 'flex',
|
|
19
19
|
flexDirection: 'column',
|
|
20
20
|
height: '100%',
|
|
21
|
-
overflow: 'hidden',
|
|
22
21
|
padding: theme.components.tiles.padding,
|
|
23
|
-
background: theme.components.tiles.backgroundColor
|
|
22
|
+
background: theme.components.tiles.backgroundColor,
|
|
23
|
+
border: theme.components.tiles.border,
|
|
24
|
+
borderRadius: theme.components.tiles.borderRadius
|
|
24
25
|
},
|
|
25
26
|
image: {
|
|
26
27
|
display: 'block',
|
|
@@ -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
|
});
|
|
@@ -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"}
|
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
100
|
-
borderBottomLeftRadius: 0
|
|
101
|
-
}
|
|
94
|
+
borderTopLeftRadius: 0,
|
|
95
|
+
borderBottomLeftRadius: 0
|
|
102
96
|
},
|
|
103
97
|
buttonNoRadiusRight: {
|
|
104
|
-
|
|
105
|
-
|
|
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(
|
|
255
|
-
|
|
241
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
242
|
+
color: "primary",
|
|
256
243
|
disabled: !allowDecrement || disabled,
|
|
257
|
-
|
|
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(
|
|
286
|
-
|
|
269
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
270
|
+
color: "primary",
|
|
287
271
|
disabled: !allowIncrement || disabled,
|
|
288
|
-
|
|
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,
|
|
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
|
-
|
|
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(
|
|
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 {
|
|
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(
|
|
52
|
-
|
|
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
|
|
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()(
|
|
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(
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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('
|
|
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('
|
|
76
|
+
expect(screen.getByRole('button', {
|
|
78
77
|
name: 'reviews.button_all'
|
|
79
|
-
})).
|
|
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('
|
|
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('
|
|
96
|
+
expect(screen.queryByRole('button', {
|
|
98
97
|
name: 'reviews.button_all'
|
|
99
98
|
})).toBeNull();
|
|
100
99
|
});
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -61,6 +61,9 @@ export const DEFAULT_APP_SETTINGS = {
|
|
|
61
61
|
size: 'medium'
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
+
typography: {
|
|
65
|
+
variants: {}
|
|
66
|
+
},
|
|
64
67
|
images: {
|
|
65
68
|
quality: DEFAULT_IMAGE_QUALITY,
|
|
66
69
|
// Already in the image service's format, so the unhydrated path needs no conversion.
|
|
@@ -87,7 +90,8 @@ const appSettings = (state, action = {
|
|
|
87
90
|
}) => {
|
|
88
91
|
if (isReceiveAppSettingsAction(action)) {
|
|
89
92
|
const {
|
|
90
|
-
images
|
|
93
|
+
images,
|
|
94
|
+
typography
|
|
91
95
|
} = action.settings ?? {};
|
|
92
96
|
|
|
93
97
|
// Merged over the defaults rather than over the current state, so a field an incoming payload
|
|
@@ -101,6 +105,10 @@ const appSettings = (state, action = {
|
|
|
101
105
|
images: images === null ? undefined : {
|
|
102
106
|
...images,
|
|
103
107
|
product: images?.product ?? undefined
|
|
108
|
+
},
|
|
109
|
+
typography: typography === null ? undefined : {
|
|
110
|
+
...typography,
|
|
111
|
+
variants: typography?.variants ?? undefined
|
|
104
112
|
}
|
|
105
113
|
}, {
|
|
106
114
|
isHydrated: true
|
|
@@ -119,4 +119,20 @@ export declare const getCardShadowSize: ((state: AppSettingsState) => import("..
|
|
|
119
119
|
}> & {
|
|
120
120
|
clearCache: () => void;
|
|
121
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
|
+
};
|
|
122
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;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"}
|
|
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"}
|
|
@@ -65,4 +65,14 @@ export const getCardSettings = createSelector(getAppSettingsState, appSettings =
|
|
|
65
65
|
/**
|
|
66
66
|
* Selects the effective card shadow size. `none` unless the shadow style is selected.
|
|
67
67
|
*/
|
|
68
|
-
export const getCardShadowSize = createSelector(getCardSettings, cards => cards.style === 'shadow' ? cards.shadow.size : 'none');
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import type { ShadowSize } from '@shopgate/engage/styles/theme';
|
|
2
|
-
export type { ShadowSize };
|
|
1
|
+
import type { ShadowSize, TypographyVariant } from '@shopgate/engage/styles/theme';
|
|
2
|
+
export type { ShadowSize, TypographyVariant };
|
|
3
3
|
/**
|
|
4
4
|
* Recursively optional variant of `T`. The settings sources send only what a merchant configured,
|
|
5
5
|
* and the admin preview additionally prunes the fields its visibility conditions hide.
|
|
@@ -214,6 +214,27 @@ export interface AppSettings {
|
|
|
214
214
|
*/
|
|
215
215
|
images: ImageSettings;
|
|
216
216
|
cards: CardSettings;
|
|
217
|
+
typography: TypographySettings;
|
|
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>>;
|
|
217
238
|
}
|
|
218
239
|
/**
|
|
219
240
|
* What a settings source actually sends. Every field is optional, so the reducer fills the gaps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/types/appSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/types/appSettings.ts"],"names":[],"mappings":"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"}
|