import{ThemeEvents}from"@theme/events";class ProductPrice extends HTMLElement{connectedCallback(){const closestSection=this.closest(".shopify-section, dialog");closestSection&&closestSection.addEventListener(ThemeEvents.variantUpdate,this.updatePrice)}disconnectedCallback(){const closestSection=this.closest(".shopify-section, dialog");closestSection&&closestSection.removeEventListener(ThemeEvents.variantUpdate,this.updatePrice)}updatePrice=event=>{if(event.detail.data.newProduct)this.dataset.productId=event.detail.data.newProduct.id;else if(event.target instanceof HTMLElement&&event.target.dataset.productId!==this.dataset.productId)return;const newPrice=event.detail.data.html.querySelector('product-price [ref="priceContainer"]'),currentPrice=this.querySelector('[ref="priceContainer"]');!newPrice||!currentPrice||currentPrice.innerHTML!==newPrice.innerHTML&&currentPrice.replaceWith(newPrice)}}customElements.get("product-price")||customElements.define("product-price",ProductPrice);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/product-price.js.map?v=1783128605
