@graphcommerce/magento-customer 10.0.1-canary.0 → 10.0.1-canary.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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.1-canary.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2571](https://github.com/graphcommerce-org/graphcommerce/pull/2571) [`78a2a8a`](https://github.com/graphcommerce-org/graphcommerce/commit/78a2a8a919346e1f9bccddf7e52682f4adb9a4e0) - Solve issue where the @client fields could not be resolved correctly. ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
- [#2571](https://github.com/graphcommerce-org/graphcommerce/pull/2571) [`0146abe`](https://github.com/graphcommerce-org/graphcommerce/commit/0146abe0d8362a09b48af42db12f8a0e7670ff8d) - Created a new GuestOrCustomerMask to show information based on their loggedIn state respecting the masking of private content. ([@paales](https://github.com/paales))
|
|
10
|
+
|
|
3
11
|
## 10.0.1-canary.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { usePrivateQueryMask } from '@graphcommerce/graphql'
|
|
2
|
+
import { cssFlag, cssNotFlag } from '@graphcommerce/next-ui'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
4
|
+
import { useCustomerSession } from '../../hooks/useCustomerSession'
|
|
5
|
+
|
|
6
|
+
export type CustomerGuestMaskProps = {
|
|
7
|
+
/** Allowed to pass null */
|
|
8
|
+
loggedOut: React.ReactNode
|
|
9
|
+
/** Allowed to pass null */
|
|
10
|
+
loggedIn: React.ReactNode
|
|
11
|
+
/** Allowed to pass null */
|
|
12
|
+
skeleton: React.ReactNode
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function GuestOrCustomerMask(props: CustomerGuestMaskProps) {
|
|
16
|
+
const { loggedOut: loggedOutContent, loggedIn: loggedInContent, skeleton } = props
|
|
17
|
+
const { mask } = usePrivateQueryMask()
|
|
18
|
+
const { loggedIn } = useCustomerSession()
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
{mask && loggedOutContent && (
|
|
23
|
+
<Box
|
|
24
|
+
sx={{
|
|
25
|
+
display: 'contents',
|
|
26
|
+
'&:empty': { display: 'none' },
|
|
27
|
+
[cssFlag('private-query')]: { display: 'none' },
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{loggedOutContent}
|
|
31
|
+
</Box>
|
|
32
|
+
)}
|
|
33
|
+
<Box
|
|
34
|
+
sx={{
|
|
35
|
+
display: 'contents',
|
|
36
|
+
'&:empty': { display: 'none' },
|
|
37
|
+
[cssNotFlag('private-query')]: { display: 'none' },
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{mask ? skeleton : loggedIn ? loggedInContent : loggedOutContent}
|
|
41
|
+
</Box>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
}
|
package/components/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from './DeleteCustomerAddressForm/DeleteCustomerAddressForm'
|
|
|
28
28
|
export * from './EditAddressForm/EditAddressForm'
|
|
29
29
|
export * from './ForgotPasswordForm/ForgotPassword.gql'
|
|
30
30
|
export * from './ForgotPasswordForm/ForgotPasswordForm'
|
|
31
|
+
export * from './GuestOrCustomerMask/GuestOrCustomerMask'
|
|
31
32
|
export * from './GuestOrderOverview/GuestOrderOverviewForm'
|
|
32
33
|
export * from './Invoice'
|
|
33
34
|
export * from './NameFields/NameFields'
|
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": "10.0.1-canary.
|
|
5
|
+
"version": "10.0.1-canary.1",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"./plugins/magentoCustomerPrivateQueryContext": "./plugins/magentoCustomerPrivateQueryContext.ts"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@graphcommerce/ecommerce-ui": "^10.0.1-canary.
|
|
25
|
-
"@graphcommerce/eslint-config-pwa": "^10.0.1-canary.
|
|
26
|
-
"@graphcommerce/framer-next-pages": "^10.0.1-canary.
|
|
27
|
-
"@graphcommerce/framer-utils": "^10.0.1-canary.
|
|
28
|
-
"@graphcommerce/graphql": "^10.0.1-canary.
|
|
29
|
-
"@graphcommerce/graphql-mesh": "^10.0.1-canary.
|
|
30
|
-
"@graphcommerce/image": "^10.0.1-canary.
|
|
31
|
-
"@graphcommerce/magento-graphql": "^10.0.1-canary.
|
|
32
|
-
"@graphcommerce/magento-store": "^10.0.1-canary.
|
|
33
|
-
"@graphcommerce/next-config": "^10.0.1-canary.
|
|
34
|
-
"@graphcommerce/next-ui": "^10.0.1-canary.
|
|
35
|
-
"@graphcommerce/prettier-config-pwa": "^10.0.1-canary.
|
|
36
|
-
"@graphcommerce/react-hook-form": "^10.0.1-canary.
|
|
37
|
-
"@graphcommerce/typescript-config-pwa": "^10.0.1-canary.
|
|
24
|
+
"@graphcommerce/ecommerce-ui": "^10.0.1-canary.1",
|
|
25
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.1-canary.1",
|
|
26
|
+
"@graphcommerce/framer-next-pages": "^10.0.1-canary.1",
|
|
27
|
+
"@graphcommerce/framer-utils": "^10.0.1-canary.1",
|
|
28
|
+
"@graphcommerce/graphql": "^10.0.1-canary.1",
|
|
29
|
+
"@graphcommerce/graphql-mesh": "^10.0.1-canary.1",
|
|
30
|
+
"@graphcommerce/image": "^10.0.1-canary.1",
|
|
31
|
+
"@graphcommerce/magento-graphql": "^10.0.1-canary.1",
|
|
32
|
+
"@graphcommerce/magento-store": "^10.0.1-canary.1",
|
|
33
|
+
"@graphcommerce/next-config": "^10.0.1-canary.1",
|
|
34
|
+
"@graphcommerce/next-ui": "^10.0.1-canary.1",
|
|
35
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.1-canary.1",
|
|
36
|
+
"@graphcommerce/react-hook-form": "^10.0.1-canary.1",
|
|
37
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.1-canary.1",
|
|
38
38
|
"@lingui/core": "^5",
|
|
39
39
|
"@lingui/macro": "^5",
|
|
40
40
|
"@lingui/react": "^5",
|
package/typePolicies.ts
CHANGED
|
@@ -37,6 +37,12 @@ const generateCustomerToken: FieldPolicy<Mutation['generateCustomerToken']> = {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const customerTypePolicies: StrictTypedTypePolicies = {
|
|
40
|
+
Query: {
|
|
41
|
+
fields: {
|
|
42
|
+
// https://github.com/apollographql/apollo-client/issues/12930
|
|
43
|
+
customerToken: { merge: (existing, incoming) => incoming ?? existing },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
40
46
|
Mutation: { fields: { generateCustomerToken } },
|
|
41
47
|
}
|
|
42
48
|
|