1import Cookies from"js-cookie";import"@archetype-themes/scripts/config";import Modals from"@archetype-themes/scripts/modules/modal";class NewsletterPopup extends HTMLElement{constructor(){super(),this.container=this,this.sectionId=this.container.getAttribute("data-section-id"),this.cookieName="newsletter-"+this.sectionId,this.cookie=Cookies.get(this.cookieName)}connectedCallback(){if(!this.container||window.location.pathname==="/challenge"||window.location.pathname==="/password")return;this.data={secondsBeforeShow:this.container.dataset.delaySeconds,daysBeforeReappear:this.container.dataset.delayDays,hasReminder:this.container.dataset.hasReminder,testMode:this.container.dataset.testMode},this.modal=new Modals("NewsletterPopup-"+this.sectionId,"newsletter-popup-modal");const btn=this.container.querySelector(".popup-cta a");if(btn&&btn.addEventListener("click",function(){this.closePopup(!0)}.bind(this)),(this.container.querySelector(".errors")||this.container.querySelector(".note--success"))&&this.modal.open(),this.container.querySelector(".note--success")){this.closePopup(!0);return}document.addEventListener("modalClose."+this.container.id,this.closePopup.bind(this)),this.cookie||this.initPopupDelay(),document.addEventListener("reminder:openNewsletter",()=>{this.modal.open()}),document.addEventListener("shopify:section:select",e=>{e.detail.sectionId===this.sectionId?this.modal.open():this.modal.close()}),document.addEventListener("shopify:section:deselect",e=>{e.detail.sectionId===this.sectionId&&this.modal.close()}),document.addEventListener("shopify:block:select",e=>{e.detail.sectionId===this.sectionId&&this.modal.close()}),document.addEventListener("shopify:block:deselect",e=>{e.detail.sectionId===this.sectionId?this.modal.open():this.modal.close()}),document.dispatchEvent(new CustomEvent("newsletter-popup:loaded",{detail:{sectionID:this.sectionId},bubbles:!0}))}initPopupDelay(){this.data.testMode!=="true"&&setTimeout(()=>{if(sessionStorage.getItem("newsletterAppeared")==="true"){const openReminder=new CustomEvent("newsletter:openReminder",{bubbles:!0});this.container.dispatchEvent(openReminder)}else this.modal.open(),sessionStorage.setItem("newsletterAppeared",!0)},this.data.secondsBeforeShow*1e3)}closePopup(success){if(this.data.testMode==="true"){Cookies.remove(this.cookieName,{path:"/"});return}const expires=success?200:this.data.daysBeforeReappear,hasReminder=this.data.hasReminder==="true",reminderAppeared=sessionStorage.getItem("reminderAppeared")==="true";hasReminder&&reminderAppeared?Cookies.set(this.cookieName,"opened",{path:"/",expires}):hasReminder||Cookies.set(this.cookieName,"opened",{path:"/",expires})}}customElements.define("newsletter-popup",NewsletterPopup); 2//# sourceMappingURL=/cdn/shop/t/88/assets/section-newsletter-popup.js.map?v=170012379161222995921720761140
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.