Skip to content

Commit

Permalink
set script
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Sahay committed Jun 27, 2024
1 parent 8471d9d commit 9ecc30d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/NostoProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -168,7 +168,7 @@ export default function NostoProvider(props: NostoProviderProps) {
setClientScriptLoadedState(true)
}
document.body.appendChild(script)
/*}*/
}
}

// Enable Shopify markets functionality:
Expand All @@ -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"
Expand All @@ -215,7 +215,7 @@ export default function NostoProvider(props: NostoProviderProps) {
setClientScriptLoadedState(true)
}
document.body.appendChild(script)
/*}*/
}
}
}
}, [clientScriptLoadedState, shopifyMarkets])
Expand Down

0 comments on commit 9ecc30d

Please sign in to comment.