1import{a as Pe,b as zt,c as Ie,d as qt,e as Ee,f as Wt,g as Kt,i as Bi}from"./chunk-4QEECZVI.js";import"./chunk-7KBH3BTM.js";import{Ba as Qt,Ca as wi}from"./chunk-7AUP6KNR.js";import{Bg as Ht,Cg as Si,Ib as Ot,Jb as bi,M as ke,Md as Yt,N as Vt,Nd as vi,of as jt,pf as _i}from"./chunk-VYO4RDGN.js";import{j as Pt,k as gi,l as It,m as Et,n as Rt,o as Lt,p as fi,s as $t,t as Ci}from"./chunk-Z7G2JRTJ.js";import"./chunk-7CS2RLJB.js";import{rb as Ft,sb as xi,tb as Ae,ub as Ut}from"./chunk-SAB3JYQF.js";import{$ as z,Ha as Mt,Ia as pi,Ja as kt,Ka as mi,Na as q,Qa as Me,Ra as oe,Sa as qe,Ta as At,U as we,Ua as hi,V as Bt,Za as Nt,_a as yi,ca as De,d as j,da as Dt,e as _e,ea as ui,fa as Te,ga as Tt,j as di}from"./chunk-RL7ZPIOE.js";import"./chunk-LWIBITZ2.js";import"./chunk-4SLMYJ2W.js";import{Aa as St,Ba as wt,Da as be,Fa as He,Ga as ve,ca as _t,d as ne,fc as ae,j as bt,lc as Qe,oc as se,p as xe,q as ye,qc as ze,rc as H,s as vt,sc as Se,tc as Q,uc as Be,v as he,ya as ci}from"./chunk-ZDLU5LI5.js";import{$ as ot,$b as A,Cb as U,Cc as ht,Db as fe,Dc as pe,F as nt,Ga as lt,Gc as r,H as T,Hc as V,Hd as J,Ic as p,J as at,Jc as me,Kc as gt,M as st,Tc as je,Vb as ue,Xb as m,Yb as h,Yc as ft,_b as R,_c as Ct,ac as P,bc as f,bd as xt,cc as o,cd as y,dc as a,dd as yt,ec as v,ed as w,fa as ge,fd as Ce,gd as Z,ic as ct,jc as dt,lc as I,nb as s,o as B,pa as M,pc as S,qa as k,ra as Ye,rc as d,sa as rt,t as D,vc as ut,wb as x,wc as pt,xc as mt,z as it}from"./chunk-MOBT6VNX.js";import"./chunk-2JDYGTA3.js";import"./chunk-5LQHPRAQ.js";import{f as G,i as li}from"./chunk-OLNG5T5J.js";function Mi(n,c){if(n&1&&(o(0,"div",1),r(1," Payment successful. "),o(2,"b"),r(3),y(4,"currency"),a(),r(5," via "),o(6,"b"),r(7),a(),r(8," ending with "),o(9,"b"),r(10),a()()),n&2){let e=d();s(3),p("",Z(4,3,e.payAmount,"USD","symbol","1.2-2")," paid"),s(4),V(e.cardBrand),s(3),V(e.cardNumber)}}function ki(n,c){if(n&1&&(r(0),y(1,"currency")),n&2){let e=d(2).$implicit,t=d();p(" ",Z(1,1,t.getEstRefillCost(e),"USD","symbol","1.2-2")," Est. refill cost ")}}function Ai(n,c){n&1&&r(0," Auto refill on low balance ")}function Pi(n,c){if(n&1){let e=I();o(0,"div",49)(1,"p",50),r(2),y(3,"lowercase"),a(),o(4,"div",51)(5,"input",52),S("input",function(i){M(e);let l=d(2).$implicit,u=d();return k(u.onAutoRenewThresholdInput(l==null?null:l.type,i.target.valueAsNumber||0))}),a(),o(6,"span",53),r(7),a()(),o(8,"p",50),r(9," add quantity "),a(),o(10,"div",54)(11,"svg-icon",55),S("click",function(){M(e);let i=d(2).$implicit,l=d();return k(l.onAutoRenewQuantityMinus(i==null?null:i.type))}),a(),o(12,"div",56)(13,"h4",39)(14,"span",40),r(15),a(),r(16),a()(),o(17,"svg-icon",57),S("click",function(){M(e);let i=d(2).$implicit,l=d();return k(l.onAutoRenewQuantityPlus(i==null?null:i.type))}),a()()()}if(n&2){let e=d(2).$implicit,t=d();s(2),p(" When ",yt(3,9,e==null?null:e.label)," drops below "),s(3),f("value",t.getAutoRenewThreshold(e==null?null:e.type)),s(2),V(e==null?null:e.unitLabel),s(4),pe("pointer-events-none",t.getAutoRenewQuantity(e==null?null:e.type)<=t.getAutoRenewMinQuantity(e==null?null:e.type))("opacity-50",t.getAutoRenewQuantity(e==null?null:e.type)<=t.getAutoRenewMinQuantity(e==null?null:e.type)),s(4),V(t.getAutoRenewQuantity(e==null?null:e.type)),s(),p(" ",e==null?null:e.unitLabel," ")}}function Ii(n,c){if(n&1){let e=I();o(0,"div",23),v(1,"svg-icon",43),a(),o(2,"div",44)(3,"div",45)(4,"div",46)(5,"app-switch",10),S("checkedChange",function(i){M(e);let l=d().$implicit,u=d();return k(u.onIndividualAutoRenewChange(l==null?null:l.type,i))}),a(),o(6,"div",47)(7,"h4",48),r(8," Auto renew credit "),a(),o(9,"h5",34),m(10,ki,2,6),m(11,Ai,1,0),a()()(),m(12,Pi,18,11,"div",49),a()()}if(n&2){let e=d().$implicit;s(5),f("checked",e==null?null:e.autoRenew),s(5),h(e!=null&&e.autoRenew?10:-1),s(),h(e!=null&&e.autoRenew?-1:11),s(),h(e!=null&&e.autoRenew?12:-1)}}function Ei(n,c){if(n&1){let e=I();o(0,"div",4)(1,"div",28)(2,"div",29)(3,"div",30),v(4,"svg-icon",31),a(),o(5,"div",32)(6,"h2",33),r(7),a(),o(8,"h5",34),r(9),y(10,"currency"),a()()(),o(11,"div",35)(12,"h5",34),r(13),a()(),o(14,"div",36)(15,"svg-icon",37),S("click",function(){let i=M(e).$implicit,l=d();return k(l.onMinusAction(i==null?null:i.type))}),a(),o(16,"div",38)(17,"h4",39)(18,"span",40),r(19),a(),r(20),a(),o(21,"h5",41),r(22),y(23,"currency"),a()(),o(24,"svg-icon",42),S("click",function(){let i=M(e).$implicit,l=d();return k(l.onPlusAction(i==null?null:i.type))}),a()()(),m(25,Ii,13,4),a()}if(n&2){let e=c.$implicit,t=d();ue("data-credit-type",e==null?null:e.type),s(4),f("src",e==null?null:e.icon),s(3),p(" ",e==null?null:e.label," "),s(2),me(" ",Z(10,14,e==null?null:e.unitPrice,"USD","symbol","1.2-2"),"/",e==null?null:e.unitLabel," "),s(4),p(" ",e==null?null:e.balance," Left "),s(2),pe("pointer-events-none",(e==null?null:e.additional)<=0)("opacity-50",(e==null?null:e.additional)<=0),s(4),V(e==null?null:e.additional),s(),p(" ",e==null?null:e.unitLabel," "),s(2),p(" ",Z(23,19,e==null?null:e.amount,"USD","symbol","1.2-2")," "),s(3),h(t.isAutoRenewAllowed(e==null?null:e.type)?25:-1)}}function Ri(n,c){if(n&1&&(o(0,"span",58),r(1),a()),n&2){let e=d().$implicit;s(),p(" (",e==null?null:e.quantityLabel,") ")}}function Li(n,c){if(n&1&&(o(0,"div",20)(1,"h4",26),r(2),m(3,Ri,2,1,"span",58),a(),o(4,"h4",26),r(5),y(6,"currency"),a()()),n&2){let e=c.$implicit;s(2),p(" ",e==null?null:e.label," "),s(),h(e!=null&&e.quantityLabel?3:-1),s(2),p(" ",Z(6,3,e==null?null:e.amount,"USD","symbol","1.2-2")," ")}}function $i(n,c){if(n&1&&(o(0,"div",16),A(1,Li,7,8,"div",20,R),a()),n&2){let e=d();s(),P(e.orderSummaryItems)}}function Vi(n,c){n&1&&(o(0,"p",17),r(1,' No credits added. Select services above and use "Add credit" to add them to your order. '),a())}var Re,Le=G(()=>{_e();pi();_i();ui();Bt();J();De();Be();Ut();qe();Qe();Tt();Me();ze();Se();gi();he();Re=(()=>{class n{constructor(e,t,i,l,u,b,_){this._loaderService=e,this._toasterService=t,this._creditService=i,this._billingService=l,this._dialog=u,this._aiAgentsService=b,this._utilities=_,this.messageConstant=j,this.planConstant=Mt,this.SMSBalance=0,this.callBalance=0,this.documentBalance=0,this.skipDataBalance=0,this.directMailBalance=0,this.eMailBalance=0,this.postcardBalance=0,this.aiCallTranscriptionBalance=0,this.investorBaseBalance=0,this.aiVoiceBalance=0,this.additionalCallBalance=0,this.additionalSMSBalance=0,this.additionalDocumentBalance=0,this.additionalSkipDataBalance=0,this.additionalDirectMailBalance=0,this.additionaleMailBalance=0,this.additionalPostcardBalance=0,this.additionalAiCallTranscriptionBalance=0,this.additionalInvestorBaseBalance=0,this.additionalAiVoiceBalance=0,this.emailCredit=0,this.aiVoiceCredit=0,this.isCallChecked=!1,this.isSMSChecked=!1,this.isDocumentChecked=!1,this.isSkipDataChecked=!1,this.isDirectMailChecked=!1,this.iseMailChecked=!1,this.isPostcardChecked=!1,this.isAiCallTranscriptionChecked=!1,this.isInvestorBaseChecked=!1,this.isAiVoiceChecked=!1,this.isPostcardShow=!1,this.isAiCallTranscriptsShow=!1,this.isPayButtonDisabled=!0,this.isPaySuccess=!1,this.payAmount=0,this.cardBrand="",this.cardNumber="",this.isAutoRenewEnabled=!1,this.autoRenewByType={},this.autoRenewThresholdByType={},this.autoRenewQuantityByType={},this.autoRenewThresholdLabelTimer=null,this.minimumAutoRenewThreshold=1,this.shouldPersistNormalizedAutoRenew=!1,this.autoRenewBalanceLoadedByType={},this.autoRenewInProgressByType={},this.autoRenewAttemptedByType={},this.autoRenewCreditKeyToType={call:"call",sms:"sms",document:"document",directMail:"directMail",investorBase:"investorBase",postcard:"postcard",email:"eMail",aiVoice:"voiceAi"},this.autoRenewExcludedTypes=new Set(["skipData"])}isAutoRenewAllowed(e){return!this.autoRenewExcludedTypes.has(e)}get autoRenewCredit(){return this._utilities?.userData?.autoRenewCredit}get autoRenewFields(){let e={};return Object.entries(this.autoRenewCreditKeyToType)?.forEach(([t,i])=>{let l=this.creditPackages?.find(u=>u?.type===i);e[t]={isEnabled:this.getAutoRenewForType(i),limit:this.getAutoRenewThreshold(i),renewalCredit:this.getAutoRenewQuantity(i),renewalAmount:l?this.getEstRefillCost(l):0}}),e}applyAutoRenewCreditFromUserData(){let e=this.autoRenewCredit;!e||typeof e!="object"||(Object.keys(this.autoRenewCreditKeyToType)?.forEach(t=>{let i=this.autoRenewCreditKeyToType[t],l=e[t];if(l&&typeof l=="object"){let u=!!l?.isEnabled,b=Number(l?.limit)||0,_=Number(l?.renew
1alCredit)||0,E=u?this.normalizeAutoRenewThreshold(b):Math.max(0,Math.round(b)),L=u?this.normalizeAutoRenewQuantity(i,_):Math.max(0,Math.round(_));this.autoRenewByType[i]=u,this.autoRenewThresholdByType[i]=E,this.autoRenewQuantityByType[i]=L,u&&(E!==b||L!==_)&&(this.shouldPersistNormalizedAutoRenew=!0)}}),this.checkMasterStatus())}getAutoRenewForType(e){return this.autoRenewByType[e]??!1}onMasterToggleChange(e){this.isAutoRenewEnabled=e,this.creditPackages?.filter(i=>this.isAutoRenewAllowed(i?.type))?.forEach(i=>{if(this.autoRenewByType[i?.type]=e,this.autoRenewAttemptedByType[i?.type]=!1,e){let l=this.getAutoRenewQuantityStepPlus(i?.type);this.setAutoRenewQuantity(i?.type,l),this.setAutoRenewThreshold(i?.type,Math?.round(l*.1))}}),this.scheduleSetAutoRenewThresholdLabel()}onIndividualAutoRenewChange(e,t){if(this.autoRenewByType[e]=t,this.autoRenewAttemptedByType[e]=!1,t){let i=this.getAutoRenewQuantityStepPlus(e);this.setAutoRenewQuantity(e,i),this.setAutoRenewThreshold(e,Math?.round(i*.1))}this.checkMasterStatus(),this.scheduleSetAutoRenewThresholdLabel()}checkMasterStatus(){let e=this.creditPackages?.filter(t=>this.isAutoRenewAllowed(t?.type));this.isAutoRenewEnabled=e?.length>0&&e?.every(t=>this.getAutoRenewForType(t?.type))}getAutoRenewThreshold(e){let t=this.autoRenewThresholdByType[e]??100;return this.getAutoRenewForType(e)?this.normalizeAutoRenewThreshold(t):Math.max(0,Math.round(Number(t)||0))}getAutoRenewQuantity(e){let t=this.autoRenewQuantityByType[e]??400;return this.getAutoRenewForType(e)?this.normalizeAutoRenewQuantity(e,t):Math.max(0,Math.round(Number(t)||0))}setAutoRenewThreshold(e,t){this.autoRenewThresholdByType[e]=this.getAutoRenewForType(e)?this.normalizeAutoRenewThreshold(t):Math.max(0,Math.round(Number(t)||0)),this.autoRenewAttemptedByType[e]=!1}onAutoRenewThresholdInput(e,t){this.setAutoRenewThreshold(e,t),this.scheduleSetAutoRenewThresholdLabel()}setAutoRenewQuantity(e,t){this.autoRenewQuantityByType[e]=this.getAutoRenewForType(e)?this.normalizeAutoRenewQuantity(e,t):Math.max(0,Math.round(Number(t)||0)),this.autoRenewAttemptedByType[e]=!1}normalizeAutoRenewThreshold(e){return Math.max(this.minimumAutoRenewThreshold,Math.round(Number(e)||0))}normalizeAutoRenewQuantity(e,t){return Math.max(e==="eMail"?1e3:1,Math.round(Number(t)||0))}getAutoRenewQuantityStepPlus(e){return this.planData?e==="call"?Math?.round(10/(this.planData?.callingMinutesCredit/100)):e==="sms"?Math?.round(10/(this.planData?.smsCredit/100)):e==="document"?Math?.round(10/(this.planData?.esign/100)):e==="skipData"?Math?.round(10/(this.planData?.skipTracing/100)):e==="directMail"?Math?.round(10/(this.planData?.directMail/100)):e==="eMail"?Math?.round(1e3/(this.planData?.eMail/100)):e==="voiceAi"?this.setAIVoiceBalance():e==="postcard"?Math?.round(10/(this.planData?.postcard/100)):e==="aiCallTranscription"?this.setAiCallTranscription():e==="investorBase"?this.setInvestorBaseBalance():1:e==="eMail"?1e3:1}getAutoRenewQuantityStepMinus(e){return this.planData?e==="call"?Math?.round(10/(this.planData?.callingMinutesCredit/100)):e==="sms"?Math?.round(10/(this.planData?.smsCredit/100)):e==="document"?Math?.round(10/(this.planData?.esign/100)):e==="skipData"?Math?.round(10/(this.planData?.skipTracing/100)):e==="directMail"?Math?.round(10/(this.planData?.directMail/100)):e==="eMail"?Math?.round(1e3*(this.planData?.eMail/100)):e==="voiceAi"?this.setAIVoiceBalance():e==="postcard"?Math?.round(10/(this.planData?.postcard/100)):e==="aiCallTranscription"?this.setAiCallTranscription():e==="investorBase"?this.setInvestorBaseBalance():1:e==="eMail"?1e3:1}onAutoRenewQuantityPlus(e){let t=this.getAutoRenewQuantity(e),i=this.getAutoRenewQuantityStepPlus(e);this.setAutoRenewQuantity(e,t+i),this.scheduleSetAutoRenewThresholdLabel()}getAutoRenewMinQuantity(e){return this.getAutoRenewQuantityStepPlus(e)}onAutoRenewQuantityMinus(e){let t=this.getAutoRenewQuantity(e),i=this.getAutoRenewQuantityStepMinus(e),l=this.getAutoRenewMinQuantity(e);if(t<=l)return;let u=t-i;this.setAutoRenewQuantity(e,u<l?l:u),this.scheduleSetAutoRenewThresholdLabel()}scheduleSetAutoRenewThresholdLabel(){this.autoRenewThresholdLabelTimer!=null&&clearTimeout(this.autoRenewThresholdLabelTimer),this.autoRenewThresholdLabelTimer=setTimeout(()=>{this.autoRenewThresholdLabelTimer=null,this.setAutoRenewalFields()},3e3)}getEstRefillCost(e){let t=this.getAutoRenewQuantity(e?.type);return e?.type==="eMail"?t/1e3:t*(e?.unitPrice||0)}ngOnDestroy(){this.autoRenewThresholdLabelTimer!=null&&(clearTimeout(this.autoRenewThresholdLabelTimer),this.autoRenewThresholdLabelTimer=null)}ngOnInit(){this.applyAutoRenewCreditFromUserData(),this.getPlanData(),this.get
1SMSCredit(),this.getCallCredit(),this.getDocumentCredit(),this.getSkipDataCredit(),this.getDirectMailCredit(),this.geteMailCredit(),this.getPostcardCredit(),this.getAiCallTranscriptionCredit(),this.getInvestorBaseCredit(),this.getAiVoiceCredit()}get totalDueToday(){return this.calculateTotalAmount()}get orderSummaryItems(){let e=[];return this.planData&&(this.additionalCallBalance>0&&e?.push({label:"Call minutes",amount:this.additionalCallBalance*(this.planData?.callingMinutesCredit/100),quantityLabel:`${this.additionalCallBalance} min`}),this.additionalSMSBalance>0&&e?.push({label:"SMS",amount:this.additionalSMSBalance*(this.planData?.smsCredit/100),quantityLabel:`${this.additionalSMSBalance} SMS`}),this.additionalDocumentBalance>0&&e?.push({label:"eSign documents",amount:this.additionalDocumentBalance*(this.planData?.esign/100),quantityLabel:`${this.additionalDocumentBalance} doc`}),this.additionalDirectMailBalance>0&&e?.push({label:"Direct Mail",amount:this.additionalDirectMailBalance*(this.planData?.directMail/100),quantityLabel:`${this.additionalDirectMailBalance} direct mail`}),this.additionalPostcardBalance>0&&e?.push({label:"Postcard",amount:this.additionalPostcardBalance*(this.planData?.postcard/100),quantityLabel:`${this.additionalPostcardBalance} postcard`}),this.emailCredit>0&&e?.push({label:"Email",amount:this.emailCredit*(this.planData?.eMail/100),quantityLabel:`${this.additionaleMailBalance} Email`}),this.aiVoiceCredit>0&&e?.push({label:"AI calling minutes",amount:this.aiVoiceCredit*(this.planData?.aiVoicePrice/100),quantityLabel:`${this.additionalAiVoiceBalance} min`}),this.additionalAiCallTranscriptionBalance>0&&e?.push({label:"AI Call Summary",amount:this.additionalAiCallTranscriptionBalance*(this.planData?.aiCallTranscription/100),quantityLabel:`${this.additionalAiCallTranscriptionBalance} summary`}),this.additionalInvestorBaseBalance>0&&e?.push({label:"Cash Buyer Searches",amount:this.additionalInvestorBaseBalance*(this.planData?.additionalInvestorBase/100),quantityLabel:`${this.additionalInvestorBaseBalance} search`}),this.additionalSkipDataBalance>0&&e?.push({label:"Skip Tracing",amount:this.additionalSkipDataBalance*(this.planData?.skipTracing/100),quantityLabel:`${this.additionalSkipDataBalance} skip trace`})),e}get creditPackages(){let e=this.planData,t=this._utilities.isNewPlanUser(this.planData);return[{type:"call",label:"Call Minutes",icon:"assets/images/icons/call.svg",unitLabel:"Min",balance:this.callBalance,additional:this.additionalCallBalance,checked:this.isCallChecked,autoRenew:this.getAutoRenewForType("call"),unitPrice:e?e?.callingMinutesCredit/100:0,amount:this.additionalCallBalance*(e?e?.callingMinutesCredit/100:0),show:!t&&!e?.isUnlimitedPlan},{type:"sms",label:"SMS Credit",icon:"assets/images/icons/sms.svg",unitLabel:"SMS",balance:this.SMSBalance,additional:this.additionalSMSBalance,checked:this.isSMSChecked,autoRenew:this.getAutoRenewForType("sms"),unitPrice:e?e?.smsCredit/100:0,amount:this.additionalSMSBalance*(e?e?.smsCredit/100:0),show:!t&&!e?.isUnlimitedPlan},{type:"document",label:"eSign Docs",icon:"assets/images/icons/esign.svg",unitLabel:"doc",balance:this.documentBalance,additional:this.additionalDocumentBalance,checked:this.isDocumentChecked,autoRenew:this.getAutoRenewForType("document"),unitPrice:e?e?.esign/100:0,amount:this.additionalDocumentBalance*(e?e?.esign/100:0),show:!t},{type:"directMail",label:"Direct Mail",icon:"assets/images/icons/direct-mail.svg",unitLabel:"direct mail",balance:this.directMailBalance,additional:this.additionalDirectMailBalance,checked:this.isDirectMailChecked,autoRenew:this.getAutoRenewForType("directMail"),unitPrice:e?e?.directMail/100:0,amount:this.additionalDirectMailBalance*(e?e?.directMail/100:0),show:!0},{type:"investorBase",label:"Cash Buyer Searches",icon:"assets/images/icons/money-2.svg",unitLabel:"search",balance:this.investorBaseBalance,additional:this.additionalInvestorBaseBalance,checked:this.isInvestorBaseChecked,autoRenew:this.getAutoRenewForType("investorBase"),unitPrice:e?e?.additionalInvestorBase/100:0,amount:this.additionalInvestorBaseBalance*(e?e?.additionalInvestorBase/100:0),show:!t},{type:"postcard",label:"D4$ Postcard",icon:"assets/images/icons/car.svg",unitLabel:"postcard",balance:this.postcardBalance,additional:this.additionalPostcardBalance,checked:this.isPostcardChecked,autoRenew:this.getAutoRenewForType("postcard"),unitPrice:e?e?.postcard/100:0,amount:this.additionalPostcardBalance*(e?e?.postcard/100:0),show:this.isPostcardShow},{type:"eMail",label:"Email",icon:"assets/images/icons/email.svg",unitLabel:"Per 1000 Email",balance:this.eMailBalance,additional:this.additionaleMailBalance,checked:this.iseMailChecked,autoRenew:this.getAutoRenewForType("eMail"),unitPrice:e?1:0,amount:this.emailCredit*(e?1:0),show:!t&&!e?.isUnlimitedPlan},{type:"voiceAi",label:"AI Voice",icon:"assets/images/icons/ai.svg",unitLabel:"min",balance:this.aiVoiceBalance,additional:this.additionalAiVoiceBalance,checked:this.isAiVoiceChecked,autoRenew:this.getAutoRenewForType("voiceAi"),unitPrice:e?e?.aiVoicePrice/100:0,amount:this.aiVoiceCredit*(e?e?.aiVoicePrice/100:0),show:!0},{type:"skipData",label:"Skip Tracing",icon:"assets/images/icons/skip-trace.svg",unitLabel:"skip trace",balance:this.skipDataBalance,additional:this.additionalSkipDataBalance,checked:this.isSkipDataChecked,autoRenew:this.getAutoRenewForType("skipData"),unitPrice:e?e?.skipTracing/100:0,amount:this.additionalSkipDataBalance*(e?e?.skipTracing/100:0),show:!0}].filter(i=>i?.show)}calculateTotalAmount(){return this.planData?this.additionalCallBalance*(this.planData?.callingMinutesCredit/100)+this.additionalSMSBalance*(this.planData?.smsCredit/100)+this.additionalDocumentBalance*(this.planData?.esign/100)+this.additionalSkipDataBalance*(this.planData?.ski
1pTracing/100)+this.additionalDirectMailBalance*(this.planData?.directMail/100)+this.emailCredit*(this.planData?.eMail/100)+this.aiVoiceCredit*(this.planData?.aiVoicePrice/100)+this.additionalPostcardBalance*(this.planData?.postcard/100)+this.additionalAiCallTranscriptionBalance*(this.planData?.aiCallTranscription/100)+this.additionalInvestorBaseBalance*(this.planData?.additionalInvestorBase/100):0}getBuyCreditDescription(){let e=[];return this.additionalCallBalance>0&&e.push("Calls"),this.additionalSMSBalance>0&&e.push("SMS"),this.additionalDocumentBalance>0&&e.push("DOCUMENTS"),this.additionalSkipDataBalance>0&&e.push("SkipData"),this.additionalDirectMailBalance>0&&e.push("Direct Mail"),this.additionaleMailBalance>0&&e.push("Email"),this.additionalPostcardBalance>0&&e.push("Postcard"),this.additionalAiCallTranscriptionBalance>0&&e.push("AiCallTranscription"),this.additionalInvestorBaseBalance>0&&e.push("Cash Buyer Searches"),this.additionalAiVoiceBalance>0&&e.push("AI calling minutes"),e.length?`Buy Credit: ${e.join(", ")}`:"Buy Credit"}onPlusAction(e){if(e==="call"){let t=Math?.round(10/(this.planData?.callingMinutesCredit/100));this.additionalCallBalance+=t}else if(e==="sms"){let t=Math?.round(10/(this.planData?.smsCredit/100));this.additionalSMSBalance+=t}else if(e==="document"){let t=Math?.round(10/(this.planData?.esign/100));this.additionalDocumentBalance+=t}else if(e==="skipData"){let t=Math?.round(10/(this.planData?.skipTracing/100));this.additionalSkipDataBalance+=t}else if(e==="directMail"){let t=Math?.round(10/(this.planData?.directMail/100));this.additionalDirectMailBalance+=t}else if(e==="eMail"){let t=Math?.round(1e3/(this.planData?.eMail/100));this.additionaleMailBalance+=t,this.emailCredit=this.additionaleMailBalance/1e3}else if(e==="voiceAi"){let t=this.setAIVoiceBalance();this.additionalAiVoiceBalance+=t,this.aiVoiceCredit=this.additionalAiVoiceBalance}else if(e==="postcard"){let t=Math?.round(10/(this.planData?.postcard/100));this.additionalPostcardBalance+=t}else if(e==="aiCallTranscription"){let t=this.setAiCallTranscription();this.additionalAiCallTranscriptionBalance+=t}else if(e==="investorBase"){let t=this.setInvestorBaseBalance();this.additionalInvestorBaseBalance+=t}}onMinusAction(e){if(e==="call"){let t=Math?.round(10/(this.planData?.callingMinutesCredit/100));if(this.additionalCallBalance<=t){this.additionalCallBalance=0,this.isCallChecked=!1;return}this.additionalCallBalance-=t}else if(e==="sms"){let t=Math?.round(10/(this.planData?.smsCredit/100));if(this.additionalSMSBalance<=t){this.additionalSMSBalance=0,this.isSMSChecked=!1;return}this.additionalSMSBalance-=t}else if(e==="document"){let t=Math?.round(10/(this.planData?.esign/100));if(this.additionalDocumentBalance<=t){this.additionalDocumentBalance=0,this.isDocumentChecked=!1;return}this.additionalDocumentBalance-=t}else if(e==="skipData"){let t=Math?.round(10/(this.planData?.skipTracing/100));if(this.additionalSkipDataBalance<=t){this.additionalSkipDataBalance=0,this.isSkipDataChecked=!1;return}this.additionalSkipDataBalance-=t}else if(e==="directMail"){let t=Math?.round(10/(this.planData?.directMail/100));if(this.additionalDirectMailBalance<=t){this.additionalDirectMailBalance=0,this.isDirectMailChecked=!1;return}this.additionalDirectMailBalance-=t}else if(e==="eMail"){let t=Math?.round(1e3*(this.planData?.eMail/100));if(this.additionaleMailBalance<=t){this.additionaleMailBalance=0,this.emailCredit=0,this.iseMailChecked=!1;return}this.additionaleMailBalance-=t,this.emailCredit-=t/1e3}else if(e==="voiceAi"){let t=this.setAIVoiceBalance();if(this.additionalAiVoiceBalance<=t){this.additionalAiVoiceBalance=0,this.aiVoiceCredit=0,this.isAiVoiceChecked=!1;return}this.additionalAiVoiceBalance-=t,this.aiVoiceCredit-=t}else if(e==="postcard"){let t=Math?.round(10/(this.planData?.postcard/100));if(this.additionalPostcardBalance<=t){this.additionalPostcardBalance=0,this.isPostcardChecked=!1;return}this.additionalPostcardBalance-=t}else if(e==="aiCallTranscription"){let t=this.setAiCallTranscription();if(this.additionalAiCallTranscriptionBalance<=t){this.additionalAiCallTranscriptionBalance=0,this.isAiCallTranscriptionChecked=!1;return}this.additionalAiCallTranscriptionBalance-=t}else if(e==="investorBase"){let t=this.setInvestorBaseBalance();if(this.additionalInvestorBaseBalance<=t){this.additionalInvestorBaseBalance=0,this.isInvestorBaseChecked=!1;return}this.additionalInvestorBaseBalance-=t}}onChangeCheck(e){if(this.changePayButton(),e==="call")if(this.isCallChecked){let t=Math?.round(10/(this.planData?.callingMinutesCredit/100));this.additionalCallBalance=t}else this.additionalCallBalance=0;else if(e==="sms")if(this.isSMSChecked){let t=Math?.round(10/(this.planData?.smsCredit/100));this.additionalSMSBalance=t}else this.additionalSMSBalance=0;else if(e==="document")if(this.isDocumentChecked){let t=Math?.round(10/(this.planData?.esign/100));this.additionalDocumentBalance=t}else this.additionalDocumentBalance=0;else if(e==="skipData")if(this.isSkipDataChecked){let t=Math?.round(10/(this.planData?.ski
1pTracing/100));this.additionalSkipDataBalance=t}else this.additionalSkipDataBalance=0;else if(e==="directMail")if(this.isDirectMailChecked){let t=Math?.round(10/(this.planData?.directMail/100));this.additionalDirectMailBalance=t}else this.additionalDirectMailBalance=0;else if(e==="eMail")if(this.iseMailChecked){let t=Math?.round(1e3*(this.planData?.eMail/100));this.additionaleMailBalance=t,this.emailCredit=this.additionaleMailBalance/1e3}else this.additionaleMailBalance=0,this.emailCredit=0;else if(e==="voiceAi")if(this.isAiVoiceChecked){let t=this.setAIVoiceBalance();this.additionalAiVoiceBalance=t,this.aiVoiceCredit=this.additionalAiVoiceBalance}else this.additionalAiVoiceBalance=0,this.aiVoiceCredit=0;else if(e==="postcard")if(this.isPostcardChecked){let t=Math?.round(10/(this.planData?.postcard/100));this.additionalPostcardBalance=t}else this.additionalPostcardBalance=0;else if(e==="aiCallTranscription")if(this.isAiCallTranscriptionChecked){let t=this.setAiCallTranscription();this.additionalAiCallTranscriptionBalance=t}else this.additionalAiCallTranscriptionBalance=0;else if(e==="investorBase")if(this.isInvestorBaseChecked){let t=this.setInvestorBaseBalance();this.additionalInvestorBaseBalance=t}else this.additionalInvestorBaseBalance=0}changePayButton(){this.isPayButtonDisabled=!(this.isCallChecked||this.isSMSChecked||this.isDocumentChecked||this.isSkipDataChecked||this.isDirectMailChecked||this.isPostcardChecked||this.isAiCallTranscriptionChecked||this.iseMailChecked||this.isInvestorBaseChecked||this.isAiVoiceChecked)}onPayAction(){this.isPaySuccess=!1;let e=this.calculateTotalAmount();if(e<=0)return;let t=this.getBuyCreditDescription();this.dialogRef=this._dialog?.open(jt,{width:"600px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{totalAmount:e,description:t,paymentType:3}}),this.dialogRef?.afterClosed()?.subscribe(i=>{i&&(i?.isPaymentSuccess?(this.isPaySuccess=!0,this.cardBrand=i?.cardData?.brand,this.cardNumber=i?.cardData?.last4,this.payAmount=i?.amount/100,setTimeout(()=>this.isPaySuccess=!1,5e3),this.updateCredit()):i.isAddCard&&this.addCard(e,t))})}addCard(e,t=this.getBuyCreditDescription()){this.dialogRef=this._dialog?.open(Dt,{width:"600px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{action:"pay",amount:e,description:t,paymentType:3}}),this.dialogRef?.afterClosed()?.subscribe(i=>{i?.isPaymentSuccess&&(this.isPaySuccess=!0,this.cardBrand=i?.cardData?.brand,this.cardNumber=i?.cardData?.last4,this.payAmount=i?.amount/100,setTimeout(()=>this.isPaySuccess=!1,5e3),this.updateCredit())})}getPlanData(){this._loaderService?.start(),this._creditService?.getUserPlan({})?.subscribe(e=>{this._loaderService?.stop(),e?.statusCode===200?(this.planData=e?.data,this.shouldPersistNormalizedAutoRenew&&(this.shouldPersistNormalizedAutoRenew=!1,this.setAutoRenewalFields()),this.triggerAutoRenewForEligibleTypes()):this._toasterService?.showError(e?.message??"")},e=>{this._loaderService?.stop();let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getSMSCredit(){this._creditService?.getSMSCredit({})?.subscribe(e=>{e?.statusCode===200?(this.SMSBalance=e?.data,this.markAutoRenewBalanceLoaded("sms")):this._toasterService.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getCallCredit(){this._creditService?.getCallCredit({})?.subscribe(e=>{e?.statusCode===200?(this.callBalance=e?.data,this.markAutoRenewBalanceLoaded("call")):this._toasterService.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getDocumentCredit(){this._creditService?.getDocumentCredit({})?.subscribe(e=>{e?.statusCode===200?(this.documentBalance=e?.data,this.markAutoRenewBalanceLoaded("document")):this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getSkipDataCredit(){this._creditService?.getSkipDataCredit({})?.subscribe(e=>{e?.statusCode===200?this.skipDataBalance=e?.data:this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getDirectMailCredit(){this._creditService?.getDirectMailCredit({})?.subscribe(e=>{e?.statusCode===200?(this.directMailBalance=e?.data,this.markAutoRenewBalanceLoaded("directMail")):this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}geteMailCredit(){this._creditService.geteMailCredit({})?.subscribe(e=>{e?.statusCode===200?(this.eMailBalance=e?.data,this.markAutoRenewBalanceLoaded("eMail")):this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getPostcardCredit(){this._creditService?.getPostcardCredit({})?.subscribe(e=>{e?.statusCode===200?(this.isPostcardShow=!0,this.postcardBalance=e?.data,this.markAutoRenewBalanceLoaded("postc
1ard")):this._toasterService?.showError(e?.message??"")},e=>{this.isPostcardShow=!1})}getAiCallTranscriptionCredit(){this._aiAgentsService?.getAiCallTranscriptionCredit({})?.subscribe(e=>{if(e?.statusCode===200){let t=e?.data;this.aiCallTranscriptionBalance=t?.credit,t?.isAiCallTranscriptionUnlimited||(this.isAiCallTranscriptsShow=!0)}else this._toasterService?.showError(e?.message??"")},()=>{})}getInvestorBaseCredit(){this._creditService?.getInvestorBaseCredit({})?.subscribe(e=>{e?.statusCode===200?(this.investorBaseBalance=e?.data,this.markAutoRenewBalanceLoaded("investorBase")):this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}getAiVoiceCredit(){this._creditService?.getAIVoiceCredit({})?.subscribe(e=>{e?.statusCode===200?(this.aiVoiceBalance=e?.data,this.markAutoRenewBalanceLoaded("voiceAi")):this._toasterService?.showError(e?.message??"")},e=>{let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}markAutoRenewBalanceLoaded(e){this.autoRenewBalanceLoadedByType[e]=!0,this.triggerAutoRenewForTypeIfNeeded(e)}triggerAutoRenewForEligibleTypes(){this.creditPackages?.forEach(e=>this.triggerAutoRenewForTypeIfNeeded(e?.type))}triggerAutoRenewForTypeIfNeeded(e){let t=this.creditPackages?.find(_=>_?.type===e);if(!this.planData||!t||!this.autoRenewBalanceLoadedByType[e]||!this.getAutoRenewForType(e)||this.autoRenewInProgressByType[e]||this.autoRenewAttemptedByType[e])return;let i=Number(t?.balance??0),l=this.getAutoRenewThreshold(e);if(i>l)return;let u=this.getAutoRenewQuantity(e),b=this.getEstRefillCost(t);u<=0||b<=0||(this.autoRenewInProgressByType[e]=!0,this.autoRenewAttemptedByType[e]=!0,this.chargeAutoRenewCredit(t,b,u))}chargeAutoRenewCredit(e,t,i){this._billingService?.getCardList({}).subscribe(l=>{if(l?.statusCode!==200){this.releaseAutoRenewAttempt(e?.type),this._toasterService?.showError(l?.message??"");return}let u=l?.data?.find(b=>b?.isDefaultCard);if(!u?.id){this.releaseAutoRenewAttempt(e?.type),this._toasterService?.showError("Please add a default card to use auto renew.");return}this._billingService?.chargeAmount({cardSourceId:u?.id,amount:t.toFixed(2),description:`Auto renewal ${e?.label} credit`,paymentType:3}).subscribe(b=>{b?.statusCode===200?this.updateAutoRenewCredit(e?.type,i):(this.releaseAutoRenewAttempt(e?.type),this._toasterService?.showError(b?.message??""))},b=>{this.releaseAutoRenewAttempt(e?.type);let _=b?.error;this._toasterService?.showError(_?.message??this.messageConstant.unknownError)})},l=>{this.releaseAutoRenewAttempt(e?.type);let u=l?.error;this._toasterService?.showError(u?.message??this.messageConstant.unknownError)})}releaseAutoRenewAttempt(e){this.autoRenewInProgressByType[e]=!1,this.autoRenewAttemptedByType[e]=!1}updateAutoRenewCredit(e,t){this._creditService?.updateCredit(this.getAutoRenewUpdateCreditParam(e,t)).subscribe(i=>{this.autoRenewInProgressByType[e]=!1,i?.statusCode===200?this.refreshAutoRenewBalance(e):this._toasterService?.showError(i?.message??"")},i=>{this.autoRenewInProgressByType[e]=!1;let l=i?.error;this._toasterService?.showError(l?.message??this.messageConstant.unknownError)})}getAutoRenewUpdateCreditParam(e,t){let i={additionalSMS:0,additionalCalling:0,additionalDocument:0,additionalSkipData:0,additionalDirectMail:0,additionaleMail:0,additionalPostcard:0,additionalAiCallTranscription:0,additionalInvestorBase:0,additionaleAIVoice:0},u={sms:"additionalSMS",call:"additionalCalling",document:"additionalDocument",directMail:"additionalDirectMail",eMail:"additionaleMail",postcard:"additionalPostcard",investorBase:"additionalInvestorBase",voiceAi:"additionaleAIVoice"}[e];return u&&(i[u]=t),i}refreshAutoRenewBalance(e){e==="sms"?this.getSMSCredit():e==="call"?this.getCallCredit():e==="document"?this.getDocumentCredit():e==="directMail"?this.getDirectMailCredit():e==="eMail"?this.geteMailCredit():e==="postcard"?this.getPostcardCredit():e==="investorBase"?this.getInvestorBaseCredit():e==="voiceAi"&&this.getAiVoiceCredit()}updateCredit(){let e={additionalSMS:this.additionalSMSBalance,additionalCalling:this.additionalCallBalance,additionalDocument:this.additionalDocumentBalance,additionalSkipData:this.additionalSkipDataBalance,additionalDirectMail:this.additionalDirectMailBalance,additionaleMail:this.additionaleMailBalance,additionalPostcard:this.additionalPostcardBalance,additionalAiCallTranscription:this.additionalAiCallTranscriptionBalance,additionalInvestorBase:this.additionalInvestorBaseBalance,additionaleAIVoice:this.additionalAiVoiceBalance};this._creditService?.updateCredit(e)?.subscribe(t=>{t?.statusCode===200?(this.openAlertDialog(t?.data),this.resetData()):this._toasterService?.showError(t?.message??"")},t=>{let i=t?.error;this._toasterService?.showError(i?.message??this.messageConstant?.unknownError)})}resetData(){this.SMSBalance=0,this.callBalance=0,this.documentBalance=0,this.skipDataBalance=0,this.directMailBalance=0,this.postcardBalance=0,this.additionalCallBalance=0,this.additionalSMSBalance=0,this.additionalDocumentBalance=0,this.additionalSkipDataBalance=0,this.additionalDirectMailBalance=0,this.additionaleMailBalance=0,this.additionalPostcardBalance=0,this.additionalAiCallTranscriptionBalance=0,this.emailCredit=0,this.additionalInvestorBaseBalance=0,this.additionalAiVoiceBalance=0,this.aiVoiceCredit=0,this.isCallChecked=!1,this.isSMSChecked=!1,this.isDocumentChecked=!1,this.isSkipDataChecked=!1,this.isDirectMailChecked=!1,this.iseMailChecked=!1,this.isPostcardChecked=!1,this.isAiCallTranscriptionChecked=!1,this.isInvestorBaseChecked=!1,this.isAiVoiceChecked=!1,this.get
1SMSCredit(),this.getCallCredit(),this.getDocumentCredit(),this.getSkipDataCredit(),this.getDirectMailCredit(),this.geteMailCredit(),this.getPostcardCredit(),this.getAiCallTranscriptionCredit(),this.getInvestorBaseCredit(),this.getAiVoiceCredit()}openAlertDialog(e){this.dialogRef=this._dialog?.open(we,{width:"500px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{yesTitle:"Ok",header:"Payment Success",hideNoButton:!0,text:`Payment successful. <b>$${this.payAmount?.toFixed(2)}</b> paid via <b>${this.cardBrand}</b> ending with <b>${this.cardNumber}</b><br><br>${e}`}})}setAiCallTranscription(){return this.planData?._id===this.planConstant.Plan.ENTERPRISE?Math?.round(10/(this.planData?.aiCallTranscription/100)):this.planData?._id===this.planConstant.Plan.PRO?Math?.round(20/(this.planData?.aiCallTranscription/100)):this.planData?._id===this.planConstant.Plan.BASIC?Math?.round(30/(this.planData?.aiCallTranscription/100)):0}setInvestorBaseBalance(){let e=this.planData?._id;return e===this.planConstant.Plan.ENTERPRISE||e===this.planConstant.Plan.PRO||e===this.planConstant.Plan.BASIC?Math?.round(10/(this.planData?.additionalInvestorBase/100)):0}setAIVoiceBalance(){let e=this.planData?._id;return e===this.planConstant.Plan.ENTERPRISE||e===this.planConstant.Plan.PRO||e===this.planConstant.Plan.BASIC?Math?.round(10/(this.planData?.aiVoicePrice/100)):0}isShowAiCallTranscription(){return this.planData?._id===this.planConstant.Plan.ENTERPRISE}trackByCreditType(e,t){return t?.type}getBalanceBarWidth(e){return!e||e<=0?0:Math?.min(100,e/1e3*100)}setAutoRenewalFields(){this._loaderService?.start(),this._creditService?.setAutoRenwalCredit(this.autoRenewFields)?.subscribe(e=>{this._loaderService?.stop(),e?.statusCode===200?this.triggerAutoRenewForEligibleTypes():this._toasterService?.showError(e?.message??"")},e=>{this._loaderService?.stop();let t=e?.error;this._toasterService?.showError(t?.message??this.messageConstant?.unknownError)})}static{this.\u0275fac=function(t){return new(t||n)(x(z),x(Q),x(Ae),x(oe),x(ae),x(Te),x(q))}}static{this.\u0275cmp=U({type:n,selectors:[["app-buy-credit"]],standalone:!1,decls:39,vars:14,consts:[[1,"flex","flex-1","gap-4","relative"],[1,"absolute","top-0","left-0","right-0","z-10","flex","items-center","justify-center","p-3","rounded-lg","bg-green-100","border-[1px]","border-solid","border-green-300","text-green-800","text-p","font-medium"],[1,"flex-1","h-[calc(100vh_-_240px)]","overflow-y-auto"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"w-[400px]","h-[calc(100vh_-_240px)]","overflow-y-auto"],[1,"flex","items-center","self-stretch","gap-[10px]","p-[20px]","bg-primary-70","rounded-[20px]","border-[1px]","border-solid","border-primary-70","mb-[20px]"],[1,"flex-1","flex","flex-col","items-start","self-stretch","gap-[5px]"],[1,"text-h3","text-transparency-white","font-semibold"],[1,"text-label","text-transparency-white","opacity-70","font-medium"],[3,"checkedChange","checked"],[1,"flex","flex-col","items-start","self-stretch","gap-[2px]","bg-transparency-25","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden"],[1,"flex","items-center","self-stretch","p-[20px]","bg-primary-70"],[1,"text-h2","text-transparency-white","font-semibold"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","py-[15px]","px-[20px]","pb-[30px]","bg-transparency-0"],[1,"text-h5","text-transparency-100","opacity-60","font-semibold"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]"],[1,"text-p","text-transparency-100","opacity-60"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","py-[30px]","px-[20px]","bg-transparency-0"],[1,"flex","flex-col","items-start","self-stretch","gap-[25px]"],[1,"flex","items-center","justify-between","self-stretch","gap-[10px]"],[1,"text-h2","text-transparency-100","font-semibold"],["label","Pay Now","variant","filled","type","default","size","44","shape","rounded",1,"w-full",3,"clicked","leftIcon","customClass","disabled"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/separator-horizontal.svg",1,"inline-flex","m-auto"],[1,"flex","flex-col","items-start","self-stretch","gap-[5px]"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"text-p","text-transparency-100","font-medium","opacity-70"],[1,"flex","items-center","flex-wrap","self-stretch","gap-[20px]","py-[10
1px]"],[1,"flex-1","flex","items-center","gap-[10px]"],[1,"flex","items-center","justify-center","p-[6px]","bg-transparency-15","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[20px] h-[20px] block text-transparency-100",3,"src"],[1,"flex-1","flex","flex-col","items-start","self-stretch","gap-[2px]"],[1,"text-h2/[normal]","text-transparency-100","font-semibold"],[1,"text-h5/[normal]","text-transparency-100","font-semibold","opacity-70"],[1,"w-[180px]","flex","items-center","justify-center","gap-[10px]","p-[10px]","bg-transparency-15","rounded-[30px]"],[1,"min-w-[180px]","flex","items-center","justify-between","gap-[5px]","py-[4px]","px-[8px]","bg-activity-outbound-bg","rounded-[40px]","border-[1px]","border-solid","border-activity-outbound-hover-border"],["svgClass","w-[18px] h-[18px] block text-primary-90","src","assets/images/icons/minus.svg",1,"cursor-pointer",3,"click"],[1,"flex-1","flex","flex-col","items-center","justify-center","self-stretch"],[1,"text-h4/[normal]","text-transparency-90","font-semibold"],[1,"text-transparency-100"],[1,"text-h5/[normal]","text-transparency-100","font-semibold","opacity-60"],["svgClass","w-[18px] h-[18px] block text-primary-90","src","assets/images/icons/plus.svg",1,"cursor-pointer",3,"click"],["svgClass","w-full h-full","src","assets/images/icons/line-3.svg",1,"inline-flex","m-auto"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","py-[10px]"],[1,"flex","items-center","flex-wrap","justify-between","self-stretch","gap-[20px]"],[1,"flex","items-center","gap-[10px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[2px]"],[1,"text-h4/[normal]","text-transparency-100","font-semibold"],[1,"flex","flex-wrap","items-center","gap-3","py-3","px-4","bg-transparency-0","rounded-2xl","border-[1px]","border-solid","border-transparency-25"],[1,"text-p","text-transparency-100","font-medium","shrink-0"],[1,"flex","items-center","gap-1.5","shrink-0"],["type","number","inputmode","numeric","min","1","step","1",1,"w-20","text-center","text-h4","font-semibold","text-transparency-100","py-2","px-3","rounded-xl","border-[1px]","border-solid","border-transparency-25","bg-transparency-0","focus:outline-none","[appearance:textfield]","[&::-webkit-outer-spin-button]:appearance-none","[&::-webkit-inner-spin-button]:appearance-none",3,"input","value"],[1,"text-p","text-transparency-90","font-medium"],[1,"min-w-[160px]","flex","items-center","justify-between","gap-[5px]","py-[4px]","px-[8px]","bg-transparency-0","rounded-[40px]","border-[1px]","border-solid","border-transparency-25","shrink-0"],["svgClass","w-[18px] h-[18px] block text-primary-90","src","assets/images/icons/minus.svg",1,"cursor-pointer","shrink-0",3,"click"],[1,"flex-1","flex","flex-col","items-center","justify-center","self-stretch","min-w-0"],["svgClass","w-[18px] h-[18px] block text-primary-90","src","assets/images/icons/plus.svg",1,"cursor-pointer","shrink-0",3,"click"],[1,"text-label-sm","text-transparency-90","font-semibold"]],template:function(t,i){t&1&&(o(0,"div",0),m(1,Mi,11,8,"div",1),o(2,"div",2)(3,"div",3),A(4,Ei,26,24,"div",4,i.trackByCreditType,!0),a()(),o(6,"div",5)(7,"div",6)(8,"div",7)(9,"h3",8),r(10," Enable Auto Renew "),a(),o(11,"div",9),r(12," Auto renew credit to automatically purchase credits when your balance hits your custom safety threshold. "),a()(),o(13,"app-switch",10),S("checkedChange",function(u){return i.onMasterToggleChange(u)}),a()(),o(14,"div",11)(15,"div",12)(16,"h2",13),r(17," Order Summary "),a()(),o(18,"div",14)(19,"h5",15),r(20," Added credits "),a(),m(21,$i,3,0,"div",16),m(22,Vi,2,0,"p",17),a(),o(23,"div",18)(24,"div",19)(25,"div",20)(26,"h2",21),r(27," Total Due Today "),a(),o(28,"h2",21),r(29),y(30,"currency"),a()(),o(31,"app-button",22),S("clicked",function(){return i.onPayAction()}),a()(),o(32,"div",23),v(33,"svg-icon",24),a(),o(34,"div",25)(35,"h4",26),r(36," Auto renew policy "),a(),o(37,"p",27),r(38),a()()()()()()),t&2&&(s(),h(i.isPaySuccess?1:-1),s(3),P(i.creditPackages),s(9),f("checked",i.isAutoRenewEnabled),s(8),h((i.orderSummaryItems==null?null:i.orderSummaryItems.length)>0?21:-1),s(),h((i.orderSummaryItems==null?null:i.orderSummaryItems.length)===0?22:-1),s(7),p(" ",Z(30,9,i.totalDueToday,"USD","symbol","1.2-2")," "),s(2),f("leftIcon",!1)("customClass","w-full justify-center")("disabled",i.totalDueToday<=0),s(7),p(" Auto-renewal of credit activates immediately when your balance reaches the set threshold. Charges will show as ","Renew Credit"," on your statement. "))},dependencies:[se,H,Pt,bt,ye],encapsulation:2})}}return n})()});function Ni(n,c){if(n&1){let e=I();ct(0,null,0),o(2,"div",24),S("click",function(){let i=M(e).$index,l=d(3);return k(l.selectItem(i))}),o(3,"div",25)(4,"div",26),v(5,"svg-icon",27),a(),o(6,"div",28)(7,"h3",29),r(8),a(),o(9,"div",30),r(10),y(11,"currency"),y(12,"myTimezone"),a(),o(13,"h4",31),r(14),y(15,"myTimezone"),a()()(),o(16,"div",32)(17,"div",33),v(18,"div",34),r(19," Active "),a(),v(20,"svg-icon",35),a()(),dt()}if(n&2){let e=c.$implicit,t=c.$index,i=d(3);s(2),f("ngClass",i.selectedItemIndex==t?"border-solid border-activity-outboun
1d-hover-border bg-activity-outbound-hover-bg":"border-solid border-transparency-25 bg-transparency-10"),s(2),f("ngClass",i.selectedItemIndex==t?"border-solid border-primary-30 text-primary-90 bg-activity-outbound-hover-bg":"border-solid border-transparency-25 text-transparency-100"),s(),f("src",i.dataBuilder(e)),s(3),p(" ",i.getSubscriptionDisplayName(e==null?null:e.description)," "),s(2),gt(" ",Ce(11,9,e==null?null:e.amount,"USD",!0),"/",e==null?null:e.interval," \u2022 Since ",w(12,13,e==null?null:e.createdAt,"MMM D, YYYY")," "),s(4),p(" Next renewal: ",w(15,16,e==null?null:e.endDate,"MMM D, YYYY")," "),s(6),f("ngClass",i.selectedItemIndex==t?"bg-primary-90 text-transparency-0":"text-transparency-100")}}function Oi(n,c){if(n&1){let e=I();o(0,"div",36),v(1,"svg-icon",37),a(),o(2,"app-button",38),S("click",function(){M(e);let i=d(3);return k(i.subscriptionStop(i.selectedItem))}),a()}n&2&&(s(2),f("leftIcon",!1))}function Yi(n,c){if(n&1&&(o(0,"div",10),A(1,Ni,21,19,"ng-container",null,R),a(),o(3,"div",11)(4,"div",12)(5,"div",13)(6,"h2",7),r(7," Subscription Details "),a(),o(8,"div",14),r(9),a()(),o(10,"div",15),r(11," Active "),a()(),o(12,"div",16)(13,"div",6)(14,"div",17)(15,"h4",18),r(16," Service Information "),a(),o(17,"div",19)(18,"div",20),r(19," Feature "),a(),o(20,"h4",21),r(21),a()()(),o(22,"div",17)(23,"h4",18),r(24," Status & Date "),a(),o(25,"div",22)(26,"div",19)(27,"div",20),r(28," Status "),a(),o(29,"h4",23),r(30," Active "),a()(),o(31,"div",19)(32,"div",20),r(33," Subscribed Date "),a(),o(34,"h4",21),r(35),y(36,"myTimezone"),a()()()(),o(37,"div",17)(38,"h4",18),r(39," Payment & Billing "),a(),o(40,"div",22)(41,"div",19)(42,"div",20),r(43," Price "),a(),o(44,"h4",21),r(45),y(46,"currency"),a()(),o(47,"div",19)(48,"div",20),r(49," Last Renewal "),a(),o(50,"h4",21),r(51),y(52,"myTimezone"),y(53,"currency"),a()()()()(),m(54,Oi,3,1),a()()),n&2){let e=d(2);s(),P(e.addOnData),s(8),p(" ",e.getSubscriptionDisplayName(e.selectedItem==null?null:e.selectedItem.description)," "),s(12),p(" ",e.getSubscriptionDisplayName(e.selectedItem==null?null:e.selectedItem.description)," "),s(14),p(" ",w(36,8,e.selectedItem==null?null:e.selectedItem.createdAt,"MMM D, YYYY")," "),s(10),me(" ",Ce(46,11,e.selectedItem==null?null:e.selectedItem.amount,"USD",!0),"/",e.selectedItem==null?null:e.selectedItem.interval," "),s(6),me(" ",w(52,15,e.selectedItem==null?null:e.selectedItem.startDate,"MMM D, YYYY")," \u2022 ",Ce(53,18,e.selectedItem==null?null:e.selectedItem.amount,"USD",!0)," "),s(3),h(e.stopSubPermission()?54:-1)}}function ji(n,c){n&1&&(o(0,"div",9)(1,"h4",21),r(2," No Add-Ons found "),a()())}function Hi(n,c){if(n&1&&(o(0,"div",4),m(1,Yi,55,22),m(2,ji,3,0,"div",9),a()),n&2){let e=d();s(),h((e.addOnData==null?null:e.addOnData.length)>0?1:-1),s(),h((e.addOnData==null?null:e.addOnData.length)==0?2:-1)}}function Qi(n,c){n&1&&(o(0,"div",4)(1,"h4",21),r(2," Please wait while we process your data "),a()())}function zi(n,c){if(n&1){let e=I();o(0,"div",45),S("click",function(){M(e);let i=d(2);return k(i.isShowMonthlyPanel=!i.isShowMonthlyPanel)}),v(1,"svg-icon",46),a()}if(n&2){let e=d(2);f("ngClass",e.isShowMonthlyPanel?"border-activity-outbound-hover-bg bg-activity-outbound-hover-bg text-primary-90":"border-transparency-25 bg-transparency-15 text-transparency-100"),s(),f("src",je(e.isShowMonthlyPanel?"assets/images/icons/chevron-down.svg":"assets/images/icons/chevron-right.svg"))}}function qi(n,c){if(n&1&&(o(0,"span"),r(1),a()),n&2){let e=d().$implicit;s(),p(" (x",e==null?null:e.quantity,") ")}}function Wi(n,c){if(n&1&&(o(0,"div",49)(1,"h4",21),r(2),m(3,qi,2,1,"span"),a(),o(4,"h4",54),r(5),y(6,"number"),a()()),n&2){let e=c.$implicit,t=d(3);s(2),p(" ",t.getSubscriptionDisplayName(e==null?null:e.description)," "),s(),h((e==null?null:e.quantity)>1?3:-1),s(2),p(" $",w(6,3,(e==null?null:e.amount)*(e==null?null:e.quantity),"1.2-2")," ")}}function Ki(n,c){if(n&1&&(o(0,"div",36),v(1,"svg-icon",37),a(),o(2,"div",49)(3,"h3",55),r(4," Subtotal "),a(),o(5,"h4",55),r(6),y(7,"number"),a()()),n&2){let e=d(3);s(6),p(" $",w(7,1,e.finalMonthlyAmount,"1.2-2")," ")}}function Gi(n,c){if(n&1&&(o(0,"div",52)(1,"h4",21),r(2),a(),o(3,"h4",58),r(4),y(5,"number"),a()()),n&2){let e=c.$implicit,t=d(4);s(2),p(" ",t.getSubscriptionDisplayName(e==null?null:e.description)," "),s(2),p(" - $",w(5,2,e==null?null:e.amount,"1.2-2")," ")}}function Zi(n,c){if(n&1&&(o(0,"div",50)(1,"h5",56),r(2,"Discounts"),a(),o(3,"div",57),A(4,Gi,6,5,"div",52,R),a()()),n&2){let e=d(3);
1s(4),P(e.discountMonthData)}}function Ji(n,c){if(n&1&&(o(0,"div",47)(1,"div",48),A(2,Wi,7,6,"div",49,R),a(),m(4,Ki,8,4),a(),m(5,Zi,6,0,"div",50),o(6,"div",51)(7,"div",52)(8,"h2",53),r(9,"Total"),a(),o(10,"h2",53),r(11),y(12,"number"),a()()()),n&2){let e=d(2);s(2),P(e.upcomingRenewals==null?null:e.upcomingRenewals.monthlySub),s(2),h((e.discountMonthData==null?null:e.discountMonthData.length)>0?4:-1),s(),h((e.discountMonthData==null?null:e.discountMonthData.length)>0?5:-1),s(6),p(" $",w(12,3,e.finalDisplayMonthAmount,"1.2-2")," ")}}function Xi(n,c){if(n&1&&(o(0,"div",8)(1,"div",39)(2,"div",13)(3,"div",40)(4,"h3",41),r(5),y(6,"myTimezone"),a(),o(7,"div",42),r(8),a()(),o(9,"h5",43),r(10),y(11,"number"),a()(),m(12,zi,2,3,"div",44),a(),m(13,Ji,13,6),a()),n&2){let e=d();s(),f("ngClass",e.isShowMonthlyPanel?"bg-primary-70":"bg-transparency-0"),s(3),f("ngClass",e.isShowMonthlyPanel?"text-transparency-0":"text-transparency-100"),s(),p(" Monthly - ",w(6,9,(e.upcomingRenewals==null||e.upcomingRenewals.monthlySub==null?null:e.upcomingRenewals.monthlySub.length)>0?e.upcomingRenewals==null||e.upcomingRenewals.monthlySub[0]==null?null:e.upcomingRenewals.monthlySub[0].endDate:e.planPriceData==null?null:e.planPriceData.endDate,"MMM D, YYYY")," "),s(2),f("ngClass",e.isShowMonthlyPanel?"text-primary-90 bg-primary-70":"text-transparency-100"),s(),p(" ",e.planPriceData==null?null:e.planPriceData.planName," Plan "),s(),f("ngClass",e.isShowMonthlyPanel?"text-transparency-0":"text-transparency-100"),s(),p(" Estimation : $",w(11,12,e.planPriceData==null?null:e.planPriceData.amount,"1.2-2")," "),s(2),h(e.subscriberData!=null&&e.subscriberData.isYearlyPlan?12:-1),s(),h(e.isShowMonthlyPanel?13:-1)}}function en(n,c){if(n&1&&(o(0,"span"),r(1),a()),n&2){let e=d().$implicit;s(),p(" (x",e==null?null:e.quantity,") ")}}function tn(n,c){if(n&1&&(o(0,"div",49)(1,"h4",21),r(2),m(3,en,2,1,"span"),a(),o(4,"h4",54),r(5),y(6,"number"),a()()),n&2){let e=c.$implicit,t=d(3);s(2),p(" ",t.getSubscriptionDisplayName(e==null?null:e.description)," "),s(),h((e==null?null:e.quantity)>1?3:-1),s(2),p(" $",w(6,3,(e==null?null:e.amount)*(e==null?null:e.quantity),"1.2-2")," ")}}function nn(n,c){if(n&1&&(o(0,"span"),r(1),a()),n&2){let e=d().$implicit;s(),p(" (x",e==null?null:e.quantity,") ")}}function an(n,c){if(n&1&&(o(0,"div",49)(1,"h4",21),r(2),m(3,nn,2,1,"span"),a(),o(4,"h4",54),r(5),y(6,"number"),a()()),n&2){let e=c.$implicit,t=d(3);s(2),p(" ",t.getSubscriptionDisplayName(e==null?null:e.description)," "),s(),h((e==null?null:e.quantity)>1?3:-1),s(2),p(" $",w(6,3,(e==null?null:e.amount)*(e==null?null:e.quantity),"1.2-2")," ")}}function sn(n,c){if(n&1&&(o(0,"div",36),v(1,"svg-icon",37),a(),o(2,"div",49)(3,"h3",55),r(4," Subtotal "),a(),o(5,"h4",55),r(6),y(7,"number"),a()()),n&2){let e=d(3);s(6),p(" $",w(7,1,e.finalYearlyAmount,"1.2-2")," ")}}function on(n,c){if(n&1&&(o(0,"div",52)(1,"h4",21),r(2),a(),o(3,"h4",58),r(4),y(5,"number"),a()()),n&2){let e=c.$implicit,t=d(4);s(2),p(" ",t.getSubscriptionDisplayName(e==null?null:e.description)," "),s(2),p(" - $",w(5,2,e==null?null:e.amount,"1.2-2")," ")}}function rn(n,c){if(n&1&&(o(0,"div",50)(1,"h5",56),r(2,"Discounts"),a(),o(3,"div",57),A(4,on,6,5,"div",52,R),a()()),n&2){let e=d(3);s(4),P(e.discountYearData)}}function ln(n,c){if(n&1&&(o(0,"div",47)(1,"div",48),A(2,tn,7,6,"div",49,R),A(4,an,7,6,"div",49,R),a(),m(6,sn,8,4),a(),m(7,rn,6,0,"div",50),o(8,"div",51)(9,"div",52)(10,"h2",53),r(11,"Total"),a(),o(12,"h2",53),r(13),y(14,"number"),a()()()),n&2){let e=d(2);s(2),P(e.upcomingRenewals==null?null:e.upcomingRenewals.yearlySub),s(2),P(e.upcomingRenewals==null?null:e.upcomingRenewals.monthlySub),s(2),h((e.discountYearData==null?null:e.discountYearData.length)>0?6:-1),s(),h((e.discountYearData==null?null:e.discountYearData.length)>0?7:-1),s(6),p(" $",w(14,3,e.finalDisplayAmount,"1.2-2")," ")}}function cn(n,c){if(n&1){let e=I();o(0,"div",8)(1,"div",39)(2,"div",13)(3,"div",40)(4,"h3",41),r(5),y(6,"myTimezone"),a(),o(7,"div",42),r(8),a()(),o(9,"h5",43),r(10),y(11,"number"),a()(),o(12,"div",45),S("click",function(){M(e);let i=d();return k(i.isShowYearlyPanel=!i.isShowYearlyPanel)}),v(13,"svg-icon",46),a()(),m(14,ln,15,6),a()}if(n&2){let e=d();s(),f("ngClass",e.isShowYearlyPanel?"bg-primary-70":"bg-transparency-0"),s(3),f("ngClass",e.isShowYearlyPanel?"text-transparency-0":"text-transparency-100"),s(),p(" Yearly - ",w(6,11,e.planPriceData==null?null:e.planPriceData.endDate,"MMM D, YYYY")," "),s(2),f("ngClass",e.isShowYearlyPanel?"text-primary-90 bg-primary-70":"text-transparency-100"),s(),p(" ",e.planPriceData==null?null:e.planPriceData.planName," Plan "),s(),f("ngClass",e.isShowYearlyPanel?"text-transparency-0":"text-transparency-100"),s(),p(" Estimation : $",w(11,14,e.planPriceData==null?null:e.planPriceData.amount,"1.2-2")," "),s(2),f("ngClass",e.isShowYearlyPanel?"border-activity-outboun
1d-hover-bg bg-activity-outbound-hover-bg text-primary-90":"border-transparency-25 bg-transparency-15 text-transparency-100"),s(),f("src",je(e.isShowYearlyPanel?"assets/images/icons/chevron-down.svg":"assets/images/icons/chevron-right.svg")),s(),h(e.isShowYearlyPanel?14:-1)}}var Xt,$e,Ve=G(()=>{Xt=li(di());_e();Bt();xi();J();Qe();De();qe();Be();Tt();Me();he();ze();Se();Vt();$e=(()=>{class n{constructor(e,t,i,l,u,b){this._dialog=e,this._loaderService=t,this._billingService=i,this._toasterService=l,this._aiAgentsService=u,this.utilities=b,this.messageConstant=j,this.isLoading=!0,this.selectedItemIndex=0,this.selectedItem={},this.addOnData=[],this.subscriberData={},this.upcomingRenewals=[],this.subscriberShow=!1,this.planPriceData={},this.discountYearData=[],this.discountMonthData=[],this.discountYearAmount=0,this.discountMonthAmount=0,this.finalYearlyAmount=0,this.finalMonthlyAmount=0,this.finalDisplayAmount=0,this.finalDisplayMonthAmount=0,this.isShowMonthlyPanel=!1,this.isShowYearlyPanel=!1,this.isLastMonthOfSubscription=!1}ngOnInit(){this.getAddOnList()}getAddOnList(){this._loaderService.start(),this._billingService.getAddOnData({}).subscribe(e=>{if(e?.statusCode&&e?.statusCode==200){let t=e?.data?.subscriberData;this.addOnData=t?.filter(g=>!g?.planName);let i=this.addOnData?.filter(g=>g?.interval=="month"),l=this.addOnData?.filter(g=>g?.interval!="month");
1this.upcomingRenewals={yearlySub:l,monthlySub:i},this.planPriceData=t?.filter(g=>g?.planName)[0],this.subscriberData=e?.data?.subscriberInfo;let u=!!this.subscriberData?.isYearlyPlan,b=i?.length??0,_=this.planPriceData?.endDate,E=(0,Xt.default)(_).subtract(1,"months").valueOf(),L=Date.now();this.isLastMonthOfSubscription=u&&L>E;let N=L>E&&(b>0||!!this.subscriberData?.isTrialPeriod)&&u;this.isShowMonthlyPanel=!u||u&&b>0&&!this.isLastMonthOfSubscription,this.isShowYearlyPanel=u&&(this.isLastMonthOfSubscription||b===0);let O=e?.data?.subscriberInfo?.billingSummary?.discounts??[];this.finalYearlyAmount=(this.planPriceData?.amount??0)+(this.addOnData??[])?.reduce((g,C)=>g+(C?.amount>0?C.amount*(C?.quantity??1):0),0);let X=[],Y=O?.filter(g=>g?.productId==this.planPriceData?.product&&(g?.duration!="once"&&g?.months>=1&&!this.subscriberData?.isYearlyPlan||g?.duration!="once"&&g?.months>=12&&!!this.subscriberData?.isYearlyPlan||g?.duration=="forever"||g?.couponStartDate>this.planPriceData?.startDate&&g?.couponStartDate<=this.planPriceData?.endDate)),F=0,ee=0,te=!!this.subscriberData?.isTrialPeriod,ie=g=>g?.duration!="once"&&g?.months>=12||g?.duration=="forever"||te;if(Y?.length>0){let g=Y[0];u?F=g?.amount??0:ee=g?.amount??0,g?.percent_off&&(g.description=`${g?.percent_off}% off in ${this.planPriceData?.planName}`),g?.amount_off&&(g.description=`$${g?.amount_off} off in ${this.planPriceData?.planName}`)}(this.addOnData??[])?.forEach(g=>{O?.forEach(C=>{g?.product==C?.productId&&C?.itemId==g?.id&&(C?.percent_off&&ie(C)&&(F+=C?.amount??0,X.push({description:`${C?.percent_off}% off in ${g?.description}`,amount:C?.amount})),C?.amount_off&&ie(C)&&(F+=C?.amount??0,X.push({description:`$${C?.amount_off} off in ${g?.description}`,amount:C?.amount})))})}),this.discountYearData=X,Y?.length>0&&u&&(this.discountYearData=[...this.discountYearData,...Y]),this.discountYearAmount=F;let W=(i??[]).reduce((g,C)=>g+(C?.amount>0?C?.amount*(C?.quantity??1):0),0);this.finalMonthlyAmount=b>0&&u?W:(this.planPriceData?.amount??0)+W;let le=[];(this.upcomingRenewals?.monthlySub??[])?.forEach(g=>{O?.forEach(C=>{if(g?.product==C?.productId&&C?.itemId==g?.id){let ce="";if(C?.percent_off)ee+=C?.amount??0,ce=`${C?.percent_off}% off in `;else if(C?.amount_off)ee+=C?.amount??0,ce=`$${C?.amount_off} off in `;else return;le.push({description:ce+g?.description,amount:C?.amount,appliedOrder:C?.appliedOrder,itemId:C?.itemId})}})}),this.discountMonthData=Y?.length>0&&!u?[...le,...Y]:le,this.discountMonthAmount=ee,this.finalDisplayAmount=Math.max(0,this.finalYearlyAmount-this.discountYearAmount),this.finalDisplayMonthAmount=Math.max(0,this.finalMonthlyAmount-this.discountMonthAmount),this.selectedItem=this.addOnData[0],this.selectedItemIndex=0,this.subscriberShow=!0,this._loaderService.stop(),this.isLoading=!1}else this._toasterService.showError(e?.message),this._loaderService.stop(),this.isLoading=!0},e=>{if(this._loaderService.stop(),this.isLoading=!0,e.error){let t=e.error;this._toasterService.showError(t.message)}else this._toasterService.showError(this.messageConstant.unknownError)})}selectItem(e){this.selectedItemIndex=e,this.selectedItem=this.addOnData[e],setTimeout(()=>{try{let i=$("#itemContainer #itemBox").eq(e),l=$("#leftBox"),u=$("#infoBox");if(i&&i.length&&l&&l.length){let b=i.offset().top,_=l.offset().top,N=l.scrollTop()+(b-_)-6,O=l[0].scrollHeight-l.innerHeight();N=Math.max(0,Math.min(N,O)),l.animate({scrollTop:N},180,()=>{this.alignDetailsTopToItem(i,l),u&&u.length&&u.scrollTop(0)})}}catch(t){console.warn("selectItem positioning error",t)}},20)}alignDetailsTopToItem(e,t){try{let i=$("#infoBox");if(!i||i.length===0)return;let l=e.offset().top,u=t.offset().top,b=l-u,_=t.innerHeight(),E=i.outerHeight(),L=Math.max(0,_-E),N=Math.max(0,Math.min(b,L));i.css("top",N+"px")}catch(i){console.warn("alignDetailsTopToItem error ==>",i)}}dataBuilder(e){let t="";switch(e?.paymentType){case 4:t="assets/images/icons/website.svg";break;case 5:t="assets/images/icons/direct-mail.svg";break;case 6:t="assets/images/icons/team.svg";break;case 7:t="assets/images/icons/streering-wheel.svg";break;case 9:t="assets/images/icons/skip-trace.svg";break;case 10:t="assets/images/icons/phone-numbers.svg";break;case 11:t="assets/images/icons/markets-management.svg";break;case 12:t="assets/images/icons/call.svg";break;case 14:t="assets/images/icons/lead.svg";break;case 15:t="assets/images/icons/a2p-10dlc.svg";break;case 16:t="assets/images/icons/in-person-appt.svg";break;case 17:t="assets/images/icons/call.svg";break;case 18:t="assets/images/icons/website.svg";break;case 19:t="assets/images/icons/phone-appt.svg";break;case 20:t="assets/images/icons/a2p-10dlc.svg";break;case 21:t="assets/images/navbar/sold-icon.svg";break;case 22:t="assets/images/icons/streering-wheel.svg";break;case 23:t="assets/images/icons/call-grade.svg";break;case 24:t="assets/images/icons/voice-follow-ai.svg";break;case 25:t="assets/images/icons/speed-to-lead-ai.svg";break;case 26:t="assets/images/icons/meet-grade.svg";break;case 27:t="assets/images/icons/conversational-ai.svg";break;case 28:t="assets/images/icons/lead-scoring.svg";break;
1case 29:t="assets/images/icons/kpi-insight.svg";break;case 30:t="assets/images/icons/translate-1.svg";break;case 31:t="assets/images/icons/call-answer-ai.svg";break;case 33:t="assets/images/icons/real-estate-agent.svg";break;case 34:t="assets/images/icons/ai-1.svg";break;case 35:t="assets/images/icons/leadmanager.svg";break;case 36:t="assets/images/icons/full-ai-copilot.svg";break;case 37:t="assets/images/icons/call-grade.svg";break;case 38:t="assets/images/icons/contact-ai.svg";break;case 39:t="assets/images/icons/conversational-ai.svg";break;case 40:t="assets/images/icons/ai-1.svg";break;case 41:t="assets/images/icons/inbound-ai.svg";break;case 42:t="assets/images/icons/lead-scoring-ai.svg";break;case 43:t="assets/images/icons/seller-appt-ai.svg";break;case 44:t="assets/images/icons/sms-assistant-ai.svg";break;case 45:t="assets/images/icons/speed-to-lead-ai-1.svg";break;case 46:t="assets/images/icons/outbound-ai.svg";break;default:t="assets/images/navbar/sold-icon.svg";break}return t}stopSubPermission(){return this.selectedItem?.paymentType>=34&&46>=this.selectedItem?.paymentType||this.selectedItem?.paymentType==17||this.selectedItem?.paymentType==19||this.selectedItem?.description=="Street View"&&this.selectedItem?.paymentType==7}subscriptionStop(e){let t="Are you sure you want to remove this feature? This action is permanent and cannot be undone.";switch(e?.paymentType){case 46:t+="Before proceeding with this step, please make sure to remove your Voice Follow agent from the REsimpli Voice Follow AI section.";break;case 45:t+="Please ensure your Automation has no active Speed To Lead AI agents and remove the configuration from the lead number.";break;case 39:t+="Before taking this action, please make sure that the Automations and Leads do not have Conversational AI enabled.";break;case 41:t+="Before taking this action, please ensure that your Inbound sales AI agent is removed from phone number and call flow.";break;case 34:case 35:t+="Before taking this action, Please double-check that in Automation, Lead, Number, Call Flow and in REsimpli Inbound sales AI, REsimpli Voice Follow AI, and REsimpli Speed to Lead AI, there are no active agents currently enabled. if any of these AI agents remain active, it may impact your Lead, Automation, Call, or SMS services.";break;case 7:e?.description==="Street View"&&(t="Are you sure you want to cancel Street View subscription? This will remove Street View from your Drive plan.");break}this.dialogRef=this._dialog.open(we,{width:"500px",disableClose:!0,panelClass:"re-new-custom-dialog",data:{noTitle:"Cancel",yesTitle:"Confirm",header:"Confirm Action",text:t}}),this.dialogRef.afterClosed().subscribe(i=>{i&&this.sendOtp(e)})}sendOtp(e){this.dialogRef=this._dialog.open(Ft,{width:"400px",panelClass:"re-new-custom-dialog",disableClose:!0,data:{email:this.utilities.userData?.loginData?.mainUserEmail,isEmailOtp:!0,otpType:"BULK_CAMPAIGN"}}),this.dialogRef.afterClosed().subscribe(t=>{t&&this.processStopSubscription(e)})}processStopSubscription(e){this._loaderService.start();let t={subscriptionKey:e?.id,paymentType:e?.paymentType};this._aiAgentsService.cancelSubscription(t).subscribe(i=>{this._loaderService.stop(),i?.statusCode==200?(this._toasterService.showSuccess(i?.message||"Subscription removed successfully"),this.getAddOnList()):this._toasterService.showError(i?.message)},i=>{this._loaderService.stop(),i?.error?this._toasterService.showError(i.error?.message):this._toasterService.showError(this.messageConstant.unknownError)})}expandPanel(e){e==="monthly"?this.isShowMonthlyPanel=!this.isShowMonthlyPanel:this.isShowYearlyPanel=!this.isShowYearlyPanel}getSubscriptionDisplayName(e){return e?e.replace(/\bSubscribe Drive\b/g,"D4$").replace(/\bCaller Number\b/g,"SPAM Check Surcharge"):""}static{this.\u0275fac=function(t){return new(t||n)(x(ae),x(z),x(oe),x(Q),x(Te),x(q))}}static{this.\u0275cmp=U({type:n,selectors:[["app-subscriptions"]],standalone:!1,decls:12,vars:4,consts:[["itemContainer",""],[1,"flex","flex-1","gap-4","relative"],[1,"flex-1","h-[calc(100vh_-_240px)]","overflow-y-auto"],[1,"text-h2","text-transparency-100","font-semibold","mb-[20px]"],[1,"flex","items-start","self-stretch","lg:flex-row","flex-col","gap-[20px]","p-[20px]","bg-transparency-1
15","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"2xl:w-[400px]","w-[300px]","h-[calc(100vh_-_240px)]","overflow-y-auto"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]"],[1,"text-h2","text-transparency-100","font-semibold"],[1,"flex","flex-col","items-start","self-stretch","gap-[2px]","bg-transparency-25","rounded-[20px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden"],[1,"flex-1","flex","flex-col","items-start","self-stretch","gap-[15px]","h-[350px]"],["id","leftBox",1,"flex-1","flex","flex-col","items-start","self-stretch","gap-[15px]"],["id","infoBox",1,"2xl:w-[500px]","w-[350px]","flex","flex-col","items-start","self-stretch","bg-transparency-0","rounded-[15px]","border-[1px]","border-solid","border-transparency-25","overflow-hidden"],[1,"flex","items-center","justify-between","self-stretch","p-[20px]","bg-activity-outbound-hover-bg","border-b-[1px]","border-solid","border-activity-outbound-hover-border"],[1,"flex","flex-col","items-start","gap-[5px]"],[1,"text-label","text-transparency-90","font-medium"],[1,"text-h5","font-semibold","px-[12px]","py-[8px]","rounded-[30px]","border-[1px]","border-solid","border-secondary-green-10","text-secondary-green","bg-secondary-green-5"],[1,"flex","flex-col","items-center","self-stretch","gap-[20px]","p-[20px]"],[1,"w-full"],[1,"text-h4","text-transparency-90","font-semibold","mb-[10px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[8px]","py-[14px]","px-[8px]","bg-transparency-15","rounded-[12px]","border-[1px]","border-solid","border-transparency-25"],[1,"text-label","text-transparency-100","font-medium","opacity-70"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"w-full","grid","xl:grid-cols-2","grid-cols-1","gap-[15px]"],[1,"text-h4","text-primary-90","font-semibold"],["id","itemBox",1,"cursor-pointer","flex","items-start","justify-between","self-stretch","p-[20px]","rounded-[15px]","border-[2px]",3,"click","ngClass"],[1,"flex","items-start","self-stretch","gap-[10px]"],[1,"flex","items-center","justify-center","p-[6px]","rounded-[30px]","border-[1px]",3,"ngClass"],["svgClass","w-[30px] h-[30px] text-transparency-100",3,"src"],[1,"flex-1","flex","flex-col","items-start","gap-[5px]"],[1,"text-h3","text-primary-90","font-semibold"],[1,"text-p","text-transparency-100","font-medium"],[1,"text-h4","text-transparency-100","font-semibold","opacity-60"],[1,"flex","flex-col","items-end","gap-[10px]"],[1,"flex","items-center","gap-[3px]","text-sub-heading","font-medium","px-[5px]","py-[2px]","rounded-[30px]","border-[1px]","border-solid","border-transparency-25","bg-secondary-green-5","text-secondary-green"],[1,"h-[6px]","w-[6px]","rounded-pill","bg-secondary-green"],["svgClass","w-[15px] h-[15px] block","src","assets/images/icons/chevron-right.svg",1,"rounded-pill","p-[4px]",3,"ngClass"],[1,"inline-flex","w-full"],["svgClass","w-full h-full","src","assets/images/icons/separator-horizontal.svg",1,"inline-flex","m-auto"],["label","Cancel Subscription","variant","outline","type","danger","shape","rounded","size","40",3,"click","leftIcon"],[1,"flex","items-center","self-stretch","justify-between","p-[20px]",3,"ngClass"],[1,"flex","items-center","flex-wrap","gap-[5px]"],[1,"text-h3","font-semibold",3,"ngClass"],[1,"flex","items-center","py-[4px]","px-[6px]","rounded-[30px]","bg-transparency-15","text-h5","font-semibold","border-[1px]","border-solid","border-transparency-25",3,"ngClass"],[1,"text-h5","font-semibold",3,"ngClass"],[1,"flex","items-center","justify-center","p-[4px]","rounded-pill","border-[1px]","border-solid","cursor-pointer",3,"ngClass"],[1,"flex","items-center","justify-center","p-[4px]","rounded-pill","border-[1px]","border-solid","cursor-pointer",3,"click","ngClass"],["svgClass","w-[22px] h-[22px] block",3,"src"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]","py-[15px]","px-[20px]","bg-transparency-0"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]"],[1,"flex","items-center","justify-between","self-stretch","gap-[10px]","py-[5px]"],[1,"flex","flex-col","items-start","self-stretch","gap-[20px]","py-[15px]","px-[20px]","bg-activity-outboun
1d-bg"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]","py-[20px]","px-[20px]","bg-transparency-0"],[1,"flex","items-center","justify-between","self-stretch","gap-[10px]"],[1,"text-h2","text-primary-90","font-semibold"],[1,"flex-none","text-h4","text-transparency-100","font-semibold"],[1,"text-h3","text-transparency-100","font-semibold"],[1,"text-h5","text-primary-90","font-semibold"],[1,"flex","flex-col","items-start","self-stretch","gap-[15px]"],[1,"flex-none","text-h4","text-secondary-red","font-semibold"]],template:function(t,i){t&1&&(o(0,"div",1)(1,"div",2)(2,"h2",3),r(3," Your Subscriptions "),a(),m(4,Hi,3,2,"div",4),m(5,Qi,3,0,"div",4),a(),o(6,"div",5)(7,"div",6)(8,"h2",7),r(9," Upcoming Renewals "),a(),m(10,Xi,14,15,"div",8),m(11,cn,15,17,"div",8),a()()()),t&2&&(s(4),h(i.isLoading?-1:4),s(),h(i.isLoading?5:-1),s(5),h(!(i.subscriberData!=null&&i.subscriberData.isYearlyPlan)||i.subscriberData!=null&&i.subscriberData.isYearlyPlan&&((i.upcomingRenewals==null||i.upcomingRenewals.monthlySub==null?null:i.upcomingRenewals.monthlySub.length)??0)>0&&!i.isLastMonthOfSubscription?10:-1),s(),h(i.subscriberData!=null&&i.subscriberData.isYearlyPlan?11:-1))},dependencies:[ne,se,H,xe,ye,ke],encapsulation:2})}}return n})()});function hn(n,c){if(n&1&&(o(0,"th",3),r(1),a()),n&2){let e=c.$implicit;f("width",(e==null?null:e.width)||"240px"),s(),p(" ",e==null?null:e.label," ")}}function gn(n,c){if(n&1){let e=I();o(0,"tr",4)(1,"td",5)(2,"span",6),r(3),y(4,"number"),a()(),o(5,"td",5),r(6),a(),o(7,"td",5),r(8),a(),o(9,"td",5),r(10),a(),o(11,"td",5),r(12),y(13,"myTimezone"),a(),o(14,"td",7)(15,"app-button",8),S("click",function(){let i=M(e).$implicit,l=d(2);return k(l.getLastChargeData(i))}),a()()()}if(n&2){let e=c.$implicit;s(2),f("ngClass",Ct(15,mn,(e==null?null:e.total)>=0,(e==null?null:e.total)<0)),s(),p(" $",w(4,9,e==null?null:e.total,"1.2-2")," "),s(3),p(" ",(e==null?null:e.description)||"N/A"," "),s(2),V((e==null?null:e.card)||"N/A"),s(2),V((e==null?null:e.userName)||"N/A"),s(2),p(" ",w(13,12,e==null?null:e.createdAt,"MMM DD, YYYY")," "),s(3),f("iconHeight","20px")("iconWidth","20px")("leftIcon",!0)}}function fn(n,c){if(n&1&&(o(0,"tbody"),A(1,gn,16,18,"tr",4,R),a()),n&2){let e=d();s(),P(e.paymentHistoryList==null?null:e.paymentHistoryList.items)}}function Cn(n,c){n&1&&(o(0,"tr",2)(1,"td",9),r(2," No data found "),a()()),n&2&&f("hoverable",!1)}var un,pn,mn,Fe,Ue=G(()=>{ci();ot();Si();_e();J();De();Be();qe();Qe();Me();he();Se();fi();Ci();Vt();un=()=>[10,25,50,100],pn=(n,c,e,t,i)=>({currentPage:n,totalCount:c,totalPages:e,pageSize:t,pageSizeOptions:i}),mn=(n,c)=>({"text-green-600":n,"text-red-600":c});Fe=(()=>{class n{constructor(e,t,i,l,u){this._loaderService=e,this._toastrService=t,this._billingService=i,this._dialog=l,this._utilities=u,this.header=[],this.messageConstant=j,this.currentPage=1,this.itemsPerPage=10,this.totalHistory=1,this.isLoading=!1,this.searchString="",this.searchControl=new _t("")}ngOnInit(){this.header=[{label:"Amount",key:"total",width:"200px"},{label:"Description",key:"description",width:"590px"},{label:"Payment Card",key:"card",width:"315px"},{label:"Created By",key:"userName",width:"260px"},{label:"Date",key:"createdAt",width:"260px"},{label:"Action",key:"action",width:"150px"}],this.getPaymentHistory(),this.searchControl.valueChanges.pipe(at(500),st()).subscribe(e=>{this.searchString=e,this.currentPage=1,this.getPaymentHistory()})}getPaymentHistory(){let e={page:this.currentPage,limit:this.itemsPerPage};this.searchString&&(e.searchString=this.searchString),this.isLoading=!0,this._loaderService.start(),this._billingService.getPaymentHistory(e).subscribe(t=>{this._loaderService.stop(),this.isLoading=!1,t?.statusCode&&t?.statusCode==200&&(this.paymentHistoryList=t?.data,this.totalHistory=t?.data?.count)},t=>{if(this._loaderService.stop(),this.isLoading=!1,t?.error){let i=t?.error;this._toastrService.showError(i?.message)}else this._toastrService.showError(this.messageConstant.unknownError)})}getLastChargeData(e){this._loaderService.start(),this._billingService.getLastChargeAmount({paymentId:e?._id}).subscribe(t=>
1{if(t?.statusCode===200&&e){this._loaderService.stop();let i=t?.data;!i?.isOldPayment&&i?.invoicePdfUrl?window.open(i?.invoicePdfUrl,"_blank"):this.openBreakDown(i,"Payment")}},t=>{if(this._loaderService.stop(),t?.error){let i=t?.error;this._toastrService.showError(i?.message)}else this._toastrService.showError(this.messageConstant.unknownError)})}openBreakDown(e,t){let i=this._utilities?.userData,l=t=="Payment"?"Charge":t;if(!e?.total){this._toastrService.showError(this.messageConstant.noPaymentObj.replace("Field",l));return}e.title=t,e.name=i?.firstName+" "+i?.lastName,e.email=i?.email,this.dialogRef=this._dialog.open(Ht,{width:"999px",disableClose:!0,data:e}),this.dialogRef.afterClosed().subscribe(()=>{})}get totalPages(){return Math.ceil(this.totalHistory/this.itemsPerPage)}goToPage(e){e>=1&&e<=this.totalPages&&e!==this.currentPage&&(this.currentPage=e,this.getPaymentHistory())}nextPage(){this.currentPage<this.totalPages&&(this.currentPage++,this.getPaymentHistory())}onItemsPerPageChange(e){this.itemsPerPage=e,this.currentPage=1,this.getPaymentHistory()}static{this.\u0275fac=function(t){return new(t||n)(x(z),x(Q),x(oe),x(ae),x(q))}}static{this.\u0275cmp=U({type:n,selectors:[["app-history"]],standalone:!1,decls:8,vars:20,consts:[[3,"searchChange","pageChange","pageSizeChange","enableStickyDefaultHeader","showHeader","showPagination","showSearch","searchPlaceholder","searchTerm","pagination","loading","showViewType"],["appTable","",1,"min-w-[1100px]",3,"bordered"],["appTr","",3,"hoverable"],["appTh","",3,"width"],["appTr",""],["appTd","",1,"text-p"],[3,"ngClass"],["appTd",""],["icon","/assets/images/download-minimalistic-grey.svg","variant","ghost","type","light","size","28","customClass","!p-0",3,"click","iconHeight","iconWidth","leftIcon"],["appTd","","colspan","6",1,"py-5","text-center","text-gray-500"]],template:function(t,i){t&1&&(o(0,"app-table-container",0),S("searchChange",function(u){return i.searchControl==null?null:i.searchControl.setValue(u)})("pageChange",function(u){return i.goToPage(u)})("pageSizeChange",function(u){return i.onItemsPerPageChange(u)}),o(1,"table",1)(2,"thead")(3,"tr",2),A(4,hn,2,2,"th",3,R),a()(),m(6,fn,3,0,"tbody"),m(7,Cn,3,1,"tr",2),a()()),t&2&&(f("enableStickyDefaultHeader",!0)("showHeader",!0)("showPagination",!0)("showSearch",!0)("searchPlaceholder","Search Files...")("searchTerm",i.searchString)("pagination",xt(14,pn,i.currentPage,i.totalHistory,i.totalPages,i.itemsPerPage,ft(13,un)))("loading",i.isLoading)("showViewType",!1),s(),f("bordered",!0),s(2),f("hoverable",!1),s(),P(i.header),s(2),h(i.paymentHistoryList!=null&&i.paymentHistoryList.items?6:-1),s(),h((i.paymentHistoryList==null||i.paymentHistoryList.items==null?null:i.paymentHistoryList.items.length)===0?7:-1))},dependencies:[ne,H,It,Et,Rt,Lt,$t,xe,ke],encapsulation:2})}}return n})()});function bn(n,c){n&1&&(o(0,"div",2),r(1," Loading usage\u2026 "),a())}function vn(n,c){n&1&&(o(0,"div",17),r(1),a()),n&2&&(s(),p(" ",c," "))}function _n(n,c){if(n&1){let e=I();o(0,"app-button",22),S("clicked",function(){M(e);let i=d(2).$implicit,l=d(2);return k(l.onAddCredits(i.addCreditsTarget))}),a()}n&2&&f("leftIcon",!1)("customClass","w-full justify-center")}function Sn(n,c){if(n&1&&(o(0,"div",17),r(1),a(),o(2,"div",18),v(3,"div",19),a(),o(4,"div",20),r(5),a(),m(6,_n,1,2,"app-button",21)),n&2){let e=d().$implicit,t=d(2);s(),p(" ",t.quotaLine(e)," "),s(2),ht("width",t.progressPercent(e),"%"),f("ngClass",t.progressBarClass(e)),s(2),p(" ",t.resetLabel()," "),s(),h(t.showAddCreditsButton(e)?6:-1)}}function wn(n,c){if(n&1&&(o(0,"div",8)(1,"div",9)(2,"div",10)(3,"div",11),v(4,"svg-icon",12),a(),o(5,"h2",13),r(6),a()()(),o(7,"div",14)(8,"div",15),r(9),o(10,"span",16),r(11),a()(),m(12,vn,2,1,"div",17)(13,Sn,7,6),a()()),n&2){let e,t=c.$implicit,i=d(2);s(4),f("src",t.icon),s(2),p(" ",t.title," "),s(3),p(" ",i.formatInt(i.consumedAmount(t))," "),s(2),V(t.unitLabel),s(),h((e=i.renewingUnlimitedLabel(t))?12:i.showRenewingUsageDetails(t)?13:-1,e)}}function Bn(n,c){if(n&1&&A(0,wn,14,5,"div",8,ei),n&2){let e=d();P(e.renewingCards)}}function Dn(n,c){if(n&1&&(Ye(),v(0,"circle",33)),n&2){let e=d().$implicit,t=d();ue("stroke-dasharray",t.capacityRedPct(e)+" "+(100-t.capacityRedPct(e)))("stroke-dashoffset",-t.capacityBluePct(e))}}function Tn(n,c){n&1&&r(0," Unlimited ")}function Mn(n,c){if(n&1&&r(0),n&2){let e=d().$implicit,t=d();
1p(" ",t.formatInt(e==null?null:e.planLimit)," ")}}function kn(n,c){if(n&1&&(o(0,"div",9)(1,"h4",39),r(2,"Overage"),a(),o(3,"h4",39),r(4),a()()),n&2){let e=d().$implicit,t=d();s(4),p(" +",t.formatInt(t.capacityOverage(e))," ")}}function An(n,c){if(n&1&&(o(0,"div",23)(1,"div",9)(2,"div",11),v(3,"svg-icon",12),a(),o(4,"div",24)(5,"h2",25),r(6),a(),o(7,"div",26),r(8),a()()(),o(9,"div",27)(10,"div",28),Ye(),o(11,"svg",29)(12,"g",30),v(13,"circle",31)(14,"circle",32),m(15,Dn,1,2,":svg:circle",33),a()(),rt(),o(16,"div",34)(17,"p",35),r(18),a(),o(19,"p",36),r(20),a()()()(),o(21,"div",37)(22,"div",9)(23,"h4",38),r(24," Plan Limit "),a(),o(25,"h4",38),m(26,Tn,1,0)(27,Mn,1,1),a()(),m(28,kn,5,1,"div",9),a()()),n&2){let e=c.$implicit,t=d();pe("border-secondary-red",t.capacityOverage(e)>0)("border-transparency-25",t.capacityOverage(e)<=0),s(3),f("src",e==null?null:e.icon),s(3),p(" ",e==null?null:e.title," "),s(2),p(" ",e==null?null:e.subtitle," "),s(6),ue("stroke-dasharray",t.capacityBluePct(e)+" "+(100-t.capacityBluePct(e))),s(),h(t.capacityRedPct(e)>0?15:-1),s(3),p(" ",t.capacityCenterLabel(e)," "),s(2),p(" ",t.capacityCenterSubLabel(e)," "),s(6),h(e.unlimited?26:27),s(2),h(t.capacityOverage(e)>0?28:-1)}}var ei,Ne,Oe=G(()=>{ot();lt();_e();J();ve();De();Ut();hi();bi();Be();mi();Me();he();ze();Se();ei=(n,c)=>c.id;Ne=(()=>{class n{constructor(e,t,i,l,u,b,_,E){this._router=e,this._loader=t,this._creditService=i,this._userService=l,this._esignService=u,this._toaster=b,this._sharedService=_,this._utilities=E,this.messageConstant=j,this.loading=!0,this.renewCycleDate=null,this.renewingCards=[],this.capacityCards=[],this.hideUsageCredits=!1,this.userTotal=0,this.userPlanLimit=0,this.userOverage=0,this.userDonutBluePct=0,this.userDonutRedPct=0,this.listStackRemaining=0,this.listStackLimit=0,this.listStackUnlimited=!1,this.listStackDonutUsedPct=0,this.listStackCenterLabel=""}ngOnInit(){this.loadUsage()}loadUsage(){this.loading=!0,this._loader.start(),it({plan:this._creditService.getUserPlan({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(e=>{let t=e?.error?.message??this.messageConstant.unknownError;return this._toaster.showError(t),B(null)})),sms:this._creditService.getSMSCredit({planOnly:!0}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),call:this._creditService.getCallCredit({planOnly:!0}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),skip:this._creditService.getSkipDataCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),document:this._creditService.getDocumentCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),esignDocCount:this._esignService.getDocument({page:1,limit:1}).pipe(D(e=>e?.statusCode===200?this.num(e?.data?.count):null),T(()=>B(null))),investor:this._creditService.getInvestorBaseCredit({planOnly:!0}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),listPulling:this._creditService.getListPullingCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),listStack:this._creditService.getListStackingCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),drive:this._creditService.getDriveCount({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),sellerWebsite:this._creditService.getUserWebsiteData(1).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),buyerWebsite:this._creditService.getUserWebsiteData(2).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),phoneNumbers:this._sharedService.getBuyNumberCountV2().pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),directMail:this._creditService.getDirectMailCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),eMail:this._creditService.geteMailCredit({}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null))),users:this._userService.getSubUserList({page:1,limit:1}).pipe(D(e=>e?.statusCode===200?e?.data:null),T(()=>B(null)))}).subscribe({next:e=>{this._loader.stop(),this.loading=!1;let t=e?.plan,i=t?.isYearlyPlan?t?.creditCycleDate??t?.renewCycleDate:t?.renewCycleDate;this.renewCycleDate=i!=null?new Date(i).getTime():null;let l=this.num(e.sms),u=this.num(e.call),b=this.num(e.skip),_=this.num(e.document),E=this.num(e.esignDocCount),L=this.num(e.investor),N=this.num(e.directMail),O=this.num(e.eMail),X=this.num(e.listPulling),Y=this.num(t?.listPullingCredit),F=e.listStack,ee=this.num(F?.listStackingCredit),te=this.num(F?.limit),ie=this.num(F?.usedCount??F?.propertyCount),W=!!F?.isListStackingUnlimited;this.listStackRemaining=ee,this.listStackLimit=te,this.listStackUnlimited=W,this.listStackCenterLabel=this.formatListStackCenter(ie,W),!W&&te>0?this.listStackDonutUsedPct=Math.min(100,Math.round(ie/te*1e3)/10):this.listStackDonutUsedPct=0,this.hideUsageCredits=this._utilities.isNewPlanUser(t);let le=this.num(t?.outgoingSMS),g=this.num(t?.callingMinutes),C=this.num(t?.freeSkipTracing),ce=this.num(t?.investorBase),ai=this.num(t?.freeEmailCredit),si=_+E;this.renewingCards=[{id:"skip",title:"Skip Tracing",icon:"assets/images/icons/skip-trace.svg",unitLabel:"credits",remaining:b,total:Math.max(C,b),addCreditsTarget:"buy-credit"},{id:"call",title:"Call Minutes",icon:"assets/images/icons/call.svg",unitLabel:"minutes",remaining:u,total:Math.max(g,u),addCreditsTarget:"buy-credit"},{id:"sms",title:"SMS Credits",icon:"assets/images/icons/sms.svg",unitLabel:"SMS",remaining:l,total:Math.max(le,l),addCreditsTarget:"buy-credit"},{id:"listBuilder",title:"List Builder",icon:"assets/images/icons/skip-trace.svg",unitLabel:"credits",remaining:X,total:Math.max(Y,X),addCreditsTarget:"buy-credit"},{id:"cashBuyer",title:"Cash Buyer Search",icon:"assets/images/icons/money-2.svg",unitLabel:"searches",remaining:L,total:Math.max(ce,L),addCreditsTarget:"buy-credit"},{id:"esign",title:"eSign Credit",icon:"assets/images/icons/esign.svg",unitLabel:"documents",remaining:_,total:Math.max(si,_),addCreditsTarget:"buy-credit"},{id:"directMail",title:"Direct Mail",icon:"assets/images/icons/direct-mail.svg",unitLabel:"credits",remaining:N,total:0,addCreditsTarget:"buy-credit"},{id:"email",title:"Email Credits",icon:"assets/images/icons/email.svg",unitLabel:"credits",remaining:O,total:Math.max(ai,O),addCreditsTarget:"buy-credit"}];let K=this.num(e.users?.count),de=this.num(t?.users);if(this.userTotal=K,this.userPlanLimit=de,de<=0)this.userOverage=0,this.userDonutBluePct=100,this.userDonutRedPct=0;else if(K<=0)this.userOverage=0,this.userDonutBluePct=0,this.userDonutRedPct=0;else{this.userOverage=Math.max(0,K-de);let ri=Math.max(0,K-this.userOverage);this.userDonutBluePct=Math.min(100,Math.round(ri/K*1e3)/10),this.userDonutRedPct=Math.min(100,Math.round(this.userOverage/K*1e3)/10)}let et=e.sellerWebsite,tt=e.buyerWebsite,oi=this.getPhoneNumberTotal(e.phoneNumbers);
1this.capacityCards=[{id:"users",title:"User Seats",subtitle:"Active team",icon:"assets/images/icons/skip-trace.svg",total:K,planLimit:de,unlimited:de<=0,addButtonLabel:"Add Seats",addCreditsTarget:"subscriptions"},{id:"listStacking",title:"List Stacking",subtitle:"Database",icon:"assets/images/icons/skip-trace.svg",total:ie,planLimit:te,unlimited:W,addButtonLabel:"Add Credits",addCreditsTarget:"buy-credit"},{id:"driveUsers",title:"D4$ Users",subtitle:"Driving users",icon:"assets/images/icons/skip-trace.svg",total:this.num(e.drive?.totalDriverCount),planLimit:this.num(e.drive?.planDriverCount),addButtonLabel:"Add Users",addCreditsTarget:"subscriptions"},{id:"sellerSites",title:"Seller Sites",subtitle:"Websites",icon:"assets/images/icons/skip-trace.svg",total:this.num(et?.totalWebsiteCount),planLimit:this.num(et?.websitePlanLimit),addButtonLabel:"Add Sites",addCreditsTarget:"subscriptions"},{id:"buyerSites",title:"Buyer Sites",subtitle:"Websites",icon:"assets/images/icons/skip-trace.svg",total:this.num(tt?.totalWebsiteCount),planLimit:this.num(tt?.websitePlanLimit),addButtonLabel:"Add Sites",addCreditsTarget:"subscriptions"},{id:"phoneNumbers",title:"Phone Numbers",subtitle:"Active numbers",icon:"assets/images/icons/call.svg",total:oi,planLimit:this.num(t?.localPhoneNumbers),addButtonLabel:"Add Numbers",addCreditsTarget:"subscriptions"}]},error:()=>{this._loader.stop(),this.loading=!1,this._toaster.showError(this.messageConstant.unknownError)}})}onAddCredits(e){if(e==="subscriptions"){this._router.navigateByUrl("/credits-billing/subscriptions");return}this._router.navigateByUrl("/credits-billing/buy-credit")}capacityCenterLabel(e){return e.unlimited?"\u221E":this.formatCompactCount(e?.total)}capacityCenterSubLabel(e){return"Total"}capacityOverage(e){return e.unlimited||e.planLimit<=0?0:Math.max(0,e?.total-e?.planLimit)}capacityBluePct(e){if(e?.unlimited)return 100;if(e.planLimit<=0||e.total<=0)return 0;let t=Math.min(e?.total,e?.planLimit);return Math.min(100,Math.round(t/e.planLimit*1e3)/10)}capacityRedPct(e){return e?.unlimited||e?.planLimit<=0||this.capacityOverage(e)<=0?0:Math.min(100,Math.round(this.capacityOverage(e)/e.planLimit*1e3)/10)}isBalanceOnlyCard(e){return e.id==="directMail"}showUsageBadge(e){return!e.unlimited&&!this.isBalanceOnlyCard(e)}usedAmount(e){if(e.unlimited||this.isBalanceOnlyCard(e))return 0;let t=e.total;return t<=0?0:Math.max(0,t-e.remaining)}consumedAmount(e){return this.usedAmount(e)}usagePercent(e){if(e.unlimited||this.isBalanceOnlyCard(e))return 0;let t=e.total;return t<=0?0:Math.min(100,Math.round((t-e.remaining)/t*1e3)/10)}progressPercent(e){return this.isBalanceOnlyCard(e)?0:Math.min(100,Math.max(0,this.usagePercent(e)))}badgeIsHighUsage(e){return!e.unlimited&&this.usagePercent(e)>=70}progressBarClass(e){return this.badgeIsHighUsage(e)?"bg-charts-brighter-yellow":"bg-charts-brighter-blue"}showRenewingUsageDetails(e){return!this.renewingUnlimitedLabel(e)}showAddCreditsButton(e){return e.id!=="listBuilder"}renewingUnlimitedLabel(e){if(e.unlimited)return e.id==="listBuilder"?"Unlimited Credits":null;switch(e.id){case"call":return this.hideUsageCredits?"Unlimited Minutes":null;case"sms":return this.hideUsageCredits?"Unlimited SMS":null;case"cashBuyer":return this.hideUsageCredits?"Unlimited Cash Buyer Searches":null;case"esign":return this.hideUsageCredits?"Unlimited eSign Credits":null;case"email":return this.hideUsageCredits?"Unlimited Email Credits":null;default:return null}}quotaLine(e){if(e.id==="directMail")return`${this.formatInt(e.remaining)} direct mail credits remaining`;if(e.id==="email"){let i=e.total;return i<=0?`${this.formatInt(e.remaining)} email credits remaining`:`Remaining ${this.formatInt(e.remaining)} of ${this.formatInt(i)}`}if(e.unlimited)return"Unlimited plan capacity";let t=e.total;return t<=0?`${this.formatInt(e.remaining)} remaining`:e.id==="esign"?`Remaining ${this.formatInt(e.remaining)} of ${this.formatInt(t)} documents`:`Remaining ${this.formatInt(e.remaining)} of ${this.formatInt(t)} ${e.unitLabel}`}resetLabel(){if(!this.renewCycleDate)return"Resets on your next billing date";let e=new Date(this.renewCycleDate);return Number.isNaN(e.getTime())?"Resets on your next billing date":`Resets on ${this._utilities.getDate(this.renewCycleDate,"MMM D, YYYY")}`}
1formatInt(e){return Math.round(e).toLocaleString(void 0,{maximumFractionDigits:0})}formatListStackCenter(e,t){return t?"\u221E":this.formatCompactCount(e)}formatCompactCount(e){return e>=1e6?`${(e/1e6).toFixed(1)}m`:e>=1e4?`${(e/1e3).toFixed(1)}k`:this.formatInt(e)}getPhoneNumberTotal(e){if(!e||typeof e!="object")return 0;let t=["flowCount","blockNumberCount"];return Object.entries(e).filter(([i])=>!t.includes(i)).reduce((i,[,l])=>i+this.num(l),0)}num(e){let t=Number(e);return Number.isFinite(t)?t:0}static{this.\u0275fac=function(t){return new(t||n)(x(be),x(z),x(Ae),x(At),x(Ot),x(Q),x(kt),x(q))}}static{this.\u0275cmp=U({type:n,selectors:[["app-monthly-usage"]],standalone:!1,decls:12,vars:1,consts:[[1,"flex","flex-col","items-start","self-stretch","gap-[40px]"],[1,"flex","items-start","gap-[20px]","self-stretch","overflow-x-auto","pb-[4px]"],[1,"text-p","font-medium","text-transparency-90","min-h-[120px]","flex","items-center"],[1,"flex","items-center","self-stretch","gap-[10px]"],[1,"flex-1","h-[1px]","flex","items-center","bg-transparency-40","rounded-[10px]"],[1,"text-h2/[normal]","text-transparency-100","font-semibold","px-[10px]"],[1,"flex","items-start","flex-wrap","self-stretch","gap-[20px]"],[1,"min-w-[250px]","flex","flex-col","items-start","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid",3,"border-secondary-red","border-transparency-25"],[1,"min-w-[260px]","shrink-0","flex","flex-col","items-start","self-stretch","gap-[50px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid","border-transparency-25"],[1,"flex","items-center","justify-between","self-stretch","gap-[5px]"],[1,"flex-1","flex","items-center","gap-[5px]"],[1,"flex","items-center","justify-center","p-[6px]","bg-transparency-15","rounded-[30px]","border-[1px]","border-solid","border-transparency-25"],["svgClass","w-[20px] h-[20px] block text-transparency-100",3,"src"],[1,"flex-1","text-h2/[normal]","text-transparency-100","font-semibold"],[1,"flex","flex-col","items-start","self-stretch"],[1,"text-display-xs/[normal]","text-transparency-100","font-bold"],[1,"text-h1/[normal]","font-medium"],[1,"text-p","text-transparency-90","font-medium"],[1,"flex","items-start","self-stretch","bg-transparency-80","rounded-[30px]","my-[8px]","overflow-hidden"],[1,"h-[15px]","rounded-[30px]","transition-[width]","duration-300",3,"ngClass"],[1,"text-label","text-transparency-90","font-medium","mb-[15px]"],["label","Add Credits","variant","filled","type","light","size","40",1,"w-full",3,"leftIcon","customClass"],["label","Add Credits","variant","filled","type","light","size","40",1,"w-full",3,"clicked","leftIcon","customClass"],[1,"min-w-[250px]","flex","flex-col","items-start","self-stretch","gap-[20px]","p-[20px]","bg-transparency-0","rounded-[20px]","border-[1px]","border-solid"],[1,"flex-1","flex","flex-col","items-start"],[1,"text-h2","text-transparency-100","font-semibold"],[1,"text-label","text-transparency-90","font-medium"],[1,"flex","items-center","justify-center","self-stretch"],[1,"relative","size-[200px]","shrink-0"],["viewBox","0 0 120 120","fill","none","xmlns","http://www.w3.org/2000/svg","aria-hidden","true",1,"absolute","inset-0","size-full"],["transform","rotate(-90 60 60)"],["cx","60","cy","60","r","44","stroke-width","20","pathLength","100","stroke-dasharray","100","stroke-dashoffset","0","fill","none",1,"stroke-transparency-50"],["cx","60","cy","60","r","44","stroke-width","20","pathLength","100","stroke-linecap","butt","fill","none",1,"stroke-charts-brighter-blue"],["cx","60","cy","60","r","44","stroke-width","20","pathLength","100","stroke-linecap","butt","fill","none",1,"stroke-secondary-red"],[1,"pointer-events-none","absolute","inset-0","flex","flex-col","items-center","justify-center","text-center"],[1,"m-0","w-[68px]","text-h1","font-semibold","leading-[24px]","text-transparency-100"],[1,"m-0","w-[68px]","text-label","font-medium","leading-normal","text-transparency-100"],[1,"flex","flex-col","items-start","self-stretch","gap-[10px]"],[1,"text-h4","text-transparency-100","font-semibold"],[1,"text-h4","text-secondary-red","font-semibold"]],template:function(t,i){t&1&&(o(0,"div",0)(1,"div",1),m(2,bn,2,0,"div",2)(3,Bn,2,0),a(),o(4,"div",3),v(5,"div",4),o(6,"h2",5),r(7," Plan Capacity (Non - Renewing) "),a(),v(8,"div",4),a(),o(9,"div",6),A(10,An,29,13,"div",7,ei),a()()),t&2&&(s(2),h(i.loading?2:3),s(8),P(i.capacityCards))},dependencies:[ne,se,H],encapsulation:2})}}return n})()});function En(n,c){n&1&&v(0,"app-buy-credit")}function Rn(n,c){n&1&&v(0,"app-subscriptions")}
1function Ln(n,c){n&1&&v(0,"app-change-plan")}function $n(n,c){n&1&&v(0,"app-d4-plans")}function Vn(n,c){n&1&&v(0,"app-billings")}function Fn(n,c){n&1&&v(0,"app-history")}function Un(n,c){n&1&&v(0,"app-monthly-usage")}var In,ti,Xe=G(()=>{ve();lt();J();ve();yi();vi();zt();qt();Wt();Le();Ve();Ue();Oe();In=["moduleTopHeader"];ti=(()=>{class n{constructor(e,t,i){this.router=e,this.route=t,this.permissionsHelper=i,this.headerConfig={icon:"assets/images/icons/money-2.svg",iconBgClass:"bg-kanban-darkblue",iconStyle:"#16549b",title:"Credits - Billing",showTabs:!0,showFilter:!1,activeTab:"buy-credit",tabs:[]},this.filterData={},this.allTabs=[{key:"buy-credit",label:"Buy Credit",icon:"assets/images/icons/money-3.svg"},{key:"subscriptions",label:"Subscriptions",icon:"assets/images/icons/receipt.svg"},{key:"change-plan",label:"Change Plan",icon:"assets/images/icons/money-2.svg"},{key:"d4-plans",label:"D4$ Plans",icon:"assets/images/icons/car.svg"},{key:"billings",label:"Billings",icon:"assets/images/icons/receipt.svg"},{key:"history",label:"History",icon:"assets/images/icons/history.svg"},{key:"monthly-usage",label:"Monthly Usage",icon:"assets/images/icons/analytics.svg"}]}ngOnInit(){this.applyTabPermissions(),this.syncActiveTabFromChildRoute(),this.routeEventsSub=this.router.events.pipe(nt(e=>e instanceof St)).subscribe(()=>this.syncActiveTabFromChildRoute())}ngOnDestroy(){this.routeEventsSub?.unsubscribe()}onTabChange(e){this.permissionsHelper.canAccessCreditsBillingTab(e)&&(this.headerConfig.activeTab=e,this.router.navigate([e],{relativeTo:this.route}))}setQuickFilter(e){this.filterData=e?.filterData??{}}syncActiveTabFromChildRoute(){let e=this.route.firstChild?.snapshot?.routeConfig?.path;if(!e||!this.permissionsHelper.canAccessCreditsBillingTab(e)){this.redirectToDefaultAllowedTab();return}this.headerConfig.activeTab=e}applyTabPermissions(){this.headerConfig.tabs=this.allTabs.filter(e=>this.permissionsHelper.canAccessCreditsBillingTab(e.key))}redirectToDefaultAllowedTab(){let t=this.permissionsHelper.getDefaultCreditsBillingRoute().split("/").pop()||"buy-credit";this.permissionsHelper.canAccessCreditsBillingTab(t)&&(this.headerConfig.activeTab=t,this.router.navigate([t],{relativeTo:this.route}))}static{this.\u0275fac=function(t){return new(t||n)(x(be),x(wt),x(Nt))}}static{this.\u0275cmp=U({type:n,selectors:[["app-credits-billing"]],viewQuery:function(t,i){if(t&1&&ut(In,5),t&2){let l;pt(l=mt())&&(i.moduleTopHeader=l.first)}},standalone:!1,decls:11,vars:8,consts:[["moduleTopHeader",""],[1,"flex","flex-col","h-full"],[3,"tabChange","headerConfig"],[1,"overflow-auto","h-[calc(100vh_-_230px)]"]],template:function(t,i){t&1&&(o(0,"div",1)(1,"app-module-top-header",2,0),S("tabChange",function(u){return i.onTabChange(u)}),a(),o(3,"div",3),m(4,En,1,0,"app-buy-credit"),m(5,Rn,1,0,"app-subscriptions"),m(6,Ln,1,0,"app-change-plan"),m(7,$n,1,0,"app-d4-plans"),m(8,Vn,1,0,"app-billings"),m(9,Fn,1,0,"app-history"),m(10,Un,1,0,"app-monthly-usage"),a()()),t&2&&(s(),f("headerConfig",i.headerConfig),s(3),h(i.headerConfig.activeTab==="buy-credit"?4:-1),s(),h(i.headerConfig.activeTab==="subscriptions"?5:-1),s(),h(i.headerConfig.activeTab==="change-plan"?6:-1),s(),h(i.headerConfig.activeTab==="d4-plans"?7:-1),s(),h(i.headerConfig.activeTab==="billings"?8:-1),s(),h(i.headerConfig.activeTab==="history"?9:-1),s(),h(i.headerConfig.activeTab==="monthly-usage"?10:-1))},dependencies:[Yt,Pe,Ie,Ee,Re,$e,Fe,Ne],encapsulation:2})}}return n})()});var Nn,ii,ni=G(()=>{ve();Xe();Le();Ve();Ue();Oe();zt();qt();Wt();J();Nn=[{path:"",component:ti,children:[{path:"buy-credit",component:Re,data:{title:"Buy Credit"}},{path:"subscriptions",component:$e,data:{title:"Subscriptions"}},{path:"change-plan",component:Pe,data:{title:"Change Plan"}},{path:"d4-plans",component:Ie,data:{title:"D4$ Plans"}},{path:"billings",component:Ee,data:{title:"Billings"}},{path:"history",component:Fe,data:{title:"History"}},{path:"monthly-usage",component:Ne,data:{title:"Monthly Usage"}}]}],ii=(()=>{class n{static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275mod=fe({type:n})}static{this.\u0275inj=ge({imports:[He.forChild(Nn),He]})}}return n})()});var Oa,On=G(()=>{he();ni();wi();Bi();Xe();Le();Ve();Ue();Oe();J();Oa=(()=>{class n{static{this.\u0275fac=function(t){return new(t||n)}}static{this.\u0275mod=fe({type:n})}static{this.\u0275inj=ge({imports:[vt,ii,Qt,Kt]})}}return n})()});On();export{Oa as CreditsBillingModule};
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.