@magento/peregrine 12.2.0-alpha.3 → 12.3.0-alpha.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/lib/Apollo/clearCustomerDataFromCache.js +1 -0
- package/lib/Apollo/policies/index.js +9 -4
- package/lib/hooks/useGoogleReCaptcha/googleReCaptchaConfig.gql.js +16 -0
- package/lib/hooks/useGoogleReCaptcha/index.js +1 -0
- package/lib/hooks/useGoogleReCaptcha/useGoogleReCaptcha.js +210 -0
- package/lib/hooks/useMediaQuery.js +83 -0
- package/lib/hooks/useScript.js +68 -0
- package/lib/hooks/useSort.js +13 -2
- package/lib/talons/AccountInformationPage/useAccountInformationPage.js +23 -6
- package/lib/talons/CartPage/PriceAdjustments/GiftOptions/giftOptions.gql.js +36 -11
- package/lib/talons/CartPage/PriceAdjustments/GiftOptions/giftOptionsFragments.gql.js +19 -0
- package/lib/talons/CartPage/PriceAdjustments/GiftOptions/useGiftOptions.js +315 -94
- package/lib/talons/CartPage/PriceAdjustments/giftOptionsSection.gql.js +17 -0
- package/lib/talons/CartPage/PriceAdjustments/useGiftOptionsSection.js +61 -0
- package/lib/talons/CartPage/PriceSummary/__fixtures__/priceSummary.js +7 -2
- package/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql.js +7 -0
- package/lib/talons/CartPage/PriceSummary/queries/giftOptionsSummary.ce.js +8 -0
- package/lib/talons/CartPage/PriceSummary/queries/giftOptionsSummary.ee.js +15 -0
- package/lib/talons/CartPage/PriceSummary/useDiscountSummary.js +71 -0
- package/lib/talons/CartPage/PriceSummary/usePriceSummary.js +3 -1
- package/lib/talons/CartPage/ProductListing/EditModal/__fixtures__/configurableThumbnailSource.js +8 -0
- package/lib/talons/CartPage/ProductListing/EditModal/productForm.gql.js +11 -0
- package/lib/talons/CartPage/ProductListing/EditModal/useProductForm.js +15 -1
- package/lib/talons/CheckoutPage/OrderConfirmationPage/useCreateAccount.js +27 -5
- package/lib/talons/CheckoutPage/PaymentInformation/useCreditCard.js +36 -15
- package/lib/talons/CheckoutPage/useCheckoutPage.js +18 -3
- package/lib/talons/CmsDynamicBlock/client-schema.graphql +4 -0
- package/lib/talons/CmsDynamicBlock/cmsDynamicBlock.gql.js +113 -0
- package/lib/talons/CmsDynamicBlock/useCmsDynamicBlock.js +211 -0
- package/lib/talons/CreateAccount/useCreateAccount.js +29 -5
- package/lib/talons/FilterModal/helpers.js +29 -0
- package/lib/talons/FilterModal/useFilterModal.js +9 -2
- package/lib/talons/FilterSidebar/useFilterSidebar.js +4 -1
- package/lib/talons/ForgotPassword/useForgotPassword.js +26 -5
- package/lib/talons/Link/useLink.js +2 -1
- package/lib/talons/MiniCart/miniCartFragments.gql.js +4 -0
- package/lib/talons/MyAccount/useResetPassword.js +23 -5
- package/lib/talons/RootComponents/Category/categoryContent.gql.js +1 -0
- package/lib/talons/RootComponents/Category/useCategory.js +1 -1
- package/lib/talons/RootComponents/Product/productDetailFragment.gql.js +6 -2
- package/lib/talons/RootComponents/Product/useProduct.js +1 -6
- package/lib/talons/SearchPage/searchPage.gql.js +1 -0
- package/lib/talons/SearchPage/useSearchPage.js +1 -1
- package/lib/talons/SignIn/useSignIn.js +25 -6
- package/lib/talons/WishlistPage/createWishlist.gql.js +1 -0
- package/lib/talons/WishlistPage/useActionMenu.js +4 -4
- package/lib/talons/WishlistPage/useCreateWishlist.js +7 -4
- package/lib/talons/WishlistPage/useWishlistItem.js +3 -2
- package/lib/talons/WishlistPage/wishlistConfig.gql.ee.js +1 -0
- package/lib/talons/WishlistPage/wishlistItemFragments.gql.js +1 -0
- package/lib/util/configuredVariant.js +10 -6
- package/package.json +1 -1
- package/lib/talons/CartPage/PriceAdjustments/GiftOptions/client-schema.graphql +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useRef, useState, useMemo } from 'react';
|
|
2
2
|
import { useApolloClient, useMutation } from '@apollo/client';
|
|
3
3
|
|
|
4
|
+
import { useGoogleReCaptcha } from '../../hooks/useGoogleReCaptcha/useGoogleReCaptcha';
|
|
4
5
|
import mergeOperations from '../../util/shallowMerge';
|
|
5
6
|
import { useCartContext } from '../../context/cart';
|
|
6
7
|
import { useUserContext } from '../../context/user';
|
|
@@ -42,6 +43,15 @@ export const useSignIn = props => {
|
|
|
42
43
|
fetchPolicy: 'no-cache'
|
|
43
44
|
});
|
|
44
45
|
|
|
46
|
+
const {
|
|
47
|
+
generateReCaptchaData,
|
|
48
|
+
recaptchaLoading,
|
|
49
|
+
recaptchaWidgetProps
|
|
50
|
+
} = useGoogleReCaptcha({
|
|
51
|
+
currentForm: 'CUSTOMER_LOGIN',
|
|
52
|
+
formAction: 'signIn'
|
|
53
|
+
});
|
|
54
|
+
|
|
45
55
|
const [fetchCartId] = useMutation(createCartMutation);
|
|
46
56
|
const [mergeCarts] = useMutation(mergeCartsMutation);
|
|
47
57
|
const fetchUserDetails = useAwaitQuery(getCustomerQuery);
|
|
@@ -57,16 +67,23 @@ export const useSignIn = props => {
|
|
|
57
67
|
// Get source cart id (guest cart id).
|
|
58
68
|
const sourceCartId = cartId;
|
|
59
69
|
|
|
70
|
+
// Get recaptchaV3 data for login
|
|
71
|
+
const recaptchaData = await generateReCaptchaData();
|
|
72
|
+
|
|
60
73
|
// Sign in and set the token.
|
|
61
74
|
const signInResponse = await signIn({
|
|
62
|
-
variables: {
|
|
75
|
+
variables: {
|
|
76
|
+
email,
|
|
77
|
+
password
|
|
78
|
+
},
|
|
79
|
+
...recaptchaData
|
|
63
80
|
});
|
|
64
81
|
const token = signInResponse.data.generateCustomerToken.token;
|
|
65
82
|
await setToken(token);
|
|
66
83
|
|
|
67
84
|
// Clear all cart/customer data from cache and redux.
|
|
68
85
|
await apolloClient.clearCacheData(apolloClient, 'cart');
|
|
69
|
-
await apolloClient.clearCacheData(apolloClient, '
|
|
86
|
+
await apolloClient.clearCacheData(apolloClient, 'customer');
|
|
70
87
|
await removeCart();
|
|
71
88
|
|
|
72
89
|
// Create and get the customer's cart id.
|
|
@@ -96,10 +113,11 @@ export const useSignIn = props => {
|
|
|
96
113
|
},
|
|
97
114
|
[
|
|
98
115
|
cartId,
|
|
99
|
-
|
|
100
|
-
removeCart,
|
|
116
|
+
generateReCaptchaData,
|
|
101
117
|
signIn,
|
|
102
118
|
setToken,
|
|
119
|
+
apolloClient,
|
|
120
|
+
removeCart,
|
|
103
121
|
createCart,
|
|
104
122
|
fetchCartId,
|
|
105
123
|
mergeCarts,
|
|
@@ -144,7 +162,8 @@ export const useSignIn = props => {
|
|
|
144
162
|
handleCreateAccount,
|
|
145
163
|
handleForgotPassword,
|
|
146
164
|
handleSubmit,
|
|
147
|
-
isBusy: isGettingDetails || isSigningIn,
|
|
148
|
-
setFormApi
|
|
165
|
+
isBusy: isGettingDetails || isSigningIn || recaptchaLoading,
|
|
166
|
+
setFormApi,
|
|
167
|
+
recaptchaWidgetProps
|
|
149
168
|
};
|
|
150
169
|
};
|
|
@@ -99,10 +99,10 @@ export const useActionMenu = (props = {}) => {
|
|
|
99
99
|
[getCustomerWishlistQuery, id, updateWishlist]
|
|
100
100
|
);
|
|
101
101
|
|
|
102
|
-
const errors = useMemo(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
102
|
+
const errors = useMemo(() => (displayError ? [updateWishlistErrors] : []), [
|
|
103
|
+
updateWishlistErrors,
|
|
104
|
+
displayError
|
|
105
|
+
]);
|
|
106
106
|
|
|
107
107
|
return {
|
|
108
108
|
editFavoritesListIsOpen,
|
|
@@ -7,10 +7,12 @@ import WISHLIST_PAGE_OPERATIONS from './wishlistPage.gql';
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @function
|
|
10
|
+
* @param {number} props.numberOfWishlists - The current number of wishlists created
|
|
10
11
|
*
|
|
11
12
|
* @returns {CreateWishListProps}
|
|
12
13
|
*/
|
|
13
|
-
export const useCreateWishlist = (props = {}) => {
|
|
14
|
+
export const useCreateWishlist = (props = { numberOfWishlists: 1 }) => {
|
|
15
|
+
const { numberOfWishlists } = props;
|
|
14
16
|
const operations = mergeOperations(
|
|
15
17
|
DEFAULT_OPERATIONS,
|
|
16
18
|
WISHLIST_PAGE_OPERATIONS,
|
|
@@ -39,11 +41,12 @@ export const useCreateWishlist = (props = {}) => {
|
|
|
39
41
|
const shouldRender = useMemo(() => {
|
|
40
42
|
return (
|
|
41
43
|
(storeConfigData &&
|
|
42
|
-
storeConfigData.storeConfig.enable_multiple_wishlists ===
|
|
43
|
-
|
|
44
|
+
storeConfigData.storeConfig.enable_multiple_wishlists === '1' &&
|
|
45
|
+
numberOfWishlists <
|
|
46
|
+
storeConfigData.storeConfig.maximum_number_of_wishlists) ||
|
|
44
47
|
false
|
|
45
48
|
);
|
|
46
|
-
}, [storeConfigData]);
|
|
49
|
+
}, [storeConfigData, numberOfWishlists]);
|
|
47
50
|
|
|
48
51
|
const handleShowModal = useCallback(() => {
|
|
49
52
|
setIsModalOpen(true);
|
|
@@ -80,9 +80,10 @@ export const useWishlistItem = props => {
|
|
|
80
80
|
) {
|
|
81
81
|
const selectedOptionsArray = selectedConfigurableOptions.map(
|
|
82
82
|
selectedOption => {
|
|
83
|
+
// TODO: Use configurable_product_option_uid for ConfigurableWishlistItem when available in 2.4.5
|
|
83
84
|
const {
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
id: attributeId,
|
|
86
|
+
value_id: selectedValueId
|
|
86
87
|
} = selectedOption;
|
|
87
88
|
const configurableOption = configurableOptions.find(
|
|
88
89
|
option => option.attribute_id_v2 === attributeId
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This function resolves configured variant for configurable cart item.
|
|
3
|
+
* This field is proposed in the https://github.com/magento/magento2/pull/30817
|
|
4
|
+
* @param {Object} configured_options An array of product variant options
|
|
5
|
+
* @param {Object} product A configurable product object with a variants property.
|
|
6
|
+
*
|
|
7
|
+
* @returns {Object | undefined}
|
|
8
|
+
*/
|
|
3
9
|
export default function configuredVariant(configured_options, product) {
|
|
4
|
-
if (!configured_options || !product
|
|
10
|
+
if (!configured_options || !product?.variants) return;
|
|
5
11
|
const optionUids = configured_options
|
|
6
12
|
.map(option => {
|
|
7
|
-
return
|
|
8
|
-
`configurable/${option.id}/${option.value_id}`
|
|
9
|
-
).toString('base64');
|
|
13
|
+
return option.configurable_product_option_value_uid;
|
|
10
14
|
})
|
|
11
15
|
.sort()
|
|
12
16
|
.toString();
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Mocked client fields used for gift receipt and message components
|
|
2
|
-
# TODO: As of 2.4.2 these fields now exist, we should remove these and update components.
|
|
3
|
-
extend type Cart {
|
|
4
|
-
include_gift_receipt: Boolean!
|
|
5
|
-
include_printed_card: Boolean!
|
|
6
|
-
local_gift_message: String
|
|
7
|
-
}
|