@graphcommerce/magento-cart 4.2.14 → 4.2.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.2.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1466](https://github.com/graphcommerce-org/graphcommerce/pull/1466) [`ed2b67a06`](https://github.com/graphcommerce-org/graphcommerce/commit/ed2b67a0618d9db97e79ed2a8226e0ae12403943) Thanks [@FrankHarland](https://github.com/FrankHarland)! - Added a new useCustomerSession hook to allow for more fine grained control over loading data for customers.
8
+
9
+ - Updated dependencies [[`0363b9671`](https://github.com/graphcommerce-org/graphcommerce/commit/0363b9671db7c2932321d97faf6f1eb385238397), [`3ac90b57c`](https://github.com/graphcommerce-org/graphcommerce/commit/3ac90b57c68b96f9d81771d6664ed9435a28fc1d), [`00f6167ff`](https://github.com/graphcommerce-org/graphcommerce/commit/00f6167ff4096bf7432f3d8e8e739ecbf6ab0dd2), [`7159d3ab3`](https://github.com/graphcommerce-org/graphcommerce/commit/7159d3ab31e937c9c921023c46e80db5813e789c), [`32370574b`](https://github.com/graphcommerce-org/graphcommerce/commit/32370574bef6345b857ae911049ca27a64bc7e08), [`ed2b67a06`](https://github.com/graphcommerce-org/graphcommerce/commit/ed2b67a0618d9db97e79ed2a8226e0ae12403943), [`4c146c682`](https://github.com/graphcommerce-org/graphcommerce/commit/4c146c68242e6edc616807fb73173cc959c26034)]:
10
+ - @graphcommerce/next-ui@4.8.0
11
+ - @graphcommerce/magento-customer@4.3.0
12
+ - @graphcommerce/ecommerce-ui@1.0.12
13
+ - @graphcommerce/framer-scroller@2.1.11
14
+ - @graphcommerce/magento-store@4.2.4
15
+
3
16
  ## 4.2.14
4
17
 
5
18
  ### Patch Changes
@@ -1,6 +1,5 @@
1
1
  import { ApolloErrorAlert, ApolloErrorAlertProps } from '@graphcommerce/ecommerce-ui'
2
- import { useQuery } from '@graphcommerce/graphql'
3
- import { CustomerTokenDocument } from '@graphcommerce/magento-customer'
2
+ import { useCustomerSession } from '@graphcommerce/magento-customer'
4
3
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
5
4
  import { i18n } from '@lingui/core'
6
5
  import { Trans } from '@lingui/react'
@@ -13,7 +12,7 @@ export type ApolloCartErrorAlertProps = ApolloErrorAlertProps
13
12
  export function ApolloCartErrorAlert(props: ApolloCartErrorAlertProps) {
14
13
  const { error } = props
15
14
  const clear = useClearCurrentCartId()
16
- const token = useQuery(CustomerTokenDocument).data?.customerToken
15
+ const { token } = useCustomerSession()
17
16
 
18
17
  let action: JSX.Element | undefined
19
18
 
@@ -23,7 +22,7 @@ export function ApolloCartErrorAlert(props: ApolloCartErrorAlertProps) {
23
22
  const [, authorizationError] = graphqlErrorByCategory({
24
23
  category: 'graphql-authorization',
25
24
  error,
26
- mask: token?.token
25
+ mask: token
27
26
  ? i18n._(/* i18n */ `Please reauthenticate and try again`)
28
27
  : i18n._(/* i18n */ `You must sign in to continue`),
29
28
  })
@@ -1,5 +1,9 @@
1
1
  import { useMutation, useQuery } from '@graphcommerce/graphql'
2
- import { CustomerTokenDocument, useExtractCustomerErrors } from '@graphcommerce/magento-customer'
2
+ import {
3
+ CustomerTokenDocument,
4
+ useCustomerSession,
5
+ useExtractCustomerErrors,
6
+ } from '@graphcommerce/magento-customer'
3
7
  import { useEffect } from 'react'
4
8
  import { CustomerCartDocument } from './CustomerCart.gql'
5
9
  import { UseMergeCustomerCartDocument } from './UseMergeCustomerCart.gql'
@@ -18,9 +22,9 @@ export function useMergeCustomerCart() {
18
22
  const [merge, { error }] = useMutation(UseMergeCustomerCartDocument, { errorPolicy: 'all' })
19
23
 
20
24
  useExtractCustomerErrors({ error })
21
- const customerToken = useQuery(CustomerTokenDocument)?.data?.customerToken
25
+ const { loggedIn } = useCustomerSession()
22
26
  const destinationCartId = useQuery(CustomerCartDocument, {
23
- skip: !(customerToken?.token && customerToken.valid),
27
+ skip: !loggedIn,
24
28
  })?.data?.customerCart.id
25
29
 
26
30
  useEffect(() => {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.2.14",
5
+ "version": "4.2.15",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -18,15 +18,15 @@
18
18
  "@playwright/test": "^1.21.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/ecommerce-ui": "1.0.11",
21
+ "@graphcommerce/ecommerce-ui": "1.0.12",
22
22
  "@graphcommerce/framer-next-pages": "3.2.1",
23
- "@graphcommerce/framer-scroller": "2.1.10",
23
+ "@graphcommerce/framer-scroller": "2.1.11",
24
24
  "@graphcommerce/graphql": "3.1.3",
25
25
  "@graphcommerce/image": "3.1.5",
26
- "@graphcommerce/magento-customer": "4.2.12",
26
+ "@graphcommerce/magento-customer": "4.3.0",
27
27
  "@graphcommerce/magento-graphql": "3.0.12",
28
- "@graphcommerce/magento-store": "4.2.3",
29
- "@graphcommerce/next-ui": "4.7.2",
28
+ "@graphcommerce/magento-store": "4.2.4",
29
+ "@graphcommerce/next-ui": "4.8.0",
30
30
  "@graphcommerce/react-hook-form": "3.1.3"
31
31
  },
32
32
  "peerDependencies": {