@graphcommerce/magento-customer 9.1.0-canary.49 → 9.1.0-canary.51

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,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.51
4
+
5
+ ## 9.1.0-canary.50
6
+
3
7
  ## 9.1.0-canary.49
4
8
 
5
9
  ## 9.1.0-canary.48
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": "9.1.0-canary.49",
5
+ "version": "9.1.0-canary.51",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,19 +12,19 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^9.1.0-canary.49",
16
- "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.49",
17
- "@graphcommerce/framer-next-pages": "^9.1.0-canary.49",
18
- "@graphcommerce/framer-utils": "^9.1.0-canary.49",
19
- "@graphcommerce/graphql": "^9.1.0-canary.49",
20
- "@graphcommerce/graphql-mesh": "^9.1.0-canary.49",
21
- "@graphcommerce/image": "^9.1.0-canary.49",
22
- "@graphcommerce/magento-graphql": "^9.1.0-canary.49",
23
- "@graphcommerce/magento-store": "^9.1.0-canary.49",
24
- "@graphcommerce/next-ui": "^9.1.0-canary.49",
25
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.49",
26
- "@graphcommerce/react-hook-form": "^9.1.0-canary.49",
27
- "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.49",
15
+ "@graphcommerce/ecommerce-ui": "^9.1.0-canary.51",
16
+ "@graphcommerce/eslint-config-pwa": "^9.1.0-canary.51",
17
+ "@graphcommerce/framer-next-pages": "^9.1.0-canary.51",
18
+ "@graphcommerce/framer-utils": "^9.1.0-canary.51",
19
+ "@graphcommerce/graphql": "^9.1.0-canary.51",
20
+ "@graphcommerce/graphql-mesh": "^9.1.0-canary.51",
21
+ "@graphcommerce/image": "^9.1.0-canary.51",
22
+ "@graphcommerce/magento-graphql": "^9.1.0-canary.51",
23
+ "@graphcommerce/magento-store": "^9.1.0-canary.51",
24
+ "@graphcommerce/next-ui": "^9.1.0-canary.51",
25
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.51",
26
+ "@graphcommerce/react-hook-form": "^9.1.0-canary.51",
27
+ "@graphcommerce/typescript-config-pwa": "^9.1.0-canary.51",
28
28
  "@lingui/core": "^4.2.1",
29
29
  "@lingui/macro": "^4.2.1",
30
30
  "@lingui/react": "^4.2.1",
@@ -1,7 +1,9 @@
1
1
  import {
2
+ type getPrivateQueryContextMesh as getPrivateQueryContextMeshType,
2
3
  type getPrivateQueryContext as getPrivateQueryContextType,
3
4
  type usePrivateQueryContext as usePrivateQueryContextType,
4
5
  } from '@graphcommerce/graphql'
6
+ import type { PrivateContext } from '@graphcommerce/graphql-mesh'
5
7
  import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
6
8
  import { CustomerTokenDocument } from '../hooks/CustomerToken.gql'
7
9
  import { useCustomerSession } from '../hooks/useCustomerSession'
@@ -11,6 +13,16 @@ export const config: PluginConfig = {
11
13
  module: '@graphcommerce/graphql',
12
14
  }
13
15
 
16
+ export const getPrivateQueryContextMesh: FunctionPlugin<typeof getPrivateQueryContextMeshType> = (
17
+ prev,
18
+ context,
19
+ ) => {
20
+ const loggedIn = !!context.headers?.authorization
21
+ const res = prev(context)
22
+ if (!loggedIn) return res
23
+ return { ...res, loggedIn: true } satisfies PrivateContext
24
+ }
25
+
14
26
  export const getPrivateQueryContext: FunctionPlugin<typeof getPrivateQueryContextType> = (
15
27
  prev,
16
28
  client,
@@ -19,7 +31,6 @@ export const getPrivateQueryContext: FunctionPlugin<typeof getPrivateQueryContex
19
31
  const loggedIn = !!client.cache.readQuery({ query: CustomerTokenDocument })?.customerToken?.token
20
32
  const res = prev(client, ...args)
21
33
  if (!loggedIn) return res
22
-
23
34
  return { ...res, loggedIn: true }
24
35
  }
25
36
 
@@ -30,9 +41,5 @@ export const usePrivateQueryContext: FunctionPlugin<typeof usePrivateQueryContex
30
41
  const { loggedIn } = useCustomerSession()
31
42
  const res = prev(...args)
32
43
  if (!loggedIn) return res
33
-
34
- return {
35
- ...res,
36
- loggedIn: true,
37
- }
44
+ return { ...res, loggedIn: true }
38
45
  }