1import{d as J,b as D,Z as E,c as V,m as o,p as w,q as k,s as l,j as t,g as y,y as i,v as f,G as W,i as v,J as z,cA as L,cB as q,eB as G,P as H}from"./CelG4gE-.js";import{N as T}from"./D1Gzdxz2.js";import{P as Z}from"./Cr4AJbsY.js";import{A as $}from"./Dm4iQbsU.js";import{M as K}from"./b-s9T3u1.js";import{c as O,u as Q}from"./CA0Z1TYk.js";import{a as R}from"./BuPjHs_A.js";import"./BvCc0Dqv.js";import"./DAQteJlc.js";import"./C7Ze7Grt.js";import"./BTUqKcPz.js";import"./CWeghwUz.js";import"./TaRkMLWm.js";import"./BcRfVl1B.js";import"./D_suB7XW.js";import"./DO2yAFxR.js";import"./BzjfXTph.js";import"./CFkb9LMM.js";import"./D6DM76Nm.js";import"./DDaCZlfC.js";import"./eiq4HvSf.js";import"./Dp4i8kSM.js";const X={class:"content"},Y=J({__name:"index",setup(ee){const{isAuthenticated:C,fetchCustomerDetails:x,details:g,customerId:M,refreshCustomerInformation:N}=D(),{customerUpdatePreferences:A}=G(),{application:{isJumboMobile:P}}=E(),B=V(()=>[{title:"E-mail voorkeuren",url:"/mijn/voorkeuren"},{title:"SMS instelligen",url:"/mijn/voorkeuren/sms"}]);R(O);const s=o({value:null,error:""}),u=o({value:null,error:""}),n=o(!1),m=o(!1),r=o(!1),d=o(!1),c=o(!1);w(()=>C?.value,async a=>{if(a){const{load:e}=await x();await e()}},{immediate:!0}),w(()=>g.value?.preferences?.deliveryNotifications,a=>{if(n.value)return;if(a){s.value.value=a.sms??!1,u.value.value=a.push??!1;return}const e=g.value?.preferences?.transactional?.notification;e!==void 0&&(u.value.value=e)},{immediate:!0});const _=async()=>{d.value=!0,c.value=!1,await h()},j=()=>{d.value=!1,c.value=!1,s.value.value=!1},U=async()=>{P.value&&await L.impact({style:q.Light}),console.log("Current SMS state:",s.value.value);const a=!s.value.value;if(console.log("Next SMS state:",a),a&&u.value.value&&!d.value){c.value=!0;return}await h()},h=async()=>{const a=!s.value.value,e={id:M.value,preferences:{pushNotifications:{sms:a,...a&&{transactional:!1}}}},{success:S,data:F,error:b}=Q.safeParse(e);if(b){r.value=!0,console.error(b);return}if(S){n.value=!0,r.value=!1;try{const{customerUpdate:{success:p,error:I}}=await A(F);if(p!==!0){r.value=!0,console.error(I);return}s.value.value=a,a&&(u.value.value=!1),await N(),m.value=!0,r.value=!1}catch(p){r.value=!0,console.error(p)}finally{n.value=!1}}};return(a,e)=>(y(),k($,{"page-title":"SMS voorkeuren",breadcrumbs:t(B)},{default:l(()=>[t(r)?(y(),k(t(T),{key:0,class:"server-error",type:"prominent","data-testid":"notification-server-error"},{default:l(()=>e[1]||(e[1]=[i(" Er is iets misgegaan."),f("br",null,null,-1),i("Probeer opnieuw. ")])),_:1})):W("",!0),f("section",X,[v(t(z),{class:"sms-toggle",name:"toggle-sms","data-testid":"toggle-sms",checked:t(s).value,disabled:t(n),loading:t(n),onChange:U},{description:l(()=>e[2]||(e[2]=[i(" We sturen een SMS met de verwachte aankomsttijd van de bezorger. Als je SMS inschakelt, worden pushmeldingen in de app uitgeschakeld. ")])),default:l(()=>[e[3]||(e[3]=i(" Ik wil SMS berichten ontvangen "))]),_:1},8,["checked","disabled","loading"])]),v(K,{title:"Pushmeldingen worden uitgeschakeld",show:t(c),"confirmation-text":"Ja, sla voorkeuren op","cancellation-text":"Nee",onAgreed:_,onCancelled:j},{default:l(()=>e[4]||(e[4]=[f("p",null,"Als je SMS inschakelt, worden pushmeldingen in de app uitgeschakeld",-1)])),_:1},8,["show"]),v(t(Z),{class:"my-snackbar",visible:t(m),success:"",onDismiss:e[0]||(e[0]=S=>m.value=!1)},{default:l(()=>e[5]||(e[5]=[i(" Jouw keuze is opgeslagen ")])),_:1},8,["visible"])]),_:1},8,["breadcrumbs"]))}}),Ce=H(Y,[["__scopeId","data-v-1f694265"]]);export{Ce as default};
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.