1import{a as pe}from"./chunk-P5JUOEPL.js";import{b as at}from"./chunk-4FHHCW4E.js";import{a as rt}from"./chunk-W4MRURUS.js";import"./chunk-KAFBO5WO.js";import{a as lt}from"./chunk-2J3JPL6J.js";import{a as ce}from"./chunk-RRAFCPPX.js";import{$ as c,$b as Re,$d as Xe,Cb as Ue,Cc as Ne,Cd as W,D as Ee,Da as $,E as Fe,Ed as we,Fb as Ce,Fc as ye,G as ge,Gc as je,H as he,Hd as We,Ia as O,Ic as xe,Id as Qe,Ja as _,Jb as Z,Jc as M,K as F,L as D,Ne as nt,Od as ae,Rc as oe,Sb as qe,Sd as ze,Te as se,Ua as l,Uc as re,Ud as f,Va as v,Vd as Ke,Wa as V,Wc as Le,Wd as Je,Xe as q,Yc as _e,Ye as R,Zd as U,Ze as ot,_c as He,_d as m,ab as Oe,ac as ee,ad as le,ae as Ye,bc as G,be as Ze,c as Te,ec as te,fa as g,fc as ie,fe as et,g as ke,ga as J,gc as ne,ge as tt,ha as De,i as Be,ib as T,ic as $e,j as Ae,jb as k,kc as N,ne as it,oa as w,pa as I,pb as X,q as E,qa as Se,qe as Ie,sa as ve,sb as Y,sc as Ge,ta as Pe,ua as S,ub as Ve,v as z,va as n,wa as r,x as K,xa as x,z as B}from"./chunk-3P7ZQ3JU.js";import{a as L,b as H}from"./chunk-MG3ERZGY.js";var de=class{constructor(u){this.returnUrl=u}};var Q=(()=>{class t{constructor(e,a){this.http=e,this.userInfoService=a,this.getBillingSubscriptionByTenantId=()=>this.http.get(`${this.apiPath}/billing-subscription`),this.createCheckoutSession=P=>this.http.post(`${this.apiPath}/billing-subscription/checkout`,P),this.createCustomerPortalSession=P=>this.http.post(`${this.apiPath}/billing-subscription/portal`,P),this.cancelSubscription=()=>this.http.delete(`${this.apiPath}/billing-subscription`),this.getCombinedBillingPlanById=P=>this.http.get(`${this.apiPath}/billing-plans/${P}`),this.getBillingPlans=()=>this.http.get(`${this.apiPath}/billing-plans`),this.resubscribeUser=()=>this.http.post(`${this.apiPath}/billing-subscription/resubscribe`,null);let d=this.userInfoService.getUserData(),C=d?.activeTenantId,A=d?.activePortfolioId;this.apiPath=`/api/tenant/${C}/portfolio/${A}`}static{this.\u0275fac=function(a){return new(a||t)(ge(qe),ge(N))}}static{this.\u0275prov=Ee({token:t,factory:t.\u0275fac,providedIn:"root"})}}return t})();var Pt=()=>["/app/my-profile/billing"];function Ct(t,u){t&1&&x(0,"flux-workspace-spinner")}function yt(t,u){t&1&&(n(0,"a",18),T(1,"translate"),x(2,"i",20),l(3," Subscribe now! "),r()),t&2&&S("routerLink",Oe(4,Pt))("title",k(1,2,"Subscribe now!"))}function xt(t,u){if(t&1){let e=$();n(0,"a",21),T(1,"translate"),O("click",function(){F(e);let d=_(3);return D(d.resubscribeUser())}),l(2," Resubscribe now! "),r()}t&2&&S("title",k(1,1,"Resubscribe now!"))}function _t(t,u){if(t&1){let e=$();n(0,"button",16),T(1,"translate"),O("click",function(){F(e);let d=_(2);return D(d.customerPortal())}),x(2,"i",17),l(3," My Billing Portal "),r(),w(4,yt,4,5,"a",18)(5,xt,3,3,"a",19)}if(t&2){let e=_(2);S("title",k(1,2,"My Billing Portal")),c(4),I(e.activeTenantSubscriptions()?e.activeTenantSubscriptions()&&!e.activePortfolioSubscription()?5:-1:4)}}function wt(t,u){if(t&1){let e=$();n(0,"flux-workspace-tables-widget",22),O("clickedButton",function(d){F(e);let C=_(2);return D(C.cancelSubscription(d))}),r()}if(t&2){let e=_(2);S("activeSubscription",e.activePortfolioSubscription())("model",u.tableWidgetModel)("showSearch",!1)}}function It(t,u){t&1&&l(0," , ")}function Mt(t,u){if(t&1&&(l(0),T(1,"translate"),w(2,It,1,0)),t&2){let e=u.$implicit,a=u.$index,d=u.$count;V(" ",k(1,2,e)),c(2),I(a!==d-1?2:-1)}}function Tt(t,u){if(t&1&&(n(0,"section",15)(1,"div",23)(2,"h3",24),l(3,"User Role Information"),r()(),n(4,"section",4)(5,"div",25)(6,"label",26),l(7,"Roles"),r(),n(8,"label",27),ve(9,Mt,3,4,null,null,Se),r()(),n(11,"div",25)(12,"label",26),l(13,"Tenant Id"),r(),n(14,"label",27),l(15),r()(),n(16,"div",25)(17,"label",26),l(18,"Tenant Name"),r(),n(19,"label",27),l(20),r()(),n(21,"div",25)(22,"label",26),l(23,"Portfolio Id"),r(),n(24,"label",27),l(25),r()(),n(26,"div",25)(27,"label",26),l(28,"Portfolio Name"),r(),n(29,"label",28),l(30),r()(),n(31,"div",25)(32,"label",26),l(33,"Business Type"),r(),n(34,"label",27),l(35),T(36,"translate"),r()()()()),t&2){let e=u.$implicit;c(9),Pe(e.role),c(6),v(e.tenantId),c(5),v(e.tenantName),c(5),v(e.portfolioId),c(5),v(e.portfolioName),c(5),v(k(36,5,e.businessTypeName))}}function kt(t,u){if(t&1&&(n(0,"section",0)(1,"article",1)(2,"div",2)(3,"h3",3),l(4,"Profile Details"),r()()(),n(5,"article",4)(6,"table",5)(7,"tbody")(8,"tr")(9,"th",6),l(10,"User Id"),r(),n(11,"td",7)(12,"span",8),l(13),r()()(),n(14,"tr")(15,"th",6),l(16,"Email"),r(),n(17,"td",7)(18,"span",9),l(19),r()()(),n(20,"tr")(21,"th",6),l(22,"Active Tenant"),r(),n(23,"td",7)(24,"span",10),l(25),r()()(),n(26,"tr")(27,"th",6),l(28,"Active Portfolio"),r(),n(29,"td",7)(30,"span",9),l(31),r()()()()()()(),n(32,"section",0)(33,"article",1)(34,"div",2)(35,"h3",3),l(36,"Subscription"),r()(),n(37,"div",11),w(38,_t,6,4),r()(),w(39,wt,1,3,"flux-workspace-tables-widget",12),T(40,"async"),r(),n(41,"section"),x(42,"flux-workspace-invitations",13),r(),n(43,"section",0)(44,"article",14),ve(45,Tt,37,7,"section",15,Se),r()()),t&2){let e,a=_();c(13),v(a.userInfo().id),c(6),v(a.userInfo().email),c(6),v(a.activeTenantName),c(6),v(a.activePortfolioName),c(7),I(a.isUserAdmin?38:-1),c(),I((e=k(40,8,a.viewModel$))?39:-1,e),
1c(3),S("receivedInvitations",a.userInfo().receivedInvitations)("title","My Invitations"),c(3),Pe(a.userRoleViewModel)}}var pt=(()=>{class t{constructor(e,a,d,C,A,P,be,y,b){this.userInfoService=e,this.userApiService=a,this.billingSubscriptionApiService=d,this.changeDetectorRef=C,this.portfolioApiService=A,this.billingPlanApiService=P,this.translationService=be,this.alertService=y,this.configurationApiService=b,this.model=new Ie("",[],[]),this.userInfo=X(()=>this.userInfoService.getUserData()),this.userRoleViewModel=[],this.activePortfolioName=(()=>{let i=this.userInfo();return!i||!i.tenantInfo?.length?"":i.tenantInfo.find(p=>p.portfolios.some(h=>h.portfolioId===i.activePortfolioId))?.portfolios.find(p=>p.portfolioId===i.activePortfolioId)?.portfolioName??""})(),this.activeTenantName=(()=>{let i=this.userInfo();return!i||!i.tenantInfo?.length?"":i.tenantInfo.find(o=>o.tenantId===i.activeTenantId)?.tenantName??""})(),this.isUserAdmin=(()=>{let i=this.userInfo();if(!i)return!1;let o=i.tenantInfo?.find(h=>h.portfolios.some(j=>j.portfolioId===i.activePortfolioId))?.portfolios.find(h=>h.portfolioId===i.activePortfolioId),p=He.getKeyByValue(_e,_e.TenantAdmin);return o?.roles.includes(p)??!1})(),this.loading=!0,this.billingSubscriptions=[],this.configurationModel=[],this.viewModel$=new Te(new ot(new Ie("",[new R("Portfolio ID"),new R("Plan"),new R("Billing Frequency"),new R("Start Date"),new R("End Date"),new R("Status")],[],[re.Add],[re.CancelSubscription],""),!0)),this.activePortfolioSubscription=X(()=>this.userInfoService.activePortfolioSubscription()),this.activeTenantSubscriptions=X(()=>this.userInfoService.activeTenantSubscription()),this.badgesByTypes={[M.PendingActivation]:"badge-light-warning",[M.Active]:"badge-light-success",[M.Paused]:"badge-light-warning",[M.Canceled]:"badge-light-warning",[M.Expired]:"badge-light-danger",[M.Trialing]:"badge-light-primary",[M.PaymentFailed]:"badge-light-danger"},this.customerPortal=()=>{this.loading=!0,this.changeDetectorRef.markForCheck();let i=`${window.location.origin}/${W}`,s=new de(i);this.billingSubscriptionApiService.createCustomerPortalSession(s).pipe(z(),B(o=>{window.location.href=o.portalUrl}),E(o=>{throw o})).subscribe()},this.getBillingSubscription=()=>Ae([this.portfolioApiService.getPortfolioById(this.userInfo().activePortfolioId),this.billingSubscriptionApiService.getBillingSubscriptionByTenantId(),this.configurationApiService.getConfiguration(oe.BillingSubscriptionStatus)]).pipe(K(([i,s,o])=>{if(this.configurationModel=o,this.billingSubscriptions=s,!i.billingPlanPriceId){let p=this.viewModel$.getValue();return p.tableWidgetModel.tableData=[],this.viewModel$.next(H(L({},p),{loading:!1})),ke(void 0)}return this.billingPlanApiService.getCombinedBillingPlanById(i.billingPlanPriceId).pipe(B(p=>{p&&this.setSubscriptionTable(s,p)}))}),E(i=>{let s=this.viewModel$.getValue();throw this.viewModel$.next(H(L({},s),{loading:!1})),this.loading=!1,this.changeDetectorRef.markForCheck(),i})),this.setSubscriptionTable=(i,s)=>{let o=this.viewModel$.getValue();o.tableWidgetModel.tableData=i.map(p=>{let h=this.configurationModel[p.billingSubscriptionStatusId-1].name,j=`badge ${this.badgesByTypes[h]}`,fe=h==M.Trialing?M.Trialing:s.billingFrequency;return[new q(this.userInfo().activePortfolioId.toString()),new q(s.name),new q(this.translationService.translateText(fe)),new q(p.startDate?new Ce(we).transform(new Date(p.startDate),ye.English):""),new q(p.expirationDate?new Ce(we).transform(new Date(p.expirationDate),ye.English):""),new q(this.translationService.translateText(h),!0,j)]}),this.viewModel$.next(H(L({},o),{loading:!1}))},this.cancelSubscription=i=>{if(this.isUserAdmin){if(i.action===re.CancelSubscription){let s=this.translationService.translateText("Are you sure you want to cancel this subscription?");this.alertService.showQuestionModal(s).then(o=>{o.value&&(this.loading=!0,this.changeDetectorRef.markForCheck(),this.billingSubscriptionApiService.cancelSubscription().pipe(z(),K(this.getBillingSubscription),K(()=>this.userApiService.getUserInfo().pipe(B(p=>{let h=this.userInfoService.getUserData(),j=this.mapTenantInfoApiModelToViewModel(p.tenants),fe=H(L({},h),{tenantInfo:j});this.userInfoService.setUser(fe)}))),E(p=>{throw this.loading=!1,this.changeDetectorRef.markForCheck(),p})).subscribe(()=>{this.loading=!1,this.changeDetectorRef.markForCheck()}))})}}else{let s=`${this.translationService.translateText("An invited user cannot cancel a subscription.")}`;this.alertService.showError(s)}},this.resubscribeUser=()=>{let i=`${this.translationService.translateText("resubscribe-message")}`;this.alertService.showQuestionModal(i).then(s=>{s.value&&(this.loading=!0,this.billingSubscriptionApiService.resubscribeUser().pipe(z(),B(()=>{this.loading=!1,this.changeDetectorRef.markForCheck(),location.reload()}),E(o=>{throw this.loading=!1,this.changeDetectorRef.markForCheck(),o})).subscribe())})},this.mapTenantInfoApiModelToViewModel=i=>i.map(s=>new We(s.tenantId,s.tenantName,s.subscriptionStatus,s.subscriptionExpirationDate,s.portfolios.map(o=>new Qe(o.portfolioId,o.portfolioName,o.businessType,o.roles,o.activeSubscription)))),this.setUserRoleViewModel=()=>{let i=this.userInfo();i&&(this.userRoleViewModel=i.tenantInfo.flatMap(s=>s.portfolios.flatMap(o=>new $e(i.id,s.tenantId,s.tenantName,o.portfolioId,o.portfolioName,o.businessType,o.roles))))}}ngOnInit(){this.setUserRoleViewModel(),this.getBillingSubscription().subscribe(()=>{this.loading=!1,this.changeDetectorRef.markForCheck()})}static{this.\u0275fac=function(a){return new(a||t)(g(N),g(rt),g(Q),g(Y),g(pe),g(Q),g(ae),g(le),g(ce))}}static{this.\u0275cmp=J({type:t,selectors:[["flux-workspace-my-profile"]],inputs:{model:"model"},decls:2,vars:1,consts:[["id","kt_profile_details_view",1,"card","mb-5","mb-xl-10"],[1,"card-header"],[1,"card-title","m-0"],["translate","",1,"fw-bolder","m-0"],[1,"card-body"],[1,"table","table-striped"],["translate","",1,"col-lg-4","fw-bold"],[1,"col-lg-8"],[1,"fw-bolder","fs-6","text-dark"],[1,"fw-bold","fs-6","word-break-all"],[1,"fw-bold","fs-6"],[1,"billing-buttons"],[3,"activeSubscription","model","showSearch"],[3,"re
1ceivedInvitations","title"],[1,"user-card-container"],[1,"card-section","w-100"],["type","button","translate","",1,"btn","btn-primary","btn-lg","btn-block","p-3","m-b-10",3,"click","title"],[1,"fas"],["type","button","translate","",1,"btn","btn-success","btn-lg","btn-block-2","m-l-7","p-3","m-b-10",3,"routerLink","title"],["type","button","translate","",1,"btn","btn-success","btn-lg","btn-block-2","m-l-7","p-3","m-b-10",3,"title"],[1,"fas","fa-arrow-right"],["type","button","translate","",1,"btn","btn-success","btn-lg","btn-block-2","m-l-7","p-3","m-b-10",3,"click","title"],[3,"clickedButton","activeSubscription","model","showSearch"],[1,"card-header","card-title-section"],["translate",""],[1,"row"],["translate","",1,"col-6"],[1,"col-6"],[1,"col-6","text-truncate"]],template:function(a,d){a&1&&w(0,Ct,1,0,"flux-workspace-spinner")(1,kt,47,10),a&2&&I(d.loading?0:1)},dependencies:[Z,ne,te,G,ee,se,nt,at,Ue,ie],styles:[".user-card-container[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(4,1fr);gap:2rem;padding:30px;margin-right:0!important}.card-section[_ngcontent-%COMP%]{border:1px solid gainsboro;border-radius:8.125px;width:95%;align-items:stretch;height:270px}.card-title-section[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;align-items:center;color:#fff!important;min-height:60px;grid-template-columns:repeat(4,1fr)}.billing-buttons[_ngcontent-%COMP%]{padding-top:1rem}@media(max-width:600px){.billing-buttons[_ngcontent-%COMP%]{align-items:center;justify-content:center;display:flex}.billing-buttons[_ngcontent-%COMP%] a.btn-lg[_ngcontent-%COMP%]{font-size:12px;padding:10px 20px}}@media(max-width:768px){.user-card-container[_ngcontent-%COMP%], .card-title-section[_ngcontent-%COMP%]{grid-template-columns:1fr}.billing-buttons[_ngcontent-%COMP%] a.btn-lg[_ngcontent-%COMP%]{padding:10px 20px}.text-truncate[_ngcontent-%COMP%]{max-width:110px}}@media(min-width:769px)and (max-width:992px){.user-card-container[_ngcontent-%COMP%], .card-title-section[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}@media(min-width:993px)and (max-width:1200px){.user-card-container[_ngcontent-%COMP%]{grid-template-columns:1fr}.card-title-section[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}@media(min-width:1201px)and (max-width:1400px){.user-card-container[_ngcontent-%COMP%], .card-title-section[_ngcontent-%COMP%]{grid-template-columns:repeat(3,1fr)}.card-section[_ngcontent-%COMP%]{height:300px}}@media(min-width:1401px){.user-card-container[_ngcontent-%COMP%], .card-title-section[_ngcontent-%COMP%]{grid-template-columns:repeat(3,1fr)}.card-section[_ngcontent-%COMP%]{height:280px}}flux-workspace-tables-widget[_ngcontent-%COMP%] section#large-table{padding-left:0!important;padding-right:0!important}"],changeDetection:0})}}return t})();var ue=class{constructor(u,e,a,d,C){this.portfolioId=u,this.billingPlanSubscription=e,this.paymentMethod=a,this.successUrl=d,this.failureUrl=C}};var me=class{constructor(u,e,a,d,C){this.businessTypeId=u,this.quantity=e,this.billingPlanId=a,this.billingPlanPriceId=d,this.priceId=C}};function Bt(t,u){t&1&&x(0,"flux-workspace-spinner")}function At(t,u){t&1&&(n(0,"span",31),l(1,"Basic"),r(),l(2," Plan "))}function Et(t,u){t&1&&(l(0," Plan "),n(1,"span",32),l(2,"Basic"),r())}function Ft(t,u){t&1&&(n(0,"span",31),l(1,"Pro"),r(),l(2," Plan "))}function Dt(t,u){t&1&&(l(0," Plan "),n(1,"span",32),l(2,"Pro"),r())}function Ot(t,u){if(t&1){let e=$();n(0,"section",0)(1,"header",1)(2,"h3",2),l(3," Billing Subscription "),r(),n(4,"a",3),T(5,"translate"),x(6,"i",4),r()()(),n(7,"form",5)(8,"section",6)(9,"article",7)(10,"label",8),w(11,At,3,0)(12,Et,3,0),r()(),n(13,"article",9)(14,"section",10)(15,"label",11),x(16,"input",12),n(17,"label",13)(18,"span",14),l(19),r(),n(20,"span",15),l(21),r()()(),n(22,"label",16),x(23,"input",17),n(24,"label",18)(25,"span",14),l(26),r(),n(27,"span",15),l(28),r()()()(),n(29,"span",19),l(30," Max. 10 Properties "),r()(),n(31,"article",20)(32,"button",21),O("click",function(){F(e);let d=_();return D(d.setupStripe())}),l(33," Subscribe "),r()()(),n(34,"section",22)(35,"article",7)(36,"label",23),w(37,Ft,3,0)(38,Dt,3,0),r()(),n(39,"article",9)(40,"section",10)(41,"label",24),x(42,"input",25),n(43,"label",26)(44,"span",14),l(45),r(),n(46,"span",15),l(47),r()()(),n(48,"label",27),x(49,"input",28),n(50,"label",29)(51,"span",14),l(52),r(),n(53,"span",15),l(54),r()()()(),n(55,"span",19),l(56," Max. 20 Properties "),r()(),n(57,"article",20)(58,"button",30),O("click",function(){F(e);let d=_();return D(d.setupStripe())}),l(59," Subscribe "),r()()()()}if(t&2){let e=_();c(4),S("title",k(5,19,"Go back to My Profile"))("routerLink","/app/my-profile"),c(3),S("formGroup",e.formGroup),c(4),I(e.language===e.lang.english?11:12),c(5),S("value",e.billingPlanUserSelection.BasicMonthlyPlan),c(3),V("$",e.formGroup.controls.basicBillingPlan.controls.monthlyPrice.value),c(2),v(e.billingFrequencyType.Monthly),c(2),S("value",e.billingPlanUserSelection.BasicAnnualPlan),c(3),V("$",e.formGroup.controls.basicBillingPlan.controls.annualPrice.value),c(2),v(e.billingFrequencyType.Annual),c(4),S("disabled",e.formGroup.controls.basicBillingPlan.controls.disabled.value||!e.formGroup.value.billingFrequency||e.loading),c(5),I(e.language===e.lang.english?37:38),c(5),S("value",e.billingPlanUserSelection.ProMonthlyPlan),c(3),V(" $",e.formGroup.controls.proBillingPlan.controls.monthlyPrice.value," "),c(2),v(e.billingFrequencyType.Monthly),c(2),S("value",e.billingPlanUserSelection.ProAnnualPlan),c(3),V(" $",e.formGroup.controls.proBillingPlan.controls.annualPrice.value," "),c(2),v(e.billingFrequencyType.Annual),c(4),S("disabled",e.formGroup.controls.proBillingPlan.controls.disabled.value||!e.formGroup.value.billingFrequency||e.loading)}}var dt=(()=>{class t{constructor(e,a,d,C,A,P,be){this.billingSubscriptionApiService=e,this.portfolioApiService=a,this.changeDetectorRef=d,this.configurationApiService=C,this.translationService=A,this.alertService=P,this.location=be,this.formGroup=new U({plan:new m(null,[f.required]),paymentMethod:new m(!0,[f.required]),billingFrequency:new m(null,[f.required]),billingPlans:new Ze([new U({name:new m("",[f.required]),monthlyPrice:new m("",[f.required]),annualPrice:new m("",[f.required]),disabled:new m(!0)})]),basicBillingPlan:new U({name:new m("",[f.required]),monthlyPrice:new m("",[f.required]),annualPrice:new m("",[f.required]),disabled:new m(!0)}),proBillingPlan:new U({name:new m("",[f.required]),monthlyPrice:new m("",[f.required]),annualPrice:new m("",[f.required]),disabled:new m(!0)})}),this.ignorePreventUnsavedChanges=!1,this.loading=!0,this.selectedSubscription=null,this.language=null,this.lang=Ge,this.billingFrequencyType=Ne,this.billingPlanUserSelection=Le,this.billingPlans=[],this.billingPlanSubscription=[],this.tiers=[],this.businessTypes=[],this.portfolioIdList=[],this.portfolioList=[],this.groupedPlans=new Map,this.subscriptions=[],this.billingPlanType=je,this.setupStripe=()=>{if(this.portfolioList.length>1){let y=this.portfolioList.join(", "),b=this.translationService.translateText("message-billing-subscription",{portfolioNames:y});this.alertService.showQuestionModal(b).then(i=>{i.value&&this.stripeCheckout()})}else this.stripeCheckout()},this.stripeCheckout=()=>{this.loading=!0,this.changeDetectorRef.markForCheck(),this.setBillingPrice();let y=this.formGroup.controls.paymentMethod.value?xe.Card:xe.Bank,b=`${window.location.origin}/${W}?session_id={CHECKOUT_SESSION_ID}`,i=`${window.location.origin}/${W}/my-profile`,s=new ue(this.portfolioIdList,this.billingPlanSubscription,y,b,i);this.billingSubscriptionApiService.createCheckoutSession(s).pipe(E(o=>{throw this.loading=!1,this.changeDetectorRef.markForCheck(),o})).subscribe(o=>{o.checkoutUrl&&(window.location.href=o.checkoutUrl)})},this.getBillingPlans=y=>{this.billingPlans=y,this.tiers=[],this.formGroup.controls.billingPlans.clear(),this.groupedPlans.clear(),this.billingPlans.sort((b,i)=>{let s=b.price||0,o=i.price||0;return s-o}),this.billingPlans.forEach(b=>{let i=b.name.match(/\b(\w+)\s+Plan\b/i),s=i?`${i[1]}
1 Plan`:"";this.tiers.push(s),this.groupedPlans.has(s)||this.groupedPlans.set(s,[]),this.groupedPlans.get(s)?.push(b)});for(let[b,i]of this.groupedPlans.entries()){let s=i.find(h=>h.billingFrequency===this.billingFrequencyType.Monthly)?.price.toString()||null,o=i.find(h=>h.billingFrequency===this.billingFrequencyType.Annual)?.price.toString()||null,p=new U({name:new m(b,[f.required]),monthlyPrice:new m(s,[f.required]),annualPrice:new m(o,[f.required]),disabled:new m(!0)});this.formGroup.controls.billingPlans.push(new U({name:new m(b,[f.required]),monthlyPrice:new m(s,[f.required]),annualPrice:new m(o,[f.required]),disabled:new m(!0)})),p.controls.name.value===this.billingPlanType.Basic?this.formGroup.controls.basicBillingPlan=p:this.formGroup.controls.proBillingPlan=p}},this.getPortfolioCount=y=>{let b=y.filter(o=>o.externalSubscriptionItemId==null);this.portfolioIdList=b.map(o=>o.id),this.portfolioList=b.map(o=>o.name);let i=[];b.forEach(o=>{let p=i.find(h=>h.businessTypeId===o.businessTypeId);p?p.count++:i.push({businessTypeId:o.businessTypeId,count:1})});let s=i.map(o=>new me(o.businessTypeId,o.count,null,null,null));this.billingPlanSubscription=s},this.setBillingPrice=()=>{let b=this.groupedPlans.get(this.selectedSubscription)?.filter(i=>i.billingFrequency===this.formGroup.value.billingFrequency);this.billingPlanSubscription?.forEach(i=>{let s=this.businessTypes.find(p=>p.id===i.businessTypeId),o=b?.find(p=>+p.businessType===s?.id);o&&(i.billingPlanId=o.billingPlanId,i.billingPlanPriceId=o.billingPlanPriceId,i.priceId=o.externalPriceId)})},this.valueChanges=()=>{let y=this.formGroup.controls.plan.valueChanges.pipe(B(b=>{switch(b){case this.billingPlanUserSelection.BasicMonthlyPlan:this.formGroup.controls.billingFrequency.setValue(this.billingFrequencyType.Monthly),this.selectedSubscription=this.billingPlanType.Basic,this.formGroup.controls.proBillingPlan.controls.disabled.setValue(!0),this.formGroup.controls.basicBillingPlan.controls.disabled.setValue(!1);break;case this.billingPlanUserSelection.BasicAnnualPlan:this.formGroup.controls.billingFrequency.setValue(this.billingFrequencyType.Annual),this.selectedSubscription=this.billingPlanType.Basic,this.formGroup.controls.proBillingPlan.controls.disabled.setValue(!0),this.formGroup.controls.basicBillingPlan.controls.disabled.setValue(!1);break;case this.billingPlanUserSelection.ProMonthlyPlan:this.formGroup.controls.billingFrequency.setValue(this.billingFrequencyType.Monthly),this.selectedSubscription=this.billingPlanType.Pro,this.formGroup.controls.proBillingPlan.controls.disabled.setValue(!1),this.formGroup.controls.basicBillingPlan.controls.disabled.setValue(!0);break;case this.billingPlanUserSelection.ProAnnualPlan:this.formGroup.controls.billingFrequency.setValue(this.billingFrequencyType.Annual),this.selectedSubscription=this.billingPlanType.Pro,this.formGroup.controls.proBillingPlan.controls.disabled.setValue(!1),this.formGroup.controls.basicBillingPlan.controls.disabled.setValue(!0);break;default:break}}));this.subscriptions.push(y.subscribe())},this.language=this.translationService.getCurrentLang()}ngOnInit(){Be([this.configurationApiService.getConfiguration(oe.BusinessType),this.portfolioApiService.getPortfolios(),this.billingSubscriptionApiService.getBillingPlans()]).pipe(B(([e,a,d])=>{this.businessTypes=e,this.getPortfolioCount(a),this.getBillingPlans(d)})).subscribe(()=>{this.loading=!1,this.changeDetectorRef.markForCheck()}),this.valueChanges()}ngOnDestroy(){this.subscriptions.forEach(e=>e.unsubscribe())}static{this.\u0275fac=function(a){return new(a||t)(g(Q),g(pe),g(Y),g(ce),g(ae),g(le),g(Ve))}}static{this.\u0275cmp=J({type:t,selectors:[["flux-workspace-billing-subscription"]],decls:2,vars:1,consts:[[1,"card","mb-8"],[1,"card-header","border-0","pt-5","pb-5","align-items-center"],["id","title","translate","",1,"m-auto","text-break"],["id","bak-to-my-profile-btn","type","button","data-bs-dismiss","modal",1,"btn","btn-sm","btn-icon","btn-danger",3,"title","routerLink"],[1,"fa-solid","fa-xmark"],[1,"d-flex","flex-wrap","gap-4","justify-content-center",3,"formGroup"],["id","basic-plan-section",1,"card-plan","border","border-5","border-info","rounded-0","pt-0","mb-8","border-color-1"],[1,"text-end","pt-8","pb-8","mr-8","position-relative"],["for","title","translate","",1,"m-0","title","fs-1"],[1,"d-flex","row","mt-4"],[1,"w-50"],["for","basicMonthlyId",1,"d-flex","mb-4"],["type","radio","role","button","id","basicMonthlyId","formControlName","plan",1,"m-4",3,"value"],["role","button","for","basicMonthlyId",1,"d-flex","flex-column"],[1,"text-start","fw-bold","display-4","primary-color"],["translate","",1,"text-start","fw-bolder"],["for","basicAnnualId",1,"d-flex","mb-4"],["type","radio","id","basicAnnualId","formControlName","plan",1,"m-4",3,"value"],["role","button","for","basicAnnualId",1,"d-flex","flex-column"],["translate","",1,"w-50","text-start","mt-4"],[1,"d-flex","justify-content-center"],["type","button","id","subscribe-basic-button","translate","",1,"btn","btn-primary",3,"click","disabled"],["id","pro-plan-section",1,"card-plan","border","border-5","border-info","rounded-0","pt-0","mb-8","border-color-2"],["for","title","translate","",1,"m-0","title","fs-1","gradient"],["for","proMonthlyId",1,"d-flex","mb-4"],["type","radio","role","button","id","proMonthlyId","formControlName","plan",1,"m-4",3,"value"],["role","button","for","proMonthlyId",1,"d-flex","flex-column"],["for","proAnnualyId",1,"d-flex","mb-4"],["type","radio","id","proAnnualyId","formControlName","plan",1,"m-4",3,"value"],["role","button","for","proAnnualyId",1,"d-flex","flex-column"],["type","button","id","subscribe-pro-button","translate","",1,"btn","btn-primary","secondary-bg-color",3,"click","disabled"],[1,"fw-bolder"],["translate","",1,"fw-bolder"]],template:function(a,d){a&1&&w(0,Bt,1,0,"flux-workspace-spinner")(1,Ot,60,21),a&2&&I(d.loading?0:1)},dependencies:[G,ee,se,ne,te,it,Xe,ze,Ye,Ke,Je,tt,et,ie],styles:[".card-plan[_ngcontent-%COMP%]{border:1px solid #ccc;padding:20px;margin:0 10px;text-align:center;flex-shrink:0;border-radius:30px;background:#fff}.card-price[_ngcontent-%COMP%]{color:#4164a3;text-align:center;font-weight:700;font-size:48px;font-family:Montserrat,serif}.title[_ngcontent-%COMP%]{background:#4164a3;color:#fff;padding:1rem;position:absolute;top:-1.5rem;right:0;width:max-content}.primary-color[_ngcontent-%COMP%]{color:#4164a3}.secondary-color[_ngcontent-%COMP%]{color:#2aba7c}#subscribe-basic-button[_ngcontent-%COMP%]{background-color:#4164a3}#subscribe-basic-button[_ngcontent-%COMP%]:hover{background-color:#355287!important}#subscribe-basic-button[_ngcontent-%COMP%]:active, #subscribe-basic-button[_ngcontent-%COMP%]:focus{background-color:#4164a3!important}#subscribe-basic-button[_ngcontent-%COMP%]:disabled{background-color:#4164a3!important}#subscribe-pro-button[_ngcontent-%COMP%]{background-color:#2aba7c}#subscribe-pro-button[_ngcontent-%COMP%]:hover{background-color:#278e62!important}#subscribe-pro-button[_ngcontent-%COMP%]:active, #subscribe-pro-button[_ngcontent-%COMP%]:focus{background-color:#2aba7c!important}#subscribe-pro-button[_ngcontent-%COMP%]:disabled{background-color:#2aba7c!important}.border-color-1[_ngcontent-%COMP%]{border-width:4px!important;border-style:solid!important;border-image:linear-gradient(90deg,#4164a374,#4164a3ba 38%,#2aba7cb4 77%,#2aba7c9c) 1!important}.border-color-2[_ngcontent-%COMP%]{border-width:4px!important;border-style:solid!important;border-image:linear-gradient(to right,#2aba7c,#4164a3) 1!important}
1.gradient[_ngcontent-%COMP%]{background:#2aba7c;background:linear-gradient(90deg,#2aba7c,#4164a3)}form[_ngcontent-%COMP%]{margin-top:10rem}#basic-plan-section[_ngcontent-%COMP%], #pro-plan-section[_ngcontent-%COMP%]{min-width:35rem}@media(max-width:500px){#basic-plan-section[_ngcontent-%COMP%], #pro-plan-section[_ngcontent-%COMP%]{min-width:unset}form[_ngcontent-%COMP%]{margin-top:2rem}}.position-relative[_ngcontent-%COMP%]{position:relative}"],changeDetection:0})}}return t})();var ut=(t,u)=>{let a=he(N).getUserData(),d=a?.activeTenantId,C=a?.tenantInfo.find(P=>P.tenantId===d),A=he(Re);return C?.portfolios.some(P=>P.activeSubscription)?A.createUrlTree(["/app"]):!0};var mt=[{path:"",loadComponent:()=>pt},{path:"billing",title:"Billing Subscription",canActivate:[ut],canDeactivate:[lt],loadComponent:()=>dt}];var Qi=(()=>{class t{static{this.\u0275fac=function(a){return new(a||t)}}static{this.\u0275mod=De({type:t})}static{this.\u0275inj=Fe({imports:[Z,G.forChild(mt)]})}}return t})();export{Qi as MyProfileModule};
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.