@graphcommerce/magento-cart-shipping-address 3.0.21 → 3.0.22
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,15 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`d6262de71`](https://github.com/graphcommerce-org/graphcommerce/commit/d6262de71d2254a2b0b492e1a60f9e141767470e), [`c8c246b8a`](https://github.com/graphcommerce-org/graphcommerce/commit/c8c246b8aaab0621b68a2fca2a1c529a56fad962), [`e3005fe63`](https://github.com/graphcommerce-org/graphcommerce/commit/e3005fe6306093d47b08c6756c21c8175649e30b)]:
|
|
8
|
+
- @graphcommerce/magento-customer@4.4.0
|
|
9
|
+
- @graphcommerce/magento-cart@4.3.2
|
|
10
|
+
- @graphcommerce/next-ui@4.8.2
|
|
11
|
+
- @graphcommerce/magento-store@4.2.6
|
|
12
|
+
|
|
3
13
|
## 3.0.21
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -6,6 +6,10 @@ import {
|
|
|
6
6
|
} from '@graphcommerce/magento-cart'
|
|
7
7
|
import { CustomerDocument } from '@graphcommerce/magento-customer'
|
|
8
8
|
import { iconHome, IconSvg, ActionCardList, ActionCard, Form, Button } from '@graphcommerce/next-ui'
|
|
9
|
+
import {
|
|
10
|
+
ActionCardItem,
|
|
11
|
+
ActionCardListForm,
|
|
12
|
+
} from '@graphcommerce/next-ui/ActionCard/ActionCardListForm'
|
|
9
13
|
import {
|
|
10
14
|
useFormPersist,
|
|
11
15
|
useFormCompose,
|
|
@@ -15,10 +19,9 @@ import {
|
|
|
15
19
|
import { Trans } from '@lingui/react'
|
|
16
20
|
import { Box, FormControl, NoSsr } from '@mui/material'
|
|
17
21
|
import { useRouter } from 'next/router'
|
|
18
|
-
import React from 'react'
|
|
22
|
+
import React, { useMemo } from 'react'
|
|
19
23
|
import { isSameAddress } from '../../utils/isSameAddress'
|
|
20
24
|
import { GetAddressesDocument } from '../ShippingAddressForm/GetAddresses.gql'
|
|
21
|
-
import { SetCustomerBillingAddressOnCartDocument } from './SetCustomerBillingAddressOnCart.gql'
|
|
22
25
|
import { SetCustomerShippingAddressOnCartDocument } from './SetCustomerShippingAddressOnCart.gql'
|
|
23
26
|
import { SetCustomerShippingBillingAddressOnCartDocument } from './SetCustomerShippingBillingAddressOnCart.gql'
|
|
24
27
|
|
|
@@ -28,7 +31,7 @@ export function CustomerAddressForm(props: CustomerAddressListProps) {
|
|
|
28
31
|
const customerAddresses = useQuery(CustomerDocument)
|
|
29
32
|
const addresses = customerAddresses.data?.customer?.addresses
|
|
30
33
|
const { step, children } = props
|
|
31
|
-
const
|
|
34
|
+
const { push } = useRouter()
|
|
32
35
|
|
|
33
36
|
const { data: cartQuery } = useCartQuery(GetAddressesDocument)
|
|
34
37
|
|
|
@@ -58,10 +61,7 @@ export function CustomerAddressForm(props: CustomerAddressListProps) {
|
|
|
58
61
|
// Mutation = SetCustomerBillingAddressOnCartDocument
|
|
59
62
|
// }
|
|
60
63
|
|
|
61
|
-
const form = useFormGqlMutationCart(Mutation, {
|
|
62
|
-
// defaultValues: { customerAddressId: defaultCustomerAddressId },
|
|
63
|
-
mode: 'onChange',
|
|
64
|
-
})
|
|
64
|
+
const form = useFormGqlMutationCart(Mutation, { mode: 'onChange' })
|
|
65
65
|
const { handleSubmit, error, control, watch } = form
|
|
66
66
|
|
|
67
67
|
// If customer selects 'new address' then we do not have to submit anything so we provide an empty submit function.
|
|
@@ -76,113 +76,44 @@ export function CustomerAddressForm(props: CustomerAddressListProps) {
|
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<>
|
|
79
|
-
{' '}
|
|
80
79
|
<Form onSubmit={submit} noValidate>
|
|
81
80
|
<FormControl>
|
|
82
|
-
<
|
|
81
|
+
<ActionCardListForm
|
|
83
82
|
control={control}
|
|
84
|
-
defaultValue={found && found.id ? found.id : 0}
|
|
85
83
|
name='customerAddressId'
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
variant='text'
|
|
120
|
-
onClick={(e) => {
|
|
121
|
-
e.stopPropagation()
|
|
122
|
-
|
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
124
|
-
router.push(
|
|
125
|
-
`/checkout/customer/addresses/edit?addressId=${address?.id}`,
|
|
126
|
-
)
|
|
127
|
-
}}
|
|
128
|
-
>
|
|
129
|
-
<Trans id='Edit address' />
|
|
130
|
-
</Button>
|
|
131
|
-
}
|
|
132
|
-
selected={value === address?.id}
|
|
133
|
-
hidden={!!value && value !== address?.id}
|
|
134
|
-
reset={
|
|
135
|
-
<Button
|
|
136
|
-
disableRipple
|
|
137
|
-
variant='text'
|
|
138
|
-
color='secondary'
|
|
139
|
-
onClick={(e) => {
|
|
140
|
-
e.preventDefault()
|
|
141
|
-
onChange(null)
|
|
142
|
-
}}
|
|
143
|
-
>
|
|
144
|
-
<Trans id='Change' />
|
|
145
|
-
</Button>
|
|
146
|
-
}
|
|
147
|
-
/>
|
|
148
|
-
))}
|
|
149
|
-
<ActionCard
|
|
150
|
-
value='-1'
|
|
151
|
-
key='new-address'
|
|
152
|
-
title={<Trans id='New address' />}
|
|
153
|
-
selected={value === -1}
|
|
154
|
-
hidden={!!value && value !== -1}
|
|
155
|
-
details={<Trans id='Add new address' />}
|
|
156
|
-
image={<IconSvg src={iconHome} size='large' />}
|
|
157
|
-
action={
|
|
158
|
-
<Button
|
|
159
|
-
disableRipple
|
|
160
|
-
variant='text'
|
|
161
|
-
color='secondary'
|
|
162
|
-
onClick={(e) => {
|
|
163
|
-
e.preventDefault()
|
|
164
|
-
}}
|
|
165
|
-
>
|
|
166
|
-
<Trans id='Select' />
|
|
167
|
-
</Button>
|
|
168
|
-
}
|
|
169
|
-
reset={
|
|
170
|
-
<Button
|
|
171
|
-
disableRipple
|
|
172
|
-
variant='text'
|
|
173
|
-
color='secondary'
|
|
174
|
-
onClick={(e) => {
|
|
175
|
-
e.preventDefault()
|
|
176
|
-
onChange(null)
|
|
177
|
-
}}
|
|
178
|
-
>
|
|
179
|
-
<Trans id='Change' />
|
|
180
|
-
</Button>
|
|
181
|
-
}
|
|
182
|
-
/>
|
|
183
|
-
</ActionCardList>
|
|
184
|
-
</NoSsr>
|
|
185
|
-
)}
|
|
84
|
+
items={[
|
|
85
|
+
...(addresses ?? []).map((address) => ({
|
|
86
|
+
value: Number(address?.id),
|
|
87
|
+
title: `${address?.firstname} ${address?.lastname}`,
|
|
88
|
+
image: <IconSvg src={iconHome} size='large' />,
|
|
89
|
+
details: (
|
|
90
|
+
<Box>
|
|
91
|
+
{address?.street?.join(' ')}, {address?.postcode}, {address?.city},{' '}
|
|
92
|
+
{address?.country_code}
|
|
93
|
+
</Box>
|
|
94
|
+
),
|
|
95
|
+
secondaryAction: (
|
|
96
|
+
<Button
|
|
97
|
+
disableRipple
|
|
98
|
+
color='secondary'
|
|
99
|
+
variant='text'
|
|
100
|
+
onClick={(e) => {
|
|
101
|
+
e.stopPropagation()
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
103
|
+
push(`/checkout/customer/addresses/edit?addressId=${address?.id}`)
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<Trans id='Edit address' />
|
|
107
|
+
</Button>
|
|
108
|
+
),
|
|
109
|
+
})),
|
|
110
|
+
{
|
|
111
|
+
value: '-1',
|
|
112
|
+
title: <Trans id='New address' />,
|
|
113
|
+
details: <Trans id='Add new address' />,
|
|
114
|
+
image: <IconSvg src={iconHome} size='large' />,
|
|
115
|
+
},
|
|
116
|
+
]}
|
|
186
117
|
/>
|
|
187
118
|
</FormControl>
|
|
188
119
|
<ApolloCartErrorAlert error={error} />
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart-shipping-address",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.22",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@graphcommerce/graphql": "3.1.3",
|
|
22
22
|
"@graphcommerce/image": "3.1.6",
|
|
23
|
-
"@graphcommerce/magento-cart": "4.3.
|
|
24
|
-
"@graphcommerce/magento-customer": "4.
|
|
25
|
-
"@graphcommerce/magento-store": "4.2.
|
|
26
|
-
"@graphcommerce/next-ui": "4.8.
|
|
23
|
+
"@graphcommerce/magento-cart": "4.3.2",
|
|
24
|
+
"@graphcommerce/magento-customer": "4.4.0",
|
|
25
|
+
"@graphcommerce/magento-store": "4.2.6",
|
|
26
|
+
"@graphcommerce/next-ui": "4.8.2",
|
|
27
27
|
"@graphcommerce/react-hook-form": "3.1.3"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|