PageSourceSearch

https://members.britishscreenforum.co.uk/607.d32bdaeb5d834916.js

js britishscreenforum.co.uk collected 2026-10-05 05:15:58 UTC 40,869 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkVeryConnect=self.webpackChunkVeryConnect||[]).push([[607],{60607:(Gt,J,i)=>{i.r(J),i.d(J,{PaymentModalComponent:()=>F});var E=i(64762),Q=i(88990),$=i(82668),M=i(92194),f=i(662),c=i(5296),_=i(7647),at=i(16733),t=i(14026),C=i(33606),Zt=i(5891),ot=i(71050),Dt=i(43383),Nt=i(25989),P=i(25336),h=i(41958),Ft=i(30288),$t=i(11022),w=i(9004),wt=i(31667),m=i(50725),d=i(85597),l=i(3811),b=i(75372),y=i(60407),Bt=i(65399),B=i(89969),R=i(91696),A=i(87563),Y=i(35260),u=i(77748),Z=i(55324),Yt=i(98992),Ht=i(91786),L=i(97482),Jt=i(88462),W=i(89763),Qt=i(90489),lt=i(78425),j=i(10174),pt=i(87399),ct=i(56625),X=i(38464),U=i(45877),Lt=i(35673),Wt=i(20880),Vt=i(62759),mt=i(7670),dt=i(10319),Kt=i(8909),ut=i(15811),kt=i(80951),ht=i(36281),q=i(24651),tt=i(31841),et=i(75143),T=i(68688),x=i(64177),V=i(10218),nt=i(78798),K=i(22009),st=i(64683);function zt(r,e){if(1&r&&(t.TgZ(0,"div",10),t._uU(1),t.ALo(2,"tr"),t.qZA()),2&r){const n=t.oxw().txt;t.xp6(1),t.Oqu(t.lcZ(2,1,n.noAccounts))}}function jt(r,e){if(1&r){const n=t.EpF();t.TgZ(0,"tg-go-cardless-accounts-table",11),t.NdJ("selectedChange",function(a){t.CHM(n);const o=t.oxw(2);return t.KtG(o.selected=a)})("onRemove",function(a){t.CHM(n);const o=t.oxw().ctxKey,p=t.oxw();return t.KtG(p.onRm(o,a))}),t.qZA()}if(2&r){const n=t.oxw().accounts,s=t.oxw();t.Q6J("selected",s.selected)("items",n)("canSelect",!0)("canRemove",!1)}}function Xt(r,e){if(1&r){const n=t.EpF();t.YNc(0,zt,3,3,"ng-template",null,4,t.W1O),t._UZ(2,"h4",5),t.YNc(3,jt,1,4,"tg-go-cardless-accounts-table",6),t.TgZ(4,"tg-new-go-cardless-account",7),t.NdJ("flowCreated",function(a){t.CHM(n);const o=t.MAs(6),p=t.oxw();return o.appendFlow(a),t.KtG(p.onFlowCreated())}),t.qZA(),t.TgZ(5,"tg-go-cardless-flow-table",8,9),t.NdJ("accCreated",function(a){const p=t.CHM(n).ctxKey,g=t.oxw();return t.KtG(g.onAccAdded(p,a))})("missing",function(){const o=t.CHM(n).ctxKey,p=t.oxw();return t.KtG(p.onMissing(o))}),t._uU(7),t.ALo(8,"tr"),t.qZA()}if(2&r){const n=e.accounts,s=e.payer,a=e.txt,o=t.MAs(1);t.xp6(2),t.Q6J("translate",a.heading),t.xp6(1),t.Q6J("ngIf",n.length)("ngIfElse",o),t.xp6(1),t.Q6J("payerID",s.id)("payerType",s.type)("existingAccounts",n),t.xp6(1),t.Q6J("payerId",s.id)("payerType",s.type),t.xp6(2),t.Oqu(t.lcZ(8,9,"pendingAccounts"))}}function qt(r,e){1&r&&t._UZ(0,"div",12),2&r&&t.Q6J("translate","goCardlessDailySub")}function te(r,e){1&r&&t._UZ(0,"tg-loader-spinner-lg")}function ee(r,e){if(1&r&&t.GkF(0,13),2&r){const n=t.oxw(3),s=t.MAs(1);t.Q6J("ngTemplateOutlet",s)("ngTemplateOutletContext",n.ctxGroup)}}function ne(r,e){if(1&r&&(t.GkF(0,13),t.YNc(1,ee,1,2,"ng-container",14)),2&r){const n=t.oxw(2),s=t.MAs(1);t.Q6J("ngTemplateOutlet",s)("ngTemplateOutletContext",n.ctxPersonal),t.xp6(1),t.Q6J("ngIf",n.ctxGroup.show)}}function se(r,e){if(1&r&&t.YNc(0,ne,2,3,"ng-template",3),2&r){const n=t.oxw(),s=t.MAs(3);t.Q6J("ngIf",!n.isDailyIntervalSubscription)("ngIfElse",s)}}class D{constructor(e,n,s,a,o,p,g){this.cdr=e,this.gcRes=n,this.chargeRes=s,this.membRes=a,this.actions$=o,this.uSvc=p,this.runtime=g,this.dailySubWarning=new t.vpe,this.isDailyIntervalSubscription=!1,this.ready=!1,this.autoSelectCreated=(0,t.f3M)(Vt.W).autoSelectCreatedPaymentMethod,this._destroyed$=this.dailySubWarning.pipe((0,ct.Z)(null,null)),this.stateWhenReady$=g.store.pipe((0,X.P)(v=>Boolean(v.payer_id&&v.payer_type)))}get selected(){return this._selected}set selected(e){this._selected=e,this.runtime.setProviderValid(u.O.GOCARDLESS,Boolean(e))}ngOnDestroy(){this.dailySubWarning.complete()}ngOnInit(){this.initPaymentListener(),this.initAccountInUse(),this.initInitialContexts(),this.initDailySubAlert()}onAccAdded(e,n){this.getMembershipExpiry().pipe((0,y.q)(1)).subscribe(s=>{this[e].accounts=[...this[e].accounts,k(n,s)],this.runtime.set("saving_payment_method",!1),this.autoSelectCreated&&(this.selected=n),this.cdr.markForCheck()})}onFlowCreated(){this.runtime.set("saving_payment_method",!0)}onMissing(e){(0,w.D)([this.gcRes.query({params:{[this[e].payer.type]:this[e].payer.id,noredirect:1}}),this.getMembershipExpiry().pipe((0,y.q)(1))]).subscribe((0,f.e)(([s,a])=>{this[e]={...this[e],accounts:s.map(o=>k(o,a))},this.cdr.markForCheck()}))}onRm(e,n){const s=this[e].accounts.findIndex(o=>o.id===n.id);if(-1===s)return;const a=[...this[e].accounts];a.splice(s,1),this[e]={...this[e],accounts:a},this.cdr.markForCheck()}begin(){return this.runtime.pluck("purchase_type").pipe((0,X.P)(Boolean),(0,d.R)(this._destroyed$),(0,U.z)(e=>"membershipSubsUpdate"===e?this.changePaymentMethod():this.pay()))}changePaymentMethod(){return this.stateWhenReady$.pipe((0,d.R)(this._destroyed$),(0,U.z)(e=>this.membRes.setSubscriptionPayment({[e.payer_type]:e.payer_id,new_payment_method:this.selected.id,provider:u.O.GOCARDLESS})),(0,B.b)(()=>{this.runtime.finishPayment({})}),(0,A.K)(this.paymentErrorCatcher))}getMembershipExpiry(){return this.stateWhenReady$.pipe((0,l.w)(({payer_id:e,payer_type:n})=>this.runtime.pluck("membership").pipe((0,R.x)(),(0,m.U)(s=>({membership:s,payer_id:e,payer_type:n})))),(0,l.w)(e=>{if(e.membership?.type===Wt.MembershipType.SUBSCRIPTION)switch(e.payer_type){case"user":return this.uSvc.latest("user","membership_expires");case"group":return this.uSvc.resourcefulStore.pipe((0,y.q)(1),(0,m.U)(n=>n.user.getGroupMembershipExpiry(e.payer_id,!0)))}return(0,P.of)(void 0)}),(0,R.x)(),(0,c.H)("[GC.getMembershipExpiry]"))}initAccountInUse(){this.runtime.pluck("current_payment_method").pipe((0,j.p)(),(0,d.R)(this._destroyed$)).subscribe(e=>{this.accountInUse=e,this.cdr.markForCheck()})}initCtxGroup(e){const n={accounts:[],ctxKey:"ctxGroup",payer:{id:e.payer_id,type:"group"},show:!1,txt:{heading:"groupAccounts",noAccounts:"noGroupAccounts"}};return e.show_group?this.gcRes.query({params:{group:e.payer_id,noredirect:1}}).pipe((0,m.U)(s=>(n.accounts=s,n.show=!0,n))):(0,P.of)(n)}initCtxPersonal(e){let n;switch(e.payer_type){case"user":case"pending_member":n=(0,P.of)([e.payer_id,e.payer_type]);break;default:n=this.uSvc.latest("user","id").pipe((0,m.U)(s=>[s,"user"]))}return n.pipe((0,l.w)(([s,a])=>this.gcRes.query({params:{[a]:s,noredirect:1}}).pipe((0,m.U)(o=>({accounts:o,ctxKey:"ctxPersonal",payer:{id:s,type:a},show:!0,txt:e.show_group?{heading:"personalAccounts",noAccounts:"noPersonalAccounts"}:{heading:"existingAccounts",noAccounts:"noExistingAccounts"}})))),(0,c.H)("[GC.initInitialContexts.personal]"))}initDailySubAlert(){this.runtime.isSubscription(!0).pipe((0,l.w)(e=>e?this.runtime.latest("subscription_recurrence").pipe((0,m.U)(n=>"daily"===n)):(0,P.of)(!1)),(0,d.R)(this._destroyed$)).subscribe(e=>{this.isDailyIntervalSubscription=e,this.cdr.markForCheck(),e&&this.dailySubWarning.emit()})}initInitialContexts(){this.stateWhenReady$.pipe((0,l.w)(e=>(0,w.D)([this.initCtxPersonal(e),this.initCtxGroup(e)])),(0,l.w)(e=>this.getMembershipExpiry().pipe((0,y.q)(1),(0,l.w)(n=>{const s=a=>k(a,n);for(const a of e)a.accounts=a.accounts.map(s);return this.ctxPersonal=e[0],this.ctxGroup=e[1],this.ready=!0,this.tryAutoSelect(),this.cdr.markForCheck(),this.getMembershipExpiry().pipe((0,Lt.T)(1))}))),(0,c.H)("[GC.initInitialContexts]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{const n=s=>k(s,e);for(const s of[this.ctxPersonal,this.ctxGroup])s.accounts=s.accounts.map(n);this.cdr.markForCheck()}))}initPaymentListener(){this.runtime.pluck("provider").pipe((0,R.x)(),(0,l.w)(e=>e===u.O.GOCARDLESS?this.actions$:h.E),(0,C.l4)("payment:begin"),(0,d.R)(this._destroyed$),(0,U.z)(()=>this.begin()),(0,c.H)("[GoCardless payment listener]")).subscribe(M.V)}pay(){return this.runtime.store.pipe((0,X.P)(e=>e.is_subscription_ready&&Boolean(e.payment_ref)),(0,d.R)(this._destroyed$),(0,U.z)(e=>{if(e.is_subscription){const n={payment_method:this.selected.id,payment_ref:e.payment_ref},s={};return e.runtime_flags?.includes(0)&&(s.params={is_renewal:1}),this.chargeRes.createGoCardlessSubscription(n,s)}return this.chargeRes.createGoCardlessCharge({amount:e.amount,payment_method:this.selected.id,payment_ref:e.payment_ref,type:e.charge_type})}),(0,A.K)(this.paymentErrorCatcher))}paymentErrorCatcher(e){return this.runtime.failPayment(e),h.E}tryAutoSelect(){if(this.ctxGroup.show)switch(this.ctxGroup.accounts.length){case 0:1===this.ctxPersonal.accounts.length&&(this.selected=this.ctxPersonal.accounts[0]);break;case 1:0===this.ctxPersonal.accounts.length&&(this.selected=this.ctxGroup.accounts[0])}else 1===this.ctxPersonal.accounts.length&&(this.selected=this.ctxPersonal.accounts[0])}}function k(r,e){return Object.assign(r,{isUsable:!e||pt(r.mandate_created_at).startOf("day").add(1,"year").isAfter(pt(e).startOf("day"))})}D.\u0275fac=function(e){return new(e||D)(t.Y36(t.sBO),t.Y36(ht.U),t.Y36(q.M),t.Y36(tt.k),t.Y36(C.eX),t.Y36(et.KD),t.Y36(T.r))},D.\u0275cmp=t.Xpm({type:D,selectors:[["tg-go-cardless-payment"]],viewQuery:function(e,n){if(1&e&&t.Gf(ut.m,5),2&e){let s;t.iGM(s=t.CRH())&&(n.flowTable=s.first)}},outputs:{dailySubWarning:"dailySubWarning"},standalone:!0,features:[t._Bn([],[{provide:L.z,useValue:"payment"}]),t.jDz],decls:7,vars:2,consts:[["tplTable",""],["tplDailyInterval",""],["tplLoading",""],[3,"ngIf","ngIfElse"],["tplNoAccounts",""],[3,"translate"],["class","mb-2 mt-2",3,"selected","items","canSelect","canRemove","selectedChange","onRemove",4,"ngIf","ngIfElse"],[1,"mb-2","mt-2",3,"payerID","payerType","existingAccounts","flowCreated"],[1,"mb-2","mt-2",3,"payerId","payerType","accCreated","missing"],["tblFlows","tg-gc-flow-tbl"],[1,"alert","alert-warning","text-center"],[1,"mb-2","mt-2",3,"selected","items","canSelect","canRemove","selectedChange","onRemove"],[1,"alert","alert-warning","text-center",3,"translate"],[3,"ngTemplateOutlet","ngTemplateOutletContext"],[3,"ngTemplateOutlet","ngTemplateOutletContext",4,"ngIf"]],template:function(e,n){if(1&e&&(t.YNc(0,Xt,9,11,"ng-template",null,0,t.W1O),t.YNc(2,qt,1,1,"ng-template",null,1,t.W1O),t.YNc(4,te,1,0,"ng-template",null,2,t.W1O),t.YNc(6,se,1,2,"ng-template",3)),2&e){const s=t.MAs(5);t.xp6(6),t.Q6J("ngIf",n.ready)("ngIfElse",s)}},dependencies:[Z.GlobalModule,x.O5,x.tP,V.P,nt.Z,K.a,st.H,Kt.X,kt._,ut.m],styles:["[_nghost-%COMP%]{display:block}"],data:{animation:[mt.Y,dt.b]},changeDetection:0}),(0,E.gn)([(0,lt.h)()],D.prototype,"paymentErrorCatcher",null);var yt=i(17143),I=i(52805),re=i(26477),gt=i(43061),rt=i(51248),ie=i(61958);
1const ft="payment";let ae=(()=>{class r{constructor(){this._sub=[],this.actions$=(0,t.f3M)(C.eX),this.chargeRes=(0,t.f3M)(q.M),this.fb=(0,t.f3M)(I.qu),this.mod=(0,t.f3M)(gt.U),this.runtime=(0,t.f3M)(T.r)}ngOnDestroy(){(0,rt.unsubscribeFromAll)(this._sub)}ngOnInit(){this.poNumberCtrl=this.fb.control("",{nonNullable:!0}),this.initStartPaymentListener()}initStartPaymentListener(){this._sub.push(this.runtime.pluck("provider").pipe((0,m.U)(n=>n===u.O.INVOICE),(0,R.x)(),(0,l.w)(n=>n?this.actions$.pipe((0,C.l4)("payment:begin"),(0,l.w)(()=>this.mod.confirmTranslated("payByInvoiceConfirm",ft).pipe((0,yt.U)(()=>{this.runtime.set("payment_in_progress",!1)}))),(0,l.w)(()=>this.pay())):h.E),(0,c.H)("[InvoiceCheckout.initPaymentListener]")).subscribe(M.V))}pay(){return this.runtime.pluck("payment_ref").pipe((0,_.v)(1),(0,l.w)(n=>this.chargeRes.payByInvoice({payment_ref:n,po_number:this.poNumberCtrl.value})),(0,A.K)(n=>(this.runtime.failPayment(n),h.E)))}}return r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=t.Xpm({type:r,selectors:[["tg-invoice-checkout"]],standalone:!0,features:[t._Bn([],[{provide:L.z,useValue:ft}]),t.jDz],decls:11,vars:11,consts:[[1,"alert","alert-info","text-center",3,"translate"],[1,"form-control",3,"formControl","placeholder"]],template:function(n,s){1&n&&(t._UZ(0,"div",0),t.TgZ(1,"div")(2,"label")(3,"tg-info-bubble"),t._uU(4),t.ALo(5,"tr"),t.qZA(),t.TgZ(6,"span"),t._uU(7),t.ALo(8,"tr"),t.qZA()(),t._UZ(9,"input",1),t.ALo(10,"tr"),t.qZA()),2&n&&(t.Q6J("translate","payByInvoiceModalMsg"),t.xp6(4),t.Oqu(t.lcZ(5,5,"poNumberTooltip")),t.xp6(3),t.hij("",t.lcZ(8,7,"poNumber"),":"),t.xp6(2),t.Q6J("formControl",s.poNumberCtrl)("placeholder",t.lcZ(10,9,"poNumberPlaceholder")))},dependencies:[Z.GlobalModule,V.P,K.a,ie.y,st.H,I.UX,I.Fj,I.JJ,I.oH,re.d],encapsulation:2,changeDetection:0}),r})();var St,Ct=i(84602),vt=i(13913),oe=i(40921),le=i(56229),_t=i(76538),pe=i(11083),ce=i(8194),Pt=i(81499),me=i(19259),de=i(6317),ue=i(70840),bt=i(44622),he=i(44595),xt=i(88765),ye=i(12233),it=i(19807);function ge(r,e){if(1&r){const n=t.EpF();t.TgZ(0,"tg-stripe-card-select",2),t.NdJ("error",function(a){t.CHM(n);const o=t.oxw();return t.KtG(o.onCardError(a))})("saving",function(a){t.CHM(n);const o=t.oxw();return t.KtG(o.onSavingChange(a))})("groupCardsChange",function(a){t.CHM(n);const o=t.oxw();return t.KtG(o.groupCards=a)})("personalCardsChange",function(a){t.CHM(n);const o=t.oxw();return t.KtG(o.personalCards=a)}),t.qZA()}if(2&r){const n=t.oxw();t.Q6J("cardInUse",n.cardInUse)("showGroupCards",n.showGroupCards)("showSaveControl",n.showSaveControl)("groupCards",n.groupCards)("personalCards",n.personalCards)("hideUseSavedCard",n.paymentInProgress&&!n.hadCardsInitially)("isSubscription",n.isSubscription)("payerType",n.payerType)("payerId",n.payerId)("prefills",n.userPrefills)("formControl",n.fcCardSelect)}}function fe(r,e){1&r&&t._UZ(0,"tg-loader-spinner-lg")}const S=Symbol("sub");class G{constructor(e,n,s,a,o,p,g,v,H,dn){this.svc=e,this.uSvc=n,this.fb=s,this.alert=a,this.actions$=o,this.stripeRes=p,this.chargeRes=g,this.membRes=v,this.runtime=H,this.cdr=dn,this.hadCardsInitially=!1,this.paymentInProgress=!1,this.showGroupCards=!1,this[St]=[]}get cardSelectReady(){return void 0!==this.isSubscription&&void 0!==this.showSaveControl&&Boolean(this.userPrefills&&this.payerType&&this.groupCards&&this.personalCards)}ngOnDestroy(){this.delayedPaymentTrigger?.complete(),(0,rt.unsubscribeFromAll)(this[S])}ngOnInit(){this.initCardSelect(),this.initIsSubscriptionAndPayer(),this.initPrefills(),this.initStartPaymentListener(),this.initCards(),this.initDelayedPaymentTrigger(),this.initCardInUse(),this.initShowGroupCards(),this.initPaymentInProgress(),this.initSaveControlShowing()}onCardError(e){!e||this.paymentInProgress||this.runtime.failPayment(e)}onSavingChange(e){this.runtime.set("saving_payment_method",e)}begin(){return this.runtime.pluck("purchase_type").pipe((0,_.v)(1),(0,l.w)(e=>"membershipSubsUpdate"===e?this.updateSubscription():this.pay()))}catchSetPaymentMethodTo(e){return n=>{const s=e.call(this);let a=!1;return s&&(this.cardSelectComponent.uiSwitchToSavedCard(),this.cardSelectComponent.selectedCard=s,this.alert.alert("info",{key:"cardSwitchAlert",ns:"payment"}),this.cardSelectComponent.cdr.detectChanges(),a=!0),this.runtime.failPayment(n),a&&this.cdr.detectChanges(),h.E}}checkResponseForErrors(e){if(e?.error&&!(e instanceof vt.UA)){const n=e.error?.message||e.error;return(0,pe._)(()=>new vt.UA({error:n,status:400}))}return(0,P.of)(e)}initCardInUse(){this[S].push(this.runtime.pluck("current_payment_method").pipe((0,j.p)()).subscribe(e=>{this.cardInUse=e,this.cdr.markForCheck()}))}initCardSelect(){this[S].push((0,ue.observeControlStatus)(this.fcCardSelect=this.fb.control(null)).pipe((0,m.U)(e
1=>"VALID"===e),(0,R.x)()).subscribe(e=>{this.runtime.setProviderValid(u.O.STRIPE,e)}))}initCards(){const e=this.runtime.store.pipe((0,b.h)(a=>Boolean(a.payer_id)&&Boolean(a.payer_type)),(0,y.q)(1)),n=e.pipe((0,l.w)(a=>{switch(a.payer_type){case"user":case"pending_member":return(0,P.of)([a.payer_type,a.payer_id]);default:return this.uSvc.pluck("user","id").pipe((0,_.v)(1),(0,m.U)(o=>["user",o]))}}),(0,l.w)(([a,o])=>this.stripeRes.query({params:{[a]:o,noredirect:1}}))),s=e.pipe((0,l.w)(a=>"group"!==a.payer_type?(0,P.of)([]):this.stripeRes.query({params:{group:a.payer_id,noredirect:1}})));(0,w.D)([n,s]).subscribe(([a,o])=>{this.personalCards=a,this.groupCards=o,this.cdr.markForCheck()})}initDelayedPaymentTrigger(){this[S].push((this.delayedPaymentTrigger=new ce.x).subscribe(e=>{this.runtime.finishPayment(e)}))}initIsSubscriptionAndPayer(){const e=this.runtime.pluck("payer_type").pipe((0,_.v)(1)),n=this.runtime.pluck("payer_id").pipe((0,_.v)(1));this[S].push((0,w.D)([this.runtime.isSubscription(!0),e,n]).subscribe(([s,a,o])=>{this.payerType=a,this.payerId=o,this.isSubscription=s,this.cdr.markForCheck()}))}initPaymentInProgress(){this[S].push(this.runtime.pluck("payment_in_progress").pipe((0,W.N)(this.paymentInProgress)).subscribe(e=>{this.paymentInProgress=e,this.cdr.markForCheck()}))}initPrefills(){this[S].push(this.uSvc.latest("user").pipe((0,m.U)(e=>e||{}),(0,B.b)(e=>{this.userPrefills={address:(0,le.Z)({city:"",country:"",line1:"",line2:"",postcode:"",region:""},(0,_t.Z)(e.address,Boolean),(0,_t.Z)(this.addressPrefill,Boolean)),email:e.email,firstname:e.firstname,lastname:e.lastname};const s=e.mobile_phone??e.phone;s&&(this.userPrefills.phone=(0,de.l)(s)),this.cdr.markForCheck()}),(0,c.H)("[Stripe.initPrefills]")).subscribe(M.V))}initSaveControlShowing(){this.runtime.latest("event_booking_params","isPublicUser").subscribe(e=>{this.showSaveControl=!e,this.cdr.markForCheck()})}initShowGroupCards(){this[S].push(this.runtime.pluck("show_group").pipe((0,W.N)(this.showGroupCards)).subscribe(e=>{this.showGroupCards=e,this.cdr.markForCheck()}))}initStartPaymentListener(){this[S].push(this.runtime.pluck("provider").pipe((0,R.x)(),(0,l.w)(e=>e!==u.O.STRIPE?h.E:this.actions$.pipe((0,C.l4)("payment:begin"),(0,l.w)(()=>this.begin()))),(0,c.H)("[Stripe payment listener]")).subscribe(M.V))}pay(){let e=null;const n=new bt.V(this.cardSelectComponent),s=this.fcCardSelect.value;return this.refreshHadCardsInitially(),this.cdr.detectChanges(),this.runtime.pluck("is_subscription_ready").pipe((0,_.v)(1),(0,l.w)(()=>this.runtime.store),(0,b.h)(a=>Boolean(a.payment_ref)),(0,y.q)(1),(0,U.z)(a=>{if(a.is_subscription){const p=!0===s.cardIsNew?n.save():(0,P.of)(s.card.id),g={};return a.runtime_flags?.includes(0)&&(g.params={is_renewal:1}),p.pipe((0,l.w)(v=>this.chargeRes.createSubscription({payment_method:v,payment_ref:a.payment_ref},{params:g})))}const o={amount:a.amount,payment_ref:a.payment_ref,type:a.charge_type};return!0===s.cardIsNew&&s.payload.save?n.save().pipe((0,l.w)(p=>(o.payment_method=p,this.chargeRes.createPaymentIntent(o))),(0,c.H)("Payment intent creation error")):(!1===s.cardIsNew&&s.card&&(o.payment_method=s.card.id),this.chargeRes.createPaymentIntent(o))}),(0,U.z)(({secret:a,requires_confirmation:o,delayed_payment:p,entity:g})=>{if(p&&(e=g),!o)return(0,P.of)(null);let v;return v=!0===s.cardIsNew?(0,Pt.D)(this.svc.getHandler()).pipe((0,l.w)(H=>H.handleCardPayment(a,s.payload.elements.cardNumber,{payment_method_data:s.payload.payload,save_payment_method:!1}))):(0,Pt.D)(this.svc.getHandler()).pipe((0,l.w)(H=>H.handleCardPayment(a,{payment_method:s.card.id}))),v.pipe((0,l.w)(this.checkResponseForErrors),(0,c.H)("stripe.handleCardPayment error"))}),(0,B.b)(()=>{e&&this.delayedPaymentTrigger.next(e)}),(0,A.K)(this.catchSetPaymentMethodTo(n.getMethod)),(0,me.x)(()=>{this.refreshHadCardsInitially(),this.cdr.detectChanges()}))}refreshHadCardsInitially(){this.hadCardsInitially=Boolean(this.personalCards.length)||Boolean(this.groupCards.length)}updateSubscription(){const e=this.fcCardSelect.value,n=new bt.V(this.cardSelectComponent);return(!0===e.cardIsNew?n.save():(0,P.of)(e.card.id)).pipe((0,U.z)(a=>this.runtime.store.pipe((0,b.h)(o=>Boolean(o.payer_type)&&Boolean(o.payer_id)),(0,y.q)(1),(0,l.w)(({payer_type:o,payer_id:p})=>this.membRes.setSubscriptionPayment({[o]:p,new_payment_method:a,provider:u.O.STRIPE})))),(0,B.b)(()=>{this.delayedPaymentTrigger.next({})}),(0,A.K)(this.catchSetPaymentMethodTo(n.getMethod)))}}St=S,G.\u0275fac=function(e){return new(e||G)(t.Y36(ye.t),t.Y36(et.KD),t.Y36(I.QS),t.Y36(it.c),t.Y36(C.eX),t.Y36(Ct.x),t.Y36(q.M),t.Y36(tt.k),t.Y36(T.r),t.Y36(t.sBO))},G.\u0275cmp=t.Xpm({type:G,selectors:[["tg-payment-stripe"]],viewQuery:function(e,n){if(1&e&&t.Gf(xt.v,5),2&e){let s;t.iGM(s=t.CRH())&&(n.cardSelectComponent=s.first)}},inputs:{addressPrefill:"addressPrefill"},standalone:!0,features:[t.jDz],decls:3,vars:2,consts:[[3,"ngIf","ngIfElse"],["tplLoading",""],[3,"cardInUse","showGroupCards","showSaveControl","groupCards","personalCards","hideUseSavedCard","isSubscription","payerType","payerId","prefills","formControl","error","saving","groupCardsChange","personalCardsChange"]],template:function(e,n){if(1&e&&(t.YNc(0,ge,1,11,"ng-template",0),t.YNc(1,fe,1,0,"ng-template",null,1,t.W1O)),2&e){const s=t.MAs(2);t.Q6J("ngIf",n.cardSelectReady)("ngIfElse",s)}},dependencies:[Z.GlobalModule,x.O5,nt.Z,he.v,xt.v,I.UX,I.JJ,I.oH],styles:["[_nghost-%COMP%]{display:block}"],data:{animation:[mt.Y,dt.b]},changeDetection:0}),(0,E.gn)([(0,oe.a)(!1,!1,Boolean)],G.prototype,"cardSelectReady",null),(0,E.gn)([(0,lt.h)()],G.prototype,"checkResponseForErrors",null);var Mt=i(30290);const Tt="payment";let Ce=(()=>
1{class r{constructor(){this.actions$=(0,t.f3M)(C.eX),this.mod=(0,t.f3M)(gt.U),this.payRefRes=(0,t.f3M)(Mt.y),this.runtime=(0,t.f3M)(T.r)}ngOnDestroy(){this.sub?.unsubscribe()}ngOnInit(){this.sub=this.runtime.pluck("provider").pipe((0,R.x)(),(0,l.w)(n=>n!==u.O.MANUAL?h.E:this.actions$.pipe((0,C.l4)("payment:begin"),(0,l.w)(()=>this.begin()))),(0,c.H)("[Manual payment begin]")).subscribe(M.V)}begin(){return this.mod.confirmTranslated("manualPaymentConfirm",Tt).pipe((0,yt.U)(()=>{this.runtime.set("payment_in_progress",!1)}),(0,l.w)(()=>this.runtime.pluck("payment_ref").pipe((0,_.v)(1),(0,l.w)(n=>this.payRefRes.resolveManual({payment_ref:n},{params:{noredirect:"1"}})),(0,A.K)(n=>(this.runtime.failPayment(n),h.E)))))}}return r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=t.Xpm({type:r,selectors:[["tg-manual-payment"]],standalone:!0,features:[t._Bn([],[{provide:L.z,useValue:Tt}]),t.jDz],decls:1,vars:1,consts:[[1,"alert","alert-info",3,"translate"]],template:function(n,s){1&n&&t._UZ(0,"div",0),2&n&&t.Q6J("translate","manualPaymentHeading")},dependencies:[Z.GlobalModule,V.P,K.a],encapsulation:2,changeDetection:0}),r})();var ve=i(26454),It=i(17241),Rt=i(20813),At=i(37666),_e=i(54074),Pe=i(90237);const be=["tg-payment-btn",""];function xe(r,e){1&r&&t._UZ(0,"tg-loader-spinner",1)}const N="payment";let Se=(()=>{class r{constructor(){this.disabled=!0,this.inProgress=!1,this.cdr=(0,t.f3M)(t.sBO),this.localeCfg=(0,t.f3M)(It.b),this.runtime=(0,t.f3M)(T.r),this.tr=(0,t.f3M)(_e.D),this.trCount=(0,t.f3M)(At.d)}ngOnDestroy(){(0,rt.unsubscribeFromAll)(this._sub)}ngOnInit(){this._sub=[this.initDisableState(),this.initTxt()]}pay(){this.disabled?this.cdr.detectChanges():this.runtime.beginPayment()}initDisableState(){return this.runtime.store.pipe((0,m.U)(n=>[n.saving_payment_method||n.payment_in_progress,n.btn_disabled]),(0,c.H)("[PaymentBtn.initDisableState]")).subscribe((0,f.e)(([n,s])=>{this.inProgress=n,this.disabled=s,this.cdr.markForCheck()}))}initTxt(){return this.runtime.store.pipe((0,m.U)(n=>(0,ve.Z)(n,["amount","amount_with_vat","vat","payment_in_progress","saving_payment_method","is_subscription","subscription_recurrence","subscription_recurrence_count","subscription_setup_fee_amount","purchase_type"])),(0,j.p)(),(0,l.w)(n=>n.saving_payment_method?[this.tr.translate("savingPaymentMethod",N)]:n.payment_in_progress?[this.txtIfInProgress(n)]:"membershipSubsUpdate"===n.purchase_type?[this.tr.translate("update",N)]:n.is_subscription?this.txtIfSubscription(n):this.txtIfOneOff(n)),(0,c.H)("[PaymentBtn.initTxt]")).subscribe((0,f.e)(n=>{this.txt=n,this.cdr.markForCheck()}))}txtIfInProgress(n){let s;return s="membershipSubsUpdate"===n.purchase_type?"updatingPaymentMethod":n.is_subscription?"creatingSubscription":"paymentInProgress",this.tr.translate(s,N)}txtIfOneOff(n){return this.localeCfg.latest("currency").pipe((0,m.U)(s=>{const a=this.tr.translate(Ot(n),N),o={amt:Y.i.formattedAmount(n.amount),currency:s};return n.vat&&(o.vat=Y.i.formattedAmount(n.amount_with_vat)),(0,Rt.o)(a,o)}))}txtIfSubscription(n){let s;if(n.subscription_recurrence){const o=this.tr.translate(`SUBSCRIPTION_INTERVAL_${n.subscription_recurrence}`,N);s=this.trCount.transform(o,n.subscription_recurrence_count)}else s="";const a=this.tr.translate(Ot(n),N);return this.localeCfg.latest("currency").pipe((0,m.U)(o=>{const p={amt:Y.i.formattedAmount(n.amount+(n.subscription_setup_fee_amount||0)),currency:o,interval:s};return n.vat&&(p.vat=Y.i.formattedAmount(n.amount_with_vat)),(0,Rt.o)(a,p)}))}}return r.\u0275fac=function(n){return new(n||r)},r.\u0275cmp=t.Xpm({type:r,selectors:[["button","tg-payment-btn",""]],hostVars:1,hostBindings:function(n,s){1&n&&t.NdJ("click.passive",function(){return s.pay()}),2&n&&t.Ikx("disabled",s.disabled)},inputs:{_unused:["tg-payment-btn","_unused"]},standalone:!0,features:[t.jDz],attrs:be,decls:3,vars:2,consts:[["class","spinner",4,"ngIf"],[1,"spinner"]],template:function(n,s){1&n&&(t.YNc(0,xe,1,0,"tg-loader-spinner",0),t.TgZ(1,"span"),t._uU(2),t.qZA()),2&n&&(t.Q6J("ngIf",s.inProgress),t.xp6(2),t.Oqu(s.txt))},dependencies:[Z.GlobalModule,x.O5,Pe.I],styles:['.spinner[_ngcontent-%COMP%] + span[_ngcontent-%COMP%]:before{content:" "}span[_ngcontent-%COMP%]{white-space:normal}'],changeDetection:0}),r})();function Ot(r){return"donations"===r.purchase_type?"donate":r.vat?"payWithVat":"payNoVat"}var Et=i(92706),Me=i(95517),Te=i(8285);let Ie=(()=>
1{class r{constructor(){this.actions$=(0,t.f3M)(C.eX),this.destroyed$=new Et.c}ngOnDestroy(){(0,$.t)(this.destroyed$)}observePaymentErrors(){const n=this.actions$.pipe((0,C.l4)("payment:fail"),(0,m.U)(a=>a.value)),s=this.actions$.pipe((0,C.l4)("payment:begin"),(0,m.U)(ot.Z));return(0,Me.T)(n,s)}}return r.\u0275fac=function(n){return new(n||r)},r.\u0275dir=t.lG2({type:r,selectors:[["tg-payment-error",3,"error",""]],standalone:!0,features:[t._Bn([{provide:Te.L,useExisting:(0,t.Gpc)(()=>r)}])]}),r})();var Re=i(62743),Ae=i(9803),Oe=i(55238),Ee=i(89751),Ue=i(80884);class O{constructor(){this.alert=(0,t.f3M)(it.c),this.payRefRes=(0,t.f3M)(Mt.y),this.refreshTrigger$=new Ae.X(void 0),this.sock=(0,t.f3M)(Ee.o),this.sockLifetimed=(0,t.f3M)(Ue.S),this.state=(0,t.f3M)(T.r),this.destroyed$=this.refreshTrigger$.pipe((0,ct.Z)())}init(){const e=this.state.store.pipe((0,b.h)(n=>n.can_create_payment_ref),(0,y.q)(1),(0,l.w)(n=>this.listen(n)));return this.state.pluck("purchase_type").pipe((0,_.v)(1),(0,l.w)(n=>"membershipSubsUpdate"===n?h.E:this.refreshTrigger$),(0,l.w)(()=>e),(0,c.H)("[PaymentModal.paymentRefListener]"),(0,A.K)(()=>h.E),(0,Oe.B)(),(0,d.R)(this.destroyed$))}ngOnDestroy(){this.refreshTrigger$.complete()}refreshPaymentRef(){this.refreshTrigger$.next(void 0)}createPaymentRef(e){return this.payRefRes.create({charge_type:e.charge_type,metadata:{[e.payer_type]:e.payer_id,...e[e.params_key]}}).pipe((0,m.U)(n=>n.id))}listen(e){let n,s,a,o=!1;const p=()=>{a&&((0,$.t)(a),a=void 0)};return this.sockLifetimed.create({init:()=>(this.state.set("payment_ref",null),n=void 0,o=!1,this.createPaymentRef(e).pipe((0,m.U)(g=>{n=g,o=!0,this.state.set("payment_ref",n),s?.unsubscribe(),s=this.listenForCompletion()}))),onDisconnect:()=>(p(),a=new Et.c,o=!1,this.alert.alertError({key:"connectOff",ns:"payment"},void 0,{closeNotifier:a,hideCloseBtn:!0,timeout:31536e7}),h.E),onReconnect:()=>(p(),o=!0,this.alert.alertSuccess({key:"connectOn",ns:"payment"}),n?this.payRefRes.reconnect({id:n}).pipe((0,m.U)(v=>{v.done&&this.state.finishPayment(v.entity)})):h.E),teardown:()=>{p(),n&&(o&&this.payRefRes.unlisten({id:n}).subscribe(M.V),n=void 0),s&&(s.unsubscribe(),s=void 0),o=!1}})}listenForCompletion(){return this.sock.on("payment-ref:finished").pipe((0,y.q)(1),(0,c.H)("[PaymentModal.listenForCompletion]")).subscribe((0,f.e)(e=>{e.success?this.state.finishPayment(e.entity):this.state.failPayment(e.error)}))}}O.\u0275fac=function(e){return new(e||O)},O.\u0275prov=t.Yz7({token:O,factory:O.\u0275fac}),(0,E.gn)([Q.qQ.all()],O.prototype,"init",null);var Ge=i(49037),Ze=i(85868),De=i(62441),Ne=i(50339),Fe=i(39805),$e=i(27527);const we=["tplProviderGoCardless"],Be=["tplInvoice"],Ye=["tplProviderManual"],He=["tplProviderStripe"];function Je(r,e){1&r&&t._UZ(0,"tg-loader-spinner-lg")}function Qe(r,e){1&r&&t._UZ(0,"div",12),2&r&&t.Q6J("translate","noProvidersAvailable")}function Le(r,e){if(1&r&&t.GkF(0,19),2&r){const n=t.oxw(3),s=t.MAs(22);t.Q6J("ngTemplateOutlet",n.providerTemplateFor(n.providers[0])||s)}}function We(r,e){1&r&&t._UZ(0,"i",27)}function Ve(r,e){if(1&r){const n=t.EpF();t.TgZ(0,"li",24),t.NdJ("click.passive",function(){const o=t.CHM(n).$implicit,p=t.oxw(4);return t.KtG(p.setSelectedProvider(o))}),t.TgZ(1,"a",25),t.YNc(2,We,1,0,"i",26),t.TgZ(3,"span"),t._uU(4),t.ALo(5,"tr"),t.qZA()()()}if(2&r){const n=e.$implicit,s=t.oxw(4);t.ekj("active",s.selectedProvider===n),t.xp6(1),t.ekj("text-muted",s.goCardlessDailySubWarning&&n===s.PaymentProvider.GOCARDLESS),t.uIk("aria-controls",s.idFor(n)),t.xp6(1),t.Q6J("ngIf",s.goCardlessDailySubWarning&&n===s.PaymentProvider.GOCARDLESS),t.xp6(2),t.Oqu(t.lcZ(5,7,"PROVIDER_TAB_"+n))}}function Ke(r,e){if(1&r&&(t.TgZ(0,"div",28),t.GkF(1,19),t.qZA()),2&r){const n=e.$implicit,s=t.oxw(4),a=t.MAs(22);t.Q6J("id",s.idFor(n))("ngClass",s.selectedProvider===n?s.CLASS_TAB_ACTIVE:""),t.xp6(1),t.Q6J("ngTemplateOutlet",s.providerTemplateFor(n)||a)}}function ke(r,e){if(1&r&&(t.TgZ(0,"ul",20),t.YNc(1,Ve,6,9,"li",21),t.qZA(),t.TgZ(2,"div",22),t.YNc(3,Ke,2,3,"div",23),t.qZA()),2&r){const n=t.oxw(3);t.xp6(1),t.Q6J("ngForOf",n.providers),t.xp6(2),t.Q6J("ngForOf",n.providers)}}const ze=function(r){return{num:r}};function je(r,e){if(1&r&&(t.TgZ(0,"p",32),t._UZ(1,"i",33),t.TgZ(2,"span"),t._uU(3),t.ALo(4,"applyTrPlaceholders"),t.ALo(5,"translateCount"),t.ALo(6,"tr"),t.qZA()()),2&r){const n=t.oxw(5);t.xp6(3),t.Oqu(t.xi3(4,1,t.xi3(5,4,t.lcZ(6,7,"includesTrial"),n.trialDays),t.VKq(9,ze,n.trialDays)))}}function Xe(r,e){1&r&&(t.TgZ(0,"p",32),t._UZ(1,"i",33)(2,"span",34),t.qZA()),2&r&&(t.xp6(2),t.Q6J("translate","includesCoupon"))}function qe(r,e){if(1&r&&(t.TgZ(0,"div",30),t.YNc(1,je,7,11,"p",31),t.YNc(2,Xe,3,1,"p",31),t.qZA()),2&r){const n=t.oxw(4);t.xp6(1),t.Q6J("ngIf",n.trialDays),t.xp6(1),t.Q6J("ngIf",n.hasCoupon)}}function tn(r,e){if(1&r&&t.YNc(0,qe,3,2,"div",29),2&r){const n=t.oxw(3);t.Q6J("ngIf",n.setupFee||n.trialDays||n.hasCoupon)}}function en(r,e){1&r&&t._UZ(0,"div",36),2&r&&t.Q6J("translate","couponNotApplicableToProvider")}function nn(r,e){if(1&r&&t.YNc(0,en,1,1,"div",35),2&r){const n=t.oxw(3);t.Q6J("ngIf",n.hasCoupon)}}function sn(r,e){if(1&r&&(t.ynx(0,13),t.YNc(1,Le,1,1,"ng-template",14),t.YNc(2,ke,4,2,"ng-template",15),t._UZ(3,"tg-payment-error"),t.TgZ(4,"div",16),t._UZ(5,"button",17),t.YNc(6,tn,1,1,"ng-template",4),t.YNc(7,nn,1,1,"ng-template",null,18,t.W1O),t.qZA(),t.BQk()),2&r){const n=t.MAs(8),s=t.oxw(2);t.Q6J("ngSwitch",s.providers.length),t.xp6(1),t.Q6J("ngSwitchCase",1),t.xp6(5),t.Q6J("ngIf",s.selectedProvider===s.PaymentProvider.STRIPE)("ngIfElse",n)}}function rn(r,e){if(1&r&&t.YNc(0,sn,9,4,"ng-template",4),2&r){const n=t.oxw(),s=t.MAs(3);t.Q6J("ngIf",n.providers.length)("ngIfElse",s)}}function an(r,e){if(1&r&&t._UZ(0,"tg-payment-stripe",37),2&r){const n=t.oxw();t.Q6J("addressPrefill",n.addressPrefill)}}function on(r,e){1&r&&t._UZ(0,"tg-manual-payment")}function ln(r,e){if(1&r){const n=t.EpF();t.TgZ(0,"tg-go-cardless-payment",38),t.NdJ("dailySubWarning",function(){t.CHM(n);const a=t.oxw();return t.KtG(a.goCardlessDailySubWarning=!0)}),t.qZA()}}function pn(r,e){1&r&&t._UZ(0,"tg-invoice-checkout")}function cn(r,e){1&r&&t._UZ(0,"div",12),2&r&&t.Q6J("translate","providerUnknown")}const z="payment";class F{constructor(e,n,s,a,o,p,g,v){this.ref=e,this.actions=n,this.membRes=s,this.uSvc=a,this.localeCfg=o,this.cdr=p,this.alert=g,this.state=v,this.CLASS_TAB_ACTIVE=["in","active"],this.PaymentProvider=u.O,this.closable=!1,this.loading=!0,this.goCardlessDailySubWarning=!1,this.hasCoupon=!1,this.completeWith={interrupted:!0},this.gcRes=(0,t.f3M)(ht.U),this.paymentRefSvc=(0,t.f3M)(O),this.postActions=function mn(){const r=(0,t.f3M)(Ht.w),e=(0,t.f3M)(Jt.q),n=(0,t.f3M)(T.r);return new Map([["refreshUserCurrent",()=>
1e.current({cache:Zt.sS.none(),params:{noredirect:1}}).pipe(Ut("Unable to refresh logged in user"))],["pm_setManualPayment",()=>n.latest("payer_id").pipe((0,l.w)(s=>r.setManualPayment({id:s,manual_payment:!0})),Ut("Unable to set manual payment"))]])}(),this.stripeRes=(0,t.f3M)(Ct.x)}closeModal(e=!1){this.closable||e?(this.closeModal=ot.Z,this.ref.hide()):this.alert.alertError({key:"cantBeClosed",ns:z})}idFor(e){return(0,Dt.Z)(`payment-provider-${e}-`)}ngOnDestroy(){(0,$.t)(this.completion,this.completeWith)}ngOnInit(){this._destroyed$=this.paymentRefSvc.destroyed$,this.state.init(),this.state.setParams(this.params,this.paymentType),this.paymentRefSvc.init().subscribe(M.V),this.initProviders(),this.initEventTimeout(),this.initImplicitUserID(),this.initFailSucceedListeners(),this.initMembership(),this.initClosable(),this.initCurrentPaymentMethod(),this.initSetupFee(),this.initTrial(),this.initCoupon()}providerTemplateFor(e){switch(e){case u.O.STRIPE:return this.tplStripe;case u.O.GOCARDLESS:return this.tplGoCardless;case u.O.MANUAL:return this.tplManual;case u.O.INVOICE:return this.tplInvoice;default:console.warn("Unknown payment provider template:",e)}}setSelectedProvider(e){this.state.setSelectedProvider(e)}initClosable(){this.state.store.pipe((0,m.U)(e=>!(e.saving_payment_method||e.payment_in_progress)),(0,W.N)(this.closable),(0,d.R)(this._destroyed$),(0,c.H)("[PaymentModal.initClosable]")).subscribe((0,f.e)(e=>{this.closable=e,this.cdr.markForCheck()}))}initCoupon(){this.state.pluck("purchase_type").pipe((0,_.v)(1),(0,l.w)(e=>{switch(e){case"membership":case"membershipExtend":return this.state.pluck("membership").pipe((0,_.v)(1),(0,m.U)(n=>Boolean(n.coupon)));default:return(0,P.of)(!1)}}),(0,W.N)(this.hasCoupon),(0,c.H)("[PaymentModal.initCoupon]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{this.hasCoupon=e,this.cdr.markForCheck()}))}initCurrentPaymentMethod(){this.state.store.pipe((0,b.h)(e=>Boolean(e.purchase_type)&&Boolean(e.payer_id)&&Boolean(e.payer_type)),(0,y.q)(1),(0,l.w)(e=>"membershipSubsUpdate"!==e.purchase_type?h.E:this.membRes.getSubscriptionPayment({params:{[e.payer_type]:e.payer_id}}).pipe((0,m.U)(n=>e.provider===u.O.GOCARDLESS?this.gcRes.instantiate(n):this.stripeRes.instantiate(n)))),(0,c.H)("[PaymentModal.initCurrentPaymentMethod]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{this.state.set("current_payment_method",e)}))}initEventTimeout(){if("events"!==this.paymentType)return;const e=this.actions.pipe((0,C.l4)("eventBooking:timeout"),(0,y.q)(1),(0,l.w)(()=>this.state.store),(0,b.h)(n=>!n.payment_in_progress&&!n.saving_payment_method),(0,y.q)(1),(0,c.H)("[PaymentModal.initEventTimeout]"));(0,Ft.x)(e,$t.z).pipe((0,d.R)(this._destroyed$)).subscribe((0,f.e)(()=>{this.closeModal(!0)}))}initFailSucceedListeners(){this.actions.pipe((0,C.l4)("payment:fail"),(0,d.R)(this._destroyed$)).subscribe(()=>{this.paymentRefSvc.refreshPaymentRef()}),this.actions.pipe((0,C.l4)("payment:succeed"),(0,y.q)(1),(0,at.d)(()=>this.state.latest().pipe((0,at.d)(e=>{const n=e.on_success?.slice()||[];if("pending_member"===e.payer_type&&e.provider===u.O.MANUAL&&!n.includes("pm_setManualPayment")&&n.push("pm_setManualPayment"),!n.length)return h.E;const s=[];for(const a of n){const o=this.postActions.get(a);o&&s.push(o.call(this).pipe((0,Bt.d)(null)))}return s.length?(0,w.D)(s):h.E}),(0,l.w)(()=>this.state.latest()),(0,B.b)(({show_success_toast:e,purchase_type:n,is_subscription:s,provider:a})=>{if(!e)return;let o;o="membershipSubsUpdate"===n?"paymentMethodUpdated":"membershipExtend"===n&&s?"membershipExtended":a===u.O.INVOICE?"payByInvoiceSuccess":"paymentSuccessful",this.alert.alertSuccess({key:o,ns:z})}))),(0,c.H)("[Payment success listener]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{this.completeWith={interrupted:!1},e.value&&(this.completeWith.response=e.value),this.closeModal(!0)}))}initImplicitUserID(){this.state.store.pipe((0,b.h)(e=>Boolean(e.payer_type)),(0,y.q)(1),(0,l.w)(e=>"user"!==e.payer_type||e.payer_id?h.E:this.uSvc.pluck("user","id").pipe((0,_.v)(1))),(0,c.H)("[PaymentModal.implicitUserId]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{this.state.dispatch({type:"payment:set:payer-id",value:e})}))}initMembership(){this.state.store.pipe((0,b.h)(e=>Boolean(e.purchase_type)),(0,y.q)(1),(0,l.w)(e=>{const n=s=>this.membRes.get(e.membership_purchase_params.membership_id,{params:s});switch(e.purchase_type){case"membership":if(!e.membership)return n();break;case"membershipExtend":if(!e.membership?.providers)return n({extend:"1"})}return h.E}),(0,c.H)("[PaymentModal.initMembership]"),(0,d.R)(this._destroyed$)).subscribe((0,f.e)(e=>{this.state.setMembership(e)}))}initProviders(){this.providers.some(e=>e===u.O.STRIPE||e===u.O.INVOICE)?this.state.store.pipe((0,b.h)(e=>e.is_subscription_ready),(0,y.q)(1),(0,d.R)(this._destroyed$)).subscribe(({is_subscription:e,membership:n})=>{e&&(this.providers=this.providers.filter(s=>s!==u.O.INVOICE&&!(n?.until&&s===u.O.STRIPE))),this.providers.length?this.setSelectedProvider(this.providers[0]):this.alert.alertError({key:"noProvidersAvailable",ns:z}),this.loading=!1,this.cdr.markForCheck()}):(this.loading=!1,this.setSelectedProvider(this.providers[0])),this.state.pluck("provider").pipe((0,R.x)(),(0,d.R)(this._destroyed$)).subscribe(e=>{this.selectedProvider=e,this.cdr.markForCheck()})}initSetupFee(){this.state.store.pipe((0,b.h)(e=>e.is_subscription_ready),(0,y.q)(1),(0,l.w)(e=>{const n=e.membership?.setup_fee_amount;return n?this.localeCfg.latest().pipe((0,m.U)(({currency:s})=>`${s}${Y.i.formattedAmount(n)}`)):h.E}),(0,d.R)(this._destroyed$),(0,c.H)("[PaymentModal.initSetupFee]")).subscribe((0,f.e)(e=>{this.setupFee=e,this.cdr.markForCheck()}))}initTrial(){this.state.store.pipe((0,b.h)(e=>e.is_subscription_ready),(0,y.q)(1),(0,d.R)(this._destroyed$)).subscribe(e=>{const n=e.membership?.trial_period_days;n&&(this.trialDays=n,this.cdr.markForCheck())})}}function Ut(r){return(0,wt.z)((0,c.H)(r),(0,A.K)(()=>h.E))}F.\u0275fac=function(e){return new(e||F)(t.Y36(Ge.UZ),t.Y36(C.eX),t.Y36(tt.k),t.Y36(et.KD),t.Y36(It.b),t.Y36(t.sBO),t.Y36(it.c),t.Y36(T.r))},F.\u0275cmp=t.Xpm({type:F,selectors:[["tg-payment-modal"]],viewQuery:function(e,n){if(1&e&&(t.Gf(we,7),t.Gf(Be,7),t.Gf(Ye,7),t.Gf(He,7)),2&e){let s;t.iGM(s=t.CRH())&&(n.tplGoCardless=s.first),t.iGM(s=t.CRH())&&(n.tplInvoice=s.first),t.iGM(s=t.CRH())&&(n.tplManual=s.first),t.iGM(s=t.CRH())&&(n.tplStripe=s.first)}},standalone:!0,features:[t._Bn([{provide:L.z,useValue:z},{provide:Qt.U,useValue:"payment-modal"},T.r,O]),t.jDz],decls:23,vars:11,consts:[["spinner",""],["noProviders",""],[3,"disabled","hide"],[1,"modal-body"],[3,"ngIf","ngIfElse"],[1,"modal-footer"],[1,"btn","btn-danger",3,"disabled","click.passive"],["tplProviderStripe",""],["tplProviderManual",""],["tplProviderGoCardless",""],["tplInvoice",""],["tplProviderNoop",""],[1,"alert","alert-danger","text-center",3,"translate"],[3,"ngSwitch"],[3,"ngSwitchCase"],["ngSwitchDefault",""],[1,"text-center","mt-3"],[1,"btn-lg","btn","btn-primary",3,"tg-payment-btn"],["tplInfoNonStripe",""],[3,"ngTemplateOutlet"],["role","tablist",1,"nav","nav-tabs"],["role","presentation",3,"active","click.passive",4,"ngFor","ngForOf"],[1,"tab-content","mt-3"],["class","tab-pane fade","role","tabpanel",3,"id","ngClass",4,"ngFor","ngForOf"],["role","presentation",3,"click.passive"],["href","#","role","tab"],["class","fa fa-exclamation-triangle",4,"ngIf"],[1,"fa","fa-exclamation-triangle"],["role","tabpanel",1,"tab-pane","fade",3,"id","ngClass"],["class","mt-3",4,"ngIf"],[1,"mt-3"],["class","text-info",4,"ngIf"],[1,"text-info"],[1,"fa","fa-info-circle"],[3,"translate"],["class","mt-3 alert alert-warning",3,"translate",4,"ngIf"],[1,"mt-3","alert","alert-warning",3,"translate"],[3,"addressPrefill"],[3,"dailySubWarning"]],template:function(e,n){if(1&e&&(t.YNc(0,Je,1,0,"ng-template",null,0,t.W1O),t.YNc(2,Qe,1,1,"ng-template",null,1,t.W1O),t.TgZ(4,"tg-modal-header",2),t.NdJ("hide",function(){return n.closeModal()}),t._uU(5),t.ALo(6,"tr"),t.qZA(),t.TgZ(7,"div",3),t.YNc(8,rn,1,2,"ng-template",4),t.qZA(),t.TgZ(9,"footer",5)(10,"button",6),t.NdJ("click.passive",function(){return n.closeModal()}),t._uU(11),t.ALo(12,"tr"),t.qZA()(),t.YNc(13,an,1,1,"ng-template",null,7,t.W1O),t.YNc(15,on,1,0,"ng-template",null,8,t.W1O),t.YNc(17,ln,1,0,"ng-template",null,9,t.W1O),t.YNc(19,pn,1,0,"ng-template",null,10,t.W1O),t.YNc(21,cn,1,1,"ng-template",null,11,t.W1O)),2&e){const s=t.MAs(1);t.xp6(4),t.Q6J("disabled",!n.closable),t.xp6(1),t.Oqu(t.lcZ(6,6,"checkout")),t.xp6(3),t.Q6J("ngIf",!n.loading)("ngIfElse",s),t.xp6(2),t.Q6J("disabled",!n.closable),t.xp6(1),t.Oqu(t.xi3(12,8,"cancel","common"))}},dependencies:[Z.GlobalModule,x.mk,x.sg,x.O5,x.tP,x.RF,x.n9,x.ED,Ze.G,V.P,nt.Z,De.h,K.a,Ne.k,At.d,Fe.v,st.H,Yt.b,$e.R,G,D,Ce,ae,Se,Ie,Re.m],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0}),(0,E.gn)([(0,Q.qQ)(Nt.Z)],F.prototype,"idFor",null)},16733:(Gt,J,i)=>{i.d(J,{d:()=>$});var E=i(3811),Q=i(29634);function $(M,f){return(0,Q.a)(E.w,M,f)}}}]);

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.