@graphcommerce/magento-customer 8.0.6-canary.0 → 8.0.6-canary.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.0.6-canary.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`0767bc4`](https://github.com/graphcommerce-org/graphcommerce/commit/0767bc40f7b596209f24ca4e745ff0441f3275c9) - Upgrade input components to no longer use muiRegister, which improves INP scores
8
+ ([@FrankHarland](https://github.com/FrankHarland))
9
+
10
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders.
11
+ ([@FrankHarland](https://github.com/FrankHarland))
12
+
13
+ ## 8.0.6-canary.1
14
+
3
15
  ## 8.0.6-canary.0
4
16
 
5
17
  ## 8.0.5
@@ -1,5 +1,4 @@
1
1
  import { TextFieldElement, FieldValues, FieldPath } from '@graphcommerce/ecommerce-ui'
2
- import { InputCheckmark } from '@graphcommerce/next-ui'
3
2
  import { Trans } from '@lingui/react'
4
3
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
5
4
 
@@ -8,7 +7,7 @@ export function AddressAddition<
8
7
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
9
8
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
10
9
  const form = useAddressFieldsForm<TFieldValues, TName>(props)
11
- const { control, name, readOnly, required, valid } = form
10
+ const { control, name, readOnly, required } = form
12
11
 
13
12
  return (
14
13
  <TextFieldElement
@@ -19,10 +18,8 @@ export function AddressAddition<
19
18
  required={required[name.addition]}
20
19
  label={<Trans id='Addition' />}
21
20
  autoComplete='address-line3'
22
- InputProps={{
23
- readOnly,
24
- endAdornment: <InputCheckmark show={valid[name.addition]} />,
25
- }}
21
+ showValid
22
+ InputProps={{ readOnly }}
26
23
  />
27
24
  )
28
25
  }
@@ -1,5 +1,4 @@
1
1
  import { TextFieldElement, FieldValues, FieldPath } from '@graphcommerce/ecommerce-ui'
2
- import { InputCheckmark } from '@graphcommerce/next-ui'
3
2
  import { Trans } from '@lingui/react'
4
3
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
5
4
 
@@ -8,7 +7,7 @@ export function AddressCity<
8
7
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
9
8
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
10
9
  const form = useAddressFieldsForm<TFieldValues, TName>(props)
11
- const { control, name, readOnly, required, valid } = form
10
+ const { control, name, readOnly, required } = form
12
11
 
13
12
  return (
14
13
  <TextFieldElement
@@ -18,10 +17,8 @@ export function AddressCity<
18
17
  type='text'
19
18
  required={required[name.city]}
20
19
  label={<Trans id='City' />}
21
- InputProps={{
22
- readOnly,
23
- endAdornment: <InputCheckmark show={valid[name.city]} />,
24
- }}
20
+ showValid
21
+ InputProps={{ readOnly }}
25
22
  />
26
23
  )
27
24
  }
@@ -1,7 +1,7 @@
1
1
  import { SelectElement, FieldValues, FieldPath, useWatch } from '@graphcommerce/ecommerce-ui'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
3
  import { CountryRegionsDocument } from '@graphcommerce/magento-store'
4
- import { FormRow, InputCheckmark, filterNonNullableKeys } from '@graphcommerce/next-ui'
4
+ import { FormRow, filterNonNullableKeys } from '@graphcommerce/next-ui'
5
5
  import { Trans } from '@lingui/react'
6
6
  import { useMemo } from 'react'
7
7
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
@@ -43,7 +43,7 @@ export function AddressCountryRegion<
43
43
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
44
44
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
45
45
  const form = useAddressCountryRegion<TFieldValues, TName>(props)
46
- const { control, name, readOnly, required, valid, countryList, regionList } = form
46
+ const { control, name, readOnly, required, countryList, regionList } = form
47
47
 
48
48
  return (
49
49
  <FormRow>
@@ -54,10 +54,8 @@ export function AddressCountryRegion<
54
54
  variant='outlined'
55
55
  label={<Trans id='Country' />}
56
56
  required={required[name.countryCode]}
57
- InputProps={{
58
- readOnly,
59
- endAdornment: <InputCheckmark show={valid[name.countryCode]} select />,
60
- }}
57
+ showValid
58
+ InputProps={{ readOnly }}
61
59
  options={countryList.map((country) => ({
62
60
  id: country.two_letter_abbreviation,
63
61
  label: country.full_name_locale,
@@ -72,10 +70,8 @@ export function AddressCountryRegion<
72
70
  variant='outlined'
73
71
  label={<Trans id='Region' />}
74
72
  required
75
- InputProps={{
76
- readOnly,
77
- endAdornment: <InputCheckmark show={valid[name.regionId]} select />,
78
- }}
73
+ showValid
74
+ InputProps={{ readOnly }}
79
75
  options={regionList.map((region) => ({ ...region, label: region.name }))}
80
76
  />
81
77
  )}
@@ -4,7 +4,6 @@ import {
4
4
  FieldPath,
5
5
  houseNumberPattern,
6
6
  } from '@graphcommerce/ecommerce-ui'
7
- import { InputCheckmark } from '@graphcommerce/next-ui'
8
7
  import { i18n } from '@lingui/core'
9
8
  import { Trans } from '@lingui/react'
10
9
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
@@ -14,7 +13,7 @@ export function AddressHousenumber<
14
13
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
15
14
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
16
15
  const form = useAddressFieldsForm<TFieldValues, TName>(props)
17
- const { control, name, readOnly, required, valid } = form
16
+ const { control, name, readOnly, required } = form
18
17
  return (
19
18
  <TextFieldElement
20
19
  control={control}
@@ -30,10 +29,8 @@ export function AddressHousenumber<
30
29
  type='text'
31
30
  label={<Trans id='Housenumber' />}
32
31
  autoComplete='address-line2'
33
- InputProps={{
34
- readOnly,
35
- endAdornment: <InputCheckmark show={valid[name.houseNumber]} />,
36
- }}
32
+ showValid
33
+ InputProps={{ readOnly }}
37
34
  />
38
35
  )
39
36
  }
@@ -1,5 +1,4 @@
1
1
  import { FieldPath, FieldValues, TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
- import { InputCheckmark } from '@graphcommerce/next-ui'
3
2
  import { Trans } from '@lingui/react'
4
3
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
5
4
 
@@ -8,7 +7,7 @@ export function AddressPostcode<
8
7
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
9
8
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
10
9
  const form = useAddressFieldsForm<TFieldValues, TName>(props)
11
- const { control, name, readOnly, required, valid } = form
10
+ const { control, name, required } = form
12
11
 
13
12
  return (
14
13
  <TextFieldElement
@@ -18,10 +17,7 @@ export function AddressPostcode<
18
17
  type='text'
19
18
  required={required[name.postcode]}
20
19
  label={<Trans id='Postcode' />}
21
- InputProps={{
22
- readOnly,
23
- endAdornment: <InputCheckmark show={valid[name.postcode]} />,
24
- }}
20
+ showValid
25
21
  />
26
22
  )
27
23
  }
@@ -1,5 +1,4 @@
1
1
  import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
- import { InputCheckmark } from '@graphcommerce/next-ui'
3
2
  import { FieldValues, FieldPath } from '@graphcommerce/react-hook-form'
4
3
  import { Trans } from '@lingui/react'
5
4
  import { AddressFieldsOptions, useAddressFieldsForm } from './useAddressFieldsForm'
@@ -9,7 +8,7 @@ export function AddressStreet<
9
8
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
10
9
  >(props: AddressFieldsOptions<TFieldValues, TName>) {
11
10
  const form = useAddressFieldsForm<TFieldValues, TName>(props)
12
- const { control, name, readOnly, required, valid } = form
11
+ const { control, name, readOnly, required } = form
13
12
  return (
14
13
  <TextFieldElement
15
14
  variant='outlined'
@@ -19,10 +18,8 @@ export function AddressStreet<
19
18
  type='text'
20
19
  label={<Trans id='Street' />}
21
20
  autoComplete='address-line1'
22
- InputProps={{
23
- readOnly,
24
- endAdornment: <InputCheckmark show={valid[name.street]} />,
25
- }}
21
+ showValid
22
+ InputProps={{ readOnly }}
26
23
  />
27
24
  )
28
25
  }
@@ -1,4 +1,4 @@
1
- import { ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
1
+ import { ApolloErrorSnackbar, TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
3
  import { CountryCodeEnum } from '@graphcommerce/graphql-mesh'
4
4
  import { CountryRegionsDocument, StoreConfigDocument } from '@graphcommerce/magento-store'
@@ -57,7 +57,7 @@ export function CreateCustomerAddressForm() {
57
57
  { errorPolicy: 'all' },
58
58
  )
59
59
 
60
- const { handleSubmit, formState, required, error, muiRegister, valid, data } = form
60
+ const { handleSubmit, formState, required, error, control, valid, data } = form
61
61
  const submitHandler = handleSubmit((_, e) => {
62
62
  if (!formState.errors) e?.target.reset()
63
63
  })
@@ -69,19 +69,21 @@ export function CreateCustomerAddressForm() {
69
69
  <AddressFields form={form} name={{ regionId: 'region.region_id' }} />
70
70
 
71
71
  <FormRow>
72
- <TextField
72
+ <TextFieldElement
73
73
  variant='outlined'
74
74
  type='text'
75
75
  error={!!formState.errors.telephone}
76
76
  required={required.telephone}
77
77
  label={<Trans id='Telephone' />}
78
- {...muiRegister('telephone', {
78
+ control={control}
79
+ name='telephone'
80
+ rules={{
79
81
  required: required.telephone,
80
82
  pattern: { value: phonePattern, message: i18n._(/* i18n */ 'Invalid phone number') },
81
- })}
83
+ }}
82
84
  helperText={formState.isSubmitted && formState.errors.telephone?.message}
83
85
  disabled={formState.isSubmitting}
84
- InputProps={{ endAdornment: <InputCheckmark show={valid.telephone} /> }}
86
+ showValid
85
87
  />
86
88
  </FormRow>
87
89
 
@@ -1,5 +1,5 @@
1
1
  // eslint-disable-next-line import/no-extraneous-dependencies
2
- import { ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
2
+ import { ApolloErrorSnackbar, TextFieldElement } from '@graphcommerce/ecommerce-ui'
3
3
  import { useQuery } from '@graphcommerce/graphql'
4
4
  import { CountryRegionsDocument } from '@graphcommerce/magento-store'
5
5
  import {
@@ -23,6 +23,9 @@ import { UpdateCustomerAddressDocument } from './UpdateCustomerAddress.gql'
23
23
  type EditAddressFormProps = {
24
24
  address?: AccountAddressFragment
25
25
  sx?: SxProps<Theme>
26
+ /**
27
+ * @deprecated not used, can be safely removed.
28
+ */
26
29
  onCompleteRoute?: string
27
30
  }
28
31
 
@@ -75,7 +78,7 @@ export function EditAddressForm(props: EditAddressFormProps) {
75
78
  { errorPolicy: 'all' },
76
79
  )
77
80
 
78
- const { handleSubmit, formState, required, error, muiRegister, valid } = form
81
+ const { handleSubmit, formState, required, error, control, valid } = form
79
82
  const submitHandler = handleSubmit(() => {})
80
83
 
81
84
  return (
@@ -85,19 +88,21 @@ export function EditAddressForm(props: EditAddressFormProps) {
85
88
  <AddressFields form={form} name={{ regionId: 'region.region_id' }} />
86
89
 
87
90
  <FormRow>
88
- <TextField
91
+ <TextFieldElement
92
+ control={control}
93
+ name='telephone'
89
94
  variant='outlined'
90
95
  type='text'
91
96
  error={!!formState.errors.telephone}
92
97
  required={required.telephone}
93
98
  label={<Trans id='Telephone' />}
94
- {...muiRegister('telephone', {
99
+ rules={{
95
100
  required: required.telephone,
96
101
  pattern: { value: phonePattern, message: i18n._(/* i18n */ 'Invalid phone number') },
97
- })}
102
+ }}
98
103
  helperText={formState.isSubmitted && formState.errors.telephone?.message}
99
104
  disabled={formState.isSubmitting}
100
- InputProps={{ endAdornment: <InputCheckmark show={valid.telephone} /> }}
105
+ showValid
101
106
  />
102
107
  </FormRow>
103
108
 
@@ -1,9 +1,10 @@
1
+ import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
1
2
  import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
2
3
  import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
4
  import { i18n } from '@lingui/core'
4
5
  import { Trans } from '@lingui/react'
5
6
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
6
- import { TextField, Alert, SxProps, Theme } from '@mui/material'
7
+ import { Alert, SxProps, Theme } from '@mui/material'
7
8
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
8
9
  import {
9
10
  ForgotPasswordDocument,
@@ -16,7 +17,7 @@ export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
16
17
  const form = useFormGqlMutation<ForgotPasswordMutation, ForgotPasswordMutationVariables>(
17
18
  ForgotPasswordDocument,
18
19
  )
19
- const { muiRegister, handleSubmit, required, data, formState, error } = form
20
+ const { control, handleSubmit, required, data, formState, error } = form
20
21
  const submitHandler = handleSubmit(() => {})
21
22
 
22
23
  if (formState.isSubmitSuccessful && data) {
@@ -37,18 +38,20 @@ export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
37
38
  return (
38
39
  <Form onSubmit={submitHandler} noValidate sx={sx}>
39
40
  <FormRow>
40
- <TextField
41
+ <TextFieldElement
41
42
  variant='outlined'
42
43
  type='text'
43
44
  error={!!formState.errors.email}
44
45
  label={<Trans id='Email' />}
45
46
  required={required.email}
46
- {...muiRegister('email', {
47
- required: required.email,
47
+ name='email'
48
+ control={control}
49
+ rules={{
48
50
  pattern: { value: emailPattern, message: i18n._(/* i18n */ 'Invalid email address') },
49
- })}
51
+ }}
50
52
  helperText={formState.errors.email?.message}
51
53
  disabled={formState.isSubmitting}
54
+ showValid
52
55
  />
53
56
  </FormRow>
54
57
 
@@ -1,5 +1,5 @@
1
1
  import { SelectElement, TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
- import { FormRow, InputCheckmark } from '@graphcommerce/next-ui'
2
+ import { FormRow } from '@graphcommerce/next-ui'
3
3
  import { assertFormGqlOperation, UseFormReturn } from '@graphcommerce/react-hook-form'
4
4
  import { i18n } from '@lingui/core'
5
5
  import { Trans } from '@lingui/react'
@@ -27,7 +27,7 @@ export function NameFields(props: NameFieldProps) {
27
27
  const { prefix, form, readOnly, prefixes = [mr, mrs, other] } = props
28
28
  assertFormGqlOperation<NameFieldValues>(form)
29
29
 
30
- const { control, required, valid } = form
30
+ const { control, required } = form
31
31
 
32
32
  return (
33
33
  <>
@@ -40,41 +40,32 @@ export function NameFields(props: NameFieldProps) {
40
40
  required={required.prefix}
41
41
  name='prefix'
42
42
  label={<Trans id='Prefix' />}
43
- InputProps={{
44
- readOnly,
45
- endAdornment: <InputCheckmark show={valid.prefix} select />,
46
- }}
47
- options={prefixes.map((option) => ({
48
- id: option,
49
- label: option,
50
- }))}
43
+ showValid
44
+ InputProps={{ readOnly }}
45
+ options={prefixes.map((option) => ({ id: option, label: option }))}
51
46
  />
52
47
  </FormRow>
53
48
  )}
54
49
  <FormRow>
55
50
  <TextFieldElement
56
- control={form.control}
51
+ control={control}
57
52
  name='firstname'
58
53
  required={required.firstname}
59
54
  variant='outlined'
60
55
  type='text'
61
56
  label={<Trans id='First Name' />}
62
- InputProps={{
63
- readOnly,
64
- endAdornment: <InputCheckmark show={valid.firstname} />,
65
- }}
57
+ InputProps={{ readOnly }}
58
+ showValid
66
59
  />
67
60
  <TextFieldElement
68
- control={form.control}
61
+ control={control}
69
62
  name='lastname'
70
63
  required={required.lastname}
71
64
  variant='outlined'
72
65
  type='text'
73
66
  label={<Trans id='Last Name' />}
74
- InputProps={{
75
- readOnly,
76
- endAdornment: <InputCheckmark show={valid.lastname} />,
77
- }}
67
+ InputProps={{ readOnly }}
68
+ showValid
78
69
  />
79
70
  </FormRow>
80
71
  </>
@@ -1,10 +1,9 @@
1
- import { PasswordRepeatElement } from '@graphcommerce/ecommerce-ui'
1
+ import { PasswordRepeatElement, SwitchElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
3
  import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
4
- import { useFormGqlMutation, useFormPersist } from '@graphcommerce/react-hook-form'
4
+ import { FormPersist, useFormGqlMutation } from '@graphcommerce/react-hook-form'
5
5
  import { Trans } from '@lingui/react'
6
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
7
- import { Alert, FormControlLabel, Switch } from '@mui/material'
6
+ import { Alert } from '@mui/material'
8
7
  import { useSignInForm } from '../../hooks/useSignInForm'
9
8
  import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError/ApolloCustomerErrorSnackbar'
10
9
  import { NameFields } from '../NameFields/NameFields'
@@ -39,13 +38,11 @@ export function SignUpForm(props: SignUpFormProps) {
39
38
  { errorPolicy: 'all' },
40
39
  )
41
40
 
42
- const { muiRegister, handleSubmit, required, formState, error, control } = form
41
+ const { handleSubmit, required, formState, error, control } = form
43
42
  const [remainingError, inputError] = graphqlErrorByCategory({ category: 'graphql-input', error })
44
43
 
45
44
  const submitHandler = handleSubmit(() => {})
46
45
 
47
- useFormPersist({ form, name: 'SignUp', exclude: ['password', 'confirmPassword'] })
48
-
49
46
  if (requireEmailValidation && form.formState.isSubmitSuccessful) {
50
47
  return (
51
48
  <Alert>
@@ -57,6 +54,7 @@ export function SignUpForm(props: SignUpFormProps) {
57
54
  return (
58
55
  <form onSubmit={submitHandler} noValidate>
59
56
  <FormRow>
57
+ <FormPersist form={form} name='SignUp' exclude={['password', 'confirmPassword']} />
60
58
  <ValidatedPasswordElement
61
59
  control={control}
62
60
  name='password'
@@ -84,9 +82,9 @@ export function SignUpForm(props: SignUpFormProps) {
84
82
 
85
83
  <NameFields form={form} prefix />
86
84
 
87
- <FormControlLabel
88
- control={<Switch color='primary' />}
89
- {...muiRegister('isSubscribed', { required: required.isSubscribed })}
85
+ <SwitchElement
86
+ control={control}
87
+ name='isSubscribed'
90
88
  disabled={formState.isSubmitting}
91
89
  label={<Trans id='Subscribe to newsletter' />}
92
90
  />
@@ -1,4 +1,4 @@
1
- import { PasswordElement } from '@graphcommerce/ecommerce-ui'
1
+ import { PasswordElement, TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
3
  import {
4
4
  Button,
@@ -12,7 +12,6 @@ import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form
12
12
  import { i18n } from '@lingui/core'
13
13
  import { Trans } from '@lingui/react'
14
14
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
15
- import { TextField } from '@mui/material'
16
15
  import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError'
17
16
  import {
18
17
  UpdateCustomerEmailDocument,
@@ -32,13 +31,17 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
32
31
  UpdateCustomerEmailMutationVariables & { currentEmail?: string; confirmEmail?: string }
33
32
  >(
34
33
  UpdateCustomerEmailDocument,
35
- {},
34
+ {
35
+ defaultValues: {
36
+ currentEmail: email,
37
+ },
38
+ },
36
39
  {
37
40
  errorPolicy: 'all',
38
41
  },
39
42
  )
40
43
 
41
- const { handleSubmit, error, required, formState, watch, muiRegister, reset, control } = form
44
+ const { handleSubmit, error, required, formState, watch, reset, control } = form
42
45
  const [remainingError, authenticationError] = graphqlErrorByCategory({
43
46
  category: 'graphql-authentication',
44
47
  error,
@@ -51,30 +54,20 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
51
54
  return (
52
55
  <Form onSubmit={submit} noValidate>
53
56
  <FormRow>
54
- <TextField
55
- key='current-email'
57
+ <TextFieldElement
56
58
  variant='outlined'
57
59
  type='text'
58
- autoComplete='email'
59
- autoFocus
60
- error={formState.isSubmitted && !!formState.errors.currentEmail}
61
- helperText={formState.isSubmitted && formState.errors.currentEmail?.message}
62
60
  label={<Trans id='Current email' />}
63
61
  required
64
- value={email}
65
- {...muiRegister('currentEmail', {
66
- required: true,
67
- pattern: { value: emailPattern, message: '' },
68
- })}
69
- InputProps={{
70
- readOnly: true,
71
- }}
62
+ name='currentEmail'
63
+ control={control}
64
+ showValid
65
+ InputProps={{ readOnly: true }}
72
66
  />
73
67
  </FormRow>
74
68
 
75
69
  <FormRow>
76
- <TextField
77
- key='email'
70
+ <TextFieldElement
78
71
  variant='outlined'
79
72
  type='text'
80
73
  autoComplete='off'
@@ -82,12 +75,15 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
82
75
  helperText={formState.isSubmitted && formState.errors.email?.message}
83
76
  label={<Trans id='New email' />}
84
77
  required={required.email}
85
- {...muiRegister('email', {
78
+ name='email'
79
+ rules={{
86
80
  required: true,
87
81
  pattern: { value: emailPattern, message: '' },
88
- })}
82
+ }}
83
+ showValid
84
+ control={control}
89
85
  />
90
- <TextField
86
+ <TextFieldElement
91
87
  key='confirm-email'
92
88
  variant='outlined'
93
89
  type='text'
@@ -96,10 +92,13 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
96
92
  helperText={formState.isSubmitted && formState.errors.confirmEmail?.message}
97
93
  label={<Trans id='Confirm new email' />}
98
94
  required
99
- {...muiRegister('confirmEmail', {
95
+ name='confirmEmail'
96
+ rules={{
100
97
  required: true,
101
98
  validate: (value) => value === watchNewEmail || i18n._(/* i18n */ "Emails don't match"),
102
- })}
99
+ }}
100
+ showValid
101
+ control={control}
103
102
  />
104
103
  </FormRow>
105
104
 
@@ -1,4 +1,4 @@
1
- import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
1
+ import { Controller, FormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
2
2
  import { Trans } from '@lingui/react'
3
3
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
4
4
  import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material'
@@ -32,7 +32,6 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
32
32
  const { handleSubmit, control, error, reset, formState } = form
33
33
 
34
34
  const submit = handleSubmit(() => {})
35
- useFormAutoSubmit({ form, submit })
36
35
 
37
36
  useEffect(() => {
38
37
  reset(defaultValues)
@@ -40,6 +39,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
40
39
 
41
40
  return (
42
41
  <form onSubmit={() => {}} noValidate>
42
+ <FormAutoSubmit control={control} submit={submit} />
43
43
  <Controller
44
44
  name='defaultShipping'
45
45
  control={control}
@@ -1,7 +1,7 @@
1
1
  import { usePageContext } from '@graphcommerce/framer-next-pages'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
+ import { useUrlQuery } from '@graphcommerce/next-ui'
3
4
  import { useFormGqlQuery } from '@graphcommerce/react-hook-form'
4
- import { useRouter } from 'next/router'
5
5
  import { useEffect } from 'react'
6
6
  import { CustomerDocument } from './Customer.gql'
7
7
  import {
@@ -10,7 +10,6 @@ import {
10
10
  IsEmailAvailableQueryVariables,
11
11
  } from './IsEmailAvailable.gql'
12
12
  import { useCustomerSession } from './useCustomerSession'
13
- import { useUrlQuery } from '@graphcommerce/next-ui'
14
13
 
15
14
  export type UseFormIsEmailAvailableProps = {
16
15
  onSubmitted?: (data: { email: string }) => void
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-customer",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.6-canary.0",
5
+ "version": "8.0.6-canary.2",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,19 +12,19 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.0.6-canary.0",
16
- "@graphcommerce/eslint-config-pwa": "^8.0.6-canary.0",
17
- "@graphcommerce/framer-next-pages": "^8.0.6-canary.0",
18
- "@graphcommerce/framer-utils": "^8.0.6-canary.0",
19
- "@graphcommerce/graphql": "^8.0.6-canary.0",
20
- "@graphcommerce/graphql-mesh": "^8.0.6-canary.0",
21
- "@graphcommerce/image": "^8.0.6-canary.0",
22
- "@graphcommerce/magento-graphql": "^8.0.6-canary.0",
23
- "@graphcommerce/magento-store": "^8.0.6-canary.0",
24
- "@graphcommerce/next-ui": "^8.0.6-canary.0",
25
- "@graphcommerce/prettier-config-pwa": "^8.0.6-canary.0",
26
- "@graphcommerce/react-hook-form": "^8.0.6-canary.0",
27
- "@graphcommerce/typescript-config-pwa": "^8.0.6-canary.0",
15
+ "@graphcommerce/ecommerce-ui": "^8.0.6-canary.2",
16
+ "@graphcommerce/eslint-config-pwa": "^8.0.6-canary.2",
17
+ "@graphcommerce/framer-next-pages": "^8.0.6-canary.2",
18
+ "@graphcommerce/framer-utils": "^8.0.6-canary.2",
19
+ "@graphcommerce/graphql": "^8.0.6-canary.2",
20
+ "@graphcommerce/graphql-mesh": "^8.0.6-canary.2",
21
+ "@graphcommerce/image": "^8.0.6-canary.2",
22
+ "@graphcommerce/magento-graphql": "^8.0.6-canary.2",
23
+ "@graphcommerce/magento-store": "^8.0.6-canary.2",
24
+ "@graphcommerce/next-ui": "^8.0.6-canary.2",
25
+ "@graphcommerce/prettier-config-pwa": "^8.0.6-canary.2",
26
+ "@graphcommerce/react-hook-form": "^8.0.6-canary.2",
27
+ "@graphcommerce/typescript-config-pwa": "^8.0.6-canary.2",
28
28
  "@lingui/core": "^4.2.1",
29
29
  "@lingui/macro": "^4.2.1",
30
30
  "@lingui/react": "^4.2.1",