/*==============================================================================
idem subscribe_it_js_tae.ftl but version used fot theme app extension
# WARNING: This file is auto-generated and any changes that are made may be lost.
==============================================================================*/
//V2.0
(function() {
var head = document.getElementsByTagName('head')[0];
var startingTime = new Date().getTime();
if (typeof jQuery == 'undefined') {
var jQueryScript = document.createElement('script');
jQueryScript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js';
jQueryScript.type = 'text/javascript';
head.appendChild(jQueryScript);
}
if (typeof Mustache == 'undefined') {
var mustacheScript = document.createElement('script');
mustacheScript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mustache.js/3.1.0/mustache.js';
mustacheScript.type = 'text/javascript';
head.appendChild(mustacheScript);
}
if (window.location.search.indexOf('selector_section_mode') > -1) {
var script = document.createElement('script');
window.selector_section_mode = true;
script.src =
('https:' == document.location.protocol ? 'https://' : 'http://') + 'back-in-stock.appikon.com/theme-settings/element-selector.js';
script.type = 'text/javascript';
head.appendChild(script);
}
// Poll for jQuery to come into existance
var checkReady = function(callback) {
if (window.jQuery) {
callback(jQuery);
} else {
window.setTimeout(function() {
checkReady(callback);
}, 20);
}
};
// Start polling...
checkReady(function($) {
$(function() {
var endingTime = new Date().getTime();
var tookTime = endingTime - startingTime;
console.log('BIS - Theme app extension loaded');
console.log('jQuery is loaded, after ' + tookTime + ' milliseconds!');
});
});
})();
function deferJquery(method) {
if (window.jQuery) method();
else
setTimeout(function() {
deferJquery(method);
}, 50);
}
function deferBisProductPageButton(callback) {
if (jQuery('#SI_trigger').length) {
callback();
} else {
setTimeout(function() {
deferBisProductPageButton(callback);
}, 50);
}
}
function getRandomSubscribeAPIPath() {
const apiGatewayPaths = [];
apiGatewayPaths.push('xsy6rdr4zb'); //Load balancer
//apiGatewayPaths.push('pw4ndd3ije')
//apiGatewayPaths.push('056wq1p6oa')
//apiGatewayPaths.push('obx6oifedg')
//apiGatewayPaths.push('seknvpr88e')
return apiGatewayPaths[Math.floor(Math.random() * apiGatewayPaths.length)];
}
(async function() {
await new Promise(resolve => setTimeout(resolve, 1000)); // 1000 ms delay to load all the page before inserting button
var popupFormTemplate = `
{{#show_phone_number_field}}
{{/show_phone_number_field}}
{{{headline}}}
{{{body_copy}}}
{{{product.title}}}
{{{footer_copy}}}
{{#madeby_link_visible}}
Powered by Back In Stock (by Appikon)
{{/madeby_link_visible}}
{{{ content_for_body}}}
`;
var cssReset =
'.si-reset>div{font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;font-size-adjust:none;font-size:100%;font-style:normal;letter-spacing:normal;font-stretch:normal;font-variant:normal;font-weight:normal;font:normal normal 100% "Helvetica Neue", Helvetica, Arial, sans-serif;text-align:left;text-align-last:start;text-decoration:none;text-emphasis:none;text-height:auto;text-indent:0;text-justify:auto;text-outline:none;text-shadow:none;text-transform:none;text-wrap:normal;alignment-adjust:auto;alignment-baseline:baseline;-webkit-animation:none 0 ease 0 1 normal;-moz-animation:none 0 ease 0 1 normal;-ms-animation:none 0 ease 0 1 normal;animation:none 0 ease 0 1 normal;-webkit-animation-play-state:running;-moz-play-state:running;-ms-animation-play-state:running;animation-play-state:running;appearance:normal;azimuth:center;backface-visibility:visible;background:none 0 0 auto repeat scroll padding-box transparent;background-color:transparent;background-image:none;baseline-shift:baseline;binding:none;bleed:6pt;bookmark-label:content();bookmark-level:none;bookmark-state:open;bookmark-target:none;border:0 none transparent;border-radius:0;bottom:auto;box-align:stretch;box-decoration-break:slice;box-direction:normal;box-flex:0.0;box-flex-group:1;box-lines:single;box-ordinal-group:1;box-orient:inline-axis;box-pack:start;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;break-after:auto;break-before:auto;break-inside:auto;caption-side:top;clear:none;clip:auto;color:inherit;color-profile:auto;-webkit-column-count:auto;-webkit-column-fill:balance;-webkit-column-gap:normal;-webkit-column-rule:medium medium #1f1f1f;-webkit-column-span:1;-webkit-column-width:auto;-webkit-columns:auto auto;-moz-column-count:auto;-moz-column-fill:balance;-moz-column-gap:normal;-moz-column-rule:medium medium #1f1f1f;-moz-column-span:1;-moz-column-width:auto;-moz-columns:auto auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium medium #1f1f1f;column-span:1;column-width:auto;columns:auto auto;content:normal;counter-increment:none;counter-reset:none;crop:auto;cursor:auto;direction:ltr;display:inline;dominant-baseline:auto;drop-initial-after-adjust:text-after-edge;drop-initial-after-align:baseline;drop-initial-before-adjust:text-before-edge;drop-initial-before-align:caps-height;drop-initial-size:auto;drop-initial-value:initial;elevation:level;empty-cells:show;fit:fill;fit-position:0% 0%;float:none;float-offset:0 0;grid-columns:none;grid-rows:none;hanging-punctuation:none;height:auto;hyphenate-after:auto;hyphenate-before:auto;hyphenate-character:auto;hyphenate-lines:no-limit;hyphenate-resource:none;hyphens:manual;icon:auto;image-orientation:auto;image-rendering:auto;image-resolution:normal;inline-box-align:last;left:auto;line-height:inherit;line-stacking:inline-line-height exclude-ruby consider-shifts;list-style:disc outside none;margin:0;marks:none;marquee-direction:forward;marquee-loop:1;marquee-play-count:1;marquee-speed:normal;marquee-style:scroll;max-height:none;max-width:none;min-height:0;min-width:0;move-to:normal;nav-down:auto;nav-index:auto;nav-left:auto;nav-right:auto;nav-up:auto;opacity:1;orphans:2;outline:invert none medium;outline-offset:0;overflow:visible;overflow-style:auto;padding:0;page:auto;page-break-after:auto;page-break-before:auto;page-break-inside:auto;page-policy:start;perspective:none;perspective-origin:50% 50%;position:static;presentation-level:0;punctuation-trim:none;quotes:none;rendering-intent:auto;resize:none;right:auto;rotation:0;rotation-point:50% 50%;ruby-align:auto;ruby-overhang:none;ruby-position:before;ruby-span:none;size:auto;string-set:none;table-layout:auto;top:auto;-webkit-transform:none;-moz-transform:none;transform:none;-webkit-transform-origin:50% 50%;-moz-transform-origin:50% 50%;-o-transform-origin:50% 50%;transform-origin:50% 50% 0;transform-style:flat;-webkit-transition:all 0 ease 0;-moz-transition:all 0 ease 0;-o-transition:all 0 ease 0;transition:all 0 ease 0;unicode-bidi:normal;vertical-align:baseline;white-space:normal;white-space-collapse:collapse;widows:2;width:auto;word-break:normal;word-spacing:normal;word-wrap:normal;z-index:auto;text-align:start;-ms-filter:"progid:DXImageTransform.Microsoft.gradient(enabled=false)";filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.si-reset{z-index:999999}.si-reset div{display:block}.si-reset .si-button{cursor:pointer;text-shadow:1px 1px 0 rgba(0,0,0,0.2);-webkit-font-smoothing:subpixel-antialiased;-moz-osx-font-smoothing:none}.si-reset.si-edge-left,.si-reset.si-edge-right{transform-origin:left bottom;white-space:nowrap;position:fixed}.si-reset.si-edge-left{left:0}.si-reset.si-edge-right{right:0}.si-reset.si-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-webkit-transform-origin:left bottom;-moz-transform:rotate(90deg);-moz-transform-origin:left bottom;-ms-transform:rotate(90deg);-ms-transform-origin:left bottom;-o-transform:rotate(90deg);-o-transform-origin:left bottom;transform:rotate(90deg)}.si-reset.si-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-webkit-transform-origin:100% 100%;-moz-transform:rotate(270deg);-moz-transform-origin:100% 100%;-ms-transform:rotate(270deg);-ms-transform-origin:100% 100%;-o-transform:rotate(270deg);-o-transform-origin:100% 100%;transform:rotate(270deg)}.si-reset.si-edge-bottom{position:fixed;bottom:0}.si-reset img{display:block;cursor:pointer}.si-reset.preview{position:absolute !important}.si-reset .si-button.with-si-image{-webkit-transform:none;-moz-transform:none;-ms-transform:none;-o-transform:none;transform:none;-ms-filter:none;filter:none}\n';
function loadScript(t, e, n) {
var i = (e = void 0 !== e ? e : document).getElementsByTagName('head')[0],
r = e.createElement('script');
(r.type = 'text/javascript'), (r.src = t), (r.onreadystatechange = n), (r.onload = n), i.appendChild(r);
}
!(function(t, e) {
'object' == typeof exports && exports && 'string' != typeof exports.nodeName
? e(exports)
: 'function' == typeof define && define.amd
? define(['exports'], e)
: ((t.Mustache = {}), e(t.Mustache));
})(this, function(t) {
function e(t) {
return 'function' == typeof t;
}
function n(t) {
return m(t) ? 'array' : typeof t;
}
function i(t) {
return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&');
}
function r(t, e) {
return null != t && 'object' == typeof t && e in t;
}
function o(t, e) {
return null != t && 'object' != typeof t && t.hasOwnProperty && t.hasOwnProperty(e);
}
function s(t, e) {
return v.call(t, e);
}
function a(t) {
return !s(y, t);
}
function u(t) {
return String(t).replace(/[&<>"'`=\/]/g, function(t) {
return S[t];
});
}
function l(e, n) {
function r() {
if (v && !y) for (; g.length; ) delete f[g.pop()];
else g = [];
(v = !1), (y = !1);
}
function o(t) {
if (('string' == typeof t && (t = t.split(b, 2)), !m(t) || 2 !== t.length)) throw new Error('Invalid tags: ' + t);
(s = new RegExp(i(t[0]) + '\\s*')), (u = new RegExp('\\s*' + i(t[1]))), (l = new RegExp('\\s*' + i('}' + t[1])));
}
if (!e) return [];
var s,
u,
l,
d = [],
f = [],
g = [],
v = !1,
y = !1;
o(n || t.tags);
for (var S, k, E, C, x, P, T = new p(e); !T.eos(); ) {
if (((S = T.pos), (E = T.scanUntil(s))))
for (var N = 0, D = E.length; N < D; ++N)
a((C = E.charAt(N))) ? g.push(f.length) : (y = !0), f.push(['text', C, S, S + 1]), (S += 1), '\n' === C && r();
if (!T.scan(s)) break;
if (
((v = !0),
(k = T.scan(w) || 'name'),
T.scan(_),
'=' === k
? ((E = T.scanUntil(I)), T.scan(I), T.scanUntil(u))
: '{' === k
? ((E = T.scanUntil(l)), T.scan(B), T.scanUntil(u), (k = '&'))
: (E = T.scanUntil(u)),
!T.scan(u))
)
throw new Error('Unclosed tag at ' + T.pos);
if (((x = [k, E, S, T.pos]), f.push(x), '#' === k || '^' === k)) d.push(x);
else if ('/' === k) {
if (!(P = d.pop())) throw new Error('Unopened section "' + E + '" at ' + S);
if (P[1] !== E) throw new Error('Unclosed section "' + P[1] + '" at ' + S);
} else 'name' === k || '{' === k || '&' === k ? (y = !0) : '=' === k && o(E);
}
if ((P = d.pop())) throw new Error('Unclosed section "' + P[1] + '" at ' + T.pos);
return h(c(f));
}
function c(t) {
for (var e, n, i = [], r = 0, o = t.length; r < o; ++r)
(e = t[r]) && ('text' === e[0] && n && 'text' === n[0] ? ((n[1] += e[1]), (n[3] = e[3])) : (i.push(e), (n = e)));
return i;
}
function h(t) {
for (var e, n = [], i = n, r = [], o = 0, s = t.length; o < s; ++o)
switch ((e = t[o])[0]) {
case '#':
case '^':
i.push(e), r.push(e), (i = e[4] = []);
break;
case '/':
(r.pop()[5] = e[2]), (i = r.length > 0 ? r[r.length - 1][4] : n);
break;
default:
i.push(e);
}
return n;
}
function p(t) {
(this.string = t), (this.tail = t), (this.pos = 0);
}
function d(t, e) {
(this.view = t),
(this.cache = {
'.': this.view
}),
(this.parent = e);
}
function f() {
this.cache = {};
}
var g = Object.prototype.toString,
m =
Array.isArray ||
function(t) {
return '[object Array]' === g.call(t);
},
v = RegExp.prototype.test,
y = /\S/,
S = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'/': '/',
'`': '`',
'=': '='
},
_ = /\s*/,
b = /\s+/,
I = /\s*=/,
B = /\s*\}/,
w = /#|\^|\/|>|\{|&|=|!/;
(p.prototype.eos = function() {
return '' === this.tail;
}),
(p.prototype.scan = function(t) {
var e = this.tail.match(t);
if (!e || 0 !== e.index) return '';
var n = e[0];
return (this.tail = this.tail.substring(n.length)), (this.pos += n.length), n;
}),
(p.prototype.scanUntil = function(t) {
var e,
n = this.tail.search(t);
switch (n) {
case -1:
(e = this.tail), (this.tail = '');
break;
case 0:
e = '';
break;
default:
(e = this.tail.substring(0, n)), (this.tail = this.tail.substring(n));
}
return (this.pos += e.length), e;
}),
(d.prototype.push = function(t) {
return new d(t, this);
}),
(d.prototype.lookup = function(t) {
var n,
i = this.cache;
if (i.hasOwnProperty(t)) n = i[t];
else {
for (var s, a, u, l = this, c = !1; l; ) {
if (t.indexOf('.') > 0)
for (s = l.view, a = t.split('.'), u = 0; null != s && u < a.length; )
u === a.length - 1 && (c = r(s, a[u]) || o(s, a[u])), (s = s[a[u++]]);
else (s = l.view[t]), (c = r(l.view, t));
if (c) {
n = s;
break;
}
l = l.parent;
}
i[t] = n;
}
return e(n) && (n = n.call(this.view)), n;
}),
(f.prototype.clearCache = function() {
this.cache = {};
}),
(f.prototype.parse = function(e, n) {
var i = this.cache,
r = e + ':' + (n || t.tags).join(':'),
o = i[r];
return null == o && (o = i[r] = l(e, n)), o;
}),
(f.prototype.render = function(t, e, n, i) {
var r = this.parse(t, i),
o = e instanceof d ? e : new d(e);
return this.renderTokens(r, o, n, t, i);
}),
(f.prototype.renderTokens = function(t, e, n, i, r) {
for (var o, s, a, u = '', l = 0, c = t.length; l < c; ++l)
(a = undefined),
'#' === (s = (o = t[l])[0])
? (a = this.renderSection(o, e, n, i))
: '^' === s
? (a = this.renderInverted(o, e, n, i))
: '>' === s
? (a = this.renderPartial(o, e, n, r))
: '&' === s
? (a = this.unescapedValue(o, e))
: 'name' === s
? (a = this.escapedValue(o, e))
: 'text' === s && (a = this.rawValue(o)),
a !== undefined && (u += a);
return u;
}),
(f.prototype.renderSection = function(t, n, i, r) {
function o(t) {
return s.render(t, n, i);
}
var s = this,
a = '',
u = n.lookup(t[1]);
if (u) {
if (m(u)) for (var l = 0, c = u.length; l < c; ++l) a += this.renderTokens(t[4], n.push(u[l]), i, r);
else if ('object' == typeof u || 'string' == typeof u || 'number' == typeof u) a += this.renderTokens(t[4], n.push(u), i, r);
else if (e(u)) {
if ('string' != typeof r) throw new Error('Cannot use higher-order sections without the original template');
null != (u = u.call(n.view, r.slice(t[3], t[5]), o)) && (a += u);
} else a += this.renderTokens(t[4], n, i, r);
return a;
}
}),
(f.prototype.renderInverted = function(t, e, n, i) {
var r = e.lookup(t[1]);
if (!r || (m(r) && 0 === r.length)) return this.renderTokens(t[4], e, n, i);
}),
(f.prototype.renderPartial = function(t, n, i, r) {
if (i) {
var o = e(i) ? i(t[1]) : i[t[1]];
return null != o ? this.renderTokens(this.parse(o, r), n, i, o) : void 0;
}
}),
(f.prototype.unescapedValue = function(t, e) {
var n = e.lookup(t[1]);
if (null != n) return n;
}),
(f.prototype.escapedValue = function(e, n) {
var i = n.lookup(e[1]);
if (null != i) return t.escape(i);
}),
(f.prototype.rawValue = function(t) {
return t[1];
}),
(t.name = 'mustache.js'),
(t.version = '3.0.1'),
(t.tags = ['{{', '}}']);
var k = new f();
return (
(t.clearCache = function() {
return k.clearCache();
}),
(t.parse = function(t, e) {
return k.parse(t, e);
}),
(t.render = function(t, e, i, r) {
if ('string' != typeof t)
throw new TypeError(
'Invalid template! Template should be a "string" but "' +
n(t) +
'" was given as the first argument for mustache#render(template, view, partials)'
);
return k.render(t, e, i, r);
}),
(t.to_html = function(n, i, r, o) {
var s = t.render(n, i, r);
if (!e(o)) return s;
o(s);
}),
(t.escape = u),
(t.Scanner = p),
(t.Context = d),
(t.Writer = f),
t
);
}),
function() {
var t = [].slice,
e = {}.hasOwnProperty;
this.SI = {
PRODUCT_HANDLE_REGEX: /\/products\/(([a-zA-Z0-9]|[\-\.\_\~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[\ud83c\ud83d\ud83e][\ud000-\udfff]){1,})\/?/,
$: function(t, e) {
var n;
return (
null == e && (e = document),
null == t.nodeType || (3 !== (n = t.nodeType) && 9 !== n)
? e.querySelector
? e.querySelector(t)
: '.' === t[0]
? this.findElmByClassName(t.slice(1), e)[0]
: '#' === t[0]
? e.getElementById(t.slice(1))
: e.getElementById(t)
: t
);
},
findElmByClassName: function(t, e) {
var n, i, r, o, s;
for (s = [], i = 0, r = (o = e.getElementsByTagName('*')).length; i < r; i++) (n = o[i]).className.match(t) && s.push(n);
return s;
},
removeClassName: function(t, e) {
return 'classList' in t
? t.classList.remove(e)
: (t.className = t.className.replace(RegExp('\\b' + class_name + '\\b', 'g'), ''));
},
isVisible: function(t) {
return null != t.offsetParent;
},
extend: function() {
var n, i, r, o, s, a, u;
for (o = arguments[0], n = 0, r = (a = 2 <= arguments.length ? t.call(arguments, 1) : []).length; n < r; n++) {
s = a[n];
for (i in s)
e.call(s, i) &&
((u = s[i]) instanceof Array
? (o[i] = u.slice(0))
: null == o[i] || '[object Object]' !== Object.prototype.toString.call(u)
? (o[i] = u)
: (o[i] = this.extend(o[i], u)));
}
return o;
},
defer: function(t, e) {
return setTimeout(e, t);
},
log: function(t) {
return 'undefined' != typeof console && null !== console && 'function' == typeof console.log
? console.log('[Back in Stock] ' + t)
: void 0;
},
windowSize: function() {
return {
width: window.innerWidth || document.documentElement.clientWidth,
height: window.innerHeight || document.documentElement.clientHeight
};
},
css: function(t, e) {
var n, i;
for (n in e) (i = e[n]), (t.style[n] = i);
return t;
},
injectCSS: function(t) {
var e;
return (
(e = document.createElement('style')),
document.getElementsByTagName('head')[0].appendChild(e),
e.styleSheet ? (e.styleSheet.cssText = t) : e.appendChild(document.createTextNode(t))
);
},
urlIsProductPage: function() {
return null != decodeURIComponent(window.location.pathname).match(this.PRODUCT_HANDLE_REGEX);
},
toQueryString: function(t, e) {
var n, i, r, o;
i = [];
for (n in t)
(o = t[n]),
e && (n = e + '[' + n + ']'),
(r = 'object' == typeof o ? this.toQueryString(o, n) : n + '=' + encodeURIComponent(o)),
i.push(r);
return i.join('&');
},
urlParamsToObject: function() {
var t, e, n, i, r;
for (r = {}, n = 0, i = (e = location.search.substr(1).split('&')).length; n < i; n++) r[(t = e[n].split('='))[0]] = t[1];
return r;
},
urlParam: function(t) {
return this.urlParamsToObject()[t] || null;
},
request: function(t, e) {
var n, i, r, o, s, a;
if (
(null == e && (e = {}),
(o = SI.extend(
{
method: 'GET'
},
e
)),
(a = new XMLHttpRequest()),
(i = new SI.Promise()),
(a.onreadystatechange = function() {
if (4 === a.readyState) return i.resolve(!(200 === a.status), a.responseText);
}),
a.open(o.method, t, !0),
null != e.headers)
) {
r = e.headers;
for (n in r) (s = r[n]), a.setRequestHeader(n, s);
}
return a.send(o.data), i;
},
submitNotificationData: function(url, data) {
var xmlhttp = new XMLHttpRequest();
var i = new SI.Promise();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState === 4) {
//XMLHttpRequest.DONE
if (xmlhttp.status === 200) {
return i.resolve(!(200 === xmlhttp.status), xmlhttp.responseText);
}
}
};
xmlhttp.open('GET', url + '?' + SI.toQueryString(data), true);
xmlhttp.send();
return i;
},
requestJSONP: function(t, e) {
var n, i, r, o;
(o = document.createElement('script')), (i = 'JSONP' + new Date().getTime()), (r = new SI.Promise());
for (n in e) e[n], n + '=' + e;
return (
null == window._SI && (window._SI = {}),
(window._SI[i] = function(t) {
return delete SI[i], r.resolve(t);
}),
(o.src = t + '?callback=_SI.' + i + '&' + SI.toQueryString(e)),
document.getElementsByTagName('head')[0].appendChild(o),
r
);
},
parseJSON: function(t) {
if ('string' == typeof t) {
if (window.JSON && window.JSON.parse) return window.JSON.parse(t);
if (
((t = t.replace(/^\s+|\s+$/g, '')),
!/^[\],:{}\s]*$/.test(
t
.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, '')
))
)
throw 'Invalid JSON';
return new Function('return ' + t)();
}
},
on: function(t, e, n) {
return t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent('on' + e, n);
},
domReady: function() {
var t;
return (
null == this._domReadyPromise &&
((this._domReadyPromise = new SI.Promise()),
'loading' === document.readyState
? document.addEventListener(
'DOMContentLoaded',
((t = this),
function() {
return t._domReadyPromise.resolve(t);
})
)
: this._domReadyPromise.resolve()),
this._domReadyPromise
);
},
preventDefault: function(t) {
return t.preventDefault ? t.preventDefault() : (t.returnValue = !1), t;
},
jsonFromParams: function(t) {
var e, n, i, r, o;
for (o = {}, n = 0, r = (e = t.split('&')).length; n < r; n++) o[(i = e[n].split('='))[0]] = i[1];
return JSON.stringify(o);
},
execute: function(t) {
var e, n, i, r;
try {
return t();
} catch (o) {
return (
(n = o),
(i = SI.Config.app_hostname || 'back-in-stock.appikon.com'),
(r = 'https://' + i + '/events/api'),
(e = {
event: {
message: n.message,
stack: n.stack
}
}),
SI.request(r, {
method: 'POST',
data: SI.toQueryString(e)
})
);
}
},
helpers: {
smallProductImage: function() {
return function(t, e) {
var n;
return e((n = t.split('.')).slice(0, n.length - 1).join('.') + '_small.' + n.slice(-1));
};
}
},
createPopover: function(t) {
var e;
return (
null == t && (t = {}),
(e = SI.extend(SI.Config, 'undefined' != typeof _SIConfig && null !== _SIConfig ? _SIConfig : {}, t)),
new SI.Popover(e)
);
},
genericTriggerHandler: function(t) {
var e, n, i, r, o, s;
if (
null != (o = ((t = t || window.event).target || t.srcElement).className) && 'function' == typeof o.match
? o.match(/SI_trigger/)
: void 0
) {
if (
(SI.preventDefault(t),
(this.popovers = this.popovers || {}),
(r = t.target.getAttribute('data-product-data')),
(s = t.target.getAttribute('data-variant-id')),
r)
)
try {
i = JSON.parse(r);
} catch (a) {
(t = a), SI.log('Could not parse product data: ' + t.message);
}
return (
(e = (null != i ? i.handle : void 0) || t.target.getAttribute('data-product-handle')),
(n =
this.popovers[e] ||
(this.popovers[e] = SI.createPopover({
productHandle: e,
product: i,
button: {
visible: !1
}
}))).ready.then(function() {
return SI.defer(13, function() {
return n.form.show({
variantId: s
});
});
})
);
}
},
create: function(t, e, n, i) {
return (
null == n && (n = ''),
null == i && (i = {}),
null == this._base &&
((this._base = new SI.Base()), (this._base.onError = function() {}), (this._base.onSuccess = function() {})),
this._base.create(t, e, n, i)
);
},
init: function() {
var t;
if (
((t = window._siq || []),
(window._siq = new SI.CmdQueue().push.apply(this, t)),
!0 === SI.Config.generic_trigger_handler && SI.on(document, 'click', SI.genericTriggerHandler),
(window.SIMobiliaForm = SI.MobiliaForm),
SI.urlIsProductPage())
)
return (SI.popup = SI.createPopover()), (window.SIPopover = SI.popup);
}
};
}.call(this),
function() {
var t =
[].indexOf ||
function(t) {
for (var e = 0, n = this.length; e < n; e++) if (e in this && this[e] === t) return e;
return -1;
};
SI.Base = (function() {
function e(t) {
null == t && (t = SI.Config),
(this.settings = SI.extend(
{
position_left: !0,
button_url: '//' + t.app_hostname + '/images/content/notify_btn.png'
},
t
)),
(this._variantsByTitle = {}),
(this._variantsById = {}),
(this.productHandle = this.settings.productHandle),
(this.product = this.settings.product),
(this.ajaxOpts = {
url: 'https://' + t.app_hostname + '/prod/api'
});
}
return (
(e.prototype.variantIsUnavailable = function(e) {
var n;
return (
this.variantSoldOut(e) &&
this.variantMeetsInventoryManagementPolicy(e) &&
this.variantMeetsPreorderPolicy(e) &&
((n = this.settings.hide_for_product_tag), t.call(this.product.tags, n) < 0) &&
this.showForCollections(this.product.collections)
);
}),
(e.prototype.variantSoldOut = function(t) {
1 !== this.settings.instock_qty_level &&
!1 === this.settings.preorder_enabled &&
SI.log('Warning: Show for preorder is off: ignoring custom instock_qty_level setting.');
if (null != t.inventory_quantity) {
return t.inventory_quantity < this.settings.instock_qty_level;
} else {
if (this.settings.preorder_enabled == true) {
return true;
}
//!0 === this.settings.preorder_enabled && SI.log("Warning: inventory_quantity not available but show for preorder is enabled.");
!1 === this.settings.instock_qty_level && SI.log('Warning: instock_qty_level is set but inventory_quantity not available.');
return !1 === t.available;
}
}),
(e.prototype.variantMeetsInventoryManagementPolicy = function(t) {
return !this.settings.require_inventory_management || (t.inventory_management && t.inventory_management.length > 0);
}),
(e.prototype.variantMeetsPreorderPolicy = function(t) {
return !!this.settings.preorder_enabled || !1 === t.available;
}),
(e.prototype.showForCollections = function(t) {
if (t && t.length && this.settings.hide_for_collections) {
for (i = 0; i < t.length; i++) {
if (this.settings.hide_for_collections.indexOf(t[i].id) > -1) {
return false;
}
}
}
return true;
}),
(e.prototype.filterDuplicateSKUs = function(t) {
var e, n, i, r, o, s;
for (
r = {},
o = function(t) {
var e;
return !((null != (e = s.sku) ? e.length : void 0) > 0) || (null == r[t] && (r[t] = 1) && !0);
},
i = [],
e = 0,
n = t.length;
e < n;
e++
)
o((s = t[e]).sku) && i.push(s);
return i;
}),
(e.prototype.getProducts = function() {
var t, e, n, i;
return (
(this.ready = new SI.Promise()),
(n = this),
(t = function() {
if ((n.processProductVariants(n.product), n.variants.length > 0)) return n.ready.resolve(n.variants);
}),
this.product
? t()
: (e = this._productDataURL()) &&
SI.request(e).then(
((i = this),
function(e, n) {
return e ? SI.log('SI.Base: error loading product data (' + n + ')') : ((i.product = SI.parseJSON(n)), t());
})
),
this.ready
);
}),
(e.prototype.processProductVariants = function(t) {
var e, n, i, r, o;
for (e = 0, n = (i = t.variants).length; e < n; e++)
(r = i[e]), (this._variantsByTitle[r.title] = SI.extend({}, r)), (this._variantsById[r.id] = SI.extend({}, r));
if (
((this.variants = function() {
var t, e, n, i;
for (i = [], t = 0, e = (n = this.product.variants).length; t < e; t++)
(o = n[t]), this.variantIsUnavailable(o) && i.push(o);
return i;
}.call(this)),
!0 === this.settings.ignore_duplicate_skus)
)
return (this.variants = this.filterDuplicateSKUs(this.variants));
}),
(e.prototype.create = function(email, e, productId, stockNotificationRequestDetails) {
var finalRequestObj, s;
var mainThis = this;
null == productId && (productId = this.product.id);
null == stockNotificationRequestDetails && (stockNotificationRequestDetails = {});
SI.extend(this.ajaxOpts, {
key: 'callback'
});
var requestObj = {
product_no: productId,
quantity_required: stockNotificationRequestDetails.quantity_required || 1,
accepts_marketing: stockNotificationRequestDetails.accepts_marketing || !1,
customer_utc_offset: 60 * new Date().getTimezoneOffset()
};
if (stockNotificationRequestDetails.customer_name) {
requestObj.customer_name = stockNotificationRequestDetails.customer_name;
}
var variant_title = undefined;
var variant_sku = undefined;
if (this.product !== undefined) {
requestObj['product_title'] = this.product.title;
requestObj['product_vendor'] = this.product.vendor;
requestObj['product_handle'] = this.product.handle;
var variant = this.product.variants.find(variant => {
return variant.id == parseInt(e);
});
variant_title = variant.title;
variant_sku = variant.sku;
}
null != email && (requestObj.email = email);
if (stockNotificationRequestDetails.pushSubscriptionToken) {
requestObj.pushSubscriptionToken = stockNotificationRequestDetails.pushSubscriptionToken;
}
null != stockNotificationRequestDetails.phone_number &&
(requestObj.phone_number = stockNotificationRequestDetails.phone_number);
finalRequestObj = {
shop: this.settings.shop,
notification: requestObj,
variant: {
variant_no: e
}
};
if (variant_title !== undefined) {
finalRequestObj.variant['variant_title'] = variant_title;
}
if (variant_sku !== undefined) {
finalRequestObj.variant['sku'] = variant_sku;
}
null != stockNotificationRequestDetails.recaptcha_response &&
(finalRequestObj.recaptcha_response = stockNotificationRequestDetails.recaptcha_response);
return SI.submitNotificationData(this.ajaxOpts.url, finalRequestObj).then(function(st, resp) {
resp = SI.parseJSON(resp);
return 'OK' === resp.status ? mainThis.onSuccess(resp) : mainThis.onError(resp);
});
}),
(e.prototype._productDataURL = function() {
var t;
if ((t = this.productHandle || this._parseProductHandleFromURL()))
return '//' + window.location.hostname + '/products/' + t + '.js';
}),
(e.prototype._parseProductHandleFromURL = function() {
var t;
return (t = decodeURIComponent(window.location.pathname).match(SI.PRODUCT_HANDLE_REGEX)) && t[1];
}),
e
);
})();
}.call(this),
function() {
var t = function(t, e) {
return function() {
return t.apply(e, arguments);
};
};
SI.CmdQueue = (function() {
function e() {
this.push = t(this.push, this);
}
return (
(e.prototype.push = function() {
var t, e, n;
for (t = 0, n = arguments.length; t < n; t++) 'function' == typeof (e = arguments[t]) && e();
return this;
}),
e
);
})();
}.call(this),
function() {
SI.detectVariant = function(popup) {
var e, n, i, r;
i = SI.urlParam('variant');
if (i) {
return popup._variantsById[i];
} else {
r = (function() {
var t, n, i, r, s;
i = document.querySelectorAll('select.single-option-selector');
s = [];
var singleOptionSelector = SI.$('select.single-option-selector');
if (singleOptionSelector != null && singleOptionSelector.selectedIndex != null && singleOptionSelector.selectedIndex !== -1) {
s.push(singleOptionSelector[singleOptionSelector.selectedIndex].value);
} else {
s.push(void 0);
}
return s;
})();
n = popup._variantsByTitle[r.join(' / ')];
if (n) {
return n;
} else {
if (false === popup.product.available) {
return popup.product.variants[0];
} else {
var variant = SI.Config.product?.selected_or_first_available_variant;
if (variant && variant.inventory_quantity != null) {
if (variant.inventory_quantity < popup.settings.instock_qty_level && popup.settings.preorder_enabled) {
return variant;
} else {
return void 0;
}
} else {
return void 0;
}
}
}
}
};
}.call(this),
function() {
var t = function(t, e) {
return function() {
return t.apply(e, arguments);
};
};
SI.Button = (function() {
function e(e, n) {
var i, r, o, s, a, u, l, c, h, p;
(this.settings = e),
(this.delegate = n),
(this.hide = t(this.hide, this)),
(this.show = t(this.show, this)),
(this.toggle = t(this.toggle, this)),
(this.click = t(this.click, this)),
null == (i = this.settings).caption && (i.caption = 'NOTIFY WHEN AVAILABLE'),
null == (r = this.settings).bold && (r.bold = !0),
null == (o = this.settings).position && (o.position = 'right-top'),
null == (s = this.settings).font_size && (s.font_size = 16),
null == (a = this.settings).background_color && (a.background_color = '#46B941'),
null == (u = this.settings).text_color && (u.text_color = '#FFF'),
null == (l = this.settings).border_color && (l.border_color = '#3DA439'),
null == (c = this.settings).border_width && (c.border_width = 1),
null == (h = this.settings).border_radius && (h.border_radius = 3),
null == (p = this.settings).corner_offset && (p.corner_offset = 100),
(this.ready = new SI.Promise()),
this.render();
}
return (
(e.prototype.render = function() {
var t, e, n, i, r, o;
return (
(i = new SI.Promise()),
(this.wrap = document.createElement('div')),
(t = (n = this.settings.position.split('-'))[0]),
(e = n[1]),
(r = ''),
!1 === this.settings.use_image &&
('left-top' === this.settings.position
? (r = 'si-rotate-90')
: 'right-top' === this.settings.position && (r = 'si-rotate-270')),
(this.wrap.className = 'si-reset si-edge-' + t + ' si-edge-' + e + ' ' + r),
(this.elm = this.settings.use_image ? this.buildImage(i) : this.buildButton(i)),
this.wrap.appendChild(this.elm),
SI.injectCSS(SI.css_reset),
(this.settings.container || document.getElementsByTagName('body')[0]).appendChild(this.wrap),
this.setOffsetPosition(e, r),
SI.on(this.wrap, 'click', this.click),
i.then(
((o = this),
function() {
return o.ready.resolve();
})
)
);
}),
(e.prototype.buildButton = function(t) {
var e, n, i, r;
return (
((n = document.createElement('div')).className = 'si-button SI_trigger'),
'textContent' in n ? (n.textContent = this.settings.caption) : (n.innerText = this.settings.caption),
(e = {
background: this.settings.background_color,
color: this.settings.text_color,
padding: '0.7em 1.3em',
border: 'solid ' + this.settings.border_color,
'font-weight': !0 === this.settings.bold ? 'bold' : void 0,
'font-size': this.settings.font_size + 'px'
}),
(r = this.settings.border_width),
(e['border-width'] = r + 'px ' + r + 'px 0 ' + r + 'px'),
(i = this.settings.border_radius),
(e['border-radius'] = i + 'px ' + i + 'px 0 0'),
SI.css(n, e),
t.resolve(),
n
);
}),
(e.prototype.buildImage = function(t) {
var e;
return (
((e = document.createElement('img')).className = 'si-image SI_trigger'),
(e.src = this.settings.image),
(e.onload = function() {
return t.resolve();
}),
e
);
}),
(e.prototype.setOffsetPosition = function(t, e) {
var n, i;
return (
(i = {}),
(n = this.settings.corner_offset),
'top' === t && !0 === e && (n -= this.elm.offsetHeight),
(i[t] = n + 'px'),
SI.css(this.wrap, i)
);
}),
(e.prototype.click = function(t) {
var e;
return (
(e = this.elm.getAttribute('data-variant-id')),
SI.preventDefault(t),
t.stopPropagation ? t.stopPropagation() : (t.cancelBubble = !0),
this.delegate.isOpen
? this.delegate.hide()
: this.delegate.show({
variantId: e
})
);
}),
(e.prototype.toggle = function(t) {
null == t && (t = this.elm.isOpen);
if (this.settings.always_show_widget) {
this.elm.style.display = 'block';
} else {
this.elm.style.display = t ? 'block' : 'none';
}
return this;
}),
(e.prototype.show = function() {
return this.toggle(!0);
}),
(e.prototype.hide = function() {
return this.toggle(!1);
}),
e
);
})();
}.call(this),
function() {
var t = function(t, e) {
return function() {
return t.apply(e, arguments);
};
},
e = {}.hasOwnProperty;
SI.Form = (function() {
function n(e, n) {
if (typeof jQuery !== 'undefined') {
var iframe = jQuery('#SI_frame');
if (iframe.length !== 0) {
iframe[0].remove();
}
}
var i, r, o, s, a, u, l;
(this.popover = e),
(this.submitButton = t(this.submitButton, this)),
(this.showMessage = t(this.showMessage, this)),
(this.reset = t(this.reset, this)),
(this.toggleComplete = t(this.toggleComplete, this)),
(this.submit = t(this.submit, this)),
(this.hide = t(this.hide, this)),
(this.show = t(this.show, this)),
(this.blurEmailField = t(this.blurEmailField, this)),
(this.focusEmailField = t(this.focusEmailField, this)),
(this.injectCSS = t(this.injectCSS, this)),
(this.isOpen = !1),
(this.pushSubscriptionToken = null),
(i = {
id: 'SI_frame',
frameBorder: 0,
src: 'about:blank',
allowTransparency: !0
}),
(r = {
background: 'none',
position: 'fixed',
width: '100%',
height: '100%',
top: 0,
border: '0',
overflow: 'hidden',
display: 'none'
}),
(s = 999999),
(a = SI.extend({}, r, {
left: 0,
width: '100%',
'z-index': s + 1
})),
(a = SI.extend({}, a, this.popover.settings.iframe_css)),
this.injectCSS(this.renderCSS(i.id, a) + n),
(this.frame = document.createElement('iframe'));
for (o in i) (u = i[o]), this.frame.setAttribute(o, u);
SI.defer(
50,
((l = this),
function() {
var t;
return (
(t = SI.extend(
{
quantity_field_enabled: l.popover.settings.quantity_field_enabled
},
l.popover.settings.labels
)),
l.render(l.popover.product, t)
);
})
),
(this.popover.settings.root || document.getElementsByTagName('body')[0]).appendChild(this.frame);
}
var i, r, o;
n.prototype.renderFinally = function(iframeElem, templateVars, partials) {
var mainThis = this;
iframeElem.open();
iframeElem.write(Mustache.render(popupFormTemplate, templateVars, partials));
iframeElem.close();
SI.on(iframeElem.getElementsByTagName('form')[0], 'submit', this.submit);
iframeElem.getElementById('enable_push_notification') &&
SI.on(iframeElem.getElementById('enable_push_notification'), 'change', function() {
if (this.checked) {
SI.log('checked');
this.checked = false;
var localThis = this;
if (window.pushowl) {
var registerForEvent = pushowl.registerForEvent('back_in_stock', true);
registerForEvent
.then(function(fulfilled) {
SI.log('fullfilled');
localThis.checked = true;
mainThis.pushSubscriptionToken = fulfilled.pushowl_subscriber_token;
SI.log(mainThis.pushSubscriptionToken);
})
.catch(function(error) {
SI.log('failed');
localThis.checked = false;
mainThis.pushSubscriptionToken = null;
SI.log(mainThis.pushSubscriptionToken);
});
}
} else {
SI.log('unchecked');
mainThis.pushSubscriptionToken = null;
}
});
this.backdrop = SI.$('body', iframeElem);
var onClose = function(t) {
if ((t.target || t.srcElement).className.indexOf('action-close') > -1) {
SI.preventDefault(t);
return mainThis.hide();
}
};
SI.on(iframeElem, 'click', onClose);
SI.on(iframeElem, 'touchend', onClose);
if (this.popover.settings.show_phone_number_field) {
var smsSupportDetails = {
preferredCountries: this.popover.settings.preferredCountries,
utilsScript: o
};
return loadScript(r, this.frameDoc(), function() {
return (mainThis.intlTelInput = mainThis.frame.contentWindow.intlTelInput(
mainThis.frameDoc().querySelector('#phone-number input'),
smsSupportDetails
));
});
}
};
return (
(n.prototype.ACTIVE_CLASS_NAME = 'si-popover-active'),
(r = (i = 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input') + '/17.0.5/js/intlTelInput.min.js'),
(o = i + '/16.0.2/js/utils.js'),
(n.prototype.frameDoc = function() {
return this.frame.contentDocument || this.frame.contentWindow.document;
}),
(n.prototype.emailField = function() {
return this.frameDoc().querySelector('#email-address input');
}),
(n.prototype.mobileDevice = function() {
return (
'absolute' ===
('function' == typeof window.getComputedStyle ? window.getComputedStyle(this.frame).getPropertyValue('position') : void 0)
);
}),
(n.prototype.renderCSS = function(t, n) {
var i, r;
return (
'#' +
t +
' { ' +
(function() {
var t;
t = [];
for (i in n) e.call(n, i) && ((r = n[i]), t.push(i + ': ' + r + ';'));
return t;
})().join('\n') +
' }\n'
);
}),
(n.prototype.injectCSS = function(t) {
return (
(this.styleElm = document.createElement('style')),
document.getElementsByTagName('head')[0].appendChild(this.styleElm),
this.styleElm.styleSheet ? (this.styleElm.styleSheet.cssText = t) : this.styleElm.appendChild(document.createTextNode(t)),
this.styleElm
);
}),
(n.prototype.selectVariant = function(t) {
var e, n, i, r, o, s;
if (null != t)
for (t = parseInt(t, 10), e = n = 0, i = (o = (s = SI.$('#variants', this.frameDoc())).options).length; n < i; e = ++n)
if (((r = o[e]), parseInt(r.value, 10) === t)) return (s.selectedIndex = e);
}),
(n.prototype.focusEmailField = function() {
var t, e;
try {
if ((e = this.emailField()) && 'focus' in e) return e.focus();
} catch (n) {
return (t = n), SI.log(null != t ? t.message : void 0);
}
}),
(n.prototype.blurEmailField = function() {
var t, e;
try {
if ((e = this.emailField()) && 'blur' in e) return e.blur();
} catch (n) {
return (t = n), SI.log(null != t ? t.message : void 0);
}
}),
(n.prototype.show = function(t) {
var e;
return (
null == t && (t = {}),
'variantId' in t && this.selectVariant(t.variantId),
(this.frame.style.display = 'block'),
SI.defer(
130,
((e = this),
function() {
return (e.backdrop.className += ' fadein'), SI.defer(100, e.focusEmailField);
})
),
(SI.$('body').className += ' ' + this.ACTIVE_CLASS_NAME),
!0 === this.mobileDevice() && (this.frame.style.height = this.frame.parentElement.scrollHeight + 'px'),
(this.isOpen = !0),
this
);
}),
(n.prototype.hide = function() {
return (
(this.isOpen = !1),
(this.backdrop.className = this.backdrop.className.replace(/fadein/, '')),
(document.getElementsByTagName('body')[0].style.overflow = ''),
this.blurEmailField(),
SI.removeClassName(SI.$('body'), this.ACTIVE_CLASS_NAME),
(this.frame.style.display = 'none'),
this.reset(),
this.frame
);
}),
(n.prototype.render = function(t, e) {
var onClose, iframeElem, smsSupportDetails, a, partials, l, templateVars;
var mainThis = this;
templateVars = SI.extend({}, e, SI.helpers, {
product: SI.extend(t, {
variants: this.popover.variants
}),
unavailableVariants: this.popover.variants,
styles: this.popover.settings.styles,
single_variant_product:
1 ===
function() {
var variantArray;
variantArray = [];
for (a in this.popover._variantsById) {
variantArray.push(a);
}
return variantArray;
}.call(this).length,
popup_theme: this.popover.settings.popup_theme,
popup_js: this.popover.settings.popup_js,
is_default_variant:
1 === this.popover.variants.length &&
('Default' === (l = this.popover.variants[0].title) || 'Default Title' === l || 'DEFAULT TITLE' === l),
madeby_link_visible: this.popover.settings.madeby_link_visible,
customer: this.popover.settings.customer,
content_for_body: this.popover.settings.content_for_body,
shop_myshopify_domain: this.popover.settings.shop,
show_phone_number_field: this.popover.settings.show_phone_number_field,
customer_name_enabled: this.popover.settings.customer_name_enabled,
only_sms_enabled: this.popover.settings.only_sms_enabled,
show_sms_first: this.popover.settings.show_sms_first,
show_fb: this.popover.settings.show_fb,
newsletter_permission_enabled: this.popover.settings.newsletter_permission_enabled,
newsletter_permission_default_checked: this.popover.settings.newsletter_permission_default_checked,
newsletter_permission_text: this.popover.settings.newsletter_permission_text,
push_owl_enabled: false,
fb_page_id: this.popover.settings.fb_page_id,
show_terms_and_conditions: this.popover.settings.show_terms_and_conditions,
terms_and_condtions_text: this.popover.settings.terms_and_condtions_text
});
partials = SI.Config.partials;
iframeElem = this.frameDoc();
if (this.popover.settings.push_owl_enabled && window.pushowl) {
window.pushowl
.isEnabled()
.then(function(res) {
SI.log(JSON.stringify(res));
templateVars.push_owl_enabled = true;
return mainThis.renderFinally(iframeElem, templateVars, partials);
})
.catch(function(error) {
templateVars.push_owl_enabled = false;
return mainThis.renderFinally(iframeElem, templateVars, partials);
});
} else {
return this.renderFinally(iframeElem, templateVars, partials);
}
}),
(n.prototype.renderDone = function() {
return (
this.toggleComplete(),
SI.defer(
1e4,
((t = this),
function() {
return t.hide;
})
)
);
var t;
}),
(n.prototype.submit = function(t) {
var e, stockNotificationRequestDetails, emailFinal, r, o, s, a, email;
SI.preventDefault(t);
this.reset();
this.submitButton().setAttribute('disabled', 'disabled');
var options = SI.$('#variants', this.frameDoc()).getElementsByTagName('option');
var productInfo = (function() {
var validOptions = [];
var optionsLength = options.length;
for (var t = 0; t < optionsLength; t++) {
r = options[t];
r.selected && validOptions.push(r);
}
return validOptions;
})()[0];
s = SI.$('#quantity_required', this.frameDoc());
e = SI.$('#customer_accepts_marketing', this.frameDoc());
a = SI.$('#g-recaptcha-response', this.frameDoc());
tc = SI.$('#acceptTermsAndConditionsForPopupForm', this.frameDoc());
if (!this.popover.settings.recaptcha_enabled || (null != a ? a.value : void 0)) {
stockNotificationRequestDetails = {
quantity_required: (null != s ? s.value : void 0) || 1,
accepts_marketing: !0 === (null != e ? e.checked : void 0),
recaptcha_response: null != a ? a.value : void 0,
pushSubscriptionToken: this.pushSubscriptionToken
};
if (this.popover.settings.customer_name_enabled) {
name = SI.$('#appikon-bis-popup-form-name', this.frameDoc())?.value;
stockNotificationRequestDetails.customer_name = name;
}
email = this.emailField();
emailFinal = (null != email ? email.value : void 0) || null;
if (this.popover.settings.show_phone_number_field) {
o = SI.$('#phone-number', this.frameDoc());
if (SI.isVisible(o)) {
stockNotificationRequestDetails.phone_number = this.intlTelInput.getNumber();
emailFinal = null;
}
}
if (this.popover.settings.show_terms_and_conditions == true) {
var isTcAccepted = !0 === (null != tc ? tc.checked : void 0);
if (isTcAccepted === false) {
this.showMessage('Please accept Terms And Conditions');
return;
}
}
if (!emailFinal && !stockNotificationRequestDetails.phone_number && !stockNotificationRequestDetails.pushSubscriptionToken) {
this.showMessage(SI.Config.labels.empty_email_phone_validation_message);
return;
} else {
return this.popover.create(emailFinal, productInfo.value, null, stockNotificationRequestDetails);
}
}
this.showMessage('Please solve the CAPTCHA to proceed.');
}),
(n.prototype.toggleComplete = function(t) {
var e;
return (
null == t && (t = !0),
(e = SI.$('#container', this.frameDoc())),
this.submitButton().removeAttribute('disabled'),
t ? (e.className += ' complete') : (e.className = e.className.replace(/complete/g, '')),
this
);
}),
(n.prototype.reset = function() {
return this.showMessage(''), this.toggleComplete(!1);
}),
(n.prototype.showMessage = function(t, e) {
var n;
return (
null == e && (e = '#message_holder'),
(n = SI.$(e, this.frameDoc())),
this.submitButton().removeAttribute('disabled'),
t && t.length > 0
? (n.innerHTML = Mustache.render('{{message}}
', {
message: t
}))
: (n.innerHTML = '')
);
}),
(n.prototype.submitButton = function() {
return this._submitButton || (this._submitButton = SI.$('[type=submit]', this.frameDoc()));
}),
n
);
})();
}.call(this),
function() {
var t = function(t, n) {
function i() {
this.constructor = t;
}
for (var r in n) e.call(n, r) && (t[r] = n[r]);
return (i.prototype = n.prototype), (t.prototype = new i()), (t.__super__ = n.prototype), t;
},
e = {}.hasOwnProperty;
SI.MobiliaForm = (function(e) {
function n(t, e) {
var i;
(this.formEl = t),
null == e && (e = SI.Config),
n.__super__.constructor.call(this, e),
(this.productId = this.formEl.parentNode
.getAttribute('id')
.split('-')
.slice(-1)[0]),
(i = {
accepts_marketing: null != this.acceptsMarketingState() ? this.acceptsMarketingState() : null,
quantity_required: null != this.quantity_required() ? this.quantity_required() : null
}),
this.create(this.email(), this.variant(), this.productId, i);
}
return (
t(n, e),
(n.prototype.email = function() {
return $(this.formEl)
.find('[name="contact[email]"]')
.val();
}),
(n.prototype.acceptsMarketingState = function() {
var t;
if ((t = $(this.formEl).find('[name="customer_accepts_marketing"]')).is(':checked')) return t.val();
}),
(n.prototype.quantity_required = function() {
var t;
if (null != (t = $(this.formEl).find('[name="qty_required"]'))[0]) return t.val();
}),
(n.prototype.variant = function() {
var t;
return null !=
(t = $(this.formEl)
.closest('.product-' + this.productId)
.find('[name=id]'))[0]
? t.val()
: (t = $(
'#product-form-' +
this.productId +
' [name=id], #product-form-' +
this.productId +
' input[name=id], #product-select-' +
this.productId
)
.eq(0)
.val()) || $(this.formEl).data('first-variant');
}),
(n.prototype.onError = function(t) {
var e, n;
return (
(n = (function() {
var n;
n = [];
for (e in t.errors) n.push(t.errors[e].join());
return n;
})()),
this.render(t.status.toLowerCase(), n.join(' '))
);
}),
(n.prototype.onSuccess = function(t) {
return this.render(t.status.toLowerCase(), t.message);
}),
(n.prototype.render = function(t, e) {
return (
null == t && (t = ''),
null == e && (e = ''),
$(this.formEl)
.find('.SI_response')
.html(
$('', {
class: t,
html: e
})
)
);
}),
n
);
})(SI.Base);
}.call(this),
function() {
var t = function(t, e) {
return function() {
return t.apply(e, arguments);
};
},
e = function(t, e) {
function i() {
this.constructor = t;
}
for (var r in e) n.call(e, r) && (t[r] = e[r]);
return (i.prototype = e.prototype), (t.prototype = new i()), (t.__super__ = e.prototype), t;
},
n = {}.hasOwnProperty;
SI.Popover = (function(n) {
function i(e) {
var n, r, o, s;
null == e && (e = SI.Config),
(this.toggle = t(this.toggle, this)),
(this.createUI = t(this.createUI, this)),
(this.triggerHandler = t(this.triggerHandler, this)),
(this.variantChanged = t(this.variantChanged, this)),
(n = {
trigger: 'SI_trigger'
}),
(this.settings = SI.extend(n, e)),
i.__super__.constructor.call(this, this.settings),
this.settings.trigger && SI.on(document, 'click', this.triggerHandler),
this.getProducts().then(
((s = this),
function() {
return s.createUI();
})
),
null != this.settings.multivariantDropdownContainer &&
!0 === (null != (o = this.settings.button) ? o.visible : void 0) &&
(r = SI.$(this.settings.multivariantDropdownContainer)) &&
SI.on(r, 'change', this.variantChanged);
}
return (
e(i, n),
(i.prototype.create = function(t, e, n, r) {
return (
null == n && (n = this.product.id),
null == r && (r = {}),
this.settings.reCAPTCHAEnabled && this.form.frame.contentWindow.grecaptcha.reset(),
i.__super__.create.apply(this, arguments)
);
}),
(i.prototype.variantChanged = function() {
var t, e, n, i;
if (
((e = SI.$('[name=id]', SI.$(this.settings.multivariantDropdownContainer))),
(t = null),
null !=
(t = (i = SI.detectVariant(this))
? i.id
: e
? 'SELECT' === e.nodeName && e.selectedIndex >= 0
? e.children[e.selectedIndex].value
: e.value
: null != (n = this.product.variants[0])
? n.id
: void 0))
)
return this.toggleForVariant(t);
}),
(i.prototype.triggerHandler = function(t) {
var e, n;
for (e = t.target || t.srcElement, n = []; e; ) {
if (
null != e.getAttribute &&
(e.getAttribute('id') === this.settings.trigger || e.getAttribute('className') === this.settings.trigger)
) {
SI.preventDefault(t), this.form.selectVariant(e.getAttribute('data-variant-id')), this.toggle();
break;
}
n.push((e = e.parentNode));
}
return n;
}),
(i.prototype.createUI = function() {
if (((this.form = new SI.Form(this, this.settings.mobile_css)), !0 === this.settings?.button?.visible))
return (
(this.button = new SI.Button(this.settings.button, this.form)),
this.button.ready.then(
((t = this),
function() {
return null != t.settings.multivariantDropdownContainer ? t.variantChanged() : t.button.toggle(t.variants.length > 0);
})
)
);
var t;
}),
(i.prototype.toggle = function(t) {
return null == t && (t = this.form.isOpen), t ? this.hide() : this.show(), this;
}),
(i.prototype.hide = function() {
return this.form.hide();
}),
(i.prototype.show = function(t) {
return this.form.show(t);
}),
(i.prototype.alert = function(t) {
return console && console.log && console.log('SI.Popover.alert() is deprecated.'), alert(t);
}),
(i.prototype.onError = function(t) {
var e, n, i;
if (
((n = (function() {
var n, r;
(n = t.errors), (r = []);
for (e in n) (i = n[e]), r.push(i);
return r;
})()),
null != this.form)
)
return this.form.showMessage(SIConfig.labels.empty_email_phone_validation_message);
}),
(i.prototype.onSuccess = function() {
if (null != this.form) return this.form.renderDone();
}),
(i.prototype.toggleForVariant = function(t) {
var e;
if (null != (e = this._variantsById[t] || this._variantsByTitle[t]) && null != this.button)
return this.button.elm.setAttribute('data-variant-id', e.id), this.button.toggle(this.variantIsUnavailable(e));
}),
i
);
})(SI.Base);
}.call(this),
function() {
var t = [].slice;
SI.Promise = (function() {
function e() {
(this.resolved = !1), (this.callbacks = []), (this.data = null);
}
return (
(e.prototype.then = function(t) {
return this.callbacks.push(t), this.resolved ? this.execute() : this;
}),
(e.prototype.resolve = function() {
var e;
return (e = 1 <= arguments.length ? t.call(arguments, 0) : []), (this.data = e), (this.resolved = !0), this.execute();
}),
(e.prototype.execute = function() {
for (var t; (t = this.callbacks.shift()); ) t.apply(t, this.data);
return this;
}),
e
);
})();
}.call(this),
function() {
SI.Analytics = (function() {
function t() {
(this.key = 'si_id'), (this.endpoint = '//' + SI.Config.conversions_hostname + '/prod/api');
}
t.prototype.init = function() {
this.identify();
if (window.location.pathname.match(/\/checkouts/)) {
SI.log('bis checkout check.');
return this.trackCheckout();
}
};
t.prototype.createCookie = function(t, e, n) {
var i, r;
return (
n ? ((i = new Date()).setTime(i.getTime() + 24 * n * 60 * 60 * 1e3), (r = '; expires=' + i.toGMTString())) : (r = ''),
(document.cookie = encodeURIComponent(t) + '=' + e + r + '; path=/;')
);
};
t.prototype.getCookie = function(t) {
var e, n;
return 0 === document.cookie.length
? null
: -1 === (n = document.cookie.indexOf(t + '='))
? null
: ((n = n + t.length + 1),
-1 === (e = document.cookie.indexOf(';', n)) && (e = document.cookie.length),
unescape(document.cookie.substring(n, e)));
};
t.prototype.deleteCookie = function(t) {
return this.createCookie(t, '', -1);
};
t.prototype.identify = function() {
if (null !== window.location.search.match(this.key)) {
SI.log('bis cookie read successfully.');
return this.createCookie(this.key, SI.urlParam(this.key), 30);
}
};
t.prototype.trackCheckout = function() {
var t, e, n, i, r, o, s, a;
if (null != (t = this.getCookie(this.key))) {
SI.log('bis cookie about to be used for checkout.');
return this.track('checkout', {
checkout_token: 'undefined' != typeof Shopify && null !== Shopify && null != (e = Shopify.checkout) ? e.token : void 0,
si_id: t,
order_id: 'undefined' != typeof Shopify && null !== Shopify && null != (n = Shopify.checkout) ? n.order_id : void 0,
subtotal_price:
'undefined' != typeof Shopify && null !== Shopify && null != (i = Shopify.checkout) ? i.subtotal_price : void 0,
total_price: 'undefined' != typeof Shopify && null !== Shopify && null != (r = Shopify.checkout) ? r.total_price : void 0,
checkout_step: 'undefined' != typeof Shopify && null !== Shopify && null != (o = Shopify.Checkout) ? o.step : void 0,
order_created_at: 'undefined' != typeof Shopify && null !== Shopify && null != (s = Shopify.checkout) ? s.created_at : void 0,
location: window.location.toString()
}).then(
((a = this),
function() {
//return a.deleteCookie(a.key)
})
);
} else {
SI.log('bis cookie was null.');
}
};
t.prototype.track = function(t, e) {
var n, i, r;
e = SI.extend(
{
name: t,
shop_name: SI.Config.shop
},
e
);
i = (function() {
var t;
t = [];
for (n in e) (r = e[n]), t.push(n + '=' + r);
return t;
})().join('&');
return SI.request(this.endpoint, {
method: 'POST',
headers: {
'Content-type': 'application/json'
},
data: JSON.stringify(e)
});
};
return t;
})();
}.call(this);
SI.Config = {};
SI.Config = SI.extend(SI.Config, 'undefined' != typeof _SIConfig && null !== _SIConfig ? _SIConfig : {});
window.SIConfig = SI.Config;
if (SI.Config.button?.selected_selector !== '' && !document.querySelector(SI.Config.button?.selected_selector)) {
console.log('BIS: button not found. Wrong selector');
} else {
console.log('BIS: button found.');
}
SI.domReady().then(SI.init);
new SI.Analytics().init();
var bisProductPageFunction = function() {
var bisCheckCondition = SI.Config.show_notify_me_button_on_collection_page;
if (SI.urlIsProductPage() == false && SI.Config.show_notify_me_button_on_collection_page == false) {
jQuery('.SI_trigger').hide();
}
let inlineFormJavascript = SI.Config.inlineFormJavascript;
eval(inlineFormJavascript);
let customJavascript = SI.Config.customJavascript;
eval(customJavascript);
deferBisProductPageButton(setBisProductPageButtonStyles);
};
function setBisProductPageButtonStyles() {
var mainButtonSettings = SI.Config.main_button;
var mainButton = jQuery('#SI_trigger');
if (mainButtonSettings.main_caption) {
if (mainButton.is('input')) {
mainButton.val(mainButtonSettings.main_caption);
} else {
mainButton.html(mainButtonSettings.main_caption);
}
}
if (mainButtonSettings.main_css_classes) {
var originalMainCssClasses = mainButton.attr('class');
mainButton.attr('class', mainButtonSettings.main_css_classes.trim() + ' ' + originalMainCssClasses);
}
if (mainButtonSettings.main_button_width) {
mainButton.css('width', mainButtonSettings.main_button_width + '%');
}
if (mainButtonSettings.main_button_height) {
mainButton.css('height', mainButtonSettings.main_button_height + 'px');
}
if (mainButtonSettings.main_caption_size) {
mainButton.css('font-size', mainButtonSettings.main_caption_size + 'px');
}
if (mainButtonSettings.main_margin_top) {
mainButton.css('margin-top', mainButtonSettings.main_margin_top + 'px');
}
if (mainButtonSettings.main_margin_bottom) {
mainButton.css('margin-bottom', mainButtonSettings.main_margin_bottom + 'px');
}
if (mainButtonSettings.main_margin_left) {
mainButton.css('margin-left', mainButtonSettings.main_margin_left + 'px');
}
if (mainButtonSettings.main_margin_right) {
mainButton.css('margin-right', mainButtonSettings.main_margin_right + 'px');
}
if (mainButtonSettings.main_text_color) {
mainButton.css('color', mainButtonSettings.main_text_color);
}
if (mainButtonSettings.main_hover_text_color) {
var originalMainButtonHoverTextColor;
mainButton.hover(
function() {
originalMainButtonHoverTextColor = jQuery(this).css('color');
jQuery(this).css('color', mainButtonSettings.main_hover_text_color);
},
function() {
jQuery(this).css('color', originalMainButtonHoverTextColor ? originalMainButtonHoverTextColor : '');
}
);
}
if (mainButtonSettings.main_text_style) {
switch (mainButtonSettings.main_text_style) {
case 'NORMAL':
mainButton.css('font-weight', 'normal');
mainButton.css('font-style', 'normal');
break;
case 'BOLD':
mainButton.css('font-weight', 'bold');
break;
case 'ITALIC':
mainButton.css('font-style', 'italic');
break;
case 'UNDERLINE':
mainButton.css('text-decoration', 'underline');
break;
default:
}
}
if (mainButtonSettings.main_background_color) {
mainButton.css('background-color', mainButtonSettings.main_background_color);
}
if (mainButtonSettings.main_hover_background_color) {
var originalMainHoverBgColor;
mainButton.hover(
function() {
originalMainHoverBgColor = jQuery(this).css('background-color');
jQuery(this).css('background-color', mainButtonSettings.main_hover_background_color);
},
function() {
jQuery(this).css('background-color', originalMainHoverBgColor ? originalMainHoverBgColor : '');
}
);
}
if (mainButtonSettings.main_border_color) {
mainButton.css('border-color', mainButtonSettings.main_border_color);
}
if (mainButtonSettings.main_hover_border_color) {
var originalMainHoverBorderColor;
mainButton.hover(
function() {
originalMainHoverBorderColor = jQuery(this).css('border-color');
jQuery(this).css('border-color', mainButtonSettings.main_hover_border_color);
},
function() {
jQuery(this).css('border-color', originalMainHoverBorderColor ? originalMainHoverBorderColor : '');
}
);
}
if (mainButtonSettings.main_border_size) {
mainButton.css('border-width', mainButtonSettings.main_border_size + 'px');
}
if (mainButtonSettings.main_border_radius) {
mainButton.css('border-radius', mainButtonSettings.main_border_radius + 'px');
}
}
SI.domReady().then(deferJquery(bisProductPageFunction));
})();