/** * version number: 27.8 */ if (typeof window.sealsubsloaded === 'undefined' || document.getElementById("seal-subs-loaded") === null) { try { // Mark SealSubs as loaded window.sealsubsloaded = true; var sealElm542 = document.createElement('div'); sealElm542.id = 'seal-subs-loaded'; sealElm542.style.cssText = 'display:none;'; document.body.appendChild(sealElm542); } catch(e) { console.error(e); } (function() { //var moduleURL = 'https://app.sealsubscriptions.com/shopify/public/js/seal-ac-module.js?shop=verbena-flores.myshopify.com' //if (window.sealsubscriptions_settings_updated !== 'undefined') { // moduleURL += '&' + window.sealsubscriptions_settings_updated; //} //import testModule from moduleURL; if (typeof window.disableSealSubscriptionsApp === 'boolean' && window.disableSealSubscriptionsApp === true) { console.log('Seal Subscriptions app was disabled by the window.disableSealSubscriptionsApp variable.'); return true; } var canShowWidgets = true; var autoInjectWidgets = true; var loadScript = function(url, callback, module){ var script = document.createElement("script") if (typeof module !== 'undefined' && module === true) { script.type = "module"; } else { script.type = "text/javascript"; } script.setAttribute("defer", "defer"); if (script.readyState){ //IE script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { //Others script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); }; var displaySealViaPreview = false; var subscriptionRules = []; var previewStyles = ""; var settings = { 'widget_ac_show_savings_badge': "true", 'one_time_option_on_top' : "true", 'subscription_widget_design' : "default" }; // Main SealSubs app var SealSubs = function() { var subscriptionRules = []; // Our replacement for jQuery var $_ = function(selector) { var d = function(els) { // Assign elements to the els variable if (arguments.length === 1) { this._els = els; } else { this._els = []; } this.is$ = true; // _els can be: // - node list // - array of nodes // - node this.getFirstEl = function(returnEmpty) { if (typeof returnEmpty === 'undefined') { returnEmpty = false; } if (this._els instanceof Node) { // This is already a node //console.log('Node'); return this._els; } else if (this._els instanceof NodeList && typeof this._els.length > 0) { //console.log('NodeList', this._els.length); // This is a list of nodes // Return the first node return this._els[0]; } else if (typeof this._els === 'object' && typeof this._els.length === 'number' && typeof this._els[0] !== 'undefined') { //console.log('Array', this._els.length, this._els[0] instanceof Node, this._els[0] instanceof NodeList); // It this is an array return this._els[0]; } if (returnEmpty) { return null; } else { return document.createElement('DIV'); } } if (this._els instanceof Node) { this[0] = this._els; } else if (this._els instanceof Node === false && this._els.length > 0) { for(var i = 0; i 0) { for(var x = 0; x { eventHandler.call(el, e); }; el.addEventListener(eventName, wrappedHandler); }); } else { this.loopAndApply(this._els, function(el) { const wrappedHandler = (e) => { if (!e.target) return; const el = e.target.closest(selector); if (el) { /* const newEvent = Object.create(e, { target: { value: el } }); */ //e.target.value = el; eventHandler.call(el, e); } }; el.addEventListener(eventName, wrappedHandler); }); } } d.prototype.after = function(html) { var parsed = this.parseHtml(html); this.loopAndApply(this._els, function(el) { el.after(parsed); }); } d.prototype.append = function(html) { var parsed = this.parseHtml(html); this.loopAndApply(this._els, function(el) { el.append(parsed); }); } d.prototype.before = function(html) { var parsed = this.parseHtml(html); this.loopAndApply(this._els, function(el) { el.before(parsed); }); } d.prototype.prepend = function(html) { var parsed = this.parseHtml(html); this.loopAndApply(this._els, function(el) { el.prepend(parsed); }); } d.prototype.attr = function(k, v) { if (typeof v !== 'undefined') { this.loopAndApply(this._els, function(el) { el.setAttribute(k, v); }); return this; } else { var attr = this.getFirstEl().getAttribute(k); if (attr === null) { attr = undefined; } return attr; } } d.prototype.removeAttr = function(k) { if (typeof v !== 'undefined') { this.loopAndApply(this._els, function(el) { el.removeAttribute(k); }); } else { return this.getFirstEl().removeAttribute(k); } } d.prototype.html = function(html) { if (arguments.length === 1) { // We are setting the value if (typeof html !== 'undefined') { this.loopAndApply(this._els, function(el) { el.innerHTML = html; }); } else { this.getFirstEl().innerHTML = html; } } else { // We are retrieving value return this.getFirstEl().innerHTML; } return this; } d.prototype.text = function(value) { var el = this.getFirstEl(); if (arguments.length === 1) { // We are setting the value if (typeof value === 'undefined') { value = ''; } // We are setting value el.textContent = value; } else { // We are retrieving value return el.textContent; //return null; } } // find, // closest d.prototype._findElements = function(selector, node, scoped) { if (typeof node === 'undefined') { node = document; } var els = []; if (selector.indexOf(':visible') !== -1) { // The selector contains the :visible selector // Explode by selector, find elements, filter them and so on var pair = selector.split(':visible'); //var tmpEls = node.querySelectorAll(pair[0]); var tmpEls = this._findElements(pair[0], node); for (let i = 0; i < tmpEls.length; i++) { var x = new d(tmpEls[i]); if (x.visible()) { if (pair[1] === '') { // Filter the current set of elements els.push(tmpEls[i]); } else { // Find the rest of elements var y = x.find(pair[1]); if (y._els instanceof NodeList) { for(var z = 0; z < y._els.length; z++) { els.push(y._els[z]); } } //els = els.concat(y._els); } } } } else if (selector.indexOf(':first') !== -1) { // The selector contains the :visible selector // Explode by selector, find elements, filter them and so on if (selector.indexOf(',') !== -1) { // We have multile selectors. Explode them by comma and run each separately, then group the results // This resolves the problem if you use :first selector with other elements (comma separated), like that "select.bndlr-select-variant[name="variant_id"], input[name^="items\["][name$="\]id"]:first" var allSelectors = selector.split(','); for (var j = 0; j < allSelectors.length; j++) { var tmpEls = this._findElements(allSelectors[j].trim(), node); // tmpEls can be either Array or NodeList if (tmpEls.length > 0) { for(var z = 0; z < tmpEls.length; z++) { els.push(tmpEls[z]); } } } } else { var pair = selector.split(':first'); var tmpEls = this._findElements(pair[0], node); if (tmpEls.length > 0) { els.push(tmpEls[0]); } } } else { /* if (typeof scoped !== 'undefined' && scoped === true) { selector = 'scope: ' + selector; //selector.replaceAll(',', ',scope:'); }*/ /* if (typeof scoped !== 'undefined' && scoped === true) { console.log('node', node); }*/ els = node.querySelectorAll(selector); } return els; } // Find all elements and children that match the selector d.prototype.find = function(selector) { var firstEl = this.getFirstEl(); var els = []; if (firstEl !== null && typeof firstEl.querySelectorAll === 'function') { els = this._findElements(selector, firstEl, true); } return (new d(els)); } d.prototype.closest = function(selector) { var els = []; var closestOne = this.getFirstEl().closest(selector); if (closestOne !== null && closestOne instanceof Node) { els.push(closestOne); } if (els.length >= 1 && els[0] !== null) { return (new d(els)); } return (new d()); } d.prototype.first = function() { var first = this.getFirstEl(true); if (first === null) { return (new d()); } else { return (new d(first)); } } // Filter the current set of elements d.prototype.filter = function(selector) { var els = []; if (selector === ':selected') { for (let i = 0; i < this._els.length; i++) { if (this._els[i].selected) { els.push(this._els[i]); } } } else { els = [this.getFirstEl().filter(selector)]; } return (new d(els)); } d.prototype.parent = function() { if (this._els.length > 0 && this._els[0] instanceof Node) { var parent = this._els[0].parentNode; if (parent instanceof Node) { return (new d(parent)); } } else if (this._els instanceof Node) { var parent = this._els.parentNode; if (parent instanceof Node) { return (new d(parent)); } } return (new d()); } d.prototype.children = function(selector) { var first = this.getFirstEl(); var filteredChildren = []; var children = first.children; if (typeof selector === 'string' && selector.length > 0) { for (var x = 0; x < children.length; x++) { if (children[x].matches(selector)) { filteredChildren.push(children[x]); } } } else { filteredChildren = children; } return (new d(filteredChildren)); } // Classes and attributes d.prototype.removeClass = function(className) { this.loopAndApply(this._els, function(el) { el.classList.remove(className); }); } d.prototype.addClass = function(className) { this.loopAndApply(this._els, function(el) { el.classList.add(className); }); } d.prototype.toggleClass = function(className) { this.loopAndApply(this._els, function(el) { el.classList.toggle(className); }); } d.prototype.hasClass = function(className) { return this.getFirstEl().classList.contains(className); } // Value d.prototype.val = function(value) { var el = this.getFirstEl(); if (arguments.length === 1) { // We are setting the value if (typeof value === 'undefined') { value = ''; } // We are setting value el.value = value; return (new d(el)); } else { // We are retrieving value if (el.options) { if (el.multiple) { return el.options.filter((option) => {return (option.selected && option.disabled === false)}).map((option) => option.value); } else { var selectedIndex = el.options.selectedIndex; if (typeof el.options[selectedIndex] !== 'undefined' && el.options[selectedIndex].disabled !== true) { return el.options[selectedIndex].value; } else { // The selected option is disabled // Get the first option which isn't disabled for(let j=0; j {return (option.selected && option.disabled === false)}).map((option) => option.value); } else { var selectedIndex = el.options.selectedIndex; if (typeof el.options[selectedIndex] !== 'undefined') { return el.options[selectedIndex].value; } else { // The selected option is disabled // Get the first option which isn't disabled for(let j=0; j 0) { return (new URLSearchParams(new FormData(firstEl)).toString()); } return ''; } d.prototype.each = function(callback) { this.loopAndApply(this._els, function(el, i) { callback(i, el); }); } d.prototype.remove = function() { this.loopAndApply(this._els, function(el, i) { el.remove(); }); } d.prototype.is = function(el) { /* var first = this.getFirstEl(); var second = el.getFirstEl(); return first === second; */ var compare = el.getFirstEl(); var isSameElement = false; this.loopAndApply(this._els, function(el, i) { if (el === compare) { isSameElement = true; } }); return isSameElement; } d.prototype.visible = function() { var el = this.getFirstEl(); var width = el.offsetWidth; var height = el.offsetHeight; return (width > 0 && height > 0); } d.prototype.partiallyVisible = function() { var el = this.getFirstEl(); var width = el.offsetWidth; var height = el.offsetHeight; return (width > 0 || height > 0); } d.prototype.show = function() { this.loopAndApply(this._els, function(el, i) { el.style.display = ''; }) } d.prototype.hide = function() { this.loopAndApply(this._els, function(el, i) { el.style.display = 'none'; }) } d.prototype.ready = function(callback) { if (document.readyState !== 'loading') { callback(); } else { document.addEventListener('DOMContentLoaded', callback); } } // Getters Object.defineProperty(d.prototype, 'length', { get: function() { if (this._els instanceof Node) { return 1; } if (this._els instanceof Node === false && this._els.length > 0) { return this._els.length; } return 0; } }); Object.defineProperty(d.prototype, 'get', { get: function() { return this._els; } }); var els = []; if (arguments.length === 1) { if (typeof selector === 'string' && selector.length > 0) { var x = new d(); els = x._findElements(selector, document); } if (selector instanceof Node) { // This is already a node els = selector; } else if (selector instanceof NodeList) { // This is a list of nodes // Return the first node els = selector; } else if (typeof selector === 'object' && typeof selector.is$ !== 'undefined' && selector.is$) { // This is already our own object :) els = selector._els; } } else { els = [document.createElement('DIV')]; } return (new d(els)); } $_.param = function param(obj, prefix) { var str = []; var encode = function (str) { return encodeURIComponent(str).replace(/%20/g, '+'); }; for (var p in obj) { if (obj.hasOwnProperty(p)) { var k = prefix ? prefix + '[' + p + ']' : p; var v = obj[p]; if (typeof v === 'object') { str.push(param(v, k)); } else { str.push(encode(k) + '=' + encode(v)); } } } return str.join('&'); } window.$_ = $_; var $ = $_; // Added 2021-03-17 var globalDebouncers = []; function globalDebounce(key, callback, delay) { if (typeof globalDebouncers[key] !== 'undefined') { clearTimeout(globalDebouncers[key]); } globalDebouncers[key] = setTimeout(callback, delay); } /* --------------------- Global Utility --------------------- */ // Collection of various global utilities var GlobalUtility = (function() { var cart = { get: function() { var endpoint = 'cart.js'; return fetch(nav.getRootUrl() + endpoint, { method: 'GET', cache: 'no-cache', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' } }); } } // Navigation object var nav = { getRootUrl: function(withLocale) { if (typeof withLocale === 'undefined') { withLocale = false; } var locale = ''; if (withLocale) { locale = this.getUrlLocale(); } var url = window.location.origin?window.location.origin+'/':window.location.protocol+'//'+window.location.host+'/'; if (locale.length > 0) { // Locale is set in the current URL, add it to the root URL url += locale+'/'; } return url; }, isHomePage: function() { if (window.location.pathname === '/') { return true; } return false; }, isProductPage: function() { if (/\/products\/([^\?\/\n]+)/.test(window.location.href)) { return true; } return false; }, isCartPage: function() { if (/\/cart\/?/.test(window.location.href)) { return true; } return false; }, isLoginPage: function() { if (/\/account\/login\/?/.test(window.location.href)) { return true; } return false; }, isAccountMenuPage: function() { if (/\/account\/?$/.test(window.location.pathname) || /\/account\/.*$/.test(window.location.pathname)) { return true; } return false; }, getProductHandle: function(href) { if (typeof href === 'undefined') { var href = window.location.href; href = href.replace('/products/products', '/products'); } if (/\/products\/([^\?\/\n]+)/.test(href)) { var found = href.match(/\/products\/([^\?\/\n#]+)/); if (typeof found[1] !== 'undefined') { try { return decodeURIComponent(found[1]).replace('#', ''); } catch(e) { return found[1].replace('#', ''); } } } return false; }, getAppApiEndpoint: function() { return 'https://app.sealsubscriptions.com/shopify/public/api/'; }, getInvoiceEndpoint: function() { return this.getAppApiEndpoint() + 'cdo.php?shop=verbena-flores.myshopify.com'; }, getSellingPlanId: function() { var qp = this.getQueryParams(window.location.search); if (typeof qp['selling_plan'] !== 'undefined') { return qp['selling_plan']; } return ''; }, getQueryParams: function(qs) { qs = qs.split('+').join(' '); var params = {}, tokens, re = /[?&]?([^=]+)=([^&]*)/g; while (tokens = re.exec(qs)) { params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]); } return params; }, getLocale: function() { // Don't use Weglot here (probably, as it usually doesn't use the /locale/ in URL) if (typeof Shopify !== 'undefined' && typeof Shopify.locale === 'string') { return Shopify.locale } return ''; }, getUrlLocale: function() { var baseUrl = this.getRootUrl(); var locale = this.getLocale(); if (typeof window.Shopify !== 'undefined' && typeof Shopify.routes !== 'undefined' && typeof Shopify.routes.root === 'string') { // Get locale which is in URL, but is also saved in routes locale = Shopify.routes.root.replace(/\//g, ''); } if (locale !== '') { var url = window.location.href+'/'; // Check if the baseurl + locale is present in the url if (url.indexOf(baseUrl+locale+'/') === 0) { return locale; } } return ''; } }; var string = { getRandomString: function(length) { var result = ''; var characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; var charactersLength = characters.length; var a = []; for ( var i = 0; i < length; i++) { a.push(characters.charAt(Math.floor(Math.random() * charactersLength))); } return a.join(''); } } var money = { currencySymbols: { 'USD': '$', // Dollar 'CAD': '$', // Dollar 'AUD': '$', // Dollar 'NZD': '$', // Dollar 'EUR': '€', // Euro 'CRC': '₡', // Costa Rican Colón 'GBP': '£', // British Pound Sterling 'ILS': '₪', // Israeli New Sheqel 'INR': '₹', // Indian Rupee 'JPY': '¥', // Japanese Yen 'KRW': '₩', // South Korean Won 'NGN': '₦', // Nigerian Naira 'PHP': '₱', // Philippine Peso 'PLN': 'zł', // Polish Zloty 'PYG': '₲', // Paraguayan Guarani 'THB': '฿', // Thai Baht 'UAH': '₴', // Ukrainian Hryvnia 'VND': '₫', // Vietnamese Dong }, formatPrice: function(price, convertCurrency) { if (typeof Shopify !== 'undefined' && Shopify.hasOwnProperty('currency') && Shopify.currency.hasOwnProperty('rate')) { var currency = Shopify.currency.active; var exchangeRate = Shopify.currency.rate; var moneyFormat = '{{amount}}'+currency; // We are no longer using this fallback value. If the currency can't be found, then the .toLocaleString method is used. var currencyFormat = ''; if (currencyFormat.indexOf('{{iso_currency}}') !== -1) { currencyFormat = currencyFormat.replace('{{iso_currency}}', currency); } if (currencyFormat.indexOf('{{currency_symbol}}') !== -1) { if (typeof this.currencySymbols[currency] === 'string') { var symbol = this.currencySymbols[currency]; currencyFormat = currencyFormat.replace('{{currency_symbol}}', symbol); } else { currencyFormat = currencyFormat.replace('{{currency_symbol}}', ''); } } if (typeof convertCurrency === 'undefined') { convertCurrency = false; } if (convertCurrency && exchangeRate !== "1.0") { price = this.convertMoney(price, exchangeRate, currency); } var bodyAttrMoneyFormat = $_('body').attr('data-money-format'); if (currencyFormat !== '') { moneyFormat = currencyFormat; } else { if (typeof Shopify !== 'undefined' && typeof Shopify.currency_settings !== 'undefined' && typeof Shopify.currency_settings.money_format !== 'undefined') { // world-rugby-shop moneyFormat = Shopify.currency_settings.money_format; } else if (typeof window.money_format !== 'undefined') { // noelle-wolf moneyFormat = window.money_format; } else if (typeof window.Theme !== 'undefined' && typeof window.Theme.moneyFormat !== 'undefined') { // yammeya moneyFormat = window.Theme.moneyFormat; } else if (typeof window.theme !== 'undefined' && typeof window.theme.moneyFormat !== 'undefined') { // guru-muscle moneyFormat = window.theme.moneyFormat; } else if (typeof window.theme !== 'undefined' && typeof window.theme.money_format === 'string') { moneyFormat = window.theme.money_format ; } else if (typeof window.theme !== 'undefined' && typeof window.theme.settings !== 'undefined' && typeof window.theme.settings.moneyFormat !== 'undefined') { moneyFormat = window.theme.settings.moneyFormat; } else if (typeof window.theme !== 'undefined' && typeof window.theme.strings !== 'undefined' && typeof window.theme.strings.moneyFormat === 'string') { moneyFormat = window.theme.strings.moneyFormat; } else if (typeof window.Currency !== 'undefined' && typeof window.Currency.money_format !== 'undefined' && typeof window.Currency.money_format[currency] === 'string') { moneyFormat = window.Currency.money_format[currency]; } else if (typeof window.Currency !== 'undefined' && typeof window.Currency.money_format === 'string') { moneyFormat = window.Currency.money_format; } else if (typeof bodyAttrMoneyFormat !== 'undefined' && typeof bodyAttrMoneyFormat === 'string' && bodyAttrMoneyFormat !== '') { moneyFormat = bodyAttrMoneyFormat; } else if (typeof wsgMoneyFormat === 'string') { moneyFormat = wsgMoneyFormat; } else if (typeof price_format === 'string') { moneyFormat = price_format; } else { price = price/100; return price.toLocaleString(undefined, { style: 'currency', currency: (currency || this.getDefaultCurrency()) }); } } return this.formatMoney(price, moneyFormat, (currency || this.getDefaultCurrency())); } return ''; }, formatMoney: function(cents, format, fallbackCurrency, directionFor50) { // The directionFor50 is used to let the function know how to round numbers if the decimals equal 50. // We are using this direction for discounted value if the user chooses the amount_no_decimals format, because we calculate the discounted value in here by // subtracting original - discount. // E.g. // original = 100 // discount = 0.5 // discounted value = 99.5 // Rounded discounted value would be 100 and the rounded discount would be 1. if (typeof directionFor50 === 'undefined') { var directionFor50 = 'up'; } try { if (typeof cents == 'string') { cents = cents.replace('.',''); } var value = ''; var placeholderRegex = /\{\{\s*(\w+)\s*\}\}/; var formatString = format; function defaultOption(opt, def) { return (typeof opt == 'undefined' ? def : opt); } function formatWithDelimiters(number, precision, thousands, decimal, directionFor50) { precision = defaultOption(precision, 2); thousands = defaultOption(thousands, ','); decimal = defaultOption(decimal, '.'); directionFor50 = defaultOption(directionFor50, 'up'); if (isNaN(number) || number == null) { return 0; } var originalNumber = number; number = (number/100.0).toFixed(precision); if (directionFor50 === 'down') { if (((originalNumber/100) - number) === -0.5) { // We have rounded in the wrong direction // Subtract 1 to fix this number -= 1; number = number.toString(); } } var parts = number.split('.'), dollars = parts[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + thousands), cents = parts[1] ? (decimal + parts[1]) : ''; return dollars + cents; } switch(formatString.match(placeholderRegex)[1]) { case 'amount': value = formatWithDelimiters(cents, 2); break; case 'amount_no_decimals': value = formatWithDelimiters(cents, 0, ',', '.', directionFor50); break; case 'amount_with_comma_separator': value = formatWithDelimiters(cents, 2, '.', ','); break; case 'amount_with_decimal_separator': // Some strange format value = formatWithDelimiters(cents, 2, ',', '.'); break; case 'amount_no_decimals_with_comma_separator': value = formatWithDelimiters(cents, 0, '.', ',', directionFor50); break; case 'amount_no_decimals_with_space_separator': value = formatWithDelimiters(cents, 0, ' ', ',', directionFor50); break; case 'amount_with_apostrophe_separator': value = formatWithDelimiters(cents, 2, "'", '.'); break; } return formatString.replace(placeholderRegex, value); } catch(e) { console.log(e.message); price = cents/100; return price.toLocaleString(undefined, { style: 'currency', currency: fallbackCurrency }); } }, convertIfNeeded: function(price, round) { if (typeof round === 'undefined') { round = true; } if (typeof Shopify !== 'undefined' && Shopify.hasOwnProperty('currency') && Shopify.currency.hasOwnProperty('rate')) { var currency = Shopify.currency.active; var exchangeRate = Shopify.currency.rate; var moneyFormat = '{{amount}}'+currency; if (exchangeRate !== "1.0" && exchangeRate !== 1.0) { price = this.convertMoney(price, exchangeRate, currency, round); } } return price; }, convertMoney: function(value, rate, currency, round) { // Converts money and rounds up based on the defined policy if (value <= 0) { return 0; } value *= rate; var roundUp = [ 'USD', 'CAD', 'AUD', 'NZD', 'SGD', 'HKD', 'GBP' ]; var roundTo100 = [ 'JPY' ]; var roundTo95 = [ 'EUR' ]; if (round) { if (roundUp.indexOf(currency) !== -1) { // Round up value = Math.ceil(value); } else if(roundTo100.indexOf(currency) !== -1) { // Round to nearest 100 value = Math.ceil(value/100)*100 } else if(roundTo95.indexOf(currency) !== -1) { // Round up to 0.95 value = Math.ceil(value) - 0.05; } } return value; }, roundMoney: function(value) { // Converts money and rounds up based on the defined policy if (value <= 0) { return 0; } if (typeof Shopify !== 'undefined' && Shopify.hasOwnProperty('currency') && Shopify.currency.hasOwnProperty('active')) { var currency = Shopify.currency.active; var roundUp = [ 'USD', 'CAD', 'AUD', 'NZD', 'SGD', 'HKD', 'GBP' ]; var roundTo100 = [ 'JPY' ]; var roundTo95 = [ 'EUR' ]; if (roundUp.indexOf(currency) !== -1) { // Round up value = Math.ceil(value); } else if(roundTo100.indexOf(currency) !== -1) { // Round to nearest 100 value = Math.ceil(value/100)*100 } else if(roundTo95.indexOf(currency) !== -1) { // Round up to 0.95 value = Math.ceil(value) - 0.05; } } return value; }, wrapInSpan: function(value) { var span = ''+value+''; return span; }, convertViaIntegrations: function($element) { /* if (typeof $element !== 'undefined') { if ($element.attr('doubly-currency') !== null) { // Remove the "doubly-currency" class so that currency converter will pick it up again $element.removeAttr('doubly-currency'); } }*/ if (typeof DoublyGlobalCurrency !== 'undefined' && typeof DoublyGlobalCurrency.currentCurrency !== 'undefined' && typeof DoublyGlobalCurrency.convertAll !== 'undefined') { try { DoublyGlobalCurrency.convertAll(DoublyGlobalCurrency.currentCurrency, '.sls-price .money'); } catch(e) {} } if (typeof geckoShopify !== 'undefined' && typeof geckoShopify.Currency_convertAll === 'function' && typeof geckoShopify.StorageCurrency === 'function' && typeof Shopify !== 'undefined' && typeof Shopify.currency !== 'undefined' && typeof Shopify.currency.active === 'string' ) { try { var c = geckoShopify.StorageCurrency(); if (c !== null) { geckoShopify.Currency_convertAll(Shopify.currency.active, geckoShopify.StorageCurrency()); } } catch(e) { //console.log(e); } } if (typeof window.money_default === 'string' && typeof Currency !== 'undefined' && typeof Currency.currentCurrency === 'string') { try { Currency.convertAll(window.money_default, Currency.currentCurrency); } catch(e) { console.log(e); } } if (typeof window.conversionBearAutoCurrencyConverter !== 'undefined' && typeof window.conversionBearAutoCurrencyConverter.convertPricesOnPage !== 'undefined') { try { window.conversionBearAutoCurrencyConverter.convertPricesOnPage(); } catch(e) { console.log(e); } } if (typeof window.baCurr !== 'undefined' && typeof window.baCurr.refreshConversion === 'function') { try { window.baCurr.refreshConversion(); } catch(e) { console.log(e); } } try { if (typeof mlvedaload === 'function' && typeof ACSCurrency !== "undefined" && typeof ACSCurrency.moneyFormats !== "undefined") { mlvedaload(); } } catch(e) { console.log(e); } if (typeof $element !== 'undefined') { if ($element.hasClass('done') && $element.hasClass('money') && $element.attr('ws-currency') !== null && $element.attr('ws-price') !== null) { // Remove the "done" class so that currency converter will pick it up again $element.removeClass('done'); $element.removeAttr('ws-currency'); $element.removeAttr('ws-price'); } } } } var unitPriceEngine = { unitRelations: { 'l': { 'ml': 0.001, 'cl': 0.01, 'l' : 1, 'm3': 1000 }, 'g': { 'mg': 0.001, 'g' : 1, 'kg': 1000 }, 'm': { 'mm': 0.001, 'cm': 0.01, 'm' : 1 }, 'm2': { 'm2': 1 }, 'item': { 'item': 1 } }, /* "unit_price_measurement": { "measured_type": "count", "quantity_value": "12.0", "quantity_unit": "item", "reference_value": 1, "reference_unit": "item" }, */ calculate: function(price, variant) { if (typeof variant.unit_price_measurement === 'undefined') { return false; } var config = variant.unit_price_measurement; var quantityUnit = config.quantity_unit; var referenceUnit = config.reference_unit; var referenceValue = config.reference_value; var quantityValue = parseFloat(config.quantity_value); var pricePerBaseUnit = 0; var pricePerReferenceUnit = -1; var pricePerUnit = price/quantityValue; // Round to two decimals //pricePerUnit = Math.round((pricePerUnit + Number.EPSILON) * 100) / 100; // Disabled on 2022-03-09 (heartwarmer-foods) var baseUnit = ''; for(var key in this.unitRelations) { if (this.unitRelations.hasOwnProperty(key)) { if (typeof this.unitRelations[key][quantityUnit] !== 'undefined') { baseUnit = key; break; } } } if (baseUnit !== '') { pricePerBaseUnit = pricePerUnit/this.unitRelations[baseUnit][quantityUnit]; var baseReferenceUnit = ''; for(var key in this.unitRelations) { if (this.unitRelations.hasOwnProperty(key)) { if (typeof this.unitRelations[key][referenceUnit] !== 'undefined') { baseReferenceUnit = key; break; } } } if (baseReferenceUnit !== '') { pricePerReferenceUnit = this.unitRelations[key][referenceUnit]*pricePerBaseUnit*referenceValue; } } if (pricePerReferenceUnit >= 0) { referenceUnitString = referenceUnit; if (referenceValue > 1) { referenceUnitString = referenceValue + referenceUnitString; } return { 'price_per_unit': pricePerReferenceUnit, 'unit' : referenceUnitString } } return false; } } var theme = { isStoreId: function(themeStoreId) { if (typeof window.Shopify !== 'undefined' && typeof window.Shopify.theme !== 'undefined' && typeof window.Shopify.theme.theme_store_id !== 'undefined' && window.Shopify.theme.theme_store_id === themeStoreId) { return true; } return false; } } return { cart : cart, nav : nav, string : string, money : money, unitPriceEngine : unitPriceEngine, theme : theme } })(); var GlobalTranslator = (function() { var translations = {"dflt":{"widget_one_time_option_label":"Compra Unica","widget_one_time_option_description":"","acwidget_purchase_options_label":"Opciones de compra","acwidget_each_label":"","acwidget_per_delivery_label":"por entrega","acwidget_savings_label":"AHORRA {{savings}}","acwidget_subscription_details_label":"Detalles de suscripci\u00f3n","acwidget_free_trial_price_label":"{{price}} after {{interval}}","acwidget_next_price_tier_label":"then {{price}}","acwidget_subscription_details_content":"\n
\nEl mejor precio: <\/strong> Con tu suscripci\u00f3n obt\u00e9n hasta un 30% de descuento\n
\n Los mejores productos:<\/strong> Con tu suscripci\u00f3n obtienes las flores m\u00e1s frescas y duraderas\n
\n Mayor flexibilidad: <\/strong> Puedes modificar fecha y hora de entrega, as\u00ed como cambiarla la persona o destino de entrega en cualquier momento\n
\nPol\u00edtica de Cancelaci\u00f3n de Servicios: <\/strong> Al suscribirse, el usuario acepta que la cancelaci\u00f3n no ser\u00e1 posible hasta transcurridos al menos tres (3) meses desde la fecha de activaci\u00f3n de la suscripci\u00f3n.\n
\n\n\n","acwidget_subscription_details_link_label":"","acwidget_subscription_details_link":"https:\/\/verbenaflores.com\/","subscribenow_button_text":"Suscribete ahora","widget_subscribe_and_deliver_text":"Subscribe and deliver every","widget_show_details_label":"See details","widget_subscription_description":"You will receive a payment link and won't be charged automatically.","cart_interval_text":"Subscription interval","cart_discount_text":"Discount on next order","intervals_day":"d\u00eda","intervals_days":"{{number}} days","intervals_week":"semana","intervals_weeks":"{{number}} semanas","intervals_month":"mes","intervals_months":"{{number}} meses","intervals_year":"a\u00f1o","intervals_years":"{{number}} a\u00f1os","orderstatuswidget_title":"Suscripcion","orderstatuswidget_description":"Puede ver, editar o cancelar sus suscripciones iniciando sesi\u00f3n en su cuenta o mediante el enlace directo que recibe en el correo electr\u00f3nico.","orderstatuswidget_subscription_button":"Manage your subscriptions","orderstatusemailwidget_title":"Resend magic subscription link","orderstatusemailwidget_description":"You can view, edit or cancel your subscriptions by logging into your account or through the magic link you receive in the email. You can also resend yourself an email with the magic link to the customer portal where you can view and edit your subscription. The email will be sent a few minutes after you click on the button below.","orderstatusemailwidget_resend_email_button_text":"Resend email with the magic link","orderstatusemailwidget_resend_email_button_success_text":"Email will be sent in a few minutes!","orderstatusemailwidget_resend_email_button_error_text":"Something went wrong","customraccountlogin_need_help_accessing_subscriptions_text":"Need help accessing your subscriptions?","customraccountlogin_click_here_text":"Click here","customeraccountmenu_link_to_subscriptions_text":"Subscriptions"}}; function getTranslations() { return translations; } function stripQuotes(string) { return string.replace("'", '').replace("'", ''); } function getLocale() { var locale = 'dflt'; if (typeof Weglot !== 'undefined' && typeof Weglot.getCurrentLang === 'function') { try { var lang = Weglot.getCurrentLang(); if (typeof lang !== 'undefined' && lang !== null && lang !== '') { return lang; } } catch(e) {} } // Shop locale should be set in Shopify.locale variable if (typeof Shopify !== 'undefined' && typeof Shopify.locale !=='undefined') { locale = Shopify.locale; } return locale; } function getPlainLocale() { // Returns locale without a dash in it (e.g. sk-SK to sk) var locale = getLocale(); if (locale.indexOf('-') !== -1) { // We have a dash in our locale locale = locale.substring(0, locale.indexOf('-')); } return locale; } function getTranslation(key, stripQuotes) { var val = key; var locale = getLocale(); var plainLocale = getPlainLocale(); var localTranslations = {}; if (typeof translations[locale] !== 'undefined') { localTranslations = translations[locale]; } if (Object.keys(localTranslations).length === 0 && typeof translations[plainLocale] !== 'undefined') { localTranslations = translations[plainLocale]; } if (typeof localTranslations[key] !== 'undefined') { val = localTranslations[key]; } else { // Looks like the translation value is missing for the local language // Get the default one if (typeof translations['dflt'][key] !== 'undefined') { val = translations['dflt'][key]; } } if (typeof stripQuotes !== 'undefined' && stripQuotes === true) { val = this.stripQuotes(val); } return val; } return { stripQuotes : stripQuotes, getTranslations : getTranslations, getLocale : getLocale, getTranslation : getTranslation } })(); var GlobalView = (function() { // This function can return an array of elements or just one element function getExtensionForm($parent, canReturnArray) { if (typeof canReturnArray === 'undefined') { canReturnArray = false; } if ($parent.closest('.bundler-target-element').length > 0) { // We are in Bundler widget, don't return the extension form as we aren't dependent on that at all return null; } var extensionAttr = $parent.attr('data-seal-extension'); if (typeof extensionAttr !== 'undefined') { // We are in the extension // Find the form and return it var extFormSelector = 'product-form.product-form form, .product-form__buy-buttons form.shopify-product-form[action*="/cart/add"], form.product-single__form[action*="/cart/add"], form[action*="/cart/add"][id^="product_form_"], form.shopify-product-form[action*="/cart/add"][data-product-form]'; extFormSelector += ', [id^="AddToCartForm"] form[action*="/cart/add"]'; extFormSelector += ', form.product-buy-buttons--form'; extFormSelector += ', .product-form-container .product_form form.shopify-product-form[action*="/cart/add"]'; extFormSelector += ', form.product-buy-buttons--form[action*="/cart/add"]'; extFormSelector += ', form.ajax-product-form[action*="/cart/add"]'; extFormSelector += ', .buy-buttons-row form[action*="/cart/add"]'; extFormSelector += ', form.product-form--container[action*="/cart/add"], .main-product__block-buy_buttons product-form form[action*="/cart/add"]'; extFormSelector += ', .product-info__buy-buttons form[action*="/cart/add"][is="product-form"].shopify-product-form, form.product-form.product-form--single[action="/cart/add"]'; extFormSelector += ', form[id^="product-form-"][is="product-form"][action*="/cart/add"]'; extFormSelector += ', form[action*="/cart/add"].buy-buttons__form'; extFormSelector += ', preorder-button form[action*="/cart/add"]'; extFormSelector += ', form[action*="/cart/add"][data-type="add-to-cart-form"]:not([id^="product-infoupsellproduct_upsell_"])'; //extFormSelector += ', #sabhq-root form.sabhq'; // ismilees if ($parent.closest('.product-detail__detail').length > 0) { extParent = $parent.closest('.product-detail__detail'); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector); if (extForm.length > 0) { // Find the form with add to cart button for (var i = 0; i 0) { return $el; } } } } } var extParent = $parent.closest('.shopify-app-block').parent(); if (extParent.length > 0) { if (canReturnArray) { var extForm = extParent.find(extFormSelector); } else { var extForm = extParent.find(extFormSelector).first(); } if (extForm.length > 0) { return extForm; } } var extParent = $parent.closest('.main-product__block').parent(); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } extParent = $parent.closest('[data-product-details], .product-single__box'); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } extParent = $parent.closest('.product__app') if ($parent.length > 0) { extParent = extParent.parent(); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('.product-page--featured-blocks') if (extParent.length > 0) { extParent = extParent.parent(); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('[class*="product-block--@app"]'); if (extParent.length > 0) { extParent = extParent.parent(); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('[data-block-type="@app"]'); if (extParent.length > 0) { extParent = extParent.parent(); if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0 && extForm.closest('product-recommendations').length === 0) { return extForm; } } } extParent = $parent.closest('.product-form.theme-init'); if (extParent.length > 0) { if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('.product-page--blocks'); if (extParent.length > 0) { if (extParent.length > 0) { var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } /* if ($parent.closest('.product__info-container').length > 0) { extParent = $parent.closest('.product__info-container'); if (extParent.length > 0) { var extForm = extParent.find('form[action*="/cart/add"][data-type="add-to-cart-form"]').first(); if (extForm.length > 0) { return extForm; } } }*/ extParent = $parent.closest('.product__info-container'); if (extParent.length > 0) { if (extParent.length > 0) { //var extForm = extParent.find(extFormSelector).first(); var extForm = extParent.find(extFormSelector).first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('article#product-description'); if (extParent.length > 0) { if (extParent.length > 0) { var extForm = extParent.find('form[action*="/cart/add"][id*="main"]').first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('div.product-form'); if (extParent.length > 0) { if (extParent.length > 0) { var extForm = extParent.find('.buy-buttons-row form.product-purchase-form[action*="/cart/add"]').first(); if (extForm.length > 0) { return extForm; } } } extParent = $parent.closest('.main-product-info-container'); // This one has to be separate from the next one! if (extParent.length > 0) { var extForm = extParent.find('form[action*="/cart/add"]'); if (extForm.length > 0) { return extForm; } } extParent = $parent.closest('product-form[data-name="main-product-form"], .product__content, .t4s-product__info-container, .product-details, .main-product__hero, .product__info, .product-info, .productView-details, .product-detail__form, .product-grid__detail, .product-blocks, .product-content-container, .featured-product__info-container, .product-converter__blocks, .main-product__blocks, .product-detail__detail, .t4s-product__info-wrapper, .form__wrapper, .product__section-details, .product-single__details, .product__detail-content, [class="#product-meta"], .flex__item.product__right, .yv-main-product-detail, .product__section-content, [data-product-details], article.product__section-right, .site-box-content, .product-single__meta, .product-main-block__details, #main-product, .item-info, .product-text.grid-portable-2, .product__meta, .main-product__blocks-after-media, product-page .product-text.grid-offset-2, product-page .product-text, .wt-product__info, [data-instant-form-variant-id], .main--product-content-inner, .product-info-details, [class="#product-meta"], .product--add-to-cart-form, .f8pr, .pdp-content, .hdt-product-info__list, .main-product__blocks, .quick-buy-drawer__info, .main-product__blocks-before-media, .drawer-content, .product-right, .product-info-container, .product__info-container, .product-single__box, .product-3grid, .product-summary-inner'); if (extParent.length > 0) { var extForm = extParent.find('form[action*="/cart/add"]:not([id*="cross_sell"])'); // :not([id*="cross_sell"]) was added for brainologist if (extForm.length > 0) { return extForm; } } } else { var $offr = $parent.closest('[itemtype="http://schema.org/Offer"]'); if($offr.length === 1) { // Special case for fgbg-lifestyle-ii because they use some kind of special volume discounting app, which hides the actual form element if ($offr.find('form + #new-form .sealsubs-target-element').length > 0) { return $offr.find('form').first(); } } var $offr = $parent.closest('.product-form--root'); if($offr.length === 1) { // Special case for xotics-products because the blockshop theme is doing some magic with forms if ($offr.find('form.product-form--container[action*="/cart/add"]').length > 0) { return $offr.find('form.product-form--container[action*="/cart/add"]').first(); } } var $offr = $parent.closest('product-form[data-aid="main-product-form"], .form__width'); if($offr.length === 1) { // Special case for the-parks.myshopify.com because the Wayne(Influence) theme is doing some magic with forms //var fKey = 'form[data-aid="dynamic-buttons-form"][action*="/cart/add"]'; var fKey = 'form[action*="/cart/add"]'; if ($offr.find(fKey).length > 0) { if (canReturnArray) { return $offr.find(fKey); } else { return $offr.find(fKey).first(); } } } var $parentContainer = $parent.closest('.collection__page-product'); // This one has to be separate from the next one. if($parentContainer.length === 1) { var fKey = 'form[action*="/cart/add"]'; if ($parentContainer.find(fKey).length > 0) { if (canReturnArray) { return $parentContainer.find(fKey); } else { return $parentContainer.find(fKey).first(); } } } var closestSelector = '.product__info-container, .single .details, .form__inner__wrapper, .product__section-right, .shogun-root .shg-row, #product-content, .product-details, .product-info, .productView-product, .product-detail__detail, .quickbuy-form, [data-product-grid-column-details], .product-display__content, .drawer__content, quick-buy-popover, .product-block-container, .featured-product__info-container, .product__sticky, .product-actions, .product-single__meta, .product-info-details, article[data-template*="__main-product"], .product-blocks, .homepage-sections--indiv-product-slider-variants, product-info, [data-product-form-wrapper], .product__content, .drawer__body__wrapper, .product-single__information, [data-replo-product-container], .quick-view__info, .product__details'; var $parentContainer = $parent.closest(closestSelector); if($parentContainer.length === 1) { var fKey = 'form[action*="/cart/add"][data-type="add-to-cart-form"]'; if ($parentContainer.find(fKey).length > 0) { if (canReturnArray) { return $parentContainer.find(fKey); } else { return $parentContainer.find(fKey).first(); } } } if($parentContainer.length === 1) { var fKey = 'form[action*="/cart/add"]:not(.installment)'; if ($parentContainer.find(fKey).length > 0) { if (canReturnArray) { return $parentContainer.find(fKey); } else { return $parentContainer.find(fKey).first(); } } } /* var extParent = $parent.closest('.shopify-app-block').parent(); if (extParent.length > 0) { if (canReturnArray) { var extForm = extParent.find(extFormSelector); } else { var extForm = extParent.find(extFormSelector).first(); } if (extForm.length > 0) { return extForm; } } */ try { var parentSel = $parent.attr('data-parent'); var formSel = $parent.attr('data-form'); if (typeof parentSel !== 'undefined' && typeof formSel !== 'undefined') { var $offr = $parent.closest(parentSel); if ($offr.find(formSel).length > 0) { return $offr.find(formSel).first(); } } } catch(e) { } /* var $offr = $parent.closest('form.product-form.product-form-product-template'); if($offr.length > 0) { if (canReturnArray) { return $offr; } else { return $offr.first(); } }*/ } return null; } // Some themes also have thing soutside of the form and then use them to add to the cart. // Get the container of these elements so that we can set up change listeners on them function getProductFormContainer($element) { var $productFormContainer = $element.closest('.product-single__box'); if($productFormContainer.length === 1) { return $productFormContainer; } return null; } return { getExtensionForm : getExtensionForm, getProductFormContainer : getProductFormContainer } })(); // This should actually be an array of objects, as object doesn't have a defined order var GlobalFormSelectors = { '#sealsubscriptions-default-widget-target-element' : 'prepend', '.buy-buttons-row form[action*="/cart/add"]' : 'prepend', 'form[action*="/cart/add"].product-purchase-form' : 'prepend', 'form[action*="/cart/add"].product-form.product-form--mini.product-form--not-quickbuy .half.column.product-details .product-section.border-bottom .option-selectors' : 'before', 'form[action*="/cart/add"].product-form.product-form--mini.product-form--not-quickbuy .half.column.product-details .product-section.border-bottom .payment-and-quantity' : 'before', 'form[action="/cart/add"] .gt_product-content .gt_product-button.gt_button-atc' : 'before', 'form[action="/cart/add"] .product-form' : 'prepend', '.product-page-info form[action="/cart/add"][data-js-product-form] [data-js-footbar-product-limit]' : 'before', 'form.lh-product-form[action="/cart/add"] .lh-content-summary .lh-price-block.price + div.clearfix' : 'after', //'product-form > form[action="/cart/add"][data-type="add-to-cart-form"] .product__cart-functions .flex-buttons' : 'after', 'product-form form[action="/cart/add"] form[action*="/cart/add"]' : 'prepend', '[itemtype="http://schema.org/Offer"] form + #new-form #new-form-atc' : 'before', 'form.product-form--wide[action="/cart/add"]' : 'prepend', 'form.shopify-product-form[action="/cart/add"] .desc_blk .main-product-description-product' : 'before', 'form[action="/cart/add"].ProductForm .ProductMeta' : 'after', 'form[action="/cart/add"].ProductForm' : 'prepend', 'form[action="/cart/add"] div.item-content div[data-icon="gpicon-product-quantity"]' : 'before', 'form.pf-product-form[action="/cart/add"][id^="product_form_"] div[data-product-type="price"][data-pf-type="ProductText"]' : 'after', // Pagefly product form //'form.pf-product-form[action="/cart/add"][id^="product_form_"] div[data-pf-type="ProductDescription"]' : 'after', // Pagefly product form 'form#AddToCartForm.form-vertical[action="/cart/add"].product-form .product-title' : 'after', 'form.shopify-product-form[action="/cart/add"][data-productid][data-product-form][id^="product_form_"] .product-description .product-qty.selector-wrapper' : 'after', 'form#AddToCartForm.product_form[action="/cart/add"] div.product-add' : 'before', '#AddToCartForm-product-template #ProductSection-product-template .product-details' : 'prepend', 'form#addToCartForm .desc_blk .desc_blk_bot' : 'prepend', 'form#AddToCartForm .product-single__variants.original-select' : 'after', 'form.product-form[action="/cart/add"] .product-form__payment-container' : 'before', 'form.product-form[action="/cart/add"] .gt_container [data-name="Product Quantity"][attribute="productQuantity"]' : 'before', 'product-form.product__form[id^="add-to-cart-template--"][data-ajax-cart] form[action*="/cart/add"]' : 'prepend', // Theme 2.0 'form[action="/cart/add"] .tab-body .product-logistics' : 'before', 'form[action="/cart/add"] .product-page-info__description' : 'after', '#product--page form[action="/cart/add"] .product__swatches' : 'after', 'form[action="/cart/add"][data-section="template-product"] .single_product__quantity' : 'before', '#main-content .shopify-section #content .product__wrapper form[action="/cart/add"].product-details[data-product-form] .product-details__qty-price-container' : 'before', 'form[action*="/cart/add"] .main-product__blocks .main-product__block-buy_buttons' : 'prepend', 'form[action*="/cart/add"].beae-product-form--single .beae-product-single__add-to-cart' : 'prepend', 'form[action*="/cart/add"][id^="product-form-buttons"].js-prod-form-submit' : 'prepend', 'form[action*="/cart/add"][id^="product-form-template"]' : 'prepend', 'form.product-details[action="/cart/add"] .product-details__options' : 'before', 'form.os__form[action="/cart/add"]' : 'prepend', 'form.product-details-form[action*="/cart/add"] .product-template__container .card-background .product-details .variant-group' : 'after', 'form.product-details-form[action*="/cart/add"] .product-template__container .card-background .product-details' : 'prepend', '.product-blocks__block--buttons form[action="/cart/add"]' : 'prepend', 'form[action*="/cart/add"] .out_of_stock_wrapper' : 'before', 'form[action="/cart/add"] .swatches-wrapper' : 'after', //'product-form.product-form form[action="/cart/add"][data-type="add-to-cart-form"]' : 'after', '.product-information form[action="/cart/add"].shopify-product-form .product-add-to-cart-container' : 'prepend', 'form[action="/cart/add"] ce-product-variant-picker' : 'after', 'form[action="/cart/add"] .product-info-wrapper .product-page--submit-action' : 'before', 'form[action*="/cart/add"] [data-block-type="buy-buttons"]' : 'prepend', 'form[action*="/cart/add"]' : 'prepend', 'form.product-form[action="/cart/add"]' : 'prepend', // * in form[action*="/cart/add"] is there to match actions on translated product pages, where action is /nl/cart/add 'product-form[class="#product-form"] form[action*="/cart/add"]' : 'prepend', 'form[action*="/cart/add"]' : 'prepend', '.product__section-content__block--buttons form.product_form[action="/cart/add"][id*="__main"]' : 'prepend', 'form#AddToCartForm.shopify-product-form[action="/cart/add"] div.product-variant-option' : 'after', 'form[action="/cart/add"].product-single__form' : 'prepend', '.product__section--form form#AddToCartForm[action*="/cart/add"]' : 'prepend', '.product-converter__add-to-cart form[action*="/cart/add"][data-type="add-to-cart-form"]' : 'prepend', 'form.shopify-product-form[action*="/cart/add"]' : 'prepend', '.product_section form[action="/cart/add"]' : 'prepend', 'form[action="/cart/add"] #product-content .quantity' : 'before', 'form[action="/cart/add"] .shop-product__description .product-variant-option' : 'before', 'form.AddToCartForm[action="/cart/add"] .item-content .module-wrap[data-icon="gpicon-product-swatches"]' : 'before', 'form.formAddToCart[action="/cart/add"] div.proVariants' : 'before', '.product-description-product-template form[action="/cart/add"].shopify-product-form' : 'prepend', 'form[action="/cart/add"] .selector-wrapper.product-form__item' : 'before', 'form[action="/cart/add"].product-form' : 'prepend', 'form[action="/cart/add"].product-single__form' : 'prepend', 'form[action="/cart/add"][id^="AddToCartForm--"]' : 'prepend', 'form#cart-form[action="/cart/add"]' : 'prepend', 'form#form_buy[action="/cart/add"]' : 'prepend', 'form.product-form[action$="/cart/add"]' : 'prepend', 'form#AddToCartForm.product-content-inner[action="/cart/add"] .product-details-text .product-variant-option' : 'before', 'form#AddToCartForm.product-content-inner[action="/cart/add"] .product-description' : 'before', 'form.shopify-product-form[action="/cart/add.js"]' : 'prepend', '[itemtype="http://schema.org/Offer"] form[action="/cart/add"][data-productid]' : 'prepend', '#shopify-section-product-template form[action="/cart/add"]' : 'prepend', '[data-product-form] form.productForm[action="/cart/add"]' : 'prepend', 'form#AddToCartForm[action*="/cart/add"] .product-options-bottom' : 'prepend', 'form#AddToCartForm[action*="/cart/add"]' : 'prepend', //'form.pf-product-form h3[data-product-type="title"] + [data-pf-type="Block"]' : 'after', '[data-pf-type="Section"] form.pf-product-form[action="/cart/add"][id^="product_form_"]' : 'prepend', 'form#add-to-cart-form' : 'prepend', '[itemtype="http://schema.org/Offer"] form[action*="/cart/add"].product-action.addProduct' : 'prepend', 'form[action="/cart/add"].product-form:not(.cart-bar__form)' : 'prepend', 'form[action="/cart/add"].product-form:not(.cart-bar__form):visible .product__submit.product__submit--spb' : 'before', '#shopify-section-static-product form.product-form' : 'prepend', '#AddToCartForm_id' : 'prepend', 'form[data-cart-submit="data-cart-submit"][data-productid]' : 'prepend', '[data-section="product-template"] form.shopify-product-form' : 'prepend', 'form[action="/cart/add"][data-productid]' : 'prepend', '#shopify-section-product-sections__main-1 .product_form .shopify-product-form' : 'prepend', '.product-page-main form[action="/cart/add"]' : 'prepend', 'form.lh-product-form' : 'prepend', '#addToCartFormId1' : 'prepend', 'form[action="/cart/add"][data-section="template-product"] .single_product__options' : 'before', '#multivariants_setbox_body' : 'after', 'div[class^="product-"] .product_section form[action="/cart/add"]' : 'prepend', 'form.AddToCartForm[data-productid] .module-wrap[data-key="icon-list"]:first' : 'before', //just4gsd '.shg-c form.shg-product-atc-btn-wrapper' : 'prepend', 'form[action*="/cart/add"][data-type="add-to-cart-form"]' : 'prepend', 'form.product-form .gt_flex .gt_button[attribute="addToCart"]' : 'before', 'form#add-item-form[action*="/cart/add"]' : 'prepend', '#MULTIADD_CUSTOM form[action*="/cart/add"]' : 'prepend', '.shg-c form.shg-product-atc-btn-wrapper:visible' : 'prepend', '.product-container form[action="/cart/add"].product-form .product-details .payment-and-quantity' : 'before', '#product--page form[action*="/cart/add"] .product__atc' : 'before', 'form#AddToCartForm' : 'prepend', '.desktop__only form.shopify-product-form' : 'prepend', 'form.product-form-product-template[action*="/cart/add"]' : 'prepend', '.product__info-wrapper form[action="/cart/add"][id*="__main"][id^="product-form-template"]' : 'prepend', '.product-page--main-content form.product-buy-buttons--form' : 'prepend', 'product-form form[action*="/cart/add"]' : 'prepend', 'form[action*="/cart/add"][is="product-form"]' : 'prepend', 'form[action*="/cart/add"] #appstle-subscription-widget-placeholder' : 'after', '[data-block-type="buy-buttons"] form[action*="/cart/add"]' : 'prepend', '.product__info form.product__form[action*="/cart/add"]' : 'prepend', '.np-product-details product-form form[action*="/cart/add"]' : 'prepend', 'form.product__form-buttons.js-prod-form-submit[id^="product-form-buttons-template--"][id*="__main"]' : 'prepend', '.product-single [itemtype="http://schema.org/Offer"] form#AddToCartForm' : 'prepend', 'form#product-add-cart.shopify-product-form' : 'prepend', '.product__main .product-info form.product-form[action*="/cart/add"] .product-details' : 'prepend', }; var GlobalRequirements = { '.gf_column, .gf_row, [data-key="product"][id^="m-"]' : { // Forms in Gempages need an add to cart button otherwise it doesn't make sense showing element there canShow : function($form, key) { var hasAddtcButton = false; if ($form.prop("tagName") !== 'FORM') { var $actualForm = $form.closest('form'); if ($actualForm.length > 0) { $form = $actualForm; } } if ($form.find('button[type="submit"], input[type="submit"], button#AddToCart, button.gf_add-to-cart, div[data-add-to-cart]').length>0) { hasAddtcButton = true; } return hasAddtcButton; } }, '.pf-product-form' : { canShow : function($form, key) { var hasAddtcButton = false; if ($form.prop("tagName") !== 'FORM') { var $actualForm = $form.closest('form'); if ($actualForm.length > 0) { $form = $actualForm; } } if ($form.find('button[data-pf-type="ProductATC"]').length>0 || $form.find('button[data-pf-type="ProductATC2"]').length>0) { hasAddtcButton = true; } return hasAddtcButton; } }, '.ecom-product-form' : { canShow : function($form, key) { var hasAddtcButton = false; if ($form.prop("tagName") !== 'FORM') { var $actualForm = $form.closest('form'); if ($actualForm.length > 0) { $form = $actualForm; } } if ($form.find('button[type="submit"]').length > 0 || $form.find('.shopify-payment-button').length > 0 || $form.find('.ecom__element--button').length > 0 || $form.find('button.ecom-product-single__buy_it_now_btn--checkout').length > 0) { hasAddtcButton = true; } return hasAddtcButton; } },/* '.gt_product' : { canShow : function($form, key) { console.log($form, $form.find('.sealsubs-target-element')); if ($form.find('.sealsubs-target-element').length>0) { return false; } return true; } },*/ // If the element exists by the selector in this key, then check what the function returns. 'product-form.product-form, div.product-form, div[data-product-blocks], [data-product-details], .product-info__wrapper, .product-page--featured-blocks, .product__information, .product-page--blocks, form#AddToCartForm, .product-single__box, .ecom-product-form' : { canShow : function($form, key) { // This is for theme 2.0 // Make sure that the parent element doesn't already include the app block var canShow = true; var configs = [ { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('product-form.product-form').closest('.product__info-container').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('product-form.product-form, div.product-form').closest('div').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('div[data-product-blocks]').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('[data-product-details]').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('.product-info__wrapper').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('.product-page--featured-blocks').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('.product__information').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('.product-page--blocks').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f) { // Get closest parent that contains all elements, including the app block // Check if the app block is there var sealExtension = $f.closest('form#AddToCartForm').find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f, key) { // Get closest parent that contains all elements, including the app block // Check if the app block is there // var sealExtension = $f.closest('.product-single__box').find('.shopify-app-block [data-seal-extension]'); var sealExtension = $f.closest(key).find('.shopify-app-block [data-seal-extension]'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } }, { hasExtension: function($f, key) { // Get closest parent that contains all elements, including the app block // Check if the Ecomposer's block is in here var sealExtension = $f.closest(key).find('.ecom-extension-product-seal-subscriptions .sealsubs-target-element'); if (sealExtension.is($form)) { // We found ourselves (the cat caught it's own tail) return false; } return (sealExtension.length > 0); } } ]; if ($form.closest(key).length>0) { for(var o = 0; o 0) { // We found ourselves (the cat caught it's own tail) return true; } return (!(sealWidget.length > 0)); } }, '[itemtype="http://schema.org/Offer"]' : { canShow: function($form, key) { var sealWidget = $form.closest(key).find('form + #new-form .sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '.product-page--root .product-page--wrapper [itemtype="https://schema.org/Product"]' : { canShow: function($form, key) { var sealWidget = $form.closest(key).find('.product-page--block[data-block-type="@app"] .shopify-app-block [data-seal-extension]'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '[data-product-block-container] .mt3, article#product-description, .product-info' : { canShow: function($form, key) { var sealWidget = $form.closest(key).find('.shopify-app-block [data-seal-extension]'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, 'form .product-form.mfp-link' : { canShow: function($form, key) { var sealWidget = $form.closest('form').children('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '.product-form .price-descriptors' : { canShow: function($form, key) { var sealWidget = $form.closest('form').children('.sealsubs-target-element'); var isAppBlock = ($form.closest('[data-seal-extension]').length > 0 ? true : false); var thereIsAnotherForm = ($form.closest('.product-form ').find('form[action*="/cart/add"] button').length > 0 ? true : false); if (!isAppBlock && thereIsAnotherForm && sealWidget.is($form) === false) { return false; } return true; } }, '.product__section-details, .product__description, .product-block-container, .product-blocks, .product-form, .product-actions, .product-info, .product__section-content, .product-single__box, .product-details, .product__inner, .product-page--info, .t4s-product__info-container' : { canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form) || sealWidget.closest('.product__upsell-item').length > 0) { // We found ourselves (the cat caught it's own tail) // OR, the form is an upsell of an item on the product page. return true; } return !(sealWidget.length > 0); } }, '.productView-details' : { // This one has to be separate. It was in the one above this one, but then the app found another parent element and used it. Therefore 2 widgets showed up. canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, 'form.shopify-product-form' : { // This one probably also has to be separate canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '.product__content, .product-page--left-column, .product-grid__detail, .product__info, .product-information .entry-summary, form.AddToCartForm, [itemtype="http://schema.org/Offer"], .product__section-right, #product-content, .product-content-container, product-page .product-text, .product-detail__detail, .product-single, .product-converter__blocks, .collection__page-product, .quick-view__info' : { // This one has to be separate from the previous one canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '.product-information--inner, .main-product__blocks, [id^="ProductInfo-quickadd-template--"], .m-main-product--info, .product-details, .quickbuy-form, .product__right-column-sticky, [id^="ProductInfo-template--"], .pdp-content, .product .CRO, product-info[direction="column"], .product-detail__form, .product__detail-content, .flex__item.product__right, .yv-main-product-detail, [class="#product-meta"], .product__meta, [data-product-grid-column-details], .product-single-right-box, .item-info, .wt-product__info, .product-info-inner, .main-product__content-inner, .main-product__hero, .prd-block-info, .product-quick-add__form, .detail-info, .gsp-main-product-blocks' : { // This one has to be separate from the previous one canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '.main-product__hero' : { // This one has to be separate from the previous one canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } }, '[id^="shopify-section-template--"][id*="__main"] .product-single__form' : { // This one has to be separate from the previous one canShow: function($form, key) { var stickyAtcButton = $form.closest(key).find('.sticky-price-and-button'); if (stickyAtcButton.length > 0) { // Don't show the widget in the stick add to cart form, as it is basically a simulation of a real form (mimate-france.myshopify.com) return false; } return true; } }, '#Block--upsell' : { canShow: function($form, key) { return false; } }, '.product-price' : { canShow: function($form, key) { return false; } }, '#recently-viewed-products-grid' : { canShow: function($form, key) { return false; } }, 'payment-terms' : { canShow: function($form, key) { return false; // ziijqw-4a } },/* 'product-info-upsell.upsell--toggle_switch' : { canShow: function($form, key) { return false; } },*/ /* '#ProductSection-product-template' : { // This one has to be separate from the previous one canShow: function($form, key) { var sealWidget = $form.closest(key).find('.sealsubs-target-element'); if (sealWidget.is($form)) { // We found ourselves (the cat caught it's own tail) return true; } return !(sealWidget.length > 0); } },*/ } if (typeof ClientSpecifics === 'undefined') { // This will contain a list of all client specific functions var ClientSpecifics = {}; } var SealGlobal = (function() { var Controller = (function() { function removeCurrencyAttrs($el) { // Remove the currency attributes so that the currency conversion apps will pick them up again try { var cattr = $el.attr('data-currency'); if (typeof cattr !== 'undefined' && cattr !== false) { $el.removeAttr('data-currency'); } if (typeof Shopify !== 'undefined' && typeof Shopify.currency !== 'undefined' && typeof Shopify.currency.active === 'string') { var cattr = $el.attr('data-currency-'+Shopify.currency.active.toLowerCase()); if (typeof cattr !== 'undefined' && cattr !== false) { $el.removeAttr('data-currency-'+Shopify.currency.active.toLowerCase()); } } } catch(e) { console.log(e.message); } } function getSeparatedPricePerUnit(price) { if (typeof Shopify !== 'undefined' && typeof Shopify.currency !== 'undefined' && typeof Shopify.currency.active !== 'undefined') { var currency = Shopify.currency.active; var currencySymbols = GlobalUtility.money.currencySymbols; var symbol = currency; if (typeof currencySymbols[currency] === 'string') { symbol = currencySymbols[currency]; } price = Math.round(price); // The price is in cents and we have to round it // The commented one also includes the currency ISO symbol var usePrice = ''+symbol+''+Math.floor(price/100)+''+'.' + (price - Math.floor(price/100)*100).toString().padStart(2, '0')+''; return usePrice; } return ''; } function setListeners() { var priceObservers = {}; document.addEventListener('sealsubs:price_update', function(e) { // Update the default price on the product page if (true) { // GlobalUtility.nav.isProductPage() var eventDetails = e.detail; if (typeof eventDetails.element !== 'undefined') { var $el = $_(eventDetails.element); if ($el.closest('.bundler-target-element').length > 0) { // Don't update prices if the widget is in the bundler widget return true; } if ($el.closest('.product-upsell-holder').length > 0) { // Don't update prices if the widget is in the upsell element, because it can cause issues with the other widget in the main product form. return true; } if ($el.closest('product-recommendations').length > 0) { // Don't update prices if the widget is in the upsell element, because it can cause issues with the other widget in the main product form. arcticmed return true; } if (typeof eventDetails.price !== 'undefined') { var newPrice = eventDetails.price; var formattedPrice = GlobalUtility.money.formatPrice(newPrice); // p: is the parent selector // s: is the price element selector var priceSelectors = [{ p: '.product-single', s: '.price:not(.price--on-sale) .price__regular .price-item--regular' }, { p: '.product-single', s: '.price.price--on-sale .price__sale .price-item--sale' }, { p: '', s: '.product-single__prices .product__price:not(.product__price--compare)' }, { p: 'form', s: '.product-pricing .product--price .price--main .money' }, { p: '#zpproductselectorfull1-wrapper', s: '[data-zp-product-discount-price]' }, { p: '.product-single__meta', s: '.product-single__header .product__price' }, { p: '.product_section', s: '.modal_price .current_price' }, { p: '.product-area__details', s: '.product-area__col--price .current-price.theme-money' }, { p: 'form.pf-product-form', s: '[data-product-type=\"price\"][data-pf-type=\"ProductPrice\"]' }, { p: '.product__meta', s: '.product__price .fs-heading-4-base[data-price]' }, { p: '.product-details', s: '#product-price .money[data-product-price]' }, { p: 'form[action*=\"/cart/add\"]', s: '#ProductPrice.product-single__price' }, { p: '[itemtype=\"http://schema.org/Offer\"]', s: '#ProductPrice' }, { p: '.shopify-section.product-section .product', s: '.price:not(.price--on-sale) span.price-item--regular' }, { p: 'form.shopify-product-form', s: '.product-price .price .money:not(.original)' }, { p: 'form.AddToCartForm .gf_column', s: '.gf_product-prices .gf_product-price.money:visible' },{ p: 'form.AddToCartForm .item-content', s: '.gf_product-prices .gf_product-price.money:visible' }, { p: '.product-shop-wrapper', s: '.price-box #price .price' }, { p: '.product-info__wrapper', s: '.product__price span[data-product-price]' }, { p: 'form.product-form--container', s: '.product-form--price-wrapper .product-form--price' }, { p: '#add-to-cart-form', s: '.product-page--pricing--variant-price #price-field' }, { p: '#section-product .site-box-content', s: '.price-reviews .product-price' }, { p: '.product-main', s: '.product--price .price--main[data-price]' }, { p: '.grid__item', s: '.product__price [data-product-price]' }, { p: '.product-info', s: '.product-title__wrapper .product-price .product-normal-price' }, { p: '.product-info-block', s: '.price .special-price' }, { p: '.product-form--root', s: '.product-form--price-container .product-form--price' }, { p: '[data-product-blocks]', s: '.product__price[data-product-price]' }, { p: '.Product__Wrapper .Container', s: '.ProductMeta__PriceList .ProductMeta__Price.Price' }, { p: '.product__info-container', s: '.price:not(.price--on-sale) .price__regular .price-item--regular price-money bdi', specialSeparatedDecimals: true }, { p: '.product__info-container', s: '.price:not(.price--on-sale) .price__container .price__regular .price-item.price-item--regular' }, { p: '.product__info-container', s: '.price .price__container .price__sale .price-item.price-item--sale.price-item--last' }, { p: '.product__info', s: '.price-list .price--highlight' }, { p: '.product__info-container', s: '.price-item--sale.price-item--last' }, { p: '.product-page--main-content', s: '.product-price--root .product-price--original' }, { p: '.formAddToCart', s: '.proPrice #ProductPrice' }, { p: '.product-single__form', s: 'button #ProductPrice' }, { p: '.shopify-product-form', s: 'button .total-sticky-price' }, { p: '.product_section', s: '.product__price .current-price' }, { p: '.product-page--blocks', s: '.product-form--price' }, { p: '#AddToCartForm', s: 'button [data-product-price]' }, { p: '.product__info', s: '.price-list .price.price--large:not(.price--compare)' }, { p: 'form[action*=\"/cart/add\"]', s: '.text-color-regular-price' }, { p: '.product-details-wrapper', s: '#AddToCartForm #ProductPrice' }, { p: '.product-wrap', s: '.product-price__final' }, { p: '', s: '.product-detail__price [data-product-price][data-product-detail-price] span.theme-money' }, { p: '.product-single__meta', s: '.price-item.price-item--regular' }, { p: '.tt-product-single-info', s: '.tt-price span.new-price' }, { p: '.tt-product-single-info', s: '.tt-price span.sale-price' }, { p: '.tt-product-single-info', s: '.tt-price span[class=\"\"]' }, { p: '.ProductForm', s: '.ProductForm__AddToCart span.Button__SeparatorDot + span' }, { p: '.grid__item', s: '.product__current-price' }, { p: 'form.product-form', s: '.add-to-cart .product-actions .product-price .current-price' }, { p: 'article#product-description', s: 'button.add-item [data-regular-price]' }, { p: '.product-details', s: 'p.price-container__price' }, { p: '.sealsubs-target-element.sealsubs-full', s: '.product-single__price' }, { p: 'form.cpts-form', s: '.cpts-form-price-container .cpts-form-price' }, { p: 'form.product-form.product-form--single', s: '.product-single__price-number' }, { p: '.sidebar-product-template', s: '#ProductPrice-product-template span[itemprop=\"price\"]' }, { p: '.product-block-container', s: '.text-scheme-text[data-product-price]' }, { p: '.product-block-container', s: 'button.add-to-cart-btn [x-html=\"formatMoney(current_price)\"]' }, { p: '.product-block-container', s: 'button.add-to-cart-btn [x-html=\"formatMoney(current_price)\"]' }, { p: '.product__details--product-page', s: '.product-block--price .price-ui .price [data-currency-original]' }, { p: '.product-single__meta', s: '.product__price[id^=\"ProductPrice-\"]' }, { p: 'form[action*=\"/cart/add\"]', s: '.single_product__price .product-price' }, { p: '.drawer__content', s: '.product-item-meta__price-list-container [data-product-price-list]' }, { p: '.product__info-container', s: '.price__regular .price-item.price-item--regular', forbiddenElements: 'bdi' }, { p: '.product-grid__detail', s: '.product-price .product-price__amount' }, { p: '.product-info-main', s: '.regular-price #productPrice' }, { p: '.lh-content-summary', s: '.lh-price-block .lh-price' }, { p: '#AddToCartForm', s: '#product-price .price__regular .price-item--regular' }, { p: '#add-item-form', s: '.purchase #price-preview' }, { p: '.product-actions', s: '.product-price--original' }, { p: '.wrap-product-info', s: '[class*=\"pr_price-template--\"] [id^=\"ProductPrice-template--\"]' }, { p: '.product-single__meta', s: '#ProductPrice-product-template' }, { p: '.shop-main', s: '.shop-sale-price' }, { // Only for home-healthcare-solutions.myshopify.com p: '#shopify-section-pr_summary', s: '#price_ppr ins' }, { // Only for home-healthcare-solutions.myshopify.com p: '#shopify-section-pr_summary', s: '#price_ppr .price-only' }, { p: '.product-details', s: '.product-price [data-product-price]' }, { p: '.pf-product-form', s: '[data-product-price="true"][data-product-type="price"]' }, { p: '.product__inner', s: '.btn-state-ready [data-button-price]' }, { p: '.product__content', s: '.product__price__wrap .product__price [data-product-price]' }, { p: '.product-half', s: '.product-price #product-price' }, { p: '.pdp-form', s: '#productPrice' }, { p: '.pdp-form', s: '.pdp-qty-price .price-wrap' }, { p: '.product-details', s: '.price__current [data-price]' }, { p: '.shg-c', s: '[data-shg-product-target="product-price"]' }, { p: '.product__grid-right', s: '.product-price .price' }, { p: '.product-info__block-list', s: '.price-list--product sale-price > span.money' }, { p: '.product-card-wrapper', s: '.price__sale .price-item.price-item--sale.price-item--last' }, { p: 'body', s: '#satcb_bar .satcb_price' }, { p: '.card__content', s: '.card-information .price .price__container .price__regular' }, { p: '.product-info__block-list', s: 'price-list sale-price' }, { p: 'form[id^="product_form_template--"]', s: '.price-list .price' }, { p: 'form.ProductForm', s: '.ProductForm__Price .ProductMeta__PriceList .ProductMeta__Price' }, { p: '.product-single__box', s: '.product-single__price-number' }, { p: 'form.product-form', s: '.product-price__prices #ProductPrice' }, { p: '.product-page--info', s: '.product-price--wrapper .product-price--original' }, { p: '.product__section-right', s: 'button.ajax-submit [data-regular-price]' }, { p: '.product-info__sticky', s: '.price__default .price__current' }, { p: 'form.product-form', s: '.product-form__info-content .price-list .price' }, { p: '[data-zp-add-to-cart-form]', s: '[data-zp-product-discount-price]' }, { p: '.zpa-multi-product-buy-box', s: '.ts-regular-1.tsl-2' }, { p: '.product-single-right', s: '#ProductPrice-section1-version2' }, { p: '.productView-product', s: '.price__regular .price-item.price-item--regular' }, { p: '.product-details', s: '#price .current-price' }, { p: '.stick-panel-checkout', s: '.product__price' }, { p: '.product__meta', s: '[data-product-price][itemprop="price"]' }, { p: '.product-single__box', s: '.price .price__number' }, { p: '.t4s-product__info-container', s: '.t4s-product-price ins' }, { // Removed, otherwise the original price and savings also get removed (457fa4-3.myshopify.com) p: '.t4s-product__info-container', s: '.t4s-product-price', onlyIfNoChildNodes: true }, { p: '.t4s-product-info__inner', s: '.t4s-product-price' }, { p: '.pf-product-form', s: '[data-pf-type="ProductPrice2"] [data-product-type="price"][data-pf-type="ProductPrice2Item"]', allowMultiple: true // So that the app can update multiple price elements on the page at the same time }, { p: '.product__info-container', s: '.price-item--sale.price-item--last', allowMultiple: true }, { p: 'form.product-page--form', s: 'product-price-root .product-price--original', allowMultiple: true }, { p: 'form.product-page-form', s: '.data-product-price', }, { p: '.product-inner-info', s: '#ProductPrice', }, { p: 'quick-buy-popover', s: '.price-list .price', }, { p: '.site-box-content', s: '.product__price--original', }, { p: '.product-block-1', s: '[data-commerce-type="variation-price"]', }, { p: 'safe-sticky.product-info', s: 'sale-price', }, { p: 'gp-product', s: 'gp-product-price[gp-data*="regular"] .gp-price', // 53a4dd-2 allowMultiple: false },{ p: 'div[label="Block"][type="component"]', // This can cause an issue on collection pages s: 'gp-product-price .gp-price', allowMultiple: true }, { p: '.product--add-to-cart-form', s: '#ProductPrice' }, { p: '.hdt-product-info__list', s: '.hdt-price .hdt-money' }, { p: '.hdt-product-info__list', s: '.hdt-qty-price .hdt-money' }, { p: '[data-instant-form-product-url]', s: '[data-instant-action-type="redirect-to-cart"] [data-instant-dynamic-content-source="PRICE"]' }, { p: '.product__info-container', s: '.price .price__sale dd + dt + dd .price-item.price-item--sale price-money bdi', specialSeparatedDecimals: true }, { p: '.product__info-container', s: '.price.price--on-sale .price__sale .price__last .price-item--sale price-money bdi', specialSeparatedDecimals: true }, { p: 'form.shopify-product-form', s: '.add-to-cart__price #ButtonPrice-product' }, { p: '#productInfo-product', s: '#ProductPrice-product' }, { p: 'safe-sticky.product-info', s: '.rating-with-text price-list sale-price' }, { p: '.product__info', s: '.product__price .price .price__regular' }, { p: '.form__wrapper', s: '.product__price .product__price--regular' }, { p: '.frm_product_collection', s: '.product-collection__price .price' }, { p: '.product-quick-add__form', s: '.product__price' }, { p: '.shop-product-info', s: '.shop-product-price-block', includeCompareAtPrice: false }, { p: '.product__blocks.accordion-parent', s: '.f-price__regular .f-price-item--regular', }, { p: '.product__form__wrapper', s: '.product__price', }, { p: '.product-single__information', s: '.price-regular .price--special', }, { p: '.product-details', s: '.add-to-cart-text [ref="priceContainer"] .price', }, { p: '.product-details', s: 'product-price [ref="priceContainer"] .price', }, { p: '.product-detail__information', s: '.product_submit_button .total-price__detail', }, { p: '.product-block-area', s: '[data-variant-fragment="price"] .product-price-block', }, { p: '.product__outer', s: '.price-item--regular', allowMultiple: true }, ]; if (typeof ClientSpecifics['ControllerPriceSelectors'] !== 'undefined') { priceSelectors = ClientSpecifics['ControllerPriceSelectors'].modify(priceSelectors); } // Update the price with a different price selector that is not yet defined inside priceSelectors var perDeliveryElements = { /* 'form[action*="/cart/add"]' : [ '.price.price_varies .money' ],*/ '#shopify-section-pr_summary' : [ // Parent '#price_ppr.price_range .money' // Child ] }; var savingsElements = { 'form' : [ '.product-pricing .badge--sale [data-price-money-saved]' ], '.product-single__meta' : [ '.product__price-savings' ], '#shopify-section-pr_summary' : [ // Only for home-healthcare-solutions.myshopify.com '#price_ppr > .txt_sale' ], '.product__info-container' : [ '.price__badge-sale' ], '.t4s-product__info-container' : [ '.t4s-badge-price' ], '.product-info' : [ '.product-info__badge-list on-sale-badge' ], '.product__form__wrapper' : [ '.product__price--off span ~ em ~ span' ] }; if (typeof ClientSpecifics['ControllerSavingsElements'] !== 'undefined') { savingsElements = ClientSpecifics['ControllerSavingsElements'].modify(savingsElements); } // Hide these elements if compare at price is lower than actual price (for prepaid subs). var compareAtPriceElementsHide = { '.tt-product-single-info' : { '.tt-price .old-price' : { 'hideClass': 'hide' } }, '.grid__item': { '.product__compare-price' : { 'hideClass': 'hide' } }, '#ProductSection-product-template .product-single__description': { // Parent '.product__price .price[data-price] .price__sale .price-item.price-item--regular' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { if (show) { $element.closest('.product__price .price[data-price]').addClass('price--on-sale'); } else { $element.closest('.product__price .price[data-price]').removeClass('price--on-sale'); } } } }, '.product__info-container': { // Parent '.price__container .price__sale .price-item--regular' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { // $element is the compare at price element if ($element.length > 0) { for (var t = 0; t < $element.length; t++) { var $elm = $($element[t]); var $priceContElm = $elm.closest('.product__info-container .price'); if ($priceContElm.length === 0) { $priceContElm = $elm.closest('.sticky-atc__price .price.price--show-badge'); } if ($priceContElm.length > 0) { if (show) { $priceContElm.addClass('price--on-sale'); } else { $priceContElm.removeClass('price--on-sale'); } } } } // sticky-atc__price }, allowMultiple: true } }, '.product-card-wrapper': { // Parent '.price__sale .price-item.price-item--regular' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { // $element is the compare at price element if (show) { $element.closest('.product-card-wrapper .price__container').addClass('price--on-sale'); } else { $element.closest('.product-card-wrapper .price__container').removeClass('price--on-sale'); } } } }, '.product-single__meta': { '.price.price--on-sale .price__regular .price-item--regular' : { 'hideClass': 'hide' } }, 'form.AddToCartForm .gf_column': { '.gf_product-compare-price' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { // $element is the compare at price element if (show) { $element.show(); } else { $element.hide(); } } } }, '.product-page--info': { '.product-price--compare' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { // $element is the compare at price element if (show) { $element.attr('style', 'display:inline-block;'); } else { $element.attr('style', 'display:none;'); } } } }, '.site-box-content' : { '.product__price--compare' : { 'hideClass': 'hide' } }, '.shop-bottom' : { '.shop-compare-price .seal-compare-at-price' : { 'hideClass': 'hide' } }, '[data-instant-form-product-url]' : { '[data-instant-action-type="redirect-to-cart"] [data-instant-dynamic-content-source="COMPARE_AT"]' : { showHideFunc: function($element, show) { // $element is the compare at price element if (show) { $element.attr('style', 'display:inline-block;'); } else { $element.attr('style', 'display:none;'); } } } }, '.product__info-container' : { '.price.price--large .price__sale .price__compare .price-item--regular price-money' : { showHideFunc: function($element, show) { // $element is the compare at price element /* if (show) { $element.closest('.price__sale').addClass('seal-show-price'); } else { $element.closest('.price__sale').removeClass('seal-show-price'); }*/ if (show) { $element.closest('.price.price--large').addClass('price--on-sale'); } else { $element.closest('.price.price--large').removeClass('price--on-sale'); } }, specialSeparatedDecimals: true } }, 'product-info.product__info-container': { // Parent '.price__sale .price__compare-price .main-comapre-price' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { if (show) { $element.closest('.price.price--large.price--show-badge').addClass('price--on-sale'); } else { $element.closest('.price.price--large.price--show-badge').removeClass('price--on-sale'); } } } }, '.sticky-content-container': { // Parent '.price__default .price__was' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { if (show) { } else { $element.html(''); } } } }, '.sticky-content-container': { // Parent '.price__default .price__was' : { // Compare at price element (will have the compare at price set in it) showHideFunc: function($element, show) { if (show) { } else { $element.html(''); } } } }, /* { p: '.product__info-container', s: '.price:not(.price--on-sale) .price__regular .price-item--regular price-money bdi', specialSeparatedDecimals: true }, */ }; if (typeof ClientSpecifics['ControllerCompareAtPriceElementsHide'] !== 'undefined') { compareAtPriceElementsHide = ClientSpecifics['ControllerCompareAtPriceElementsHide'].modify(compareAtPriceElementsHide); } /* // Elements where we should show the compare at price var compareAtPriceElements = { '.product__info-container': [ '.price.price--on-sale .price__sale .price-item--regular' ] };*/ var pricePerUnitElements = { '.product__info-container' : [ { 'price_per_unit_with_unit': '.unit-price .price-item' }, { 'price_per_unit' : '.unit-price.caption .price-item.price-item--last > span:first-of-type', 'unit' : '.unit-price.caption .price-item.price-item--last > span:last-of-type', } ], 'form.ProductForm' : [ { 'price_per_unit' : '.UnitPriceMeasurement .UnitPriceMeasurement__Price', 'unit' : '.UnitPriceMeasurement .UnitPriceMeasurement__ReferenceUnit' } ], '.product-info__block-list' : [ { 'price_per_unit' : '.UnitPriceMeasurement .UnitPriceMeasurement__Price', 'unit' : '.UnitPriceMeasurement .UnitPriceMeasurement__ReferenceUnit' } ], '.product .product__info-wrapper .product__info-container' : [ { 'price_per_unit' : '.unit-price .price-item.price-item--last > span:first-of-type', // Added .unit-price on 2023-01-26 because of "fembites" where price was updated with just unit 'unit' : '.unit-price .price-item.price-item--last > span:last-of-type', // Added .unit-price on 2023-01-26 because of "fembites" where price was updated with just unit } ], '.product-single__meta' : [ { 'price_per_unit' : '.price-unit-price [data-unit-price]', 'unit' : 'price-unit-price [data-unit-price-base-unit]', } ], '.product__meta' : [ { 'price_per_unit' : '.price-item.price-item--last > span:first-of-type', 'unit' : '.price-item.price-item--last > span:last-of-type', } ], 'safe-sticky.product-info' : [ { 'price_per_unit_with_unit' : 'unit-price' } ], 'div.product__info-container' : [ { 'price_per_unit' : '[data-unit-price] price-money bdi', 'unit' : '[data-unit-base]', specialSeparatedDecimals : true } ], '.product__info' : [ { 'price_per_unit' : '.unit-price-measurement .unit-price-measurement__price', //'unit' : '.unit-price-measurement .unit-price-measurement__reference-value', } ], 'div.product__info-container[class]' : [ // A different selector so we don't override the .product__info-container selector { 'price_per_unit_with_unit' : '.unit-price .price-item.price-item--last', } ],/* To display price per unit, the widget HAS to be installed! */ } // Elements where we should show the total amount increased by quantity var amountElements = { 'form[action="/cart/add"]' : [ '[data-button-price]' ], '#AddToCartForm' : [ '#AddToCart .btn-money' ] }; // Elements where we should show the total compare at amount increased by quantity var compareAtAmountElements = { /* 'form[action="/cart/add"]' : [ '[data-button-price]' ] */ }; var isProductPage = GlobalUtility.nav.isProductPage(); for(var o = 0; o < priceSelectors.length; o++) { var selector = priceSelectors[o].s; var sParent = priceSelectors[o].p; var $parent = null; if (sParent !== '') { $parent = $el.closest(sParent); var $priceEl = $parent.find(selector); } else if(isProductPage) { // Use the selector without the parent element only on non-product pages var $priceEl = $_(selector); } if ($priceEl.length === 1 || ($priceEl.length > 1 && typeof priceSelectors[o].allowMultiple !== 'undefined') ) { var skipElement = false; try { if (typeof priceSelectors[o].onlyIfNoChildNodes !== 'undefined' && priceSelectors[o].onlyIfNoChildNodes === true && $priceEl[0].children.length > 0) { // This element has child nodes, but we mustn't update it if it has them // Skip it var containsNotOurElement = false; for(var t = 0; t < $priceEl[0].children.length; t++) { if ($priceEl[0].children[t].classList.contains('seal-money') !== true) { containsNotOurElement = true; } } if (containsNotOurElement === true) { skipElement = true; } } } catch(e) { console.log(e); } if (skipElement === false) { $priceEl.each(function(k, e) { var $currentPricEl = $(e); if ($currentPricEl.closest('.complementary-products').length > 0) { return; // Don't update the price in the recommended products } if ($currentPricEl.closest('product-recommendations').length > 0) { return; // Don't update the price in the recommended products (568705) } if (typeof priceSelectors[o].forbiddenElements !== 'undefined' && typeof $currentPricEl !== 'undefined') { var forbiddenElements = priceSelectors[o].forbiddenElements; if ($currentPricEl.find(forbiddenElements).length > 0) { return; // Skip this element as it contains a forbidden element, which means that another selector is probably controlling it. } } var usePrice = GlobalUtility.money.wrapInSpan(formattedPrice); if (typeof priceSelectors[o].specialSeparatedDecimals !== 'undefined' && priceSelectors[o].specialSeparatedDecimals === true) { if (typeof Shopify !== 'undefined' && typeof Shopify.currency !== 'undefined' && typeof Shopify.currency.active !== 'undefined') { var currency = Shopify.currency.active; var currencySymbols = GlobalUtility.money.currencySymbols; var symbol = currency; if (typeof currencySymbols[currency] === 'string') { symbol = currencySymbols[currency]; } // The commented one also includes the currency ISO symbol usePrice = ''+symbol+''+Math.floor(newPrice/100)+''+'.' + (newPrice - Math.floor(newPrice/100)*100).toString().padStart(2, '0')+''; } } if (typeof priceSelectors[o].includeCompareAtPrice !== 'undefined' && priceSelectors[o].includeCompareAtPrice === true) { // includeCompareAtPrice var formattedCompareAtPrice = GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(eventDetails.compareAtPrice)); usePrice += ''+formattedCompareAtPrice+''; } $currentPricEl.html(usePrice); removeCurrencyAttrs($currentPricEl); GlobalUtility.money.convertViaIntegrations($currentPricEl); // Not added because we couldn't test it }); } } } if (typeof eventDetails.amount !== 'undefined' && eventDetails.amount !== null && eventDetails.amount !== '') { var amount = eventDetails.amount; if (amount > 0) { for(var amountParent in amountElements) { if (amountElements.hasOwnProperty(amountParent)) { var $parent = $el.closest(amountParent); if ($parent.length > 0) { for(p = 0; p < amountElements[amountParent].length; p++) { var $amountEl = $parent.find(amountElements[amountParent][p]); if ($amountEl.length === 1) { $amountEl.html(GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(amount))); } } } } } } } if (typeof eventDetails.compareAtPrice !== 'undefined' && eventDetails.compareAtPrice !== null && eventDetails.compareAtPrice !== '') { var savings = eventDetails.compareAtPrice - newPrice; if (savings > 0) { for(var savingsParent in savingsElements) { if (savingsElements.hasOwnProperty(savingsParent)) { var $parent = $el.closest(savingsParent); if ($parent.length > 0) { for(p = 0; p < savingsElements[savingsParent].length; p++) { var selectorTmp = ''; if (typeof savingsElements[savingsParent][p] === 'object') { // This savings element has it's own configuration var elConfig = savingsElements[savingsParent][p]; selectorTmp = elConfig.selector; if (elConfig.createAutomatically === true) { var template = elConfig.template; var appendTo = elConfig.appendTo; var $savingsEls = $parent.find(selectorTmp); if ($savingsEls.length === 0) { // Append this element $parent.find(appendTo).append(template); } } } else { selectorTmp = savingsElements[savingsParent][p]; } var $savingsEls = $parent.find(selectorTmp); if ($savingsEls.length > 0) { $savingsEls.each(function(k, el) { // Added option to loop through savings elements because of 2a40b9-2 and bfa432-0e var $savingsEl = $(el); var savingsFormatted = GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(savings)); var originalValue = $savingsEl.text(); if (/\d+/.test(originalValue)) { // Change the value only if it already contains a number. var originalValue = originalValue.trim(); var match = originalValue.match(/^.*?\s/); var prefixText = ''; if (match !== null && typeof match[0] !== 'undefined') { prefixText = match[0]; } if (prefixText.indexOf('%') === -1) { // This should come out as something like "SAVE 20€" savingsFormatted = prefixText + savingsFormatted; } if (originalValue.indexOf('%') !== -1) { // This is a percentage saving badge. var originalHtml = $savingsEl.html(); originalHtml = originalHtml.trim(); var percentage = savings/eventDetails.compareAtPrice*100; percentage = Math.round(percentage); savingsFormatted = percentage+'%'; var originalHtmlWithUpdatedSavings = originalHtml.replace(/\s\d+% 0) { var hideCompare = (eventDetails.compareAtPrice <= eventDetails.price) ? true : false; if (eventDetails.compareAtPrice > 0) { for(var compareAtPriceParent in compareAtPriceElementsHide) { if (compareAtPriceElementsHide.hasOwnProperty(compareAtPriceParent)) { var $parent = $el.closest(compareAtPriceParent); if ($parent.length > 0) { for(var compareAtPriceElement in compareAtPriceElementsHide[compareAtPriceParent]) { var $compareAtPriceEl = $parent.find(compareAtPriceElement); var elm = compareAtPriceElementsHide[compareAtPriceParent][compareAtPriceElement]; if ($compareAtPriceEl.length === 1 || ($compareAtPriceEl.length > 0 && typeof elm.allowMultiple !== 'undefined' && elm.allowMultiple === true)) { var formattedCompareAtPrice = GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(eventDetails.compareAtPrice)); if (typeof elm.specialSeparatedDecimals !== 'undefined' && elm.specialSeparatedDecimals === true) { formattedCompareAtPrice = getSeparatedPricePerUnit(eventDetails.compareAtPrice); } $compareAtPriceEl.html(formattedCompareAtPrice); var config = compareAtPriceElementsHide[compareAtPriceParent][compareAtPriceElement]; if (typeof config.hideClass === 'string') { var hideClass = compareAtPriceElementsHide[compareAtPriceParent][compareAtPriceElement].hideClass; if (hideCompare) { $compareAtPriceEl.addClass(hideClass); } else { $compareAtPriceEl.removeClass(hideClass); } } if (typeof config.showHideFunc === 'function') { config.showHideFunc($compareAtPriceEl, !hideCompare); } /* var showClass = compareAtPriceElementsHide[compareAtPriceParent][observerKey].showClass; if (typeof showClass === 'string') { console.log(showClass, hideCompare); if (hideCompare) { $compareAtPriceEl.removeClass(showClass); } else { $compareAtPriceEl.addClass(showClass); } }*/ } } } } } } } if (typeof eventDetails.compareAtAmount !== 'undefined' && eventDetails.compareAtAmount !== null && eventDetails.compareAtAmount !== '') { var compareAtAmount = eventDetails.compareAtAmount; if (compareAtAmount > 0) { for(var amountParent in compareAtAmountElements) { if (compareAtAmountElements.hasOwnProperty(amountParent)) { var $parent = $el.closest(amountParent); if ($parent.length > 0) { for(p = 0; p < compareAtAmountElements[amountParent].length; p++) { var $amountEl = $parent.find(compareAtAmountElements[amountParent][p]); if ($amountEl.length === 1) { $amountEl.html(GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(compareAtAmount))); removeCurrencyAttrs($amountEl); } } } } } } } if (typeof eventDetails.pricePerDelivery !== 'undefined' && eventDetails.pricePerDelivery !== null && eventDetails.pricePerDelivery !== '') { var pricePerDelivery = eventDetails.pricePerDelivery; for(var perDeliveryParent in perDeliveryElements) { if (perDeliveryElements.hasOwnProperty(perDeliveryParent)) { var $parent = $el.closest(perDeliveryParent); if ($parent.length > 0) { for(p = 0; p < perDeliveryElements[perDeliveryParent].length; p++) { var $perDeliveryEl = $parent.find(perDeliveryElements[perDeliveryParent][p]); if ($perDeliveryEl.length === 1) { $perDeliveryEl.html(GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(pricePerDelivery))); GlobalUtility.money.convertViaIntegrations($perDeliveryEl); } } } } } } if (typeof eventDetails.pricePerUnit !== 'undefined' && eventDetails.pricePerUnit !== false && typeof eventDetails.pricePerUnit.pricePerUnitFormatted !== 'undefined' && eventDetails.pricePerUnit.pricePerUnitFormatted !== '') { for(var pricePerUnitParent in pricePerUnitElements) { if (pricePerUnitElements.hasOwnProperty(pricePerUnitParent)) { var $parent = $el.closest(pricePerUnitParent); if ($parent.length > 0) { for(p = 0; p < pricePerUnitElements[pricePerUnitParent].length; p++) { for(var k in pricePerUnitElements[pricePerUnitParent][p]) { if (pricePerUnitElements[pricePerUnitParent][p].hasOwnProperty(k)) { // Available options for k: // - price_per_unit_with_unit // - price_per_unit // - unit if (k === 'unit') { var $pricePerUnitEl = $parent.find(pricePerUnitElements[pricePerUnitParent][p][k]); if ($pricePerUnitEl.length === 1) { $pricePerUnitEl.html(eventDetails.pricePerUnit.unit); } } if (k === 'price_per_unit') { var $pricePerUnitEl = $parent.find(pricePerUnitElements[pricePerUnitParent][p][k]); if ($pricePerUnitEl.length === 1) { var priceWithSeparatedDecimals = ''; if (typeof pricePerUnitElements[pricePerUnitParent][p].specialSeparatedDecimals !== 'undefined' && pricePerUnitElements[pricePerUnitParent][p].specialSeparatedDecimals === true) { priceWithSeparatedDecimals = getSeparatedPricePerUnit(eventDetails.pricePerUnit.pricePerUnit); } if (priceWithSeparatedDecimals !== '') { $pricePerUnitEl.html(GlobalUtility.money.wrapInSpan(priceWithSeparatedDecimals)); } else { $pricePerUnitEl.html(GlobalUtility.money.wrapInSpan(GlobalUtility.money.formatPrice(eventDetails.pricePerUnit.pricePerUnit))); } } } if (k === 'price_per_unit_with_unit') { var $pricePerUnitEl = $parent.find(pricePerUnitElements[pricePerUnitParent][p][k]); if ($pricePerUnitEl.length === 1) { $pricePerUnitEl.html(eventDetails.pricePerUnit.pricePerUnitFormatted); } } } } } } } } } } } } /* globalDebounce('convert-prices', function() { GlobalUtility.money.convertViaIntegrations(); }, 1); */ GlobalUtility.money.convertViaIntegrations(); }); var $document = $_(document); $document.on('click', '.product-thumb-full-quick-view.quick-view-btn', function() { // Required the option to display widgets on homepage turned on globalDebounce('refresh', window.SealSubs.refresh, 500); }); $document.on('click', '.sf__pcard-quick-add button.sf-pqv__button, [data-quick-view-button-open], .form__selectors .radio__button', function() { // Required the option to display widgets on homepage turned on globalDebounce('refresh', window.SealSubs.refresh, 500); }); window.addEventListener("product_modal_displayed", function() { // Requires the option to display widgets on homepage turned on //window.SealSubs.refresh(); globalDebounce('refresh', window.SealSubs.refresh, 50); globalDebounce('checkGenericFormSelectors', window.SealSubs.checkGenericFormSelectors, 50); }); document.addEventListener("quickview:loaded", function() { // Requires the option to display widgets on homepage turned on // naturheals-llc Streamline globalDebounce('refresh', window.SealSubs.refresh, 50); }); $document.on('click', '.btn.quick_view_button', function() { // Requires the option to display widgets on homepage turned on globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 500) }); $document.on('click', 'a.product-modal', function() { // Requires the option to display widgets on homepage turned on globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 500) }); $document.on('click', '.quick-buy, .product-card__quick-buy', function (e) { //setTimeout(window.SealSubs.refresh, 500); globalDebounce('refresh', window.SealSubs.refresh, 500); }); $document.on('click', '.quick-add__submit', function (e) { //setTimeout(window.SealSubs.refresh, 500); globalDebounce('refresh', window.SealSubs.refresh, 500); }); document.addEventListener('sealsubs:subscription_widget_created', function() { if (typeof Flickity=='function') { // Dispatch resize event so that Flickity sliders recalculate their height window.dispatchEvent(new Event('resize')); } }); document.addEventListener('sealsubs:selling_plan_changed', function() { if (typeof Flickity=='function') { // Dispatch resize event so that Flickity sliders recalculate their height window.dispatchEvent(new Event('resize')); } }); } function showHelpForAccessingSubscriptions() { } function addSubscriptonsLinkToCustomerAccountMenu() { } function canRunDisplayByForm() { var canRunDisplayByFormClientResult = false; if (typeof ClientSpecifics['CanRunDisplayByForm'] !== 'undefined') { canRunDisplayByFormClientResult = ClientSpecifics['CanRunDisplayByForm'].check(); } if(GlobalUtility.nav.isProductPage() === false || //$_('#__pf[data-section-id="product-template"]').length > 0 || $_('#__pf').length > 0 || $_('body.template-product #__pf').length > 0 || $_('#quick-modal').length > 0 || $_('.zpa-page-template').length > 0 || $_('.zpa-product-template').length > 0 || $_('.gryffeditor').length > 0 || $_('#shop-bar').length > 0 || $_('quick-buy-drawer').length > 0 || $_('.shopify-section--featured-product').length > 0 || $_('.sticky-cart-bar-container').length > 0 || $_('#sticky-atc-form').length > 0 || (typeof window.Shopify !== 'undefined' && typeof window.Shopify.theme !== 'undefined' && typeof window.Shopify.theme.name === 'string' && window.Shopify.theme.name.indexOf('Express') !== -1) || canRunDisplayByFormClientResult) { // The display by product form can be run on: // - non product pages (homepage) // - on pagefly pages // - on pages in Express theme return true; } } // SealGlobal.init() function init() { var shortInitStyle = document.getElementById('seal-short-init-style'); if (shortInitStyle === null) { $_('body').append(''); } const encodedSettings = btoa(JSON.stringify(settings)); // WIP: SEAL PREVIEW // Append css to body // https://app.sealsubscriptions.com/shopify/public/css/style.css?shop=jp-bear-store.myshopify.com&1657695144 var cssId = 'seal-css-main'; // you could encode the css path itself to generate id.. if (!document.getElementById(cssId)){ var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = cssId; link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'https://cdn-app.sealsubscriptions.com/shopify/public/css/style.css?shop=verbena-flores.myshopify.com&'+window.sealsubscriptions_settings_updated; link.media = 'all'; head.appendChild(link); } /* var cssId = 'seal-css-main'; // you could encode the css path itself to generate id.. if (!document.getElementById(cssId)){ var head = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.id = cssId; link.rel = 'stylesheet'; link.type = 'text/css'; //link.href = 'https://cdn-app.sealsubscriptions.com/shopify/public/css/style.css?shop=verbena-flores.myshopify.com&'+window.sealsubscriptions_settings_updated+'&preview_set_on='; link.href = ' https://app.sealsubscriptions.com/shopify/public/css/style.css?shop=verbena-flores.myshopify.com&'+window.sealsubscriptions_settings_updated+'&preview_set_on='; link.media = 'all'; head.appendChild(link); } */ try { if (document.querySelectorAll('#seal-div-icon').length === 0) { // Preload the down icon var sealElem7482371 = document.createElement('div'); sealElem7482371.id = 'seal-div-icon'; sealElem7482371.style.cssText = 'display:none;'; var img = document.createElement("img") img.src = 'https://cdn-app.sealsubscriptions.com/shopify/public/img/app/dwn.svg?v2'; img.style.cssText = 'width:10px;height:10px;'; img.alt = 'Down icon'; sealElem7482371.appendChild(img); document.body.appendChild(sealElem7482371); } } catch(e) { console.error(e); } setListeners(); showHelpForAccessingSubscriptions(); addSubscriptonsLinkToCustomerAccountMenu(); } function checkGenericFormSelectors() { var genericFormSelectors = []; var genericFormSubSelectors = {}; var homepageFormSelectors = {}; // This part of code will add a blank subscription element to the featured products on the homepage // It works for both IN and AC modules. It would be a good idea to put this logic to a global module if possible. if(canRunDisplayByForm()) { // This condition is redundand, but we kept it for backward compatibility // #__pf is ID which is present on pagefly pages. These product pages don't have one unique form, therefore we have to use this method to display the widget on products there. // TODO: Add a check if we are really on the homepage so we won't show the widgets on collection pages? // TODO: This might not be a good idea, as pagefly builder allows you to create a product page which is on a different url // Works with products on homepage and with quick views } // genericFormSubSelectors = { '.gt_product form[action="/cart/add"][id^="product_form_"]': { '.gt_product-button.gt_button-atc': 'before' }, 'form.AddToCartForm[action*="/cart/add"][data-productid]': { 'div.module-wrap[data-key="p-variants"]' : 'before', '.module-wrap[data-label*="Price"]' : 'after', '.item-content [data-icon="gpicon-product-price"]' : 'after' }, 'form.pf-product-form[action="/cart/add"][id^="product_form_"]': { // Pagefly product form 'h3[data-product-type="title"] + [data-pf-type="Block"]' : 'after', // traynor-family-vineyard 'button[data-pf-type="ProductATC"]' : 'before', // afitmerch 'div[data-pf-type="Row"]' : 'append', // minim-coffee-co 'div[data-product-type="content"][data-pf-type="ProductText"]' : 'after', 'div[data-pf-type="Column"] [data-display="radio"][data-pf-type="ProductVariant"]' : 'after', // vibrant-farm 'div[data-pf-type="Column"] [data-product-type="price"][data-pf-type="ProductText"]' : 'after', // vibrant-farm '[data-pf-type="Row"] div[data-pf-type="Column"] [data-pf-type="Paragraph"]' : 'before', // my-bee-balm 'div[data-pf-type="Column"] [data-product-type="price"][data-pf-type="ProductPrice"]' : 'after', // punarpoosam 'div[data-pf-type="ProductDescription"]' : 'after' // hindigena }, '.gt_product .gt_container form.product-form[data-productid]': { '.gt_flex .gt_button[attribute="addToCart"]' : 'before' }, '[data-name="Sticky Add To Cart"] form.product-form[data-productid]': { 'div[data-class="sticky-cart-bar-container"]' : 'append' }, '.quickview-product form[id^="product-actions-"][action*="/cart/add"]': { '.prices.product-price' : 'after' // happybarista }, '.all_products .grid__item[data-id]' : { '.product-control form.shopify-product-form' : 'prepend' }, '#quick-modal section[data-product-id] form[action*="/cart/add"]' : { '.product-logistics' : 'before' }, 'form[action="/cart/add"][id^="product_form_"]' : { 'product-buy-buttons-element' : 'prepend', '.product-details__options' : 'before' }, 'form[data-zp-add-to-cart-form][data-productid]' : { '.zpa-dynamic-product__inner-row .zpa-product-wrapper' : 'before' }, '.boost-sd__product-item[data-product-id]' : { 'button.boost-sd__button' : 'before' }, 'div.product-details--form-wrapper[itemtype="http://schema.org/Offer"] form#AddToCartForm' : { '#shopify-block-ea8a2e6e-7456-4678-bab0-c68a41b2dc54' : 'after', '[id^="shopify-block-seal_subscriptions_subscription_widget_"]' : 'after' }, 'form[action*="/cart/add"][id^="AddToCartForm-"]' : { '.product__submit__holder' : 'prepend' }, 'form[action*="/cart/add"][id^="product-form-template--"][id*="__"]' : { '.product-featured__block--buy_buttons' : 'before' }, /*'quick-add-component product-form-component[data-product-id]' : { 'form[data-type="add-to-cart-form"][action*="/cart/add"] add-to-cart-component' : 'prepend' },*/ '.buy-buttons-block product-form-component[data-product-id]' : { 'form[data-type="add-to-cart-form"][action*="/cart/add"] add-to-cart-component' : 'prepend' }, 'form[action*="/cart/add"].frm_product_collection' : { '.button-cart-bottom' : 'prepend' } }; // Now add form selectors that can be used anywhere genericFormSelectors = [ // From homepageform selectors {'.gt_product .gt_container form.product-form[data-productid]' : 'prepend'}, {'[data-name="Sticky Add To Cart"] form.product-form[data-productid]' : 'prepend'}, {'form.pf-product-form[action="/cart/add"][id^="product_form_"]' : 'prepend'}, // Pagefly product form {'.gt_product form[action="/cart/add"][id^="product_form_"]' : 'prepend'}, {'form[action="/cart/add"][id^="product-form-"][data-type="add-to-cart-form"][data-productid]' : 'prepend'}, //{'form[action="/cart/add"][id^="product_form_"]' : 'prepend'}, {'form[action="/cart/add"][id^="product_form_"] .ecom-product-single__selling-plan' : 'prepend'}, {'form[action="/cart/add"][id^="product_form_"] .ec-button-action' : 'prepend'}, {'form[action="/cart/add"][id^="product_form_"][onsubmit*="onSubmitAtcForm"]' : 'prepend'}, {'form[action="/cart/add"][id^="product_form_"]' : 'prepend'}, {'form[action*="/cart/add"][id^="product_form_"]' : 'prepend'}, {'form.AddToCartForm[action*="/cart/add"][data-productid]' : 'prepend'}, {'form.product-single__form[action*="/cart/add"][data-productid]' : 'prepend'}, //{'form[data-zp-add-to-cart-form][data-productid] .zpa-dynamic-product__inner-row .zpa-product-wrapper' : 'before'}, {'form[data-zp-add-to-cart-form][data-productid]' : 'prepend'}, {'form.lh-product-form[data-pid]' : 'prepend'}, {'div.product-details--form-wrapper[itemtype="http://schema.org/Offer"] form#AddToCartForm' : 'prepend'}, {'form.product__form-buttons[id="product-form-buttons-"][data-product-id]' : 'prepend'}, {'form.product_form[data-product-id]' : 'prepend'}, {'form#modal_quick_view[data-product-id]' : 'prepend'}, {'form.product-form[action="/cart/add"][data-productid]' : 'prepend'}, {'.quickview-product form[id^="product-actions-"][action*="/cart/add"]' : 'prepend'}, {'form[id^="product-actions-"]' : 'prepend'}, {'#shop-bar form.productForm--shop-bar' : 'prepend'}, {'.all_products .grid__item[data-id]' : 'prepend'}, {'.grid__item[data-id] form[action="/cart/add"].shopify-product-form' : 'prepend'}, {'#quick-modal section[data-product-id] form[action*="/cart/add"]' : 'prepend'}, {'form[action*="/cart/add"][id^="product-form-template--"][id*="__main-"]' : 'prepend'}, // product-form-template--14188255182918__main-2002663538745 in quick-buy-drawer {'form[action*="/cart/add"][id^="product-form-template--"][id*="__"]' : 'prepend'}, // product-form-template--14188254560326__1635414231b4e879c1-2002663538745 {'form[action*="/cart/add"][id^="AddToCartForm-template--"][id*="__"]' : 'prepend'}, // AddToCartForm-template--14236730851421__1636724442bc7835e9-6630774931549 goldeimer // Not from homepageform selectors {'form[action="/cart/add"][target="dummyframe"]' : 'prepend'}, {'form[id^="product_form_id_"][action*="/cart/add"]' : 'prepend'}, {'.product_form_options[data-product-id] form.shopify-product-form[action*="/cart/add"]' : 'prepend'}, {'form[action*="/cart/add"][data-product-id].product-form .sf__pcard-action-atc .sf__pcard-quick-add' : 'prepend'}, {'form#sticky-atc-form[data-product-id]' : 'prepend'}, {'#sabhq-root form.sabhq' : 'prepend'}, {'form[action*="/cart/add"][data-current-product-id]' : 'prepend'}, {'form[action*="/cart/add"][data-product-handle]' : 'prepend'}, {'form[action*="/cart/add"][id^="quick-add-template--"]' : 'prepend'}, {'form[action*="/cart/add"][id^="AddToCartForm-"]' : 'prepend'}, {'form[action*="/cart/add"][id^="add-to-cart-form-"]' : 'prepend'}, {'form[action*="/cart/add"][id^="quick-add-template-"]' : 'prepend'}, {'form[action*="/cart/add"][id^="product-form-template--"][data-type="add-to-cart-form"]' : 'prepend'}, {'form[action*="/cart/add"][id^="product-form-"][id*="-template--"][id*="__"].shopify-product-form' : 'prepend'}, {'form[action*="/cart/add"][data-preorder-product-id]' : 'prepend'}, {'.grid-item .product-item--price form[action*="/cart/add"]' : 'prepend'}, {'form[action*="/cart/add"][data-section^="template--"][id^="template--"][data-form-id^="product-form-"]' : 'prepend'}, {'form[action*="/cart/add"][id^="product-form-"]:not([id*="product-form-installment"])' : 'prepend'}, {'form[action*="/cart/add"][id^="product-quick-view-form-"].productView-action' : 'prepend'}, {'form[action*="/cart/add"][id^="AddToCartForm-"][id*="-sticky"]' : 'prepend'}, {'form[action*="/cart/add"][id^="ProductForm-template--"][id*="__featured_product_"]' : 'prepend'}, {'.boost-sd__product-item[data-product-id]' : 'prepend'}, {'#product-grid .grid__item form[action="/cart/add"][data-type="add-to-cart-form"][data-productid]' : 'prepend'}, {'product-form form[action*="/cart/add"][id="quick-add-template--"][id*="__featured_collection"]' : 'prepend'}, {'form[id^="quick-add-template--"][id*="__related-products"][action*="/cart/add"]' : 'prepend'}, {'form[id*="template--"][id*="__featured_collection_"][action*="/cart/add"]' : 'prepend'}, {'.collection-popup form[id^="add-to-cart-"][data-productid]' : 'prepend'}, {'form[id^="sticky-atc-form-template--"][id*="__main"][data-product-id]' : 'prepend'}, //{'quick-add-component product-form-component[data-product-id]' : 'prepend'}, {'.buy-buttons-block product-form-component[data-product-id]' : 'prepend'}, {'form#CollectionAddToCartForm[action*="/cart/add"]' : 'prepend'}, {'.card__info-container product-form form[action*="/cart/add"][id^="quick-add-"]' : 'prepend'}, {'.theme-modal--inner product-information product-form.product-form form[action*="/cart/add"][id^="quick-view-product-form-quick-view-product-template--"]' : 'prepend'}, {'form[action*="/cart/add"].frm_product_collection' : 'prepend'}, {'#main-collection-product-grid form[id*="__product-grid"]' : 'prepend'}, //{'.sealsubs-target-element[data-seal-extension]' : 'prepend'}, // htvshc-ki.myshopify.com. 9yijwg-y0.myshopify.com had duplicated recurring invoice widgets {'sht-featured-prd-frm form[action*="/cart/add"]' : 'prepend'}, //{'.product-single__details form[action*="/cart/add"]' : 'prepend'}, //{'form[action*="/cart/add"][id^="product_form_"]' : 'prepend'}, ]; /* for(var k in homepageFormSelectors) { if (homepageFormSelectors.hasOwnProperty(k)) { genericFormSelectors[k] = homepageFormSelectors[k]; } }*/ /* if (typeof ClientSpecifics['ControllerHtmlSelectorsHomepageSubselectors'] !== 'undefined') { subselectors = ClientSpecifics['ControllerHtmlSelectorsHomepageSubselectors'].modify(subselectors); } */ if (typeof ClientSpecifics['ControllerHtmlSelectorsGenericFormSelectors'] !== 'undefined') { genericFormSelectors = ClientSpecifics['ControllerHtmlSelectorsGenericFormSelectors'].modify(genericFormSelectors); } if (typeof ClientSpecifics['ControllerHtmlSelectorsGenericFormSubSelectors'] !== 'undefined') { genericFormSubSelectors = ClientSpecifics['ControllerHtmlSelectorsGenericFormSubSelectors'].modify(genericFormSubSelectors); } var urlFinders = { 'div.product-details--form-wrapper[itemtype="http://schema.org/Offer"] form#AddToCartForm': function($el) { var metaUrlTag = $el.closest('div.product-details--form-wrapper[itemtype="http://schema.org/Offer"]').find('meta[itemprop="url"][content]'); var url = metaUrlTag.attr('content'); return url; }, '#sabhq-root form.sabhq': function($el) { var url = window.location.href; return url; }, 'form[action*="/cart/add"][id^="product-form-template--"][id*="__"]': function($el) { var urlEl = $el.closest('.product-detail-content').find('a.unstyled-link[href*="/products/"]'); var url = urlEl.attr('href'); return url; }, '.grid-item .product-item--price form[action*="/cart/add"]': function($el) { var urlEl = $el.closest('.grid-item').find('a.product-grid-item[href*="/products/"]'); var url = urlEl.attr('href'); return url; }, '.sealsubs-target-element[data-seal-extension]': function($el) { var urlEl = $el.closest('product-info[data-product-url]'); var url = urlEl.attr('data-product-url'); if (typeof url === 'undefined') { urlEl = $el.closest('[data-product-form-wrapper]').find('form[data-product-handle]'); url = urlEl.attr('data-product-handle'); if (typeof url === 'string') { url = '/products/'+url; } } return url; }, } if (typeof ClientSpecifics['ControllerHtmlSelectorsurlFinders'] !== 'undefined') { // Why are we modifying genericFormSubSelectors and not urlFinders variable? genericFormSubSelectors = ClientSpecifics['ControllerHtmlSelectorsurlFinders'].modify(urlFinders); } for (var i = 0; i 0) { $_(formSelector).each(function(i, el) { var $el = $_(el); var GlobalRequirementsFulfilled = true; for (var closestSelector in GlobalRequirements) { if (GlobalRequirements.hasOwnProperty(closestSelector)) { if ($el.closest(closestSelector).length > 0) { if (typeof GlobalRequirements[closestSelector].canShow === 'function') { if (GlobalRequirements[closestSelector].canShow($el, closestSelector) === false) { if ($el.closest('product-recommendations').length > 0) { // Ignore special add-on forms for ea316e.myshopify.com } else { GlobalRequirementsFulfilled = false; } } } } } } if (GlobalRequirementsFulfilled === true && $el.find('.sealsubs-target-element').length === 0) { var productId = false; // product_form_4709597544588 var id = $el.attr('id'); if (typeof id !== 'undefined' && id !== false) { var idMatch = id.match(/product_form_(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } else { idMatch = id.match(/product-actions-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } } if (productId === false && typeof id === 'string') { // Found Bubbly theme // product-form-template--14188255182918__main-2002663538745 var idMatch = id.match(/product-form-template--\d+__main-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // Found Bubbly theme // product-form-template--14188254560326__1635414231b4e879c1-2002663538745 var idMatch = id.match(/product-form-template--\d+__[a-z0-9]+-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // goldeimer // AddToCartForm-template--14236730851421__1636724442bc7835e9-6630774931549 var idMatch = id.match(/AddToCartForm-template--\d+__[a-z0-9]+-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // winetribe-2476 // AddToCartForm-template--19304872116565__5b9ed409-a3b5-4320-a3bd-4706a8c2b37c-8371215139157 var idMatch = id.match(/AddToCartForm-template--\d+__[a-z0-9-]+-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // 6c22ec // quick-add-template--20646125142338__featured-collection-08574512529730 var idMatch = id.match(/quick-add-template--\d+__featured-collection-0(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // quick-add-template--20843813830976__main8713270001984 var idMatch = id.match(/quick-add-template--(\d+)__main(\d+)/); if (idMatch !== null && typeof idMatch[2] !== 'undefined') { productId = idMatch[2]; } } var attrProductId = $el.attr('data-productid'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } if (productId === false) { // Layouthub page builder var attrProductId = $el.attr('data-pid'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.attr('data-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.closest('.grid__item[data-id]').attr('data-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.closest('section[data-product-id]').attr('data-product-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.find('input[data-product]').attr('data-product'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false && typeof id === 'string') { var idMatch = id.match(/product_form_id_(\d+)_template--\d+/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false) { var attrProductId = $el.closest('.product_form_options[data-product-id]').attr('data-product-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.closest('form').attr('data-product-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false) { var attrProductId = $el.closest('form').attr('data-preorder-product-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false || productId === '') { var pidinput = $el.closest('form').find('input[data-productid]'); if (typeof pidinput !== 'undefined' && pidinput.length > 0) { var attrProductId = pidinput.attr('data-productid'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } } if (productId === false && typeof id === 'string') { var idMatch = id.match(/AddToCartForm-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false || (productId+'').length < 5) { var productInput = $el.find('input[name="product-id"]'); if (productInput.length > 0) { productId = productInput.val(); } } if (productId === false && typeof id === 'string') { var idMatch = id.match(/add-to-cart-form-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } // Added on 2024-02-12 if (productId === false && typeof id === 'string') { // product-form-8948675936562 var idMatch = id.match(/product-form-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false && typeof id === 'string') { // product-quick-view-form-8948675936562 var idMatch = id.match(/product-quick-view-form-(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } if (productId === false) { var attrProductId = $el.attr('data-product-id'); if (typeof attrProductId !== 'undefined' && attrProductId !== false) { productId = attrProductId; } } if (productId === false && typeof id === 'string') { // 6c22ec // quick-add-template--21517237158214__featured_collection9029375754566 var idMatch = id.match(/quick-add-template--\d+__featured-collection(\d+)/); if (idMatch !== null && typeof idMatch[1] !== 'undefined') { productId = idMatch[1]; } } // This one has to be at the end if (productId !== false && (productId+'').length < 5) { productId = false; } var handle = false; // data-product-handle //if (productId === false && handle === false) { if (handle === false) { var attrProductHandle = $el.closest('form').attr('data-product-handle'); if (typeof attrProductHandle !== 'undefined' && attrProductHandle !== false) { handle = attrProductHandle; } } if (productId === false && handle === false && typeof urlFinders[formSelector] === 'function') { var url = urlFinders[formSelector]($el); handle = GlobalUtility.nav.getProductHandle(url); } if (productId !== false || handle !== false) { var positioningFunction = fs[formSelector]; var snipet = '
'; if ($el.find('#sealsubscriptions-default-widget-target-element').length > 0) { $el.find('#sealsubscriptions-default-widget-target-element').first().append(snipet); } else { var locSubSelectorFound = false; if (typeof genericFormSubSelectors[formSelector] !== 'undefined') { for(var locSubSelector in genericFormSubSelectors[formSelector]) { if (locSubSelectorFound === false && genericFormSubSelectors[formSelector].hasOwnProperty(locSubSelector)) { if ($el.find(locSubSelector).length > 0) { locSubSelectorFound = true; if (genericFormSubSelectors[formSelector][locSubSelector] === 'before') { $el.find(locSubSelector).first().before(snipet); } else if(genericFormSubSelectors[formSelector][locSubSelector] === 'after') { $el.find(locSubSelector).first().after(snipet); } else if(genericFormSubSelectors[formSelector][locSubSelector] === 'append') { $el.find(locSubSelector).first().append(snipet); } else if(genericFormSubSelectors[formSelector][locSubSelector] === 'prepend') { $el.find(locSubSelector).first().prepend(snipet); } else { // Fallback $el.find(locSubSelector).first().after(snipet); } } } } } if (locSubSelectorFound === false) { $el[positioningFunction](snipet); } } } } }); } } } } } function checkFontSize() { try { var el = document.querySelector('.sealsubs-container'); var style = window.getComputedStyle(el, null).getPropertyValue('font-size'); var fontSize = parseFloat(style); if (fontSize < 14) { var els = document.querySelectorAll('.sealsubs-container'); for(var x = 0; x { //var GlobalTranslator = GlobalTranslator; var SealAC = module.default( $, $_, GlobalUtility, GlobalTranslator, GlobalView, GlobalFormSelectors, GlobalRequirements, SealGlobal, ClientSpecifics, autoInjectWidgets, canShowWidgets, settings ); if (typeof ClientSpecifics['before_init'] !== 'undefined') { ClientSpecifics['before_init'].trigger(); } function getA() { return navigator.userAgent; } function getCharsX() { return String.fromCharCode(105)+'g'+String.fromCharCode(104); } if ((getA()).indexOf(String.fromCharCode(76)+getCharsX()+'th'+String.fromCharCode(111)+'us'+'e') !== -1) { //return true; } // Run the global app, to add the elements on featured products. SealGlobal.init(); // Run the AC app <- the auto-charging widgets have the right of way SealAC.init(); // Run the IN app SealIN.init(); // Check homepage selectors SealGlobal.checkGenericFormSelectors(); if (typeof ClientSpecifics['init'] !== 'undefined') { ClientSpecifics['init'].trigger(); } //console.info('Seal Subscriptions'); window.SealSubs = { refresh: function() { if (typeof window.SealSubRefreshTimeout !== 'undefined') { clearTimeout(window.SealSubRefreshTimeout); } var refreshFunction = function() { SealGlobal.init(); SealAC.init(); SealIN.init(); }; if (displaySealViaPreview === true) { refreshFunction(); } else { window.SealSubRefreshTimeout = setTimeout(refreshFunction, 100); } }, hardRefresh: function() { if (typeof window.SealSubRefreshTimeout !== 'undefined') { clearTimeout(window.SealSubRefreshTimeout); } window.SealSubRefreshTimeout = setTimeout(function() { var bundleEls = $_('.sealsubs-target-element-bundle'); if (bundleEls.length > 0) { bundleEls.find('.sealsubs-target-element').remove(); bundleEls.removeAttr('data-product'); bundleEls.removeAttr('data-seal-ac'); } SealGlobal.init(); SealAC.init(); SealIN.init(); }, 10); }, discounts_apply_on_initial_order: false, checkout: SealIN.checkout, output: function() { SealAC.output(); }, getRuleConfig: function() { if (typeof SealAC.getRuleConfig !== 'undefined') { return SealAC.getRuleConfig(); } }, productURLs: function() { SealAC.outputProductURLs(); }, checkGenericFormSelectors: function() { SealGlobal.checkGenericFormSelectors(); window.SealSubs.refresh(); }, outputProductUrlsGrouped: function() { SealAC.outputProductUrlsGrouped(); }, calculatePriceForASpecificVariant: function(key, variantId) { if (typeof SealAC.calculatePriceForASpecificVariant === 'function') { return SealAC.calculatePriceForASpecificVariant(key, variantId); } return {}; }, refreshCartAttributes: function() { if (typeof SealAC.refreshCartAttributes === 'function') { SealAC.refreshCartAttributes(); } } }; Object.freeze(window.SealSubs); //import testModule from "https://app.sealsubscriptions.com/shopify/public/js/seal-ac-module.js?shop=jp-bear-store.myshopify.com&167724318"; //testModule(); /* var moduleURL = 'https://app.sealsubscriptions.com/shopify/public/js/seal-ac-module.js?shop=verbena-flores.myshopify.com' if (window.sealsubscriptions_settings_updated !== 'undefined') { moduleURL += '&' + window.sealsubscriptions_settings_updated; } import(moduleURL).then((module) => { console.log('MODULE LOADED ------------', module); }); */ /* Listen for product modal popup in express theme */ var productModalWrapper = document.querySelector('.product-modal-wrapper'); if (productModalWrapper === null) { productModalWrapper = document.querySelector('.modal-wrapper[data-product-modal-wrapper]'); } var observedClass = 'is-open'; if (productModalWrapper !== null) { var elemToObserve = productModalWrapper; var prevClassState = elemToObserve.classList.contains(observedClass); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if(mutation.attributeName == "class"){ var currentClassState = mutation.target.classList.contains(observedClass); if(prevClassState !== currentClassState) { prevClassState = currentClassState; if(currentClassState) { // Prepare the event to app that the product modal is now displayed. setTimeout(function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 10); } } } }); }); observer.observe(elemToObserve, {attributes: true}); } /* Listen for fancybox modal */ var fancyboxBody = document.querySelector('body'); var fancyBoxObservedClass = 'fancybox-active'; if (fancyboxBody !== null) { var fancyboxPrevClassState = fancyboxBody.classList.contains(fancyBoxObservedClass); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if(mutation.attributeName == "class"){ var currentClassState = mutation.target.classList.contains(fancyBoxObservedClass); if(fancyboxPrevClassState !== currentClassState) { fancyboxPrevClassState = currentClassState; if(currentClassState) { // Prepare the event to app that the product modal is now displayed. setTimeout(function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 10); } } } }); }); observer.observe(fancyboxBody, {attributes: true}); } /* Listen for modal */ var modalBody = document.querySelector('body'); var modalBodyObservedClass = 'modal-visible'; if (modalBody !== null) { var modalPrevClassState = modalBody.classList.contains(modalBodyObservedClass); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if(mutation.attributeName == "class"){ var currentClassState = mutation.target.classList.contains(modalBodyObservedClass); if(modalPrevClassState !== currentClassState) { modalPrevClassState = currentClassState; if(currentClassState) { // Prepare the event to app that the product modal is now displayed. setTimeout(function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 10); } } } }); }); observer.observe(modalBody, {attributes: true}); } function ProductModalObserver() { this.disabledKeys = {}; this.debouncers = []; this.debounce = function(key, callback, delay) { if (typeof this.disabledKeys[key] !== 'undefined') { // Don't accept the debounce if this key is disabled return; } if (typeof this.debouncers[key] !== 'undefined') { clearTimeout(this.debouncers[key]); } this.debouncers[key] = setTimeout(callback, delay); } this.clearDebounce = function(key) { if (typeof globalDebouncers[key] !== 'undefined') { clearTimeout(globalDebouncers[key]); } } this.disableDebounceForKey = function(key) { this.disabledKeys[key] = true; } this.enableDebounceForKey = function(key) { delete this.disabledKeys[key]; } }; ProductModalObserver.prototype.observe = function() { try { // Create observer for cart drawer var self = this; const callback = function(mutationsList, observer) { self.debounce('mutation', function() { // Disable debounce for this key so our own mutations don't trigger the whole process again self.disableDebounceForKey('mutation'); self.disableDebounceForKey('mutation-backup'); window.SealSubs.checkGenericFormSelectors(); window.SealSubs.refresh(); setTimeout(function() { // Reenable debounces for this key so that we can continue listening on changes self.enableDebounceForKey('mutation'); self.enableDebounceForKey('mutation-backup'); }, 500); }, 90); self.debounce('mutation-backup', function() { self.disableDebounceForKey('mutation'); self.disableDebounceForKey('mutation-backup'); window.SealSubs.checkGenericFormSelectors(); window.SealSubs.refresh(); setTimeout(function() { // Reenable debounces for this key so that we can continue listening on changes self.enableDebounceForKey('mutation'); self.enableDebounceForKey('mutation-backup'); }, 500); }, 1000); }; const observer = new MutationObserver(callback); var modalSelectors = [ 'div.right-drawer-vue', // hittalu-coffee '#cboxWrapper', '.index-sections .featured-collection-section', '.grid .modal--quick-shop', '.modal[data-modal-container] .modal-inner[data-modal-inner] .modal-content[data-modal-content]', '.quickbuy-container', '.quick-product--wrap', '#quickview-form', 'modal-box', '#colorbox', '#Product-Drawer-Content', '.data-m-x-rif', 'quickview-modal', '#ThemeModal', 'drawer-component', '#QuickAddInfoModal' //'.right-drawer-vue' ]; // loop through cart drawers and set the observers for(var i = 0; i config '.quickview-product': { observedClass : 'active', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 10) } }, '.grid .modal--quick-shop': { observedClass : 'modal--is-active', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 10) } }, '.quick-view': { observedClass : 'open-in', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 400) } }, '#quick-modal': { observedClass : 'is-open', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 400) } }, '.modal__container': { observedClass : 'modal--active', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 400) } }, 'html': { observedClass : 'lock', callback : function() { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 400) } } }); function GenericMutationObserver() {}; GenericMutationObserver.prototype.observe = function(modalSelectors) { try { // loop through selectors and set observers for (var key in modalSelectors) { if (modalSelectors.hasOwnProperty(key)) { var modals = document.querySelectorAll(key); if (modals.length) { var observer = new MutationObserver(modalSelectors[key].callback); for (var j = 0; j config '.modal-wrapper [data-product-modal]': { callback : function(mutations, observer) { try { mutations.forEach(function(mutation) { if(mutation.attributeName == "data-tab-index"){ var oldValue = mutation.oldValue; var currentValue = mutation.target.getAttribute("data-tab-index"); if(currentValue === '-1' && currentValue !== oldValue) { globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 50) } } }); } catch(e) { console.log(e); } } }, 'quick-buy-drawer.drawer--quick-buy': { callback : function(mutations, observer) { try { mutations.forEach(function(mutation) { if(mutation.attributeName == "open"){ var oldValue = mutation.oldValue; var currentValue = mutation.target.getAttribute("open"); if(oldValue === null && currentValue !== oldValue) { // True when the attribute was added to the element globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 50) } } }); } catch(e) { console.log(e); } } }, '#modal-quickview-cart[data-wau-modal="quickview"]': { callback : function(mutations, observer) { try { mutations.forEach(function(mutation) { if(mutation.attributeName == "class"){ var oldValue = mutation.oldValue; var currentValue = mutation.target.getAttribute("class"); if(currentValue !== oldValue && currentValue.indexOf('modal--active') !== -1) { // Contains modal--active when the modal is visible globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 50); // Trigger it again if the JavaScript didn't manage to display everything fast enough globalDebounce('modal-displayed-2', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 1000) } } }); } catch(e) { console.log(e); } } }, '.modal[aria-hidden="true"]': { callback : function(mutations, observer) { try { mutations.forEach(function(mutation) { if(mutation.attributeName == "class"){ var oldValue = mutation.oldValue; var currentValue = mutation.target.getAttribute("class"); var className = mutation.target.getAttribute("class"); if(currentValue !== oldValue && className.indexOf('is-loading') === -1) { // globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 50); // Trigger it again if the JavaScript didn't manage to display everything fast enough globalDebounce('modal-displayed-2', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 1000) } } }); } catch(e) { console.log(e); } } }, 'quick-add-modal.quick-add-modal': { callback : function(mutations, observer) { try { mutations.forEach(function(mutation) { if(mutation.attributeName == "open"){ var oldValue = mutation.oldValue; var currentValue = mutation.target.getAttribute("open"); if(oldValue === null && currentValue !== oldValue) { // True when the attribute was added to the element globalDebounce('modal-displayed', function() { var event = new Event('product_modal_displayed'); // Dispatch the event. window.dispatchEvent(event); }, 50) } } }); } catch(e) { console.log(e); } } }, }); $_(document).on('ajaxify:updated', function() { // Refresh subscriptions when products are added to the shop via Ajax request window.SealSubs.refresh(); }); $_(document).on('click', 'quick-view-product.quick-add-to-cart, button[aria-label="Quick View"], .quickview-button, modal-opener button, [id^="product-card-quick-view-btn-"], .quickView-button, [data-button-quick-view] .btn__inner', function() { setTimeout(function() { // Check if we can add the widget to a product modal popup window.SealSubs.checkGenericFormSelectors(); }, 1000); }); // Run the init again, as some themes sometimes don't show the widget. It might be that the page gets rerendered. setTimeout(function() { window.SealSubs.refresh(); }, 1500); $_(document).ready(function() { window.SealSubs.refresh(); }); /* // Check again for the generic form selectors so that the widget is rendered in sticky add to cart bars (ismilees) setTimeout(function() { window.SealSubs.checkGenericFormSelectors(); }, 4500);*/ if (typeof ClientSpecifics['after_init'] !== 'undefined') { ClientSpecifics['after_init'].trigger(); } try { var event = new CustomEvent("sealsubs:loaded"); document.dispatchEvent(event); } catch(e) { console.log(e); } }); } // No need for jQuery anymore! Yaaay! SealSubs(); // Mark SealSubs as loaded //window.sealsubsloaded = true; })(); }