@graphcommerce/magento-cart 4.2.15 → 4.3.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.
- package/CHANGELOG.md +39 -0
- package/components/ApolloCartError/ApolloCartErrorAlert.tsx +5 -1
- package/components/ApolloCartError/ApolloCartErrorFullPage.tsx +6 -1
- package/components/ApolloCartError/ApolloCartErrorSnackbar.tsx +2 -1
- package/components/CartSummary/CartSummary.tsx +10 -8
- package/components/InlineAccount/InlineAccount.tsx +4 -7
- package/hooks/useMergeCustomerCart.ts +1 -5
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1485](https://github.com/graphcommerce-org/graphcommerce/pull/1485) [`d6262de71`](https://github.com/graphcommerce-org/graphcommerce/commit/d6262de71d2254a2b0b492e1a60f9e141767470e) Thanks [@paales](https://github.com/paales)! - move to useCustomerSession instead of using the tokenquery directly and fix ssr issues
|
|
8
|
+
|
|
9
|
+
* [#1483](https://github.com/graphcommerce-org/graphcommerce/pull/1483) [`e3005fe63`](https://github.com/graphcommerce-org/graphcommerce/commit/e3005fe6306093d47b08c6756c21c8175649e30b) Thanks [@FrankHarland](https://github.com/FrankHarland)! - actually apply sx prop on cartsummary
|
|
10
|
+
|
|
11
|
+
* Updated dependencies [[`d6262de71`](https://github.com/graphcommerce-org/graphcommerce/commit/d6262de71d2254a2b0b492e1a60f9e141767470e), [`c8c246b8a`](https://github.com/graphcommerce-org/graphcommerce/commit/c8c246b8aaab0621b68a2fca2a1c529a56fad962)]:
|
|
12
|
+
- @graphcommerce/magento-customer@4.4.0
|
|
13
|
+
- @graphcommerce/next-ui@4.8.2
|
|
14
|
+
- @graphcommerce/ecommerce-ui@1.0.14
|
|
15
|
+
- @graphcommerce/framer-scroller@2.1.13
|
|
16
|
+
- @graphcommerce/magento-store@4.2.6
|
|
17
|
+
|
|
18
|
+
## 4.3.1
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 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)]:
|
|
23
|
+
- @graphcommerce/next-ui@4.8.1
|
|
24
|
+
- @graphcommerce/framer-scroller@2.1.12
|
|
25
|
+
- @graphcommerce/framer-next-pages@3.2.2
|
|
26
|
+
- @graphcommerce/ecommerce-ui@1.0.13
|
|
27
|
+
- @graphcommerce/magento-customer@4.3.2
|
|
28
|
+
- @graphcommerce/magento-store@4.2.5
|
|
29
|
+
- @graphcommerce/image@3.1.6
|
|
30
|
+
|
|
31
|
+
## 4.3.0
|
|
32
|
+
|
|
33
|
+
### Minor Changes
|
|
34
|
+
|
|
35
|
+
- [#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
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- Updated dependencies [[`a12db31b9`](https://github.com/graphcommerce-org/graphcommerce/commit/a12db31b9db9d27d86f59c1bfe58a0879999b9d3)]:
|
|
40
|
+
- @graphcommerce/magento-customer@4.3.1
|
|
41
|
+
|
|
3
42
|
## 4.2.15
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
|
@@ -17,7 +17,11 @@ export function ApolloCartErrorAlert(props: ApolloCartErrorAlertProps) {
|
|
|
17
17
|
let action: JSX.Element | undefined
|
|
18
18
|
|
|
19
19
|
const [, noSuchEntity] = graphqlErrorByCategory({ category: 'graphql-no-such-entity', error })
|
|
20
|
-
action = noSuchEntity ?
|
|
20
|
+
action = noSuchEntity ? (
|
|
21
|
+
<Button onClick={clear}>
|
|
22
|
+
<Trans id='Reset Cart' />
|
|
23
|
+
</Button>
|
|
24
|
+
) : undefined
|
|
21
25
|
|
|
22
26
|
const [, authorizationError] = graphqlErrorByCategory({
|
|
23
27
|
category: 'graphql-authorization',
|
|
@@ -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 ?
|
|
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,6 +1,5 @@
|
|
|
1
1
|
import { useHistoryLink } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { SectionContainer, extendableComponent } from '@graphcommerce/next-ui'
|
|
3
|
-
import { i18n } from '@lingui/core'
|
|
4
3
|
import { Trans } from '@lingui/react'
|
|
5
4
|
import { Box, Link, SxProps, Theme, Typography } from '@mui/material'
|
|
6
5
|
import PageLink from 'next/link'
|
|
@@ -21,7 +20,7 @@ const parts = ['root', 'detailsContainer', 'sectionHeaderWrapper'] as const
|
|
|
21
20
|
const { classes } = extendableComponent<OwnerState, typeof compName, typeof parts>(compName, parts)
|
|
22
21
|
|
|
23
22
|
export function CartSummary(props: CartSummaryProps) {
|
|
24
|
-
const { children, editable } = props
|
|
23
|
+
const { children, editable, sx = [] } = props
|
|
25
24
|
|
|
26
25
|
const { data } = useCartQuery(GetCartSummaryDocument, { allowUrl: true })
|
|
27
26
|
const { href: historyHref, onClick: historyOnClick } = useHistoryLink({
|
|
@@ -35,12 +34,15 @@ export function CartSummary(props: CartSummaryProps) {
|
|
|
35
34
|
return (
|
|
36
35
|
<Box
|
|
37
36
|
className={classes.root}
|
|
38
|
-
sx={
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
sx={[
|
|
38
|
+
(theme) => ({
|
|
39
|
+
margin: `${theme.spacings.sm} 0`,
|
|
40
|
+
'& div:last-of-type': {
|
|
41
|
+
borderRadius: '0 0 4px 4px',
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
...(Array.isArray(sx) ? sx : [sx]),
|
|
45
|
+
]}
|
|
44
46
|
>
|
|
45
47
|
<Box
|
|
46
48
|
className={classes.detailsContainer}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
2
|
import {
|
|
3
3
|
SignUpFormInline,
|
|
4
|
-
CustomerTokenDocument,
|
|
5
4
|
IsEmailAvailableDocument,
|
|
5
|
+
useCustomerSession,
|
|
6
6
|
} from '@graphcommerce/magento-customer'
|
|
7
7
|
import { Button, FormRow, extendableComponent } from '@graphcommerce/next-ui'
|
|
8
8
|
import { Trans } from '@lingui/react'
|
|
@@ -30,15 +30,12 @@ export function InlineAccount(props: InlineAccountProps) {
|
|
|
30
30
|
const { loading, data } = useCartQuery(InlineAccountDocument)
|
|
31
31
|
const cart = data?.cart
|
|
32
32
|
|
|
33
|
-
const {
|
|
33
|
+
const { loggedIn } = useCustomerSession()
|
|
34
34
|
const { data: isEmailAvailableData } = useQuery(IsEmailAvailableDocument, {
|
|
35
35
|
variables: { email: cart?.email ?? '' },
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
const { firstname, lastname } = cart?.shipping_addresses?.[0] ?? {}
|
|
39
|
-
const signedIn = Boolean(
|
|
40
|
-
customerTokenData?.customerToken && customerTokenData?.customerToken.valid,
|
|
41
|
-
)
|
|
42
39
|
const canSignUp = isEmailAvailableData?.isEmailAvailable?.is_email_available === true
|
|
43
40
|
|
|
44
41
|
if (!canSignUp) return null
|
|
@@ -56,7 +53,7 @@ export function InlineAccount(props: InlineAccountProps) {
|
|
|
56
53
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
57
54
|
]}
|
|
58
55
|
>
|
|
59
|
-
{!
|
|
56
|
+
{!loggedIn && canSignUp && (
|
|
60
57
|
<>
|
|
61
58
|
<Box
|
|
62
59
|
className={classes.innerContainer}
|
|
@@ -118,7 +115,7 @@ export function InlineAccount(props: InlineAccountProps) {
|
|
|
118
115
|
</>
|
|
119
116
|
)}
|
|
120
117
|
|
|
121
|
-
{
|
|
118
|
+
{loggedIn && (
|
|
122
119
|
<Box className={classes.innerContainer}>
|
|
123
120
|
<div>
|
|
124
121
|
<Typography variant='h4' className={classes.title}>
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { useMutation, useQuery } from '@graphcommerce/graphql'
|
|
2
|
-
import {
|
|
3
|
-
CustomerTokenDocument,
|
|
4
|
-
useCustomerSession,
|
|
5
|
-
useExtractCustomerErrors,
|
|
6
|
-
} from '@graphcommerce/magento-customer'
|
|
2
|
+
import { useCustomerSession, useExtractCustomerErrors } from '@graphcommerce/magento-customer'
|
|
7
3
|
import { useEffect } from 'react'
|
|
8
4
|
import { CustomerCartDocument } from './CustomerCart.gql'
|
|
9
5
|
import { UseMergeCustomerCartDocument } from './UseMergeCustomerCart.gql'
|
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
|
|
5
|
+
"version": "4.3.2",
|
|
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.
|
|
22
|
-
"@graphcommerce/framer-next-pages": "3.2.
|
|
23
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "1.0.14",
|
|
22
|
+
"@graphcommerce/framer-next-pages": "3.2.2",
|
|
23
|
+
"@graphcommerce/framer-scroller": "2.1.13",
|
|
24
24
|
"@graphcommerce/graphql": "3.1.3",
|
|
25
|
-
"@graphcommerce/image": "3.1.
|
|
26
|
-
"@graphcommerce/magento-customer": "4.
|
|
25
|
+
"@graphcommerce/image": "3.1.6",
|
|
26
|
+
"@graphcommerce/magento-customer": "4.4.0",
|
|
27
27
|
"@graphcommerce/magento-graphql": "3.0.12",
|
|
28
|
-
"@graphcommerce/magento-store": "4.2.
|
|
29
|
-
"@graphcommerce/next-ui": "4.8.
|
|
28
|
+
"@graphcommerce/magento-store": "4.2.6",
|
|
29
|
+
"@graphcommerce/next-ui": "4.8.2",
|
|
30
30
|
"@graphcommerce/react-hook-form": "3.1.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|