@graphcommerce/graphcms-ui 6.1.1-canary.5 → 6.2.0-canary.7
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
|
+
## 6.2.0-canary.7
|
|
4
|
+
|
|
5
|
+
## 6.2.0-canary.6
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#1915](https://github.com/graphcommerce-org/graphcommerce/pull/1915) [`f4a8c3881`](https://github.com/graphcommerce-org/graphcommerce/commit/f4a8c388183e17c52e7f66536c5448749f494d7f) - Moved the injection of the links to plugins ([@paales](https://github.com/paales))
|
|
10
|
+
|
|
3
11
|
## 6.1.1-canary.5
|
|
4
12
|
|
|
5
13
|
## 6.1.1-canary.4
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphcms-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "6.
|
|
5
|
+
"version": "6.2.0-canary.7",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "6.
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "6.
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "6.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "6.2.0-canary.7",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.7",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "6.2.0-canary.7"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/graphql": "6.
|
|
21
|
-
"@graphcommerce/image": "6.
|
|
22
|
-
"@graphcommerce/next-ui": "6.
|
|
20
|
+
"@graphcommerce/graphql": "6.2.0-canary.7",
|
|
21
|
+
"@graphcommerce/image": "6.2.0-canary.7",
|
|
22
|
+
"@graphcommerce/next-ui": "6.2.0-canary.7"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@mui/material": "^5.10.16",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { graphqlConfig, setContext } from '@graphcommerce/graphql'
|
|
2
|
+
import type { MethodPlugin } from '@graphcommerce/next-config'
|
|
3
|
+
|
|
4
|
+
export const func = 'graphqlConfig'
|
|
5
|
+
export const exported = '@graphcommerce/graphql/config'
|
|
6
|
+
|
|
7
|
+
const hygraphGraphqlConfig: MethodPlugin<typeof graphqlConfig> = (prev, config) => {
|
|
8
|
+
const locales = config.storefront.hygraphLocales
|
|
9
|
+
|
|
10
|
+
if (!locales) return prev(config)
|
|
11
|
+
|
|
12
|
+
const hygraphLink = setContext((_, context) => {
|
|
13
|
+
if (!context.headers) context.headers = {}
|
|
14
|
+
context.headers['gcms-locales'] = locales.join(',')
|
|
15
|
+
return context
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
return prev({ ...config, links: [...(config.links ?? []), hygraphLink] })
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const plugin = hygraphGraphqlConfig
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { GraphQLProviderProps } from '@graphcommerce/graphql'
|
|
2
|
-
import type { PluginProps } from '@graphcommerce/next-config'
|
|
3
|
-
import { useMemo } from 'react'
|
|
4
|
-
import { createHygraphLink } from '../links/createHygraphLink'
|
|
5
|
-
|
|
6
|
-
export const component = 'GraphQLProvider'
|
|
7
|
-
export const exported = '@graphcommerce/graphql'
|
|
8
|
-
|
|
9
|
-
function HygraphGraphqlProvider(props: PluginProps<GraphQLProviderProps>) {
|
|
10
|
-
const { Prev, links = [], ...rest } = props
|
|
11
|
-
|
|
12
|
-
const hygraphLink = useMemo(() => createHygraphLink(rest.router.locale), [rest.router.locale])
|
|
13
|
-
return <Prev {...rest} links={[...links, hygraphLink]} />
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const Plugin = HygraphGraphqlProvider
|