/*__SALLA_WRAP_V1__*/ (function () { var s = document.currentScript; Salla.onReady(function () { var scoped = window.Salla.appScope(s.dataset.scopeId); var salla = scoped, Salla = scoped; var document = new Proxy(window.document, { get: function (d, p) { if (p === 'currentScript') { return s; } var v = d[p]; return typeof v === 'function' ? v.bind(d) : v; }, set: function (d, p, v) { d[p] = v; return true; } }); /*__SALLA_USER_CODE_START__*/ /* Jarribha storefront loader: adds the try-on button on product pages. The full UI is served from https://jarribha.craffo.com/storefront/jarribha.js (readable source). Some themes (the React theme) open a product without a page load, so this loader keeps a light watch until the shopper reaches a product page, loads the UI once, and then the UI follows product changes itself. Salla snippet rules: the interval is always cleared (product found, UI loaded, or page left), and the script tag goes into , never through a direct `body` reference. */ (function () { if (window.__jarribhaLoader) return; window.__jarribhaLoader = true; var timer = null, done = false; function get(key) { try { return salla.config.get(key); } catch (e) { return null; } } function stop() { if (timer) { clearInterval(timer); timer = null; } } function check() { if (done || window.Jarribha) { done = true; stop(); return; } var page = get("page") || {}; if (page.slug !== "product.single" || !page.id) return; stop(); done = true; var store = String(get("store.id") || ""); var s = document.createElement("script"); s.src = "https://jarribha.craffo.com/storefront/tryon"; s.async = true; s.setAttribute("data-jarribha-store", store); s.setAttribute("data-store", store); s.setAttribute("data-product", String(page.id)); (document.head || document.documentElement).appendChild(s); } window.addEventListener("pagehide", stop); window.addEventListener("pageshow", function (e) { if (e.persisted && !done && !timer) timer = setInterval(check, 500); }); salla.onReady(function () { check(); if (!done) timer = setInterval(check, 500); }); })(); /*__SALLA_USER_CODE_END__*/ }); })();