https://soldejaneiro.com/cdn/shop/t/568/assets/ia-gorgias-bridge.js?v=166529342258386806861790194901
1import{openCart}from"ia-util-helpers";const CAMPAIGN_IFRAME_ID="chat-campaigns",OPEN_MIN_HEIGHT=10,GUARD_MS=400,CHAT_CART_EVENT="cart:updated",BRIDGE_CART_EVENT="gorgias:cart-updated";class IaGorgiasBridge extends HTMLElement{connectedCallback(){this.guardMs=parseInt(this.dataset.guardMs,10)||GUARD_MS,this.onCartUpdated=this.handleCartUpdated.bind(this),document.addEventListener(BRIDGE_CART_EVENT,this.onCartUpdated),this.connectChat(),this.watchCampaigns()}disconnectedCallback(){document.removeEventListener(BRIDGE_CART_EVENT,this.onCartUpdated),this.chatBound&&window.GorgiasChat.off(CHAT_CART_EVENT,this.onCartUpdated),this.mountObserver?.disconnect(),this.sizeObserver?.disconnect(),clearTimeout(this.guardTimeout),document.body.style.pointerEvents=""}async whenChatReady(){return window.GorgiasChat||await new Promise(resolve=>{window.addEventListener("gorgias-widget-loaded",resolve,{once:!0})}),window.GorgiasChat.init()}async connectChat(){try{await this.whenChatReady(),window.GorgiasChat.on(CHAT_CART_EVENT,this.onCartUpdated),this.chatBound=!0}catch(error){console.warn("[ia-gorgias-bridge] chat setup failed:",error.message)}}handleCartUpdated(){Promise.resolve(window.iaCartAPI?.refresh?.()).finally(()=>{openCart()})}watchCampaigns(){const iframe=document.getElementById(CAMPAIGN_IFRAME_ID);if(iframe)return this.guardClicks(iframe);this.mountObserver=new MutationObserver(()=>{const mounted=document.getElementById(CAMPAIGN_IFRAME_ID);mounted&&(this.mountObserver.disconnect(),this.guardClicks(mounted))}),this.mountObserver.observe(document.documentElement,{childList:!0,subtree:!0})}guardClicks(iframe){if(typeof ResizeObserver>"u")return;let wasOpen=iframe.getBoundingClientRect().height>OPEN_MIN_HEIGHT;this.sizeObserver=new ResizeObserver(()=>{const isOpen=iframe.getBoundingClientRect().height>OPEN_MIN_HEIGHT;wasOpen&&!isOpen&&this.suspendPointer(),wasOpen=isOpen}),this.sizeObserver.observe(iframe)}suspendPointer(){document.body.style.pointerEvents="none",clearTimeout(this.guardTimeout),this.guardTimeout=setTimeout(()=>{document.body.style.pointerEvents=""},this.guardMs)}}customElements.get("ia-gorgias-bridge")||customElements.define("ia-gorgias-bridge",IaGorgiasBridge); 2//# sourceMappingURL=/cdn/shop/t/568/assets/ia-gorgias-bridge.js.map?v=166529342258386806861790194901
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.