@graphcommerce/docs 6.1.1-canary.5 → 6.2.0-canary.11
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 +12 -0
- package/contributing.md +1 -0
- package/framework/config.md +45 -0
- package/framework/plugins-react.md +40 -13
- package/getting-started/graphcms-component.md +1 -1
- package/package.json +2 -2
- package/roadmap.md +23 -11
package/CHANGELOG.md
CHANGED
package/contributing.md
CHANGED
|
@@ -98,6 +98,7 @@ need to sign the CLA once.
|
|
|
98
98
|
- Changeset is available
|
|
99
99
|
- Eslint must not report any errors in the changed files
|
|
100
100
|
- Eslint should not give any warnings in the changed files
|
|
101
|
+
- Bundle size should not increase significantly
|
|
101
102
|
- Lingui translations must be
|
|
102
103
|
[generated](https://www.graphcommerce.org/docs/framework/translations#generating-translation-files-with-all-translations)
|
|
103
104
|
and translated
|
package/framework/config.md
CHANGED
|
@@ -90,6 +90,8 @@ Examples:
|
|
|
90
90
|
|
|
91
91
|
The HyGraph endpoint.
|
|
92
92
|
|
|
93
|
+
> Read-only endpoint that allows low latency and high read-throughput content delivery.
|
|
94
|
+
|
|
93
95
|
Project settings -> API Access -> High Performance Read-only Content API
|
|
94
96
|
|
|
95
97
|
#### `magentoEndpoint: String!`
|
|
@@ -109,6 +111,15 @@ Due to a limitation of the GraphQL API it is not possible to determine if a cart
|
|
|
109
111
|
|
|
110
112
|
When Magento's StoreConfig adds this value, this can be replaced.
|
|
111
113
|
|
|
114
|
+
#### `compare: Boolean`
|
|
115
|
+
|
|
116
|
+
Use compare functionality
|
|
117
|
+
|
|
118
|
+
#### `compareVariant: [CompareVariant](#CompareVariant)`
|
|
119
|
+
|
|
120
|
+
By default the compare feature is denoted with a 'compare icon' (2 arrows facing one another).
|
|
121
|
+
This may be fine for experienced users, but for more clarity it's also possible to present the compare feature as a checkbox accompanied by the 'Compare' label
|
|
122
|
+
|
|
112
123
|
#### `customerRequireEmailConfirmation: Boolean`
|
|
113
124
|
|
|
114
125
|
Due to a limitation in the GraphQL API of Magento 2, we need to know if the
|
|
@@ -149,6 +160,40 @@ The Google Tagmanager ID to be used on the site.
|
|
|
149
160
|
|
|
150
161
|
This value is required even if you are configuring different values for each locale.
|
|
151
162
|
|
|
163
|
+
#### `hygraphWriteAccessEndpoint: String`
|
|
164
|
+
|
|
165
|
+
Content API. **Only used for migrations.**
|
|
166
|
+
|
|
167
|
+
> Regular read & write endpoint that allows querying and mutating data in your project.
|
|
168
|
+
|
|
169
|
+
Project settings -> API Access -> Content API
|
|
170
|
+
|
|
171
|
+
#### `hygraphWriteAccessToken: String`
|
|
172
|
+
|
|
173
|
+
Hygraph Management SDK Authorization Token. **Only used for migrations.**
|
|
174
|
+
|
|
175
|
+
Project settings -> API Access -> Permanent Auth Tokens
|
|
176
|
+
|
|
177
|
+
1. Click 'Add token' and give it a name, something like 'GraphCommerce Write Access Token' and keep stage on 'Published'.
|
|
178
|
+
2. Under 'Management API', click 'Yes, Initialize defaults'
|
|
179
|
+
3. Click 'Edit Permissions' and enable: 'Update' and 'Delete' permissions for 'models', 'enumerations', 'fields', 'components' and 'sources'
|
|
180
|
+
- Update existing models
|
|
181
|
+
- Delete existing models
|
|
182
|
+
- Update existing fields
|
|
183
|
+
- Delete existing fields
|
|
184
|
+
- Update existing enumerations
|
|
185
|
+
- Delete existing enumerations
|
|
186
|
+
- Update existing components
|
|
187
|
+
- Delete existing components
|
|
188
|
+
- Update remote sources
|
|
189
|
+
- Delete remote sources
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
GC_HYGRAPH_WRITE_ACCESS_ENDPOINT="https://...hygraph.com/v2/..."
|
|
193
|
+
GC_HYGRAPH_WRITE_ACCESS_TOKEN="AccessTokenFromHygraph"
|
|
194
|
+
yarn graphcommerce hygraph-migrate
|
|
195
|
+
```
|
|
196
|
+
|
|
152
197
|
#### `legacyProductRoute: Boolean`
|
|
153
198
|
|
|
154
199
|
On older versions of GraphCommerce products would use a product type specific route.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Plugins
|
|
1
|
+
# Plugins GraphCommerce
|
|
2
2
|
|
|
3
|
-
GraphCommerce's
|
|
4
|
-
|
|
3
|
+
GraphCommerce's plugin system allows you to extend GraphCommerce's built-in
|
|
4
|
+
components or functions with your own logic.
|
|
5
5
|
|
|
6
6
|
- No runtime overhead: The plugin system is fully implemented in webpack and
|
|
7
7
|
- Easy plugin creation: Configuration should happen in the plugin file, not a
|
|
@@ -10,13 +10,30 @@ built-in components with your own logic.
|
|
|
10
10
|
|
|
11
11
|
## What is a plugin
|
|
12
12
|
|
|
13
|
-
A plugin is a way to modify React Components by wrapping them,
|
|
14
|
-
modify the code directly.
|
|
13
|
+
A plugin is a way to modify React Components or a Function by wrapping them,
|
|
14
|
+
without having to modify the code directly.
|
|
15
15
|
|
|
16
16
|
For the M2 people: Think of around plugins, but without configuration files and
|
|
17
17
|
no performance penalty.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
GraphCommerce has two kinds of plugins, React Component plugins and Function
|
|
20
|
+
|
|
21
|
+
React Component plugins, which can be used to:
|
|
22
|
+
|
|
23
|
+
- Pass props to components
|
|
24
|
+
- Place your own components before the original component
|
|
25
|
+
- Place your own components after the original component
|
|
26
|
+
- Skip rendering of the original component conditionally
|
|
27
|
+
|
|
28
|
+
Function plugins, which can be used to:
|
|
29
|
+
|
|
30
|
+
- Call a function before the original function
|
|
31
|
+
- Call a function after the original function
|
|
32
|
+
- Modify the return value of a function
|
|
33
|
+
- Modify the arguments of a function
|
|
34
|
+
- Skip calling the original function conditionally
|
|
35
|
+
|
|
36
|
+
## How do I write a React Component plugin?
|
|
20
37
|
|
|
21
38
|
In this example we're going to add some text to list items, just like the text
|
|
22
39
|
‘BY GC’ that can seen in the demo on
|
|
@@ -26,14 +43,14 @@ In this example we're going to add some text to list items, just like the text
|
|
|
26
43
|
contents:
|
|
27
44
|
|
|
28
45
|
```tsx
|
|
29
|
-
import type {
|
|
30
|
-
import type {
|
|
46
|
+
import type { ProductListItem } from '@graphcommerce/magento-product'
|
|
47
|
+
import type { ReactPlugin } from '@graphcommerce/next-config'
|
|
31
48
|
import { Typography } from '@mui/material'
|
|
32
49
|
|
|
33
50
|
export const component = 'ProductListItem' // Component to extend, required
|
|
34
51
|
export const exported = '@graphcommerce/magento-product' // Location where the component is exported, required
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
const ListPlugin: ReactPlugin<typeof ProductListItem> = (props) => {
|
|
37
54
|
// Prev in this case is ProductListItem, you should be able to see this if you log it.
|
|
38
55
|
const { Prev, ...rest } = props
|
|
39
56
|
return (
|
|
@@ -47,7 +64,7 @@ In this example we're going to add some text to list items, just like the text
|
|
|
47
64
|
/>
|
|
48
65
|
)
|
|
49
66
|
}
|
|
50
|
-
export const Plugin =
|
|
67
|
+
export const Plugin = ListPlugin // An export with the name Plugin, required
|
|
51
68
|
```
|
|
52
69
|
|
|
53
70
|
2. Trigger the 'interceptor generation' so GraphCommerce knows of the existence
|
|
@@ -56,10 +73,20 @@ In this example we're going to add some text to list items, just like the text
|
|
|
56
73
|
and save the file
|
|
57
74
|
|
|
58
75
|
If everything went as expected you should see `Plugin!` below the product
|
|
59
|
-
name.
|
|
76
|
+
name. If that doesn't work try restarting the dev server.
|
|
60
77
|
|
|
61
78
|
3. Happy programming!
|
|
62
79
|
|
|
80
|
+
4. You can enable debug mode in your graphcommerce.config.js:
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
const config = {
|
|
84
|
+
debug: {
|
|
85
|
+
pluginStatus: true,
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
63
90
|
## How does it work?
|
|
64
91
|
|
|
65
92
|
After the creation of the plugin file GraphCommerce will create an interceptor
|
|
@@ -108,7 +135,7 @@ When opening the React debugger you can see the plugin wrapped.
|
|
|
108
135
|
|
|
109
136
|
GraphCommerce uses a custom Webpack plugin to load the plugins. The plugin does
|
|
110
137
|
a glob search for plugin folders in each GraphCommerce related pacakge:
|
|
111
|
-
`${packageLocation}/plugins/**/*.tsx`
|
|
138
|
+
`${packageLocation}/plugins/**/*.{ts|tsx}`
|
|
112
139
|
|
|
113
140
|
Package locations are the root and all packages with `graphcommerce` in the name
|
|
114
141
|
(This means all `@graphcommerce/*` packages and
|
|
@@ -125,7 +152,7 @@ work for other things such as:
|
|
|
125
152
|
- Googletagmanager
|
|
126
153
|
- Googleanalytics
|
|
127
154
|
- Google recaptcha
|
|
128
|
-
- Compare functionality
|
|
155
|
+
- Compare functionality
|
|
129
156
|
- Wishlist functionality?
|
|
130
157
|
- Abstraction between GraphCommerce and Backends? (Magento, BigCommerce,
|
|
131
158
|
CommerceTools, etc.)
|
|
@@ -155,7 +155,7 @@ fragment Banner on Banner {
|
|
|
155
155
|
- In /components/GraphCMS/RowRenderer.graphql, add the fragment:
|
|
156
156
|
|
|
157
157
|
```graphql
|
|
158
|
-
fragment RowRenderer on Page {
|
|
158
|
+
fragment RowRenderer on Page @inject(into: ["HygraphPage"]) {
|
|
159
159
|
content {
|
|
160
160
|
__typename
|
|
161
161
|
... on Node {
|
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": "6.
|
|
5
|
+
"version": "6.2.0-canary.11",
|
|
6
6
|
"sideEffects": true,
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@graphcommerce/prettier-config-pwa": "6.
|
|
8
|
+
"@graphcommerce/prettier-config-pwa": "6.2.0-canary.11"
|
|
9
9
|
},
|
|
10
10
|
"prettier": "@graphcommerce/prettier-config-pwa"
|
|
11
11
|
}
|
package/roadmap.md
CHANGED
|
@@ -15,14 +15,25 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
15
15
|
|
|
16
16
|
## In progress
|
|
17
17
|
|
|
18
|
-
- [ ]
|
|
19
|
-
- [ ]
|
|
20
|
-
- [ ]
|
|
21
|
-
|
|
22
|
-
- [ ]
|
|
18
|
+
- [ ] Algolia implementation
|
|
19
|
+
- [ ] Dynamic Row based content
|
|
20
|
+
- [ ] Product compare functionality
|
|
21
|
+
- [ ] Edge runtime for GraphQL Mesh and Streaming SSR rendering
|
|
22
|
+
- [ ] Global store messages
|
|
23
23
|
|
|
24
24
|
## Just released
|
|
25
25
|
|
|
26
|
+
[See all releases](https://github.com/graphcommerce-org/graphcommerce/releases?q=prerelease%3Afalse+&expanded=true)
|
|
27
|
+
|
|
28
|
+
- [x] Google Tagmanager 4 datalayer implementation
|
|
29
|
+
[docs ↗](https://github.com/graphcommerce-org/graphcommerce/tree/main/packages/googleanalytics)
|
|
30
|
+
- [x] Paypal Express payment service
|
|
31
|
+
[docs ↗](https://github.com/graphcommerce-org/graphcommerce/tree/main/packages/magento-payment-paypal)
|
|
32
|
+
- [x] Adyen payment service
|
|
33
|
+
[docs ↗](https://github.com/graphcommerce-org/graphcommerce/tree/main/packages/magento-payment-adyen)
|
|
34
|
+
- [x] Postcode check integration
|
|
35
|
+
[docs ↗](https://github.com/graphcommerce-org/graphcommerce/tree/main/packages/address-fields-nl)
|
|
36
|
+
- [x] Redesigned layered navigation for mobile and desktop
|
|
26
37
|
- [x] Crosssells overlay after adding a product to cart
|
|
27
38
|
- [x] Bundle product
|
|
28
39
|
[example ↗](https://graphcommerce.vercel.app/nl/p/giftcard-bundle-gc-570)
|
|
@@ -40,15 +51,16 @@ The following overview contains the status of items on the GraphCommerce roadmap
|
|
|
40
51
|
|
|
41
52
|
## Planned
|
|
42
53
|
|
|
43
|
-
- [ ]
|
|
44
|
-
- [ ]
|
|
45
|
-
- [ ]
|
|
46
|
-
- [ ] Fetch Magento image sizes (probe-image-size)
|
|
47
|
-
- [ ] Postcode check integration
|
|
48
|
-
- [ ] Windows support
|
|
54
|
+
- [ ] Redesigned cart
|
|
55
|
+
- [ ] Product thumbnail carousel
|
|
56
|
+
- [ ] React Server Components integration
|
|
49
57
|
|
|
50
58
|
## Future
|
|
51
59
|
|
|
60
|
+
- [ ] Fetch Magento image sizes (probe-image-size)
|
|
61
|
+
- [ ] Windows support
|
|
62
|
+
- [ ] Store locator
|
|
63
|
+
- [ ] Buckaroo payment service
|
|
52
64
|
- [ ] `magento` example without Hygraph
|
|
53
65
|
- [ ] PageBuilder support
|
|
54
66
|
|