@graphcommerce/magento-customer 5.2.0-canary.8 → 6.0.0-canary.20
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 +28 -0
- package/Config.graphqls +11 -0
- package/README.md +6 -0
- package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +5 -8
- package/components/SignUpForm/SignUpForm.tsx +1 -1
- package/components/SignUpForm/SignUpFormInline.tsx +5 -3
- package/hooks/useCustomerQuery.ts +8 -2
- package/hooks/useGuestQuery.ts +7 -2
- package/link/createCustomerTokenLink.ts +3 -8
- package/link/onAuthenticationError.ts +2 -1
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.0.0-canary.20
|
|
4
|
+
|
|
5
|
+
## 5.2.0-canary.19
|
|
6
|
+
|
|
7
|
+
## 5.2.0-canary.18
|
|
8
|
+
|
|
9
|
+
## 5.2.0-canary.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1801](https://github.com/graphcommerce-org/graphcommerce/pull/1801) [`12263d608`](https://github.com/graphcommerce-org/graphcommerce/commit/12263d6080c1e550985a42f140ffa9d95d0b0335) - Add sign up form translations ([@StefanAngenent](https://github.com/StefanAngenent))
|
|
14
|
+
|
|
15
|
+
## 5.2.0-canary.16
|
|
16
|
+
|
|
17
|
+
## 5.2.0-canary.15
|
|
18
|
+
|
|
19
|
+
## 5.2.0-canary.14
|
|
20
|
+
|
|
21
|
+
## 5.2.0-canary.13
|
|
22
|
+
|
|
23
|
+
## 5.2.0-canary.12
|
|
24
|
+
|
|
25
|
+
## 5.2.0-canary.11
|
|
26
|
+
|
|
27
|
+
## 5.2.0-canary.10
|
|
28
|
+
|
|
29
|
+
## 5.2.0-canary.9
|
|
30
|
+
|
|
3
31
|
## 5.2.0-canary.8
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/Config.graphqls
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
extend input GraphCommerceConfig {
|
|
2
|
+
"""
|
|
3
|
+
Due to a limitation in the GraphQL API of Magento 2, we need to know if the
|
|
4
|
+
customer requires email confirmation.
|
|
5
|
+
|
|
6
|
+
This value should match Magento 2's configuration value for
|
|
7
|
+
`customer/create_account/confirm` and should be removed once we can query
|
|
8
|
+
"""
|
|
9
|
+
customerRequireEmailConfirmation: Boolean
|
|
10
|
+
# @deprecated(reason: "Should be replaced with a Magento configuration instead.")
|
|
11
|
+
}
|
package/README.md
ADDED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ApolloCustomerErrorAlert,
|
|
3
|
-
SignInForm,
|
|
4
|
-
SignUpForm,
|
|
5
|
-
useFormIsEmailAvailable,
|
|
6
|
-
CustomerDocument,
|
|
7
|
-
} from '@graphcommerce/magento-customer'
|
|
8
|
-
import { useCustomerQuery } from '@graphcommerce/magento-customer/hooks'
|
|
9
1
|
import {
|
|
10
2
|
Button,
|
|
11
3
|
FormDiv,
|
|
@@ -18,6 +10,11 @@ import { emailPattern } from '@graphcommerce/react-hook-form'
|
|
|
18
10
|
import { Trans } from '@lingui/react'
|
|
19
11
|
import { Box, CircularProgress, Link, SxProps, TextField, Theme, Typography } from '@mui/material'
|
|
20
12
|
import router from 'next/router'
|
|
13
|
+
import { CustomerDocument, useFormIsEmailAvailable } from '../../hooks'
|
|
14
|
+
import { useCustomerQuery } from '../../hooks/useCustomerQuery'
|
|
15
|
+
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError'
|
|
16
|
+
import { SignInForm } from '../SignInForm/SignInForm'
|
|
17
|
+
import { SignUpForm } from '../SignUpForm/SignUpForm'
|
|
21
18
|
|
|
22
19
|
export type AccountSignInUpFormProps = { sx?: SxProps<Theme> }
|
|
23
20
|
|
|
@@ -13,7 +13,7 @@ import { SignUpConfirmDocument } from './SignUpConfirm.gql'
|
|
|
13
13
|
|
|
14
14
|
type SignUpFormProps = { email: string }
|
|
15
15
|
|
|
16
|
-
const requireEmailValidation = process.env.
|
|
16
|
+
const requireEmailValidation = process.env.BUILD_FLAG_CUSTOMER_REQUIRE_EMAIL_CONFIRMATION === '1'
|
|
17
17
|
|
|
18
18
|
export function SignUpForm(props: SignUpFormProps) {
|
|
19
19
|
const { email } = props
|
|
@@ -77,14 +77,16 @@ export function SignUpFormInline({
|
|
|
77
77
|
variant='outlined'
|
|
78
78
|
type='password'
|
|
79
79
|
error={!!formState.errors.confirmPassword || !!error?.message}
|
|
80
|
-
label='Confirm password'
|
|
80
|
+
label={<Trans id='Confirm password' />}
|
|
81
81
|
autoComplete='new-password'
|
|
82
82
|
required
|
|
83
83
|
{...muiRegister('confirmPassword', {
|
|
84
84
|
required: true,
|
|
85
85
|
validate: (value) => value === watchPassword,
|
|
86
86
|
})}
|
|
87
|
-
helperText={
|
|
87
|
+
helperText={
|
|
88
|
+
!!formState.errors.confirmPassword && <Trans id="Passwords should match" />
|
|
89
|
+
}
|
|
88
90
|
disabled={formState.isSubmitting}
|
|
89
91
|
/>
|
|
90
92
|
</FormRow>
|
|
@@ -108,7 +110,7 @@ export function SignUpFormInline({
|
|
|
108
110
|
color='secondary'
|
|
109
111
|
variant='pill'
|
|
110
112
|
>
|
|
111
|
-
Create Account
|
|
113
|
+
<Trans id='Create Account' />
|
|
112
114
|
</Button>
|
|
113
115
|
</Box>
|
|
114
116
|
</FormRow>
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useQuery,
|
|
3
|
+
TypedDocumentNode,
|
|
4
|
+
QueryHookOptions,
|
|
5
|
+
QueryResult,
|
|
6
|
+
OperationVariables,
|
|
7
|
+
} from '@graphcommerce/graphql'
|
|
2
8
|
import { useCustomerSession } from './useCustomerSession'
|
|
3
9
|
|
|
4
10
|
/** Will only execute when the customer is signed in. */
|
|
5
|
-
export function useCustomerQuery<Q, V>(
|
|
11
|
+
export function useCustomerQuery<Q, V extends OperationVariables>(
|
|
6
12
|
document: TypedDocumentNode<Q, V>,
|
|
7
13
|
options: QueryHookOptions<Q, V> & { hydration?: boolean } = {},
|
|
8
14
|
): QueryResult<Q, V> {
|
package/hooks/useGuestQuery.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
useQuery,
|
|
3
|
+
TypedDocumentNode,
|
|
4
|
+
QueryHookOptions,
|
|
5
|
+
OperationVariables,
|
|
6
|
+
} from '@graphcommerce/graphql'
|
|
2
7
|
import { useCustomerSession } from './useCustomerSession'
|
|
3
8
|
|
|
4
9
|
/** Will only execute when the customer is not signed in. */
|
|
5
|
-
export function useGuestQuery<Q, V>(
|
|
10
|
+
export function useGuestQuery<Q, V extends OperationVariables>(
|
|
6
11
|
document: TypedDocumentNode<Q, V>,
|
|
7
12
|
queryOptions: QueryHookOptions<Q, V> & { hydration?: boolean } = {},
|
|
8
13
|
) {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
ApolloLink,
|
|
4
|
-
ClientContext,
|
|
5
|
-
NormalizedCacheObject,
|
|
6
|
-
setContext,
|
|
7
|
-
} from '@graphcommerce/graphql'
|
|
1
|
+
import { NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
2
|
+
import { ApolloLink, ApolloCache, setContext } from '@graphcommerce/graphql/apollo'
|
|
8
3
|
import { CustomerTokenDocument } from '../hooks'
|
|
9
4
|
import { onAuthorizationError } from './onAuthenticationError'
|
|
10
5
|
|
|
11
|
-
export const addTokenHeader = setContext((_, context
|
|
6
|
+
export const addTokenHeader = setContext((_, context) => {
|
|
12
7
|
if (!context.headers) context.headers = {}
|
|
13
8
|
try {
|
|
14
9
|
const query = context.cache.readQuery({ query: CustomerTokenDocument })
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { InMemoryCache
|
|
1
|
+
import { InMemoryCache } from '@graphcommerce/graphql'
|
|
2
|
+
import { onError } from '@graphcommerce/graphql/apollo'
|
|
2
3
|
import { CustomerTokenDocument } from '../hooks/CustomerToken.gql'
|
|
3
4
|
|
|
4
5
|
function invalidateToken(cache: InMemoryCache) {
|
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
|
+
"version": "6.0.0-canary.20",
|
|
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": "
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "6.0.0-canary.20",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.20",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "6.0.0-canary.20"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/ecommerce-ui": "
|
|
21
|
-
"@graphcommerce/framer-utils": "
|
|
22
|
-
"@graphcommerce/graphql": "
|
|
23
|
-
"@graphcommerce/graphql-mesh": "
|
|
24
|
-
"@graphcommerce/image": "
|
|
25
|
-
"@graphcommerce/magento-graphql": "
|
|
26
|
-
"@graphcommerce/magento-store": "
|
|
27
|
-
"@graphcommerce/next-ui": "
|
|
28
|
-
"@graphcommerce/react-hook-form": "
|
|
20
|
+
"@graphcommerce/ecommerce-ui": "6.0.0-canary.20",
|
|
21
|
+
"@graphcommerce/framer-utils": "6.0.0-canary.20",
|
|
22
|
+
"@graphcommerce/graphql": "6.0.0-canary.20",
|
|
23
|
+
"@graphcommerce/graphql-mesh": "6.0.0-canary.20",
|
|
24
|
+
"@graphcommerce/image": "6.0.0-canary.20",
|
|
25
|
+
"@graphcommerce/magento-graphql": "6.0.0-canary.20",
|
|
26
|
+
"@graphcommerce/magento-store": "6.0.0-canary.20",
|
|
27
|
+
"@graphcommerce/next-ui": "6.0.0-canary.20",
|
|
28
|
+
"@graphcommerce/react-hook-form": "6.0.0-canary.20"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@lingui/react": "^3.13.2",
|