@graphcommerce/graphcms-ui 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 CHANGED
@@ -1,5 +1,29 @@
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
+ ## 5.2.0-canary.16
12
+
13
+ ## 5.2.0-canary.15
14
+
15
+ ## 5.2.0-canary.14
16
+
17
+ ## 5.2.0-canary.13
18
+
19
+ ## 5.2.0-canary.12
20
+
21
+ ## 5.2.0-canary.11
22
+
23
+ ## 5.2.0-canary.10
24
+
25
+ ## 5.2.0-canary.9
26
+
3
27
  ## 5.2.0-canary.8
4
28
 
5
29
  ## 5.2.0-canary.7
@@ -0,0 +1,15 @@
1
+ extend input GraphCommerceConfig {
2
+ """
3
+ The HyGraph endpoint.
4
+
5
+ Project settings -> API Access -> High Performance Read-only Content API
6
+ """
7
+ hygraphEndpoint: String!
8
+ }
9
+
10
+ extend input GraphCommerceI18nConfig {
11
+ """
12
+ Add a gcms-locales header to make sure queries return in a certain language, can be an array to define fallbacks.
13
+ """
14
+ hygraphLocales: [String!]
15
+ }
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ ## Configuration
2
+
3
+ Configure the following ([configuration values](./Config.graphqls)) in your
4
+ graphcommerce.config.js
@@ -1,22 +1,13 @@
1
- import { ClientContext, setContext } from '@graphcommerce/graphql'
2
- import { defaultLocale } from '@graphcommerce/magento-store'
1
+ import { setContext } from '@graphcommerce/graphql'
2
+ import { i18nConfig } from '@graphcommerce/next-ui'
3
3
 
4
- /**
5
- * Add a gcms-locales header to make sure queries return in a certain language with a fallback to
6
- * defaultLocale().
7
- *
8
- * This will create a fallback list like: `nl_nl,nl,en_us,en`
9
- */
4
+ /** Add a gcms-locales header to make sure queries return in a certain language. */
10
5
  export const createHygraphLink = (locale?: string) =>
11
- setContext((_, context: ClientContext) => {
6
+ setContext((_, context) => {
12
7
  if (!context.headers) context.headers = {}
13
8
 
14
- const gcmsLocales = [
15
- locale?.replace('-', '_'),
16
- locale?.split('-')[0],
17
- defaultLocale().replace('-', '_'),
18
- defaultLocale().split('-')[0],
19
- ]
20
- context.headers['gcms-locales'] = gcmsLocales.filter(Boolean).join(',')
9
+ const locales = i18nConfig(locale)?.hygraphLocales
10
+ if (locales) context.headers['gcms-locales'] = locales.join(',')
11
+
21
12
  return context
22
13
  })
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": "5.2.0-canary.8",
5
+ "version": "6.0.0-canary.20",
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": "5.2.0-canary.8",
16
- "@graphcommerce/prettier-config-pwa": "5.2.0-canary.8",
17
- "@graphcommerce/typescript-config-pwa": "5.2.0-canary.8"
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/graphql": "5.2.0-canary.8",
21
- "@graphcommerce/image": "5.2.0-canary.8",
22
- "@graphcommerce/next-ui": "5.2.0-canary.8"
20
+ "@graphcommerce/graphql": "6.0.0-canary.20",
21
+ "@graphcommerce/image": "6.0.0-canary.20",
22
+ "@graphcommerce/next-ui": "6.0.0-canary.20"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@mui/material": "^5.10.16",