@graphcommerce/magento-customer 6.0.1-canary.2 → 6.0.1-canary.3

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,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.1-canary.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1855](https://github.com/graphcommerce-org/graphcommerce/pull/1855) [`0f789d3be`](https://github.com/graphcommerce-org/graphcommerce/commit/0f789d3be1aa6d724bd98bceee092e1da6701915) - Added registration email validation to inline registration form. ([@mikekeehnen](https://github.com/mikekeehnen))
8
+
3
9
  ## 6.0.1-canary.2
4
10
 
5
11
  ## 6.0.1-canary.1
@@ -13,7 +13,7 @@ import { SignUpConfirmDocument } from './SignUpConfirm.gql'
13
13
 
14
14
  type SignUpFormProps = { email: string }
15
15
 
16
- const requireEmailValidation = process.env.BUILD_FLAG_CUSTOMER_REQUIRE_EMAIL_CONFIRMATION === '1'
16
+ const requireEmailValidation = import.meta.graphCommerce.customerRequireEmailConfirmation ?? false
17
17
 
18
18
  export function SignUpForm(props: SignUpFormProps) {
19
19
  const { email } = props
@@ -4,9 +4,10 @@ import { Button, extendableComponent, Form, FormRow } from '@graphcommerce/next-
4
4
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
5
5
  import { i18n } from '@lingui/core'
6
6
  import { Trans } from '@lingui/react'
7
- import { Box, TextField } from '@mui/material'
7
+ import { Alert, Box, TextField } from '@mui/material'
8
8
  import React from 'react'
9
9
  import { SignUpMutationVariables, SignUpMutation, SignUpDocument } from './SignUp.gql'
10
+ import { SignUpConfirmDocument } from './SignUpConfirm.gql'
10
11
 
11
12
  type SignUpFormInlineProps = Pick<SignUpMutationVariables, 'email'> & {
12
13
  children?: React.ReactNode
@@ -22,6 +23,8 @@ const { classes } = extendableComponent('SignUpFormInline', [
22
23
  'buttonContainer',
23
24
  ] as const)
24
25
 
26
+ const requireEmailValidation = import.meta.graphCommerce.customerRequireEmailConfirmation ?? false
27
+
25
28
  export function SignUpFormInline({
26
29
  email,
27
30
  children,
@@ -29,10 +32,12 @@ export function SignUpFormInline({
29
32
  lastname,
30
33
  onSubmitted = () => {},
31
34
  }: SignUpFormInlineProps) {
35
+ const Mutation = requireEmailValidation ? SignUpConfirmDocument : SignUpDocument
36
+
32
37
  const form = useFormGqlMutation<
33
38
  SignUpMutation,
34
39
  SignUpMutationVariables & { confirmPassword?: string }
35
- >(SignUpDocument, {
40
+ >(Mutation, {
36
41
  // todo(paales): This causes dirty data to be send to the backend.
37
42
  defaultValues: {
38
43
  email,
@@ -51,6 +56,14 @@ export function SignUpFormInline({
51
56
  useQuery(StoreConfigDocument).data?.storeConfig?.minimum_password_length ?? 8,
52
57
  )
53
58
 
59
+ if (requireEmailValidation && form.formState.isSubmitSuccessful) {
60
+ return (
61
+ <Alert>
62
+ <Trans id='Please check your inbox to validate your email ({email})' values={{ email }} />
63
+ </Alert>
64
+ )
65
+ }
66
+
54
67
  return (
55
68
  <Form onSubmit={submitHandler} noValidate className={classes.form} sx={{ padding: 0 }}>
56
69
  <FormRow key='inline-signup' className={classes.row} sx={{ padding: 0 }}>
@@ -84,9 +97,7 @@ export function SignUpFormInline({
84
97
  required: true,
85
98
  validate: (value) => value === watchPassword,
86
99
  })}
87
- helperText={
88
- !!formState.errors.confirmPassword && <Trans id="Passwords should match" />
89
- }
100
+ helperText={!!formState.errors.confirmPassword && <Trans id='Passwords should match' />}
90
101
  disabled={formState.isSubmitting}
91
102
  />
92
103
  </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": "6.0.1-canary.2",
5
+ "version": "6.0.1-canary.3",
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": "6.0.1-canary.2",
16
- "@graphcommerce/prettier-config-pwa": "6.0.1-canary.2",
17
- "@graphcommerce/typescript-config-pwa": "6.0.1-canary.2"
15
+ "@graphcommerce/eslint-config-pwa": "6.0.1-canary.3",
16
+ "@graphcommerce/prettier-config-pwa": "6.0.1-canary.3",
17
+ "@graphcommerce/typescript-config-pwa": "6.0.1-canary.3"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/ecommerce-ui": "6.0.1-canary.2",
21
- "@graphcommerce/framer-utils": "6.0.1-canary.2",
22
- "@graphcommerce/graphql": "6.0.1-canary.2",
23
- "@graphcommerce/graphql-mesh": "6.0.1-canary.2",
24
- "@graphcommerce/image": "6.0.1-canary.2",
25
- "@graphcommerce/magento-graphql": "6.0.1-canary.2",
26
- "@graphcommerce/magento-store": "6.0.1-canary.2",
27
- "@graphcommerce/next-ui": "6.0.1-canary.2",
28
- "@graphcommerce/react-hook-form": "6.0.1-canary.2"
20
+ "@graphcommerce/ecommerce-ui": "6.0.1-canary.3",
21
+ "@graphcommerce/framer-utils": "6.0.1-canary.3",
22
+ "@graphcommerce/graphql": "6.0.1-canary.3",
23
+ "@graphcommerce/graphql-mesh": "6.0.1-canary.3",
24
+ "@graphcommerce/image": "6.0.1-canary.3",
25
+ "@graphcommerce/magento-graphql": "6.0.1-canary.3",
26
+ "@graphcommerce/magento-store": "6.0.1-canary.3",
27
+ "@graphcommerce/next-ui": "6.0.1-canary.3",
28
+ "@graphcommerce/react-hook-form": "6.0.1-canary.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@lingui/react": "^3.13.2",