@graphcommerce/graphcms-ui 6.2.0-canary.7 → 6.2.0-canary.71
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 +136 -0
- package/Config.graphqls +2 -0
- package/components/index.ts +2 -0
- package/graphql/HygraphAllPages.graphql +5 -0
- package/graphql/HygraphPage.graphql +16 -0
- package/graphql/HygraphPages.graphql +7 -0
- package/graphql/PageLink.graphql +10 -0
- package/graphql/PagesStaticPaths.graphql +6 -0
- package/graphql/index.ts +5 -0
- package/index.ts +3 -2
- package/lib/hygraphPageContent.ts +48 -0
- package/lib/index.ts +1 -0
- package/package.json +7 -7
- package/plugins/hygraphGraphqlConfig.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,141 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.2.0-canary.71
|
|
4
|
+
|
|
5
|
+
## 6.2.0-canary.70
|
|
6
|
+
|
|
7
|
+
## 6.2.0-canary.69
|
|
8
|
+
|
|
9
|
+
## 6.2.0-canary.68
|
|
10
|
+
|
|
11
|
+
## 6.2.0-canary.67
|
|
12
|
+
|
|
13
|
+
## 6.2.0-canary.66
|
|
14
|
+
|
|
15
|
+
## 6.2.0-canary.65
|
|
16
|
+
|
|
17
|
+
## 6.2.0-canary.64
|
|
18
|
+
|
|
19
|
+
## 6.2.0-canary.63
|
|
20
|
+
|
|
21
|
+
## 6.2.0-canary.62
|
|
22
|
+
|
|
23
|
+
## 6.2.0-canary.61
|
|
24
|
+
|
|
25
|
+
## 6.2.0-canary.60
|
|
26
|
+
|
|
27
|
+
## 6.2.0-canary.59
|
|
28
|
+
|
|
29
|
+
## 6.2.0-canary.58
|
|
30
|
+
|
|
31
|
+
## 6.2.0-canary.57
|
|
32
|
+
|
|
33
|
+
## 6.2.0-canary.56
|
|
34
|
+
|
|
35
|
+
## 6.2.0-canary.55
|
|
36
|
+
|
|
37
|
+
## 6.2.0-canary.54
|
|
38
|
+
|
|
39
|
+
## 6.2.0-canary.53
|
|
40
|
+
|
|
41
|
+
## 6.2.0-canary.52
|
|
42
|
+
|
|
43
|
+
## 6.2.0-canary.51
|
|
44
|
+
|
|
45
|
+
## 6.2.0-canary.50
|
|
46
|
+
|
|
47
|
+
### Minor Changes
|
|
48
|
+
|
|
49
|
+
- [`e55d8c390`](https://github.com/graphcommerce-org/graphcommerce/commit/e55d8c390d90b4bb7bab11c6a99027ac72bd7e3e) - Created a new sidebar layout system, can be configured with productFiltersLayout in the graphcommerce.config.js ([@paales](https://github.com/paales))
|
|
50
|
+
|
|
51
|
+
## 6.2.0-canary.49
|
|
52
|
+
|
|
53
|
+
## 6.2.0-canary.48
|
|
54
|
+
|
|
55
|
+
## 6.2.0-canary.47
|
|
56
|
+
|
|
57
|
+
## 6.2.0-canary.46
|
|
58
|
+
|
|
59
|
+
## 6.2.0-canary.45
|
|
60
|
+
|
|
61
|
+
## 6.2.0-canary.44
|
|
62
|
+
|
|
63
|
+
## 6.2.0-canary.43
|
|
64
|
+
|
|
65
|
+
## 6.2.0-canary.42
|
|
66
|
+
|
|
67
|
+
## 6.2.0-canary.41
|
|
68
|
+
|
|
69
|
+
## 6.2.0-canary.40
|
|
70
|
+
|
|
71
|
+
## 6.2.0-canary.39
|
|
72
|
+
|
|
73
|
+
## 6.2.0-canary.38
|
|
74
|
+
|
|
75
|
+
## 6.2.0-canary.37
|
|
76
|
+
|
|
77
|
+
## 6.2.0-canary.36
|
|
78
|
+
|
|
79
|
+
## 6.2.0-canary.35
|
|
80
|
+
|
|
81
|
+
## 6.2.0-canary.34
|
|
82
|
+
|
|
83
|
+
## 6.2.0-canary.33
|
|
84
|
+
|
|
85
|
+
## 6.2.0-canary.32
|
|
86
|
+
|
|
87
|
+
## 6.2.0-canary.31
|
|
88
|
+
|
|
89
|
+
## 6.2.0-canary.30
|
|
90
|
+
|
|
91
|
+
## 6.2.0-canary.29
|
|
92
|
+
|
|
93
|
+
## 6.2.0-canary.28
|
|
94
|
+
|
|
95
|
+
## 6.2.0-canary.27
|
|
96
|
+
|
|
97
|
+
## 6.2.0-canary.26
|
|
98
|
+
|
|
99
|
+
## 6.2.0-canary.25
|
|
100
|
+
|
|
101
|
+
## 6.2.0-canary.24
|
|
102
|
+
|
|
103
|
+
## 6.2.0-canary.23
|
|
104
|
+
|
|
105
|
+
## 6.2.0-canary.22
|
|
106
|
+
|
|
107
|
+
## 6.2.0-canary.21
|
|
108
|
+
|
|
109
|
+
## 6.2.0-canary.20
|
|
110
|
+
|
|
111
|
+
## 6.2.0-canary.19
|
|
112
|
+
|
|
113
|
+
## 6.2.0-canary.18
|
|
114
|
+
|
|
115
|
+
## 6.2.0-canary.17
|
|
116
|
+
|
|
117
|
+
## 6.2.0-canary.16
|
|
118
|
+
|
|
119
|
+
## 6.2.0-canary.15
|
|
120
|
+
|
|
121
|
+
## 6.2.0-canary.14
|
|
122
|
+
|
|
123
|
+
## 6.2.0-canary.13
|
|
124
|
+
|
|
125
|
+
## 6.2.0-canary.12
|
|
126
|
+
|
|
127
|
+
## 6.2.0-canary.11
|
|
128
|
+
|
|
129
|
+
## 6.2.0-canary.10
|
|
130
|
+
|
|
131
|
+
## 6.2.0-canary.9
|
|
132
|
+
|
|
133
|
+
## 6.2.0-canary.8
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- [#1912](https://github.com/graphcommerce-org/graphcommerce/pull/1912) [`a43d389e9`](https://github.com/graphcommerce-org/graphcommerce/commit/a43d389e956fe69b73238b12c98c781b7044e4bb) - Added dynamic rows feature and better performance for Hygraph ([@JoshuaS98](https://github.com/JoshuaS98))
|
|
138
|
+
|
|
3
139
|
## 6.2.0-canary.7
|
|
4
140
|
|
|
5
141
|
## 6.2.0-canary.6
|
package/Config.graphqls
CHANGED
package/graphql/index.ts
ADDED
package/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
2
|
+
import { HygraphAllPagesDocument, HygraphPagesQuery, HygraphPagesDocument } from '../graphql'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fetch the page content for the given urls.
|
|
6
|
+
*
|
|
7
|
+
* - Uses an early bailout to check to reduce hygraph calls.
|
|
8
|
+
* - Implements an alias sytem to merge the content of multiple pages.
|
|
9
|
+
*/
|
|
10
|
+
async function pageContent(
|
|
11
|
+
client: ApolloClient<NormalizedCacheObject>,
|
|
12
|
+
url: string,
|
|
13
|
+
cached: boolean,
|
|
14
|
+
): Promise<{ data: HygraphPagesQuery }> {
|
|
15
|
+
/**
|
|
16
|
+
* Some routes are very generic and wil be requested very often, like 'product/global'. To reduce
|
|
17
|
+
* the amount of requests to Hygraph we can cache the result of the query if requested.
|
|
18
|
+
*
|
|
19
|
+
* This only works in a persistent nodejs environment and doesn't work in a serverless
|
|
20
|
+
* environment, because those instances get discarded.
|
|
21
|
+
*
|
|
22
|
+
* This comes with a downside, if the page is updated the cache will not be invalidated, resulting
|
|
23
|
+
* in stale data.
|
|
24
|
+
*
|
|
25
|
+
* Todo: Implement next.js 13 fetch revalidation:
|
|
26
|
+
* https://beta.nextjs.org/docs/data-fetching/fetching#revalidating-data
|
|
27
|
+
*/
|
|
28
|
+
const alwaysCache = process.env.NODE_ENV !== 'development' ? 'cache-first' : undefined
|
|
29
|
+
const fetchPolicy = cached ? alwaysCache : undefined
|
|
30
|
+
|
|
31
|
+
const allRoutes = await client.query({ query: HygraphAllPagesDocument, fetchPolicy: alwaysCache })
|
|
32
|
+
|
|
33
|
+
// Only do the query when there the page is found in the allRoutes
|
|
34
|
+
const found = allRoutes.data.pages.some((page) => page.url === url)
|
|
35
|
+
|
|
36
|
+
return found
|
|
37
|
+
? client.query({ query: HygraphPagesDocument, variables: { url }, fetchPolicy })
|
|
38
|
+
: Promise.resolve({ data: { pages: [] } })
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function hygraphPageContent(
|
|
42
|
+
client: ApolloClient<NormalizedCacheObject>,
|
|
43
|
+
url: string,
|
|
44
|
+
additionalProperties?: Promise<object> | object,
|
|
45
|
+
cached = false,
|
|
46
|
+
): Promise<{ data: HygraphPagesQuery }> {
|
|
47
|
+
return pageContent(client, url, cached)
|
|
48
|
+
}
|
package/lib/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hygraphPageContent'
|
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.2.0-canary.
|
|
5
|
+
"version": "6.2.0-canary.71",
|
|
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.2.0-canary.
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "6.2.0-canary.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "6.2.0-canary.71",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.71",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "6.2.0-canary.71"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/graphql": "6.2.0-canary.
|
|
21
|
-
"@graphcommerce/image": "6.2.0-canary.
|
|
22
|
-
"@graphcommerce/next-ui": "6.2.0-canary.
|
|
20
|
+
"@graphcommerce/graphql": "6.2.0-canary.71",
|
|
21
|
+
"@graphcommerce/image": "6.2.0-canary.71",
|
|
22
|
+
"@graphcommerce/next-ui": "6.2.0-canary.71"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@mui/material": "^5.10.16",
|
|
@@ -5,6 +5,8 @@ export const func = 'graphqlConfig'
|
|
|
5
5
|
export const exported = '@graphcommerce/graphql/config'
|
|
6
6
|
|
|
7
7
|
const hygraphGraphqlConfig: MethodPlugin<typeof graphqlConfig> = (prev, config) => {
|
|
8
|
+
const results = prev(config)
|
|
9
|
+
|
|
8
10
|
const locales = config.storefront.hygraphLocales
|
|
9
11
|
|
|
10
12
|
if (!locales) return prev(config)
|
|
@@ -15,7 +17,7 @@ const hygraphGraphqlConfig: MethodPlugin<typeof graphqlConfig> = (prev, config)
|
|
|
15
17
|
return context
|
|
16
18
|
})
|
|
17
19
|
|
|
18
|
-
return
|
|
20
|
+
return { ...results, links: [...results.links, hygraphLink] }
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export const plugin = hygraphGraphqlConfig
|