(() => {
document.addEventListener(“shopline_sdk_loaded”, renderButton);
if(!window.ShoplineBuy) getSdk();
else renderButton();
function getSdk(){
const elem = document.createElement(“script”);
elem.src = “https://buy-button.shoplineapp.com/sdk.js”;
elem.defer = true;
elem.async = true;
elem.id = “shopline-buy-sdk”
elem.onload = () => {document.dispatchEvent(new CustomEvent(‘shopline_sdk_loaded’)); }
if (!document.getElementById(“shopline-buy-sdk”)) {
document.body.appendChild(elem);
}
}
function renderButton(){
const client = window.ShoplineBuy.getClient({
accessToken: “MTYyMTU2NTY1MDUyMy01NWIwODI5M2UzN2VjNmFlYjIwMDAwMDc=”,
endpoint: “https://buy-button.shoplineapp.com”
});
client.render(“sl-buybutton-1621565804457”, {“productBrief”:{“layout”:”normal”,”callToAction”:”checkout”,”text”:{“button”:”Buy Now”},”style”:{“button”:{“textAlign”:”center”,”radius”:0,”width”:180,”backgroundColor”:”#b8becc”,”color”:”#363d4d”,”borderColor”:”transparent”,”fontSize”:16,”fontFamily”:”Arial”},”type”:”product”,”id”:”55b1b1e969702d26dc190a00″});
}
})()