@graphcommerce/docs 5.2.0-canary.9 → 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 +26 -0
- package/framework/config.md +198 -0
- package/framework/graphcms.md +15 -15
- package/framework/plugins-react.md +3 -3
- package/framework/readme.md +5 -5
- package/getting-started/create.md +14 -15
- package/getting-started/graphcms-component.md +10 -10
- package/getting-started/pages.md +12 -12
- package/getting-started/readme.md +9 -7
- package/package.json +2 -2
- package/readme.md +1 -1
- package/roadmap.md +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.0.0-canary.20
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1786](https://github.com/graphcommerce-org/graphcommerce/pull/1786) [`26239ef73`](https://github.com/graphcommerce-org/graphcommerce/commit/26239ef73e49731224b227f1eb850dde56d40584) - Bumped minimum version to node16 ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
## 5.2.0-canary.19
|
|
10
|
+
|
|
11
|
+
## 5.2.0-canary.18
|
|
12
|
+
|
|
13
|
+
## 5.2.0-canary.17
|
|
14
|
+
|
|
15
|
+
## 5.2.0-canary.16
|
|
16
|
+
|
|
17
|
+
## 5.2.0-canary.15
|
|
18
|
+
|
|
19
|
+
## 5.2.0-canary.14
|
|
20
|
+
|
|
21
|
+
## 5.2.0-canary.13
|
|
22
|
+
|
|
23
|
+
## 5.2.0-canary.12
|
|
24
|
+
|
|
25
|
+
## 5.2.0-canary.11
|
|
26
|
+
|
|
27
|
+
## 5.2.0-canary.10
|
|
28
|
+
|
|
3
29
|
## 5.2.0-canary.9
|
|
4
30
|
|
|
5
31
|
## 5.2.0-canary.8
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
<!-- auto generated -->
|
|
2
|
+
## GraphCommerceConfig
|
|
3
|
+
|
|
4
|
+
Global GraphCommerce configuration can be configured in your `graphcommerce.config.js` file in the root of your project.
|
|
5
|
+
|
|
6
|
+
### `canonicalBaseUrl: String!`
|
|
7
|
+
|
|
8
|
+
The canonical base URL is used for SEO purposes.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
- https://example.com
|
|
12
|
+
- https://example.com/en
|
|
13
|
+
- https://example.com/en-US
|
|
14
|
+
|
|
15
|
+
### `hygraphEndpoint: String!`
|
|
16
|
+
|
|
17
|
+
The HyGraph endpoint.
|
|
18
|
+
|
|
19
|
+
Project settings -> API Access -> High Performance Read-only Content API
|
|
20
|
+
|
|
21
|
+
### `i18n: [GraphCommerceI18nConfig!]!`
|
|
22
|
+
|
|
23
|
+
All i18n configuration for the project
|
|
24
|
+
|
|
25
|
+
### `magentoEndpoint: String!`
|
|
26
|
+
|
|
27
|
+
GraphQL Magento endpoint.
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
- https://magento2.test/graphql
|
|
31
|
+
|
|
32
|
+
### `productFiltersPro: Boolean!`
|
|
33
|
+
|
|
34
|
+
Product filters with better UI for mobile and desktop.
|
|
35
|
+
|
|
36
|
+
@experimental This is an experimental feature and may change in the future.
|
|
37
|
+
|
|
38
|
+
### `robotsAllow: Boolean!`
|
|
39
|
+
|
|
40
|
+
Allow the site to be indexed by search engines.
|
|
41
|
+
If false, the robots.txt file will be set to disallow all.
|
|
42
|
+
|
|
43
|
+
### `singleProductRoute: Boolean!`
|
|
44
|
+
|
|
45
|
+
On older versions of GraphCommerce products would use a product type specific route.
|
|
46
|
+
|
|
47
|
+
This should only be set to false if you use the /product/[url] or /product/configurable/[url] routes.
|
|
48
|
+
|
|
49
|
+
### `cartDisplayPricesInclTax: Boolean`
|
|
50
|
+
|
|
51
|
+
Due to a limitation of the GraphQL API it is not possible to determine if a cart should be displayed including or excluding tax.
|
|
52
|
+
|
|
53
|
+
When Magento's StoreConfig adds this value, this can be replaced.
|
|
54
|
+
|
|
55
|
+
### `customerRequireEmailConfirmation: Boolean`
|
|
56
|
+
|
|
57
|
+
Due to a limitation in the GraphQL API of Magento 2, we need to know if the
|
|
58
|
+
customer requires email confirmation.
|
|
59
|
+
|
|
60
|
+
This value should match Magento 2's configuration value for
|
|
61
|
+
`customer/create_account/confirm` and should be removed once we can query
|
|
62
|
+
|
|
63
|
+
### `debug: GraphCommerceDebugConfig`
|
|
64
|
+
|
|
65
|
+
Debug configuration for GraphCommerce
|
|
66
|
+
|
|
67
|
+
### `demoMode: Boolean`
|
|
68
|
+
|
|
69
|
+
Enables some demo specific code that is probably not useful for a project:
|
|
70
|
+
|
|
71
|
+
- Adds the "BY GC" to the product list items.
|
|
72
|
+
- Adds "dominant_color" attribute swatches to the product list items.
|
|
73
|
+
- Creates a big list items in the product list.
|
|
74
|
+
|
|
75
|
+
### `deployEnvironment: DeployEnvironment`
|
|
76
|
+
|
|
77
|
+
Environment GraphCommerce is deployed to.
|
|
78
|
+
|
|
79
|
+
Not to be confused with NODE_ENV: which will always be 'production' when running `next build`.
|
|
80
|
+
|
|
81
|
+
### `googleAnalyticsId: String`
|
|
82
|
+
|
|
83
|
+
See https://support.google.com/analytics/answer/9539598?hl=en
|
|
84
|
+
|
|
85
|
+
Provide a value to enable Google Analytics for your store.
|
|
86
|
+
|
|
87
|
+
To enable only for a specific locale, override the value in the i18n config.
|
|
88
|
+
|
|
89
|
+
### `googleRecaptchaKey: String`
|
|
90
|
+
|
|
91
|
+
Google reCAPTCHA key, get from https://developers.google.com/recaptcha/docs/v3
|
|
92
|
+
|
|
93
|
+
This value is required even if you are configuring different values for each locale.
|
|
94
|
+
|
|
95
|
+
### `googleTagmanagerId: String`
|
|
96
|
+
|
|
97
|
+
The Google Tagmanager ID to be used on the site.
|
|
98
|
+
|
|
99
|
+
This value is required even if you are configuring different values for each locale.
|
|
100
|
+
|
|
101
|
+
### `previewSecret: String`
|
|
102
|
+
|
|
103
|
+
To enable next.js' preview mode, configure the secret you'd like to use.
|
|
104
|
+
|
|
105
|
+
### `wishlistHideForGuests: Boolean`
|
|
106
|
+
|
|
107
|
+
Hide the wishlist functionality for guests.
|
|
108
|
+
|
|
109
|
+
### `wishlistIgnoreProductWishlistStatus: Boolean`
|
|
110
|
+
|
|
111
|
+
Ignores wether a product is already in the wishlist, makes the toggle an add only.
|
|
112
|
+
|
|
113
|
+
## GraphCommerceDebugConfig
|
|
114
|
+
|
|
115
|
+
Debug configuration for GraphCommerce
|
|
116
|
+
|
|
117
|
+
### `pluginStatus: Boolean`
|
|
118
|
+
|
|
119
|
+
Reports which plugins are enabled or disabled.
|
|
120
|
+
|
|
121
|
+
### `webpackCircularDependencyPlugin: Boolean`
|
|
122
|
+
|
|
123
|
+
Cyclic dependencies can cause memory issues and other strange bugs.
|
|
124
|
+
This plugin will warn you when it detects a cyclic dependency.
|
|
125
|
+
|
|
126
|
+
When running into memory issues, it can be useful to enable this plugin.
|
|
127
|
+
|
|
128
|
+
### `webpackDuplicatesPlugin: Boolean`
|
|
129
|
+
|
|
130
|
+
When updating packages it can happen that the same package is included with different versions in the same project.
|
|
131
|
+
|
|
132
|
+
Issues that this can cause are:
|
|
133
|
+
- The same package is included multiple times in the bundle, increasing the bundle size.
|
|
134
|
+
- The Typescript types of the package are not compatible with each other, causing Typescript errors.
|
|
135
|
+
|
|
136
|
+
## GraphCommerceI18nConfig
|
|
137
|
+
|
|
138
|
+
All i18n configuration for the project
|
|
139
|
+
|
|
140
|
+
### `locale: String!`
|
|
141
|
+
|
|
142
|
+
Must be a locale string https://www.unicode.org/reports/tr35/tr35-59/tr35.html#Identifiers
|
|
143
|
+
|
|
144
|
+
### `magentoStoreCode: String!`
|
|
145
|
+
|
|
146
|
+
Magento store code.
|
|
147
|
+
|
|
148
|
+
Stores => All Stores => [Store View] => Store View Code
|
|
149
|
+
|
|
150
|
+
Examples:
|
|
151
|
+
- default
|
|
152
|
+
- en-us
|
|
153
|
+
- b2b-us
|
|
154
|
+
|
|
155
|
+
### `canonicalBaseUrl: String`
|
|
156
|
+
|
|
157
|
+
The canonical base URL is used for SEO purposes.
|
|
158
|
+
|
|
159
|
+
Examples:
|
|
160
|
+
- https://example.com
|
|
161
|
+
- https://example.com/en
|
|
162
|
+
- https://example.com/en-US
|
|
163
|
+
|
|
164
|
+
### `cartDisplayPricesInclTax: Boolean`
|
|
165
|
+
|
|
166
|
+
Due to a limitation of the GraphQL API it is not possible to determine if a cart should be displayed including or excluding tax.
|
|
167
|
+
|
|
168
|
+
### `defaultLocale: Boolean`
|
|
169
|
+
|
|
170
|
+
There can only be one entry with defaultLocale set to true.
|
|
171
|
+
- If there are more, the first one is used.
|
|
172
|
+
- If there is none, the first entry is used.
|
|
173
|
+
|
|
174
|
+
### `domain: String`
|
|
175
|
+
|
|
176
|
+
Domain configuration, must be a domain https://tools.ietf.org/html/rfc3986
|
|
177
|
+
|
|
178
|
+
### `googleAnalyticsId: String`
|
|
179
|
+
|
|
180
|
+
Configure different Google Analytics IDs for different locales.
|
|
181
|
+
|
|
182
|
+
To disable for a specific locale, set the value to null.
|
|
183
|
+
|
|
184
|
+
### `googleRecaptchaKey: String`
|
|
185
|
+
|
|
186
|
+
Locale specific google reCAPTCHA key.
|
|
187
|
+
|
|
188
|
+
### `googleTagmanagerId: String`
|
|
189
|
+
|
|
190
|
+
The Google Tagmanager ID to be used per locale.
|
|
191
|
+
|
|
192
|
+
### `hygraphLocales: [String!]`
|
|
193
|
+
|
|
194
|
+
Add a gcms-locales header to make sure queries return in a certain language, can be an array to define fallbacks.
|
|
195
|
+
|
|
196
|
+
### `linguiLocale: String`
|
|
197
|
+
|
|
198
|
+
Specify a custom locale for to load translations.
|
package/framework/graphcms.md
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
---
|
|
2
|
-
menu:
|
|
2
|
+
menu: Hygraph
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# Hygraph
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Hygraph is integrated as a Content Management System. It is used to store all
|
|
8
8
|
static content and provides a user-friendly interface for managing it.
|
|
9
9
|
|
|
10
10
|
The [magento-graphcms example](./../getting-started/readme.md) offers a number
|
|
11
11
|
of components to render this content in different ways, for example in the form
|
|
12
12
|
of a page-wide hero banner, a list of USPs or grid of text columns.
|
|
13
13
|
|
|
14
|
-
This guide covers how to configure
|
|
15
|
-
by adding
|
|
14
|
+
This guide covers how to configure Hygraph and how to build rich content pages
|
|
15
|
+
by adding Hygraph content to pages.
|
|
16
16
|
|
|
17
17
|
## Configuration
|
|
18
18
|
|
|
19
|
-
To connect your GraphCommerce app to your
|
|
20
|
-
|
|
21
|
-
[Clone the demo
|
|
19
|
+
To connect your GraphCommerce app to your Hygraph project, you'll need a Hygraph
|
|
20
|
+
project with the required schema.
|
|
21
|
+
[Clone the demo Hygraph project ↗](https://app.graphcms.com/clone/caddaa93cfa9436a9e76ae9c0F34d257)
|
|
22
22
|
as your starting point. Update the variable in the /.env file:
|
|
23
23
|
|
|
24
24
|
`GRAPHCMS_URL=""`
|
|
25
|
-
|
|
25
|
+
Hygraph API URL. Once logged in, copy it from Project Settings > Api Access >
|
|
26
26
|
Content API
|
|
27
27
|
|
|
28
28
|
## Adding content to pages
|
|
@@ -33,15 +33,15 @@ the concept of pages. When a file is added to the /pages directory, it's
|
|
|
33
33
|
automatically available as a route. Magento category routes are handled by the
|
|
34
34
|
`/pages/[...url].tsx` page.
|
|
35
35
|
|
|
36
|
-
To add
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
To add Hygraph content to, for example, a category page, create a Page entry in
|
|
37
|
+
Hygraph and match the value of the URL field with the route of the page you wish
|
|
38
|
+
to add content to.
|
|
39
39
|
|
|
40
|
-
For example, the content of the 'men' Page entry in
|
|
40
|
+
For example, the content of the 'men' Page entry in Hygraph:
|
|
41
41
|
|
|
42
42
|
<figure>
|
|
43
43
|
|
|
44
|
-

|
|
45
45
|
|
|
46
46
|
</figure>
|
|
47
47
|
|
|
@@ -64,4 +64,4 @@ Is used to add a`RowProduct (variant:Grid)` and a
|
|
|
64
64
|
## Next steps
|
|
65
65
|
|
|
66
66
|
- Learn how to
|
|
67
|
-
[build a custom
|
|
67
|
+
[build a custom Hygraph component](../getting-started/graphcms-component.md)
|
|
@@ -171,11 +171,11 @@ work for other things such as:
|
|
|
171
171
|
|
|
172
172
|
### Conditionally include a plugin
|
|
173
173
|
|
|
174
|
-
Provide an
|
|
175
|
-
|
|
174
|
+
Provide an ifConfig export in the plugin that will only include the plugin if a
|
|
175
|
+
configuration value is truety.
|
|
176
176
|
|
|
177
177
|
```tsx
|
|
178
|
-
export const
|
|
178
|
+
export const ifConfig = 'googleAnalytics'
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
### When to use a plugin?
|
package/framework/readme.md
CHANGED
|
@@ -16,15 +16,15 @@ high-end e-commerce progressive web apps (PWA).
|
|
|
16
16
|
| [Static generation](../framework/static-generation.md) | [Theming](../framework/theming.md) | [Translations](../framework/translations.md) |
|
|
17
17
|
| [Environment Variables](../framework/environment-variables.md) | [Typography](../framework/typography.md) | [Troubleshooting](../framework/troubleshooting.md) |
|
|
18
18
|
| [Deployment](../framework/deployment.md) | [Favicon](../framework/favicon.md) | [SEO](../framework/seo.md) |
|
|
19
|
-
| [
|
|
19
|
+
| [Hygraph](../framework/graphcms.md) | [Icons](../framework//icons.md) | |
|
|
20
20
|
|
|
21
21
|
## GraphCommerce project structure
|
|
22
22
|
|
|
23
23
|
When you create a GraphCommerce app, the GraphCommerce
|
|
24
24
|
[magento-graphcms example](../getting-started/readme.md) comes with a basic file
|
|
25
|
-
structure of a GraphCommerce project that's integrated with Magento and
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
structure of a GraphCommerce project that's integrated with Magento and Hygraph.
|
|
26
|
+
Most of the files that you'll work within your GraphCommerce project are located
|
|
27
|
+
in the /components or /pages directories.
|
|
28
28
|
|
|
29
29
|
- A minimal set of components you would most likely modify for your project
|
|
30
30
|
- The main layout component, which renders header, navigation, and footer
|
|
@@ -40,7 +40,7 @@ File structure of the graphcommerce-magento example
|
|
|
40
40
|
└── Layout
|
|
41
41
|
└── Footer.tsx
|
|
42
42
|
└── LayoutFull.tsx
|
|
43
|
-
└──
|
|
43
|
+
└── Hygraph
|
|
44
44
|
└── Asset
|
|
45
45
|
└── RowHeroBanner
|
|
46
46
|
└── RowQuote
|
|
@@ -38,18 +38,17 @@ After you've finished this tutorial, you'll have accomplished the following:
|
|
|
38
38
|
You've familiarized yourself with
|
|
39
39
|
[React ↗](https://reactjs.org/docs/getting-started.html),
|
|
40
40
|
[Next.js ↗](https://nextjs.org/docs/getting-started), and
|
|
41
|
-
[Mui ↗](https://mui.com/getting-started/
|
|
42
|
-
front-end React framework that uses Next.js for server-side rendering.
|
|
41
|
+
[Mui ↗](https://mui.com/material-ui/getting-started/overview/). GraphCommerce is
|
|
42
|
+
a front-end React framework that uses Next.js for server-side rendering.
|
|
43
43
|
|
|
44
44
|
### Install dependencies
|
|
45
45
|
|
|
46
46
|
If you want to test a GraphCommerce storefront using a pre-configured Magento
|
|
47
|
-
demo store and a pre-configured
|
|
48
|
-
|
|
47
|
+
demo store and a pre-configured Hygraph project with demo content, then you need
|
|
48
|
+
to only install the dependencies. This is the quickest approach.
|
|
49
49
|
|
|
50
|
-
- Install and use node
|
|
51
|
-
- Install yarn: `corepack enable`
|
|
52
|
-
`npm install --global yarn` (for node 14)
|
|
50
|
+
- Install and use node 16/18: `nvm install 16` or `nvm use 16`
|
|
51
|
+
- Install yarn: `corepack enable`
|
|
53
52
|
|
|
54
53
|
## Step 1: Create a new GraphCommerce app
|
|
55
54
|
|
|
@@ -75,27 +74,27 @@ https://user-images.githubusercontent.com/1251986/158647122-dc57002f-a9c2-4661-a
|
|
|
75
74
|
5. `cp -R .env.example .env` — create .env file
|
|
76
75
|
6. `rm CHANGELOG.md` — remove changelog
|
|
77
76
|
|
|
78
|
-
## Step 2: Magento and
|
|
77
|
+
## Step 2: Magento and Hygraph API keys
|
|
79
78
|
|
|
80
79
|
> By default, the .env file is configured with API keys from a demo Magento
|
|
81
|
-
> store and a demo
|
|
80
|
+
> store and a demo Hygraph project. If you want to test your GraphCommerce app
|
|
82
81
|
> using the demo store, then you can start the development environment. Only
|
|
83
82
|
> proceed with the following steps if you want to develop a GraphCommerce
|
|
84
|
-
> storefront using your own Magento store and/or
|
|
83
|
+
> storefront using your own Magento store and/or Hygraph project.
|
|
85
84
|
|
|
86
85
|
### Requirements
|
|
87
86
|
|
|
88
87
|
To order to be able to connect your GraphCommerce app to your Magento backend
|
|
89
|
-
and/or
|
|
88
|
+
and/or Hygraph project, you'll need:
|
|
90
89
|
|
|
91
90
|
- Magento 2.4.3 - Clean install, a production or a development environment
|
|
92
|
-
-
|
|
93
|
-
[Clone the demo
|
|
91
|
+
- Hygraph - A Hygraph project with the required schema.
|
|
92
|
+
[Clone the demo Hygraph project ↗](https://app.graphcms.com/clone/caddaa93cfa9436a9e76ae9c0F34d257)
|
|
94
93
|
as your starting point.
|
|
95
94
|
|
|
96
95
|
### Configuration
|
|
97
96
|
|
|
98
|
-
To connect your GraphCommerce app to your Magento backend and/or
|
|
97
|
+
To connect your GraphCommerce app to your Magento backend and/or Hygraph
|
|
99
98
|
project, you need to update variables in the /.env file. The .env file contains
|
|
100
99
|
useful information about your storefront.
|
|
101
100
|
|
|
@@ -106,7 +105,7 @@ Magento 2 API URL, located at `http://<magento2-server>/graphql`.
|
|
|
106
105
|
Comma-separated list of image domains. Add media.graphcms.com as default.
|
|
107
106
|
|
|
108
107
|
`GRAPHCMS_URL=""`
|
|
109
|
-
|
|
108
|
+
Hygraph API URL. Once logged in, copy it from Project Settings > Api Access >
|
|
110
109
|
Content API
|
|
111
110
|
|
|
112
111
|
`NEXT_PUBLIC_LOCALE_STORES='{"en-us": "default", "en-ca": "canada"}'`
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
menu: 5. Build a
|
|
3
|
-
metaTitle: Build a
|
|
2
|
+
menu: 5. Build a Hygraph component
|
|
3
|
+
metaTitle: Build a Hygraph component
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Build a
|
|
6
|
+
# Build a Hygraph component
|
|
7
7
|
|
|
8
8
|
Previously, you created a GraphCommerce app and started building a custom
|
|
9
|
-
header. You're now ready to build a
|
|
9
|
+
header. You're now ready to build a Hygraph component.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Hygraph is the integrated Content Management System that is part of the
|
|
12
12
|
[magento-graphcms example](../getting-started/readme.md).
|
|
13
13
|
|
|
14
14
|
In this tutorial, you'll accomplish a series of tasks to add some specific
|
|
@@ -17,7 +17,7 @@ you'll learn where to find resources to build more complex features on your own.
|
|
|
17
17
|
|
|
18
18
|
### After you've finished this tutorial, you'll have accomplished the following:
|
|
19
19
|
|
|
20
|
-
- Create a Model in
|
|
20
|
+
- Create a Model in Hygraph, called Banner
|
|
21
21
|
- Configure the Model's copy and image field
|
|
22
22
|
- Define the relationship between the Banner Model and Page Content field
|
|
23
23
|
- Write a GraphQL query fragment and add it to the page query
|
|
@@ -33,9 +33,9 @@ frontend React framework that uses Next.js for server-side rendering.
|
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
|
-
### Create the
|
|
36
|
+
### Create the Hygraph model
|
|
37
37
|
|
|
38
|
-
- Login to
|
|
38
|
+
- Login to Hygraph, navigate to the Schema and add a new Model called "Banner"
|
|
39
39
|
- Add a single line text field called "Identity" and configure the following:
|
|
40
40
|
|
|
41
41
|
<figure>
|
|
@@ -240,9 +240,9 @@ const defaultRenderer: Partial<ContentTypeRenderer> = {
|
|
|
240
240
|
|
|
241
241
|
<figure>
|
|
242
242
|
|
|
243
|
-

|
|
244
244
|
|
|
245
|
-
<figcaption>An instance of the banner component rendering with content from
|
|
245
|
+
<figcaption>An instance of the banner component rendering with content from Hygraph</figcaption>
|
|
246
246
|
</figure>
|
|
247
247
|
|
|
248
248
|
<figure>
|
package/getting-started/pages.md
CHANGED
|
@@ -17,7 +17,7 @@ learn where to find resources to build more complex features on your own.
|
|
|
17
17
|
|
|
18
18
|
- Create a new route
|
|
19
19
|
- Add the page GraphQL queries required to render the layout (header, footer)
|
|
20
|
-
- Use getStaticProps to fetch
|
|
20
|
+
- Use getStaticProps to fetch Hygraph data
|
|
21
21
|
- Use getStaticPaths to provide a list of all URLs to pre-render
|
|
22
22
|
|
|
23
23
|
### Requirements
|
|
@@ -126,16 +126,16 @@ fetch information about the Magento storeview. Then, the query
|
|
|
126
126
|
footer and page content.
|
|
127
127
|
|
|
128
128
|
In this example, the URL variable is empty. As a result, the
|
|
129
|
-
`...PageContentQueryFragment` will have no result when trying to fetch a
|
|
130
|
-
|
|
129
|
+
`...PageContentQueryFragment` will have no result when trying to fetch a Hygraph
|
|
130
|
+
page with URL `''`.
|
|
131
131
|
|
|
132
132
|
The function `getStaticProps` is used to fetch data, meaning content is rendered
|
|
133
133
|
on the server. Review the page's source code and search for `About Us` to
|
|
134
134
|
validate that this string (currently hard-coded) is part of the source code.
|
|
135
135
|
|
|
136
|
-
### Add
|
|
136
|
+
### Add Hygraph content to the page
|
|
137
137
|
|
|
138
|
-
- Login to
|
|
138
|
+
- Login to Hygraph, navigate to Content and add a new Page entry with URL:
|
|
139
139
|
about/about-us
|
|
140
140
|
- In /about/about-us.tsx, make the following change to `getStaticProps`:
|
|
141
141
|
|
|
@@ -161,16 +161,16 @@ function AboutUs({ pages }: Props) {
|
|
|
161
161
|
|
|
162
162
|
<figure>
|
|
163
163
|
|
|
164
|
-

|
|
165
165
|
|
|
166
|
-
<figcaption>Fetch page content from
|
|
166
|
+
<figcaption>Fetch page content from Hygraph</figcaption>
|
|
167
167
|
</figure>
|
|
168
168
|
|
|
169
169
|
<figure>
|
|
170
170
|
|
|
171
|
-

|
|
172
172
|
|
|
173
|
-
<figcaption>
|
|
173
|
+
<figcaption>Hygraph entry</figcaption>
|
|
174
174
|
</figure>
|
|
175
175
|
|
|
176
176
|
### Add pre-rendering with getStaticPaths
|
|
@@ -225,7 +225,7 @@ built-time will not result in a 404:
|
|
|
225
225
|
> for the HTML to be generated, identical to SSR (hence why blocking), and then
|
|
226
226
|
> be cached for future requests so it only happens once per path.
|
|
227
227
|
|
|
228
|
-
### Pre-render all /about/ pages from
|
|
228
|
+
### Pre-render all /about/ pages from Hygraph
|
|
229
229
|
|
|
230
230
|
- In /about/[url].tsx, replace the getStaticPaths function with the following:
|
|
231
231
|
|
|
@@ -254,7 +254,7 @@ export const getStaticPaths: GetPageStaticPaths = async (context) => {
|
|
|
254
254
|
}
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
The PagesStaticPathsDocument query is used to fetch all pages from
|
|
257
|
+
The PagesStaticPathsDocument query is used to fetch all pages from Hygraph that
|
|
258
258
|
have a URL starting with 'about'. The locale options from the context object are
|
|
259
259
|
used to create an array:
|
|
260
260
|
|
|
@@ -288,4 +288,4 @@ You can test the static build process by running it locally:
|
|
|
288
288
|
## Next steps
|
|
289
289
|
|
|
290
290
|
- Learn how to
|
|
291
|
-
[build a custom
|
|
291
|
+
[build a custom Hygraph component](../getting-started/graphcms-component.md)
|
|
@@ -100,6 +100,8 @@ also applies if you want to modify a component's or
|
|
|
100
100
|
|
|
101
101
|
| Packages (/node_modules directory/) | |
|
|
102
102
|
| -------------------------------------------- | ---------------------------------------------------------- |
|
|
103
|
+
| @graphcommerce/address-fields-nl | [Source](../../../packages/address-fields-nl/) |
|
|
104
|
+
| @graphcommerce/cli | [Source](../../../packages/cli/) |
|
|
103
105
|
| @graphcommerce/framer-next-pages | [Source](../../../packages/framer-next-pages/) |
|
|
104
106
|
| @graphcommerce/googleanalytics | [Source](../../../packages/googleanalytics/) |
|
|
105
107
|
| @graphcommerce/googlerecaptcha | [Source](../../../packages/googlerecaptcha/) |
|
|
@@ -144,9 +146,9 @@ also applies if you want to modify a component's or
|
|
|
144
146
|
| @graphcommerce/react-hook-form | |
|
|
145
147
|
| @graphcommerce/typescript-config-pwa | |
|
|
146
148
|
|
|
147
|
-
##
|
|
149
|
+
## Hygraph
|
|
148
150
|
|
|
149
|
-
|
|
151
|
+
Hygraph is integrated as a Content Management System. It is used to store all
|
|
150
152
|
static content and provides a user-friendly interface for managing it.
|
|
151
153
|
|
|
152
154
|
The magento-graphcms example offers a number of components to render this
|
|
@@ -154,7 +156,7 @@ content in different ways, for example in the form of a page-wide hero banner, a
|
|
|
154
156
|
list of USPs or grid of text columns.
|
|
155
157
|
|
|
156
158
|
To [get started](../getting-started/create.md) with the magento-graphcms
|
|
157
|
-
example, cloning the demo
|
|
159
|
+
example, cloning the demo Hygraph project GraphQL schema and its content is
|
|
158
160
|
recommended.
|
|
159
161
|
|
|
160
162
|
## Pages
|
|
@@ -200,10 +202,10 @@ Page structure of the graphcommerce-magento example
|
|
|
200
202
|
GraphCommerce is built and optimized to use data coming from Magento's GraphQL
|
|
201
203
|
API. GraphCommerce uses GraphQL Mesh, which adds the ability to add extra
|
|
202
204
|
(micro)services as data sources. In the magento-graphcms example, a headless CMS
|
|
203
|
-
called [
|
|
205
|
+
called [Hygraph](../getting-started/../framework/graphcms.md) is integrated.
|
|
204
206
|
|
|
205
207
|
By default, the GraphQL Mesh endpoint runs on route /api/graphql. You can query
|
|
206
|
-
both the Magento GraphQL schema and the
|
|
208
|
+
both the Magento GraphQL schema and the Hygraph GraphQL schema. Try out the
|
|
207
209
|
GraphCommerce demo
|
|
208
210
|
[GraphQL Explorer ↗](https://graphcommerce.vercel.app/api/graphql) with the
|
|
209
211
|
following example query:
|
|
@@ -244,12 +246,12 @@ GraphQL queries in the graphcommerce-magento example
|
|
|
244
246
|
|
|
245
247
|
├── GraphQL
|
|
246
248
|
└── CategoryPage.graphql
|
|
249
|
+
└── DefaultPage.graphql
|
|
247
250
|
└── PageLink.graphql
|
|
248
251
|
└── DefaultPage.graphql
|
|
249
252
|
└── PagesStaticPaths.graphql
|
|
250
|
-
└── FooterQueryFragment.graphql
|
|
251
|
-
└── PageContentQueryFragment.graphql
|
|
252
253
|
└── ProductPage.graphql
|
|
254
|
+
└── ProductPage2.graphql
|
|
253
255
|
```
|
|
254
256
|
|
|
255
257
|
## FAQ
|
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": "
|
|
5
|
+
"version": "6.0.0-canary.20",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@graphcommerce/prettier-config-pwa": "
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "6.0.0-canary.20"
|
|
9
9
|
},
|
|
10
10
|
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
11
11
|
}
|
package/readme.md
CHANGED
|
@@ -44,7 +44,7 @@ https://user-images.githubusercontent.com/1251986/154977573-4015e77c-43e7-481e-a
|
|
|
44
44
|
GraphCommerce offers a [magento-graphcms](./getting-started/readme.md) example
|
|
45
45
|
that provides a full-featured storefront. The example integrates with your
|
|
46
46
|
Magento backend and provides a full purchase journey out-of-the-box. It uses
|
|
47
|
-
|
|
47
|
+
Hygraph to enrich pages with multiple content components, like the homepage.
|
|
48
48
|
|
|
49
49
|
The magento-graphcms example is styled using the Mui component library. You can
|
|
50
50
|
start styling by making changes to the [theme](./framework/theming.md).
|
package/roadmap.md
CHANGED
|
@@ -29,7 +29,7 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
29
29
|
- [x] Configurable product image swatches
|
|
30
30
|
[example ↗](https://graphcommerce.vercel.app/nl/p/gc-puncturing-sock)
|
|
31
31
|
- [x] Virtual product, downloadable products
|
|
32
|
-
- [x] Multilingual Hygraph (
|
|
32
|
+
- [x] Multilingual Hygraph (Hygraph) setup support
|
|
33
33
|
- [x] Multisafepay payment service
|
|
34
34
|
- [x] Multilingual product sitemap generation
|
|
35
35
|
- [x] Multi level Navigation (Mega Menu)
|
|
@@ -49,7 +49,7 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
49
49
|
|
|
50
50
|
## Future
|
|
51
51
|
|
|
52
|
-
- [ ] `magento` example without
|
|
52
|
+
- [ ] `magento` example without Hygraph
|
|
53
53
|
- [ ] PageBuilder support
|
|
54
54
|
|
|
55
55
|
## Next steps
|