@graphcommerce/magento-cart 4.2.14 → 4.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`a9df81310`](https://github.com/graphcommerce-org/graphcommerce/commit/a9df81310c051876dd82fb2819105dece47cc213), [`55c2dcde7`](https://github.com/graphcommerce-org/graphcommerce/commit/55c2dcde7869ee51b84494af653b3edfd43904a4), [`597e2f413`](https://github.com/graphcommerce-org/graphcommerce/commit/597e2f413bdb5b76793b40ab631ce61390e26e81), [`f167f9963`](https://github.com/graphcommerce-org/graphcommerce/commit/f167f99630966a7de43717937d43669e66132494)]:
8
+ - @graphcommerce/next-ui@4.8.1
9
+ - @graphcommerce/framer-scroller@2.1.12
10
+ - @graphcommerce/framer-next-pages@3.2.2
11
+ - @graphcommerce/ecommerce-ui@1.0.13
12
+ - @graphcommerce/magento-customer@4.3.2
13
+ - @graphcommerce/magento-store@4.2.5
14
+ - @graphcommerce/image@3.1.6
15
+
16
+ ## 4.3.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#1472](https://github.com/graphcommerce-org/graphcommerce/pull/1472) [`cf575395c`](https://github.com/graphcommerce-org/graphcommerce/commit/cf575395c16e9c571f75d4563004c3018a29aeaa) Thanks [@mikekeehnen](https://github.com/mikekeehnen)! - Added translations to cart errors
21
+
22
+ ### Patch Changes
23
+
24
+ - Updated dependencies [[`a12db31b9`](https://github.com/graphcommerce-org/graphcommerce/commit/a12db31b9db9d27d86f59c1bfe58a0879999b9d3)]:
25
+ - @graphcommerce/magento-customer@4.3.1
26
+
27
+ ## 4.2.15
28
+
29
+ ### Patch Changes
30
+
31
+ - [#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.
32
+
33
+ - 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)]:
34
+ - @graphcommerce/next-ui@4.8.0
35
+ - @graphcommerce/magento-customer@4.3.0
36
+ - @graphcommerce/ecommerce-ui@1.0.12
37
+ - @graphcommerce/framer-scroller@2.1.11
38
+ - @graphcommerce/magento-store@4.2.4
39
+
3
40
  ## 4.2.14
4
41
 
5
42
  ### 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,17 +12,21 @@ 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
 
20
19
  const [, noSuchEntity] = graphqlErrorByCategory({ category: 'graphql-no-such-entity', error })
21
- action = noSuchEntity ? <Button onClick={clear}>Reset Cart</Button> : undefined
20
+ action = noSuchEntity ? (
21
+ <Button onClick={clear}>
22
+ <Trans id='Reset Cart' />
23
+ </Button>
24
+ ) : undefined
22
25
 
23
26
  const [, authorizationError] = graphqlErrorByCategory({
24
27
  category: 'graphql-authorization',
25
28
  error,
26
- mask: token?.token
29
+ mask: token
27
30
  ? i18n._(/* i18n */ `Please reauthenticate and try again`)
28
31
  : i18n._(/* i18n */ `You must sign in to continue`),
29
32
  })
@@ -1,6 +1,7 @@
1
1
  import { ApolloErrorFullPage, ApolloErrorFullPageProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
3
  import { iconSadFace, IconSvg } from '@graphcommerce/next-ui'
4
+ import { Trans } from '@lingui/react'
4
5
  import { Button } from '@mui/material'
5
6
  import { useClearCurrentCartId } from '../../hooks/useClearCurrentCartId'
6
7
 
@@ -11,7 +12,11 @@ export function ApolloCartErrorFullPage(props: ApolloCartErrorFullPageProps) {
11
12
  const clear = useClearCurrentCartId()
12
13
 
13
14
  const [, noSuchEntity] = graphqlErrorByCategory({ category: 'graphql-no-such-entity', error })
14
- const action = noSuchEntity ? <Button onClick={clear}>Reset Cart</Button> : undefined
15
+ const action = noSuchEntity ? (
16
+ <Button onClick={clear}>
17
+ <Trans id='Reset Cart' />
18
+ </Button>
19
+ ) : undefined
15
20
 
16
21
  return (
17
22
  <ApolloErrorFullPage
@@ -1,5 +1,6 @@
1
1
  import { ApolloErrorSnackbarProps, ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
+ import { Trans } from '@lingui/react'
3
4
  import { Button } from '@mui/material'
4
5
  import React from 'react'
5
6
  import { useClearCurrentCartId } from '../../hooks/useClearCurrentCartId'
@@ -13,7 +14,7 @@ export function ApolloCartErrorSnackbar(props: ApolloCartErrorSnackbarProps) {
13
14
  const [, noSuchEntity] = graphqlErrorByCategory({ category: 'graphql-no-such-entity', error })
14
15
  const action = noSuchEntity ? (
15
16
  <Button onClick={clear} variant='pill' color='secondary'>
16
- Reset Cart
17
+ <Trans id='Reset Cart' />
17
18
  </Button>
18
19
  ) : undefined
19
20
 
@@ -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.3.1",
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",
22
- "@graphcommerce/framer-next-pages": "3.2.1",
23
- "@graphcommerce/framer-scroller": "2.1.10",
21
+ "@graphcommerce/ecommerce-ui": "1.0.13",
22
+ "@graphcommerce/framer-next-pages": "3.2.2",
23
+ "@graphcommerce/framer-scroller": "2.1.12",
24
24
  "@graphcommerce/graphql": "3.1.3",
25
- "@graphcommerce/image": "3.1.5",
26
- "@graphcommerce/magento-customer": "4.2.12",
25
+ "@graphcommerce/image": "3.1.6",
26
+ "@graphcommerce/magento-customer": "4.3.2",
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.5",
29
+ "@graphcommerce/next-ui": "4.8.1",
30
30
  "@graphcommerce/react-hook-form": "3.1.3"
31
31
  },
32
32
  "peerDependencies": {