1import{a as m}from"./vendor-CGK3-ZBd.js";import{_ as f,L as h}from"./main-BTCL6hId.js";import{q as _,a as r,m as i,u as l,F as b,D as k,e as o,y as d,f as y}from"./vue-C_5Xpcpw.js";const v={components:{LoadingIndicator:h},props:{mailingListData:{type:Array,required:!0},siteId:{type:Number,default:1}},data(){return{lists:this.mailingListData.map(s=>({...s})),error:null,success:!1,loading:!1,message:null}},computed:{csrfName(){return window.csrfTokenName},csrfToken(){return window.csrfTokenValue}},methods:{toggleSubscription(s,a){const u=s.subscribed;s.subscribed=a,this.loading=!0,this.error=null,this.success=!1,this.message=null;let c,e=new FormData;e.append(this.csrfName,this.csrfToken),a?(c="/actions/campaign/contacts/subscribe-mailing-list",e.append("contactId",s.contactId),e.append("mailingListId",s.id)):(c="/actions/campaign/contacts/unsubscribe-mailing-list",e.append("contactId",s.contactId),e.append("mailingListId",s.id)),m({method:"post",url:c,data:e,headers:{Accept:"application/json"}}).then(n=>{this.success=!0,this.message=`Aanmelding ${a?"bevestigd":"geannuleerd"}`,this.$logger(n)}).catch(n=>{s.subscribed=u,this.error=!0,this.message="Er is een fout opgetreden tijdens het aan of afmelden.",this.$logger(n,"error")}).finally(()=>{this.loading=!1})}}},I={class:"mailing-preferences"},L=["for"],w=["for"],N=["id","checked","onChange","disabled","aria-label"],D={key:0,class:"mailing-preferences__loading",role:"status"},x={key:1,class:"profile-status profile-status--success",role:"status"},C={key:2,class:"profile-status profile-status--error",role:"alert"};function S(s,a,u,c,e,n){const p=_("loading-indicator");return i(),r("div",I,[(i(!0),r(b,null,k(e.lists,t=>(i(),r("div",{key:t.id,class:"profile-setting-row mailing-preferences__item"},[o("label",{class:"profile-setting-row__copy",for:"list-"+t.id},[o("strong",null,d(t.name),1)],8,L),o("div",null,[o("label",{class:"profile-toggle",for:"list-"+t.id},[o("input",{type:"checkbox",id:"list-"+t.id,checked:t.subscribed,onChange:g=>n.toggleSubscription(t,g.target.checked),disabled:e.loading,"aria-label":t.name},null,40,N),a[0]||(a[0]=o("span",{class:"profile-toggle__track","aria-hidden":"true"},null,-1))],8,w)])]))),128)),e.loading?(i(),r("div",D,[y(p)])):l("",!0),e.success?(i(),r("div",x,d(e.message),1)):l("",!0),e.error?(i(),r("div",C,d(e.message),1)):l("",!0)])}const B=f(v,[["render",S]]);export{B as default}; 2//# sourceMappingURL=MailingListManager-D3puWB-B.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.