@okendo/shopify-hydrogen 2.2.3 → 2.2.5
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/README.md +230 -293
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -42,19 +42,16 @@ unauthenticated_read_product_tags
|
|
|
42
42
|
|
|
43
43
|
Follow the instructions on [this page](https://help.shopify.com/en/manual/apps/app-types/custom-apps#create-and-install-a-custom-app) to create it.
|
|
44
44
|
|
|
45
|
-
#### Note
|
|
46
|
-
|
|
47
|
-
Shopify is in the process of deprecating `metafieldStorefrontVisibilityCreate` in favour of `metafieldDefinitionCreate`. The following method uses `metafieldDefinitionCreate`. If you're having trouble with it, you will find below the deprecated method using `metafieldStorefrontVisibilityCreate`.
|
|
48
45
|
|
|
49
46
|
#### Using Curl
|
|
50
47
|
|
|
51
48
|
Open a new terminal or PowerShell window, then:
|
|
52
49
|
|
|
53
|
-
1. Run the following command to expose the `
|
|
50
|
+
1. Run the following command to expose the `widget_pre_render_style_tags` shop metafield:
|
|
54
51
|
|
|
55
52
|
```bash
|
|
56
53
|
curl -X POST \
|
|
57
|
-
https://{shop}.myshopify.com/admin/api/
|
|
54
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
58
55
|
-H 'Content-Type: application/graphql' \
|
|
59
56
|
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
60
57
|
-d '
|
|
@@ -62,11 +59,14 @@ mutation {
|
|
|
62
59
|
metafieldDefinitionCreate(
|
|
63
60
|
definition: {
|
|
64
61
|
name: "WidgetPreRenderStyleTags"
|
|
65
|
-
namespace: "
|
|
66
|
-
key: "
|
|
62
|
+
namespace: "$app:review"
|
|
63
|
+
key: "widget_pre_render_style_tags"
|
|
67
64
|
type: "multi_line_text_field"
|
|
68
65
|
ownerType: SHOP
|
|
69
|
-
|
|
66
|
+
access: {
|
|
67
|
+
admin: PUBLIC_READ
|
|
68
|
+
storefront: PUBLIC_READ
|
|
69
|
+
}
|
|
70
70
|
}
|
|
71
71
|
) {
|
|
72
72
|
createdDefinition { id name }
|
|
@@ -76,11 +76,11 @@ mutation {
|
|
|
76
76
|
'
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
2. Run the following command to expose the `
|
|
79
|
+
2. Run the following command to expose the `widget_pre_render_body_style_tags` shop metafield:
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
82
|
curl -X POST \
|
|
83
|
-
https://{shop}.myshopify.com/admin/api/
|
|
83
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
84
84
|
-H 'Content-Type: application/graphql' \
|
|
85
85
|
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
86
86
|
-d '
|
|
@@ -88,11 +88,14 @@ mutation {
|
|
|
88
88
|
metafieldDefinitionCreate(
|
|
89
89
|
definition: {
|
|
90
90
|
name: "WidgetPreRenderBodyStyleTags"
|
|
91
|
-
namespace: "
|
|
92
|
-
key: "
|
|
91
|
+
namespace: "$app:review"
|
|
92
|
+
key: "widget_pre_render_body_style_tags"
|
|
93
93
|
type: "multi_line_text_field"
|
|
94
94
|
ownerType: SHOP
|
|
95
|
-
|
|
95
|
+
access: {
|
|
96
|
+
admin: PUBLIC_READ
|
|
97
|
+
storefront: PUBLIC_READ
|
|
98
|
+
}
|
|
96
99
|
}
|
|
97
100
|
) {
|
|
98
101
|
createdDefinition { id name }
|
|
@@ -102,11 +105,11 @@ mutation {
|
|
|
102
105
|
'
|
|
103
106
|
```
|
|
104
107
|
|
|
105
|
-
3. Run the following command to expose the `
|
|
108
|
+
3. Run the following command to expose the `reviews_widget_snippet` product metafield:
|
|
106
109
|
|
|
107
110
|
```bash
|
|
108
111
|
curl -X POST \
|
|
109
|
-
https://{shop}.myshopify.com/admin/api/
|
|
112
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
110
113
|
-H 'Content-Type: application/graphql' \
|
|
111
114
|
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
112
115
|
-d '
|
|
@@ -114,11 +117,14 @@ mutation {
|
|
|
114
117
|
metafieldDefinitionCreate(
|
|
115
118
|
definition: {
|
|
116
119
|
name: "ReviewsWidgetSnippet"
|
|
117
|
-
namespace: "
|
|
118
|
-
key: "
|
|
120
|
+
namespace: "$app:reviews"
|
|
121
|
+
key: "reviews_widget_snippet"
|
|
119
122
|
type: "multi_line_text_field"
|
|
120
123
|
ownerType: PRODUCT
|
|
121
|
-
|
|
124
|
+
access: {
|
|
125
|
+
admin: PUBLIC_READ
|
|
126
|
+
storefront: PUBLIC_READ
|
|
127
|
+
}
|
|
122
128
|
}
|
|
123
129
|
) {
|
|
124
130
|
createdDefinition { id name }
|
|
@@ -128,11 +134,11 @@ mutation {
|
|
|
128
134
|
'
|
|
129
135
|
```
|
|
130
136
|
|
|
131
|
-
4. Run the following command to expose the `
|
|
137
|
+
4. Run the following command to expose the `star_rating_snippet` product metafield:
|
|
132
138
|
|
|
133
139
|
```bash
|
|
134
140
|
curl -X POST \
|
|
135
|
-
https://{shop}.myshopify.com/admin/api/
|
|
141
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
136
142
|
-H 'Content-Type: application/graphql' \
|
|
137
143
|
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
138
144
|
-d '
|
|
@@ -140,11 +146,72 @@ mutation {
|
|
|
140
146
|
metafieldDefinitionCreate(
|
|
141
147
|
definition: {
|
|
142
148
|
name: "StarRatingSnippet"
|
|
143
|
-
namespace: "
|
|
144
|
-
key: "
|
|
149
|
+
namespace: "$app:reviews"
|
|
150
|
+
key: "star_rating_snippet"
|
|
145
151
|
type: "multi_line_text_field"
|
|
146
152
|
ownerType: PRODUCT
|
|
147
|
-
|
|
153
|
+
access: {
|
|
154
|
+
admin: PUBLIC_READ
|
|
155
|
+
storefront: PUBLIC_READ
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
) {
|
|
159
|
+
createdDefinition { id name }
|
|
160
|
+
userErrors { field message code }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
'
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
5. Run the following command to expose the `review_count` product metafield:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
curl -X POST \
|
|
170
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
171
|
+
-H 'Content-Type: application/graphql' \
|
|
172
|
+
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
173
|
+
-d '
|
|
174
|
+
mutation {
|
|
175
|
+
metafieldDefinitionCreate(
|
|
176
|
+
definition: {
|
|
177
|
+
name: "ReviewCount"
|
|
178
|
+
namespace: "$app:reviews"
|
|
179
|
+
key: "review_count"
|
|
180
|
+
type: "number_integer"
|
|
181
|
+
ownerType: PRODUCT
|
|
182
|
+
access: {
|
|
183
|
+
admin: PUBLIC_READ
|
|
184
|
+
storefront: PUBLIC_READ
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
) {
|
|
188
|
+
createdDefinition { id name }
|
|
189
|
+
userErrors { field message code }
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
6. Run the following command to expose the `average_rating` product metafield:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
curl -X POST \
|
|
199
|
+
https://{shop}.myshopify.com/admin/api/2024-10/graphql.json \
|
|
200
|
+
-H 'Content-Type: application/graphql' \
|
|
201
|
+
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
202
|
+
-d '
|
|
203
|
+
mutation {
|
|
204
|
+
metafieldDefinitionCreate(
|
|
205
|
+
definition: {
|
|
206
|
+
name: "AverageRating"
|
|
207
|
+
namespace: "$app:reviews"
|
|
208
|
+
key: "average_rating"
|
|
209
|
+
type: "rating"
|
|
210
|
+
ownerType: PRODUCT
|
|
211
|
+
access: {
|
|
212
|
+
admin: PUBLIC_READ
|
|
213
|
+
storefront: PUBLIC_READ
|
|
214
|
+
}
|
|
148
215
|
}
|
|
149
216
|
) {
|
|
150
217
|
createdDefinition { id name }
|
|
@@ -158,21 +225,24 @@ mutation {
|
|
|
158
225
|
|
|
159
226
|
Open your GraphQL IDE (such as Postman) and make `POST` requests with the following details:
|
|
160
227
|
|
|
161
|
-
- **URL:** https://{shop}.myshopify.com/admin/api/
|
|
228
|
+
- **URL:** https://{shop}.myshopify.com/admin/api/2024-10/graphql.json
|
|
162
229
|
- **Headers:** - X-Shopify-Access-Token: {access_token} - Content-Type: application/json
|
|
163
230
|
|
|
164
|
-
1. Execute the following request to expose the `
|
|
231
|
+
1. Execute the following request to expose the `widget_pre_render_style_tags` shop metafield:
|
|
165
232
|
|
|
166
233
|
```graphql
|
|
167
234
|
mutation {
|
|
168
235
|
metafieldDefinitionCreate(
|
|
169
236
|
definition: {
|
|
170
237
|
name: "WidgetPreRenderStyleTags"
|
|
171
|
-
namespace: "
|
|
172
|
-
key: "
|
|
238
|
+
namespace: "$app:reviews"
|
|
239
|
+
key: "widget_pre_render_style_tags"
|
|
173
240
|
type: "multi_line_text_field"
|
|
174
241
|
ownerType: SHOP
|
|
175
|
-
|
|
242
|
+
access: {
|
|
243
|
+
admin: PUBLIC_READ
|
|
244
|
+
storefront: PUBLIC_READ
|
|
245
|
+
}
|
|
176
246
|
}
|
|
177
247
|
) {
|
|
178
248
|
createdDefinition {
|
|
@@ -188,18 +258,21 @@ mutation {
|
|
|
188
258
|
}
|
|
189
259
|
```
|
|
190
260
|
|
|
191
|
-
2. Execute the following request to expose the `
|
|
261
|
+
2. Execute the following request to expose the `widget_pre_render_body_style_tags` shop metafield:
|
|
192
262
|
|
|
193
263
|
```graphql
|
|
194
264
|
mutation {
|
|
195
265
|
metafieldDefinitionCreate(
|
|
196
266
|
definition: {
|
|
197
267
|
name: "WidgetPreRenderBodyStyleTags"
|
|
198
|
-
namespace: "
|
|
199
|
-
key: "
|
|
268
|
+
namespace: "$app:reviews"
|
|
269
|
+
key: "widget_pre_render_body_style_tags"
|
|
200
270
|
type: "multi_line_text_field"
|
|
201
271
|
ownerType: SHOP
|
|
202
|
-
|
|
272
|
+
access: {
|
|
273
|
+
admin: PUBLIC_READ
|
|
274
|
+
storefront: PUBLIC_READ
|
|
275
|
+
}
|
|
203
276
|
}
|
|
204
277
|
) {
|
|
205
278
|
createdDefinition {
|
|
@@ -215,18 +288,21 @@ mutation {
|
|
|
215
288
|
}
|
|
216
289
|
```
|
|
217
290
|
|
|
218
|
-
3. Execute the following request to expose the `
|
|
291
|
+
3. Execute the following request to expose the `reviews_widget_snippet` product metafield:
|
|
219
292
|
|
|
220
293
|
```graphql
|
|
221
294
|
mutation {
|
|
222
295
|
metafieldDefinitionCreate(
|
|
223
296
|
definition: {
|
|
224
297
|
name: "ReviewsWidgetSnippet"
|
|
225
|
-
namespace: "
|
|
226
|
-
key: "
|
|
298
|
+
namespace: "$app:reviews"
|
|
299
|
+
key: "reviews_widget_snippet"
|
|
227
300
|
type: "multi_line_text_field"
|
|
228
301
|
ownerType: PRODUCT
|
|
229
|
-
|
|
302
|
+
access: {
|
|
303
|
+
admin: PUBLIC_READ
|
|
304
|
+
storefront: PUBLIC_READ
|
|
305
|
+
}
|
|
230
306
|
}
|
|
231
307
|
) {
|
|
232
308
|
createdDefinition {
|
|
@@ -242,18 +318,21 @@ mutation {
|
|
|
242
318
|
}
|
|
243
319
|
```
|
|
244
320
|
|
|
245
|
-
4. Execute the following request to expose the `
|
|
321
|
+
4. Execute the following request to expose the `star_rating_snippet` product metafield:
|
|
246
322
|
|
|
247
323
|
```graphql
|
|
248
324
|
mutation {
|
|
249
325
|
metafieldDefinitionCreate(
|
|
250
326
|
definition: {
|
|
251
327
|
name: "StarRatingSnippet"
|
|
252
|
-
namespace: "
|
|
253
|
-
key: "
|
|
328
|
+
namespace: "$app:reviews"
|
|
329
|
+
key: "star_rating_snippet"
|
|
254
330
|
type: "multi_line_text_field"
|
|
255
331
|
ownerType: PRODUCT
|
|
256
|
-
|
|
332
|
+
access: {
|
|
333
|
+
admin: PUBLIC_READ
|
|
334
|
+
storefront: PUBLIC_READ
|
|
335
|
+
}
|
|
257
336
|
}
|
|
258
337
|
) {
|
|
259
338
|
createdDefinition {
|
|
@@ -269,225 +348,70 @@ mutation {
|
|
|
269
348
|
}
|
|
270
349
|
```
|
|
271
350
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
- [https://shopify.dev/api/examples/metafields#step-1-expose-metafields](https://shopify.dev/api/examples/metafields#step-1-expose-metafields)
|
|
275
|
-
- [https://shopify.dev/api/admin-graphql/2023-07/mutations/metafieldDefinitionCreate](https://shopify.dev/api/admin-graphql/2023-07/mutations/metafieldDefinitionCreate)
|
|
276
|
-
|
|
277
|
-
<details>
|
|
278
|
-
|
|
279
|
-
<summary>If you're having trouble with `metafieldDefinitionCreate`, click here to see the deprecated method, using `metafieldStorefrontVisibilityCreate`.</summary>
|
|
280
|
-
|
|
281
|
-
#### Using Curl
|
|
282
|
-
|
|
283
|
-
Open a new terminal or PowerShell window, then:
|
|
284
|
-
|
|
285
|
-
1. Run the following command to expose the `WidgetPreRenderStyleTags` shop metafield:
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
curl -X POST \
|
|
289
|
-
https://{shop}.myshopify.com/admin/api/2023-07/graphql.json \
|
|
290
|
-
-H 'Content-Type: application/graphql' \
|
|
291
|
-
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
292
|
-
-d '
|
|
293
|
-
mutation {
|
|
294
|
-
metafieldStorefrontVisibilityCreate(
|
|
295
|
-
input: {
|
|
296
|
-
namespace: "okendo"
|
|
297
|
-
key: "WidgetPreRenderStyleTags"
|
|
298
|
-
ownerType: SHOP
|
|
299
|
-
}
|
|
300
|
-
) {
|
|
301
|
-
metafieldStorefrontVisibility {
|
|
302
|
-
id
|
|
303
|
-
}
|
|
304
|
-
userErrors {
|
|
305
|
-
field
|
|
306
|
-
message
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
'
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
2. Run the following command to expose the `WidgetPreRenderBodyStyleTags` shop metafield:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
curl -X POST \
|
|
317
|
-
https://{shop}.myshopify.com/admin/api/2023-07/graphql.json \
|
|
318
|
-
-H 'Content-Type: application/graphql' \
|
|
319
|
-
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
320
|
-
-d '
|
|
321
|
-
mutation {
|
|
322
|
-
metafieldStorefrontVisibilityCreate(
|
|
323
|
-
input: {
|
|
324
|
-
namespace: "okendo"
|
|
325
|
-
key: "WidgetPreRenderBodyStyleTags"
|
|
326
|
-
ownerType: SHOP
|
|
327
|
-
}
|
|
328
|
-
) {
|
|
329
|
-
metafieldStorefrontVisibility {
|
|
330
|
-
id
|
|
331
|
-
}
|
|
332
|
-
userErrors {
|
|
333
|
-
field
|
|
334
|
-
message
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
'
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
3. Run the following command to expose the `ReviewsWidgetSnippet` product metafield:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
curl -X POST \
|
|
345
|
-
https://{shop}.myshopify.com/admin/api/2023-07/graphql.json \
|
|
346
|
-
-H 'Content-Type: application/graphql' \
|
|
347
|
-
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
348
|
-
-d '
|
|
349
|
-
mutation {
|
|
350
|
-
metafieldStorefrontVisibilityCreate(
|
|
351
|
-
input: {
|
|
352
|
-
namespace: "okendo"
|
|
353
|
-
key: "ReviewsWidgetSnippet"
|
|
354
|
-
ownerType: PRODUCT
|
|
355
|
-
}
|
|
356
|
-
) {
|
|
357
|
-
metafieldStorefrontVisibility {
|
|
358
|
-
id
|
|
359
|
-
}
|
|
360
|
-
userErrors {
|
|
361
|
-
field
|
|
362
|
-
message
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
'
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
4. Run the following command to expose the `StarRatingSnippet` the product metafield:
|
|
370
|
-
|
|
371
|
-
```bash
|
|
372
|
-
curl -X POST \
|
|
373
|
-
https://{shop}.myshopify.com/admin/api/2023-07/graphql.json \
|
|
374
|
-
-H 'Content-Type: application/graphql' \
|
|
375
|
-
-H 'X-Shopify-Access-Token: {access_token}' \
|
|
376
|
-
-d '
|
|
377
|
-
mutation {
|
|
378
|
-
metafieldStorefrontVisibilityCreate(
|
|
379
|
-
input: {
|
|
380
|
-
namespace: "okendo"
|
|
381
|
-
key: "StarRatingSnippet"
|
|
382
|
-
ownerType: PRODUCT
|
|
383
|
-
}
|
|
384
|
-
) {
|
|
385
|
-
metafieldStorefrontVisibility {
|
|
386
|
-
id
|
|
387
|
-
}
|
|
388
|
-
userErrors {
|
|
389
|
-
field
|
|
390
|
-
message
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
'
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
### Using GraphQL IDE
|
|
398
|
-
|
|
399
|
-
Open your GraphQL IDE (such as Postman) and make `POST` requests with the following details:
|
|
400
|
-
|
|
401
|
-
- **URL:** https://{shop}.myshopify.com/admin/api/2023-07/graphql.json
|
|
402
|
-
- **Headers:** - X-Shopify-Access-Token: {access_token} - Content-Type: application/json
|
|
403
|
-
|
|
404
|
-
1. Execute the following request to expose the `WidgetPreRenderStyleTags` shop metafield:
|
|
405
|
-
|
|
406
|
-
```graphql
|
|
407
|
-
mutation {
|
|
408
|
-
metafieldStorefrontVisibilityCreate(
|
|
409
|
-
input: {
|
|
410
|
-
namespace: "okendo"
|
|
411
|
-
key: "WidgetPreRenderStyleTags"
|
|
412
|
-
ownerType: SHOP
|
|
413
|
-
}
|
|
414
|
-
) {
|
|
415
|
-
metafieldStorefrontVisibility {
|
|
416
|
-
id
|
|
417
|
-
}
|
|
418
|
-
userErrors {
|
|
419
|
-
field
|
|
420
|
-
message
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
2. Execute the following request to expose the `WidgetPreRenderBodyStyleTags` shop metafield:
|
|
351
|
+
5. Execute the following request to expose the `review_count` product metafield:
|
|
427
352
|
|
|
428
353
|
```graphql
|
|
429
354
|
mutation {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
355
|
+
metafieldDefinitionCreate(
|
|
356
|
+
definition: {
|
|
357
|
+
name: "ReviewCount"
|
|
358
|
+
namespace: "$app:reviews"
|
|
359
|
+
key: "review_count"
|
|
360
|
+
type: "number_integer"
|
|
361
|
+
ownerType: PRODUCT
|
|
362
|
+
access: {
|
|
363
|
+
admin: PUBLIC_READ
|
|
364
|
+
storefront: PUBLIC_READ
|
|
365
|
+
}
|
|
435
366
|
}
|
|
436
367
|
) {
|
|
437
|
-
|
|
368
|
+
createdDefinition {
|
|
438
369
|
id
|
|
370
|
+
name
|
|
439
371
|
}
|
|
440
372
|
userErrors {
|
|
441
373
|
field
|
|
442
374
|
message
|
|
375
|
+
code
|
|
443
376
|
}
|
|
444
377
|
}
|
|
445
378
|
}
|
|
446
379
|
```
|
|
447
380
|
|
|
448
|
-
|
|
381
|
+
6. Execute the following request to expose the `average_rating` product metafield:
|
|
449
382
|
|
|
450
383
|
```graphql
|
|
451
384
|
mutation {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
385
|
+
metafieldDefinitionCreate(
|
|
386
|
+
definition: {
|
|
387
|
+
name: "AverageRating"
|
|
388
|
+
namespace: "$app:reviews"
|
|
389
|
+
key: "average_rating"
|
|
390
|
+
type: "rating"
|
|
456
391
|
ownerType: PRODUCT
|
|
392
|
+
access: {
|
|
393
|
+
admin: PUBLIC_READ
|
|
394
|
+
storefront: PUBLIC_READ
|
|
395
|
+
}
|
|
457
396
|
}
|
|
458
397
|
) {
|
|
459
|
-
|
|
460
|
-
id
|
|
461
|
-
}
|
|
462
|
-
userErrors {
|
|
463
|
-
field
|
|
464
|
-
message
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
4. Execute the following request to expose the `StarRatingSnippet` the product metafield:
|
|
471
|
-
|
|
472
|
-
```graphql
|
|
473
|
-
mutation {
|
|
474
|
-
metafieldStorefrontVisibilityCreate(
|
|
475
|
-
input: { namespace: "okendo", key: "StarRatingSnippet", ownerType: PRODUCT }
|
|
476
|
-
) {
|
|
477
|
-
metafieldStorefrontVisibility {
|
|
398
|
+
createdDefinition {
|
|
478
399
|
id
|
|
400
|
+
name
|
|
479
401
|
}
|
|
480
402
|
userErrors {
|
|
481
403
|
field
|
|
482
404
|
message
|
|
405
|
+
code
|
|
483
406
|
}
|
|
484
407
|
}
|
|
485
408
|
}
|
|
486
409
|
```
|
|
487
410
|
|
|
488
|
-
|
|
411
|
+
**References**
|
|
489
412
|
|
|
490
|
-
|
|
413
|
+
- [https://shopify.dev/api/examples/metafields#step-1-expose-metafields](https://shopify.dev/api/examples/metafields#step-1-expose-metafields)
|
|
414
|
+
- [https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/metafieldDefinitionCreate](https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/metafieldDefinitionCreate)
|
|
491
415
|
|
|
492
416
|
## Installation
|
|
493
417
|
|
|
@@ -587,76 +511,89 @@ Append `OkendoProvider` to `body`, and pass it the promise — or the data — r
|
|
|
587
511
|
|
|
588
512
|
> This is only necessary if Content Security Policy is active in your project.
|
|
589
513
|
|
|
590
|
-
Locate the call to `createContentSecurityPolicy`, and
|
|
591
|
-
|
|
592
|
-
- `https://d3hw6dc1ow8pp2.cloudfront.net`, `https://d3g5hqndtiniji.cloudfront.net`, and `data:` to `defaultSrc`
|
|
593
|
-
- `https://d3hw6dc1ow8pp2.cloudfront.net` to `styleSrc`
|
|
594
|
-
- `https://api.okendo.io` to `connectSrc`
|
|
595
|
-
|
|
514
|
+
Locate the call to `createContentSecurityPolicy`, and ensure your configuration includes the entries below:
|
|
596
515
|
Note that it's necessary to to add the default values (`'self'`, etc.) when [extending the CSP](https://shopify.dev/docs/custom-storefronts/hydrogen/content-security-policy). The call to `createContentSecurityPolicy` should now look like the following:
|
|
597
516
|
|
|
598
517
|
```ts
|
|
599
518
|
const { nonce, header, NonceProvider } = createContentSecurityPolicy({
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
519
|
+
defaultSrc: [
|
|
520
|
+
"'self'",
|
|
521
|
+
"localhost:*",
|
|
522
|
+
"https://cdn.shopify.com",
|
|
523
|
+
"https://www.google.com",
|
|
524
|
+
"https://www.gstatic.com",
|
|
525
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
526
|
+
"https://d3g5hqndtiniji.cloudfront.net",
|
|
527
|
+
"https://dov7r31oq5dkj.cloudfront.net",
|
|
528
|
+
"https://cdn-static.okendo.io",
|
|
529
|
+
"https://surveys.okendo.io",
|
|
530
|
+
"https://api.okendo.io",
|
|
531
|
+
"data:",
|
|
532
|
+
],
|
|
533
|
+
imgSrc: [
|
|
534
|
+
"'self'",
|
|
535
|
+
"https://cdn.shopify.com",
|
|
536
|
+
"data:",
|
|
537
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
538
|
+
"https://d3g5hqndtiniji.cloudfront.net",
|
|
539
|
+
"https://dov7r31oq5dkj.cloudfront.net",
|
|
540
|
+
"https://cdn-static.okendo.io",
|
|
541
|
+
"https://surveys.okendo.io"
|
|
542
|
+
],
|
|
543
|
+
mediaSrc: [
|
|
544
|
+
"'self'",
|
|
545
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
546
|
+
"https://d3g5hqndtiniji.cloudfront.net",
|
|
547
|
+
"https://dov7r31oq5dkj.cloudfront.net",
|
|
548
|
+
"https://cdn-static.okendo.io"
|
|
549
|
+
],
|
|
550
|
+
styleSrcElem: [
|
|
551
|
+
"'self'",
|
|
552
|
+
"'unsafe-inline'",
|
|
553
|
+
"https://cdn.shopify.com",
|
|
554
|
+
"https://fonts.googleapis.com",
|
|
555
|
+
"https://fonts.gstatic.com",
|
|
556
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
557
|
+
"https://cdn-static.okendo.io",
|
|
558
|
+
"https://surveys.okendo.io"
|
|
559
|
+
],
|
|
560
|
+
scriptSrc: [
|
|
561
|
+
"'self'",
|
|
562
|
+
"https://cdn.shopify.com",
|
|
563
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
564
|
+
"https://dov7r31oq5dkj.cloudfront.net",
|
|
565
|
+
"https://cdn-static.okendo.io",
|
|
566
|
+
"https://surveys.okendo.io",
|
|
567
|
+
"https://api.okendo.io",
|
|
568
|
+
"https://www.google.com",
|
|
569
|
+
"https://www.gstatic.com"
|
|
570
|
+
],
|
|
571
|
+
fontSrc: [
|
|
572
|
+
"'self'",
|
|
573
|
+
"https://fonts.gstatic.com",
|
|
574
|
+
"https://d3hw6dc1ow8pp2.cloudfront.net",
|
|
575
|
+
"https://dov7r31oq5dkj.cloudfront.net",
|
|
576
|
+
"https://cdn.shopify.com",
|
|
577
|
+
"https://cdn-static.okendo.io",
|
|
578
|
+
"https://surveys.okendo.io"
|
|
579
|
+
],
|
|
580
|
+
connectSrc: [
|
|
581
|
+
"'self'",
|
|
582
|
+
"https://monorail-edge.shopifysvc.com",
|
|
583
|
+
"localhost:*",
|
|
584
|
+
"ws://localhost:*",
|
|
585
|
+
"ws://127.0.0.1:*",
|
|
586
|
+
"https://api.okendo.io",
|
|
587
|
+
"https://cdn-static.okendo.io",
|
|
588
|
+
"https://surveys.okendo.io",
|
|
589
|
+
"https://api.raygun.com",
|
|
590
|
+
"https://www.google.com",
|
|
591
|
+
"https://www.gstatic.com",
|
|
592
|
+
],
|
|
593
|
+
frameSrc: [
|
|
594
|
+
"https://www.google.com",
|
|
595
|
+
"https://www.gstatic.com"
|
|
596
|
+
]
|
|
660
597
|
});
|
|
661
598
|
```
|
|
662
599
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okendo/shopify-hydrogen",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"description": "Okendo React components for Shopify Hydrogen 2 (Remix)",
|
|
5
5
|
"author": "Okendo",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"eslint": "eslint src"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@okendo/reviews-common": "^
|
|
23
|
-
"@okendo/reviews-widget-plus": "^0.
|
|
22
|
+
"@okendo/reviews-common": "^7.14.0",
|
|
23
|
+
"@okendo/reviews-widget-plus": "^0.70.23",
|
|
24
24
|
"@okendo/tsconfig": "0.0.2",
|
|
25
25
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
26
26
|
"@rollup/plugin-node-resolve": "^15.2.3",
|