@graphcommerce/magento-customer 4.7.1 → 4.8.1
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 +43 -0
- package/components/CustomerMenuFabItem/CustomerMenuFabItem.tsx +1 -0
- package/components/SignOutForm/SignOutForm.tsx +3 -1
- package/hooks/useCustomerQuery.ts +3 -2
- package/hooks/useCustomerSession.ts +16 -17
- package/hooks/useFormIsEmailAvailable.tsx +1 -1
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1557](https://github.com/graphcommerce-org/graphcommerce/pull/1557) [`84428ccab`](https://github.com/graphcommerce-org/graphcommerce/commit/84428ccab8d1d263893766197076651eae68759c) Thanks [@paales](https://github.com/paales)! - Use WaitForQuery component to handle the loading state
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`01f1588c9`](https://github.com/graphcommerce-org/graphcommerce/commit/01f1588c9200bb39dd61146e260bfa2b32060612), [`c0a7f9427`](https://github.com/graphcommerce-org/graphcommerce/commit/c0a7f9427466f0a3886b2c3ebf2f0aa5d79ee081)]:
|
|
10
|
+
- @graphcommerce/graphql-mesh@4.1.6
|
|
11
|
+
- @graphcommerce/graphql@3.4.3
|
|
12
|
+
- @graphcommerce/ecommerce-ui@1.1.4
|
|
13
|
+
- @graphcommerce/magento-store@4.2.19
|
|
14
|
+
- @graphcommerce/magento-graphql@3.1.3
|
|
15
|
+
|
|
16
|
+
## 4.8.0
|
|
17
|
+
|
|
18
|
+
### Minor Changes
|
|
19
|
+
|
|
20
|
+
- [#1553](https://github.com/graphcommerce-org/graphcommerce/pull/1553) [`03d01c06c`](https://github.com/graphcommerce-org/graphcommerce/commit/03d01c06c6dc13df8d38ab5b40bd100c567a9e8d) Thanks [@NickdeK](https://github.com/NickdeK)! - Added a `{ hydrate: boolean }` option to `useCartQuery`, `useCurrentCartId`, `useCustomerQuery` and `useCustomerSession` to allow for data during the hydration phase. This can cause hydration warnings, but prevents an additional rerender.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`1afc6a547`](https://github.com/graphcommerce-org/graphcommerce/commit/1afc6a5473d6e31f47b5d0188801803b31865290), [`4a4579bb2`](https://github.com/graphcommerce-org/graphcommerce/commit/4a4579bb2f7da378f3fcc504405caf2560dc10f6), [`afcd8e4bf`](https://github.com/graphcommerce-org/graphcommerce/commit/afcd8e4bfb7010da4d5faeed85b61991ed7975f4), [`02e1988e5`](https://github.com/graphcommerce-org/graphcommerce/commit/02e1988e5f361c6f66ae30d3bbee38ef2ac062df), [`323fdee4b`](https://github.com/graphcommerce-org/graphcommerce/commit/323fdee4b15ae23e0e84dd0588cb2c6446dcfd50)]:
|
|
25
|
+
- @graphcommerce/graphql@3.4.2
|
|
26
|
+
- @graphcommerce/react-hook-form@3.3.1
|
|
27
|
+
- @graphcommerce/next-ui@4.14.0
|
|
28
|
+
- @graphcommerce/ecommerce-ui@1.1.3
|
|
29
|
+
- @graphcommerce/magento-graphql@3.1.2
|
|
30
|
+
- @graphcommerce/magento-store@4.2.18
|
|
31
|
+
|
|
32
|
+
## 4.7.2
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#1552](https://github.com/graphcommerce-org/graphcommerce/pull/1552) [`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce) Thanks [@paales](https://github.com/paales)! - Updated to Next.js v12.2.2 and other packages and made compatible
|
|
37
|
+
|
|
38
|
+
- Updated dependencies [[`18054c441`](https://github.com/graphcommerce-org/graphcommerce/commit/18054c441962ba750bed3acc39ab46c8d3a341ce), [`c5c539c44`](https://github.com/graphcommerce-org/graphcommerce/commit/c5c539c44eeac524cd62ce649e132d2e00333794), [`6f69bc54c`](https://github.com/graphcommerce-org/graphcommerce/commit/6f69bc54c6e0224452817c532ae58d9c332b61ea), [`21886d6fa`](https://github.com/graphcommerce-org/graphcommerce/commit/21886d6fa64a48d9e932bfaf8d138c9b13c36e43)]:
|
|
39
|
+
- @graphcommerce/graphql@3.4.1
|
|
40
|
+
- @graphcommerce/graphql-mesh@4.1.5
|
|
41
|
+
- @graphcommerce/next-ui@4.13.1
|
|
42
|
+
- @graphcommerce/ecommerce-ui@1.1.2
|
|
43
|
+
- @graphcommerce/magento-graphql@3.1.1
|
|
44
|
+
- @graphcommerce/magento-store@4.2.17
|
|
45
|
+
|
|
3
46
|
## 4.7.1
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|
|
@@ -5,7 +5,9 @@ import React from 'react'
|
|
|
5
5
|
import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
|
|
6
6
|
import { SignOutFormDocument } from './SignOutForm.gql'
|
|
7
7
|
|
|
8
|
-
type SignOutFormProps = {
|
|
8
|
+
type SignOutFormProps = {
|
|
9
|
+
button: (props: { formState: FormState<Record<string, unknown>> }) => React.ReactNode
|
|
10
|
+
}
|
|
9
11
|
|
|
10
12
|
export function SignOutForm(props: SignOutFormProps) {
|
|
11
13
|
const { button } = props
|
|
@@ -19,9 +19,10 @@ const notLoggedInError = new ApolloError({
|
|
|
19
19
|
/** Will only execute when the customer is signed in. */
|
|
20
20
|
export function useCustomerQuery<Q, V>(
|
|
21
21
|
document: TypedDocumentNode<Q, V>,
|
|
22
|
-
|
|
22
|
+
options: QueryHookOptions<Q, V> & { hydration?: boolean } = {},
|
|
23
23
|
): QueryResult<Q, V> {
|
|
24
|
-
const {
|
|
24
|
+
const { hydration, ...queryOptions } = options
|
|
25
|
+
const { loggedIn, called } = useCustomerSession({ hydration })
|
|
25
26
|
|
|
26
27
|
const result = useQuery(document, {
|
|
27
28
|
...queryOptions,
|
|
@@ -3,28 +3,27 @@ import { useQuery } from '@graphcommerce/graphql'
|
|
|
3
3
|
import { useState } from 'react'
|
|
4
4
|
import { CustomerTokenDocument, CustomerTokenQuery } from './CustomerToken.gql'
|
|
5
5
|
|
|
6
|
-
type
|
|
7
|
-
called: boolean
|
|
8
|
-
}
|
|
6
|
+
export type UseCustomerSessionOptions = { hydration?: boolean }
|
|
9
7
|
|
|
10
8
|
export type UseCustomerSessionReturn =
|
|
11
|
-
| Partial<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
9
|
+
| Partial<
|
|
10
|
+
Omit<NonNullable<CustomerTokenQuery['customerToken']>, '__typename'> & {
|
|
11
|
+
called: boolean
|
|
12
|
+
}
|
|
13
|
+
> & { loggedIn: boolean; requireAuth: boolean }
|
|
14
|
+
|
|
15
|
+
export function useCustomerSession(
|
|
16
|
+
options: UseCustomerSessionOptions = {},
|
|
17
|
+
): UseCustomerSessionReturn {
|
|
18
|
+
const { hydration = true } = options
|
|
19
|
+
const [hydrating, setHydrating] = useState(!hydration)
|
|
20
|
+
useIsomorphicLayoutEffect(() => setHydrating(false), [])
|
|
21
|
+
const skip = hydrating
|
|
22
|
+
|
|
23
|
+
const { called, data } = useQuery(CustomerTokenDocument, { skip })
|
|
21
24
|
|
|
22
25
|
const token = data?.customerToken
|
|
23
26
|
|
|
24
|
-
useIsomorphicLayoutEffect(() => {
|
|
25
|
-
if (skip) setSkip(false)
|
|
26
|
-
}, [skip])
|
|
27
|
-
|
|
28
27
|
if (!token) return { called, loggedIn: false, requireAuth: true }
|
|
29
28
|
|
|
30
29
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useFormAutoSubmit, useFormGqlQuery
|
|
1
|
+
import { useFormAutoSubmit, useFormGqlQuery } from '@graphcommerce/react-hook-form'
|
|
2
2
|
import { useEffect, useState } from 'react'
|
|
3
3
|
import { CustomerDocument } from './Customer.gql'
|
|
4
4
|
import { IsEmailAvailableDocument } from './IsEmailAvailable.gql'
|
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": "4.
|
|
5
|
+
"version": "4.8.1",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,22 +12,22 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.9",
|
|
16
16
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "^4.0.
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "^4.0.4",
|
|
18
18
|
"@playwright/test": "^1.21.1",
|
|
19
19
|
"type-fest": "^2.12.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@graphcommerce/ecommerce-ui": "1.1.
|
|
22
|
+
"@graphcommerce/ecommerce-ui": "1.1.4",
|
|
23
23
|
"@graphcommerce/framer-utils": "3.1.4",
|
|
24
|
-
"@graphcommerce/graphql": "3.4.
|
|
25
|
-
"@graphcommerce/graphql-mesh": "4.1.
|
|
24
|
+
"@graphcommerce/graphql": "3.4.3",
|
|
25
|
+
"@graphcommerce/graphql-mesh": "4.1.6",
|
|
26
26
|
"@graphcommerce/image": "3.1.7",
|
|
27
|
-
"@graphcommerce/magento-graphql": "3.1.
|
|
28
|
-
"@graphcommerce/magento-store": "4.2.
|
|
29
|
-
"@graphcommerce/next-ui": "4.
|
|
30
|
-
"@graphcommerce/react-hook-form": "3.3.
|
|
27
|
+
"@graphcommerce/magento-graphql": "3.1.3",
|
|
28
|
+
"@graphcommerce/magento-store": "4.2.19",
|
|
29
|
+
"@graphcommerce/next-ui": "4.14.0",
|
|
30
|
+
"@graphcommerce/react-hook-form": "3.3.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@lingui/react": "^3.13.2",
|