1"use strict";(self.webpackChunkcrownpeak_opus2=self.webpackChunkcrownpeak_opus2||[]).push([["getgiftcard-loader"],{"./src/js/opus2/moly-gift/getGiftCardZip.ts"(e,t,i){i.d(t,{GiftCardFormHandler:()=>r});var s=i(/*! axios */"./node_modules/axios/lib/axios.js"),d=i(/*! ../config/apiConfig */"./src/js/opus2/config/apiConfig.ts"),n=i(/*! ../constants/regex */"./src/js/opus2/constants/regex.ts"),o=i(/*! ../util/loader */"./src/js/opus2/util/loader.ts");class r{static getInstance(){return r.instance||(r.instance=new r),r.instance}constructor(){var e;this.handleSubmit=e=>{e.preventDefault(),e.stopPropagation();const t=document.getElementById("successful-message-zip-check");null==t||t.classList.add("hidden");const i=document.getElementById("check-zip-gift-cert").value;if(this.validateForm()){(0,o.startLoader)();const e=document.getElementById("skip-lookup-call");if("yes"===(null==e?void 0:e.getAttribute("value"))){sessionStorage.setItem("brandZipCode",i);const e=document.getElementById("successful-url-zip-check"),t=document.querySelector(".check-zip-error");e&&(globalThis.location.href=globalThis.location.origin+e.getAttribute("value")+`?address=${encodeURIComponent(i)}`,null==t||t.classList.add("hidden")),(0,o.stopLoader)()}else this.getData(i)}},this.form=document.querySelector(".gift-cetificate-wrap .primary-btn"),this.zipCodeInput=document.getElementById("check-zip-gift-cert"),this.form&&this.form.addEventListener("click",this.handleSubmit.bind(this));document.getElementById("check-zip-gift-cert")&&(null===(e=this.zipCodeInput)||void 0===e||e.addEventListener("input",this.zipCodeError.bind(this)))}zipCodeError(){var e;if(""==this.zipCodeInput.value||n.REGEX.sendZip.test(this.zipCodeInput.value.trim())){document.getElementById("check-zip-gift-cert-error-msg").classList.add("hidden"),this.zipCodeInput&&(null===(e=this.zipCodeInput)||void 0===e||e.classList.remove("invalid-field"))}else{const e=document.getElementById("check-zip-gift-cert-error-msg"),t=document.getElementById("successful-message-zip-check"),i=document.querySelector(".check-zip-error");e.classList.remove("hidden"),null==i||i.classList.add("hidden"),null==t||t.classList.add("hidden"),!e.innerHTML.trim()&&(e.innerHTML="Invalid zip code format.")}}getData(e){const t=document.querySelector(".gift-cetificate-wrap .primary-btn");t.setAttribute("disabled","true"),s.default.get(`${d.apiConfig.FranchiseLookUpByServiceAddress}&Address=${e}`).then(e=>{t.disabled=!1;const i=e.data,s=document.getElementById("successful-message-zip-check"),d=document.getElementById("successful-url-zip-check"),n=document.querySelector(".check-zip-error");i.length>0?d?(window.location.href=window.location.origin+d.getAttribute("value"),null==n||n.classList.add("hidden")):s&&(null==s||s.classList.remove("hidden"),null==n||n.classList.add("hidden")):n&&(null==n||n.classList.remove("hidden"),null==s||s.classList.add("hidden")),(0,o.stopLoader)()}).catch(e=>{(0,o.stopLoader)(),t.disabled=!1,console.log("Error:",e)})}validateForm(){var e;document.querySelectorAll(".error-msg").forEach(e=>e.classList.add("hidden")),document.querySelectorAll(".invalid-field").forEach(e=>e.classList.remove("invalid-field"));const t={zipCode:document.getElementById("check-zip-gift-cert").value},i={};if(!n.REGEX.sendZip.test(t.zipCode.trim())){const t=null===(e=document.getElementById("check-zip-gift-cert-error-msg"))||void 0===e?void 0:e.innerText;i["check-zip-gift-cert"]=t||"Invalid zip code format."}return document.querySelectorAll(".error-msg").forEach(e=>
1e.classList.add("hidden")),Object.keys(i).forEach((e,t)=>{const s=document.getElementById(e),d=document.getElementById(`${e}-error-msg`);if(null==s?void 0:s.parentNode){const t=i[e],n=document.createElement("span");n.className="error-msg",n.textContent=t,s.classList.add("invalid-field"),d&&t&&(d.innerHTML=t),(null==d?void 0:d.classList.contains("hidden"))&&(null==d||d.classList.remove("hidden"))}else 0==t&&s&&s.focus()}),0===Object.keys(i).length}}document.addEventListener("DOMContentLoaded",()=>{globalThis.__GiftCardFormHandlerInitialized||(globalThis.__GiftCardFormHandlerInitialized=!0,r.getInstance())})},"./src/js/opus2/moly-gift/index.ts"(e,t,i){i.r(t),i.d(t,{GiftCardFormHandler:()=>s.GiftCardFormHandler});var s=i(/*! ./getGiftCardZip */"./src/js/opus2/moly-gift/getGiftCardZip.ts")}}]); 2//# sourceMappingURL=opus2.getgiftcard-loader.7df0d5ca22ab7f13d71e.js.map
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.