(function (w, d) { const LOADER_ID = "relixir-script-loader"; const el = d.getElementById(LOADER_ID); if (!el) return; const orgId = el.getAttribute("data-org-id"); if (!orgId) { console.warn("Relixir: missing data-org-id"); return; } function hasWarmly() { return !!d.querySelector( 'script[src*="opps-widget.getwarmly.com/warmly.js"]' ); } function loadWarmly(clientId) { if (hasWarmly()) return; const s = d.createElement("script"); s.id = "warmly-script-loader"; s.src = "https://opps-widget.getwarmly.com/warmly.js?clientId=" + encodeURIComponent(clientId); s.defer = true; s.async = true; d.head.appendChild(s); } function muteWarmly() { try { if (w.warmly && w.warmly.q) w.warmly.q.length = 0; } catch {} w.warmly = function () { /* muted by Relixir */ }; } const endpoint = "https://app.relixir.ai/api/embed/bootstrap?orgId=" + encodeURIComponent(orgId) + "&url=" + encodeURIComponent(location.href); fetch(endpoint, { credentials: "omit" }) .then((r) => (r.ok ? r.json() : Promise.reject(r.status))) .then(({ allowed, client_id }) => { if (allowed && client_id) loadWarmly(client_id); else muteWarmly(); }) .catch(() => { muteWarmly(); }); })(window, document);