@graphcommerce/magento-cart-email 3.0.23 → 3.0.27
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 +42 -0
- package/EmailForm/EmailForm.tsx +34 -73
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.0.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`d205b037f`](https://github.com/graphcommerce-org/graphcommerce/commit/d205b037fee82b8c03993f2c586f477e826093bf)]:
|
|
8
|
+
- @graphcommerce/magento-cart@4.4.1
|
|
9
|
+
- @graphcommerce/magento-customer@4.5.1
|
|
10
|
+
- @graphcommerce/magento-product@4.4.5
|
|
11
|
+
|
|
12
|
+
## 3.0.26
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`ffec8800a`](https://github.com/graphcommerce-org/graphcommerce/commit/ffec8800a50ff2fe9b9fc5feeb5a0a878b573f0e), [`bed806ddd`](https://github.com/graphcommerce-org/graphcommerce/commit/bed806dddd7e025806a69798ef9587aa165d392f)]:
|
|
17
|
+
- @graphcommerce/react-hook-form@3.2.1
|
|
18
|
+
- @graphcommerce/graphql@3.2.0
|
|
19
|
+
- @graphcommerce/magento-cart@4.4.0
|
|
20
|
+
- @graphcommerce/magento-customer@4.5.0
|
|
21
|
+
- @graphcommerce/magento-product@4.4.4
|
|
22
|
+
- @graphcommerce/magento-store@4.2.8
|
|
23
|
+
|
|
24
|
+
## 3.0.25
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`858a3b3a3`](https://github.com/graphcommerce-org/graphcommerce/commit/858a3b3a3601cd00491219daf45557c2f1cc804b)]:
|
|
29
|
+
- @graphcommerce/react-hook-form@3.2.0
|
|
30
|
+
- @graphcommerce/magento-cart@4.3.4
|
|
31
|
+
- @graphcommerce/magento-customer@4.4.2
|
|
32
|
+
- @graphcommerce/magento-product@4.4.3
|
|
33
|
+
|
|
34
|
+
## 3.0.24
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`c63ab89c2`](https://github.com/graphcommerce-org/graphcommerce/commit/c63ab89c20cb81d79188900d57f3d65a7bba71cc), [`238aa4d34`](https://github.com/graphcommerce-org/graphcommerce/commit/238aa4d3478773b8cb0973f4112c9829e59e16d6), [`afc67103d`](https://github.com/graphcommerce-org/graphcommerce/commit/afc67103d0e00583e274465036fd287537f95e79)]:
|
|
39
|
+
- @graphcommerce/magento-product@4.4.2
|
|
40
|
+
- @graphcommerce/magento-customer@4.4.1
|
|
41
|
+
- @graphcommerce/next-ui@4.8.3
|
|
42
|
+
- @graphcommerce/magento-cart@4.3.3
|
|
43
|
+
- @graphcommerce/magento-store@4.2.7
|
|
44
|
+
|
|
3
45
|
## 3.0.23
|
|
4
46
|
|
|
5
47
|
### Patch Changes
|
package/EmailForm/EmailForm.tsx
CHANGED
|
@@ -14,6 +14,7 @@ import { emailPattern, useFormCompose, UseFormComposeOptions } from '@graphcomme
|
|
|
14
14
|
import { Trans } from '@lingui/react'
|
|
15
15
|
import { CircularProgress, TextField, Typography, Alert, Button } from '@mui/material'
|
|
16
16
|
import { AnimatePresence } from 'framer-motion'
|
|
17
|
+
import PageLink from 'next/link'
|
|
17
18
|
import React, { useEffect, useState } from 'react'
|
|
18
19
|
import { CartEmailDocument } from './CartEmail.gql'
|
|
19
20
|
import { SetGuestEmailOnCartDocument } from './SetGuestEmailOnCart.gql'
|
|
@@ -28,12 +29,10 @@ const { classes } = extendableComponent(name, parts)
|
|
|
28
29
|
|
|
29
30
|
export function EmailForm(props: EmailFormProps) {
|
|
30
31
|
const { step, children } = props
|
|
31
|
-
const [expand, setExpand] = useState(false)
|
|
32
|
-
|
|
33
|
-
useMergeCustomerCart()
|
|
34
32
|
|
|
35
33
|
const [setGuestEmailOnCart] = useMutation(SetGuestEmailOnCartDocument)
|
|
36
34
|
const { data: cartData } = useCartQuery(CartEmailDocument)
|
|
35
|
+
|
|
37
36
|
const { mode, form, submit } = useFormIsEmailAvailable({ email: cartData?.cart?.email })
|
|
38
37
|
|
|
39
38
|
const { formState, muiRegister, required, watch, error, getValues } = form
|
|
@@ -57,80 +56,42 @@ export function EmailForm(props: EmailFormProps) {
|
|
|
57
56
|
|
|
58
57
|
if (mode === 'signin') {
|
|
59
58
|
endAdornment = (
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if (mode === 'signup') {
|
|
66
|
-
endAdornment = (
|
|
67
|
-
<Button color='secondary' style={{ whiteSpace: 'nowrap' }} onClick={() => setExpand(!expand)}>
|
|
68
|
-
{expand ? <Trans id='Close' /> : <Trans id='Create Account' />}
|
|
69
|
-
</Button>
|
|
59
|
+
<PageLink href='/account/signin' passHref>
|
|
60
|
+
<Button color='secondary' style={{ whiteSpace: 'nowrap' }}>
|
|
61
|
+
<Trans id='Sign in' />
|
|
62
|
+
</Button>
|
|
63
|
+
</PageLink>
|
|
70
64
|
)
|
|
71
65
|
}
|
|
72
66
|
if (formState.isSubmitting) endAdornment = <CircularProgress />
|
|
73
67
|
|
|
74
68
|
return (
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
</FormRow>
|
|
103
|
-
<ApolloCartErrorAlert error={error} />
|
|
104
|
-
</form>
|
|
105
|
-
</AnimatedRow>
|
|
106
|
-
|
|
107
|
-
{((mode === 'signin' && expand) || mode === 'session-expired') && (
|
|
108
|
-
<AnimatedRow key='signin-form-inline'>
|
|
109
|
-
<FormRow>
|
|
110
|
-
<SignInFormInline email={watch('email')} />
|
|
111
|
-
</FormRow>
|
|
112
|
-
</AnimatedRow>
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
{mode === 'signup' && expand && (
|
|
116
|
-
<AnimatedRow key='inline-signup'>
|
|
117
|
-
<SignUpFormInline key='signup-form-inline' email={watch('email')}>
|
|
118
|
-
{children}
|
|
119
|
-
</SignUpFormInline>
|
|
120
|
-
</AnimatedRow>
|
|
121
|
-
)}
|
|
122
|
-
|
|
123
|
-
{mode === 'session-expired' && (
|
|
124
|
-
<FormRow>
|
|
125
|
-
<Alert severity='error'>
|
|
126
|
-
<Trans id='You must sign in to continue' />
|
|
127
|
-
</Alert>
|
|
128
|
-
</FormRow>
|
|
129
|
-
)}
|
|
130
|
-
{children && mode !== 'session-expired' && ((mode !== 'signup' && expand) || !expand) && (
|
|
131
|
-
<AnimatedRow key='email-helperlist'>{children}</AnimatedRow>
|
|
132
|
-
)}
|
|
133
|
-
</AnimatePresence>
|
|
134
|
-
</FormDiv>
|
|
69
|
+
<form noValidate onSubmit={submit}>
|
|
70
|
+
<FormRow>
|
|
71
|
+
<Typography variant='h5' component='h2' gutterBottom>
|
|
72
|
+
<Trans id='Personal details' />
|
|
73
|
+
</Typography>
|
|
74
|
+
</FormRow>
|
|
75
|
+
<FormRow className={classes.formRow} sx={{ py: 0 }}>
|
|
76
|
+
<TextField
|
|
77
|
+
variant='outlined'
|
|
78
|
+
type='email'
|
|
79
|
+
error={formState.isSubmitted && !!formState.errors.email}
|
|
80
|
+
helperText={formState.isSubmitted && formState.errors.email?.message}
|
|
81
|
+
label={<Trans id='Email' />}
|
|
82
|
+
required={required.email}
|
|
83
|
+
{...muiRegister('email', {
|
|
84
|
+
required: required.email,
|
|
85
|
+
pattern: { value: emailPattern, message: '' },
|
|
86
|
+
})}
|
|
87
|
+
InputProps={{
|
|
88
|
+
autoComplete: 'email',
|
|
89
|
+
endAdornment,
|
|
90
|
+
readOnly: mode === 'signedin' || mode === 'session-expired',
|
|
91
|
+
}}
|
|
92
|
+
/>
|
|
93
|
+
</FormRow>
|
|
94
|
+
<ApolloCartErrorAlert error={error} />
|
|
95
|
+
</form>
|
|
135
96
|
)
|
|
136
97
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart-email",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.27",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"@playwright/test": "^1.21.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@graphcommerce/graphql": "3.
|
|
21
|
+
"@graphcommerce/graphql": "3.2.0",
|
|
22
22
|
"@graphcommerce/image": "3.1.6",
|
|
23
|
-
"@graphcommerce/magento-cart": "4.
|
|
24
|
-
"@graphcommerce/magento-customer": "4.
|
|
25
|
-
"@graphcommerce/magento-product": "4.4.
|
|
26
|
-
"@graphcommerce/magento-store": "4.2.
|
|
27
|
-
"@graphcommerce/next-ui": "4.8.
|
|
28
|
-
"@graphcommerce/react-hook-form": "3.1
|
|
23
|
+
"@graphcommerce/magento-cart": "4.4.1",
|
|
24
|
+
"@graphcommerce/magento-customer": "4.5.1",
|
|
25
|
+
"@graphcommerce/magento-product": "4.4.5",
|
|
26
|
+
"@graphcommerce/magento-store": "4.2.8",
|
|
27
|
+
"@graphcommerce/next-ui": "4.8.3",
|
|
28
|
+
"@graphcommerce/react-hook-form": "3.2.1"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@lingui/react": "^3.13.2",
|