@graphcommerce/magento-customer 5.1.0-canary.4 → 5.1.0-canary.6

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,13 @@
1
1
  # Change Log
2
2
 
3
+ ## 5.1.0-canary.6
4
+
5
+ ## 5.1.0-canary.5
6
+
7
+ ### Patch Changes
8
+
9
+ - [`b1444b933`](https://github.com/graphcommerce-org/graphcommerce/commit/b1444b9336107d3ac111563f9b62a884f1b26a8d) - Bring password reset page more in line with standard forms, add missing translations. ([@paales](https://github.com/paales))
10
+
3
11
  ## 5.1.0-canary.4
4
12
 
5
13
  ## 5.1.0-canary.3
@@ -1,3 +1,8 @@
1
+ import {
2
+ PasswordElement,
3
+ PasswordRepeatElement,
4
+ TextFieldElement,
5
+ } from '@graphcommerce/ecommerce-ui'
1
6
  import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
2
7
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
8
  import { Trans } from '@lingui/react'
@@ -20,19 +25,22 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
20
25
  const form = useFormGqlMutation<
21
26
  ResetPasswordMutation,
22
27
  ResetPasswordMutationVariables & { confirmPassword?: string }
23
- >(ResetPasswordDocument, {
24
- onBeforeSubmit: (formData) => ({
25
- ...formData,
26
- resetPasswordToken: token,
27
- }),
28
- })
28
+ >(
29
+ ResetPasswordDocument,
30
+ {
31
+ onBeforeSubmit: (formData) => ({
32
+ ...formData,
33
+ resetPasswordToken: token,
34
+ }),
35
+ },
36
+ { errorPolicy: 'all' },
37
+ )
29
38
 
30
39
  const router = useRouter()
31
- const { muiRegister, handleSubmit, required, watch, data, formState, error } = form
40
+ const { handleSubmit, data, formState, error, control } = form
32
41
  const submitHandler = handleSubmit(() => {})
33
- const newPass = watch('newPassword')
34
42
 
35
- if (formState.isSubmitSuccessful && data) {
43
+ if (formState.isSubmitSuccessful && data && !error) {
36
44
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
37
45
  router.replace(`${window.location.href.split('?')[0]}?success=1`)
38
46
  }
@@ -40,41 +48,34 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
40
48
  return (
41
49
  <Form onSubmit={submitHandler} noValidate>
42
50
  <FormRow>
43
- <TextField
51
+ <TextFieldElement
52
+ control={control}
53
+ name='email'
44
54
  variant='outlined'
45
55
  type='email'
46
- error={!!formState.errors.email}
47
56
  label={<Trans id='Email' />}
48
- required={required.email}
49
- {...muiRegister('email', { required: required.email })}
50
- helperText={formState.errors.email?.message}
57
+ required
51
58
  disabled={formState.isSubmitting}
52
59
  />
53
60
  </FormRow>
54
61
  <FormRow>
55
- <TextField
62
+ <PasswordElement
63
+ control={control}
64
+ name='newPassword'
56
65
  variant='outlined'
57
66
  type='password'
58
- error={!!formState.errors.newPassword}
59
67
  label={<Trans id='New password' />}
60
- required={required.newPassword}
61
- {...muiRegister('newPassword', { required: required.newPassword })}
62
- helperText={formState.errors.newPassword?.message}
68
+ required
63
69
  disabled={formState.isSubmitting}
64
70
  />
65
- </FormRow>
66
- <FormRow>
67
- <TextField
71
+ <PasswordRepeatElement
72
+ control={control}
73
+ name='confirmPassword'
74
+ passwordFieldName='newPassword'
68
75
  variant='outlined'
69
76
  type='password'
70
- error={!!formState.errors.confirmPassword}
71
77
  label={<Trans id='Confirm password' />}
72
78
  required
73
- {...muiRegister('confirmPassword', {
74
- required: true,
75
- validate: (value) => value === newPass || "Passwords don't match",
76
- })}
77
- helperText={formState.errors.confirmPassword?.message}
78
79
  disabled={formState.isSubmitting}
79
80
  />
80
81
  </FormRow>
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": "5.1.0-canary.4",
5
+ "version": "5.1.0-canary.6",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,20 +12,20 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "5.1.0-canary.4",
16
- "@graphcommerce/prettier-config-pwa": "5.1.0-canary.4",
17
- "@graphcommerce/typescript-config-pwa": "5.1.0-canary.4"
15
+ "@graphcommerce/eslint-config-pwa": "5.1.0-canary.6",
16
+ "@graphcommerce/prettier-config-pwa": "5.1.0-canary.6",
17
+ "@graphcommerce/typescript-config-pwa": "5.1.0-canary.6"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/ecommerce-ui": "5.1.0-canary.4",
21
- "@graphcommerce/framer-utils": "5.1.0-canary.4",
22
- "@graphcommerce/graphql": "5.1.0-canary.4",
23
- "@graphcommerce/graphql-mesh": "5.1.0-canary.4",
24
- "@graphcommerce/image": "5.1.0-canary.4",
25
- "@graphcommerce/magento-graphql": "5.1.0-canary.4",
26
- "@graphcommerce/magento-store": "5.1.0-canary.4",
27
- "@graphcommerce/next-ui": "5.1.0-canary.4",
28
- "@graphcommerce/react-hook-form": "5.1.0-canary.4"
20
+ "@graphcommerce/ecommerce-ui": "5.1.0-canary.6",
21
+ "@graphcommerce/framer-utils": "5.1.0-canary.6",
22
+ "@graphcommerce/graphql": "5.1.0-canary.6",
23
+ "@graphcommerce/graphql-mesh": "5.1.0-canary.6",
24
+ "@graphcommerce/image": "5.1.0-canary.6",
25
+ "@graphcommerce/magento-graphql": "5.1.0-canary.6",
26
+ "@graphcommerce/magento-store": "5.1.0-canary.6",
27
+ "@graphcommerce/next-ui": "5.1.0-canary.6",
28
+ "@graphcommerce/react-hook-form": "5.1.0-canary.6"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@lingui/react": "^3.13.2",