1import{a as L}from"./chunk-KLJHVFNZ.js";import{a as V}from"./chunk-3SVZFVRD.js";import"./chunk-AY2GT5RS.js";import{a as G}from"./chunk-RFOBNJQH.js";import"./chunk-WZSF2MJM.js";import{b as N}from"./chunk-JTAUWRYJ.js";import"./chunk-TK6ZCEM3.js";import"./chunk-BQEWEUWG.js";import"./chunk-45MPTPEU.js";import"./chunk-BD2PKRY6.js";import{a as $}from"./chunk-YZ4MIJRL.js";import"./chunk-3YLG643I.js";import{a as A}from"./chunk-JKT7J6LB.js";import{a as R}from"./chunk-Y3PN5BSJ.js";import"./chunk-R4UTJ2DX.js";import"./chunk-RPM7JARY.js";import"./chunk-72TIUP6P.js";import"./chunk-KOPZETE2.js";import"./chunk-VLOO5O7Z.js";import"./chunk-NB7D3KAH.js";import"./chunk-HRH6ARC7.js";import"./chunk-HE6SPJF2.js";import{r as p}from"./chunk-E457NSCN.js";import{a as B,b as q}from"./chunk-RXWTHBJM.js";import"./chunk-77XYNVEL.js";import"./chunk-4SNYSAET.js";import"./chunk-GAJUY3IC.js";import"./chunk-QJ5AWP4N.js";import"./chunk-6YWIV6Q4.js";import"./chunk-MDJUHEDQ.js";import"./chunk-MES46NTK.js";import"./chunk-SA3FXKEZ.js";import{r as E}from"./chunk-VGJNR7UK.js";import"./chunk-XFDPYF6F.js";import{Bb as T,a as d,d as D}from"./chunk-KXQ22SIX.js";import"./chunk-RC4AHRA5.js";import"./chunk-DDJWHZK7.js";import{Hc as f,Jc as g,Ma as a,N as x,Nc as c,Oc as s,Pc as m,Qc as u,Tb as o,Wa as _,Xa as y,Xc as S,ab as k,cd as M,ed as l,hb as v,ia as P,ie as I,lc as U,q as w,td as h,va as O,y as C}from"./chunk-VKCGIC6R.js";import"./chunk-2ZPGY3SD.js";function j(i,e){i&1&&u(0,"div",1)(1,"div",2)(2,"div",3)(3,"div",4)(4,"div",5)(5,"div",6)}function Y(i,e){if(i&1){let t=S();s(0,"div"),u(1,"ui-heading",7),s(2,"p",8),h(3," You\u2019re unsubscribing from "),u(4,"br")(5,"ui-label",9),m(),s(6,"p",8),h(7," You will no longer receive emails or SMSes regarding "),u(8,"br")(9,"ui-label",9),m()(),s(10,"div")(11,"ui-button",10),M("click",function(){_(t);let r=l(3);return y(r.confirm())}),m()(),u(12,"ui-label",11),s(13,"ui-label",12),h(14,"legalRichText"),m()}if(i&2){let t=e,n=l(3);o(),c("text",t==null?null:t.headingText),o(4),c("text",n.preferenceName),o(4),c("text",n.preferenceDescription),o(2),c("type",n.buttonTypeEnum.SUBMIT)("text",t==null?null:t.confirmButtonText),o(),c("text",t==null?null:t.communicationPreferencePortalRichText),o(),c("text",t==null?null:t.legalRichText)}}function z(i,e){if(i&1&&f(0,Y,15,7),i&2){let t,n=l(2);g((t=n.cms())?0:-1,t)}}function F(i,e){if(i&1&&f(0,j,6,0)(1,z,1,1),i&2){let t=l();g(t.loadingState()?0:1)}}function H(i,e){if(i&1){let t=S();s(0,"ui-error-state",13),M("retryEvent",function(){_(t);let r=l();return y(r.getData())}),m()}}var W=class i{constructor(){this.changeRef=a(I);this.cmsComponent=a(E);this.communicationPreferencesService=a(L);this.router=a(T);this.userService=a(N);this.errorState=v(!1);this.loadingState=v(!0);this.updateSuccess$=this.userService.updateCommunicationPreferencesSuccess$();this.buttonTypeEnum=B;this.cms=D(this.cmsComponent.data$);this.destroyRef=a(k)}ngOnInit(){this.userService.resetUpdateUserCommunicationPreferences(),this.communicationPreferencesService.loadCommunicationPreferences(),this.router.getRouterState().pipe(P(),C(e=>e.state.queryParams)).subscribe(e=>{this.queryParamBusinessPartnerGuid=e.businesspartnerguid,this.queryParamAttribute=e.attribute,this.queryParamAttributeSet=e.attributeset,this.userService.loadAnonUserCommunicationPreferences(this.queryParamBusinessPartnerGuid),this.getData()}),this.communicationPreferencesService.isCommunicationPreferencesError$().pipe(d(this.destroyRef)).subscribe(e=>{this.errorState.set(e)}),this.updateSuccess$.pipe(x(e=>e),d(this.destroyRef)).subscribe(()=>{this.router.go("/unsubscribe/success")}),this.userService.userCommunicationPreferencesError$().pipe(d(this.destroyRef)).subscribe(e=>{this.errorState.set(e)}),this.communicationPreferencesService.getCommunicationPreferences$().pipe(x(p.isArrayAndNotEmpty),P(),C(e=>this.getDetails(e)),O(e=>{if(!p.isStringAndNotEmpty(e.displayName)&&!p.isStringAndNotEmpty(e.preferenceDescription))throw new Error("invalid");return w(e)}),d(this.destroyRef)).subscribe({next:e=>{this.loadingState.set(!1),p.isNullOrUndefined(e)?this.errorState.set(!0):(this.preferenceName=e.displayName,this.preferenceDescription=e.preferenceDescription,this.errorState.set(!1),this.loadingState.set(!1)),this.changeRef.detectChanges()},error:()=>{this.errorState.set(!0),this.loadingState.set(!1),this.changeRef.detectChanges()}})}getData(){this.loadingState.set(!0),this.errorState.set(!1),p.isNullOrUndefined(this.queryParamBusinessPartnerGuid)?(this.loadingState.set(!1),this.errorState.set(!0)):this.userService.loadAnonUserCommunicationPreferences(this.queryParamBusinessPartnerGuid)}confirm(){this.userService.userCommunicationPreferencesResponse$().subscribe(e=>{let t=[];for(let n of e){let r={communicationPreferenceId:n.communicationPreferenceId,deliveryMethod:n.deliveryMethod,editable:n.editable,optedIn:n.optedIn};n.communicationPreferenceId===this.preferenceName&&n.deliveryMethod==="EMAIL"&&(r.optedIn=!1),t.push(r)}this.userService.updateAnonUserCommunicationPreferences(t,this.queryParamBusinessPartnerGuid)})}getDetails(e){if(e.length)for(let t=0;t<e.length;++t){let n=e[t].preferences;if(n.length)for(let r=0;r<n.length;++r){let b=n[r];if(b.forEmailCrmMarketingAttribute===this.queryParamAttribute&&b.forEmailCrmAttributeSet===this.queryParamAttributeSet)return{displayName:b.displayName,preferenceDescription:b.description}}}return{displayName:"",preferenceDescription:""}}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=U({type:i,selectors:[["cms-unsubscribe"]],standalone:!1,decls:3,vars:1,consts:[[1,"container","text-center"],[1,"skeletonText","unsubscribe-skeleton-header"],[1,"skeletonText","unsubscribe-skeleton-preference-name"],[1,"skeletonText","unsubscribe-skeleton-preference"],[1,"skeletonText","unsubscribe-skeleton-button"],[1,"skeletonText","unsubscribe-skeleton-main"],[1,"skeletonText","unsubscribe-skeleton-legal"],[3,"text"],[1,"unsubscribe-paragraph"],["tiny","",1,"preferenceName",3,"text"],[3,"click","type","text"],["tiny","",1,"unsubscribe-rich-text",3,"text"],["tiny","",3,"text"],[3,"retryEvent"]],template:function(t,n){t&1&&(s(0,"div",0),f(1,F,2,1)(2,H,1,0,"ui-error-state"),m()),t&2&&(o(),g(n.errorState()?2:1))},dependencies:[q,$,G,R,A,V],styles:["[_nghost-%COMP%] .preferenceName[_ngcontent-%COMP%]{font-weight:500;display:inline-block;margin-bottom:10px}
1[_nghost-%COMP%] .unsubscribe-skeleton-preference-name[_ngcontent-%COMP%]{height:30px;margin-bottom:20px;width:100%;max-width:165px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-preference-name[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-skeleton-preference[_ngcontent-%COMP%]{height:30px;margin-bottom:20px;width:100%;max-width:330px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-preference[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-skeleton-button[_ngcontent-%COMP%]{height:44px;margin-bottom:20px;width:100%;max-width:150px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-button[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-skeleton-main[_ngcontent-%COMP%]{height:50px;margin-bottom:20px;width:100%;max-width:870px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-main[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-skeleton-header[_ngcontent-%COMP%]{height:29px;margin-bottom:20px;width:100%;max-width:132px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-header[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-skeleton-legal[_ngcontent-%COMP%]{height:25px;margin-top:50px;width:100%;max-width:160px;display:block;margin-left:auto;margin-right:auto}@media(max-width:900px){[_nghost-%COMP%] .unsubscribe-skeleton-legal[_ngcontent-%COMP%]{width:100%}}[_nghost-%COMP%] .unsubscribe-paragraph[_ngcontent-%COMP%]{font-size:13px;font-weight:600}[_nghost-%COMP%] .unsubscribe-rich-text[_ngcontent-%COMP%]{margin-bottom:50px}@media(max-width:900px){[_nghost-%COMP%] .desktop-only[_ngcontent-%COMP%]{display:none}}"],changeDetection:0})}};export{W as UnsubscribeComponent};
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.