[]
0; window.SwymPageData = {}, window.SwymProductInfo = {}; var unknown = {et: 0}; window.SwymPageData = unknown; window.SwymPageData.uri = window.swymLandingURL; }; if(window.selectCallback){ (function(){ // Variant select override var originalSelectCallback = window.selectCallback; window.selectCallback = function(variant){ originalSelectCallback.apply(this, arguments); try{ if(window.triggerSwymVariantEvent){ window.triggerSwymVariantEvent(variant.id); } }catch(err){ console.warn(“Swym selectCallback”, err); } }; })(); } window.swymCustomerId = null; var swappName = (“Wishlist” || “Wishlist”); var swymJSObject = { pid: “LuNw0LzVLChzqS60Nq3zII6XWzZuc2nLw8mfT2/7Oy8=” || “LuNw0LzVLChzqS60Nq3zII6XWzZuc2nLw8mfT2/7Oy8=”, interface: “/apps/swym” + swappName + “/interfaces/interfaceStore.php?appname=” + swappName }; window.swymJSShopifyLoad = function(){ if(window.swymPageLoad) swymPageLoad(); if(!window._swat) { (function (s, w, r, e, l, a, y) { r[‘SwymRetailerConfig’] = s; r[s] = r[s] || function (k, v) { r[s][k] = v; }; })(‘_swrc’, ”, window); _swrc(‘RetailerId’, swymJSObject.pid); _swrc(‘Callback’, function(){initSwymShopify();}); }else if(window._swat.postLoader){ _swrc = window._swat.postLoader; _swrc(‘RetailerId’, swymJSObject.pid); _swrc(‘Callback’, function(){initSwymShopify();}); }else{ initSwymShopify(); } } if(!window._SwymPreventAutoLoad) { swymJSShopifyLoad(); } window.swymGetCartCookies = function(){ var RequiredCookies = [“cart”, “swym-session-id”, “swym-swymRegid”, “swym-email”]; var reqdCookies = {}; RequiredCookies.forEach(function(k){ reqdCookies[k] = _swat.storage.getRaw(k); }); var cart_token = window.swymCart.token; var data = { action:’cart’, token:cart_token, cookies:reqdCookies }; return data; } window.swymGetCustomerData = function(){ return {status:1}; } ]]]]]]>]]]]>]]> svg{fill:#000}.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jm-mfp-content,.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev__icon,.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev__pic-img,.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev__reply{border-radius:8px}.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev[data-verified-buyer=”true”] .jdgm-full-rev__icon::after{border-radius:8px}.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev .jdgm-rev__buyer-badge{border-radius:calc( 8px / 2 )}.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev .jdgm-full-rev__replier::before{content:’Vital Living Herbs And Nutrition’}.jdgm-full-rev-modal.rev-snippet-widget .jm-mfp-container .jdgm-full-rev .jdgm-full-rev__product-button{border-radius:calc( 8px * 6 )} ]]]]]]>]]]]>]]> 0)&&(jdgmSettings.widget_load_with_code_splitting? parseFloat(jdgmSettings.widget_version)>=3?jdgm.loadCSS(jdgm.CDN_HOST+”widget_v3/base.css”): jdgm.loadCSS(jdgm.CDN_HOST+”widget/base.css”):jdgm.loadCSS(jdgm.CDN_HOST+”shopify_v2.css”), jdgm.loadJS(jdgm.CDN_HOST+”loader.js”))}))}(document); ]]]]]]>]]]]>]]>
{ fetchOptions.method = ‘POST’; fetch(_url + ‘/api/storeapi/authv2’, fetchOptions).then((response) => response.text()).then((result) => { var data = JSON.parse(result); if (data.enabled) { _widget = data.widget; setWidget(data.css, data.mcss); updateWidgetPoints(data.points); updateWidgetRewards(data.rewards); updateCartView(); } else { console.log(‘Disabled: ‘ + data.message); } }).catch((error) => console.log(‘storeapi/authv2: error occured : ‘, error)); }; messageHandler = (event) => { console.log(‘message received’, event); if (event.data.action == ‘ready’ && event.data.source == ‘main’) { document.getElementById(‘tm-rewards’).style.display = ‘block’; var widgetIframe = document.querySelector(‘#tm-widget>iframe’); widgetIframe = widgetIframe.contentWindow || widgetIframe.contentDocument.document || widgetIframe.contentDocument; widgetIframe .document .querySelector(‘.tool’) .classList .remove(‘loading’); widgetIframe .document .querySelector(‘.tool i’) .style .visibility = ‘visible’; } else if (event.data.action == ‘closed’ && event.data.source == ‘main’) { document.getElementById(‘tm-rewards’).remove(); } else if (event.data.action == ‘login_requested’ && event.data.source == ‘main’) { document.getElementById(‘tm-rewards’).remove(); window.location.href = window.location.origin + ‘/account/login’; } else if (event.data.action == ‘signup_requested’ && event.data.source == ‘main’) { document.getElementById(‘tm-rewards’).remove(); window.location.href = window.location.origin + ‘/account/register’; } else if (event.data.action == ‘points_updated’ && event.data.source == ‘main’) { updateWidgetPoints(event.data.points) } }; setWidget = (css, mcss) => { if (window.addEventListener) { addEventListener(‘message’, messageHandler, false); } else { window.attachEvent(‘onmessage’, messageHandler); } var tmWidget = document.getElementById(‘tm-widget’); var widgetIframe = document.querySelector(‘#tm-widget>iframe’); widgetIframe = widgetIframe.contentWindow || widgetIframe.contentDocument.document || widgetIframe.contentDocument; widgetIframe.document.open(); widgetIframe.document.write(_widget); widgetIframe.document.close(); tmWidget.style.height = widgetIframe.document.querySelector(‘body’).offsetHeight + 10 + ‘px’; tmWidget.style.width = widgetIframe.document.querySelector(‘.widget’).offsetWidth + 10 + ‘px’; widgetIframe.document.querySelector(‘.widget’).addEventListener(‘click’, function(e) { widgetIframe .document .querySelector(‘.tool’) .classList .add(‘loading’); widgetIframe .document .querySelector(‘.tool i’) .style .visibility = ‘hidden’; showRewards(); }); widgetIframe.addEventListener(‘load’, function() { if (css != ”) { addCSS(‘tm-widget’, css); } if (mcss != null && mcss != ”) { addMcss(‘tm-widget’, mcss); } }); }; showRewards = () => { var popup = document.getElementById(‘tm-rewards’); if (popup == null) { var popup = document.createElement(‘iframe’); popup.id = ‘tm-rewards’; popup.frameborder = ‘0’; popup.allowtransparency = ‘true’; popup.setAttribute(‘scrolling’, ‘no’); popup.style.cssText = ` position: fixed; top: 0px; left: 0px; overflow-x: hidden; overflow-y: auto; z-index: 9999999; display: none; border: none; margin: 0px; padding: 0px; width: 100%; height: 100%; background: transparent; visibility: visible; `; document.getElementById(‘tm-rewards-wrapper’).append(popup); } var url = _url + ‘/store/indexv2’; popup.src = url; }; updateWidgetPoints = (points) => { var iPoints = points != null && points != undefined && points != 0 && isNaN(points) == false ? parseInt(points + ”) : 0; var widgetIframe = document.querySelector(‘#tm-widget>iframe’); widgetIframe = widgetIframe.contentWindow || widgetIframe.contentDocument.document || widgetIframe.contentDocument; var cont = widgetIframe.document.querySelector(‘.points’); if (cont != null) { if (iPoints >= 0) { cont.textContent = iPoints + ‘ ‘ + cont.getAttribute(‘data-label’); cont.style.display = ‘inline-block’; } else { cont.textContent = ”; cont.style.display = ‘none’; } document.getElementById(‘tm-widget’).style.width = widgetIframe.document.querySelector(‘.widget’).offsetWidth + 10 + ‘px’; } }; updateWidgetRewards = (rewards) => { var iRewards = rewards != null && rewards != undefined && rewards != 0 && isNaN(rewards) == false ? parseInt(rewards + ”) : 0; var widgetIframe = document.querySelector(‘#tm-widget>iframe’); widgetIframe = widgetIframe.contentWindow || widgetIframe.contentDocument.document || widgetIframe.contentDocument; var cont = widgetIframe.document.querySelector(‘.rewards’); if (cont != null) { if (iRewards > 0) { cont.textContent = iRewards; cont.style.display = ‘inline-block’; } else { cont.textContent = ”; cont.style.display = ‘none’; } document.getElementById(‘tm-widget’).style.width = widgetIframe.document.querySelector(‘.widget’).offsetWidth + 10 + ‘px’; } }; updateCartView = () => { if (document.getElementById(‘shopify-section-cart-template’) == null) return; var cid = ”; if (” != null && ” != undefined && ” != ”) { cid = ”; console.log(‘CID is ‘ + cid); } if (cid == ”) return; fetchOptions.method = ‘POST’; fetch(_url + ‘/api/storeapi/GetPromoCodesV2’, fetchOptions).then((response) => response.text()).then((result) => { var data = JSON.parse(result); if (data.codes != null && data.codes.length > 0) { setCartPromoCodesView(data.codes); } }).catch((error) => console.log(‘/store/GetPromoCodesV2: error occured : ‘, error)); }; setCartPromoCodesView = (codes) => { if (document.getElementById(‘shopify-section-cart-template’) == null) return; var lbl = ‘points’; var widgetIframe = document.querySelector(‘#tm-widget>iframe’); widgetIframe = widgetIframe.contentWindow || widgetIframe.contentDocument.document || widgetIframe.contentDocument; if (widgetIframe != null) { var p = widgetIframe.document.querySelector(‘.points’); if (p != null) lbl = p.getAttribute(‘data-label’); } var cont = document.getElementById(‘shopify-section-cart-template’); var chbtn = cont.querySelector(‘input[name=”checkout”]’); if (chbtn != null) cont = chbtn.parentElement; var tmdiv = cont.getElementById(‘tm-cart-prmocodes’); if (tmdiv == null) { cont.prepend(“]]]]]]>]]]]>]]>”); tmdiv = cont.getElementById(‘tm-cart-prmocodes’); } tmdiv.append(“
Available Rewards: Copy the code and apply it during checkout
“);
for (var i = 0; i < codes.length; i++) {
tmdiv.append("
” + codes[i].title + ‘ ‘ + (
codes[i].points > 0
? ” ” + codes[i].points + ‘ ‘ + lbl + ”
: ”
) + ”
“); } }; addCSS = (id, css) => { var div = document.getElementById(id); style = document.createElement(‘style’); div.append(style); style.type = ‘text/css’; style.append(document.createTextNode(css)); }; addMcss = (id, mcss) => { var iframe = document.querySelector(‘#’ + id + ‘>iframe’); iframe = iframe.contentWindow || iframe.contentDocument.document || iframe.contentDocument; var iframeHead = iframe.document.querySelector(‘head’); console.log(iframe.document); var styleSheet = document.createElement(‘link’); styleSheet.type = ‘text/css’; styleSheet.rel = ‘stylesheet’; styleSheet.href = _url + mcss; iframeHead.append(styleSheet); }; init(); })();