From 9ecc30dc473e3c4e58095bc5ede3c864916c62d7 Mon Sep 17 00:00:00 2001 From: Siddharth Sahay Date: Thu, 27 Jun 2024 15:26:17 +0300 Subject: [PATCH] set script --- src/components/NostoProvider.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/NostoProvider.tsx b/src/components/NostoProvider.tsx index 59208c0..afb3875 100644 --- a/src/components/NostoProvider.tsx +++ b/src/components/NostoProvider.tsx @@ -149,10 +149,10 @@ export default function NostoProvider(props: NostoProviderProps) { if (!document.querySelectorAll("[nosto-client-script]").length && !shopifyMarkets) { const scriptUrl = `//${host || "connect.nosto.com"}/include/${account}` - /*if (typeof setScriptUrl === "function") { + if (typeof setScriptUrl === "function") { console.log("Setting script URL") setScriptUrl(scriptUrl) - } else {*/ + } else { console.log("Creating script element") const script = document.createElement("script") script.type = "text/javascript" @@ -168,7 +168,7 @@ export default function NostoProvider(props: NostoProviderProps) { setClientScriptLoadedState(true) } document.body.appendChild(script) - /*}*/ + } } // Enable Shopify markets functionality: @@ -194,10 +194,10 @@ export default function NostoProvider(props: NostoProviderProps) { shopifyMarkets.marketId || "" }&locale=${shopifyMarkets?.language?.toLowerCase() || ""}` - /*if (typeof setScriptUrl === "function") { + if (typeof setScriptUrl === "function") { console.log("Setting script URL") setScriptUrl(scriptUrl) - } else {*/ + } else { console.log("Creating script element") const script = document.createElement("script") script.type = "text/javascript" @@ -215,7 +215,7 @@ export default function NostoProvider(props: NostoProviderProps) { setClientScriptLoadedState(true) } document.body.appendChild(script) - /*}*/ + } } } }, [clientScriptLoadedState, shopifyMarkets])