1import{$ as l,$a as k,$c as Re,$e as Je,A as U,B,Bc as Pe,Ca as g,Cb as me,Fa as L,Ga as s,L as q,La as Z,Ld as Ue,Ma as ee,Na as te,Nb as ue,Od as Be,Q as y,R as A,Ra as P,Rb as Ce,Sa as f,Sd as ke,Ta as v,Ua as M,Wc as Ie,Xa as ne,Xc as ye,Y as Q,_ as K,_a as ie,_c as Ae,_d as Ve,aa as h,ac as V,af as Ge,bc as de,c as D,cb as S,cc as ge,db as T,e as Y,ec as $,fb as I,fc as fe,fd as Le,gc as Se,gd as ve,hb as oe,hc as Te,hd as Me,ia as _,ic as he,j as F,jc as be,ka as a,l as j,nc as Ee,ne as ze,oc as xe,pc as z,qb as ae,qc as Oe,qd as $e,rb as le,rc as Ne,s as X,sa as p,sb as re,t as w,ta as c,tb as ce,ua as u,ub as se,v as W,va as O,vd as Fe,wa as b,wd as we,x as H,xa as N,xb as pe,xe as J,ya as R,yb as _e}from"./chunk-6ULPYS7P.js";var De=e=>({"m-t-40":e}),Ye=(e,o)=>({channelId:e,subscriptionId:o}),je=(e,o)=>({period:e,isSelected:o});function Xe(e,o){e&1&&N(0);}function We(e,o){if(e&1&&(O(0),_(1,Xe,1,0,"ng-container",22),b()),e&2){s(3);let t=P(11);l(),a("ngTemplateOutlet",t);}}function He(e,o){e&1&&N(0);}function qe(e,o){if(e&1&&(O(0),_(1,He,1,0,"ng-container",22),b()),e&2){s(3);let t=P(3);l(),a("ngTemplateOutlet",t);}}function Qe(e,o){e&1&&N(0);}function Ke(e,o){if(e&1&&(O(0),_(1,Qe,1,0,"ng-container",23),b()),e&2){let t=s().ngIf,n=s().ngIf;s();let i=P(7);l(),a("ngTemplateOutlet",i)("ngTemplateOutletContext",k(2,Ye,n.docId,t.docId));}}function Ze(e,o){e&1&&N(0);}function et(e,o){if(e&1&&(O(0),_(1,Ze,1,0,"ng-container",22),b()),e&2){s(3);let t=P(9);l(),a("ngTemplateOutlet",t);}}function tt(e,o){if(e&1){let t=R();p(0,"yo-button",24),L("click",function(){y(t);let i=s(3);return A(i.goToStep(i.stepsConfig[i.step].nextStep.step));}),u(1,"yo-icon",25),p(2,"span",26),f(3),c()();}if(e&2){let t=s(3);a("fullWidth",!0)("disabled",t.state==="loading"),l(3),M(" ",t.stepsConfig[t.step].nextStep.label," ");}}function nt(e,o){if(e&1){let t=R();O(0,15)(1,16),_(2,We,2,1,"ng-container",17)(3,qe,2,1,"ng-container",17)(4,Ke,2,5,"ng-container",17)(5,et,2,1,"ng-container",17),b(),p(6,"footer",18)(7,"div",19)(8,"yo-button",20),L("click",function(){let i=y(t).ngIf,r=s().ngIf,m=s();return A(m.submit(m.step,r.docId,i.docId));}),f(9),c(),_(10,tt,4,3,"yo-button",21),c()(),b();}if(e&2){let t=s(2);l(),a("ngSwitch",t.step),l(),a("ngSwitchCase","RETENTION"),l(),a("ngSwitchCase","PAUSE_SUBSCRIPTION"),l(),a("ngSwitchCase","CANCEL_SUBSCRIPTION"),l(),a("ngSwitchCase","CONFIRM_CANCEL_SUBSCRIPTION"),l(),a("ngClass",ie(10,De,t.step!=="PAUSE_SUBSCRIPTION")),l(2),a("fullWidth",!0)("loading",t.state==="loading"),l(),M(" ",t.stepsConfig[t.step].submitLabel," "),l(),a("ngIf",t.stepsConfig[t.step].nextStep);}}function it(e,o){if(e&1&&(p(0,"yo-modal",13),_(1,nt,11,12,"ng-container",14),S(2,"async"),c()),e&2){let t=s();a("title",t.title),l(),a("ngIf",T(2,2,t.subscription$));}}function ot(e,o){if(e&1&&(p(0,"yo-list-item"),u(1,"yo-icon",36),p(2,"p"),f(3),c()()),e&2){let t=o.$implicit;l(3),v(t);}}function at(e,o){if(e&1&&(p(0,"section",28)(1,"h2",33),f(2),c(),p(3,"yo-list",34),_(4,ot,4,1,"yo-list-item",35),c()()),e&2){let t=s(2);a("scrollTop",0),l(2),M(" ",t.pauseBehaviour.texts.header," "),l(2),a("ngForOf",t.pausePros);}}function lt(e,o){e&1&&N(0);}function rt(e,o){if(e&1){let t=R();p(0,"li",37),L("click",function(){let i=y(t).$implicit,r=s(2);return A(r.selectedPausePeriod=i.period);}),_(1,lt,1,0,"ng-container",23),c();}if(e&2){let t=o.$implicit,n=s(2),i=P(5);l(),a("ngTemplateOutlet",i)("ngTemplateOutletContext",k(2,je,t,n.selectedPausePeriod===t.period));}}function ct(e,o){if(e&1&&u(0,"img",38),e&2){let t=s(2);a("src",t.pauseBehaviour.texts.promoBlock==null?null:t.pauseBehaviour.texts.promoBlock.imageUrl,K);}}function st(e,o){if(e&1&&(_(0,at,5,3,"section",27),p(1,"section",28)(2,"h2",29),g(3,5),c(),p(4,"ul",30),_(5,rt,2,5,"li",31),c()(),_(6,ct,1,1,"img",32)),e&2){let t=s();a("ngIf",t.pauseBehaviour),l(),a("scrollTop",0),l(4),a("ngForOf",t.pauseBehaviour==null?null:t.pauseBehaviour.periods),l(),a("ngIf",t.pauseBehaviour);}}function pt(e,o){e&1&&u(0,"yo-icon",42);}function _t(e,o){if(e&1&&(p(0,"yo-card",39)(1,"header",40)(2,"h2")(3,"strong"),f(4),c()(),_(5,pt,1,0,"yo-icon",41),c(),p(6,"div")(7,"p"),g(8,6),c(),p(9,"p"),f(10),c()()()),e&2){let t=o.period,n=o.isSelected,i=s();a("isActive",n),l(4),v(t.label),l(),a("ngIf",n),l(5),v(i.getPauseUntilDate(t.period));}}function mt(e,o){if(e&1&&(u(0,"yo-radio",46),S(1,"asFormControl")),e&2){let t=o.$implicit,n=s(2);a("control",T(1,2,n.feedbackForm.controls.reason))("value",t);}}function ut(e,o){if(e&1&&(u(0,"yo-text-field",52),S(1,"asFormControl")),e&2){let t=s(2);a("control",T(1,2,t.feedbackForm.controls.customReason))("label",t.customReasonLabel);}}function Ct(e,o){e&1&&(p(0,"p",53),g(1,9),c());}function dt(e,o){if(e&1){let t=R();p(0,"section",28)(1,"h2",43),g(2,7),c(),p(3,"form",44),L("ngSubmit",function(){let i=y(t),r=i.channelId,m=i.subscriptionId,d=s();return A(d.cancelSubscription(r,m));}),p(4,"yo-radio-group"),_(5,mt,2,4,"yo-radio",45),u(6,"yo-radio",46),S(7,"asFormControl"),c(),_(8,ut,2,4,"yo-text-field",47)(9,Ct,2,0,"p",48),p(10,"section",49)(11,"h2",50),g(12,8),c(),u(13,"yo-text-area",51),S(14,"asFormControl"),c()()();}if(e&2){let t=s();a("scrollTop",0),l(3),a("formGroup",t.feedbackForm),l(2),a("ngForOf",t.cancelReasons),l(),a("control",T(7,9,t.feedbackForm.controls.reason))("value",t.customReasonOption),l(2),a("ngIf",t.feedbackForm.value.reason===t.customReasonOption),l(),a("ngIf",t.state==="error"),l(4),a("control",T(14,11,t.feedbackForm.controls.improvement))("rows",3);}}function gt(e,o){e&1&&(p(0,"section",54)(1,"h2",55),g(2,10),c(),p(3,"p",56),g(4,11),c()()),e&2&&a("scrollTop",0);}function ft(e,o){if(e&1&&u(0,"yo-testimonial",58),e&2){let t=o.$implicit;a("imageUrl",t.imageUrl)("name",t.name)("quote",t.quote)("role",t.role);}}function St(e,o){if(e&1&&(p(0,"section",28)(1,"h2",33),f(2),c(),_(3,ft,1,4,"yo-testimonial",57),c()),e&2){let t=o.ngIf;
1a("scrollTop",0),l(2),v(t.title),l(),a("ngForOf",t.testimonials);}}function Tt(e,o){if(e&1&&(_(0,St,4,3,"section",27),S(1,"async")),e&2){let t=s();a("ngIf",T(1,1,t.retention$));}}var E={cancelInstead:"Cancel instead",completeCancellation:"Complete cancellation",confirmPlanChange:"Confirm plan change",continueWithCancellation:"Continue with cancellation",keepSubscription:"Keep subscription",pauseSubscription:"Pause my subscription",showPauseOptions:"Show me pause options"},zt=(()=>{let o=class o{constructor(n,i,r,m,d,C){this.locale=n,this.ff=i,this.fs=r,this.platformService=m,this.scopeService=d,this.toastService=C,this.onSubscriptionStateChanged=new Q(),this.stepsConfig={RETENTION:{submitLabel:E.keepSubscription,nextStep:{step:"CANCEL_SUBSCRIPTION",label:E.continueWithCancellation}},PAUSE_SUBSCRIPTION:{submitLabel:E.pauseSubscription,nextStep:{step:"CANCEL_SUBSCRIPTION",label:E.continueWithCancellation}},CANCEL_SUBSCRIPTION:{submitLabel:E.keepSubscription,nextStep:{step:"CONFIRM_CANCEL_SUBSCRIPTION",label:E.continueWithCancellation}},CONFIRM_CANCEL_SUBSCRIPTION:{submitLabel:E.completeCancellation}},this.title="Cancel subscription",this.cancelReasons=["I no longer need it","It is too expensive","I found an alternative","Quality was less than expected"],this.pausePros=["Subscription price remain fixed. Any price change during the pause period won\u2019t affect you."],this.state="idle",this.step="CANCEL_SUBSCRIPTION",this.channel$=this.scopeService.listenToChannel(),this.subscription$=new Y(1),this.retention$=this.getRetention$(),this.feedbackForm=new ge({reason:new $("",{nonNullable:!0,validators:[V.required]}),customReason:new $("",{nonNullable:!0,validators:[V.required]}),improvement:new $("",{nonNullable:!0})}),this.customReasonLabel="Please indicate the reason",this.customReasonOption="Other",this.destroy$=new D(),!this.platformService.isServer()&&this.feedbackForm.controls.reason.valueChanges.pipe(B(this.destroy$),X(Boolean)).subscribe(()=>this.state="idle");}open(n,i){this.subscription$.next(n),this.pauseBehaviour=this.getPauseConfig(n,i),this.pauseBehaviour&&(this.pausePros=this.pauseBehaviour.texts.pros,this.selectedPausePeriod=this.pauseBehaviour.periods[0].period),this.setInitialStep(!!this.pauseBehaviour),this.modal?.open();}submit(n,i,r){if(n==="RETENTION"||n==="CANCEL_SUBSCRIPTION")return this.modal?.close();if(n==="PAUSE_SUBSCRIPTION")return this.pauseSubscription(i,r);if(n==="CONFIRM_CANCEL_SUBSCRIPTION")return this.cancelSubscription(i,r);throw new Error("UnhandledCancellationStep::"+n);}goToStep(n){n==="CONFIRM_CANCEL_SUBSCRIPTION"&&!this.isFormValid()||(this.step=n);}cancelSubscription(n,i){if(!this.isFormValid())return;this.state="loading";let{reason:r,customReason:m,improvement:d}=this.feedbackForm.value;Ue(this.ff,n,i,[m||r,d].join(":")).pipe(B(this.destroy$),w(C=>F({success:!1,errorReason:C})),W(1)).subscribe(C=>{if(this.state="idle",this.modal?.close(),!C.success)throw this.toastService.open("Cancellation failed",{type:"error"}),new Error(C.errorReason);this.toastService.open("Subscription has been cancelled"),this.onSubscriptionStateChanged.emit();});}pauseSubscription(n,i){if(this.selectedPausePeriod===void 0)throw new Error("PausePeriodMustBeDefined");this.state="loading",Be(this.ff,n,i,this.selectedPausePeriod).pipe(w(r=>F({success:!1,errorReason:r})),U(r=>{if(!r.success)throw this.modal?.close(),this.toastService.open("Pause subscription failed",{type:"error"}),this.state="error",new Error(r.errorReason);return ke(this.fs,n,i);}),H(r=>r?.status==="PAUSED")).subscribe(()=>{this.state="idle",this.onSubscriptionStateChanged.emit(),this.modal?.close(),this.toastService.open("Subscription has been paused");});}getPauseUntilDate(n){if(n instanceof Date)return J(n,this.locale);let i=new Date();return i.setDate(i.getDate()+n),J(i,this.locale);}isFormValid(){let{reason:n,customReason:i}=this.feedbackForm.controls;return this.feedbackForm.markAllAsTouched(),!n.value||n.value===this.customReasonOption&&!i.value?(this.state="error",!1):!0;}ngOnDestroy(){this.destroy$.next(),this.destroy$.complete();}getPauseConfig(n,i){let r=we(n,i)?Fe(n,i):void 0;if(r)return r.periods=r.periods.filter(({period:m})=>!(m instanceof Date)||m.getTime()>Date.now()),r;}getRetention$(){return this.channel$.pipe(U(n=>(this.state="loading",Ve(this.fs,n.docId))),j(({viewerRetentionSettings:n})=>(this.state="idle",n)));}setInitialStep(n){if(n){this.stepsConfig.RETENTION.nextStep.step="PAUSE_SUBSCRIPTION",this.goToStep("RETENTION");return;}this.goToStep("CANCEL_SUBSCRIPTION");}};o.ɵfac=function(i){return new(i||o)(h(oe),h(Ce),h(ue),h(Ge),h(Je),h(be));},o.ɵcmp=q({type:o,selectors:[["joymo-cancellations"]],viewQuery:function(i,r){if(i&1&&Z(z,5),i&2){let m;
1ee(m=te())&&(r.modal=m.first);}},outputs:{onSubscriptionStateChanged:"onSubscriptionStateChanged"},standalone:!0,features:[ne],decls:12,vars:3,consts:()=>{let n;n=" Please select the pausing period ";let i;i="Pause until";let r;r=" Why have you decided to unsubscribe? ";let m;m=" What do you want to see more of on the platform? ";let d;d=" Please select a reason ";let C;C=" Please confirm the cancellation ";let G;return G=" The subscription will be cancelled at the end of the billing period. You have access to the platform before that date. ",[["suggestPauseTmpl",""],["pausePeriodCard",""],["cancelTmpl",""],["confirmCancelTmpl",""],["retentionTmpl",""],n,i,r,m,d,C,G,[3,"title",4,"ngIf"],[3,"title"],["yo-modal-content","",4,"ngIf"],["yo-modal-content",""],[3,"ngSwitch"],[4,"ngSwitchCase"],[1,"border-t","border-default",3,"ngClass"],[1,"flex","flex-column","md:flex-row","flex-justify-between","flex-align-center","m-t-24","gap-40"],["role","primary",3,"click","fullWidth","loading"],["role","link","iconPosition","RIGHT","class","flex gap-4 flex-align-center clickable",3,"fullWidth","disabled","click",4,"ngIf"],[4,"ngTemplateOutlet"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["role","link","iconPosition","RIGHT",1,"flex","gap-4","flex-align-center","clickable",3,"click","fullWidth","disabled"],["icon","arrow_right"],[1,"text-semibold"],[3,"scrollTop",4,"ngIf"],[3,"scrollTop"],[1,"text-lg","text-semibold","m-t-40","md:m-t-48"],[1,"flex","flex-wrap","gap-8","md:gap-12","m-t-16","md:m-t-24","m-b-40","md:m-b-48"],["class","clickable",3,"click",4,"ngFor","ngForOf"],["class","block w-100 m-x-auto",3,"src",4,"ngIf"],[1,"text-lg","text-semibold","md:p-t-24"],[1,"m-t-16","md:m-t-24","gap-12","text-md-spacious"],[4,"ngFor","ngForOf"],["icon","check_solid","yo-list-item-icon",""],[1,"clickable",3,"click"],[1,"block","w-100","m-x-auto",3,"src"],[1,"h-100","flex","flex-column","gap-24","flex-justify-between","text-md",3,"isActive"],[1,"flex","flex-justify-between","flex-align-start"],["icon","check_solid","size","lg",4,"ngIf"],["icon","check_solid","size","lg"],[1,"p-b-16","md:p-y-24","text-lg","text-semibold"],[1,"flex","flex-column",3,"ngSubmit","formGroup"],["name","reason",3,"control","value",4,"ngFor","ngForOf"],["name","reason",3,"control","value"],["class","m-t-20",3,"control","label",4,"ngIf"],["class","text-danger m-t-24",4,"ngIf"],[1,"m-t-40","md:m-t-48"],[1,"text-lg","text-semibold","p-b-8","md:p-b-16"],["name","improvement",3,"control","rows"],[1,"m-t-20",3,"control","label"],[1,"text-danger","m-t-24"],[1,"flex","flex-column","gap-8",3,"scrollTop"],[1,"text-lg","text-semibold","m-b-8"],[1,"text-md","text-md-spacious"],["class","block p-t-24",3,"imageUrl","name","quote","role",4,"ngFor","ngForOf"],[1,"block","p-t-24",3,"imageUrl","name","quote","role"]];},template:function(i,r){i&1&&(_(0,it,3,4,"yo-modal",12),S(1,"async"),_(2,st,7,4,"ng-template",null,0,I)(4,_t,11,4,"ng-template",null,1,I)(6,dt,15,13,"ng-template",null,2,I)(8,gt,5,1,"ng-template",null,3,I)(10,Tt,2,3,"ng-template",null,4,I)),i&2&&a("ngIf",T(1,1,r.channel$));},dependencies:[me,ae,le,re,pe,ce,se,_e,z,Ne,Oe,ye,Ie,Re,Te,fe,de,he,Se,xe,Ee,Ae,Pe,Me,Le,ve,ze,$e],styles:["yo-modal[_ngcontent-%COMP%] h2[_ngcontent-%COMP%], yo-modal[_ngcontent-%COMP%] section[_ngcontent-%COMP%]{max-width:572px}yo-modal[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{max-width:460px}footer[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--text-highlight-color)}footer[_ngcontent-%COMP%] yo-button[_ngcontent-%COMP%]{width:100%}@media (min-width: 768px){footer[_ngcontent-%COMP%] yo-button[_ngcontent-%COMP%]{width:auto}}yo-list-item[_ngcontent-%COMP%] yo-icon[_ngcontent-%COMP%], yo-card[_ngcontent-%COMP%] yo-icon[_ngcontent-%COMP%]{color:var(--accent-color)}ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{flex-basis:calc(50% - 4px)}@media (min-width: 768px){ul[_ngcontent-%COMP%] li[_ngcontent-%COMP%]{flex-basis:calc(33% - 8px)}}"]});let e=o;return e;})();export{zt as a};/**i18n:97d16af80b9e941913080ec17ee9bbcf9996ba7c137660b21174b8d4b6f2b4aa*/ //# sourceMappingURL=chunk-KYWR4BDX.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.