1import{s as l,aN as y,aM as S,z as g,aF as N,bg as F,K as o}from"./DOUwDtZz.js";import{t as T}from"./BxkVHpJ-.js";import{n as C}from"./CF1bNn0I.js";import{u as I}from"./BZxi85GY.js";function U(){const{isLoggedIn:c}=l(y()),{customer:r}=l(S()),{t:m}=g(),s=o(),e=o(!1),a=o(!1),f=N(),{acsUrl:d}=f.public,p=C(m),{handleSubmit:h,setFieldValue:v}=I({validationSchema:T(p)}),n=async t=>{if(!t.email){s.value="Email is required";return}s.value=null,e.value=!1,a.value=!0;const u={serviceName:"Footer Newsletter"},b=c.value&&r.value?.email===t.email?{...u,...t,userId:r.value?.key||""}:{...u,...t};try{await $fetch(`${d}/api/subscribe`,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(b)})&&(e.value=!0,F("submit-newsletter",t.email))}catch(i){s.value=i}finally{a.value=!1,e.value&&(v("email",""),setTimeout(()=>{e.value=!1},3e3))}},w=h(n);return{success:e,error:s,pending:a,submitNewsletter:n,submitNewsletterForm:w}}export{U as u};
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.