@graphcommerce/magento-cart 3.1.3 → 3.1.4
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
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.1.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.1.3...@graphcommerce/magento-cart@3.1.4) (2021-10-08)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* conditional hook in CartSummary ([780c5c1](https://github.com/ho-nl/m2-pwa/commit/780c5c140e03ea5f77ea9cf5409498ed853e772c))
|
|
12
|
+
* issue where the cart shippingMethod didn't have a value defined ([a1f27d1](https://github.com/ho-nl/m2-pwa/commit/a1f27d1bff01921ff2cf783394c2bb4a65285d17))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [3.1.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.1.2...@graphcommerce/magento-cart@3.1.3) (2021-10-07)
|
|
7
19
|
|
|
8
20
|
|
|
@@ -46,15 +46,14 @@ export default function CartSummary(props: CartSummaryProps) {
|
|
|
46
46
|
const { children, editable } = props
|
|
47
47
|
|
|
48
48
|
const { data } = useCartQuery(GetCartSummaryDocument, { allowUrl: true })
|
|
49
|
+
const { href: historyHref, onClick: historyOnClick } = useHistoryLink({
|
|
50
|
+
href: '/checkout',
|
|
51
|
+
})
|
|
49
52
|
|
|
50
53
|
if (!data?.cart) return null
|
|
51
54
|
|
|
52
55
|
const { email, shipping_addresses, billing_address } = data.cart
|
|
53
56
|
|
|
54
|
-
const { href: historyHref, onClick: historyOnClick } = useHistoryLink({
|
|
55
|
-
href: '/checkout',
|
|
56
|
-
})
|
|
57
|
-
|
|
58
57
|
return (
|
|
59
58
|
<div className={classes.root}>
|
|
60
59
|
<div className={classes.detailsContainer}>
|
|
@@ -65,9 +65,10 @@ export default function CartTotals(props: CartTotalsProps) {
|
|
|
65
65
|
const { containerMargin } = props
|
|
66
66
|
const { shipping_addresses, prices } = data.cart
|
|
67
67
|
const shippingMethod = shipping_addresses?.[0]?.selected_shipping_method
|
|
68
|
+
|
|
68
69
|
const shippingMethodPrices = shipping_addresses?.[0]?.available_shipping_methods?.find(
|
|
69
70
|
(avail) =>
|
|
70
|
-
(shippingMethod?.amount
|
|
71
|
+
(shippingMethod?.amount?.value ?? 0) > 0 &&
|
|
71
72
|
avail?.carrier_code === shippingMethod?.carrier_code &&
|
|
72
73
|
avail?.method_code === shippingMethod?.method_code,
|
|
73
74
|
)
|
|
@@ -1,54 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
SvgImage,
|
|
4
|
-
iconSadShoppingBag,
|
|
5
|
-
FullPageMessage,
|
|
6
|
-
} from '@graphcommerce/next-ui'
|
|
7
|
-
import { Button, makeStyles, Theme, Typography } from '@material-ui/core'
|
|
1
|
+
import { iconSadShoppingBag, FullPageMessage, SvgImageSimple } from '@graphcommerce/next-ui'
|
|
2
|
+
import { Button } from '@material-ui/core'
|
|
8
3
|
import Link from 'next/link'
|
|
9
4
|
import React from 'react'
|
|
10
5
|
|
|
11
|
-
const useStyles = makeStyles(
|
|
12
|
-
(theme: Theme) => ({
|
|
13
|
-
root: {
|
|
14
|
-
textAlign: 'center',
|
|
15
|
-
display: 'flex',
|
|
16
|
-
justifyContent: 'center',
|
|
17
|
-
alignItems: 'center',
|
|
18
|
-
[theme.breakpoints.down('sm')]: {
|
|
19
|
-
minHeight: '70vh',
|
|
20
|
-
},
|
|
21
|
-
[theme.breakpoints.up('md')]: {
|
|
22
|
-
minHeight: '60vh',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
img: {
|
|
26
|
-
display: 'block',
|
|
27
|
-
margin: `0 auto ${theme.spacings.xxs} auto`,
|
|
28
|
-
width: responsiveVal(120, 180),
|
|
29
|
-
height: responsiveVal(120, 180),
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
{ name: 'EmptyCart' },
|
|
33
|
-
)
|
|
34
|
-
|
|
35
6
|
type EmptyCartProps = { children?: React.ReactNode }
|
|
36
7
|
export default function EmptyCart(props: EmptyCartProps) {
|
|
37
8
|
const { children } = props
|
|
38
|
-
const classes = useStyles()
|
|
39
9
|
|
|
40
10
|
return (
|
|
41
11
|
<FullPageMessage
|
|
42
|
-
title=
|
|
43
|
-
icon={
|
|
44
|
-
<SvgImage
|
|
45
|
-
src={iconSadShoppingBag}
|
|
46
|
-
alt='Empty Cart'
|
|
47
|
-
className={classes.img}
|
|
48
|
-
loading='eager'
|
|
49
|
-
size='large'
|
|
50
|
-
/>
|
|
51
|
-
}
|
|
12
|
+
title='Your cart is empty'
|
|
13
|
+
icon={<SvgImageSimple src={iconSadShoppingBag} alt='Empty Cart' layout='fill' />}
|
|
52
14
|
button={
|
|
53
15
|
<Link href='/' passHref>
|
|
54
16
|
<Button variant='contained' color='primary' size='large'>
|
|
@@ -57,30 +19,7 @@ export default function EmptyCart(props: EmptyCartProps) {
|
|
|
57
19
|
</Link>
|
|
58
20
|
}
|
|
59
21
|
>
|
|
60
|
-
Discover our collection and add items to your basket
|
|
22
|
+
{children ?? <>Discover our collection and add items to your basket!</>}
|
|
61
23
|
</FullPageMessage>
|
|
62
24
|
)
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div className={classes.root}>
|
|
66
|
-
<div>
|
|
67
|
-
<SvgImage
|
|
68
|
-
src={iconSadShoppingBag}
|
|
69
|
-
alt='Empty Cart'
|
|
70
|
-
className={classes.img}
|
|
71
|
-
loading='eager'
|
|
72
|
-
size='large'
|
|
73
|
-
/>
|
|
74
|
-
|
|
75
|
-
{children ?? (
|
|
76
|
-
<>
|
|
77
|
-
<Typography variant='h3' gutterBottom component='h1'>
|
|
78
|
-
Your cart is empty
|
|
79
|
-
</Typography>
|
|
80
|
-
<Typography>Discover our collection and add items to your basket!</Typography>
|
|
81
|
-
</>
|
|
82
|
-
)}
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
)
|
|
86
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/magento-cart",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
6
6
|
"browserslist": [
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"@graphcommerce/framer-scroller": "^0.2.7",
|
|
25
25
|
"@graphcommerce/graphql": "^2.103.5",
|
|
26
26
|
"@graphcommerce/image": "^2.104.6",
|
|
27
|
-
"@graphcommerce/magento-customer": "^3.0.
|
|
27
|
+
"@graphcommerce/magento-customer": "^3.0.17",
|
|
28
28
|
"@graphcommerce/magento-graphql": "^2.103.5",
|
|
29
|
-
"@graphcommerce/magento-store": "^3.0.
|
|
30
|
-
"@graphcommerce/next-ui": "^3.1.
|
|
29
|
+
"@graphcommerce/magento-store": "^3.0.15",
|
|
30
|
+
"@graphcommerce/next-ui": "^3.1.7",
|
|
31
31
|
"@graphcommerce/react-hook-form": "^2.102.6",
|
|
32
32
|
"@graphql-typed-document-node/core": "^3.1.0",
|
|
33
33
|
"@material-ui/core": "^4.12.3",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"react": "^17.0.2",
|
|
39
39
|
"react-dom": "^17.0.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "7c6ad9b6fdf91e48b33013218d962ad15f931db8"
|
|
42
42
|
}
|