@okendo/shopify-hydrogen 1.0.2 → 1.2.0
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
CHANGED
|
@@ -371,7 +371,7 @@ mutation {
|
|
|
371
371
|
|
|
372
372
|
### Server Components
|
|
373
373
|
|
|
374
|
-
Import `OkendoReviewsWidget` and `OkendoStarRating` and use as
|
|
374
|
+
Import `OkendoReviewsWidget` and `OkendoStarRating` and use as JSX components. Pass in the Shopify Product ID as a prop.
|
|
375
375
|
|
|
376
376
|
The `productId` prop is optional for the `OkendoReviewsWidget`. Not providing it will mean that the widget will display reviews for all products, which is ideal for homepages or collection pages.
|
|
377
377
|
|
|
@@ -397,7 +397,7 @@ const okendoStarRating = <OkendoStarRating productId={product.id} />;
|
|
|
397
397
|
|
|
398
398
|
We also include an `OkendoClientStarRating` component for use within client-side (e.g.`<your component>.client.tsx`) components.
|
|
399
399
|
|
|
400
|
-
Import the `OkendoClientStarRating` component inside a client component and use as a
|
|
400
|
+
Import the `OkendoClientStarRating` component inside a client component and use as a JSX component as seen below:
|
|
401
401
|
|
|
402
402
|
```tsx
|
|
403
403
|
import { OkendoClientStarRating } from '@okendo/shopify-hydrogen';
|
|
@@ -570,7 +570,7 @@ The `ProductCard.client.tsx` component has the result of a server-side `useShopQ
|
|
|
570
570
|
Because we have implemented our `OKENDO_PRODUCT_STAR_RATING_FRAGMENT` we can express the resulting type as a union:
|
|
571
571
|
|
|
572
572
|
```tsx
|
|
573
|
-
Product & OkendoProductFragment
|
|
573
|
+
Product & OkendoProductFragment
|
|
574
574
|
```
|
|
575
575
|
|
|
576
576
|
In the `ProductCard.client.tsx` import the `OkendoProductFragment` type and the `OkendoClientStarRating` component:
|
|
@@ -11,7 +11,7 @@ export const OkendoProvider = (props) => {
|
|
|
11
11
|
// Download subscriber widget plus settings.
|
|
12
12
|
const url = `https://${apiDomain ?? kDefaultOkendoApiDomain}/stores/${subscriberId}/widget_plus_settings`;
|
|
13
13
|
const settingsResponse = fetchSync(url, { preload: true });
|
|
14
|
-
if (!settingsResponse.
|
|
14
|
+
if (!settingsResponse.ok) {
|
|
15
15
|
console.error(okendoError('Failed to retrieve subscriber settings. Please check your environment variables.'));
|
|
16
16
|
setInOkendoRequestContext('setupFailed', true);
|
|
17
17
|
return null;
|
|
@@ -24,7 +24,7 @@ export const OkendoProvider = (props) => {
|
|
|
24
24
|
cache: CacheShort(),
|
|
25
25
|
preload: true
|
|
26
26
|
});
|
|
27
|
-
if (!initScriptResponse.
|
|
27
|
+
if (!initScriptResponse.ok) {
|
|
28
28
|
console.error(okendoError('Failed to retrieve widget initialization script.'));
|
|
29
29
|
setInOkendoRequestContext('setupFailed', true);
|
|
30
30
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okendo/shopify-hydrogen",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A component library containing Okendo Reviews React components.",
|
|
5
5
|
"main": "dist/esnext/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"html-react-parser": "^1.4.13"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@okendo/reviews-widget-plus": "^0.
|
|
46
|
+
"@okendo/reviews-widget-plus": "^0.49.0",
|
|
47
47
|
"@okendo/tsconfig": "0.0.2",
|
|
48
|
-
"@shopify/hydrogen": "^1.
|
|
48
|
+
"@shopify/hydrogen": "^1.2.0",
|
|
49
49
|
"@types/node": "^17.0.35",
|
|
50
50
|
"@types/react": "^18.0.14",
|
|
51
51
|
"@types/react-dom": "^18.0.5",
|
|
@@ -56,6 +56,6 @@
|
|
|
56
56
|
"vite": "^2.9.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"@shopify/hydrogen": "1.
|
|
59
|
+
"@shopify/hydrogen": "1.2.x"
|
|
60
60
|
}
|
|
61
61
|
}
|