PageSourceSearch

https://www.qwetch.com/cdn/shop/t/650/assets/section-newsletter.js?v=73839797931098591181790070583

js qwetch.com collected 2026-09-26 05:57:53 UTC 3,295 bytes, 1 lines download raw bytes

1!function(){class e{setupForm(e,t=null){void 0===e&&console.error("form undefined, form cannot be initialized for marketing automation");const r=e.querySelector("button[type=submit]");if(!r)return!1;const o=this.handleSubmit;window.Shopify.reCaptchaKeyTheme||console.warn("reCaptchaKeyTheme undefined, form cannot be initialized in ajax for marketing automation"),r.addEventListener("click",(t=>{t.preventDefault();e.querySelector(".js-newsletter-checkbox-consent").checked?grecaptcha.ready((()=>{grecaptcha.execute(window.Shopify.reCaptchaKeyTheme,{action:"submit"}).then((async t=>{console.log("🤖 Human after all !"),await o(e)}))})):e.dispatchEvent(new CustomEvent("subscription:error",a({error:{code:s}})))}))}async handleSubmit(s){const c=s.querySelector('input[name="contact[email]"]').value,i=(s.querySelector('input[name="contact[locale]"]').value,s.querySelector('input[name="contact[source]"]').value,s.querySelector('input[name="key"]').value);if(!e.validateEmail(c))return void s.dispatchEvent(new CustomEvent("subscription:error",a({error:{code:t}})));if(!e.validateEmail(c))return void s.dispatchEvent(new CustomEvent("subscription:error",a({error:{code:t}})));const u=new FormData(s);await fetch("https://w3app-customer-api.herokuapp.com/v3/customer/subscribe",{method:"POST",headers:{"X-Shopify-shop-domain":Shopify.shop,Authorization:"Bearer "+i},body:u}).then((e=>e.json())).then((e=>{"success"===e.status?s.dispatchEvent(new CustomEvent("subscription:success",a({error:{code:n}}))):"already_accepts_marketing"===e.status.toLowerCase()||"update_accepts_marketing"===e.status.toLowerCase()?s.dispatchEvent(new CustomEvent("subscription:error",a({error:{code:r}}))):s.dispatchEvent(new CustomEvent("subscription:error",a({error:{code:o}})))})).catch((e=>{console.error("Error:",e)}))}static validateEmail(e){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}}const t=-1,r=-2,o=-3,s=-4,n=1,a=e=>({detail:e});window.onload=()=>{(()=>{const e=document.querySelector(".js-footer-newsletter-form-input"),t=document.querySelector(".js-footer-newsletter-form-checkbox");e?e.addEventListener("focus",(()=>{t.classList.remove("u-none")})):t.classList.remove("u-none")})(),(()=>{const t=new e,o=document.querySelectorAll("form.js-newsletter-subscription-form");for(let e=0;e<o.length;e++){const n=o[e];t.setupForm(n);const a=n.querySelector(".js-footer-newsletter-message");n.addEventListener("subscription:error",(e=>{if(a.querySelector("span").classList.remove("u-success"),a.querySelector("span").classList.add("u-error"),a){if(a.style.display="flex",e.detail.error.code===r)return void(a.querySelector("span").innerHTML=Shopify.translations.newsletter.newsletter_email_exists);if(e.detail.error.code===s)return void(a.querySelector("span").innerHTML=Shopify.translations.newsletter.newsletter_no_consent);a.querySelector("span").innerHTML=Shopify.translations.newsletter.newsletter_error}})),n.addEventListener("subscription:success",(e=>{a.querySelector("span").classList.remove("u-error"),a.querySelector("span").classList.add("u-success"),a.style.display="flex",a.querySelector("span").innerHTML=Shopify.translations.newsletter.newsletter_success}))}})()}}();

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.