@graphcommerce/magento-customer 3.5.4 → 3.6.1
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 +29 -0
- package/components/AccountAddress/index.tsx +4 -1
- package/components/AccountAddresses/index.tsx +6 -6
- package/components/AddressFields/index.tsx +9 -8
- package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +4 -1
- package/components/ApolloCustomerError/ApolloCustomerErrorFullPage.tsx +3 -2
- package/components/ChangeNameForm/index.tsx +3 -5
- package/components/ChangePasswordForm/ChangePasswordForm.tsx +7 -6
- package/components/CreateCustomerAddressForm/index.tsx +4 -3
- package/components/CustomerFab/index.tsx +2 -1
- package/components/DeleteCustomerAddressForm/index.tsx +2 -1
- package/components/EditAddressForm/index.tsx +4 -3
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +5 -4
- package/components/NameFields/index.tsx +6 -5
- package/components/ResetPasswordForm/index.tsx +2 -1
- package/components/SignInForm/SignInForm.tsx +1 -4
- package/components/SignInForm/SignInFormInline.tsx +1 -1
- package/components/SignUpForm/SignUpForm.tsx +1 -1
- package/components/SignUpForm/SignUpFormInline.tsx +2 -2
- package/components/UpdateCustomerEmailForm/index.tsx +6 -6
- package/components/UpdateDefaultAddressForm/index.tsx +3 -2
- package/hooks/useExtractCustomerErrors.tsx +2 -1
- package/hooks/useFormIsEmailAvailable.tsx +1 -3
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.6.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-customer@3.5.6...@graphcommerce/magento-customer@3.6.0) (2021-11-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* even more translations ([1a1f988](https://github.com/ho-nl/m2-pwa/commit/1a1f98837c704b978f6b42b619d9c52f540b2d48))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* added tons of translations ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.5.5](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-customer@3.5.4...@graphcommerce/magento-customer@3.5.5) (2021-11-12)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* design ([a095309](https://github.com/ho-nl/m2-pwa/commit/a095309bb3d77228985e08e30f626cd26e878f57))
|
|
28
|
+
* login error message should wrap ([6b8e61f](https://github.com/ho-nl/m2-pwa/commit/6b8e61fa6523391e5faa3dfd37b9fcd648d831bb))
|
|
29
|
+
* snackbar styling and consistant grammar ([3f6a4f9](https://github.com/ho-nl/m2-pwa/commit/3f6a4f9a1c8b2d5220268d59d0c8e5a11c9ce6a8))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
## [3.5.4](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-customer@3.5.3...@graphcommerce/magento-customer@3.5.4) (2021-11-12)
|
|
7
36
|
|
|
8
37
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Trans } from '@lingui/macro'
|
|
1
2
|
import { Link, makeStyles, Theme } from '@material-ui/core'
|
|
2
3
|
import PageLink from 'next/link'
|
|
3
4
|
import React from 'react'
|
|
@@ -50,7 +51,9 @@ export default function AccountAddress(props: AccountAddressProps) {
|
|
|
50
51
|
</div>
|
|
51
52
|
<div className={classes.actions}>
|
|
52
53
|
<PageLink href={`/account/addresses/edit?addressId=${id}`} passHref>
|
|
53
|
-
<Link color='primary'>
|
|
54
|
+
<Link color='primary'>
|
|
55
|
+
<Trans>Edit</Trans>
|
|
56
|
+
</Link>
|
|
54
57
|
</PageLink>
|
|
55
58
|
<DeleteCustomerAddressForm addressId={id ?? undefined} />
|
|
56
59
|
</div>
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
FullPageMessage,
|
|
4
4
|
SectionContainer,
|
|
5
5
|
MessageSnackbar,
|
|
6
|
-
SvgImage,
|
|
7
6
|
iconHome,
|
|
8
7
|
SvgImageSimple,
|
|
9
8
|
} from '@graphcommerce/next-ui'
|
|
9
|
+
import { Trans } from '@lingui/macro'
|
|
10
10
|
import { makeStyles, Theme } from '@material-ui/core'
|
|
11
11
|
import { Skeleton } from '@material-ui/lab'
|
|
12
12
|
import Link from 'next/link'
|
|
@@ -54,7 +54,7 @@ export default function AccountAddresses(props: AccountAddressesProps) {
|
|
|
54
54
|
<Skeleton height={128} />
|
|
55
55
|
</div>
|
|
56
56
|
<Button className={classes.button} variant='contained' color='primary' disabled>
|
|
57
|
-
Add new address
|
|
57
|
+
<Trans>Add new address</Trans>
|
|
58
58
|
</Button>
|
|
59
59
|
</SectionContainer>
|
|
60
60
|
)
|
|
@@ -65,12 +65,12 @@ export default function AccountAddresses(props: AccountAddressesProps) {
|
|
|
65
65
|
{((addresses && addresses.length === 0) || !addresses) && (
|
|
66
66
|
<>
|
|
67
67
|
<FullPageMessage
|
|
68
|
-
title=
|
|
68
|
+
title={<Trans>You have no addresses saved yet</Trans>}
|
|
69
69
|
icon={<SvgImageSimple src={iconHome} size='xxl' />}
|
|
70
70
|
button={
|
|
71
71
|
<Link href='/account/addresses/add' passHref>
|
|
72
72
|
<Button size='large' variant='contained' color='primary'>
|
|
73
|
-
Add new address
|
|
73
|
+
<Trans>Add new address</Trans>
|
|
74
74
|
</Button>
|
|
75
75
|
</Link>
|
|
76
76
|
}
|
|
@@ -88,12 +88,12 @@ export default function AccountAddresses(props: AccountAddressesProps) {
|
|
|
88
88
|
|
|
89
89
|
<Link href='/account/addresses/add' passHref>
|
|
90
90
|
<Button className={classes.button} variant='contained' color='primary'>
|
|
91
|
-
Add new address
|
|
91
|
+
<Trans>Add new address</Trans>
|
|
92
92
|
</Button>
|
|
93
93
|
</Link>
|
|
94
94
|
|
|
95
95
|
<MessageSnackbar sticky open={router.query.confirm_delete !== undefined}>
|
|
96
|
-
|
|
96
|
+
<Trans>Successfully deleted address</Trans>
|
|
97
97
|
</MessageSnackbar>
|
|
98
98
|
</SectionContainer>
|
|
99
99
|
)}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
houseNumberPattern,
|
|
7
7
|
UseFormReturn,
|
|
8
8
|
} from '@graphcommerce/react-hook-form'
|
|
9
|
+
import { t, Trans } from '@lingui/macro'
|
|
9
10
|
import { TextField } from '@material-ui/core'
|
|
10
11
|
import React, { useMemo } from 'react'
|
|
11
12
|
|
|
@@ -56,7 +57,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
56
57
|
variant='outlined'
|
|
57
58
|
type='text'
|
|
58
59
|
error={!!formState.errors.street}
|
|
59
|
-
label=
|
|
60
|
+
label={<Trans>Street</Trans>}
|
|
60
61
|
autoComplete='address-line1'
|
|
61
62
|
required={!!required?.street}
|
|
62
63
|
{...muiRegister('street', { required: required?.street })}
|
|
@@ -70,12 +71,12 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
70
71
|
variant='outlined'
|
|
71
72
|
type='text'
|
|
72
73
|
error={!!formState.errors.houseNumber}
|
|
73
|
-
label=
|
|
74
|
+
label={<Trans>Housenumber</Trans>}
|
|
74
75
|
autoComplete='address-line2'
|
|
75
76
|
required={!!required?.houseNumber}
|
|
76
77
|
{...muiRegister('houseNumber', {
|
|
77
78
|
required: required?.houseNumber,
|
|
78
|
-
pattern: { value: houseNumberPattern, message:
|
|
79
|
+
pattern: { value: houseNumberPattern, message: t`Please provide a valid house number` },
|
|
79
80
|
})}
|
|
80
81
|
helperText={formState.isSubmitted && formState.errors.houseNumber?.message}
|
|
81
82
|
InputProps={{
|
|
@@ -88,7 +89,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
88
89
|
type='text'
|
|
89
90
|
error={!!formState.errors.addition}
|
|
90
91
|
required={!!required?.addition}
|
|
91
|
-
label=
|
|
92
|
+
label={<Trans>Addition</Trans>}
|
|
92
93
|
autoComplete='address-line3'
|
|
93
94
|
{...muiRegister('addition', { required: required?.addition })}
|
|
94
95
|
helperText={formState.isSubmitted && formState.errors.addition?.message}
|
|
@@ -104,7 +105,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
104
105
|
type='text'
|
|
105
106
|
error={!!formState.errors.postcode}
|
|
106
107
|
required={!!required?.postcode}
|
|
107
|
-
label=
|
|
108
|
+
label={<Trans>Postcode</Trans>}
|
|
108
109
|
{...muiRegister('postcode', { required: required?.postcode })}
|
|
109
110
|
helperText={formState.isSubmitted && formState.errors.postcode?.message}
|
|
110
111
|
InputProps={{
|
|
@@ -117,7 +118,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
117
118
|
type='text'
|
|
118
119
|
error={!!formState.errors.city}
|
|
119
120
|
required={!!required?.city}
|
|
120
|
-
label=
|
|
121
|
+
label={<Trans>City</Trans>}
|
|
121
122
|
{...muiRegister('city', { required: required?.city })}
|
|
122
123
|
helperText={formState.isSubmitted && formState.errors.city?.message}
|
|
123
124
|
InputProps={{
|
|
@@ -133,7 +134,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
133
134
|
{...muiRegister('countryCode', { required: required.countryCode })}
|
|
134
135
|
variant='outlined'
|
|
135
136
|
error={!!formState.errors.countryCode}
|
|
136
|
-
label=
|
|
137
|
+
label={<Trans>Country</Trans>}
|
|
137
138
|
required={!!required?.countryCode}
|
|
138
139
|
helperText={formState.errors.countryCode?.message}
|
|
139
140
|
// onBlur={onBlur}
|
|
@@ -159,7 +160,7 @@ export default function AddressFields(props: AddressFieldsProps) {
|
|
|
159
160
|
SelectProps={{ native: true, displayEmpty: true }}
|
|
160
161
|
variant='outlined'
|
|
161
162
|
error={!!formState.errors.regionId}
|
|
162
|
-
label=
|
|
163
|
+
label={<Trans>Region</Trans>}
|
|
163
164
|
{...muiRegister('regionId', {
|
|
164
165
|
required: true,
|
|
165
166
|
shouldUnregister: true,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ApolloErrorAlert, ApolloErrorAlertProps } from '@graphcommerce/next-ui'
|
|
2
|
+
import { Trans } from '@lingui/macro'
|
|
2
3
|
import { Link } from '@material-ui/core'
|
|
3
4
|
import NextLink from 'next/link'
|
|
4
5
|
import React from 'react'
|
|
@@ -12,7 +13,9 @@ export default function ApolloCustomerErrorAlert(props: MagentoErrorAlertProps)
|
|
|
12
13
|
const action = unauthorized && (
|
|
13
14
|
<>
|
|
14
15
|
<NextLink href='/account/signin' passHref>
|
|
15
|
-
<Link>
|
|
16
|
+
<Link>
|
|
17
|
+
<Trans>Create Account</Trans> / <Trans>Sign In</Trans>
|
|
18
|
+
</Link>
|
|
16
19
|
</NextLink>
|
|
17
20
|
</>
|
|
18
21
|
)
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
iconPerson,
|
|
6
6
|
SvgImageSimple,
|
|
7
7
|
} from '@graphcommerce/next-ui'
|
|
8
|
+
import { Trans } from '@lingui/macro'
|
|
8
9
|
import PageLink from 'next/link'
|
|
9
10
|
import React from 'react'
|
|
10
11
|
|
|
@@ -27,7 +28,7 @@ export default function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFu
|
|
|
27
28
|
unauthorized ? (
|
|
28
29
|
<PageLink href={signInHref} passHref>
|
|
29
30
|
<Button variant='contained' color='primary' size='large'>
|
|
30
|
-
Login
|
|
31
|
+
<Trans>Login</Trans>
|
|
31
32
|
</Button>
|
|
32
33
|
</PageLink>
|
|
33
34
|
) : undefined
|
|
@@ -36,7 +37,7 @@ export default function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFu
|
|
|
36
37
|
unauthorized ? (
|
|
37
38
|
<PageLink href={signUpHref} passHref>
|
|
38
39
|
<Button variant='text' color='primary'>
|
|
39
|
-
Or create an account
|
|
40
|
+
<Trans>Or create an account</Trans>
|
|
40
41
|
</Button>
|
|
41
42
|
</PageLink>
|
|
42
43
|
) : undefined
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
SvgImageSimple,
|
|
9
9
|
} from '@graphcommerce/next-ui'
|
|
10
10
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
11
|
+
import { Trans } from '@lingui/macro'
|
|
11
12
|
import React from 'react'
|
|
12
13
|
import ApolloCustomerErrorAlert from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
13
14
|
import NameFields from '../NameFields'
|
|
@@ -49,16 +50,13 @@ export default function ChangeNameForm(props: ChangeNameFormProps) {
|
|
|
49
50
|
size='large'
|
|
50
51
|
loading={formState.isSubmitting}
|
|
51
52
|
>
|
|
52
|
-
Save changes
|
|
53
|
+
<Trans>Save changes</Trans>
|
|
53
54
|
</Button>
|
|
54
55
|
</FormActions>
|
|
55
56
|
<ApolloCustomerErrorAlert error={error} />
|
|
56
57
|
</Form>
|
|
57
58
|
<MessageSnackbar open={formState.isSubmitSuccessful && !error} variant='pill'>
|
|
58
|
-
|
|
59
|
-
<SvgImageSimple src={iconCheckmark} size='small' />
|
|
60
|
-
Changes saved
|
|
61
|
-
</>
|
|
59
|
+
<Trans>Successfully saved changes</Trans>
|
|
62
60
|
</MessageSnackbar>
|
|
63
61
|
</>
|
|
64
62
|
)
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
FormDivider,
|
|
8
8
|
} from '@graphcommerce/next-ui'
|
|
9
9
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
10
|
+
import { Trans, t } from '@lingui/macro'
|
|
10
11
|
import { TextField } from '@material-ui/core'
|
|
11
12
|
import React from 'react'
|
|
12
13
|
|
|
@@ -33,7 +34,7 @@ export default function ChangePasswordForm() {
|
|
|
33
34
|
variant='outlined'
|
|
34
35
|
type='password'
|
|
35
36
|
error={!!formState.errors.currentPassword}
|
|
36
|
-
label=
|
|
37
|
+
label={<Trans>Current Password</Trans>}
|
|
37
38
|
required={required.currentPassword}
|
|
38
39
|
{...muiRegister('currentPassword', { required: required.currentPassword })}
|
|
39
40
|
helperText={formState.errors.currentPassword?.message}
|
|
@@ -46,7 +47,7 @@ export default function ChangePasswordForm() {
|
|
|
46
47
|
variant='outlined'
|
|
47
48
|
type='password'
|
|
48
49
|
error={!!formState.errors.newPassword}
|
|
49
|
-
label=
|
|
50
|
+
label={<Trans>New Password</Trans>}
|
|
50
51
|
required={required.newPassword}
|
|
51
52
|
{...muiRegister('newPassword', { required: required.newPassword })}
|
|
52
53
|
helperText={formState.errors.newPassword?.message}
|
|
@@ -57,11 +58,11 @@ export default function ChangePasswordForm() {
|
|
|
57
58
|
variant='outlined'
|
|
58
59
|
type='password'
|
|
59
60
|
error={!!formState.errors.confirmPassword}
|
|
60
|
-
label=
|
|
61
|
+
label={<Trans>Confirm Password</Trans>}
|
|
61
62
|
required
|
|
62
63
|
{...muiRegister('confirmPassword', {
|
|
63
64
|
required: true,
|
|
64
|
-
validate: (value) => value === pass ||
|
|
65
|
+
validate: (value) => value === pass || t`Passwords don't match`,
|
|
65
66
|
})}
|
|
66
67
|
helperText={formState.errors.confirmPassword?.message}
|
|
67
68
|
disabled={formState.isSubmitting}
|
|
@@ -80,12 +81,12 @@ export default function ChangePasswordForm() {
|
|
|
80
81
|
variant='contained'
|
|
81
82
|
size='large'
|
|
82
83
|
>
|
|
83
|
-
Save new password
|
|
84
|
+
<Trans>Save new password</Trans>
|
|
84
85
|
</Button>
|
|
85
86
|
</FormActions>
|
|
86
87
|
|
|
87
88
|
<MessageSnackbar sticky open={Boolean(formState.isSubmitSuccessful && data)}>
|
|
88
|
-
|
|
89
|
+
<Trans>Successfully changed password</Trans>
|
|
89
90
|
</MessageSnackbar>
|
|
90
91
|
</Form>
|
|
91
92
|
)
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
InputCheckmark,
|
|
10
10
|
} from '@graphcommerce/next-ui'
|
|
11
11
|
import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
12
|
+
import { Trans, t } from '@lingui/macro'
|
|
12
13
|
import { TextField } from '@material-ui/core'
|
|
13
14
|
import { useRouter } from 'next/router'
|
|
14
15
|
import React from 'react'
|
|
@@ -65,10 +66,10 @@ export default function CreateCustomerAddressForm() {
|
|
|
65
66
|
type='text'
|
|
66
67
|
error={!!formState.errors.telephone}
|
|
67
68
|
required={required.telephone}
|
|
68
|
-
label=
|
|
69
|
+
label={<Trans>Telephone</Trans>}
|
|
69
70
|
{...muiRegister('telephone', {
|
|
70
71
|
required: required.telephone,
|
|
71
|
-
pattern: { value: phonePattern, message:
|
|
72
|
+
pattern: { value: phonePattern, message: t`Invalid phone number` },
|
|
72
73
|
})}
|
|
73
74
|
helperText={formState.isSubmitted && formState.errors.telephone?.message}
|
|
74
75
|
disabled={formState.isSubmitting}
|
|
@@ -86,7 +87,7 @@ export default function CreateCustomerAddressForm() {
|
|
|
86
87
|
size='large'
|
|
87
88
|
loading={formState.isSubmitting}
|
|
88
89
|
>
|
|
89
|
-
Save changes
|
|
90
|
+
<Trans>Save changes</Trans>
|
|
90
91
|
</Button>
|
|
91
92
|
</FormActions>
|
|
92
93
|
</Form>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@apollo/client'
|
|
2
2
|
import { iconPerson, StyledBadge, SvgImageSimple, UseStyles } from '@graphcommerce/next-ui'
|
|
3
|
+
import { t } from '@lingui/macro'
|
|
3
4
|
import { Fab, FabProps as FabPropsType, makeStyles, NoSsr, Theme } from '@material-ui/core'
|
|
4
5
|
import PageLink from 'next/link'
|
|
5
6
|
import React from 'react'
|
|
@@ -25,7 +26,7 @@ function CustomerFabContent(props: CustomerFabContentProps) {
|
|
|
25
26
|
|
|
26
27
|
return (
|
|
27
28
|
<PageLink href={requireAuth ? guestHref : authHref} passHref>
|
|
28
|
-
<Fab color='inherit' aria-label=
|
|
29
|
+
<Fab color='inherit' aria-label={t`Account`} size='large' {...FabProps}>
|
|
29
30
|
<StyledBadge
|
|
30
31
|
badgeContent={customerToken?.token ? 1 : 0}
|
|
31
32
|
color={customerToken?.valid ? 'primary' : 'error'}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
2
|
+
import { Trans } from '@lingui/macro'
|
|
2
3
|
import { Button, makeStyles, Theme } from '@material-ui/core'
|
|
3
4
|
import { useRouter } from 'next/router'
|
|
4
5
|
import React from 'react'
|
|
@@ -38,7 +39,7 @@ export default function DeleteCustomerAddressForm(props: DeleteCustomerAddressFo
|
|
|
38
39
|
return (
|
|
39
40
|
<form onSubmit={submitHandler} noValidate>
|
|
40
41
|
<Button type='submit' variant='text' color='inherit' className={classes.button}>
|
|
41
|
-
Delete this address
|
|
42
|
+
<Trans>Delete this address</Trans>
|
|
42
43
|
</Button>
|
|
43
44
|
<ApolloCustomerErrorAlert error={error} />
|
|
44
45
|
</form>
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
InputCheckmark,
|
|
10
10
|
} from '@graphcommerce/next-ui'
|
|
11
11
|
import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
12
|
+
import { t, Trans } from '@lingui/macro'
|
|
12
13
|
import { makeStyles, TextField } from '@material-ui/core'
|
|
13
14
|
import { useRouter } from 'next/router'
|
|
14
15
|
import React from 'react'
|
|
@@ -94,10 +95,10 @@ export default function EditAddressForm(props: EditAddressFormProps) {
|
|
|
94
95
|
type='text'
|
|
95
96
|
error={!!formState.errors.telephone}
|
|
96
97
|
required={required.telephone}
|
|
97
|
-
label=
|
|
98
|
+
label={<Trans>Telephone</Trans>}
|
|
98
99
|
{...muiRegister('telephone', {
|
|
99
100
|
required: required.telephone,
|
|
100
|
-
pattern: { value: phonePattern, message:
|
|
101
|
+
pattern: { value: phonePattern, message: t`Invalid phone number` },
|
|
101
102
|
})}
|
|
102
103
|
helperText={formState.isSubmitted && formState.errors.telephone?.message}
|
|
103
104
|
disabled={formState.isSubmitting}
|
|
@@ -115,7 +116,7 @@ export default function EditAddressForm(props: EditAddressFormProps) {
|
|
|
115
116
|
size='large'
|
|
116
117
|
loading={formState.isSubmitting}
|
|
117
118
|
>
|
|
118
|
-
Save changes
|
|
119
|
+
<Trans>Save changes</Trans>
|
|
119
120
|
</Button>
|
|
120
121
|
</FormActions>
|
|
121
122
|
</Form>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
2
2
|
import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
3
|
+
import { t, Trans } from '@lingui/macro'
|
|
3
4
|
import { makeStyles, TextField, Theme } from '@material-ui/core'
|
|
4
5
|
import { Alert } from '@material-ui/lab'
|
|
5
6
|
import React from 'react'
|
|
@@ -31,7 +32,7 @@ export default function ForgotPasswordForm() {
|
|
|
31
32
|
if (formState.isSubmitSuccessful && data) {
|
|
32
33
|
return (
|
|
33
34
|
<Alert severity='success' variant='standard' className={classes.alert}>
|
|
34
|
-
We
|
|
35
|
+
<Trans>We've send a password reset link to your email address!</Trans>
|
|
35
36
|
</Alert>
|
|
36
37
|
)
|
|
37
38
|
}
|
|
@@ -43,11 +44,11 @@ export default function ForgotPasswordForm() {
|
|
|
43
44
|
variant='outlined'
|
|
44
45
|
type='text'
|
|
45
46
|
error={!!formState.errors.email}
|
|
46
|
-
label=
|
|
47
|
+
label={<Trans>Email</Trans>}
|
|
47
48
|
required={required.email}
|
|
48
49
|
{...muiRegister('email', {
|
|
49
50
|
required: required.email,
|
|
50
|
-
pattern: { value: emailPattern, message:
|
|
51
|
+
pattern: { value: emailPattern, message: t`Invalid email address` },
|
|
51
52
|
})}
|
|
52
53
|
helperText={formState.errors.email?.message}
|
|
53
54
|
disabled={formState.isSubmitting}
|
|
@@ -64,7 +65,7 @@ export default function ForgotPasswordForm() {
|
|
|
64
65
|
variant='contained'
|
|
65
66
|
size='large'
|
|
66
67
|
>
|
|
67
|
-
Send password reset email
|
|
68
|
+
<Trans>Send password reset email</Trans>
|
|
68
69
|
</Button>
|
|
69
70
|
</FormActions>
|
|
70
71
|
</Form>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FormRow, InputCheckmark } from '@graphcommerce/next-ui'
|
|
2
2
|
import { assertFormGqlOperation, Controller, UseFormReturn } from '@graphcommerce/react-hook-form'
|
|
3
|
+
import { t, Trans } from '@lingui/macro'
|
|
3
4
|
import { MenuItem, TextField } from '@material-ui/core'
|
|
4
5
|
import React from 'react'
|
|
5
6
|
|
|
@@ -34,18 +35,18 @@ export default function NameFields(props: NameFieldProps) {
|
|
|
34
35
|
variant='outlined'
|
|
35
36
|
select
|
|
36
37
|
error={!!fieldState.error}
|
|
37
|
-
label=
|
|
38
|
+
label={<Trans>Prefix</Trans>}
|
|
38
39
|
required={!!required?.prefix}
|
|
39
40
|
helperText={fieldState.error?.message}
|
|
40
41
|
onChange={(e) => onChange(e.target.value)}
|
|
41
42
|
inputRef={ref}
|
|
42
43
|
InputProps={{
|
|
43
44
|
readOnly,
|
|
44
|
-
endAdornment: <InputCheckmark show={valid.prefix} />,
|
|
45
|
+
endAdornment: <InputCheckmark show={valid.prefix} select />,
|
|
45
46
|
}}
|
|
46
47
|
{...field}
|
|
47
48
|
>
|
|
48
|
-
{[
|
|
49
|
+
{[t`Mr`, t`Mrs`, t`Other`].map((option) => (
|
|
49
50
|
<MenuItem key={option} value={option}>
|
|
50
51
|
{option}
|
|
51
52
|
</MenuItem>
|
|
@@ -60,7 +61,7 @@ export default function NameFields(props: NameFieldProps) {
|
|
|
60
61
|
<TextField
|
|
61
62
|
variant='outlined'
|
|
62
63
|
type='text'
|
|
63
|
-
label=
|
|
64
|
+
label={<Trans>First Name</Trans>}
|
|
64
65
|
required={!!required}
|
|
65
66
|
error={!!formState.errors.firstname}
|
|
66
67
|
helperText={formState.isSubmitted && formState.errors.firstname?.message}
|
|
@@ -74,7 +75,7 @@ export default function NameFields(props: NameFieldProps) {
|
|
|
74
75
|
variant='outlined'
|
|
75
76
|
type='text'
|
|
76
77
|
error={!!formState.errors.lastname}
|
|
77
|
-
label=
|
|
78
|
+
label={<Trans>Last Name</Trans>}
|
|
78
79
|
required={!!required?.lastname}
|
|
79
80
|
helperText={formState.isSubmitted && formState.errors.lastname?.message}
|
|
80
81
|
InputProps={{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
|
|
2
2
|
import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
3
|
+
import { Trans } from '@lingui/macro'
|
|
3
4
|
import { TextField } from '@material-ui/core'
|
|
4
5
|
import { useRouter } from 'next/router'
|
|
5
6
|
import React from 'react'
|
|
@@ -44,7 +45,7 @@ export default function ResetPasswordForm(props: ResetPasswordFormProps) {
|
|
|
44
45
|
variant='outlined'
|
|
45
46
|
type='email'
|
|
46
47
|
error={!!formState.errors.email}
|
|
47
|
-
label=
|
|
48
|
+
label={<Trans>Email</Trans>}
|
|
48
49
|
required={required.email}
|
|
49
50
|
{...muiRegister('email', { required: required.email })}
|
|
50
51
|
helperText={formState.errors.email?.message}
|
|
@@ -55,15 +55,12 @@ export default function SignInForm(props: SignInFormProps) {
|
|
|
55
55
|
variant='outlined'
|
|
56
56
|
type='password'
|
|
57
57
|
error={!!formState.errors.password || !!authError}
|
|
58
|
-
label={
|
|
58
|
+
label={<Trans>Password</Trans>}
|
|
59
59
|
autoFocus
|
|
60
60
|
autoComplete='current-password'
|
|
61
61
|
id='current-password'
|
|
62
62
|
required={required.password}
|
|
63
63
|
{...muiRegister('password', { required: required.password })}
|
|
64
|
-
FormHelperTextProps={{
|
|
65
|
-
className: classes.forgotPass,
|
|
66
|
-
}}
|
|
67
64
|
InputProps={{
|
|
68
65
|
endAdornment: (
|
|
69
66
|
<PageLink href='/account/forgot-password' key='forgot-password' passHref>
|
|
@@ -43,7 +43,7 @@ export default function SignInFormInline({ email }: PropsWithChildren<InlineSign
|
|
|
43
43
|
variant='outlined'
|
|
44
44
|
type='password'
|
|
45
45
|
error={!!formState.errors.password || !!error?.message}
|
|
46
|
-
label={
|
|
46
|
+
label={<Trans>Password</Trans>}
|
|
47
47
|
autoFocus
|
|
48
48
|
autoComplete='current-password'
|
|
49
49
|
id='current-password'
|
|
@@ -34,7 +34,7 @@ export default function SignUpForm(props: SignUpFormProps) {
|
|
|
34
34
|
variant='outlined'
|
|
35
35
|
type='password'
|
|
36
36
|
error={!!formState.errors.password || !!inputError}
|
|
37
|
-
label={
|
|
37
|
+
label={<Trans>Password</Trans>}
|
|
38
38
|
autoFocus
|
|
39
39
|
autoComplete='new-password'
|
|
40
40
|
required={required.password}
|
|
@@ -67,7 +67,7 @@ export default function SignUpFormInline({
|
|
|
67
67
|
variant='outlined'
|
|
68
68
|
type='password'
|
|
69
69
|
error={!!formState.errors.password || !!error?.message}
|
|
70
|
-
label={
|
|
70
|
+
label={<Trans>Password</Trans>}
|
|
71
71
|
autoFocus
|
|
72
72
|
autoComplete='new-password'
|
|
73
73
|
id='new-password'
|
|
@@ -103,7 +103,7 @@ export default function SignUpFormInline({
|
|
|
103
103
|
color='secondary'
|
|
104
104
|
variant='pill'
|
|
105
105
|
>
|
|
106
|
-
|
|
106
|
+
Create Account
|
|
107
107
|
</Button>
|
|
108
108
|
</div>
|
|
109
109
|
</FormRow>
|
|
@@ -71,7 +71,7 @@ export default function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormPr
|
|
|
71
71
|
autoFocus
|
|
72
72
|
error={formState.isSubmitted && !!formState.errors.email}
|
|
73
73
|
helperText={formState.isSubmitted && formState.errors.email?.message}
|
|
74
|
-
label=
|
|
74
|
+
label={<Trans>New email</Trans>}
|
|
75
75
|
required={required.email}
|
|
76
76
|
{...muiRegister('email', {
|
|
77
77
|
required: true,
|
|
@@ -86,11 +86,11 @@ export default function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormPr
|
|
|
86
86
|
autoFocus
|
|
87
87
|
error={formState.isSubmitted && !!formState.errors.confirmEmail}
|
|
88
88
|
helperText={formState.isSubmitted && formState.errors.confirmEmail?.message}
|
|
89
|
-
label={
|
|
89
|
+
label={<Trans>Confirm new email</Trans>}
|
|
90
90
|
required
|
|
91
91
|
{...muiRegister('confirmEmail', {
|
|
92
92
|
required: true,
|
|
93
|
-
validate: (value) => value === watchNewEmail ||
|
|
93
|
+
validate: (value) => value === watchNewEmail || t`Emails don't match`,
|
|
94
94
|
})}
|
|
95
95
|
/>
|
|
96
96
|
</FormRow>
|
|
@@ -100,7 +100,7 @@ export default function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormPr
|
|
|
100
100
|
variant='outlined'
|
|
101
101
|
type='password'
|
|
102
102
|
error={!!formState.errors.password}
|
|
103
|
-
label={
|
|
103
|
+
label={<Trans>Password</Trans>}
|
|
104
104
|
autoComplete='password'
|
|
105
105
|
required={required.password}
|
|
106
106
|
{...muiRegister('password', {
|
|
@@ -120,13 +120,13 @@ export default function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormPr
|
|
|
120
120
|
size='large'
|
|
121
121
|
loading={formState.isSubmitting}
|
|
122
122
|
>
|
|
123
|
-
Save changes
|
|
123
|
+
<Trans>Save changes</Trans>
|
|
124
124
|
</Button>
|
|
125
125
|
</FormActions>
|
|
126
126
|
<ApolloCustomerErrorAlert error={error} />
|
|
127
127
|
|
|
128
128
|
<MessageSnackbar sticky open={formState.isSubmitSuccessful && !error}>
|
|
129
|
-
|
|
129
|
+
<Trans>Successfully updated email</Trans>
|
|
130
130
|
</MessageSnackbar>
|
|
131
131
|
</Form>
|
|
132
132
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
|
2
|
+
import { Trans } from '@lingui/macro'
|
|
2
3
|
import { FormControl, FormControlLabel, FormHelperText, Switch } from '@material-ui/core'
|
|
3
4
|
import React, { useEffect, useMemo } from 'react'
|
|
4
5
|
import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
|
|
@@ -50,7 +51,7 @@ export default function UpdateDefaultAddressForm(props: AccountAddressProps) {
|
|
|
50
51
|
<FormControl error={!!formState.errors.defaultShipping}>
|
|
51
52
|
<FormControlLabel
|
|
52
53
|
control={<Switch color='primary' />}
|
|
53
|
-
label=
|
|
54
|
+
label={<Trans>Shipping address</Trans>}
|
|
54
55
|
checked={value}
|
|
55
56
|
inputRef={ref}
|
|
56
57
|
onBlur={onBlur}
|
|
@@ -71,7 +72,7 @@ export default function UpdateDefaultAddressForm(props: AccountAddressProps) {
|
|
|
71
72
|
<FormControl error={!!formState.errors.defaultBilling}>
|
|
72
73
|
<FormControlLabel
|
|
73
74
|
control={<Switch color='primary' />}
|
|
74
|
-
label=
|
|
75
|
+
label={<Trans>Billing address</Trans>}
|
|
75
76
|
checked={value}
|
|
76
77
|
inputRef={ref}
|
|
77
78
|
onBlur={onBlur}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloError, useApolloClient } from '@apollo/client'
|
|
2
2
|
import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
|
|
3
|
+
import { t } from '@lingui/macro'
|
|
3
4
|
import { useEffect } from 'react'
|
|
4
5
|
import { CustomerTokenDocument } from './CustomerToken.gql'
|
|
5
6
|
|
|
@@ -11,7 +12,7 @@ export function useExtractCustomerErrors({ error }: UseExtractErrors) {
|
|
|
11
12
|
category: 'graphql-authorization',
|
|
12
13
|
error,
|
|
13
14
|
extract: false,
|
|
14
|
-
mask:
|
|
15
|
+
mask: t`You must sign in to continue`,
|
|
15
16
|
})
|
|
16
17
|
|
|
17
18
|
useEffect(() => {
|
|
@@ -44,9 +44,7 @@ export default function useFormIsEmailAvailable(props: useFormIsEmailAvailablePr
|
|
|
44
44
|
return
|
|
45
45
|
}
|
|
46
46
|
if (isSubmitting) return
|
|
47
|
-
if (!isValid)
|
|
48
|
-
return
|
|
49
|
-
}
|
|
47
|
+
if (!isValid) return
|
|
50
48
|
if (!isDirty && isSubmitted && isSubmitSuccessful && isValid)
|
|
51
49
|
setMode(hasAccount ? 'signin' : 'signup')
|
|
52
50
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/magento-customer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
6
6
|
"browserslist": [
|
|
@@ -14,20 +14,20 @@
|
|
|
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.5",
|
|
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/graphql": "^2.105.
|
|
25
|
-
"@graphcommerce/image": "^2.105.
|
|
26
|
-
"@graphcommerce/magento-graphql": "^2.104.
|
|
27
|
-
"@graphcommerce/magento-store": "^3.
|
|
28
|
-
"@graphcommerce/next-ui": "^3.
|
|
29
|
-
"@graphcommerce/react-hook-form": "^2.
|
|
30
|
-
"@
|
|
24
|
+
"@graphcommerce/graphql": "^2.105.5",
|
|
25
|
+
"@graphcommerce/image": "^2.105.4",
|
|
26
|
+
"@graphcommerce/magento-graphql": "^2.104.5",
|
|
27
|
+
"@graphcommerce/magento-store": "^3.3.1",
|
|
28
|
+
"@graphcommerce/next-ui": "^3.17.1",
|
|
29
|
+
"@graphcommerce/react-hook-form": "^2.104.0",
|
|
30
|
+
"@lingui/macro": "^3.12.1",
|
|
31
31
|
"@material-ui/core": "^4.12.3",
|
|
32
32
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
33
33
|
"clsx": "^1.1.1",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"react": "^17.0.2",
|
|
37
37
|
"react-dom": "^17.0.2"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "e8578cc336e58d896531179f5fcb6973e8a983ce"
|
|
40
40
|
}
|