@graphcommerce/docs 8.1.0-canary.41 → 8.1.0-canary.43

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
+ ## 8.1.0-canary.43
4
+
5
+ ## 8.1.0-canary.42
6
+
3
7
  ## 8.1.0-canary.41
4
8
 
5
9
  ### Patch Changes
@@ -181,6 +181,8 @@ Enable customer account deletion through the account section
181
181
 
182
182
  #### dataLayer: [DatalayerConfig](#DatalayerConfig)
183
183
 
184
+ Datalayer config
185
+
184
186
  #### debug: [GraphCommerceDebugConfig](#GraphCommerceDebugConfig)
185
187
 
186
188
  Debug configuration for GraphCommerce
@@ -0,0 +1,31 @@
1
+ # Preview mode
2
+
3
+ GraphCommerce implements Next.js' preview mode which allows you to view the
4
+ realtime data from Magento and Hygraph.
5
+
6
+ You can select whether to view Hygraph content in the DRAFT of PUBLISHED stage
7
+ (or other if configured).
8
+
9
+ You can Revalidate / Regenerate a page to make sure it is always up to date when
10
+ viewing.
11
+
12
+ It bypasses all caches from Next.js, Magento and Hygraph (this means that
13
+ Preview Mode is expdcted to be slower but does show your changes directly).
14
+
15
+ ## Accessing preview mode
16
+
17
+ To enter preview mode press `ALT + Backtick` (\`) on your keyboard. This will
18
+ open the preview mode toolbar on the bottom of the screen.
19
+
20
+ ![Toolbar requesting secret](https://github.com/graphcommerce-org/graphcommerce/assets/1244416/5064dbf0-e491-4d14-9c44-17754941d193)
21
+
22
+ Fill in the secret and press the chevron button to enter preview mode.
23
+
24
+ You are now greeted with the preview mode toolbar:
25
+
26
+ ![Scherm­afbeelding 2024-07-04 om 21 09 58](https://github.com/graphcommerce-org/graphcommerce/assets/1244416/f6a2224b-ad0a-429d-bd1b-ad924a3f81e5)
27
+
28
+ ## Enabling preview mode
29
+
30
+ Configure the `previewSecret` in your `graphcommerce.config.js` file to enable
31
+ preview mode.
@@ -43,8 +43,10 @@ data needed to render the layout (header, footer, menu etc.)
43
43
 
44
44
  export const getStaticProps: GetPageStaticProps = async ({ locale }) => {
45
45
  ...
46
-
47
- const layout = staticClient.query({ query: LayoutDocument, fetchPolicy: 'cache-first' })
46
+ const layout = staticClient.query({
47
+ query: LayoutDocument,
48
+ fetchPolicy: cacheFirst(staticClient),
49
+ })
48
50
 
49
51
  return {
50
52
  props: {
@@ -93,9 +93,9 @@ AboutUs.pageOptions = pageOptions
93
93
 
94
94
  export default AboutUs
95
95
 
96
- export const getStaticProps: GetPageStaticProps = async ({ locale }) => {
97
- const client = graphqlSharedClient(locale)
98
- const staticClient = graphqlSsrClient(locale)
96
+ export const getStaticProps: GetPageStaticProps = async (context) => {
97
+ const client = graphqlSharedClient(context)
98
+ const staticClient = graphqlSsrClient(context)
99
99
 
100
100
  const conf = client.query({ query: StoreConfigDocument })
101
101
  const layout = staticClient.query({
@@ -210,9 +210,9 @@ AboutUs.pageOptions = pageOptions
210
210
 
211
211
  export default AboutUs
212
212
 
213
- export const getStaticProps: GetPageStaticProps = async ({ locale }) => {
214
- const client = graphqlSharedClient(locale)
215
- const staticClient = graphqlSsrClient(locale)
213
+ export const getStaticProps: GetPageStaticProps = async (context) => {
214
+ const client = graphqlSharedClient(context)
215
+ const staticClient = graphqlSsrClient(context)
216
216
 
217
217
  const conf = client.query({ query: StoreConfigDocument })
218
218
  const page = hygraphPageContent(staticClient, 'about/about-us')
@@ -259,12 +259,10 @@ export const getStaticPaths: GetPageStaticPaths = (context) => ({
259
259
  fallback: 'blocking',
260
260
  })
261
261
 
262
- export const getStaticProps: GetPageStaticProps = async ({
263
- locale,
264
- params,
265
- }) => {
266
- const client = graphqlSharedClient(locale)
267
- const staticClient = graphqlSsrClient(locale)
262
+ export const getStaticProps: GetPageStaticProps = async (context) => {
263
+ const { params } = context
264
+ const client = graphqlSharedClient(context)
265
+ const staticClient = graphqlSsrClient(context)
268
266
 
269
267
  const conf = client.query({ query: StoreConfigDocument })
270
268
  const page = hygraphPageContent(staticClient, `about/${params?.url}`)
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "name": "@graphcommerce/docs",
3
3
  "homepage": "https://www.graphcommerce.org/docs",
4
4
  "repository": "github:graphcommerce-org/graphcommerce/docs",
5
- "version": "8.1.0-canary.41",
5
+ "version": "8.1.0-canary.43",
6
6
  "sideEffects": true,
7
7
  "peerDependencies": {
8
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.41"
8
+ "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.43"
9
9
  },
10
10
  "prettier": "@graphcommerce/prettier-config-pwa"
11
11
  }