@magento/peregrine 12.1.0-alpha.1 → 12.2.0-alpha.2

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.
Files changed (110) hide show
  1. package/lib/Apollo/clearCartDataFromCache.js +11 -12
  2. package/lib/Apollo/clearCustomerDataFromCache.js +15 -8
  3. package/lib/Apollo/policies/index.js +35 -3
  4. package/lib/Toasts/useToasts.js +5 -0
  5. package/lib/hooks/useCustomerWishlistSkus/customerWishlist.gql.ce.js +3 -3
  6. package/lib/store/actions/cart/asyncActions.js +1 -2
  7. package/lib/store/actions/user/asyncActions.js +2 -4
  8. package/lib/store/reducers/catalog.js +7 -7
  9. package/lib/store/reducers/user.js +1 -3
  10. package/lib/talons/Adapter/useAdapter.js +80 -11
  11. package/lib/talons/AddToCartDialog/addToCartDialog.gql.js +2 -2
  12. package/lib/talons/AddressBookPage/addressBookPage.gql.js +3 -9
  13. package/lib/talons/Breadcrumbs/breadcrumbs.gql.js +16 -12
  14. package/lib/talons/Breadcrumbs/useBreadcrumbs.js +6 -4
  15. package/lib/talons/CartPage/GiftCards/giftCardQueries.gql.ee.js +2 -2
  16. package/lib/talons/CartPage/PriceAdjustments/CouponCode/couponCode.gql.js +2 -3
  17. package/lib/talons/CartPage/PriceAdjustments/ShippingMethods/shippingMethods.gql.js +1 -1
  18. package/lib/talons/CartPage/PriceSummary/priceSummaryFragments.gql.js +2 -1
  19. package/lib/talons/CartPage/ProductListing/EditModal/productForm.gql.js +3 -3
  20. package/lib/talons/CartPage/ProductListing/EditModal/productFormFragment.gql.js +6 -3
  21. package/lib/talons/CartPage/ProductListing/EditModal/useProductForm.js +1 -0
  22. package/lib/talons/CartPage/ProductListing/product.gql.js +2 -1
  23. package/lib/talons/CartPage/ProductListing/productListing.gql.ce.js +2 -1
  24. package/lib/talons/CartPage/ProductListing/productListing.gql.ee.js +2 -1
  25. package/lib/talons/CartPage/ProductListing/productListingFragments.gql.js +14 -5
  26. package/lib/talons/CartPage/ProductListing/useProduct.js +8 -1
  27. package/lib/talons/CartPage/ProductListing/useProductListing.js +4 -2
  28. package/lib/talons/CartPage/useCartPage.js +4 -3
  29. package/lib/talons/CategoryList/categoryList.gql.js +25 -17
  30. package/lib/talons/CategoryList/useCategoryList.js +6 -1
  31. package/lib/talons/CategoryList/useCategoryTile.js +2 -0
  32. package/lib/talons/CategoryTree/categoryTree.gql.js +18 -12
  33. package/lib/talons/CategoryTree/useCategoryBranch.js +1 -1
  34. package/lib/talons/CategoryTree/useCategoryTree.js +5 -5
  35. package/lib/talons/CheckoutPage/AddressBook/addressBook.gql.js +1 -1
  36. package/lib/talons/CheckoutPage/BillingAddress/billingAddress.gql.js +1 -1
  37. package/lib/talons/CheckoutPage/ItemsReview/__fixtures__/cartItems.js +12 -12
  38. package/lib/talons/CheckoutPage/ItemsReview/itemsReview.gql.js +2 -1
  39. package/lib/talons/CheckoutPage/ItemsReview/itemsReviewFragments.gql.js +11 -5
  40. package/lib/talons/CheckoutPage/OrderConfirmationPage/createAccount.gql.js +12 -6
  41. package/lib/talons/CheckoutPage/PaymentInformation/creditCard.gql.js +2 -2
  42. package/lib/talons/CheckoutPage/PaymentInformation/paymentInformation.gql.js +2 -2
  43. package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/customerForm.gql.js +3 -5
  44. package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/guestForm.gql.js +12 -4
  45. package/lib/talons/CheckoutPage/ShippingInformation/AddressForm/useGuestForm.js +45 -5
  46. package/lib/talons/CheckoutPage/ShippingInformation/shippingInformation.gql.js +2 -2
  47. package/lib/talons/CheckoutPage/ShippingMethod/shippingMethod.gql.js +1 -1
  48. package/lib/talons/CheckoutPage/checkoutPage.gql.js +2 -2
  49. package/lib/talons/CheckoutPage/checkoutPageFragments.gql.js +4 -2
  50. package/lib/talons/CheckoutPage/useCheckoutPage.js +5 -2
  51. package/lib/talons/Cms/cmsPage.gql.js +0 -4
  52. package/lib/talons/Cms/useCmsPage.js +6 -23
  53. package/lib/talons/CommunicationsPage/communicationsPage.gql.js +2 -2
  54. package/lib/talons/ContactPage/contactUs.gql.js +48 -0
  55. package/lib/talons/ContactPage/index.js +2 -0
  56. package/lib/talons/ContactPage/useContactLink.js +27 -0
  57. package/lib/talons/ContactPage/useContactPage.js +85 -0
  58. package/lib/talons/CreateAccount/createAccount.gql.js +15 -8
  59. package/lib/talons/CreateAccount/useCreateAccount.js +2 -4
  60. package/lib/talons/Footer/footer.gql.js +2 -1
  61. package/lib/talons/FormError/useFormError.js +9 -7
  62. package/lib/talons/Gallery/__fixtures__/apolloMocks.js +2 -2
  63. package/lib/talons/Gallery/gallery.gql.ce.js +2 -1
  64. package/lib/talons/Gallery/gallery.gql.ee.js +2 -1
  65. package/lib/talons/Gallery/useAddToCartButton.js +13 -12
  66. package/lib/talons/Header/storeSwitcher.gql.js +21 -9
  67. package/lib/talons/Header/useCartTrigger.js +3 -3
  68. package/lib/talons/Header/useStoreSwitcher.js +10 -8
  69. package/lib/talons/MagentoRoute/magentoRoute.gql.js +4 -2
  70. package/lib/talons/MagentoRoute/useMagentoRoute.js +39 -33
  71. package/lib/talons/MegaMenu/megaMenu.gql.js +10 -5
  72. package/lib/talons/MegaMenu/useMegaMenu.js +3 -5
  73. package/lib/talons/MegaMenu/useMegaMenuItem.js +5 -0
  74. package/lib/talons/MiniCart/ProductList/productListFragments.gql.js +10 -5
  75. package/lib/talons/MiniCart/miniCart.gql.js +2 -1
  76. package/lib/talons/MiniCart/useMiniCart.js +8 -7
  77. package/lib/talons/Navigation/navigation.gql.js +4 -3
  78. package/lib/talons/Navigation/useNavigation.js +1 -1
  79. package/lib/talons/Newsletter/newsletter.gql.js +14 -1
  80. package/lib/talons/Newsletter/useNewsletter.js +31 -12
  81. package/lib/talons/OrderHistoryPage/orderHistoryContext.gql.js +2 -1
  82. package/lib/talons/OrderHistoryPage/orderHistoryPage.gql.js +1 -1
  83. package/lib/talons/OrderHistoryPage/orderRow.gql.js +7 -3
  84. package/lib/talons/ProductFullDetail/CustomAttributes/AttributeType/useAttributeType.js +26 -0
  85. package/lib/talons/ProductFullDetail/productFullDetail.gql.ce.js +4 -3
  86. package/lib/talons/ProductFullDetail/productFullDetail.gql.ee.js +2 -1
  87. package/lib/talons/ProductFullDetail/useProductFullDetail.js +28 -2
  88. package/lib/talons/RootComponents/Category/category.gql.js +7 -4
  89. package/lib/talons/RootComponents/Category/categoryContent.gql.js +26 -7
  90. package/lib/talons/RootComponents/Category/categoryFragments.gql.js +4 -2
  91. package/lib/talons/RootComponents/Category/useCategory.js +8 -6
  92. package/lib/talons/RootComponents/Category/useCategoryContent.js +30 -3
  93. package/lib/talons/RootComponents/Category/useNoProductsFound.js +0 -1
  94. package/lib/talons/RootComponents/Product/product.gql.js +2 -1
  95. package/lib/talons/RootComponents/Product/productDetailFragment.gql.js +66 -10
  96. package/lib/talons/SearchPage/searchPage.gql.js +18 -2
  97. package/lib/talons/SearchPage/useSearchPage.js +25 -0
  98. package/lib/talons/SignIn/signIn.gql.js +4 -3
  99. package/lib/talons/SignIn/useSignIn.js +2 -4
  100. package/lib/talons/Wishlist/WishlistDialog/wishlistDialog.gql.js +3 -2
  101. package/lib/talons/WishlistPage/createWishlist.gql.js +2 -1
  102. package/lib/talons/WishlistPage/useWishlistItem.js +2 -2
  103. package/lib/talons/WishlistPage/wishlist.gql.js +2 -2
  104. package/lib/talons/WishlistPage/wishlistConfig.gql.ce.js +2 -1
  105. package/lib/talons/WishlistPage/wishlistConfig.gql.ee.js +2 -1
  106. package/lib/talons/WishlistPage/wishlistItemFragments.gql.js +5 -2
  107. package/lib/talons/WishlistPage/wishlistPage.gql.js +1 -1
  108. package/package.json +6 -6
  109. package/lib/Apollo/clearStore.js +0 -26
  110. package/lib/Apollo/deleteCacheEntry.js +0 -87
@@ -3,8 +3,9 @@ import { ProductListingFragment } from './productListingFragments.gql';
3
3
 
4
4
  export const GET_WISHLIST_CONFIG = gql`
5
5
  query GetWishlistConfigForCartPageCE {
6
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
7
  storeConfig {
7
- id
8
+ store_code
8
9
  magento_wishlist_general_is_enabled
9
10
  }
10
11
  }
@@ -3,8 +3,9 @@ import { ProductListingFragment } from './productListingFragments.gql';
3
3
 
4
4
  export const GET_WISHLIST_CONFIG = gql`
5
5
  query GetWishlistConfigForCartPageEE {
6
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
7
  storeConfig {
7
- id
8
+ store_code
8
9
  magento_wishlist_general_is_enabled
9
10
  enable_multiple_wishlists
10
11
  }
@@ -3,11 +3,12 @@ import { gql } from '@apollo/client';
3
3
  export const ProductListingFragment = gql`
4
4
  fragment ProductListingFragment on Cart {
5
5
  id
6
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
6
7
  items {
7
- id
8
8
  uid
9
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
9
10
  product {
10
- id
11
+ uid
11
12
  name
12
13
  sku
13
14
  url_key
@@ -18,13 +19,15 @@ export const ProductListingFragment = gql`
18
19
  url
19
20
  }
20
21
  stock_status
22
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
21
23
  ... on ConfigurableProduct {
22
24
  variants {
23
25
  attributes {
24
26
  uid
25
27
  }
28
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
26
29
  product {
27
- id
30
+ uid
28
31
  small_image {
29
32
  url
30
33
  }
@@ -39,12 +42,18 @@ export const ProductListingFragment = gql`
39
42
  }
40
43
  }
41
44
  quantity
45
+ errors {
46
+ code
47
+ message
48
+ }
49
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
42
50
  ... on ConfigurableCartItem {
51
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
43
52
  configurable_options {
44
53
  id
45
- configurable_product_option_value_uid
54
+ configurable_product_option_uid
46
55
  option_label
47
- value_id
56
+ configurable_product_option_value_uid
48
57
  value_label
49
58
  }
50
59
  }
@@ -107,13 +107,20 @@ export const useProduct = props => {
107
107
  updateItemLoading
108
108
  ]);
109
109
 
110
+ useEffect(() => {
111
+ if (item.errors) {
112
+ setDisplayError(true);
113
+ }
114
+ }, [item.errors]);
115
+
110
116
  const derivedErrorMessage = useMemo(() => {
111
117
  return (
112
118
  (displayError &&
113
119
  deriveErrorMessage([updateError, removeItemError])) ||
120
+ deriveErrorMessage([...(item.errors || [])]) ||
114
121
  ''
115
122
  );
116
- }, [displayError, removeItemError, updateError]);
123
+ }, [displayError, removeItemError, updateError, item.errors]);
117
124
 
118
125
  const handleEditItem = useCallback(() => {
119
126
  setActiveEditItem(item);
@@ -54,13 +54,14 @@ export const useProductListing = (props = {}) => {
54
54
  }, [cartId, fetchProductListing]);
55
55
 
56
56
  let items = [];
57
- if (called && !error && !loading) {
58
- items = data.cart.items;
57
+ if (called && !loading) {
58
+ items = data?.cart?.items || [];
59
59
  }
60
60
 
61
61
  return {
62
62
  activeEditItem,
63
63
  isLoading: !!loading,
64
+ error,
64
65
  items,
65
66
  setActiveEditItem,
66
67
  wishlistConfig
@@ -89,6 +90,7 @@ export const useProductListing = (props = {}) => {
89
90
  *
90
91
  * @property {Object} activeEditItem The product item currently being edited
91
92
  * @property {boolean} isLoading True if the query to get the product listing is still in progress. False otherwise.
93
+ * @property {Error|null} error An array of graphql errors
92
94
  * @property {Array<Object>} items A list of products in a cart
93
95
  * @property {function} setActiveEditItem Function for setting the current item to edit
94
96
  *
@@ -36,15 +36,16 @@ export const useCartPage = (props = {}) => {
36
36
  getCartDetailsQuery,
37
37
  {
38
38
  fetchPolicy: 'cache-and-network',
39
- nextFetchPolicy: 'cache-first'
39
+ nextFetchPolicy: 'cache-first',
40
+ errorPolicy: 'all'
40
41
  }
41
42
  );
42
43
 
43
- const hasItems = !!(data && data.cart.total_quantity);
44
+ const hasItems = !!data?.cart?.total_quantity;
44
45
  const shouldShowLoadingIndicator = called && loading && !hasItems;
45
46
 
46
47
  const cartItems = useMemo(() => {
47
- return (data && data.cart.items) || [];
48
+ return data?.cart?.items || [];
48
49
  }, [data]);
49
50
 
50
51
  const onAddToWishlistSuccess = useCallback(successToastProps => {
@@ -1,31 +1,39 @@
1
+ /* Deprecated in PWA-12.1.0*/
2
+
1
3
  import { gql } from '@apollo/client';
2
4
 
3
5
  export const GET_STORE_CONFIG_DATA = gql`
4
6
  query GetStoreConfigForCategoryList {
7
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
5
8
  storeConfig {
6
- id
9
+ store_code
7
10
  category_url_suffix
8
11
  }
9
12
  }
10
13
  `;
11
14
 
12
15
  export const GET_CATEGORY_LIST = gql`
13
- query GetCategoryList($id: Int!) {
14
- category(id: $id) {
15
- id
16
- children {
17
- id
18
- name
19
- url_key
20
- url_path
21
- children_count
22
- path
23
- image
24
- productImagePreview: products(pageSize: 1) {
25
- items {
26
- id
27
- small_image {
28
- url
16
+ query GetCategoryList($id: String!) {
17
+ categories(filters: { category_uid: { in: [$id] } }) {
18
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
19
+ items {
20
+ uid
21
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
22
+ children {
23
+ uid
24
+ name
25
+ url_key
26
+ url_path
27
+ children_count
28
+ path
29
+ image
30
+ productImagePreview: products(pageSize: 1) {
31
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
32
+ items {
33
+ uid
34
+ small_image {
35
+ url
36
+ }
29
37
  }
30
38
  }
31
39
  }
@@ -1,3 +1,5 @@
1
+ /* Deprecated in PWA-12.1.0*/
2
+
1
3
  import { useQuery } from '@apollo/client';
2
4
 
3
5
  import mergeOperations from '../../util/shallowMerge';
@@ -35,7 +37,10 @@ export const useCategoryList = props => {
35
37
 
36
38
  return {
37
39
  childCategories:
38
- (data && data.category && data.category.children) || null,
40
+ (data &&
41
+ data.categories.items[0] &&
42
+ data.categories.items[0].children) ||
43
+ null,
39
44
  storeConfig,
40
45
  error,
41
46
  loading
@@ -1,3 +1,5 @@
1
+ /* Deprecated in PWA-12.1.0*/
2
+
1
3
  import { useMemo } from 'react';
2
4
  import useInternalLink from '../../hooks/useInternalLink';
3
5
 
@@ -2,29 +2,35 @@ import { gql } from '@apollo/client';
2
2
 
3
3
  export const GET_CATEGORY_URL_SUFFIX = gql`
4
4
  query GetStoreConfigForCategoryTree {
5
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
5
6
  storeConfig {
6
- id
7
+ store_code
7
8
  category_url_suffix
8
9
  }
9
10
  }
10
11
  `;
11
12
 
12
13
  export const GET_NAVIGATION_MENU = gql`
13
- query GetNavigationMenu($id: Int!) {
14
- category(id: $id) {
15
- id
16
- name
17
- children {
14
+ query GetNavigationMenu($id: String!) {
15
+ categories(filters: { category_uid: { in: [$id] } }) {
16
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
17
+ items {
18
+ uid
19
+ name
20
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
21
+ children {
22
+ children_count
23
+ uid
24
+ include_in_menu
25
+ name
26
+ position
27
+ url_path
28
+ url_suffix
29
+ }
18
30
  children_count
19
- id
20
31
  include_in_menu
21
- name
22
- position
23
32
  url_path
24
- url_suffix
25
33
  }
26
- include_in_menu
27
- url_path
28
34
  }
29
35
  }
30
36
  `;
@@ -12,7 +12,7 @@ import { useCallback } from 'react';
12
12
  */
13
13
  export const useCategoryBranch = props => {
14
14
  const { category, setCategoryId } = props;
15
- const { id, include_in_menu } = category;
15
+ const { uid: id, include_in_menu } = category;
16
16
 
17
17
  // `include_in_menu` is undefined when Magento <= 2.3.1
18
18
  const exclude = include_in_menu === 0;
@@ -54,12 +54,12 @@ export const useCategoryTree = props => {
54
54
 
55
55
  // update redux with fetched categories
56
56
  useEffect(() => {
57
- if (data && data.category) {
58
- updateCategories(data.category);
57
+ if (data && data.categories.items[0]) {
58
+ updateCategories(data.categories.items[0]);
59
59
  }
60
60
  }, [data, updateCategories]);
61
61
 
62
- const rootCategory = data && data.category;
62
+ const rootCategory = data && data.categories.items[0];
63
63
 
64
64
  const { children = [] } = rootCategory || {};
65
65
 
@@ -72,7 +72,7 @@ export const useCategoryTree = props => {
72
72
  rootCategory.include_in_menu &&
73
73
  rootCategory.url_path
74
74
  ) {
75
- childCategories.set(rootCategory.id, {
75
+ childCategories.set(rootCategory.uid, {
76
76
  category: rootCategory,
77
77
  isLeaf: true
78
78
  });
@@ -81,7 +81,7 @@ export const useCategoryTree = props => {
81
81
  children.map(category => {
82
82
  if (category.include_in_menu) {
83
83
  const isLeaf = !parseInt(category.children_count);
84
- childCategories.set(category.id, { category, isLeaf });
84
+ childCategories.set(category.uid, { category, isLeaf });
85
85
  }
86
86
  });
87
87
 
@@ -6,8 +6,8 @@ import { ShippingInformationFragment } from '../ShippingInformation/shippingInfo
6
6
 
7
7
  export const GET_CUSTOMER_ADDRESSES = gql`
8
8
  query GetCustomerAddresses {
9
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
9
10
  customer {
10
- id
11
11
  addresses {
12
12
  id
13
13
  ...CustomerAddressFragment
@@ -86,7 +86,7 @@ export const SET_BILLING_ADDRESS = gql`
86
86
  }
87
87
  }
88
88
  }
89
- ) @connection(key: "setBillingAddressOnCart") {
89
+ ) {
90
90
  cart {
91
91
  id
92
92
  billing_address {
@@ -18,16 +18,16 @@ export default {
18
18
  quantity: 3,
19
19
  configurable_options: [
20
20
  {
21
- id: 179,
21
+ configurable_product_option_uid: 179,
22
22
  option_label: 'Fashion Color',
23
- value_id: 18,
23
+ configurable_product_option_value_uid: 18,
24
24
  value_label: 'Peach',
25
25
  __typename: 'SelectedConfigurableOption'
26
26
  },
27
27
  {
28
- id: 182,
28
+ configurable_product_option_uid: 182,
29
29
  option_label: 'Fashion Size',
30
- value_id: 27,
30
+ configurable_product_option_value_uid: 27,
31
31
  value_label: 'M',
32
32
  __typename: 'SelectedConfigurableOption'
33
33
  }
@@ -49,16 +49,16 @@ export default {
49
49
  quantity: 1,
50
50
  configurable_options: [
51
51
  {
52
- id: 179,
52
+ configurable_product_option_uid: 179,
53
53
  option_label: 'Fashion Color',
54
- value_id: 21,
54
+ configurable_product_option_value_uid: 21,
55
55
  value_label: 'Rain',
56
56
  __typename: 'SelectedConfigurableOption'
57
57
  },
58
58
  {
59
- id: 182,
59
+ configurable_product_option_uid: 182,
60
60
  option_label: 'Fashion Size',
61
- value_id: 29,
61
+ configurable_product_option_value_uid: 29,
62
62
  value_label: 'XS',
63
63
  __typename: 'SelectedConfigurableOption'
64
64
  }
@@ -80,16 +80,16 @@ export default {
80
80
  quantity: 3,
81
81
  configurable_options: [
82
82
  {
83
- id: 179,
83
+ configurable_product_option_uid: 179,
84
84
  option_label: 'Fashion Color',
85
- value_id: 20,
85
+ configurable_product_option_value_uid: 20,
86
86
  value_label: 'Lilac',
87
87
  __typename: 'SelectedConfigurableOption'
88
88
  },
89
89
  {
90
- id: 182,
90
+ configurable_product_option_uid: 182,
91
91
  option_label: 'Fashion Size',
92
- value_id: 26,
92
+ configurable_product_option_value_uid: 26,
93
93
  value_label: 'L',
94
94
  __typename: 'SelectedConfigurableOption'
95
95
  }
@@ -4,8 +4,9 @@ import { ItemsReviewFragment } from './itemsReviewFragments.gql';
4
4
 
5
5
  export const GET_CONFIGURABLE_THUMBNAIL_SOURCE = gql`
6
6
  query getConfigurableThumbnailSource {
7
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
7
8
  storeConfig {
8
- id
9
+ store_code
9
10
  configurable_thumbnail_source
10
11
  }
11
12
  }
@@ -4,21 +4,25 @@ export const ItemsReviewFragment = gql`
4
4
  fragment ItemsReviewFragment on Cart {
5
5
  id
6
6
  total_quantity
7
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
7
8
  items {
8
- id
9
+ uid
10
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
9
11
  product {
10
- id
12
+ uid
11
13
  name
12
14
  thumbnail {
13
15
  url
14
16
  }
17
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
15
18
  ... on ConfigurableProduct {
16
19
  variants {
17
20
  attributes {
18
21
  uid
19
22
  }
23
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
20
24
  product {
21
- id
25
+ uid
22
26
  thumbnail {
23
27
  url
24
28
  }
@@ -27,11 +31,13 @@ export const ItemsReviewFragment = gql`
27
31
  }
28
32
  }
29
33
  quantity
34
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
30
35
  ... on ConfigurableCartItem {
36
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
31
37
  configurable_options {
32
- id
38
+ configurable_product_option_uid
33
39
  option_label
34
- value_id
40
+ configurable_product_option_value_uid
35
41
  value_label
36
42
  }
37
43
  }
@@ -19,8 +19,10 @@ export const CREATE_ACCOUNT = gql`
19
19
  ) {
20
20
  # The createCustomer mutation returns a non-nullable CustomerOutput type
21
21
  # which requires that at least one of the sub fields be returned.
22
+
23
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
22
24
  customer {
23
- id
25
+ email
24
26
  }
25
27
  }
26
28
  }
@@ -28,8 +30,8 @@ export const CREATE_ACCOUNT = gql`
28
30
 
29
31
  export const GET_CUSTOMER = gql`
30
32
  query GetCustomerAfterCheckout {
33
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
31
34
  customer {
32
- id
33
35
  email
34
36
  firstname
35
37
  lastname
@@ -56,15 +58,17 @@ export const GET_CART_DETAILS = gql`
56
58
  query GetCartDetailsAfterCheckout($cartId: String!) {
57
59
  cart(cart_id: $cartId) {
58
60
  id
61
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
59
62
  items {
60
- id
63
+ uid
61
64
  prices {
62
65
  price {
63
66
  value
64
67
  }
65
68
  }
69
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
66
70
  product {
67
- id
71
+ uid
68
72
  name
69
73
  sku
70
74
  small_image {
@@ -80,11 +84,13 @@ export const GET_CART_DETAILS = gql`
80
84
  }
81
85
  }
82
86
  quantity
87
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
83
88
  ... on ConfigurableCartItem {
89
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
84
90
  configurable_options {
85
- id
91
+ configurable_product_option_uid
86
92
  option_label
87
- value_id
93
+ configurable_product_option_value_uid
88
94
  value_label
89
95
  }
90
96
  }
@@ -99,7 +99,7 @@ export const SET_BILLING_ADDRESS = gql`
99
99
  }
100
100
  }
101
101
  }
102
- ) @connection(key: "setBillingAddressOnCart") {
102
+ ) {
103
103
  cart {
104
104
  id
105
105
  billing_address {
@@ -143,7 +143,7 @@ export const SET_CC_DETAILS_ON_CART = gql`
143
143
  }
144
144
  }
145
145
  }
146
- ) @connection(key: "setPaymentMethodOnCart") {
146
+ ) {
147
147
  cart {
148
148
  id
149
149
  selected_payment_method {
@@ -76,7 +76,7 @@ export const SET_BILLING_ADDRESS = gql`
76
76
  }
77
77
  }
78
78
  }
79
- ) @connection(key: "setBillingAddressOnCart") {
79
+ ) {
80
80
  cart {
81
81
  id
82
82
  billing_address {
@@ -107,7 +107,7 @@ export const SET_FREE_PAYMENT_METHOD_ON_CART = gql`
107
107
  mutation setPaymentMethodOnCart($cartId: String!) {
108
108
  setPaymentMethodOnCart(
109
109
  input: { cart_id: $cartId, payment_method: { code: "free" } }
110
- ) @connection(key: "setPaymentMethodOnCart") {
110
+ ) {
111
111
  cart {
112
112
  id
113
113
  selected_payment_method {
@@ -6,8 +6,7 @@ import { GET_DEFAULT_SHIPPING } from '../shippingInformation.gql';
6
6
 
7
7
  export const CREATE_CUSTOMER_ADDRESS_MUTATION = gql`
8
8
  mutation CreateCustomerAddress($address: CustomerAddressInput!) {
9
- createCustomerAddress(input: $address)
10
- @connection(key: "createCustomerAddress") {
9
+ createCustomerAddress(input: $address) {
11
10
  id
12
11
  ...CustomerAddressFragment
13
12
  }
@@ -27,8 +26,7 @@ export const UPDATE_CUSTOMER_ADDRESS_MUTATION = gql`
27
26
  $addressId: Int!
28
27
  $address: CustomerAddressInput!
29
28
  ) {
30
- updateCustomerAddress(id: $addressId, input: $address)
31
- @connection(key: "updateCustomerAddress") {
29
+ updateCustomerAddress(id: $addressId, input: $address) {
32
30
  id
33
31
  }
34
32
  }
@@ -36,8 +34,8 @@ export const UPDATE_CUSTOMER_ADDRESS_MUTATION = gql`
36
34
 
37
35
  export const GET_CUSTOMER_QUERY = gql`
38
36
  query GetCustomer {
37
+ # eslint-disable-next-line @graphql-eslint/require-id-when-available
39
38
  customer {
40
- id
41
39
  default_shipping
42
40
  email
43
41
  firstname
@@ -11,8 +11,7 @@ export const SET_GUEST_SHIPPING_MUTATION = gql`
11
11
  $email: String!
12
12
  $address: CartAddressInput!
13
13
  ) {
14
- setGuestEmailOnCart(input: { cart_id: $cartId, email: $email })
15
- @connection(key: "setGuestEmailOnCart") {
14
+ setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
16
15
  cart {
17
16
  id
18
17
  }
@@ -23,7 +22,7 @@ export const SET_GUEST_SHIPPING_MUTATION = gql`
23
22
  cart_id: $cartId
24
23
  shipping_addresses: [{ address: $address }]
25
24
  }
26
- ) @connection(key: "setShippingAddressesOnCart") {
25
+ ) {
27
26
  cart {
28
27
  id
29
28
  ...ShippingInformationFragment
@@ -39,6 +38,15 @@ export const SET_GUEST_SHIPPING_MUTATION = gql`
39
38
  ${AvailablePaymentMethodsFragment}
40
39
  `;
41
40
 
41
+ export const GET_EMAIL_AVAILABLE_QUERY = gql`
42
+ query IsEmailAvailable($email: String!) {
43
+ isEmailAvailable(email: $email) {
44
+ is_email_available
45
+ }
46
+ }
47
+ `;
48
+
42
49
  export default {
43
- setGuestShippingMutation: SET_GUEST_SHIPPING_MUTATION
50
+ setGuestShippingMutation: SET_GUEST_SHIPPING_MUTATION,
51
+ getEmailAvailableQuery: GET_EMAIL_AVAILABLE_QUERY
44
52
  };