@magento/peregrine 11.0.0-beta.1 → 12.0.0-alpha.3
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/magentoGqlCacheLink.js +59 -0
- package/lib/List/item.js +12 -9
- package/lib/List/list.js +10 -7
- package/lib/Price/price.js +0 -1
- package/lib/context/cart.js +9 -10
- package/lib/hooks/hook-wrappers/useInformedFieldStateWrapper.js +27 -0
- package/lib/hooks/useDelayedTransition.js +127 -0
- package/lib/hooks/useDetectScrollWidth.js +77 -0
- package/lib/hooks/useInternalLink.js +21 -0
- package/lib/hooks/useIntersectionObserver.js +7 -0
- package/lib/hooks/useIsInViewport.js +44 -0
- package/lib/store/actions/app/actions.js +2 -1
- package/lib/store/reducers/app.js +8 -1
- package/lib/talons/AccountInformationPage/useAccountInformationPage.js +0 -1
- package/lib/talons/Adapter/useAdapter.js +23 -3
- package/lib/talons/AddressBookPage/useAddressBookPage.js +0 -10
- package/lib/talons/Breadcrumbs/breadcrumbs.gql.js +11 -2
- package/lib/talons/Breadcrumbs/useBreadcrumbs.js +19 -5
- package/lib/talons/CartPage/GiftCards/giftCardFragments.gql.ee.js +14 -0
- package/lib/talons/CartPage/GiftCards/giftCardFragments.gql.js +8 -0
- package/lib/talons/CartPage/GiftCards/giftCardQueries.gql.ee.js +73 -0
- package/lib/talons/CartPage/GiftCards/useGiftCards.js +25 -16
- package/lib/talons/CartPage/PriceAdjustments/CouponCode/couponCode.gql.js +56 -0
- package/lib/talons/CartPage/PriceAdjustments/CouponCode/couponCodeFragments.gql.js +10 -0
- package/lib/talons/CartPage/PriceAdjustments/{useCouponCode.js → CouponCode/useCouponCode.js} +10 -6
- package/lib/talons/CartPage/{GiftOptions → PriceAdjustments/GiftOptions}/client-schema.graphql +0 -0
- package/lib/talons/CartPage/PriceAdjustments/GiftOptions/giftOptions.gql.js +21 -0
- package/lib/talons/CartPage/{GiftOptions → PriceAdjustments/GiftOptions}/useGiftOptions.js +5 -3
- package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/shippingMethods.gql.js +43 -0
- package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/shippingMethodsFragments.gql.js +60 -0
- package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/useShippingForm.js +8 -9
- package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/useShippingMethods.js +7 -5
- package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/useShippingRadios.js +1 -1
- package/lib/talons/CartPage/PriceSummary/priceSummary.gql.js +16 -0
- package/lib/talons/CartPage/PriceSummary/usePriceSummary.js +6 -5
- package/lib/talons/CartPage/ProductListing/EditModal/productForm.gql.js +78 -0
- package/lib/talons/CartPage/ProductListing/EditModal/productFormFragment.gql.js +47 -0
- package/lib/talons/CartPage/ProductListing/EditModal/useProductForm.js +18 -8
- package/lib/talons/CartPage/ProductListing/product.gql.js +4 -3
- package/lib/talons/CartPage/ProductListing/productListing.gql.ce.js +13 -1
- package/lib/talons/CartPage/ProductListing/productListing.gql.ee.js +13 -1
- package/lib/talons/CartPage/ProductListing/productListingFragments.gql.js +52 -0
- package/lib/talons/CartPage/ProductListing/useProduct.js +22 -18
- package/lib/talons/CartPage/ProductListing/useProductListing.js +8 -13
- package/lib/talons/CartPage/ProductListing/useQuantity.js +2 -1
- package/lib/talons/CartPage/cartPage.gql.js +16 -0
- package/lib/talons/CartPage/cartPageFragments.gql.js +21 -0
- package/lib/talons/CartPage/useCartPage.js +7 -6
- package/lib/talons/CategoryList/categoryList.gql.js +11 -2
- package/lib/talons/CategoryList/useCategoryList.js +8 -1
- package/lib/talons/CategoryList/useCategoryTile.js +10 -4
- package/lib/talons/CategoryTree/categoryTree.gql.js +11 -2
- package/lib/talons/CategoryTree/useCategoryTree.js +12 -3
- package/lib/talons/CheckoutPage/AddressBook/addressBook.gql.js +34 -0
- package/lib/talons/CheckoutPage/AddressBook/addressBookFragments.gql.js +31 -0
- package/lib/talons/CheckoutPage/AddressBook/useAddressBook.js +16 -8
- package/lib/talons/CheckoutPage/PaymentInformation/braintreeSummary.gql.js +1 -1
- package/lib/talons/CheckoutPage/PaymentInformation/editModal.gql.js +16 -0
- package/lib/talons/CheckoutPage/PaymentInformation/paymentInformation.gql.js +4 -8
- package/lib/talons/CheckoutPage/PaymentInformation/paymentMethods.gql.js +17 -0
- package/lib/talons/CheckoutPage/PaymentInformation/useBraintreeSummary.js +1 -1
- package/lib/talons/CheckoutPage/PaymentInformation/useEditModal.js +6 -5
- package/lib/talons/CheckoutPage/PaymentInformation/usePaymentInformation.js +22 -16
- package/lib/talons/CheckoutPage/PaymentInformation/usePaymentMethods.js +6 -3
- package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/customerForm.gql.js +55 -0
- package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/guestForm.gql.js +44 -0
- package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useCustomerForm.js +11 -14
- package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js +6 -7
- package/lib/talons/CheckoutPage/ShippingInformation/shippingInformation.gql.js +54 -0
- package/lib/talons/CheckoutPage/ShippingInformation/shippingInformationFragments.gql.js +25 -0
- package/lib/talons/CheckoutPage/ShippingInformation/useShippingInformation.js +11 -6
- package/lib/talons/CheckoutPage/ShippingMethod/shippingMethod.gql.js +64 -0
- package/lib/talons/CheckoutPage/ShippingMethod/shippingMethodFragments.gql.js +64 -0
- package/lib/talons/CheckoutPage/{useShippingMethod.js → ShippingMethod/useShippingMethod.js} +11 -8
- package/lib/talons/Cms/cmsPage.gql.js +2 -2
- package/lib/talons/Cms/useCmsPage.js +2 -2
- package/lib/talons/CommunicationsPage/useCommunicationsPage.js +1 -2
- package/lib/talons/CreateAccount/createAccount.gql.js +3 -0
- package/lib/talons/CreateAccount/useCreateAccount.js +2 -4
- package/lib/talons/CreateAccountPage/useCreateAccountPage.js +38 -9
- package/lib/talons/FilterModal/useFilterList.js +17 -3
- package/lib/talons/FilterModal/useFilterModal.js +4 -5
- package/lib/talons/FilterSidebar/useFilterSidebar.js +4 -5
- package/lib/talons/ForgotPasswordPage/useForgotPasswordPage.js +46 -0
- package/lib/talons/FormError/useFormError.js +10 -3
- package/lib/talons/Gallery/__fixtures__/apolloMocks.js +8 -6
- package/lib/talons/Gallery/addToCart.gql.js +17 -0
- package/lib/talons/Gallery/gallery.gql.ce.js +4 -3
- package/lib/talons/Gallery/gallery.gql.ee.js +4 -3
- package/lib/talons/Gallery/useAddToCartButton.js +81 -0
- package/lib/talons/Gallery/useGallery.js +4 -7
- package/lib/talons/Gallery/useGalleryItem.js +7 -1
- package/lib/talons/Header/useCartTrigger.js +14 -7
- package/lib/talons/Link/useLink.js +68 -0
- package/lib/talons/MagentoRoute/magentoRoute.gql.js +12 -3
- package/lib/talons/MagentoRoute/useMagentoRoute.js +115 -30
- package/lib/talons/MegaMenu/megaMenu.gql.js +10 -4
- package/lib/talons/MegaMenu/useMegaMenu.js +61 -11
- package/lib/talons/MegaMenu/useMegaMenuItem.js +61 -0
- package/lib/talons/MegaMenu/useSubMenu.js +20 -0
- package/lib/talons/MiniCart/ProductList/productListFragments.gql.js +0 -1
- package/lib/talons/MiniCart/miniCart.gql.js +4 -3
- package/lib/talons/MiniCart/useMiniCart.js +15 -12
- package/lib/talons/Navigation/useNavigation.js +6 -1
- package/lib/talons/OrderHistoryPage/orderRow.gql.js +0 -1
- package/lib/talons/OrderHistoryPage/useOrderHistoryPage.js +2 -14
- package/lib/talons/PageLoadingIndicator/usePageLoadingIndicator.js +52 -0
- package/lib/talons/Postcode/usePostcode.js +2 -1
- package/lib/talons/ProductFullDetail/useProductFullDetail.js +30 -5
- package/lib/talons/Region/useRegion.js +12 -10
- package/lib/talons/RootComponents/Category/categoryFragments.gql.js +5 -4
- package/lib/talons/RootComponents/Product/productDetailFragment.gql.js +7 -0
- package/lib/talons/SavedPaymentsPage/useSavedPaymentsPage.js +1 -11
- package/lib/talons/SearchBar/useAutocomplete.js +1 -1
- package/lib/talons/SearchBar/useSearchField.js +2 -1
- package/lib/talons/SearchBar/useSuggestedCategory.js +4 -6
- package/lib/talons/SearchPage/searchPage.gql.js +10 -9
- package/lib/talons/SignIn/signIn.gql.js +3 -0
- package/lib/talons/SignInPage/useSignInPage.js +63 -0
- package/lib/talons/Wishlist/AddToListButton/helpers/useSingleWishlist.js +2 -2
- package/lib/talons/Wishlist/AddToListButton/useAddToListButton.ee.js +2 -1
- package/lib/talons/WishlistPage/useActionMenu.js +39 -5
- package/lib/talons/WishlistPage/useWishlist.js +4 -4
- package/lib/talons/WishlistPage/useWishlistPage.js +3 -11
- package/lib/talons/WishlistPage/wishlist.gql.js +1 -1
- package/lib/talons/WishlistPage/wishlistConfig.gql.ce.js +14 -0
- package/lib/talons/WishlistPage/wishlistConfig.gql.ee.js +15 -0
- package/lib/targets/peregrine-declare.js +0 -4
- package/lib/util/deriveErrorMessage.js +12 -6
- package/lib/util/images.js +3 -2
- package/lib/util/isSupportedProductType.js +5 -0
- package/lib/util/magentoRouteData.js +9 -0
- package/package.json +8 -8
|
@@ -18,8 +18,8 @@ export const useWishlist = (props = {}) => {
|
|
|
18
18
|
const [isOpen, setIsOpen] = useState(!isCollapsed);
|
|
19
19
|
const [isFetchingMore, setIsFetchingMore] = useState(false);
|
|
20
20
|
|
|
21
|
-
const [
|
|
22
|
-
operations.
|
|
21
|
+
const [fetchWishlistItems, queryResult] = useLazyQuery(
|
|
22
|
+
operations.getCustomerWishlistItems,
|
|
23
23
|
{
|
|
24
24
|
fetchPolicy: 'cache-and-network',
|
|
25
25
|
nextFetchPolicy: 'cache-first',
|
|
@@ -52,9 +52,9 @@ export const useWishlist = (props = {}) => {
|
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
setPage(1);
|
|
54
54
|
if (itemsCount >= 1 && isOpen === true && !data) {
|
|
55
|
-
|
|
55
|
+
fetchWishlistItems();
|
|
56
56
|
}
|
|
57
|
-
}, [itemsCount, isOpen,
|
|
57
|
+
}, [itemsCount, isOpen, fetchWishlistItems, data]);
|
|
58
58
|
|
|
59
59
|
const items =
|
|
60
60
|
data && data.customer.wishlist_v2.items_v2.items
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useHistory } from 'react-router-dom';
|
|
1
|
+
import { useMemo } from 'react';
|
|
3
2
|
import { useQuery } from '@apollo/client';
|
|
4
3
|
|
|
5
|
-
import { useUserContext } from '
|
|
6
|
-
import mergeOperations from '
|
|
4
|
+
import { useUserContext } from '@magento/peregrine/lib/context/user';
|
|
5
|
+
import mergeOperations from '@magento/peregrine/lib/util/shallowMerge';
|
|
7
6
|
|
|
8
7
|
import defaultOperations from './wishlistPage.gql';
|
|
9
8
|
|
|
@@ -16,7 +15,6 @@ export const useWishlistPage = (props = {}) => {
|
|
|
16
15
|
const operations = mergeOperations(defaultOperations, props.operations);
|
|
17
16
|
const { getCustomerWishlistQuery } = operations;
|
|
18
17
|
|
|
19
|
-
const history = useHistory();
|
|
20
18
|
const [{ isSignedIn }] = useUserContext();
|
|
21
19
|
|
|
22
20
|
const { data, error, loading } = useQuery(getCustomerWishlistQuery, {
|
|
@@ -33,12 +31,6 @@ export const useWishlistPage = (props = {}) => {
|
|
|
33
31
|
return new Map([['getCustomerWishlistQuery', error]]);
|
|
34
32
|
}, [error]);
|
|
35
33
|
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!isSignedIn) {
|
|
38
|
-
history.push('/');
|
|
39
|
-
}
|
|
40
|
-
}, [history, isSignedIn]);
|
|
41
|
-
|
|
42
34
|
return {
|
|
43
35
|
errors,
|
|
44
36
|
loading,
|
|
@@ -54,6 +54,6 @@ export const UPDATE_WISHLIST = gql`
|
|
|
54
54
|
|
|
55
55
|
export default {
|
|
56
56
|
getCustomerWishlistQuery: GET_CUSTOMER_WISHLIST,
|
|
57
|
-
|
|
57
|
+
getCustomerWishlistItems: GET_CUSTOMER_WISHLIST_ITEMS,
|
|
58
58
|
updateWishlistMutation: UPDATE_WISHLIST
|
|
59
59
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_WISHLIST_CONFIG = gql`
|
|
4
|
+
query GetWishlistConfigForWishlistPageCE {
|
|
5
|
+
storeConfig {
|
|
6
|
+
id
|
|
7
|
+
magento_wishlist_general_is_enabled
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
getWishlistConfigQuery: GET_WISHLIST_CONFIG
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { gql } from '@apollo/client';
|
|
2
|
+
|
|
3
|
+
export const GET_WISHLIST_CONFIG = gql`
|
|
4
|
+
query GetWishlistConfigForWishlistPageEE {
|
|
5
|
+
storeConfig {
|
|
6
|
+
id
|
|
7
|
+
magento_wishlist_general_is_enabled
|
|
8
|
+
enable_multiple_wishlists
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
getWishlistConfigQuery: GET_WISHLIST_CONFIG
|
|
15
|
+
};
|
|
@@ -20,8 +20,6 @@ module.exports = targets => {
|
|
|
20
20
|
*
|
|
21
21
|
* @member {tapable.AsyncSeriesHook}
|
|
22
22
|
*
|
|
23
|
-
* @see [list of wrappable hooks][]
|
|
24
|
-
*
|
|
25
23
|
* @see [Intercept function signature]{@link hookInterceptFunction}
|
|
26
24
|
*
|
|
27
25
|
* @example <caption>Access the tapable object</caption>
|
|
@@ -49,8 +47,6 @@ module.exports = targets => {
|
|
|
49
47
|
*
|
|
50
48
|
* @member {tapable.AsyncSeriesHook}
|
|
51
49
|
*
|
|
52
|
-
* @see [list of wrappable talons][]
|
|
53
|
-
*
|
|
54
50
|
* @see [Intercept function signature]{@link hookInterceptFunction}
|
|
55
51
|
*
|
|
56
52
|
* @example <caption>Access the tapable object</caption>
|
|
@@ -4,22 +4,28 @@
|
|
|
4
4
|
* @param {Error} error the error to map
|
|
5
5
|
* @return {String} error message
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
const toString = (error, defaultErrorMessage) => {
|
|
8
9
|
const { graphQLErrors, message } = error;
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if (graphQLErrors && graphQLErrors.length) {
|
|
12
|
+
if (defaultErrorMessage) {
|
|
13
|
+
return defaultErrorMessage;
|
|
14
|
+
}
|
|
15
|
+
return graphQLErrors.map(({ message }) => message).join(', ');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return message;
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* A function to derive an error string from an array of errors.
|
|
17
23
|
*/
|
|
18
|
-
export const deriveErrorMessage = errors => {
|
|
24
|
+
export const deriveErrorMessage = (errors, defaultErrorMessage = '') => {
|
|
19
25
|
const errorCollection = [];
|
|
20
26
|
for (const error of errors) {
|
|
21
27
|
if (error) {
|
|
22
|
-
errorCollection.push(toString(error));
|
|
28
|
+
errorCollection.push(toString(error, defaultErrorMessage));
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
|
package/lib/util/images.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
// 4x5 transparent
|
|
1
|
+
// 4x5 transparent svg
|
|
2
|
+
// svg source = <svg xmlns='http://www.w3.org/2000/svg' width='4' height='5'><rect width='4' height='5' style='fill: none' /></svg>
|
|
2
3
|
export const transparentPlaceholder =
|
|
3
|
-
'data:image/
|
|
4
|
+
'data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPSc0JyBoZWlnaHQ9JzUnPjxyZWN0IHdpZHRoPSc0JyBoZWlnaHQ9JzUnIHN0eWxlPSdmaWxsOiBub25lJyAvPjwvc3ZnPg==';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magento/peregrine",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-alpha.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"intl-locales-supported": "~1.8.12",
|
|
28
28
|
"react": "~17.0.1",
|
|
29
29
|
"react-dom": "~17.0.1",
|
|
30
|
-
"react-intl": "~5.
|
|
31
|
-
"react-redux": "~7.
|
|
32
|
-
"react-router-dom": "~5.
|
|
30
|
+
"react-intl": "~5.20.0",
|
|
31
|
+
"react-redux": "~7.2.2",
|
|
32
|
+
"react-router-dom": "~5.2.0",
|
|
33
33
|
"react-test-renderer": "~17.0.1",
|
|
34
34
|
"redux": "~4.0.4",
|
|
35
35
|
"redux-actions": "~2.6.5",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@apollo/client": "~3.1.2",
|
|
40
40
|
"@babel/runtime": "~7.4.2",
|
|
41
|
-
"informed": "~3.
|
|
41
|
+
"informed": "~3.29.0",
|
|
42
42
|
"react": "~17.0.1",
|
|
43
43
|
"react-dom": "~17.0.1",
|
|
44
|
-
"react-intl": "~5.
|
|
45
|
-
"react-redux": "~7.
|
|
46
|
-
"react-router-dom": "~5.
|
|
44
|
+
"react-intl": "~5.20.0",
|
|
45
|
+
"react-redux": "~7.2.2",
|
|
46
|
+
"react-router-dom": "~5.2.0",
|
|
47
47
|
"redux": "~4.0.4",
|
|
48
48
|
"redux-actions": "~2.6.5"
|
|
49
49
|
},
|