import d from"./Bvs3L9q-.js";import{v as p}from"./7BSVXI-E.js";import{K as h,m as o,j as i,k as t,t as n,v as f,A as m,l as _,D as b,E as g,F as v,B as S,b as E}from"./BCLrUOBx.js";import"./CWalxxGV.js";const w={setup(){const e=E(),{unAuthPost:s}=e;return{unAuthPost:s}},name:"Subscription",data(){return{errors:[],formSubmitting:!1,email:"",hasFormError:!1,messageSent:!1}},components:{},props:{},mixins:[p],computed:{invalidEmail(){return!this.isValidEmail(this.email)}},methods:{async formSubmit(){var e;if(this.email&&!this.invalidEmail){this.formSubmitting=!0;const s=await this.unAuthPost({params:{email:this.email},api:"emailSubscription"});(s==null?void 0:s.status)===200?(this.messageSent=!0,this.hasFormError=!1):(this.hasFormError=!0,this.errors=(e=s==null?void 0:s.data)==null?void 0:e.form),this.formSubmitting=!1}else this.hasFormError=!0}}},y={class:"subscription-wrapper pt-20 pb-15"},k={class:"container"},F={class:"flex sided block-md"},x={class:"mn-w-50 mb-10"},V={class:"bold"},j={class:"color-lite"},B={class:"mx-w-400x grow"},N={class:"grow"},P={key:0,class:"flex grow wrap gap-10"},A={class:"m-0 icon-input flex grow"},D=["placeholder"],M={key:1,class:"success-msg flex"},C={key:0},L={key:1,class:"error"},q={key:2,class:"error"};function K(e,s,R,T,r,a){const c=d;return i(),o("div",y,[t("div",k,[t("div",F,[t("div",x,[t("h3",V,n(e.$t("home.subscribeNewsletter")),1),t("p",j,n(e.$t("home.getLatestEmail")),1)]),t("form",{class:"flex mn-w-50 j-end j-start-md mb-10",onSubmit:s[1]||(s[1]=f((...l)=>a.formSubmit&&a.formSubmit(...l),["prevent"]))},[t("div",B,[t("div",N,[r.messageSent?(i(),o("div",M,[s[3]||(s[3]=t("i",{class:"mr-10 icon tick-icon"},null,-1)),t("h4",null,n(e.$t("home.subscribeSuccessMsg")),1)])):(i(),o("div",P,[t("div",A,[s[2]||(s[2]=t("i",{class:"icon email-icon"},null,-1)),b(t("input",{type:"text","onUpdate:modelValue":s[0]||(s[0]=l=>r.email=l),placeholder:e.$t("contact.your",{type:e.$t("contact.email")}),class:"plr-15 grow"},null,8,D),[[g,r.email]])]),_(c,{class:"primary-btn plr-25 plr-sm-15","fetching-data":r.formSubmitting,text:e.$t("home.subscribe")},null,8,["fetching-data","text"])]))]),r.hasFormError&&r.errors&&r.errors.length?(i(),o("div",C,[(i(!0),o(v,null,S(r.errors,(l,u)=>(i(),o("span",{class:"error",key:u},n(l),1))),128))])):m("",!0),!r.email&&r.hasFormError?(i(),o("span",L,n(e.$t("addressPopup.isRequired",{type:e.$t("addressPopup.email")})),1)):a.invalidEmail&&r.hasFormError?(i(),o("span",q,n(e.$t("contact.invalidEmail")),1)):m("",!0)])],32)])])])}const I=h(w,[["render",K]]);export{I as default};
