@graphcommerce/magento-customer 7.0.0-canary.13 → 7.0.0
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 +236 -2
- package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +4 -1
- package/components/AddressFields/AddressFields.tsx +1 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +0 -1
- package/components/ChangePasswordForm/ChangePasswordForm.tsx +44 -30
- package/components/CreateCustomerAddressForm/CreateCustomerAddress.graphql +2 -2
- package/components/CreateCustomerAddressForm/CreateCustomerAddressForm.tsx +2 -1
- package/components/CreateCustomerAddressForm/CustomerAddress.graphql +1 -0
- package/components/CustomerFab/CustomerFab.tsx +3 -0
- package/components/CustomerMenuFabItem/CustomerMenuFabItem.tsx +4 -2
- package/components/EditAddressForm/EditAddressForm.tsx +2 -0
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +1 -0
- package/components/NameFields/NameFields.tsx +2 -1
- package/components/OrderCard/OrderCard.tsx +1 -1
- package/components/OrderDetails/OrderDetails.tsx +6 -18
- package/components/ResetPasswordForm/ResetPasswordForm.tsx +5 -9
- package/components/SessionDebugger/SessionDebugger.tsx +2 -1
- package/components/SignInForm/SignInForm.tsx +9 -10
- package/components/SignInForm/SignInFormInline.tsx +17 -17
- package/components/SignUpForm/SignUpForm.tsx +14 -27
- package/components/SignUpForm/SignUpFormInline.tsx +39 -52
- package/components/TrackingLink/TrackingLink.tsx +14 -5
- package/components/UpdateCustomerEmailForm/UpdateCustomerEmailForm.tsx +28 -21
- package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +1 -0
- package/components/ValidatedPasswordElement/ValidatedPasswordElement.tsx +47 -0
- package/hooks/CustomerInfo.graphql +1 -0
- package/hooks/UseCustomerValidateToken.graphql +5 -0
- package/hooks/useCustomerValidateToken.ts +23 -0
- package/link/createCustomerTokenLink.ts +2 -7
- package/package.json +16 -15
- package/test/authentication.playwright.ts +1 -0
- package/link/onAuthenticationError.ts +0 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,242 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
## 7.0.0
|
|
3
|
+
## 7.0.0
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
|
|
8
|
+
|
|
9
|
+
- [#1926](https://github.com/graphcommerce-org/graphcommerce/pull/1926) [`ab8877fdb`](https://github.com/graphcommerce-org/graphcommerce/commit/ab8877fdb6147960ce656d28306d719e92f6de68) - Made the follow order link in the order card & order details a working `<Link />` if provided from magento backend. ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1916](https://github.com/graphcommerce-org/graphcommerce/pull/1916) [`97ebc19af`](https://github.com/graphcommerce-org/graphcommerce/commit/97ebc19aff093bf57d24d009e96661ad43926fd6) - The customer's token would be invalidated if any authorization error occured. Now only scoped to customer queries and mutations, potentially reducing the amount of random logouts. ([@paales](https://github.com/paales))
|
|
14
|
+
|
|
15
|
+
- [#1952](https://github.com/graphcommerce-org/graphcommerce/pull/1952) [`f1fe4f598`](https://github.com/graphcommerce-org/graphcommerce/commit/f1fe4f5986cee1f7c8313152e43691ed939c8f21) - Enable password fields when there is an error and user input correction is required. ([@carlocarels90](https://github.com/carlocarels90))
|
|
16
|
+
|
|
17
|
+
- [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`38d6c4888`](https://github.com/graphcommerce-org/graphcommerce/commit/38d6c488850013b36cae9f388996039219c1327e) - Errors in the cart didn't allow for recovery from the faulty state ([@paales](https://github.com/paales))
|
|
18
|
+
|
|
19
|
+
- [#1930](https://github.com/graphcommerce-org/graphcommerce/pull/1930) [`c8d023e9e`](https://github.com/graphcommerce-org/graphcommerce/commit/c8d023e9e874131cd9f8fe192b1fca5fe1a26ee3) - Fix the 'close menu' on search and add the option to secondary menu items ([@StefanAngenent](https://github.com/StefanAngenent))
|
|
20
|
+
|
|
21
|
+
- [#2006](https://github.com/graphcommerce-org/graphcommerce/pull/2006) [`80b60cb40`](https://github.com/graphcommerce-org/graphcommerce/commit/80b60cb404882260bd0e8184f3e54f4720925c96) - The Billing address was set to the shipping address when a default billing address was available and made prefix optional when creating an address ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
22
|
+
|
|
23
|
+
- [#1942](https://github.com/graphcommerce-org/graphcommerce/pull/1942) [`21b0d0c48`](https://github.com/graphcommerce-org/graphcommerce/commit/21b0d0c48603343c09f287978bf051140e9be912) - Customer's session is now revalidated when a previous session is detected on pageload, making sure the customer is still logged in. ([@paales](https://github.com/paales))
|
|
24
|
+
|
|
25
|
+
- [#1972](https://github.com/graphcommerce-org/graphcommerce/pull/1972) [`cda89820d`](https://github.com/graphcommerce-org/graphcommerce/commit/cda89820dc50e2019a26239b7450863d8c862bfb) - Ensure correct width for CircularProgress and fix misalignment in rotate animation ([@carlocarels90](https://github.com/carlocarels90))
|
|
26
|
+
|
|
27
|
+
- [#2016](https://github.com/graphcommerce-org/graphcommerce/pull/2016) [`227ddcee8`](https://github.com/graphcommerce-org/graphcommerce/commit/227ddcee8808715928371c1f3a4c7925032df0ef) - Made cardProps on CustomerAddressActionCards overridable. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
28
|
+
|
|
29
|
+
- [#1969](https://github.com/graphcommerce-org/graphcommerce/pull/1969) [`838322a97`](https://github.com/graphcommerce-org/graphcommerce/commit/838322a97c7ef1b8aa919196e756da381904bf04) - Fixing the Internal Server Error if the third address line is empty. ([@action-simon](https://github.com/action-simon))
|
|
30
|
+
|
|
31
|
+
## 6.2.0-canary.98
|
|
32
|
+
|
|
33
|
+
## 6.2.0-canary.97
|
|
34
|
+
|
|
35
|
+
## 6.2.0-canary.96
|
|
36
|
+
|
|
37
|
+
## 6.2.0-canary.95
|
|
38
|
+
|
|
39
|
+
## 6.2.0-canary.94
|
|
40
|
+
|
|
41
|
+
## 6.2.0-canary.93
|
|
42
|
+
|
|
43
|
+
## 6.2.0-canary.92
|
|
44
|
+
|
|
45
|
+
## 6.2.0-canary.91
|
|
46
|
+
|
|
47
|
+
## 6.2.0-canary.90
|
|
48
|
+
|
|
49
|
+
## 6.2.0-canary.89
|
|
50
|
+
|
|
51
|
+
## 6.2.0-canary.88
|
|
52
|
+
|
|
53
|
+
## 6.2.0-canary.87
|
|
54
|
+
|
|
55
|
+
## 6.2.0-canary.86
|
|
56
|
+
|
|
57
|
+
## 6.2.0-canary.85
|
|
58
|
+
|
|
59
|
+
## 6.2.0-canary.84
|
|
60
|
+
|
|
61
|
+
## 6.2.0-canary.83
|
|
62
|
+
|
|
63
|
+
## 6.2.0-canary.82
|
|
64
|
+
|
|
65
|
+
## 6.2.0-canary.81
|
|
66
|
+
|
|
67
|
+
## 6.2.0-canary.80
|
|
68
|
+
|
|
69
|
+
## 6.2.0-canary.79
|
|
70
|
+
|
|
71
|
+
## 6.2.0-canary.78
|
|
72
|
+
|
|
73
|
+
## 6.2.0-canary.77
|
|
74
|
+
|
|
75
|
+
## 6.2.0-canary.76
|
|
76
|
+
|
|
77
|
+
## 6.2.0-canary.75
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- [#2016](https://github.com/graphcommerce-org/graphcommerce/pull/2016) [`227ddcee8`](https://github.com/graphcommerce-org/graphcommerce/commit/227ddcee8808715928371c1f3a4c7925032df0ef) - Made cardProps on CustomerAddressActionCards overridable. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
82
|
+
|
|
83
|
+
## 6.2.0-canary.74
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- [#2006](https://github.com/graphcommerce-org/graphcommerce/pull/2006) [`80b60cb40`](https://github.com/graphcommerce-org/graphcommerce/commit/80b60cb404882260bd0e8184f3e54f4720925c96) - Bugfix for unintentionally overriding the billing address even if a default address was set. Also made prefix optional when creating an address ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
88
|
+
|
|
89
|
+
## 6.2.0-canary.73
|
|
90
|
+
|
|
91
|
+
## 6.2.0-canary.72
|
|
92
|
+
|
|
93
|
+
## 6.2.0-canary.71
|
|
94
|
+
|
|
95
|
+
## 6.2.0-canary.70
|
|
96
|
+
|
|
97
|
+
## 6.2.0-canary.69
|
|
98
|
+
|
|
99
|
+
## 6.2.0-canary.68
|
|
100
|
+
|
|
101
|
+
## 6.2.0-canary.67
|
|
102
|
+
|
|
103
|
+
## 6.2.0-canary.66
|
|
104
|
+
|
|
105
|
+
## 6.2.0-canary.65
|
|
106
|
+
|
|
107
|
+
## 6.2.0-canary.64
|
|
108
|
+
|
|
109
|
+
## 6.2.0-canary.63
|
|
110
|
+
|
|
111
|
+
## 6.2.0-canary.62
|
|
112
|
+
|
|
113
|
+
## 6.2.0-canary.61
|
|
114
|
+
|
|
115
|
+
## 6.2.0-canary.60
|
|
116
|
+
|
|
117
|
+
## 6.2.0-canary.59
|
|
118
|
+
|
|
119
|
+
## 6.2.0-canary.58
|
|
120
|
+
|
|
121
|
+
## 6.2.0-canary.57
|
|
122
|
+
|
|
123
|
+
## 6.2.0-canary.56
|
|
124
|
+
|
|
125
|
+
## 6.2.0-canary.55
|
|
126
|
+
|
|
127
|
+
## 6.2.0-canary.54
|
|
128
|
+
|
|
129
|
+
## 6.2.0-canary.53
|
|
130
|
+
|
|
131
|
+
## 6.2.0-canary.52
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- [#1972](https://github.com/graphcommerce-org/graphcommerce/pull/1972) [`cda89820d`](https://github.com/graphcommerce-org/graphcommerce/commit/cda89820dc50e2019a26239b7450863d8c862bfb) - Ensure correct width for CircularProgress and fix misalignment in rotate animation ([@carlocarels90](https://github.com/carlocarels90))
|
|
136
|
+
|
|
137
|
+
## 6.2.0-canary.51
|
|
138
|
+
|
|
139
|
+
## 6.2.0-canary.50
|
|
140
|
+
|
|
141
|
+
## 6.2.0-canary.49
|
|
142
|
+
|
|
143
|
+
## 6.2.0-canary.48
|
|
144
|
+
|
|
145
|
+
## 6.2.0-canary.47
|
|
146
|
+
|
|
147
|
+
### Patch Changes
|
|
148
|
+
|
|
149
|
+
- [#1969](https://github.com/graphcommerce-org/graphcommerce/pull/1969) [`838322a97`](https://github.com/graphcommerce-org/graphcommerce/commit/838322a97c7ef1b8aa919196e756da381904bf04) - Fixing the Internal Server Error if the third address line is empty. ([@action-simon](https://github.com/action-simon))
|
|
150
|
+
|
|
151
|
+
## 6.2.0-canary.46
|
|
152
|
+
|
|
153
|
+
## 6.2.0-canary.45
|
|
154
|
+
|
|
155
|
+
### Minor Changes
|
|
156
|
+
|
|
157
|
+
- [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
|
|
158
|
+
|
|
159
|
+
## 6.2.0-canary.44
|
|
160
|
+
|
|
161
|
+
## 6.2.0-canary.43
|
|
162
|
+
|
|
163
|
+
## 6.2.0-canary.42
|
|
164
|
+
|
|
165
|
+
## 6.2.0-canary.41
|
|
166
|
+
|
|
167
|
+
## 6.2.0-canary.40
|
|
168
|
+
|
|
169
|
+
## 6.2.0-canary.39
|
|
170
|
+
|
|
171
|
+
## 6.2.0-canary.38
|
|
172
|
+
|
|
173
|
+
## 6.2.0-canary.37
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- [#1952](https://github.com/graphcommerce-org/graphcommerce/pull/1952) [`f1fe4f598`](https://github.com/graphcommerce-org/graphcommerce/commit/f1fe4f5986cee1f7c8313152e43691ed939c8f21) - enable password fields when there is an error and user input correction is required. ([@carlocarels90](https://github.com/carlocarels90))
|
|
178
|
+
|
|
179
|
+
## 6.2.0-canary.36
|
|
180
|
+
|
|
181
|
+
## 6.2.0-canary.35
|
|
182
|
+
|
|
183
|
+
## 6.2.0-canary.34
|
|
184
|
+
|
|
185
|
+
## 6.2.0-canary.33
|
|
186
|
+
|
|
187
|
+
## 6.2.0-canary.32
|
|
188
|
+
|
|
189
|
+
## 6.2.0-canary.31
|
|
190
|
+
|
|
191
|
+
## 6.2.0-canary.30
|
|
192
|
+
|
|
193
|
+
### Patch Changes
|
|
194
|
+
|
|
195
|
+
- [#1942](https://github.com/graphcommerce-org/graphcommerce/pull/1942) [`21b0d0c48`](https://github.com/graphcommerce-org/graphcommerce/commit/21b0d0c48603343c09f287978bf051140e9be912) - Customer's session is now revalidated when a previous session is detected on pageload, making sure the customer is still logged in. ([@paales](https://github.com/paales))
|
|
196
|
+
|
|
197
|
+
## 6.2.0-canary.29
|
|
198
|
+
|
|
199
|
+
## 6.2.0-canary.28
|
|
200
|
+
|
|
201
|
+
## 6.2.0-canary.27
|
|
202
|
+
|
|
203
|
+
## 6.2.0-canary.26
|
|
204
|
+
|
|
205
|
+
## 6.2.0-canary.25
|
|
206
|
+
|
|
207
|
+
## 6.2.0-canary.24
|
|
208
|
+
|
|
209
|
+
## 6.2.0-canary.23
|
|
210
|
+
|
|
211
|
+
## 6.2.0-canary.22
|
|
212
|
+
|
|
213
|
+
## 6.2.0-canary.21
|
|
214
|
+
|
|
215
|
+
## 6.2.0-canary.20
|
|
216
|
+
|
|
217
|
+
## 6.2.0-canary.19
|
|
218
|
+
|
|
219
|
+
## 6.2.0-canary.18
|
|
220
|
+
|
|
221
|
+
## 6.2.0-canary.17
|
|
222
|
+
|
|
223
|
+
## 6.2.0-canary.16
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- [#1930](https://github.com/graphcommerce-org/graphcommerce/pull/1930) [`c8d023e9e`](https://github.com/graphcommerce-org/graphcommerce/commit/c8d023e9e874131cd9f8fe192b1fca5fe1a26ee3) - Fix the close menu on search and add the option to secondary menu items ([@StefanAngenent](https://github.com/StefanAngenent))
|
|
228
|
+
|
|
229
|
+
## 6.2.0-canary.15
|
|
230
|
+
|
|
231
|
+
### Minor Changes
|
|
232
|
+
|
|
233
|
+
- [#1926](https://github.com/graphcommerce-org/graphcommerce/pull/1926) [`ab8877fdb`](https://github.com/graphcommerce-org/graphcommerce/commit/ab8877fdb6147960ce656d28306d719e92f6de68) - Made the follow order link in the order card & order details a working <Link /> if provided from magento backend. ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
234
|
+
|
|
235
|
+
## 6.2.0-canary.14
|
|
236
|
+
|
|
237
|
+
## 6.2.0-canary.13
|
|
238
|
+
|
|
239
|
+
## 6.2.0-canary.12
|
|
6
240
|
|
|
7
241
|
## 6.2.0-canary.11
|
|
8
242
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from '@graphcommerce/next-ui'
|
|
9
9
|
import { emailPattern } from '@graphcommerce/react-hook-form'
|
|
10
10
|
import { Trans } from '@lingui/react'
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
11
12
|
import { Box, CircularProgress, Link, SxProps, TextField, Theme, Typography } from '@mui/material'
|
|
12
13
|
import router from 'next/router'
|
|
13
14
|
import { CustomerDocument, useFormIsEmailAvailable } from '../../hooks'
|
|
@@ -118,7 +119,9 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
|
|
|
118
119
|
pattern: { value: emailPattern, message: '' },
|
|
119
120
|
})}
|
|
120
121
|
InputProps={{
|
|
121
|
-
endAdornment: formState.isSubmitting &&
|
|
122
|
+
endAdornment: formState.isSubmitting && (
|
|
123
|
+
<CircularProgress sx={{ display: 'inline-flex' }} />
|
|
124
|
+
),
|
|
122
125
|
readOnly: !!customerQuery.data?.customer?.email,
|
|
123
126
|
}}
|
|
124
127
|
/>
|
|
@@ -21,8 +21,8 @@ export type AddressFieldValues = {
|
|
|
21
21
|
city?: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
24
|
export type AddressFieldsProps = {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
26
|
form: UseFormReturn<any>
|
|
27
27
|
readOnly?: boolean
|
|
28
28
|
countryFirst?: boolean
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ApolloErrorAlert, ApolloErrorAlertProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { Button } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Trans } from '@lingui/react'
|
|
4
|
-
import { Link } from '@mui/material'
|
|
5
4
|
import { useCustomerSession } from '../../hooks/useCustomerSession'
|
|
6
5
|
import { useAuthorizationErrorMasked } from './useAuthorizationErrorMasked'
|
|
7
6
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ApolloErrorSnackbar,
|
|
3
|
+
PasswordElement,
|
|
4
|
+
PasswordRepeatElement,
|
|
5
|
+
} from '@graphcommerce/ecommerce-ui'
|
|
6
|
+
import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
|
|
1
7
|
import {
|
|
2
8
|
Form,
|
|
3
9
|
FormActions,
|
|
@@ -7,10 +13,8 @@ import {
|
|
|
7
13
|
Button,
|
|
8
14
|
} from '@graphcommerce/next-ui'
|
|
9
15
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
10
|
-
import { i18n } from '@lingui/core'
|
|
11
16
|
import { Trans } from '@lingui/react'
|
|
12
|
-
import {
|
|
13
|
-
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
17
|
+
import { ValidatedPasswordElement } from '../ValidatedPasswordElement/ValidatedPasswordElement'
|
|
14
18
|
import {
|
|
15
19
|
ChangePasswordDocument,
|
|
16
20
|
ChangePasswordMutation,
|
|
@@ -21,55 +25,61 @@ export function ChangePasswordForm() {
|
|
|
21
25
|
const form = useFormGqlMutation<
|
|
22
26
|
ChangePasswordMutation,
|
|
23
27
|
ChangePasswordMutationVariables & { confirmPassword?: string }
|
|
24
|
-
>(ChangePasswordDocument)
|
|
25
|
-
const {
|
|
28
|
+
>(ChangePasswordDocument, {}, { errorPolicy: 'all' })
|
|
29
|
+
const { handleSubmit, required, formState, error, control } = form
|
|
30
|
+
const [remainingError0, authenticationError] = graphqlErrorByCategory({
|
|
31
|
+
category: 'graphql-authentication',
|
|
32
|
+
error,
|
|
33
|
+
})
|
|
34
|
+
const [remainingError, inputError] = graphqlErrorByCategory({
|
|
35
|
+
category: 'graphql-input',
|
|
36
|
+
error: remainingError0,
|
|
37
|
+
})
|
|
38
|
+
|
|
26
39
|
const submitHandler = handleSubmit(() => {})
|
|
27
|
-
|
|
40
|
+
|
|
41
|
+
const showSuccess = !formState.isSubmitting && formState.isSubmitSuccessful && !error?.message
|
|
28
42
|
|
|
29
43
|
return (
|
|
30
44
|
<Form onSubmit={submitHandler} noValidate>
|
|
31
45
|
<FormRow>
|
|
32
|
-
<
|
|
46
|
+
<PasswordElement
|
|
47
|
+
control={control}
|
|
48
|
+
name='currentPassword'
|
|
33
49
|
variant='outlined'
|
|
34
|
-
|
|
35
|
-
error={!!formState.errors.currentPassword}
|
|
50
|
+
autoComplete='current-password'
|
|
36
51
|
label={<Trans id='Current Password' />}
|
|
37
52
|
required={required.currentPassword}
|
|
38
|
-
{...muiRegister('currentPassword', { required: required.currentPassword })}
|
|
39
|
-
helperText={formState.errors.currentPassword?.message}
|
|
40
53
|
disabled={formState.isSubmitting}
|
|
54
|
+
error={Boolean(authenticationError)}
|
|
55
|
+
helperText={authenticationError?.message}
|
|
41
56
|
/>
|
|
42
57
|
</FormRow>
|
|
43
58
|
|
|
44
59
|
<FormRow>
|
|
45
|
-
<
|
|
60
|
+
<ValidatedPasswordElement
|
|
61
|
+
control={control}
|
|
62
|
+
name='newPassword'
|
|
46
63
|
variant='outlined'
|
|
47
|
-
|
|
48
|
-
error={!!formState.errors.newPassword}
|
|
64
|
+
autoComplete='new-password'
|
|
49
65
|
label={<Trans id='New password' />}
|
|
50
66
|
required={required.newPassword}
|
|
51
|
-
{...muiRegister('newPassword', { required: required.newPassword })}
|
|
52
|
-
helperText={formState.errors.newPassword?.message}
|
|
53
67
|
disabled={formState.isSubmitting}
|
|
68
|
+
error={Boolean(inputError)}
|
|
69
|
+
helperText={inputError?.message}
|
|
54
70
|
/>
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
<PasswordRepeatElement
|
|
72
|
+
control={control}
|
|
73
|
+
name='confirmPassword'
|
|
74
|
+
passwordFieldName='newPassword'
|
|
75
|
+
autoComplete='new-password'
|
|
57
76
|
variant='outlined'
|
|
58
|
-
type='password'
|
|
59
|
-
error={!!formState.errors.confirmPassword}
|
|
60
77
|
label={<Trans id='Confirm password' />}
|
|
61
78
|
required
|
|
62
|
-
{...muiRegister('confirmPassword', {
|
|
63
|
-
required: true,
|
|
64
|
-
validate: (value) => value === pass || i18n._(/* i18n */ "Passwords don't match"),
|
|
65
|
-
})}
|
|
66
|
-
helperText={formState.errors.confirmPassword?.message}
|
|
67
79
|
disabled={formState.isSubmitting}
|
|
68
80
|
/>
|
|
69
81
|
</FormRow>
|
|
70
82
|
|
|
71
|
-
<ApolloCustomerErrorAlert error={error} />
|
|
72
|
-
|
|
73
83
|
<FormDivider />
|
|
74
84
|
|
|
75
85
|
<FormActions>
|
|
@@ -84,9 +94,13 @@ export function ChangePasswordForm() {
|
|
|
84
94
|
</Button>
|
|
85
95
|
</FormActions>
|
|
86
96
|
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
<ApolloErrorSnackbar error={remainingError} />
|
|
98
|
+
|
|
99
|
+
{showSuccess && (
|
|
100
|
+
<MessageSnackbar open={showSuccess} sticky variant='pill'>
|
|
101
|
+
<Trans id='Successfully changed password' />
|
|
102
|
+
</MessageSnackbar>
|
|
103
|
+
)}
|
|
90
104
|
</Form>
|
|
91
105
|
)
|
|
92
106
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
mutation CreateCustomerAddress(
|
|
2
|
-
$prefix: String
|
|
2
|
+
$prefix: String
|
|
3
3
|
$firstname: String!
|
|
4
4
|
$middlename: String
|
|
5
5
|
$lastname: String!
|
|
@@ -7,7 +7,7 @@ mutation CreateCustomerAddress(
|
|
|
7
7
|
$telephone: String!
|
|
8
8
|
$street: String!
|
|
9
9
|
$houseNumber: String!
|
|
10
|
-
$addition: String
|
|
10
|
+
$addition: String = ""
|
|
11
11
|
$city: String!
|
|
12
12
|
$postcode: String!
|
|
13
13
|
$region: CustomerAddressRegionInput!
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
13
13
|
import { i18n } from '@lingui/core'
|
|
14
14
|
import { Trans } from '@lingui/react'
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
15
16
|
import { TextField } from '@mui/material'
|
|
16
17
|
import { useRouter } from 'next/router'
|
|
17
18
|
import { AddressFields } from '../AddressFields/AddressFields'
|
|
@@ -43,7 +44,7 @@ export function CreateCustomerAddressForm() {
|
|
|
43
44
|
{},
|
|
44
45
|
}
|
|
45
46
|
},
|
|
46
|
-
onComplete: (
|
|
47
|
+
onComplete: () => {
|
|
47
48
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
48
49
|
router.push(`/account/addresses`)
|
|
49
50
|
},
|
|
@@ -8,6 +8,7 @@ import { i18n } from '@lingui/core'
|
|
|
8
8
|
import { Fab, FabProps as FabPropsType, NoSsr, SxProps, Theme } from '@mui/material'
|
|
9
9
|
import React from 'react'
|
|
10
10
|
import { useCustomerSession, UseCustomerSessionReturn } from '../../hooks'
|
|
11
|
+
import { useCustomerValidateToken } from '../../hooks/useCustomerValidateToken'
|
|
11
12
|
|
|
12
13
|
type CustomerFabContentProps = {
|
|
13
14
|
icon?: React.ReactNode
|
|
@@ -53,6 +54,8 @@ export type CustomerFabProps = Omit<CustomerFabContentProps, 'session'>
|
|
|
53
54
|
export function CustomerFab(props: CustomerFabProps) {
|
|
54
55
|
const session = useCustomerSession()
|
|
55
56
|
|
|
57
|
+
useCustomerValidateToken()
|
|
58
|
+
|
|
56
59
|
return (
|
|
57
60
|
<NoSsr fallback={<CustomerFabContent {...props} />}>
|
|
58
61
|
<CustomerFabContent session={session} {...props} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MenuFabSecondaryItem, iconPerson, IconSvg } from '@graphcommerce/next-ui'
|
|
2
2
|
import { Badge, NoSsr, SxProps, Theme } from '@mui/material'
|
|
3
|
-
import React from 'react'
|
|
3
|
+
import React, { MouseEventHandler } from 'react'
|
|
4
4
|
import { useCustomerSession, UseCustomerSessionReturn } from '../../hooks/useCustomerSession'
|
|
5
5
|
|
|
6
6
|
type CustomerMenuFabItemProps = {
|
|
@@ -10,13 +10,15 @@ type CustomerMenuFabItemProps = {
|
|
|
10
10
|
guestHref: string
|
|
11
11
|
sx?: SxProps<Theme>
|
|
12
12
|
session?: UseCustomerSessionReturn
|
|
13
|
+
onClick?: MouseEventHandler<HTMLElement>
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
function CustomerMenuFabItemContent(props: CustomerMenuFabItemProps) {
|
|
16
|
-
const { session, icon, children, guestHref, authHref, sx = [] } = props
|
|
17
|
+
const { session, icon, children, onClick, guestHref, authHref, sx = [] } = props
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<MenuFabSecondaryItem
|
|
21
|
+
onClick={onClick}
|
|
20
22
|
sx={sx}
|
|
21
23
|
icon={
|
|
22
24
|
<Badge
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
1
2
|
import { useGo, usePageContext } from '@graphcommerce/framer-next-pages'
|
|
2
3
|
import { useQuery } from '@graphcommerce/graphql'
|
|
3
4
|
import { CountryRegionsDocument } from '@graphcommerce/magento-store'
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
13
14
|
import { i18n } from '@lingui/core'
|
|
14
15
|
import { Trans } from '@lingui/react'
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
15
17
|
import { SxProps, TextField, Theme } from '@mui/material'
|
|
16
18
|
import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
17
19
|
import { AddressFields } from '../AddressFields/AddressFields'
|
|
@@ -2,6 +2,7 @@ import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
|
2
2
|
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
3
3
|
import { i18n } from '@lingui/core'
|
|
4
4
|
import { Trans } from '@lingui/react'
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
5
6
|
import { TextField, Alert, SxProps, Theme } from '@mui/material'
|
|
6
7
|
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
8
|
import {
|
|
@@ -3,6 +3,7 @@ import { FormRow, InputCheckmark } from '@graphcommerce/next-ui'
|
|
|
3
3
|
import { assertFormGqlOperation, Controller, UseFormReturn } from '@graphcommerce/react-hook-form'
|
|
4
4
|
import { i18n } from '@lingui/core'
|
|
5
5
|
import { Trans } from '@lingui/react'
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
6
7
|
import { MenuItem, TextField } from '@mui/material'
|
|
7
8
|
import React from 'react'
|
|
8
9
|
|
|
@@ -28,7 +29,7 @@ export function NameFields(props: NameFieldProps) {
|
|
|
28
29
|
const { prefix, form, readOnly, prefixes = [mr, mrs, other] } = props
|
|
29
30
|
assertFormGqlOperation<NameFieldValues>(form)
|
|
30
31
|
|
|
31
|
-
const { control,
|
|
32
|
+
const { control, required, valid } = form
|
|
32
33
|
|
|
33
34
|
return (
|
|
34
35
|
<>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Money } from '@graphcommerce/magento-store'
|
|
2
2
|
import { extendableComponent, NextLink, useDateTimeFormat } from '@graphcommerce/next-ui'
|
|
3
|
+
import { Trans } from '@lingui/react'
|
|
3
4
|
import { Box, styled, SxProps, Theme, Skeleton, ListItemButton } from '@mui/material'
|
|
4
5
|
import { UseOrderCardItemImages } from '../../hooks/useOrderCardItemImages'
|
|
5
6
|
import { OrderCardItemImage } from '../OrderCardItemImage/OrderCardItemImage'
|
|
6
7
|
import { OrderStateLabel } from '../OrderStateLabel/OrderStateLabel'
|
|
7
8
|
import { TrackingLink } from '../TrackingLink/TrackingLink'
|
|
8
9
|
import { OrderCardFragment } from './OrderCard.gql'
|
|
9
|
-
import { Trans } from '@lingui/react'
|
|
10
10
|
|
|
11
11
|
type OrderCardProps = Partial<OrderCardFragment> & {
|
|
12
12
|
loading?: boolean
|
|
@@ -26,7 +26,6 @@ const parts = [
|
|
|
26
26
|
'totalsRow',
|
|
27
27
|
'totalsDivider',
|
|
28
28
|
'totalsVat',
|
|
29
|
-
'iconContainer',
|
|
30
29
|
'invoice',
|
|
31
30
|
] as const
|
|
32
31
|
const { classes } = extendableComponent(componentName, parts)
|
|
@@ -85,18 +84,11 @@ const TotalsVat = styled(TotalsRow, { target: classes.totalsVat })(({ theme }) =
|
|
|
85
84
|
padding: `${theme.spacings.xxs} 0`,
|
|
86
85
|
}),
|
|
87
86
|
)
|
|
88
|
-
const IconContainer = styled(TotalsRow, { target: classes.iconContainer })(({ theme }) =>
|
|
89
|
-
theme.unstable_sx({
|
|
90
|
-
marginLeft: '-6px',
|
|
91
|
-
'& > div': {
|
|
92
|
-
padding: '4px 0',
|
|
93
|
-
},
|
|
94
|
-
}),
|
|
95
|
-
)
|
|
96
87
|
|
|
97
88
|
const Invoice = styled(TotalsRow, { target: classes.invoice })(({ theme }) =>
|
|
98
89
|
theme.unstable_sx({
|
|
99
90
|
display: 'flex',
|
|
91
|
+
justifyContent: 'flex-start',
|
|
100
92
|
alignItems: 'center',
|
|
101
93
|
color: 'primary.main',
|
|
102
94
|
}),
|
|
@@ -248,9 +240,7 @@ export function OrderDetails(props: OrderDetailsProps) {
|
|
|
248
240
|
<>
|
|
249
241
|
<div>{shipments?.[0]?.tracking && shipments?.[0]?.tracking?.[0]?.title}</div>
|
|
250
242
|
{shipments?.[0]?.tracking?.[0] && (
|
|
251
|
-
<
|
|
252
|
-
<TrackingLink {...shipments?.[0].tracking?.[0]} />
|
|
253
|
-
</IconContainer>
|
|
243
|
+
<TrackingLink {...shipments?.[0].tracking?.[0]} sx={{ padding: '4px 0' }} />
|
|
254
244
|
)}
|
|
255
245
|
</>
|
|
256
246
|
)}
|
|
@@ -275,12 +265,10 @@ export function OrderDetails(props: OrderDetailsProps) {
|
|
|
275
265
|
<div>{payment_methods[0].name}</div>
|
|
276
266
|
|
|
277
267
|
{invoices && invoices?.length > 0 && (
|
|
278
|
-
<
|
|
279
|
-
<
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
</Invoice>
|
|
283
|
-
</IconContainer>
|
|
268
|
+
<Invoice>
|
|
269
|
+
<IconSvg src={iconInvoice} size='small' />
|
|
270
|
+
{invoices?.[0]?.number}
|
|
271
|
+
</Invoice>
|
|
284
272
|
)}
|
|
285
273
|
</>
|
|
286
274
|
)}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PasswordElement,
|
|
3
|
-
PasswordRepeatElement,
|
|
4
|
-
TextFieldElement,
|
|
5
|
-
} from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import { PasswordRepeatElement, TextFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
6
2
|
import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
7
3
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
8
4
|
import { Trans } from '@lingui/react'
|
|
9
|
-
import { TextField } from '@mui/material'
|
|
10
5
|
import { useRouter } from 'next/router'
|
|
11
6
|
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
7
|
+
import { ValidatedPasswordElement } from '../ValidatedPasswordElement/ValidatedPasswordElement'
|
|
12
8
|
import {
|
|
13
9
|
ResetPasswordDocument,
|
|
14
10
|
ResetPasswordMutation,
|
|
@@ -59,11 +55,11 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
|
|
|
59
55
|
/>
|
|
60
56
|
</FormRow>
|
|
61
57
|
<FormRow>
|
|
62
|
-
<
|
|
58
|
+
<ValidatedPasswordElement
|
|
63
59
|
control={control}
|
|
64
60
|
name='newPassword'
|
|
61
|
+
autoComplete='new-password'
|
|
65
62
|
variant='outlined'
|
|
66
|
-
type='password'
|
|
67
63
|
label={<Trans id='New password' />}
|
|
68
64
|
required
|
|
69
65
|
disabled={formState.isSubmitting}
|
|
@@ -71,9 +67,9 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
|
|
|
71
67
|
<PasswordRepeatElement
|
|
72
68
|
control={control}
|
|
73
69
|
name='confirmPassword'
|
|
70
|
+
autoComplete='new-password'
|
|
74
71
|
passwordFieldName='newPassword'
|
|
75
72
|
variant='outlined'
|
|
76
|
-
type='password'
|
|
77
73
|
label={<Trans id='Confirm password' />}
|
|
78
74
|
required
|
|
79
75
|
disabled={formState.isSubmitting}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import { useApolloClient } from '@graphcommerce/graphql'
|
|
2
|
-
import { CustomerTokenDocument } from '@graphcommerce/magento-customer'
|
|
3
3
|
import { Button } from '@mui/material'
|
|
4
|
+
import { CustomerTokenDocument } from '../../hooks/CustomerToken.gql'
|
|
4
5
|
|
|
5
6
|
export function SessionDebugger() {
|
|
6
7
|
const client = useApolloClient()
|