@magento/venia-ui 9.2.0-beta.1 → 9.3.0-beta.1
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/i18n/en_US.json +17 -3
- package/lib/RootComponents/CMS/__tests__/__snapshots__/cms.spec.js.snap +19 -0
- package/lib/RootComponents/CMS/__tests__/cms.spec.js +4 -9
- package/lib/RootComponents/CMS/cms.js +5 -4
- package/lib/RootComponents/CMS/cms.shimmer.js +18 -0
- package/lib/RootComponents/Category/__tests__/__snapshots__/categoryContent.shimmer.spec.js.snap +12 -0
- package/lib/RootComponents/Category/categoryContent.js +4 -1
- package/lib/components/AccountChip/accountChip.js +3 -1
- package/lib/components/AccountInformationPage/accountInformationPage.js +3 -1
- package/lib/components/AccountInformationPage/editModal.js +9 -2
- package/lib/components/AccountMenu/accountMenuItems.js +8 -3
- package/lib/components/CartPage/GiftCards/giftCards.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/CouponCode/couponCode.js +5 -1
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/__tests__/__snapshots__/giftOptions.spec.js.snap +1018 -78
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/__tests__/giftOptions.spec.js +221 -35
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.js +287 -40
- package/lib/components/CartPage/PriceAdjustments/GiftOptions/giftOptions.module.css +56 -1
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftCardSection.ee.spec.js.snap +12 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftOptionsSection.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/giftOptionsSection.ee.spec.js.snap +16 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/__snapshots__/priceAdjustments.spec.js.snap +1 -32
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftCardSection.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftCardSection.ee.spec.js +36 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftOptionsSection.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/giftOptionsSection.ee.spec.js +54 -0
- package/lib/components/CartPage/PriceAdjustments/__tests__/priceAdjustments.spec.js +1 -1
- package/lib/components/CartPage/PriceAdjustments/{giftCardSection.js → giftCardSection.ce.js} +0 -0
- package/lib/components/CartPage/PriceAdjustments/giftOptionsSection.ce.js +7 -0
- package/lib/components/CartPage/PriceAdjustments/giftOptionsSection.ee.js +38 -0
- package/lib/components/CartPage/PriceAdjustments/priceAdjustments.js +2 -14
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/discountSummary.spec.js.snap +496 -42
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftCardSummary.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/{giftCardSummary.spec.js.snap → giftCardSummary.ee.spec.js.snap} +4 -4
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftOptionsSummary.ce.spec.js.snap +3 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftOptionsSummary.ee.spec.js.snap +63 -0
- package/lib/components/CartPage/PriceSummary/__tests__/__snapshots__/priceSummary.spec.js.snap +201 -141
- package/lib/components/CartPage/PriceSummary/__tests__/discountSummary.spec.js +41 -1
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.ee.spec.js +84 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftOptionsSummary.ce.spec.js +17 -0
- package/lib/components/CartPage/PriceSummary/__tests__/giftOptionsSummary.ee.spec.js +69 -0
- package/lib/components/CartPage/PriceSummary/__tests__/priceSummary.spec.js +2 -0
- package/lib/components/CartPage/PriceSummary/discountSummary.js +99 -49
- package/lib/components/CartPage/PriceSummary/discountSummary.module.css +40 -0
- package/lib/components/CartPage/PriceSummary/giftOptionsSummary.ce.js +5 -0
- package/lib/components/CartPage/PriceSummary/giftOptionsSummary.ee.js +40 -0
- package/lib/components/CartPage/PriceSummary/priceSummary.js +95 -53
- package/lib/components/CartPage/PriceSummary/priceSummary.module.css +2 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productDetail.spec.js.snap +57 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/__snapshots__/productForm.spec.js.snap +22 -0
- package/lib/components/CartPage/ProductListing/EditModal/__tests__/productDetail.spec.js +42 -3
- package/lib/components/CartPage/ProductListing/EditModal/productDetail.js +13 -10
- package/lib/components/CartPage/ProductListing/EditModal/productForm.js +7 -2
- package/lib/components/CartPage/ProductListing/product.js +1 -0
- package/lib/components/CartPage/ProductListing/productListing.js +1 -1
- package/lib/components/CartPage/cartPage.js +1 -1
- package/lib/components/Checkbox/checkbox.js +6 -1
- package/lib/components/Checkbox/checkbox.module.css +1 -0
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/item.spec.js.snap +2 -2
- package/lib/components/CheckoutPage/ItemsReview/__tests__/__snapshots__/itemsReview.spec.js.snap +33 -0
- package/lib/components/CheckoutPage/ItemsReview/__tests__/item.spec.js +2 -2
- package/lib/components/CheckoutPage/ItemsReview/itemsReview.js +4 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/__tests__/createAccount.spec.js +4 -0
- package/lib/components/CheckoutPage/OrderConfirmationPage/createAccount.js +9 -1
- package/lib/components/CheckoutPage/OrderConfirmationPage/orderConfirmationPage.js +12 -3
- package/lib/components/CheckoutPage/PaymentInformation/__tests__/__snapshots__/creditCard.spec.js.snap +1 -0
- package/lib/components/CheckoutPage/PaymentInformation/__tests__/creditCard.spec.js +2 -1
- package/lib/components/CheckoutPage/PaymentInformation/brainTreeDropIn.js +2 -18
- package/lib/components/CheckoutPage/PaymentInformation/creditCard.js +13 -3
- package/lib/components/CheckoutPage/PriceAdjustments/__tests__/__snapshots__/priceAdjustments.spec.js.snap +1 -6
- package/lib/components/CheckoutPage/PriceAdjustments/__tests__/priceAdjustments.spec.js +2 -2
- package/lib/components/CheckoutPage/PriceAdjustments/priceAdjustments.js +8 -12
- package/lib/components/CheckoutPage/ShippingInformation/AddressForm/customerForm.js +1 -1
- package/lib/components/CheckoutPage/ShippingInformation/shippingInformation.js +4 -1
- package/lib/components/CheckoutPage/ShippingMethod/shippingMethod.js +5 -2
- package/lib/components/CheckoutPage/__tests__/__snapshots__/checkoutPage.spec.js.snap +3 -3
- package/lib/components/CheckoutPage/__tests__/checkoutPage.spec.js +5 -0
- package/lib/components/CheckoutPage/checkoutPage.js +25 -4
- package/lib/components/CheckoutPage/checkoutPage.module.css +8 -1
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/cmsDynamicBlock.ce.spec.js.snap +3 -0
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/cmsDynamicBlock.ee.spec.js.snap +61 -0
- package/lib/components/CmsDynamicBlock/__tests__/__snapshots__/dynamicBlock.spec.js.snap +7 -0
- package/lib/components/CmsDynamicBlock/__tests__/cmsDynamicBlock.ce.spec.js +17 -0
- package/lib/components/CmsDynamicBlock/__tests__/cmsDynamicBlock.ee.spec.js +211 -0
- package/lib/components/CmsDynamicBlock/__tests__/constants.spec.js +37 -0
- package/lib/components/CmsDynamicBlock/__tests__/dynamicBlock.spec.js +33 -0
- package/lib/components/CmsDynamicBlock/cmsDynamicBlock.ce.js +5 -0
- package/lib/components/CmsDynamicBlock/cmsDynamicBlock.ee.js +73 -0
- package/lib/components/CmsDynamicBlock/constants.js +6 -0
- package/lib/components/CmsDynamicBlock/dynamicBlock.js +32 -0
- package/lib/components/CmsDynamicBlock/index.js +2 -0
- package/lib/components/CreateAccount/__tests__/createAccount.spec.js +6 -1
- package/lib/components/CreateAccount/createAccount.js +7 -2
- package/lib/components/Field/field.module.css +6 -0
- package/lib/components/FilterSidebar/filterSidebar.js +4 -1
- package/lib/components/Footer/__tests__/__snapshots__/footer.spec.js.snap +8 -2
- package/lib/components/Footer/footer.js +16 -9
- package/lib/components/Footer/footer.module.css +7 -2
- package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/__snapshots__/forgotPasswordForm.spec.js.snap +109 -1
- package/lib/components/ForgotPassword/ForgotPasswordForm/__tests__/forgotPasswordForm.spec.js +22 -3
- package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.js +13 -3
- package/lib/components/ForgotPassword/ForgotPasswordForm/forgotPasswordForm.module.css +1 -1
- package/lib/components/ForgotPassword/__tests__/__snapshots__/forgotPassword.spec.js.snap +5 -6
- package/lib/components/ForgotPassword/__tests__/forgotPassword.spec.js +41 -28
- package/lib/components/ForgotPassword/forgotPassword.js +10 -3
- package/lib/components/ForgotPassword/forgotPassword.module.css +2 -2
- package/lib/components/Gallery/__tests__/__snapshots__/gallery.spec.js.snap +22 -0
- package/lib/components/Gallery/__tests__/__snapshots__/item.spec.js.snap +17 -0
- package/lib/components/Gallery/addToCartButton.js +2 -0
- package/lib/components/Gallery/gallery.js +6 -1
- package/lib/components/Gallery/item.js +7 -2
- package/lib/components/GoogleReCaptcha/googleReCaptcha.js +49 -0
- package/lib/components/GoogleReCaptcha/googleReCaptcha.module.css +3 -0
- package/lib/components/GoogleReCaptcha/index.js +1 -0
- package/lib/components/Header/currencySwitcher.js +2 -1
- package/lib/components/Header/header.js +1 -1
- package/lib/components/Header/header.module.css +2 -2
- package/lib/components/Header/searchTrigger.js +3 -1
- package/lib/components/Header/storeSwitcher.js +18 -4
- package/lib/components/Header/switcherItem.js +4 -1
- package/lib/components/HomePage/homePage.module.css +12 -0
- package/lib/components/Image/resourceImage.js +8 -1
- package/lib/components/Image/simpleImage.js +8 -1
- package/lib/components/Link/link.js +15 -13
- package/lib/components/LoadingIndicator/spinner.js +5 -7
- package/lib/components/LoadingIndicator/spinner.module.css +4 -17
- package/lib/components/MiniCart/ProductList/__tests__/__snapshots__/item.spec.js.snap +44 -0
- package/lib/components/MiniCart/ProductList/__tests__/item.spec.js +2 -2
- package/lib/components/MiniCart/ProductList/item.js +3 -2
- package/lib/components/MiniCart/miniCart.js +6 -3
- package/lib/components/MyAccount/ResetPassword/__tests__/__snapshots__/resetPassword.spec.js.snap +274 -254
- package/lib/components/MyAccount/ResetPassword/__tests__/resetPassword.spec.js +10 -5
- package/lib/components/MyAccount/ResetPassword/resetPassword.js +55 -55
- package/lib/components/MyAccount/ResetPassword/resetPassword.module.css +27 -79
- package/lib/components/Newsletter/newsletter.js +6 -2
- package/lib/components/OrderHistoryPage/OrderDetails/__tests__/__snapshots__/item.spec.js.snap +11 -0
- package/lib/components/ProductFullDetail/productFullDetail.js +12 -3
- package/lib/components/ProductImageCarousel/__tests__/__snapshots__/carousel.spec.js.snap +61 -0
- package/lib/components/ProductImageCarousel/__tests__/__snapshots__/thumbnail.spec.js.snap +26 -0
- package/lib/components/ProductOptions/__tests__/options.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/swatch.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/swatchList.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/tile.spec.js +1 -1
- package/lib/components/ProductOptions/__tests__/tileList.spec.js +1 -1
- package/lib/components/ProductOptions/option.js +4 -1
- package/lib/components/ProductSort/productSort.js +22 -14
- package/lib/components/Rating/rating.js +1 -1
- package/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +11 -0
- package/lib/components/SearchBar/autocomplete.js +4 -2
- package/lib/components/SearchBar/suggestedProduct.js +1 -1
- package/lib/components/SearchBar/suggestions.js +1 -1
- package/lib/components/SignIn/__tests__/signIn.spec.js +11 -20
- package/lib/components/SignIn/signIn.js +6 -16
- package/lib/components/TextInput/textInput.module.css +0 -4
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/__tests__/__snapshots__/wishlistLineItem.spec.js.snap +5 -1
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.js +7 -1
- package/lib/components/Wishlist/WishlistDialog/WishlistLineItem/wishlistLineItem.module.css +7 -0
- package/lib/components/Wishlist/WishlistDialog/__tests__/__snapshots__/wishlistDialog.spec.js.snap +6 -1
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlist.spec.js.snap +4 -0
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistItem.spec.js.snap +22 -0
- package/lib/components/WishlistPage/__tests__/__snapshots__/wishlistPage.spec.js.snap +9 -3
- package/lib/components/WishlistPage/createWishlist.ee.js +3 -1
- package/lib/components/WishlistPage/wishlist.js +1 -1
- package/lib/components/WishlistPage/wishlist.module.css +3 -0
- package/lib/components/WishlistPage/wishlistPage.js +1 -1
- package/package.json +5 -4
- package/lib/components/CartPage/PriceSummary/__tests__/giftCardSummary.spec.js +0 -84
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { bool, func, shape, string } from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
5
|
+
|
|
6
|
+
import defaultClasses from './googleReCaptcha.module.css';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A component to display a Google ReCaptcha V3 inline widget.
|
|
10
|
+
*
|
|
11
|
+
* @typedef GoogleReCaptcha
|
|
12
|
+
* @kind functional component
|
|
13
|
+
*
|
|
14
|
+
* @param {props} props React component props
|
|
15
|
+
*
|
|
16
|
+
* @returns {React.Element} A React component that displays a container to be used by the useGoogleReCaptcha hook.
|
|
17
|
+
*/
|
|
18
|
+
const GoogleReCaptcha = props => {
|
|
19
|
+
const { containerElement = () => {}, shouldRender = false } = props;
|
|
20
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
21
|
+
|
|
22
|
+
// Do not display if position is not inline
|
|
23
|
+
if (!shouldRender) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return <div ref={containerElement} className={classes.root} />;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Props for {@link GoogleReCaptcha}
|
|
32
|
+
*
|
|
33
|
+
* @typedef props
|
|
34
|
+
*
|
|
35
|
+
* @property {Object} classes An object containing the class names for the
|
|
36
|
+
* GoogleReCaptcha component.
|
|
37
|
+
* @property {String} classes.root class for root container
|
|
38
|
+
* @property {Function} containerElement Element callback ref
|
|
39
|
+
* @property {Boolean} shouldRender Checks if component should be rendered
|
|
40
|
+
*/
|
|
41
|
+
GoogleReCaptcha.propTypes = {
|
|
42
|
+
classes: shape({
|
|
43
|
+
root: string
|
|
44
|
+
}),
|
|
45
|
+
containerElement: func.isRequired,
|
|
46
|
+
shouldRender: bool.isRequired
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default GoogleReCaptcha;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './googleReCaptcha';
|
|
@@ -51,8 +51,9 @@ const CurrencySwitcher = props => {
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
return (
|
|
54
|
-
<div className={classes.root}>
|
|
54
|
+
<div data-cy="CurrencySwitcher-root" className={classes.root}>
|
|
55
55
|
<button
|
|
56
|
+
data-cy="CurrencySwitcher-triggerButton"
|
|
56
57
|
className={classes.trigger}
|
|
57
58
|
aria-label={currentCurrencyCode}
|
|
58
59
|
onClick={handleTriggerClick}
|
|
@@ -75,7 +75,8 @@
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
.logo {
|
|
78
|
-
|
|
78
|
+
height: var(--height);
|
|
79
|
+
width: var(--width);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
.primaryActions {
|
|
@@ -90,7 +91,6 @@
|
|
|
90
91
|
.logoContainer {
|
|
91
92
|
composes: col-start-2 from global;
|
|
92
93
|
composes: justify-self-center from global;
|
|
93
|
-
composes: my-4 from global;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/* Large screen styles */
|
|
@@ -36,7 +36,9 @@ const SearchTrigger = React.forwardRef((props, ref) => {
|
|
|
36
36
|
ref={ref}
|
|
37
37
|
>
|
|
38
38
|
<Icon src={SearchIcon} />
|
|
39
|
-
<span className={classes.label}>
|
|
39
|
+
<span data-cy="SearchTrigger-label" className={classes.label}>
|
|
40
|
+
{searchText}
|
|
41
|
+
</span>
|
|
40
42
|
</button>
|
|
41
43
|
);
|
|
42
44
|
});
|
|
@@ -41,7 +41,11 @@ const StoreSwitcher = props => {
|
|
|
41
41
|
label = `${storeGroupName} - ${storeName}`;
|
|
42
42
|
}
|
|
43
43
|
stores.push(
|
|
44
|
-
<li
|
|
44
|
+
<li
|
|
45
|
+
key={code}
|
|
46
|
+
className={classes.menuItem}
|
|
47
|
+
data-cy="StoreSwitcher-view"
|
|
48
|
+
>
|
|
45
49
|
<SwitcherItem
|
|
46
50
|
active={isCurrent}
|
|
47
51
|
onClick={handleSwitchStore}
|
|
@@ -54,7 +58,11 @@ const StoreSwitcher = props => {
|
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
groups.push(
|
|
57
|
-
<ul
|
|
61
|
+
<ul
|
|
62
|
+
className={classes.groupList}
|
|
63
|
+
key={key}
|
|
64
|
+
data-cy="StoreSwitcher-group"
|
|
65
|
+
>
|
|
58
66
|
{stores}
|
|
59
67
|
</ul>
|
|
60
68
|
);
|
|
@@ -68,16 +76,22 @@ const StoreSwitcher = props => {
|
|
|
68
76
|
}
|
|
69
77
|
|
|
70
78
|
return (
|
|
71
|
-
<div className={classes.root}>
|
|
79
|
+
<div className={classes.root} data-cy="StoreSwitcher-root">
|
|
72
80
|
<button
|
|
81
|
+
data-cy="StoreSwitcher-triggerButton"
|
|
73
82
|
className={classes.trigger}
|
|
74
83
|
aria-label={currentStoreName}
|
|
75
84
|
onClick={handleTriggerClick}
|
|
76
85
|
ref={storeMenuTriggerRef}
|
|
86
|
+
data-cy="StoreSwitcher-trigger"
|
|
77
87
|
>
|
|
78
88
|
{triggerLabel}
|
|
79
89
|
</button>
|
|
80
|
-
<div
|
|
90
|
+
<div
|
|
91
|
+
ref={storeMenuRef}
|
|
92
|
+
className={menuClassName}
|
|
93
|
+
data-cy="StoreSwitcher-menu"
|
|
94
|
+
>
|
|
81
95
|
<div className={classes.groups}>{groups}</div>
|
|
82
96
|
</div>
|
|
83
97
|
</div>
|
|
@@ -14,10 +14,13 @@ const SwitcherItem = props => {
|
|
|
14
14
|
onClick(option);
|
|
15
15
|
}, [option, onClick]);
|
|
16
16
|
|
|
17
|
-
const activeIcon = active ?
|
|
17
|
+
const activeIcon = active ? (
|
|
18
|
+
<Icon data-cy="SwitcherItem-activeIcon" size={20} src={Check} />
|
|
19
|
+
) : null;
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<button
|
|
23
|
+
data-cy="SwitcherItem-button"
|
|
21
24
|
className={classes.root}
|
|
22
25
|
disabled={active}
|
|
23
26
|
onClick={handleClick}
|
|
@@ -419,3 +419,15 @@
|
|
|
419
419
|
:global(.venia-home-products .slick-slider .slick-dots .slick-active > button) {
|
|
420
420
|
background-color: hsl(205 004% 048%) !important;
|
|
421
421
|
}
|
|
422
|
+
|
|
423
|
+
:global(.venia-home-banner-text > div) {
|
|
424
|
+
flex-direction: unset !important;
|
|
425
|
+
justify-content: normal !important;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
@media (max-width: 960px) {
|
|
429
|
+
:global(.venia-home-banner-text > div) {
|
|
430
|
+
flex-direction: column !important;
|
|
431
|
+
justify-content: center !important;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
@@ -47,11 +47,18 @@ const ResourceImage = props => {
|
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
const { sizes, src, srcSet } = talonProps;
|
|
50
|
-
|
|
50
|
+
const dimensionAttributes = {};
|
|
51
|
+
if (typeof height !== 'undefined') {
|
|
52
|
+
dimensionAttributes['--height'] = height + 'px';
|
|
53
|
+
}
|
|
54
|
+
if (typeof width !== 'undefined') {
|
|
55
|
+
dimensionAttributes['--width'] = width + 'px';
|
|
56
|
+
}
|
|
51
57
|
// Note: Attributes that are allowed to be overridden must appear before the spread of `rest`.
|
|
52
58
|
return (
|
|
53
59
|
<img
|
|
54
60
|
loading="lazy"
|
|
61
|
+
style={dimensionAttributes}
|
|
55
62
|
{...rest}
|
|
56
63
|
alt={alt}
|
|
57
64
|
className={className}
|
|
@@ -23,11 +23,18 @@ const SimpleImage = props => {
|
|
|
23
23
|
width,
|
|
24
24
|
...rest
|
|
25
25
|
} = props;
|
|
26
|
-
|
|
26
|
+
const dimensionAttributes = {};
|
|
27
|
+
if (typeof height !== 'undefined') {
|
|
28
|
+
dimensionAttributes['--height'] = height + 'px';
|
|
29
|
+
}
|
|
30
|
+
if (typeof width !== 'undefined') {
|
|
31
|
+
dimensionAttributes['--width'] = width + 'px';
|
|
32
|
+
}
|
|
27
33
|
// Note: Attributes that are allowed to be overridden must appear before the spread of `rest`.
|
|
28
34
|
return (
|
|
29
35
|
<img
|
|
30
36
|
loading="lazy"
|
|
37
|
+
style={dimensionAttributes}
|
|
31
38
|
{...rest}
|
|
32
39
|
alt={alt}
|
|
33
40
|
className={className}
|
|
@@ -3,38 +3,40 @@ import { Link as RouterLink } from 'react-router-dom';
|
|
|
3
3
|
import { bool } from 'prop-types';
|
|
4
4
|
import useLink from '@magento/peregrine/lib/talons/Link/useLink';
|
|
5
5
|
|
|
6
|
-
const removeProps = (props, exclude) => {
|
|
7
|
-
return Object.fromEntries(
|
|
8
|
-
Object.entries(props).filter(([name]) => !exclude.includes(name))
|
|
9
|
-
);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
6
|
/**
|
|
13
7
|
* @kind functional component
|
|
14
8
|
*
|
|
15
|
-
* @property {bool}
|
|
9
|
+
* @property {bool} shouldPrefetch `true` activates prefetching the target page when the link becomes visible in the viewport.
|
|
16
10
|
* @property {string} to From [react-router-dom Link](https://knowbody.github.io/react-router-docs/api/Link.html). The absolute path to the target page of the link. Uses the `to` prop from the `react-router-dom Link`.
|
|
17
11
|
*
|
|
18
12
|
* @example <caption>Basic usage</caption>
|
|
19
|
-
* <Link
|
|
13
|
+
* <Link shouldPrefetch={true} to="/about/">About Us</Link>
|
|
20
14
|
*/
|
|
21
15
|
const Link = props => {
|
|
22
|
-
|
|
16
|
+
// TODO: remove `prefetchType`
|
|
17
|
+
const { innerRef, prefetchType, shouldPrefetch, ...propsForBase } = props;
|
|
18
|
+
const talonProps = useLink({
|
|
19
|
+
...props,
|
|
20
|
+
innerRef,
|
|
21
|
+
shouldPrefetch: shouldPrefetch || prefetchType
|
|
22
|
+
});
|
|
23
23
|
const { ref } = talonProps;
|
|
24
|
-
const propsForBase = removeProps(props, ['prefetchType', 'innerRef']);
|
|
25
24
|
|
|
26
25
|
return <RouterLink {...propsForBase} innerRef={ref} />;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
28
|
Link.defaultProps = {
|
|
30
|
-
prefetchType: false
|
|
29
|
+
prefetchType: false,
|
|
30
|
+
shouldPrefetch: false
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @property {bool} [prefetchType=false]
|
|
34
|
+
* @property {bool} [prefetchType=false] Deprecated. Use `shouldPrefetch` instead.
|
|
35
|
+
* @property {bool} [shouldPrefetch=false] Determine if the link should be prefetched using `IntersectionObserver`.
|
|
35
36
|
*/
|
|
36
37
|
Link.propTypes = {
|
|
37
|
-
prefetchType: bool
|
|
38
|
+
prefetchType: bool,
|
|
39
|
+
shouldPrefetch: bool
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
export default Link;
|
|
@@ -9,13 +9,11 @@ const Spinner = props => {
|
|
|
9
9
|
const classes = useStyle(defaultClasses, props.classes);
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
12
|
+
<Icon
|
|
13
|
+
src={LoaderIcon}
|
|
14
|
+
size={24}
|
|
15
|
+
classes={{ root: classes.root, icon: classes.icon }}
|
|
16
|
+
/>
|
|
19
17
|
);
|
|
20
18
|
};
|
|
21
19
|
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
.root {
|
|
2
|
-
|
|
3
|
-
grid-area: primary;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.indicator {
|
|
2
|
+
composes: root from '../Icon/icon.module.css';
|
|
7
3
|
--stroke: rgb(var(--venia-global-color-text-hint));
|
|
8
4
|
}
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
.
|
|
12
|
-
|
|
13
|
-
margin-left: 0.5rem;
|
|
14
|
-
grid-area: secondary;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (min-width: 1024px) {
|
|
19
|
-
.root {
|
|
20
|
-
grid-column: 2 / 3;
|
|
21
|
-
}
|
|
6
|
+
.icon {
|
|
7
|
+
composes: icon from '../Icon/icon.module.css';
|
|
8
|
+
animation: spin 1920ms linear infinite;
|
|
22
9
|
}
|
|
23
10
|
|
|
24
11
|
@keyframes spin {
|
|
@@ -16,6 +16,11 @@ exports[`Should disable delete icon while loading 1`] = `
|
|
|
16
16
|
className="image placeholder"
|
|
17
17
|
loading="eager"
|
|
18
18
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
19
|
+
style={
|
|
20
|
+
Object {
|
|
21
|
+
"--width": "100px",
|
|
22
|
+
}
|
|
23
|
+
}
|
|
19
24
|
width={100}
|
|
20
25
|
/>
|
|
21
26
|
<img
|
|
@@ -35,6 +40,12 @@ exports[`Should disable delete icon while loading 1`] = `
|
|
|
35
40
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1280&height=1600&fit=cover 1280w,
|
|
36
41
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1600&height=2000&fit=cover 1600w,
|
|
37
42
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=2560&height=3200&fit=cover 2560w"
|
|
43
|
+
style={
|
|
44
|
+
Object {
|
|
45
|
+
"--height": "125px",
|
|
46
|
+
"--width": "100px",
|
|
47
|
+
}
|
|
48
|
+
}
|
|
38
49
|
width={100}
|
|
39
50
|
/>
|
|
40
51
|
</div>
|
|
@@ -162,6 +173,11 @@ exports[`Should render correctly 1`] = `
|
|
|
162
173
|
className="image placeholder"
|
|
163
174
|
loading="eager"
|
|
164
175
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
176
|
+
style={
|
|
177
|
+
Object {
|
|
178
|
+
"--width": "100px",
|
|
179
|
+
}
|
|
180
|
+
}
|
|
165
181
|
width={100}
|
|
166
182
|
/>
|
|
167
183
|
<img
|
|
@@ -181,6 +197,12 @@ exports[`Should render correctly 1`] = `
|
|
|
181
197
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1280&height=1600&fit=cover 1280w,
|
|
182
198
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1600&height=2000&fit=cover 1600w,
|
|
183
199
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=2560&height=3200&fit=cover 2560w"
|
|
200
|
+
style={
|
|
201
|
+
Object {
|
|
202
|
+
"--height": "125px",
|
|
203
|
+
"--width": "100px",
|
|
204
|
+
}
|
|
205
|
+
}
|
|
184
206
|
width={100}
|
|
185
207
|
/>
|
|
186
208
|
</div>
|
|
@@ -308,6 +330,11 @@ exports[`Should render correctly when configured to use variant thumbnail 1`] =
|
|
|
308
330
|
className="image placeholder"
|
|
309
331
|
loading="eager"
|
|
310
332
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
333
|
+
style={
|
|
334
|
+
Object {
|
|
335
|
+
"--width": "100px",
|
|
336
|
+
}
|
|
337
|
+
}
|
|
311
338
|
width={100}
|
|
312
339
|
/>
|
|
313
340
|
<img
|
|
@@ -327,6 +354,12 @@ exports[`Should render correctly when configured to use variant thumbnail 1`] =
|
|
|
327
354
|
/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=1280&height=1600&fit=cover 1280w,
|
|
328
355
|
/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=1600&height=2000&fit=cover 1600w,
|
|
329
356
|
/media/catalog/product/www.venia.com/p1-variant1?auto=webp&format=pjpg&width=2560&height=3200&fit=cover 2560w"
|
|
357
|
+
style={
|
|
358
|
+
Object {
|
|
359
|
+
"--height": "125px",
|
|
360
|
+
"--width": "100px",
|
|
361
|
+
}
|
|
362
|
+
}
|
|
330
363
|
width={100}
|
|
331
364
|
/>
|
|
332
365
|
</div>
|
|
@@ -454,6 +487,11 @@ exports[`Should render correctly with out of stock product 1`] = `
|
|
|
454
487
|
className="image placeholder"
|
|
455
488
|
loading="eager"
|
|
456
489
|
src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg=="
|
|
490
|
+
style={
|
|
491
|
+
Object {
|
|
492
|
+
"--width": "100px",
|
|
493
|
+
}
|
|
494
|
+
}
|
|
457
495
|
width={100}
|
|
458
496
|
/>
|
|
459
497
|
<img
|
|
@@ -473,6 +511,12 @@ exports[`Should render correctly with out of stock product 1`] = `
|
|
|
473
511
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1280&height=1600&fit=cover 1280w,
|
|
474
512
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=1600&height=2000&fit=cover 1600w,
|
|
475
513
|
/media/catalog/product/www.venia.com/p1?auto=webp&format=pjpg&width=2560&height=3200&fit=cover 2560w"
|
|
514
|
+
style={
|
|
515
|
+
Object {
|
|
516
|
+
"--height": "125px",
|
|
517
|
+
"--width": "100px",
|
|
518
|
+
}
|
|
519
|
+
}
|
|
476
520
|
width={100}
|
|
477
521
|
/>
|
|
478
522
|
</div>
|
|
@@ -72,6 +72,7 @@ const Item = props => {
|
|
|
72
72
|
? configured_variant.thumbnail.url
|
|
73
73
|
: product.thumbnail.url
|
|
74
74
|
}
|
|
75
|
+
data-cy="Item-image"
|
|
75
76
|
/>
|
|
76
77
|
</Link>
|
|
77
78
|
<Link
|
|
@@ -88,14 +89,14 @@ const Item = props => {
|
|
|
88
89
|
options: classes.options
|
|
89
90
|
}}
|
|
90
91
|
/>
|
|
91
|
-
<span className={classes.quantity}>
|
|
92
|
+
<span data-cy="MiniCart-Item-quantity" className={classes.quantity}>
|
|
92
93
|
<FormattedMessage
|
|
93
94
|
id={'productList.quantity'}
|
|
94
95
|
defaultMessage={'Qty : {quantity}'}
|
|
95
96
|
values={{ quantity }}
|
|
96
97
|
/>
|
|
97
98
|
</span>
|
|
98
|
-
<span className={classes.price}>
|
|
99
|
+
<span data-cy="MiniCart-Item-price" className={classes.price}>
|
|
99
100
|
<Price
|
|
100
101
|
currencyCode={prices.price.currency}
|
|
101
102
|
value={prices.price.value}
|
|
@@ -80,15 +80,18 @@ const MiniCart = React.forwardRef((props, ref) => {
|
|
|
80
80
|
<div className={classes.stockStatusMessageContainer}>
|
|
81
81
|
<StockStatusMessage cartItems={productList} />
|
|
82
82
|
</div>
|
|
83
|
-
<span
|
|
83
|
+
<span
|
|
84
|
+
data-cy="MiniCart-totalQuantity"
|
|
85
|
+
className={quantityClassName}
|
|
86
|
+
>
|
|
84
87
|
<FormattedMessage
|
|
85
88
|
id={'miniCart.totalQuantity'}
|
|
86
89
|
defaultMessage={'{totalQuantity} Items'}
|
|
87
90
|
values={{ totalQuantity }}
|
|
88
91
|
/>
|
|
89
92
|
</span>
|
|
90
|
-
<span className={priceClassName}>
|
|
91
|
-
<span>
|
|
93
|
+
<span data-cy="MiniCart-subtotalPrice" className={priceClassName}>
|
|
94
|
+
<span data-cy="MiniCart-subtotalPriceLabel">
|
|
92
95
|
<FormattedMessage
|
|
93
96
|
id={'miniCart.subtotal'}
|
|
94
97
|
defaultMessage={'Subtotal: '}
|