@graphcommerce/magento-cart 3.7.3 → 3.8.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 +38 -0
- package/components/ApolloCartError/ApolloCartErrorAlert.tsx +1 -1
- package/components/CartAgreementsForm/CartAgreementsForm.tsx +5 -5
- package/components/CartFab/CartFab.tsx +20 -2
- package/components/CartItemSummary/index.tsx +3 -3
- package/components/CartSummary/index.tsx +1 -1
- package/components/CartTotals/CartTotals.tsx +2 -2
- package/components/InlineAccount/index.tsx +2 -4
- package/hooks/useCartQuery.ts +2 -2
- package/hooks/useDisplayInclTax.ts +2 -2
- package/hooks/useMergeCustomerCart.ts +0 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,44 @@
|
|
|
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.8.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.8.1...@graphcommerce/magento-cart@3.8.2) (2021-12-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* spacing of LayoutTItle ([7afcd31](https://github.com/ho-nl/m2-pwa/commit/7afcd3163d16e902cf2ff7917f56ee6a8798f55b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.8.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.7.4...@graphcommerce/magento-cart@3.8.0) (2021-12-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* borderRadius ([0999901](https://github.com/ho-nl/m2-pwa/commit/0999901f6a3265f40fef18e72702d80158d8c4a9))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* borderRadius based on theme.shape.borderRadius ([7c34937](https://github.com/ho-nl/m2-pwa/commit/7c349376cd41a131c628324c299106fdb7e60484))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## [3.7.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.7.3...@graphcommerce/magento-cart@3.7.4) (2021-11-27)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* shadows ([8f43f33](https://github.com/ho-nl/m2-pwa/commit/8f43f33190e429e8abea8eddc0646ffd670f2ce8))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
6
44
|
## [3.7.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-cart@3.7.0...@graphcommerce/magento-cart@3.7.1) (2021-11-12)
|
|
7
45
|
|
|
8
46
|
|
|
@@ -2,9 +2,9 @@ import { useQuery } from '@apollo/client'
|
|
|
2
2
|
import { CustomerTokenDocument } from '@graphcommerce/magento-customer'
|
|
3
3
|
import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
|
|
4
4
|
import { ApolloErrorAlert, ApolloErrorAlertProps, Button } from '@graphcommerce/next-ui'
|
|
5
|
+
import { t } from '@lingui/macro'
|
|
5
6
|
import Link from 'next/link'
|
|
6
7
|
import React from 'react'
|
|
7
|
-
import { t } from '@lingui/macro'
|
|
8
8
|
import { useClearCurrentCartId } from '../../hooks/useClearCurrentCartId'
|
|
9
9
|
|
|
10
10
|
export type ApolloCartErrorAlertProps = ApolloErrorAlertProps
|
|
@@ -51,9 +51,9 @@ export default function CartAgreementsForm(props: CartAgreementsFormProps) {
|
|
|
51
51
|
|
|
52
52
|
// sort conditions so checkboxes will be placed first
|
|
53
53
|
const sortedAgreements = data?.checkoutAgreements
|
|
54
|
-
? [...data.checkoutAgreements].sort((a, b) =>
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
? [...data.checkoutAgreements].sort((a, b) =>
|
|
55
|
+
a?.mode === 'MANUAL' ? -1 : b?.mode === 'MANUAL' ? 1 : 0,
|
|
56
|
+
)
|
|
57
57
|
: []
|
|
58
58
|
|
|
59
59
|
const form = useForm({ mode: 'onChange' })
|
|
@@ -78,7 +78,7 @@ export default function CartAgreementsForm(props: CartAgreementsFormProps) {
|
|
|
78
78
|
<React.Fragment key={agreement.agreement_id}>
|
|
79
79
|
{agreement.mode === 'MANUAL' ? (
|
|
80
80
|
<Controller
|
|
81
|
-
defaultValue=
|
|
81
|
+
defaultValue=''
|
|
82
82
|
name={String(agreement.agreement_id)}
|
|
83
83
|
control={control}
|
|
84
84
|
rules={{ required: t`You have to agree in order to proceed` }}
|
|
@@ -91,7 +91,7 @@ export default function CartAgreementsForm(props: CartAgreementsFormProps) {
|
|
|
91
91
|
classes={{ root: classes.formControlRoot }}
|
|
92
92
|
>
|
|
93
93
|
<FormControlLabel
|
|
94
|
-
control={<Checkbox color='secondary' required
|
|
94
|
+
control={<Checkbox color='secondary' required />}
|
|
95
95
|
label={
|
|
96
96
|
<PageLink href={href} passHref>
|
|
97
97
|
<Link color='secondary'>{agreement.checkbox_text}</Link>
|
|
@@ -26,6 +26,18 @@ const useStyles = makeStyles(
|
|
|
26
26
|
height: responsiveVal(42, 56),
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
+
fabWrapper: {
|
|
30
|
+
position: 'relative',
|
|
31
|
+
},
|
|
32
|
+
shadow: {
|
|
33
|
+
pointerEvents: 'none',
|
|
34
|
+
borderRadius: '99em',
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
height: '100%',
|
|
37
|
+
width: '100%',
|
|
38
|
+
boxShadow: theme.shadows[6],
|
|
39
|
+
top: 0,
|
|
40
|
+
},
|
|
29
41
|
}),
|
|
30
42
|
{
|
|
31
43
|
name: 'CartFab',
|
|
@@ -42,7 +54,7 @@ type CartFabContentProps = CartFabProps & CartTotalQuantityFragment
|
|
|
42
54
|
function CartFabContent(props: CartFabContentProps) {
|
|
43
55
|
const { total_quantity, icon, ...fabProps } = props
|
|
44
56
|
const cartIcon = icon ?? <SvgImageSimple src={iconShoppingBag} loading='eager' size='large' />
|
|
45
|
-
const {
|
|
57
|
+
const { opacity, backgroundColor } = useFixedFabAnimation()
|
|
46
58
|
const theme = useTheme()
|
|
47
59
|
const isMobile = useMediaQuery(theme.breakpoints.down('sm'))
|
|
48
60
|
const classes = useStyles(props)
|
|
@@ -50,11 +62,11 @@ function CartFabContent(props: CartFabContentProps) {
|
|
|
50
62
|
return (
|
|
51
63
|
<m.div
|
|
52
64
|
style={{
|
|
53
|
-
boxShadow: isMobile ? undefined : boxShadow,
|
|
54
65
|
backgroundColor: isMobile ? undefined : backgroundColor,
|
|
55
66
|
width: 'inherit',
|
|
56
67
|
borderRadius: 'inherit',
|
|
57
68
|
}}
|
|
69
|
+
className={classes.fabWrapper}
|
|
58
70
|
>
|
|
59
71
|
<PageLink href='/cart' passHref>
|
|
60
72
|
<Fab
|
|
@@ -73,6 +85,12 @@ function CartFabContent(props: CartFabContentProps) {
|
|
|
73
85
|
)}
|
|
74
86
|
</Fab>
|
|
75
87
|
</PageLink>
|
|
88
|
+
<m.div
|
|
89
|
+
className={classes.shadow}
|
|
90
|
+
style={{
|
|
91
|
+
opacity: isMobile ? undefined : opacity,
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
76
94
|
</m.div>
|
|
77
95
|
)
|
|
78
96
|
}
|
|
@@ -32,8 +32,8 @@ const useStyles = makeStyles(
|
|
|
32
32
|
image: {
|
|
33
33
|
borderRadius: '50%',
|
|
34
34
|
marginRight: theme.spacings.xs,
|
|
35
|
-
border: `
|
|
36
|
-
|
|
35
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
36
|
+
padding: responsiveVal(5, 10),
|
|
37
37
|
width: `${responsiveVal(48, 96)} !important`,
|
|
38
38
|
height: `${responsiveVal(48, 96)} !important`,
|
|
39
39
|
display: 'block',
|
|
@@ -77,7 +77,7 @@ export default function CartItemSummary(props: OrderSummaryProps) {
|
|
|
77
77
|
|
|
78
78
|
if (!data?.cart) return null
|
|
79
79
|
|
|
80
|
-
const
|
|
80
|
+
const items = data?.cart.items
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
83
|
<div className={classes.root}>
|
|
@@ -20,7 +20,7 @@ const useStyles = makeStyles(
|
|
|
20
20
|
borderRadius: '4px 4px 0 0',
|
|
21
21
|
background: theme.palette.type === 'light' ? '#FFE10820' : theme.palette.background.paper,
|
|
22
22
|
padding: theme.spacings.sm,
|
|
23
|
-
gridColumnGap: theme.spacings.
|
|
23
|
+
gridColumnGap: theme.spacings.xxl,
|
|
24
24
|
gridRowGap: theme.spacings.sm,
|
|
25
25
|
display: `grid`,
|
|
26
26
|
[theme.breakpoints.up('sm')]: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Money } from '@graphcommerce/magento-store'
|
|
2
|
-
import { AnimatedRow, UseStyles } from '@graphcommerce/next-ui'
|
|
2
|
+
import { AnimatedRow, responsiveVal, UseStyles } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Trans } from '@lingui/macro'
|
|
4
4
|
import { Divider, makeStyles, Theme } from '@material-ui/core'
|
|
5
5
|
import clsx from 'clsx'
|
|
@@ -11,7 +11,7 @@ import { GetCartTotalsDocument } from './GetCartTotals.gql'
|
|
|
11
11
|
const useStyles = makeStyles(
|
|
12
12
|
(theme: Theme) => ({
|
|
13
13
|
costsContainer: {
|
|
14
|
-
borderRadius: 4,
|
|
14
|
+
borderRadius: responsiveVal(theme.shape.borderRadius * 3, theme.shape.borderRadius * 4),
|
|
15
15
|
background: theme.palette.type === 'light' ? '#FFE10820' : theme.palette.background.paper,
|
|
16
16
|
padding: `${theme.spacings.xs} ${theme.spacings.sm}`,
|
|
17
17
|
},
|
|
@@ -62,9 +62,7 @@ export default function InlineAccount(props: InlineAccountProps) {
|
|
|
62
62
|
|
|
63
63
|
const { data: customerTokenData } = useQuery(CustomerTokenDocument)
|
|
64
64
|
const { data: isEmailAvailableData } = useQuery(IsEmailAvailableDocument, {
|
|
65
|
-
variables: {
|
|
66
|
-
email: cart?.email ?? '',
|
|
67
|
-
},
|
|
65
|
+
variables: { email: cart?.email ?? '' },
|
|
68
66
|
})
|
|
69
67
|
|
|
70
68
|
const { firstname, lastname } = cart?.shipping_addresses?.[0] ?? {}
|
|
@@ -73,7 +71,7 @@ export default function InlineAccount(props: InlineAccountProps) {
|
|
|
73
71
|
)
|
|
74
72
|
const canSignUp = isEmailAvailableData?.isEmailAvailable?.is_email_available === true
|
|
75
73
|
|
|
76
|
-
if (!canSignUp) return
|
|
74
|
+
if (!canSignUp) return null
|
|
77
75
|
|
|
78
76
|
return (
|
|
79
77
|
<div>
|
package/hooks/useCartQuery.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQuery, TypedDocumentNode, QueryHookOptions } from '@apollo/client'
|
|
2
|
-
import {
|
|
2
|
+
import { usePageRouter } from '@graphcommerce/framer-next-pages'
|
|
3
3
|
import { useCurrentCartId } from './useCurrentCartId'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -18,7 +18,7 @@ export function useCartQuery<Q, V extends { cartId: string; [index: string]: unk
|
|
|
18
18
|
) {
|
|
19
19
|
const { allowUrl = false, ...queryOptions } = options
|
|
20
20
|
|
|
21
|
-
const router =
|
|
21
|
+
const router = usePageRouter()
|
|
22
22
|
const currentCartId = useCurrentCartId()
|
|
23
23
|
const urlCartId = router.query.cartId
|
|
24
24
|
const usingUrl = allowUrl && typeof urlCartId === 'string'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePageRouter } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
|
|
3
3
|
export function useDisplayInclTax(): boolean {
|
|
4
|
-
const { locale } =
|
|
4
|
+
const { locale } = usePageRouter()
|
|
5
5
|
const locales = (process.env.NEXT_PUBLIC_DISPLAY_INCL_TAX ?? '').split(',').map((i) => i.trim())
|
|
6
6
|
return locale ? locales.includes(locale) : false
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useMutation, useQuery } from '@apollo/client'
|
|
2
2
|
import { CustomerTokenDocument, useExtractCustomerErrors } from '@graphcommerce/magento-customer'
|
|
3
|
-
import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
|
|
4
3
|
import { useEffect } from 'react'
|
|
5
4
|
import { CustomerCartDocument } from './CustomerCart.gql'
|
|
6
5
|
import { UseMergeCustomerCartDocument } from './UseMergeCustomerCart.gql'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/magento-cart",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
6
6
|
"browserslist": [
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@graphcommerce/browserslist-config-pwa": "^3.0.2",
|
|
17
|
-
"@graphcommerce/eslint-config-pwa": "^3.1.
|
|
17
|
+
"@graphcommerce/eslint-config-pwa": "^3.1.6",
|
|
18
18
|
"@graphcommerce/prettier-config-pwa": "^3.0.4",
|
|
19
19
|
"@graphcommerce/typescript-config-pwa": "^3.1.1",
|
|
20
20
|
"@playwright/test": "^1.16.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@apollo/client": "^3.4.16",
|
|
24
|
-
"@graphcommerce/framer-next-pages": "^2.
|
|
25
|
-
"@graphcommerce/framer-scroller": "^1.0
|
|
26
|
-
"@graphcommerce/graphql": "^2.105.
|
|
27
|
-
"@graphcommerce/image": "^2.105.
|
|
28
|
-
"@graphcommerce/magento-customer": "^3.6.
|
|
29
|
-
"@graphcommerce/magento-graphql": "^2.104.
|
|
30
|
-
"@graphcommerce/magento-store": "^3.3.
|
|
31
|
-
"@graphcommerce/next-ui": "^3.
|
|
32
|
-
"@graphcommerce/react-hook-form": "^2.104.
|
|
24
|
+
"@graphcommerce/framer-next-pages": "^2.108.0",
|
|
25
|
+
"@graphcommerce/framer-scroller": "^1.1.0",
|
|
26
|
+
"@graphcommerce/graphql": "^2.105.6",
|
|
27
|
+
"@graphcommerce/image": "^2.105.5",
|
|
28
|
+
"@graphcommerce/magento-customer": "^3.6.7",
|
|
29
|
+
"@graphcommerce/magento-graphql": "^2.104.6",
|
|
30
|
+
"@graphcommerce/magento-store": "^3.3.7",
|
|
31
|
+
"@graphcommerce/next-ui": "^3.20.0",
|
|
32
|
+
"@graphcommerce/react-hook-form": "^2.104.1",
|
|
33
33
|
"@lingui/macro": "^3.12.1",
|
|
34
34
|
"@material-ui/core": "^4.12.3",
|
|
35
35
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"react": "^17.0.2",
|
|
40
40
|
"react-dom": "^17.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "8f156415c7f5a963e363f0d6d18fe5d6bbd5dba2"
|
|
43
43
|
}
|