import{_ as te}from"./CcBIMsHM.js";import{_ as oe}from"./B3TJSbpd.js";import{_ as Z}from"./C1GjbExY.js";import{c as O,d as x,u as H,a as Q,b as W,e as U,r as C,f as E,g as J,h,o as c,w as X,i as A,j as t,t as z,k as n,l as f,_ as V,n as se,p as R,F as Y,m as N,q as D,s as ie,v as le,x as ce,y as re,z as pe,A as ue,B as me,C as T,D as I,E as q,G as de,H as _e,I as ge,J as be,K as G,L as fe,M as ve,N as he,O as ye,P as ke,Q as $e}from"./Cvzsf6pb.js";import{u as ee,F as B}from"./mpyo7n-t.js";import{_ as ne}from"./BMmwfXzG.js";import{n as ze}from"./DzQpl8X5.js";import{u as Ae}from"./DSU8t9ft.js";const Le=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Se=l=>{const e=O().required("form.email.required").matches(Le,"form.email.invalid");return l?e:e.optional()},Me={class:"magazine-pip__subtitle"},we=x({__name:"AppLoginMagazinePip",emits:["should-use-fallback-login"],setup(l,{emit:e}){const a=e,{getLoginUrl:p}=H(),u=Q(),{$logger:y}=W(),{callbackDestination:L,fallbackDestination:_}=U(),m=C(!1),g=E(()=>J().shape({pipEmail:Se(!0)})),{handleSubmit:b}=ee({validationSchema:g});async function S(d,s){try{const{data:o}=await $fetch("/front-office/v1/accounts/availability",{method:"POST",body:{email:d,title:s}});return!o.available}catch(o){const r={errorData:null};return o instanceof Y&&(r.errorData=o.data,o.statusCode===422)||y.log({error:o,title:"Error checking pip account",metadata:{additionalData:r}}),!1}}function k(){m.value||b(async d=>{var o;m.value=!0,await S(d.pipEmail,u.value)?(se(p({email:d.pipEmail,callbackUrl:((o=L.value)==null?void 0:o.href)||_.value}),{external:!0}),R({event:"customEvent",eventCategory:"form",eventAction:"validation_submit_success",eventLabel:`Login met pip - account beschikbaar ${u.value}`})):(a("should-use-fallback-login"),R({event:"customEvent",eventCategory:"form",eventAction:"validation_submit_fail",eventLabel:`Login met pip - account niet beschikbaar ${u.value}`})),m.value=!1})()}return(d,s)=>{const o=Z,r=V;return c(),h("form",{class:"magazine-pip",onSubmit:X(k,["prevent"])},[A("p",Me,z(d.$t("pages.landing.loginMagazine.pip.subtitle")),1),t(n(B),{name:"pipEmail"},{default:f(({field:i,errorMessage:M,handleChange:w,handleBlur:v})=>[t(o,{id:"pip-login-magazine-input","model-value":i.value,"data-testid":"pip-prefill-input",type:"email",label:"E-mailadres",required:"","error-message":M&&d.$t(M),"onUpdate:modelValue":$=>w($,!1),onBlur:v},null,8,["model-value","error-message","onUpdate:modelValue","onBlur"])]),_:1}),t(r,{type:"submit",size:"large","data-testid":"magazinePipLoginButton","data-analytics-category":"element_tracking","data-analytics-action":"button_click","data-analytics-label":"Login met pip",loading:n(m),disabled:n(m),text:"Ga verder"},null,8,["loading","disabled"])],32)}}}),xe=Object.assign(N(we,[["__scopeId","data-v-ecac1f2e"]]),{__name:"AppLoginMagazinePip"}),Fe=x({__name:"AppSmallLink",props:{tag:{}},setup(l){return(e,a)=>(c(),D(ce(e.tag),le(e.$props,{class:"small-link"}),{default:f(()=>[ie(e.$slots,"default",{},void 0,!0)]),_:3},16))}}),Ce=Object.assign(N(Fe,[["__scopeId","data-v-7f8fd21b"]]),{__name:"AppSmallLink"}),De=l=>{const e=O().required("form.subscriptionNumber.required").max(13);return l?e:e.optional()},Ne=l=>{const e=O().required("form.iban4.required").length(4,"form.iban4.length4");return l?e:e.optional()},Pe={class:"login-abon-iban__subtitle"},Ee=x({__name:"AppLoginMagazineAbonIban",setup(l){const e=Q(),{callbackDestination:a}=U(),{fetchMagazineSubscription:p}=re(),u=pe(),{storeAbonIban4:y}=ue(),L=me(),{$logger:_}=W(),m=E(()=>e.value==="pak12"?u.t("components.loginMagazine.subscriptionNumberExplanationPAK12"):u.t("components.loginMagazine.subscriptionNumberExplanation")),g=C(!1),b=C(!1),S=E(()=>J().shape({subscriptionNumber:De(!0),iban4:Ne(!0)})),{handleSubmit:k}=ee({validationSchema:S});function d(){g.value||(b.value=!1,k(async s=>{var o,r;g.value=!0;try{if(!await p({subscriptionNumber:s.subscriptionNumber,lastIbanDigits:s.iban4,brandCode:e.value}))throw new Error("Subscription not found");y({abon:s.subscriptionNumber,iban4:s.iban4}),await L.push({path:((o=a.value)==null?void 0:o.path)||"/abonnee",query:{loginType:"abonnr",switchType:(r=a.value)==null?void 0:r.switchType}})}catch(i){if(b.value=!0,i instanceof Y&&i.message.includes("404"))return;_.log({error:i,title:"Error in AppLoginMagazineAbonIban handleSubmitForm"})}finally{g.value=!1}})())}return(s,o)=>{const r=Z,i=V,M=ne;return c(),h("div",null,[A("form",{class:"login-abon-iban",onSubmit:X(d,["prevent"])},[A("p",Pe,z(s.$t("pages.landing.loginMagazine.abonIban.subtitle")),1),t(n(B),{name:"subscriptionNumber"},{default:f(({field:w,errorMessage:v,handleChange:$,handleBlur:P})=>[t(r,{id:"subscription-number","model-value":w.value,required:"",label:"Abonnementsnummer","helper-text":n(m),type:"text","data-testid":"subscriptionNumber","error-message":v&&s.$t(v),"onUpdate:modelValue":F=>$(F,!1),onBlur:P},null,8,["model-value","helper-text","error-message","onUpdate:modelValue","onBlur"])]),_:1}),t(n(B),{name:"iban4"},{default:f(({field:w,errorMessage:v,handleChange:$,handleBlur:P})=>[t(r,{id:"iban4","model-value":w.value,required:"",label:s.$t("components.loginMagazine.lastIbanDigits"),type:"text","data-testid":"iban4","error-message":v&&s.$t(v),"onUpdate:modelValue":F=>$(F,!1),onBlur:P},null,8,["model-value","label","error-message","onUpdate:modelValue","onBlur"])]),_:1}),t(i,{type:"submit",size:"large","data-analytics-category":"element_tracking","data-analytics-action":"button_click","data-analytics-label":"Login met abonnementsnummer","data-testid":"magazineRetentionLogin",loading:n(g),disabled:n(g),text:"Ga verder"},null,8,["loading","disabled"]),n(b)?(c(),D(M,{key:0,variant:"error",text:s.$t("errors.subscriptionNotFound")},null,8,["text"])):T("",!0)],32)])}}}),Te=Object.assign(N(Ee,[["__scopeId","data-v-75523855"]]),{__name:"AppLoginMagazineAbonIban"}),qe={class:"login-magazine"},Ie={class:"login-magazine__actions"},Be=x({__name:"AppLoginMagazine",setup(l){const{isPipDisabled:e}=H(),a=C(!1),p=C(!1),u=E(()=>!e.value&&!a.value);function y(){p.value=!0,a.value=!0}function L(){p.value=!1,a.value=!1}return(_,m)=>{const g=xe,b=Ce,S=ne,k=Te;return c(),h("div",qe,[A("div",Ie,[A("h2",null,z(_.$t("pages.landing.loginMagazine.title")),1),n(u)?(c(),h(I,{key:0},[t(g,{onShouldUseFallbackLogin:y}),t(b,{tag:"button","data-testid":"showFallbackLogin","data-analytics-category":"element_tracking","data-analytics-action":"button_click","data-analytics-label":"Login op een andere manier",onClick:m[0]||(m[0]=d=>a.value=!0)},{default:f(()=>[q(z(_.$t("components.landingOtherOptions.loginDifferent")),1)]),_:1})],64)):(c(),h(I,{key:1},[n(p)?(c(),D(S,{key:0,"data-testid":"magazineRetentionLoginError",variant:"warning",text:_.$t("components.landingOtherOptions.noAccountFound")},null,8,["text"])):T("",!0),t(k),n(e)?T("",!0):(c(),D(b,{key:1,tag:"button","data-testid":"showPipLogin","data-analytics-category":"element_tracking","data-analytics-action":"button_click","data-analytics-label":"Login met e-mailadres",onClick:L},{default:f(()=>[q(z(_.$t("components.landingOtherOptions.loginWithEmail")),1)]),_:1}))],64))])])}}}),Oe=Object.assign(N(Be,[["__scopeId","data-v-6cb1532d"]]),{__name:"AppLoginMagazine"}),Ue={class:"kcc-steering"},Ve=x({__name:"AppMagazineKccSteering",setup(l){const{phoneNumber:e}=de();return(a,p)=>{const u=V;return c(),h("div",Ue,[A("h3",null,z(a.$t("components.appMagazineKccSteering.title")),1),A("p",null,z(a.$t("components.appMagazineKccSteering.description")),1),t(u,{autofocus:"","data-testid":"kcc-steering-button",tag:"a",href:`tel:${n(e)}`,text:a.$t("labels.callPhoneNumber",[n(e)]),"data-analytics-category":"element_tracking","data-analytics-action":"button_click","data-analytics-label":a.$t("labels.callPhoneNumber",[n(e)])},null,8,["href","text","data-analytics-label"])])}}}),je=Object.assign(N(Ve,[["__scopeId","data-v-3f2b2811"]]),{__name:"AppMagazineKccSteering"});function Ke(){const l=C(!1);function e(){l.value=!0}return{isModalDismissed:l,dismiss:e}}const Re={id:"login-pagina"},Ge=["href"],Ze=x({__name:"PageLogin",async setup(l){let e,a;const{brandCode:p,brandDomain:u,brandType:y,brandLocale:L}=_e(),{flowType:_}=ge(),{isModalOpen:m,closeModal:g}=U(),{isModalDismissed:b,dismiss:S}=Ke(),k=p.value,d=_,s={title:k,templates:[{template_id:G.faqs,sort:{mode:"sortOrderTag",direction:"asc"},tags:{slug:d}}]},[{data:o}]=([e,a]=be(()=>Promise.all([he({path:`/retention/${_}/index/${y.value}`,locale:L.value,metaData:{title:k}},{key:"ret-login-page"}),ye(s)])),e=await e,a(),e),r=Ae(G.faqs);return(i,M)=>{var j;const w=ke("StoryblokComponent"),v=te,$=oe,P=Oe,F=ve,ae=je;return c(),h("div",Re,[(c(!0),h(I,null,fe((j=n(o))==null?void 0:j.data.story.content.sections,K=>(c(),D(w,{key:K._uid,blok:K},null,8,["blok"]))),128)),n(r)?(c(),D($,{key:0,"is-backgroundless":"","is-paddingless":""},{default:f(()=>[t(v,{faqs:("normalizeDamFaqs"in i?i.normalizeDamFaqs:n(ze))(n(r))},null,8,["faqs"])]),_:1})):T("",!0),t(F,{variant:"fullscreen","accessible-title":i.$t("pages.landing.modal.login.title"),"accessible-description":i.$t("pages.landing.modal.login.description"),open:n(m),"onUpdate:open":n(g)},{default:f(()=>[t(P)]),_:1},8,["accessible-title","accessible-description","open","onUpdate:open"]),t(F,{"accessible-title":i.$t("pages.landing.modal.steering.title"),"accessible-description":i.$t("pages.landing.modal.steering.description"),open:n(y)==="magazine"&&!n(b),variant:"always-windowed","onUpdate:open":n(S)},{default:f(()=>[t(ae)]),_:1},8,["accessible-title","accessible-description","open","onUpdate:open"]),t($,{"is-backgroundless":"","is-paddingless":""},{default:f(()=>[q(z(i.$t("pages.landing.faq.missingQuestionText"))+" ",1),A("a",{href:`https://mijnomgeving.${encodeURIComponent(n(u))}`},"klantenservice",8,Ge),M[0]||(M[0]=q(". ",-1))]),_:1,__:[0]})])}}}),He=Object.assign(N(Ze,[["__scopeId","data-v-1dce5bd8"]]),{__name:"PageLogin"}),tn=x({__name:"index",setup(l){return $e(),(e,a)=>{const p=He;return c(),h("div",null,[t(p)])}}});export{tn as default}; //# sourceMappingURL=Be5NOw4p.js.map