@okendo/shopify-hydrogen 2.0.1 → 2.0.2
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/dist/cjs/index.js +1 -1
- package/dist/cjs/types/components/OkendoProvider/OkendoProvider.d.ts +30 -36
- package/dist/cjs/types/components/OkendoProvider/index.d.ts +1 -1
- package/dist/cjs/types/components/OkendoReviews/OkendoReviews.d.ts +11 -11
- package/dist/cjs/types/components/OkendoReviews/index.d.ts +1 -1
- package/dist/cjs/types/components/OkendoStarRating/OkendoStarRating.d.ts +11 -11
- package/dist/cjs/types/components/OkendoStarRating/index.d.ts +1 -1
- package/dist/cjs/types/components/index.d.ts +3 -3
- package/dist/cjs/types/fragments/fragments.d.ts +2 -2
- package/dist/cjs/types/fragments/index.d.ts +1 -1
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/types/internal/OkendoWidget/OkendoWidget.d.ts +12 -12
- package/dist/cjs/types/internal/types.d.ts +3 -3
- package/dist/cjs/types/internal/utils.d.ts +6 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/types/components/OkendoProvider/OkendoProvider.d.ts +30 -36
- package/dist/esm/types/components/OkendoProvider/index.d.ts +1 -1
- package/dist/esm/types/components/OkendoReviews/OkendoReviews.d.ts +11 -11
- package/dist/esm/types/components/OkendoReviews/index.d.ts +1 -1
- package/dist/esm/types/components/OkendoStarRating/OkendoStarRating.d.ts +11 -11
- package/dist/esm/types/components/OkendoStarRating/index.d.ts +1 -1
- package/dist/esm/types/components/index.d.ts +3 -3
- package/dist/esm/types/fragments/fragments.d.ts +2 -2
- package/dist/esm/types/fragments/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts +2 -2
- package/dist/esm/types/internal/OkendoWidget/OkendoWidget.d.ts +12 -12
- package/dist/esm/types/internal/types.d.ts +3 -3
- package/dist/esm/types/internal/utils.d.ts +6 -6
- package/dist/index.d.ts +43 -49
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("react");const e=({dataAttributes:e,metafieldContent:n=""})=>{const r=t.useRef(null),s=()=>{r.current&&window.okeWidgetApi.initWidget(r.current)};return t.useEffect((()=>(window.okeWidgetApi&&r.current?s():document.addEventListener("oke-script-loaded",s),()=>{document.removeEventListener("oke-script-loaded",s)})),[e]),t.createElement("div",{ref:r,key:JSON.stringify(e),...e,dangerouslySetInnerHTML:{__html:n}})},n=/^[0-9]*$/;function r(t){if(t)return`shopify-${n.test(t)?t:t.split("/").slice(-1)[0]}`}exports.OKENDO_PRODUCT_REVIEWS_FRAGMENT='#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "ReviewsWidgetSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n',exports.OKENDO_PRODUCT_STAR_RATING_FRAGMENT='#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "StarRatingSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n',exports.OkendoProvider=({okendoProviderData:e
|
|
1
|
+
"use strict";var t=require("react");const e=({dataAttributes:e,metafieldContent:n=""})=>{const r=t.useRef(null),s=()=>{r.current&&window.okeWidgetApi.initWidget(r.current)};return t.useEffect((()=>(window.okeWidgetApi&&r.current?s():document.addEventListener("oke-script-loaded",s),()=>{document.removeEventListener("oke-script-loaded",s)})),[e]),t.createElement("div",{ref:r,key:JSON.stringify(e),...e,dangerouslySetInnerHTML:{__html:n}})},n=/^[0-9]*$/;function r(t){if(t)return`shopify-${n.test(t)?t:t.split("/").slice(-1)[0]}`}exports.OKENDO_PRODUCT_REVIEWS_FRAGMENT='#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "ReviewsWidgetSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n',exports.OKENDO_PRODUCT_STAR_RATING_FRAGMENT='#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "StarRatingSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n',exports.OkendoProvider=({okendoProviderData:e})=>{if(!e)return null;const{reviewsHeaderConfig:n,cssVariables:r,customCss:s,initScriptContents:i,preRenderStyleTags:o,starSymbols:a}=e,d="(product) =>\n\t\tproduct && productHandle\n\t\t\t? \"/products/\" + product.productHandle + \"/\" + (product.variantId ? '?variantId=' + product.variantId : '')\n\t\t\t: undefined",l=(r??"").replace('<style id="oke-css-vars">',"").replace("</style>",""),c=s?s.replace('<style id="oke-reviews-custom-css">',"").replace("</style>",""):"";return t.createElement("div",null,t.createElement("script",{id:"oke-reviews-settings",type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify(n)}}),t.createElement("style",{id:"oke-css-vars",dangerouslySetInnerHTML:{__html:l}}),c&&t.createElement("style",{id:"oke-reviews-custom-css",dangerouslySetInnerHTML:{__html:c}}),i&&t.createElement("script",{dangerouslySetInnerHTML:{__html:i}}),t.createElement("script",{type:"text/javascript",dangerouslySetInnerHTML:{__html:`window.okeProductUrlFormatter = ${d.toString()}`}}),o&&t.createElement("div",{dangerouslySetInnerHTML:{__html:o}}),a&&t.createElement("div",{dangerouslySetInnerHTML:{__html:a}}))},exports.OkendoReviews=({productId:n,okendoReviewsSnippet:s})=>{const i={"data-oke-widget":"","data-oke-reviews-product-id":r(n)};return t.createElement(e,{dataAttributes:i,metafieldContent:s?.value})},exports.OkendoStarRating=({productId:n,okendoStarRatingSnippet:s})=>{const i={"data-oke-star-rating":"","data-oke-reviews-product-id":r(n)};return t.createElement(e,{dataAttributes:i,metafieldContent:s?.value})},exports.getOkendoProviderData=async({context:t,subscriberId:e,apiDomain:n,cdnDomain:r})=>{const s=`https://${n??"api.okendo.io/v1"}/stores/${e}/widget_plus_settings`,i=await fetch(s);if(!i.ok)return console.error(`Failed to retrieve subscriber settings for subscriber ID '${e}'.`),null;const{reviewsHeaderConfig:o,cssVariables:a,customCss:d,starSymbols:l}=await i.json(),c=await fetch(`https://${r??"cdn-static.okendo.io"}/reviews-widget-plus/js/okendo-reviews.js`);if(!c.ok)return console.error("Failed to retrieve widget initialisation script."),null;const p=await c.text(),{shop:{widgetPreRenderStyleTags:u}}=await t.storefront.query('#graphql\n\t\tquery metafields {\n\t\t\tshop {\n\t\t\t\twidgetPreRenderStyleTags: metafield(\n\t\t\t\t\tnamespace: "okendo"\n\t\t\t\t\tkey: "WidgetPreRenderStyleTags"\n\t\t\t\t) {\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'),g=u?.value??"";return g||console.warn("Failed to retrieve pre-rendered widget style settings."),{reviewsHeaderConfig:o,cssVariables:a,customCss:d,initScriptContents:p,preRenderStyleTags:g,starSymbols:l}};
|
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import type { Storefront } from "@shopify/hydrogen";
|
|
2
|
-
import { type FC } from "react";
|
|
3
|
-
interface OkendoProviderData {
|
|
4
|
-
reviewsHeaderConfig: Record<string, unknown>;
|
|
5
|
-
cssVariables: string;
|
|
6
|
-
customCss?: string;
|
|
7
|
-
initScriptContents: string;
|
|
8
|
-
preRenderStyleTags: string;
|
|
9
|
-
starSymbols: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
12
|
-
context: {
|
|
13
|
-
storefront: Storefront;
|
|
14
|
-
};
|
|
15
|
-
subscriberId: string;
|
|
16
|
-
apiDomain?: string | undefined;
|
|
17
|
-
cdnDomain?: string | undefined;
|
|
18
|
-
}) => Promise<{
|
|
19
|
-
reviewsHeaderConfig: import("@okendo/reviews-common").WidgetPlus.ReviewsHeaderConfig;
|
|
20
|
-
cssVariables: string;
|
|
21
|
-
customCss: string | undefined;
|
|
22
|
-
initScriptContents: string;
|
|
23
|
-
preRenderStyleTags: string;
|
|
24
|
-
starSymbols: string;
|
|
25
|
-
} | null>;
|
|
26
|
-
interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
interface OkendoProviderProps {
|
|
32
|
-
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
33
|
-
productUrlFormatter?: (product: ReviewProduct) => string;
|
|
34
|
-
}
|
|
35
|
-
export declare const OkendoProvider: FC<OkendoProviderProps>;
|
|
36
|
-
export {};
|
|
1
|
+
import type { Storefront } from "@shopify/hydrogen";
|
|
2
|
+
import { type FC } from "react";
|
|
3
|
+
interface OkendoProviderData {
|
|
4
|
+
reviewsHeaderConfig: Record<string, unknown>;
|
|
5
|
+
cssVariables: string;
|
|
6
|
+
customCss?: string;
|
|
7
|
+
initScriptContents: string;
|
|
8
|
+
preRenderStyleTags: string;
|
|
9
|
+
starSymbols: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
12
|
+
context: {
|
|
13
|
+
storefront: Storefront;
|
|
14
|
+
};
|
|
15
|
+
subscriberId: string;
|
|
16
|
+
apiDomain?: string | undefined;
|
|
17
|
+
cdnDomain?: string | undefined;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
reviewsHeaderConfig: import("@okendo/reviews-common").WidgetPlus.ReviewsHeaderConfig;
|
|
20
|
+
cssVariables: string;
|
|
21
|
+
customCss: string | undefined;
|
|
22
|
+
initScriptContents: string;
|
|
23
|
+
preRenderStyleTags: string;
|
|
24
|
+
starSymbols: string;
|
|
25
|
+
} | null>;
|
|
26
|
+
interface OkendoProviderProps {
|
|
27
|
+
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
28
|
+
}
|
|
29
|
+
export declare const OkendoProvider: FC<OkendoProviderProps>;
|
|
30
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoProvider";
|
|
1
|
+
export * from "./OkendoProvider";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
-
export interface WithOkendoReviewsSnippet {
|
|
4
|
-
okendoReviewsSnippet: MetafieldValue;
|
|
5
|
-
}
|
|
6
|
-
interface OkendoReviewsProps {
|
|
7
|
-
productId: string;
|
|
8
|
-
okendoReviewsSnippet
|
|
9
|
-
}
|
|
10
|
-
export declare const OkendoReviews: FC<OkendoReviewsProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
+
export interface WithOkendoReviewsSnippet {
|
|
4
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
5
|
+
}
|
|
6
|
+
interface OkendoReviewsProps {
|
|
7
|
+
productId: string;
|
|
8
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const OkendoReviews: FC<OkendoReviewsProps>;
|
|
11
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoReviews";
|
|
1
|
+
export * from "./OkendoReviews";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
-
export interface WithOkendoStarRatingSnippet {
|
|
4
|
-
okendoStarRatingSnippet: MetafieldValue;
|
|
5
|
-
}
|
|
6
|
-
interface OkendoStarRatingProps {
|
|
7
|
-
productId: string;
|
|
8
|
-
okendoStarRatingSnippet
|
|
9
|
-
}
|
|
10
|
-
export declare const OkendoStarRating: FC<OkendoStarRatingProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
+
export interface WithOkendoStarRatingSnippet {
|
|
4
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
5
|
+
}
|
|
6
|
+
interface OkendoStarRatingProps {
|
|
7
|
+
productId: string;
|
|
8
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const OkendoStarRating: FC<OkendoStarRatingProps>;
|
|
11
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoStarRating";
|
|
1
|
+
export * from "./OkendoStarRating";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./OkendoProvider";
|
|
2
|
-
export * from "./OkendoReviews";
|
|
3
|
-
export * from "./OkendoStarRating";
|
|
1
|
+
export * from "./OkendoProvider";
|
|
2
|
+
export * from "./OkendoReviews";
|
|
3
|
+
export * from "./OkendoStarRating";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
2
|
-
export declare const OKENDO_PRODUCT_REVIEWS_FRAGMENT = "#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"ReviewsWidgetSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
1
|
+
export declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
2
|
+
export declare const OKENDO_PRODUCT_REVIEWS_FRAGMENT = "#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"ReviewsWidgetSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./fragments";
|
|
1
|
+
export * from "./fragments";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./components";
|
|
2
|
-
export * from "./fragments";
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./fragments";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ReviewsWidgetPlus } from "@okendo/reviews-widget-plus/dist-utils/ReviewsWidgetPlus";
|
|
2
|
-
import { type FC } from "react";
|
|
3
|
-
export interface OkendoWidgetProps {
|
|
4
|
-
dataAttributes: Record<string, unknown>;
|
|
5
|
-
metafieldContent?: string;
|
|
6
|
-
}
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
okeWidgetApi: ReviewsWidgetPlus.WidgetWindowApi;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export declare const OkendoWidget: FC<OkendoWidgetProps>;
|
|
1
|
+
import type { ReviewsWidgetPlus } from "@okendo/reviews-widget-plus/dist-utils/ReviewsWidgetPlus";
|
|
2
|
+
import { type FC } from "react";
|
|
3
|
+
export interface OkendoWidgetProps {
|
|
4
|
+
dataAttributes: Record<string, unknown>;
|
|
5
|
+
metafieldContent?: string;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
okeWidgetApi: ReviewsWidgetPlus.WidgetWindowApi;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const OkendoWidget: FC<OkendoWidgetProps>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface MetafieldValue {
|
|
2
|
-
value: string;
|
|
3
|
-
}
|
|
1
|
+
export interface MetafieldValue {
|
|
2
|
+
value: string;
|
|
3
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the product ID with Okendo formatting.
|
|
3
|
-
* @param productId The Shopify Product ID e.g. gid://shopify/Product/10079785100.
|
|
4
|
-
* @returns The product ID in Okendo formatting.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getOkendoProductId(productId: string): string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Gets the product ID with Okendo formatting.
|
|
3
|
+
* @param productId The Shopify Product ID e.g. gid://shopify/Product/10079785100.
|
|
4
|
+
* @returns The product ID in Okendo formatting.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getOkendoProductId(productId: string): string | undefined;
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t,{useRef as e,useEffect as n}from"react";const r=async({context:t,subscriberId:e,apiDomain:n,cdnDomain:r})=>{const i=`https://${n
|
|
1
|
+
import t,{useRef as e,useEffect as n}from"react";const r=async({context:t,subscriberId:e,apiDomain:n,cdnDomain:r})=>{const i=`https://${n??"api.okendo.io/v1"}/stores/${e}/widget_plus_settings`,s=await fetch(i);if(!s.ok)return console.error(`Failed to retrieve subscriber settings for subscriber ID '${e}'.`),null;const{reviewsHeaderConfig:o,cssVariables:a,customCss:d,starSymbols:l}=await s.json(),c=await fetch(`https://${r??"cdn-static.okendo.io"}/reviews-widget-plus/js/okendo-reviews.js`);if(!c.ok)return console.error("Failed to retrieve widget initialisation script."),null;const p=await c.text(),{shop:{widgetPreRenderStyleTags:u}}=await t.storefront.query('#graphql\n\t\tquery metafields {\n\t\t\tshop {\n\t\t\t\twidgetPreRenderStyleTags: metafield(\n\t\t\t\t\tnamespace: "okendo"\n\t\t\t\t\tkey: "WidgetPreRenderStyleTags"\n\t\t\t\t) {\n\t\t\t\t\tvalue\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t'),m=u?.value??"";return m||console.warn("Failed to retrieve pre-rendered widget style settings."),{reviewsHeaderConfig:o,cssVariables:a,customCss:d,initScriptContents:p,preRenderStyleTags:m,starSymbols:l}},i=({okendoProviderData:e})=>{if(!e)return null;const{reviewsHeaderConfig:n,cssVariables:r,customCss:i,initScriptContents:s,preRenderStyleTags:o,starSymbols:a}=e,d="(product) =>\n\t\tproduct && productHandle\n\t\t\t? \"/products/\" + product.productHandle + \"/\" + (product.variantId ? '?variantId=' + product.variantId : '')\n\t\t\t: undefined",l=(r??"").replace('<style id="oke-css-vars">',"").replace("</style>",""),c=i?i.replace('<style id="oke-reviews-custom-css">',"").replace("</style>",""):"";return t.createElement("div",null,t.createElement("script",{id:"oke-reviews-settings",type:"application/json",dangerouslySetInnerHTML:{__html:JSON.stringify(n)}}),t.createElement("style",{id:"oke-css-vars",dangerouslySetInnerHTML:{__html:l}}),c&&t.createElement("style",{id:"oke-reviews-custom-css",dangerouslySetInnerHTML:{__html:c}}),s&&t.createElement("script",{dangerouslySetInnerHTML:{__html:s}}),t.createElement("script",{type:"text/javascript",dangerouslySetInnerHTML:{__html:`window.okeProductUrlFormatter = ${d.toString()}`}}),o&&t.createElement("div",{dangerouslySetInnerHTML:{__html:o}}),a&&t.createElement("div",{dangerouslySetInnerHTML:{__html:a}}))},s=({dataAttributes:r,metafieldContent:i=""})=>{const s=e(null),o=()=>{s.current&&window.okeWidgetApi.initWidget(s.current)};return n((()=>(window.okeWidgetApi&&s.current?o():document.addEventListener("oke-script-loaded",o),()=>{document.removeEventListener("oke-script-loaded",o)})),[r]),t.createElement("div",{ref:s,key:JSON.stringify(r),...r,dangerouslySetInnerHTML:{__html:i}})},o=/^[0-9]*$/;function a(t){if(t)return`shopify-${o.test(t)?t:t.split("/").slice(-1)[0]}`}const d=({productId:e,okendoReviewsSnippet:n})=>{const r={"data-oke-widget":"","data-oke-reviews-product-id":a(e)};return t.createElement(s,{dataAttributes:r,metafieldContent:n?.value})},l=({productId:e,okendoStarRatingSnippet:n})=>{const r={"data-oke-star-rating":"","data-oke-reviews-product-id":a(e)};return t.createElement(s,{dataAttributes:r,metafieldContent:n?.value})},c='#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "StarRatingSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n',p='#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: "okendo"\n\t\t\tkey: "ReviewsWidgetSnippet"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n';export{p as OKENDO_PRODUCT_REVIEWS_FRAGMENT,c as OKENDO_PRODUCT_STAR_RATING_FRAGMENT,i as OkendoProvider,d as OkendoReviews,l as OkendoStarRating,r as getOkendoProviderData};
|
|
@@ -1,36 +1,30 @@
|
|
|
1
|
-
import type { Storefront } from "@shopify/hydrogen";
|
|
2
|
-
import { type FC } from "react";
|
|
3
|
-
interface OkendoProviderData {
|
|
4
|
-
reviewsHeaderConfig: Record<string, unknown>;
|
|
5
|
-
cssVariables: string;
|
|
6
|
-
customCss?: string;
|
|
7
|
-
initScriptContents: string;
|
|
8
|
-
preRenderStyleTags: string;
|
|
9
|
-
starSymbols: string;
|
|
10
|
-
}
|
|
11
|
-
export declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
12
|
-
context: {
|
|
13
|
-
storefront: Storefront;
|
|
14
|
-
};
|
|
15
|
-
subscriberId: string;
|
|
16
|
-
apiDomain?: string | undefined;
|
|
17
|
-
cdnDomain?: string | undefined;
|
|
18
|
-
}) => Promise<{
|
|
19
|
-
reviewsHeaderConfig: import("@okendo/reviews-common").WidgetPlus.ReviewsHeaderConfig;
|
|
20
|
-
cssVariables: string;
|
|
21
|
-
customCss: string | undefined;
|
|
22
|
-
initScriptContents: string;
|
|
23
|
-
preRenderStyleTags: string;
|
|
24
|
-
starSymbols: string;
|
|
25
|
-
} | null>;
|
|
26
|
-
interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
interface OkendoProviderProps {
|
|
32
|
-
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
33
|
-
productUrlFormatter?: (product: ReviewProduct) => string;
|
|
34
|
-
}
|
|
35
|
-
export declare const OkendoProvider: FC<OkendoProviderProps>;
|
|
36
|
-
export {};
|
|
1
|
+
import type { Storefront } from "@shopify/hydrogen";
|
|
2
|
+
import { type FC } from "react";
|
|
3
|
+
interface OkendoProviderData {
|
|
4
|
+
reviewsHeaderConfig: Record<string, unknown>;
|
|
5
|
+
cssVariables: string;
|
|
6
|
+
customCss?: string;
|
|
7
|
+
initScriptContents: string;
|
|
8
|
+
preRenderStyleTags: string;
|
|
9
|
+
starSymbols: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
12
|
+
context: {
|
|
13
|
+
storefront: Storefront;
|
|
14
|
+
};
|
|
15
|
+
subscriberId: string;
|
|
16
|
+
apiDomain?: string | undefined;
|
|
17
|
+
cdnDomain?: string | undefined;
|
|
18
|
+
}) => Promise<{
|
|
19
|
+
reviewsHeaderConfig: import("@okendo/reviews-common").WidgetPlus.ReviewsHeaderConfig;
|
|
20
|
+
cssVariables: string;
|
|
21
|
+
customCss: string | undefined;
|
|
22
|
+
initScriptContents: string;
|
|
23
|
+
preRenderStyleTags: string;
|
|
24
|
+
starSymbols: string;
|
|
25
|
+
} | null>;
|
|
26
|
+
interface OkendoProviderProps {
|
|
27
|
+
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
28
|
+
}
|
|
29
|
+
export declare const OkendoProvider: FC<OkendoProviderProps>;
|
|
30
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoProvider";
|
|
1
|
+
export * from "./OkendoProvider";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
-
export interface WithOkendoReviewsSnippet {
|
|
4
|
-
okendoReviewsSnippet: MetafieldValue;
|
|
5
|
-
}
|
|
6
|
-
interface OkendoReviewsProps {
|
|
7
|
-
productId: string;
|
|
8
|
-
okendoReviewsSnippet
|
|
9
|
-
}
|
|
10
|
-
export declare const OkendoReviews: FC<OkendoReviewsProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
+
export interface WithOkendoReviewsSnippet {
|
|
4
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
5
|
+
}
|
|
6
|
+
interface OkendoReviewsProps {
|
|
7
|
+
productId: string;
|
|
8
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const OkendoReviews: FC<OkendoReviewsProps>;
|
|
11
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoReviews";
|
|
1
|
+
export * from "./OkendoReviews";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type FC } from "react";
|
|
2
|
-
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
-
export interface WithOkendoStarRatingSnippet {
|
|
4
|
-
okendoStarRatingSnippet: MetafieldValue;
|
|
5
|
-
}
|
|
6
|
-
interface OkendoStarRatingProps {
|
|
7
|
-
productId: string;
|
|
8
|
-
okendoStarRatingSnippet
|
|
9
|
-
}
|
|
10
|
-
export declare const OkendoStarRating: FC<OkendoStarRatingProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type FC } from "react";
|
|
2
|
+
import { type MetafieldValue } from "../../internal/types";
|
|
3
|
+
export interface WithOkendoStarRatingSnippet {
|
|
4
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
5
|
+
}
|
|
6
|
+
interface OkendoStarRatingProps {
|
|
7
|
+
productId: string;
|
|
8
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
9
|
+
}
|
|
10
|
+
export declare const OkendoStarRating: FC<OkendoStarRatingProps>;
|
|
11
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./OkendoStarRating";
|
|
1
|
+
export * from "./OkendoStarRating";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./OkendoProvider";
|
|
2
|
-
export * from "./OkendoReviews";
|
|
3
|
-
export * from "./OkendoStarRating";
|
|
1
|
+
export * from "./OkendoProvider";
|
|
2
|
+
export * from "./OkendoReviews";
|
|
3
|
+
export * from "./OkendoStarRating";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
2
|
-
export declare const OKENDO_PRODUCT_REVIEWS_FRAGMENT = "#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"ReviewsWidgetSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
1
|
+
export declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
2
|
+
export declare const OKENDO_PRODUCT_REVIEWS_FRAGMENT = "#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"ReviewsWidgetSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./fragments";
|
|
1
|
+
export * from "./fragments";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./components";
|
|
2
|
-
export * from "./fragments";
|
|
1
|
+
export * from "./components";
|
|
2
|
+
export * from "./fragments";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ReviewsWidgetPlus } from "@okendo/reviews-widget-plus/dist-utils/ReviewsWidgetPlus";
|
|
2
|
-
import { type FC } from "react";
|
|
3
|
-
export interface OkendoWidgetProps {
|
|
4
|
-
dataAttributes: Record<string, unknown>;
|
|
5
|
-
metafieldContent?: string;
|
|
6
|
-
}
|
|
7
|
-
declare global {
|
|
8
|
-
interface Window {
|
|
9
|
-
okeWidgetApi: ReviewsWidgetPlus.WidgetWindowApi;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export declare const OkendoWidget: FC<OkendoWidgetProps>;
|
|
1
|
+
import type { ReviewsWidgetPlus } from "@okendo/reviews-widget-plus/dist-utils/ReviewsWidgetPlus";
|
|
2
|
+
import { type FC } from "react";
|
|
3
|
+
export interface OkendoWidgetProps {
|
|
4
|
+
dataAttributes: Record<string, unknown>;
|
|
5
|
+
metafieldContent?: string;
|
|
6
|
+
}
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
okeWidgetApi: ReviewsWidgetPlus.WidgetWindowApi;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare const OkendoWidget: FC<OkendoWidgetProps>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export interface MetafieldValue {
|
|
2
|
-
value: string;
|
|
3
|
-
}
|
|
1
|
+
export interface MetafieldValue {
|
|
2
|
+
value: string;
|
|
3
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the product ID with Okendo formatting.
|
|
3
|
-
* @param productId The Shopify Product ID e.g. gid://shopify/Product/10079785100.
|
|
4
|
-
* @returns The product ID in Okendo formatting.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getOkendoProductId(productId: string): string | undefined;
|
|
1
|
+
/**
|
|
2
|
+
* Gets the product ID with Okendo formatting.
|
|
3
|
+
* @param productId The Shopify Product ID e.g. gid://shopify/Product/10079785100.
|
|
4
|
+
* @returns The product ID in Okendo formatting.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getOkendoProductId(productId: string): string | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,63 +2,57 @@ import * as _okendo_reviews_common from '@okendo/reviews-common';
|
|
|
2
2
|
import { Storefront } from '@shopify/hydrogen';
|
|
3
3
|
import { FC } from 'react';
|
|
4
4
|
|
|
5
|
-
interface OkendoProviderData {
|
|
6
|
-
reviewsHeaderConfig: Record<string, unknown>;
|
|
7
|
-
cssVariables: string;
|
|
8
|
-
customCss?: string;
|
|
9
|
-
initScriptContents: string;
|
|
10
|
-
preRenderStyleTags: string;
|
|
11
|
-
starSymbols: string;
|
|
12
|
-
}
|
|
13
|
-
declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
14
|
-
context: {
|
|
15
|
-
storefront: Storefront;
|
|
16
|
-
};
|
|
17
|
-
subscriberId: string;
|
|
18
|
-
apiDomain?: string | undefined;
|
|
19
|
-
cdnDomain?: string | undefined;
|
|
20
|
-
}) => Promise<{
|
|
21
|
-
reviewsHeaderConfig: _okendo_reviews_common.WidgetPlus.ReviewsHeaderConfig;
|
|
22
|
-
cssVariables: string;
|
|
23
|
-
customCss: string | undefined;
|
|
24
|
-
initScriptContents: string;
|
|
25
|
-
preRenderStyleTags: string;
|
|
26
|
-
starSymbols: string;
|
|
27
|
-
} | null>;
|
|
28
|
-
interface
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
variantId?: string;
|
|
32
|
-
}
|
|
33
|
-
interface OkendoProviderProps {
|
|
34
|
-
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
35
|
-
productUrlFormatter?: (product: ReviewProduct) => string;
|
|
36
|
-
}
|
|
5
|
+
interface OkendoProviderData {
|
|
6
|
+
reviewsHeaderConfig: Record<string, unknown>;
|
|
7
|
+
cssVariables: string;
|
|
8
|
+
customCss?: string;
|
|
9
|
+
initScriptContents: string;
|
|
10
|
+
preRenderStyleTags: string;
|
|
11
|
+
starSymbols: string;
|
|
12
|
+
}
|
|
13
|
+
declare const getOkendoProviderData: ({ context, subscriberId, apiDomain, cdnDomain, }: {
|
|
14
|
+
context: {
|
|
15
|
+
storefront: Storefront;
|
|
16
|
+
};
|
|
17
|
+
subscriberId: string;
|
|
18
|
+
apiDomain?: string | undefined;
|
|
19
|
+
cdnDomain?: string | undefined;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
reviewsHeaderConfig: _okendo_reviews_common.WidgetPlus.ReviewsHeaderConfig;
|
|
22
|
+
cssVariables: string;
|
|
23
|
+
customCss: string | undefined;
|
|
24
|
+
initScriptContents: string;
|
|
25
|
+
preRenderStyleTags: string;
|
|
26
|
+
starSymbols: string;
|
|
27
|
+
} | null>;
|
|
28
|
+
interface OkendoProviderProps {
|
|
29
|
+
okendoProviderData: Partial<OkendoProviderData> | null;
|
|
30
|
+
}
|
|
37
31
|
declare const OkendoProvider: FC<OkendoProviderProps>;
|
|
38
32
|
|
|
39
|
-
interface MetafieldValue {
|
|
40
|
-
value: string;
|
|
33
|
+
interface MetafieldValue {
|
|
34
|
+
value: string;
|
|
41
35
|
}
|
|
42
36
|
|
|
43
|
-
interface WithOkendoReviewsSnippet {
|
|
44
|
-
okendoReviewsSnippet: MetafieldValue;
|
|
45
|
-
}
|
|
46
|
-
interface OkendoReviewsProps {
|
|
47
|
-
productId: string;
|
|
48
|
-
okendoReviewsSnippet
|
|
49
|
-
}
|
|
37
|
+
interface WithOkendoReviewsSnippet {
|
|
38
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
39
|
+
}
|
|
40
|
+
interface OkendoReviewsProps {
|
|
41
|
+
productId: string;
|
|
42
|
+
okendoReviewsSnippet: MetafieldValue;
|
|
43
|
+
}
|
|
50
44
|
declare const OkendoReviews: FC<OkendoReviewsProps>;
|
|
51
45
|
|
|
52
|
-
interface WithOkendoStarRatingSnippet {
|
|
53
|
-
okendoStarRatingSnippet: MetafieldValue;
|
|
54
|
-
}
|
|
55
|
-
interface OkendoStarRatingProps {
|
|
56
|
-
productId: string;
|
|
57
|
-
okendoStarRatingSnippet
|
|
58
|
-
}
|
|
46
|
+
interface WithOkendoStarRatingSnippet {
|
|
47
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
48
|
+
}
|
|
49
|
+
interface OkendoStarRatingProps {
|
|
50
|
+
productId: string;
|
|
51
|
+
okendoStarRatingSnippet: MetafieldValue;
|
|
52
|
+
}
|
|
59
53
|
declare const OkendoStarRating: FC<OkendoStarRatingProps>;
|
|
60
54
|
|
|
61
|
-
declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
55
|
+
declare const OKENDO_PRODUCT_STAR_RATING_FRAGMENT = "#graphql\n\tfragment OkendoStarRatingSnippet on Product {\n\t\tokendoStarRatingSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"StarRatingSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
62
56
|
declare const OKENDO_PRODUCT_REVIEWS_FRAGMENT = "#graphql\n\tfragment OkendoReviewsSnippet on Product {\n\t\tokendoReviewsSnippet: metafield(\n\t\t\tnamespace: \"okendo\"\n\t\t\tkey: \"ReviewsWidgetSnippet\"\n\t\t) {\n\t\t\tvalue\n\t\t}\n\t}\n";
|
|
63
57
|
|
|
64
58
|
export { OKENDO_PRODUCT_REVIEWS_FRAGMENT, OKENDO_PRODUCT_STAR_RATING_FRAGMENT, OkendoProvider, OkendoReviews, OkendoStarRating, WithOkendoReviewsSnippet, WithOkendoStarRatingSnippet, getOkendoProviderData };
|