@zeniai/web-app-ui 5.3.31-dev → 5.3.31-next
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/AccountMappingScreen-UrK9tRbM.js +9 -0
- package/dist/assets/AddressRoutes-DxH_ava2.js +1 -0
- package/dist/assets/{AddressScreen-Dmypz8Cm.js → AddressScreen-DABWioDo.js} +2 -2
- package/dist/assets/{AiCfoScreen-DNghBGiO.js → AiCfoScreen-C6rCfTGT.js} +1 -1
- package/dist/assets/{AppDrawer-kOTtyyGv.js → AppDrawer-BpbvdDLm.js} +3 -3
- package/dist/assets/{BillPayApprovalRoutes--ALQ35-1.js → BillPayApprovalRoutes-Cmc_HgEW.js} +1 -1
- package/dist/assets/{BillPayRoutes-BcTRlRv8.js → BillPayRoutes-BABmRhm7.js} +18 -18
- package/dist/assets/BusinessVerificationPageScreen-BVTBy_NH.js +9 -0
- package/dist/assets/{CardsAiCfoScreen-C_lk15md.js → CardsAiCfoScreen-M8CfBozB.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-BjIdSbvb.js → ChargeCardRoutes-CwfEA-XD.js} +7 -7
- package/dist/assets/CompanyPassportScreen-45xG8rzd.js +1 -0
- package/dist/assets/ConnectionAuthScreen-BXoS0E4O.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-Ck-b5wn8.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-NbUwP2i4.js +30 -0
- package/dist/assets/{DashboardRoutes-BruAIMYU.js → DashboardRoutes-Dhl22-a2.js} +3 -3
- package/dist/assets/{DefaultTenantHome-BtIFl_77.js → DefaultTenantHome-BEXYkQfC.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DhuGx2JM.js +18 -0
- package/dist/assets/{DrawerScreen-CbY0_Vl5.js → DrawerScreen-mgSqnbLE.js} +1 -1
- package/dist/assets/EntityDetailRoutes-CwRaBzZh.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-Dll0r-g6.js → ExpenseAutomationRoutes-D8xRf3tj.js} +4 -4
- package/dist/assets/FeaturePreviewScreen-mBMqdh0l.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-aP0Pvjj3.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-55rQDTXA.js → InboxNotificationsProvider-BzQISC6s.js} +1 -1
- package/dist/assets/{InvoicingRoutes-B8ytNofm.js → InvoicingRoutes-n19UtnGB.js} +2 -2
- package/dist/assets/{MagicLinkRoutes-DbYU9yxF.js → MagicLinkRoutes-C0dABmOd.js} +7 -7
- package/dist/assets/MagicLinkSignInScreen-2ydReiC6.js +12 -0
- package/dist/assets/MobileAppDrawer-DWfh55e9.js +1 -0
- package/dist/assets/NotFoundScreen-DBpwqY1S.js +1 -0
- package/dist/assets/NotificationRoutes-C_Wu_QQd.js +1 -0
- package/dist/assets/OAuthConsentScreen-Bv6-abMp.js +1 -0
- package/dist/assets/{PandLWithForecastRoutes-Diz_Rn8O.js → PandLWithForecastRoutes-Bpdm61h0.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-BcSDg2Q0.js → PaymentLinkScreen-xYlmE0b0.js} +4 -4
- package/dist/assets/PeopleRoutes-CzEtg-zt.js +22 -0
- package/dist/assets/PerformanceRoutes-DRyT5mzt.js +1 -0
- package/dist/assets/{Preview-DNAybQkC.js → Preview-Df0Evw69.js} +1 -1
- package/dist/assets/QBOConnectionScreen-CfxNJwBb.js +100 -0
- package/dist/assets/ReimbursementApprovalRoutes-p3cuLrFT.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-CdYfHOlM.js +1 -0
- package/dist/assets/ReimbursementRoutes-iVI2y2XY.js +68 -0
- package/dist/assets/{ReportsRoutes-iapNY-Ca.js → ReportsRoutes-DU2ZkUlY.js} +1 -1
- package/dist/assets/RewardsRoutes-Cif2_D0W.js +1 -0
- package/dist/assets/ScreenRoutes-DVrtUBAU.js +2 -0
- package/dist/assets/{SettingsRoutes-DU6XdEOY.js → SettingsRoutes-BCZ9b82a.js} +7 -7
- package/dist/assets/{SetupPagesScreen-CPUD_j1y.js → SetupPagesScreen-EOP6chTr.js} +5 -5
- package/dist/assets/SignInScreen-CkGTMLnN.js +1 -0
- package/dist/assets/SignOutScreen-DeeRr6fj.js +9 -0
- package/dist/assets/TaskListScreen-BX4DNneN.js +9 -0
- package/dist/assets/TaskRoutes-BwnsJ23B.js +9 -0
- package/dist/assets/TransactionDetailRoutes-Bgi9E7C2.js +1 -0
- package/dist/assets/{TransactionDetailScreen-srWo_3sK.js → TransactionDetailScreen-D_LA5Rwt.js} +2 -2
- package/dist/assets/TransactionListRoutes-DfOdGVQy.js +1 -0
- package/dist/assets/TreasuryRoutes-D3fXeGra.js +37 -0
- package/dist/assets/{VendorsRoutes-CoiOEvIl.js → VendorsRoutes-BcyXx4f8.js} +20 -20
- package/dist/assets/WiseConfirmationScreen-CqqBK3x9.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-BjLND6jg.js → ZeniAccountRoutes-DjdSRB-H.js} +9 -9
- package/dist/assets/ZeniAccountStatementScreen-DmMMy7PA.js +9 -0
- package/dist/assets/{accountMappingHelper-CAg2qsF3.js → accountMappingHelper-uI5S9sNL.js} +1 -1
- package/dist/assets/{analytics-CqoRAkB1.js → analytics-F_dCijCm.js} +1 -1
- package/dist/assets/{analyticsHelper-Cjtujqyf.js → analyticsHelper-ChcFnIcs.js} +1 -1
- package/dist/assets/{core-CiFsHd3i.js → core-CesISa_L.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-FYjI-TwW.js → decodeURIComponentSafe-B3NnThvD.js} +1 -1
- package/dist/assets/{dnd-jcX4BW0a.js → dnd-C6bwm0uz.js} +1 -1
- package/dist/assets/{empty-DSab5moc.js → empty-BK615K_3.js} +1 -1
- package/dist/assets/{empty-4iGv0vIv.js → empty-BU4Pahc0.js} +1 -1
- package/dist/assets/{emptyVideoElement-BSwv6rHf.js → emptyVideoElement-QDsEpnXc.js} +1 -1
- package/dist/assets/epic-DK8B_Vh6.js +2 -0
- package/dist/assets/{expenseAutomationHelper-R2jHKv-Z.js → expenseAutomationHelper-DdnrNMTR.js} +1 -1
- package/dist/assets/{getLocaleForTenant-CRduVQsY.js → getLocaleForTenant-ncGMGLNW.js} +1 -1
- package/dist/assets/{index-2FqIUc6q.js → index-7hjKN-OX.js} +1 -1
- package/dist/assets/{index-DGRhh-da.js → index-8KWy0lu6.js} +1 -1
- package/dist/assets/{index-0sENwUb_.js → index-C6jF5Obg.js} +1 -1
- package/dist/assets/{index-CVbu1_bp.js → index-CQe5P8WB.js} +1 -1
- package/dist/assets/{index-Cz99TrBA.js → index-D4vxEYY4.js} +1 -1
- package/dist/assets/{index-juRht-9c.js → index-D7arCk2M.js} +30310 -31275
- package/dist/assets/{index-BJOxGHxN.js → index-JzuRLp4p.js} +2 -2
- package/dist/assets/{index-D6dzsKZ7.js → index-sDiXLM_h.js} +1 -1
- package/dist/assets/{lexical-DBiumTDC.js → lexical-BnZJ_Q_K.js} +1 -1
- package/dist/assets/{liveblocks-CkQ2CY6T.js → liveblocks-CrgMd6cu.js} +1 -1
- package/dist/assets/{lottie-cUBeCDOE.js → lottie-CKWYnB4Q.js} +1 -1
- package/dist/assets/{mui-FQy08n5j.js → mui-DBCQIIXU.js} +1 -1
- package/dist/assets/{pathToGoBack-DWIhT07R.js → pathToGoBack-gghVNE3r.js} +1 -1
- package/dist/assets/{pdf-C6cPvWx8.js → pdf-CPWsdPSJ.js} +3 -3
- package/dist/assets/{pdf-lib-C9DR7g8H.js → pdf-lib-BBXjnQzB.js} +1 -1
- package/dist/assets/{plaid-Dw5LGskq.js → plaid-nYfe67yC.js} +1 -1
- package/dist/assets/{pusher-Bs1ItrSl.js → pusher-BLnFEKgX.js} +1 -1
- package/dist/assets/{react-B-yGKA4G.js → react-BBnhVvFM.js} +1 -1
- package/dist/assets/{react-BzoedhUW.js → react-BH8C9JXq.js} +1 -1
- package/dist/assets/{react-BD9-MMqW.js → react-B_eo67KW.js} +1 -1
- package/dist/assets/{react-Rj21KKGh.js → react-Cr62yEeY.js} +1 -1
- package/dist/assets/{react-N2ByZQ0u.js → react-DMGUYxKK.js} +1 -1
- package/dist/assets/{react-BK8OyR5e.js → react-GyNCgvQJ.js} +1 -1
- package/dist/assets/{recharts-CYbL6OhC.js → recharts-Bsi9TAsl.js} +1 -1
- package/dist/assets/{routePaths-DqksJ4i_.js → routePaths-Da5NL2pW.js} +1 -1
- package/dist/assets/{sentry-Lj2WEO6K.js → sentry-C0JeJOxU.js} +1 -1
- package/dist/assets/{url-Bk85P8pL.js → url-TS5h_3Yv.js} +1 -1
- package/dist/assets/url-oDWzN2ME.js +6 -0
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-B3XyU0Fo.js → useAiCfoDashboardSuggestedQuestionsChips-DEZ358c2.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-JCPjjF9P.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-YQlWLN09.js → useChargeCardPusherEvents-BHH6XZRm.js} +1 -1
- package/dist/assets/{useDeviceId-CWOFj37E.js → useDeviceId-Dkib5aJx.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DAfemXhZ.js +1 -0
- package/dist/assets/{useInitialThreadRequest-D-SxLs4P.js → useInitialThreadRequest-DwaKOz44.js} +1 -1
- package/dist/assets/useTaskManagerAccess-CCBB-yeF.js +1 -0
- package/dist/assets/utils-DTqrFXzb.js +36 -0
- package/dist/assets/{withTransactionSidePanel-BjLmCRfl.js → withTransactionSidePanel-qDIN4nKR.js} +2 -2
- package/dist/assets/{zeni-epic-state-BdFiPfcm.js → zeni-epic-state-B9V6b-sD.js} +3 -3
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/AccountMappingScreen-UdzIeE_v.js +0 -9
- package/dist/assets/AddressRoutes-CaXv_Hc-.js +0 -1
- package/dist/assets/BusinessVerificationPageScreen-DzWgqXwG.js +0 -9
- package/dist/assets/CompanyPassportScreen-BKrZbZ6U.js +0 -1
- package/dist/assets/ConnectionAuthScreen-Dzixugfp.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-D31TaCjo.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-3cZyVkRN.js +0 -30
- package/dist/assets/DomesticWireDetailScreen-DhMVIfNi.js +0 -18
- package/dist/assets/EntityDetailRoutes-DpM6LjT5.js +0 -1
- package/dist/assets/FeaturePreviewScreen-DRMNz052.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CaSUfoGO.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-DSGkqzLp.js +0 -12
- package/dist/assets/MobileAppDrawer-BAV0ejOs.js +0 -1
- package/dist/assets/NotFoundScreen-ButYFiTG.js +0 -1
- package/dist/assets/NotificationRoutes-jy7KSYzl.js +0 -1
- package/dist/assets/OAuthConsentScreen-4W57tKq2.js +0 -1
- package/dist/assets/PeopleRoutes-BsxSMUvq.js +0 -22
- package/dist/assets/PerformanceRoutes-DFKVpzlk.js +0 -1
- package/dist/assets/QBOConnectionScreen-BmXy-56M.js +0 -100
- package/dist/assets/ReimbursementApprovalRoutes-DW0hPEhv.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js +0 -1
- package/dist/assets/ReimbursementRoutes-BQ18gzav.js +0 -68
- package/dist/assets/RewardsRoutes-CO35jNo-.js +0 -1
- package/dist/assets/ScreenRoutes-B2fNAm1R.js +0 -2
- package/dist/assets/SignInScreen-DL2bXt_7.js +0 -1
- package/dist/assets/SignOutScreen-DSAHdKNP.js +0 -9
- package/dist/assets/TaskListScreen-BH2rdLa7.js +0 -9
- package/dist/assets/TaskRoutes-C-JJtR4s.js +0 -9
- package/dist/assets/TransactionDetailRoutes-CaIXvpDL.js +0 -1
- package/dist/assets/TransactionListRoutes-CpBDr1qT.js +0 -1
- package/dist/assets/TreasuryRoutes-Ja8FQwZH.js +0 -37
- package/dist/assets/WiseConfirmationScreen-Dj7QUTt6.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-BgOPM6A3.js +0 -9
- package/dist/assets/epic-CjiXGW6W.js +0 -2
- package/dist/assets/url-DhKb0GNI.js +0 -6
- package/dist/assets/useAskAiCfoHostNavButtonProps-Dhoa0fnv.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-DpIv7GW3.js +0 -1
- package/dist/assets/useTaskManagerAccess-BrCmQLIc.js +0 -1
- package/dist/assets/utils-DsJsAXTJ.js +0 -36
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-CiFsHd3i.js";import{fO as Pt,$5 as is,f_ as wt,bt as ve,$6 as ds,$7 as ls,fD as fn,$8 as Pn,fM as wn,$9 as Tn,$a as vn,$b as Fn,$c as xn,fN as Bn,fZ as Ln,$d as Rn,$e as us,fT as ms,fS as Cs,$f as ps,Jm as On,g0 as ia,$g as hs,$h as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$i as Ss,fW as ys,IU as Is,IT as ks,IX as Es,IZ as As,g6 as Ds,fA as $n,$j as _s,$k as Ps,gb as Mn,$l as ws,gc as yt,J3 as Ts,J0 as vs,fB as fe,$m as qa,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$n as ua,$o as Tt,Cf as Ga,m3 as Ka,$p as za,JC as ka,g1 as qe,JE as vt,lV as Nn,$q as ma,Jq as _a,$r as Fs,$s as xs,Jt as Ja,$t as Bs,Yg as Qa,fY as Vn,Jz as ba,im as Ls,$u as Hn,fP as Ca,br as Rs,$v as Os,gD as Xa,gC as et,K6 as Us,gB as at,$w as Gn,ct as Kn,d6 as js,Yf as wa,KH as zn,$x as gn,Kh as Pa,$y as Yn,KI as $s,YF as Ms,KJ as Ns,LO as Vs,Bv as Hs,LI as Gs,$z as Ks,JD as oa,$A as zs,$B as Ys,$C as Ws,$D as Zs,$E as qs,$F as Ft,$G as Js,JT as Wn,JM as Qs,$H as Xs,gZ as eo,$I as Zn,K0 as qn,K4 as Jn,gY as ao,$J as to,Kt as Qn,$K as no,$L as ro,$M as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$N as rr,$O as co,g8 as io,g9 as lo,ga as uo,$P as tt,g2 as sr,d8 as xt,$Q as mo,$R as Co,$S as po,$T as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$U as or,KG as Ha,Rx as ko,$V as Eo,$W as Ao,$X as Do,$Y as cr,$Z as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,$_ as To,$$ as vo,Jn as Fo,a00 as dr,fX as lr,a01 as xo,Jp as Bo,Jo as bn,a02 as Lo,a03 as Ro,a04 as Oo,UA as Uo,a05 as Bt,a06 as jo,Fm as ur,mD as $o,ib as Mo,L6 as No,a07 as mr,fJ as Vo,fK as Ho,a08 as Go,dJ as Ko,f$ as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cF as qo,bK as Jo,Ts as Qo}from"./zeni-epic-state-BdFiPfcm.js";import{V as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Xo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,d as gr,ap as br,p as ke,O as le,y as W,g as ya,dh as Sr,di as tc,dj as nc,z as te,a5 as Ta,d0 as nt,dk as rc,dl as sc,dm as oc,$ as va,bg as Qe,bC as Rt,dn as cc,a9 as Fa,T as rt,E as Ot,h as ae,w as st,dp as ic,bO as Sa,dq as kt,dr as dc,a6 as Ut,ds as lc,ac as yr,at as Et,dt as uc,ao as Ir,I as kr,N as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,F as Ya,dB as Sc,dC as yc,m as ht,U as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,f as wc}from"./index-juRht-9c.js";import{n as Ne,D as Ar,S as Tc}from"./mui-FQy08n5j.js";import{a as r}from"./sentry-Lj2WEO6K.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Dhoa0fnv.js";import{M as Ee}from"./MobileAppDrawer-BAV0ejOs.js";import{d as jt}from"./recharts-CYbL6OhC.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-CPUD_j1y.js";import{u as Tr}from"./useInitialThreadRequest-D-SxLs4P.js";import ot from"./NotFoundScreen-ButYFiTG.js";import{u as Nt}from"./useChargeCardPusherEvents-YQlWLN09.js";import{n as yn}from"./utils-DsJsAXTJ.js";import{t as Lc}from"./AddressScreen-Dmypz8Cm.js";import"./analytics-CqoRAkB1.js";import"./plaid-Dw5LGskq.js";import"./dnd-jcX4BW0a.js";import"./stripe-cKAAJElX.js";import"./lottie-cUBeCDOE.js";import"./lexical-DBiumTDC.js";import"./pdf-C6cPvWx8.js";import"./InboxNotificationsProvider-55rQDTXA.js";import"./useTaskManagerAccess-BrCmQLIc.js";import"./BusinessVerificationPageScreen-DzWgqXwG.js";import"./routePaths-DqksJ4i_.js";import"./analyticsHelper-Cjtujqyf.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b4b93283-5558-4471-a603-845e32572659",e._sentryDebugIdIdentifier="sentry-dbid-b4b93283-5558-4471-a603-845e32572659")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
1
|
+
import{j as o}from"./liveblocks-CrgMd6cu.js";import{u as me,j as d,h as de,g as he,i as Me,N as qe,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-CesISa_L.js";import{fO as Pt,_R as is,f_ as wt,bt as ve,_S as ds,_T as ls,fD as fn,_U as Pn,fM as wn,_V as Tn,_W as vn,_X as Fn,_Y as xn,fN as Bn,fZ as Ln,_Z as Rn,__ as us,fT as ms,fS as Cs,_$ as ps,J6 as On,g0 as ia,$0 as hs,$1 as fs,fF as gs,fE as bs,gd as ze,fV as Un,fU as jn,$2 as Ss,fW as ys,IE as Is,ID as ks,IH as Es,IJ as As,g6 as Ds,fA as $n,$3 as _s,$4 as Ps,gb as Mn,$5 as ws,gc as yt,IP as Ts,IM as vs,fB as fe,$6 as Za,dU as Fe,de as xe,dV as Be,gX as da,cA as la,$7 as ua,$8 as Tt,B$ as Ga,lN as Ka,$9 as za,Jm as ka,g1 as Ze,Jo as vt,lD as Nn,$a as ma,Ja as _a,$b as Fs,$c as xs,Jd as qa,$d as Bs,Y0 as Xa,fY as Vn,Jj as ba,im as Ls,$e as Hn,fP as Ca,br as Rs,$f as Os,gD as Qa,gC as et,JS as Us,gB as at,$g as Gn,ct as Kn,d6 as js,X$ as wa,Kr as zn,$h as gn,K1 as Pa,$i as Yn,Ks as $s,Yp as Ms,Kt as Ns,Ly as Vs,Bf as Hs,Ls as Gs,$j as Ks,Jn as oa,$k as zs,$l as Ys,$m as Ws,$n as Js,$o as Zs,$p as Ft,$q as qs,JD as Wn,Jw as Xs,$r as Qs,gZ as eo,$s as Jn,JM as Zn,JQ as qn,gY as ao,$t as to,Kd as Xn,$u as no,$v as ro,$w as so,JO as Qn,Jz as er,Jg as ar,JI as tr,JG as nr,JK as oo,$x as rr,$y as co,g8 as io,g9 as lo,ga as uo,$z as tt,g2 as sr,d8 as xt,$A as mo,$B as Co,$C as po,$D as ho,JY as It,Kk as fo,Kg as go,JU as bo,Ki as So,K8 as yo,Ka as Io,$E as or,Kq as Ha,Rh as ko,$F as Eo,$G as Ao,$H as Do,$I as cr,$J as _o,KN as Po,K0 as ir,JX as $e,J$ as wo,$K as To,$L as vo,J7 as Fo,$M as dr,fX as lr,$N as xo,J9 as Bo,J8 as bn,$O as Lo,$P as Ro,$Q as Oo,Uk as Uo,$R as Bt,$S as jo,F6 as ur,ml as $o,ib as Mo,KS as No,$T as mr,fJ as Vo,fK as Ho,$U as Go,dJ as Ko,f$ as zo,KI as Yo,KC as Je,bq as Wo,bJ as Jo,cF as Zo,bK as qo,Tc as Xo}from"./zeni-epic-state-B9V6b-sD.js";import{U as Le,db as Cr,a2 as we,dc as pr,dd as hr,de as Qo,G as ea,aq as Lt,df as ec,dg as ac,a as fr,f as gr,ap as br,p as ke,I as le,d as W,j as ya,dh as Sr,di as tc,dj as nc,z as te,a5 as Ta,d0 as nt,dk as rc,dl as sc,dm as oc,$ as va,bg as Xe,bC as Rt,dn as cc,a9 as Fa,X as rt,E as Ot,k as ae,w as st,dp as ic,bO as Sa,dq as kt,dr as dc,a6 as Ut,ds as lc,ac as yr,at as Et,dt as uc,ao as Ir,O as kr,S as Er,du as mc,dv as Cc,dw as pc,dx as hc,dy as fc,dz as gc,dA as bc,K as Ya,dB as Sc,dC as yc,m as ht,c as Ic,dD as kc,dE as Ec,dF as Ac,ag as Dc,dG as _c,dH as Pc,h as wc}from"./index-D7arCk2M.js";import{n as Ne,D as Ar,S as Tc}from"./mui-DBCQIIXU.js";import{a as r}from"./sentry-C0JeJOxU.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-JCPjjF9P.js";import{M as Ee}from"./MobileAppDrawer-DWfh55e9.js";import{d as jt}from"./recharts-Bsi9TAsl.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Qe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-EOP6chTr.js";import{u as Tr}from"./useInitialThreadRequest-DwaKOz44.js";import ot from"./NotFoundScreen-DBpwqY1S.js";import{u as Nt}from"./useChargeCardPusherEvents-BHH6XZRm.js";import{n as yn}from"./utils-DTqrFXzb.js";import{t as Lc}from"./AddressScreen-DABWioDo.js";import"./analytics-F_dCijCm.js";import"./plaid-nYfe67yC.js";import"./dnd-C6bwm0uz.js";import"./stripe-cKAAJElX.js";import"./lottie-CKWYnB4Q.js";import"./lexical-BnZJ_Q_K.js";import"./pdf-CPWsdPSJ.js";import"./InboxNotificationsProvider-BzQISC6s.js";import"./useTaskManagerAccess-CCBB-yeF.js";import"./BusinessVerificationPageScreen-BVTBy_NH.js";import"./routePaths-Da5NL2pW.js";import"./analyticsHelper-ChcFnIcs.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="008e1efb-94db-425c-b9f3-24acc1079777",e._sentryDebugIdIdentifier="sentry-dbid-008e1efb-94db-425c-b9f3-24acc1079777")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),Z=O.poppedPathname??T;e(Z,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),J=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const Z=pr(O);t(gs({templates:[Z]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),X=r.useRef(V);r.useEffect((()=>{const O=X.current;X.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Qo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:J,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(qe,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",J=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const X=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(qe,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:J,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:J,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:J}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:X,setIsAiCfoOpen:c}=fr(),O=gr(),Z=br(),se=d((q=>$n(q))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:Q,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(Q,Ve,3)),[Q,Ve]),[ge,re]=r.useState(""),be=Z&&O&&N!=null&&!X,ue=r.useCallback((q=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:q,aiCfoShouldSubmit:q!=null&&q.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((q=>{q.trim().length!==0&&(re(""),ue(q))}),[ue]),Se=r.useCallback((()=>{const q=ge.trim();q.length!==0&&(re(""),ue(q))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((q=>{re(q)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:J,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,J,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((Q=>fe(Q))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((Q=>Za(Q).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((Q=>da(Q,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((Q=>ua(Q))),R=d((Q=>Q.classListState.fetchState)),i=!F&&k&&p,f=d((Q=>Tt(Q,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((Q=>x!=null?Ga(Q.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((Q=>V!=null?Ka(Q.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((Q=>P!=null?Ga(Q.userRoleState,P):void 0)),J=K?.accountingClassIDs[0],I=d((Q=>J!=null?Ka(Q.classState,{classId:J,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const Q=_e(s.tenantEmailDomain,a,t,U,m);e(Q)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(Ze()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const X=()=>{if(t!=null&&a!=null){n(za());const Q=_e(s.tenantEmailDomain,a,t);e(Q)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Qe(k,B,_,p),Z=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:X,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:Z,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Jc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),Zc=[Ra,La],qc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Xc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Qc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,Zc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(qc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Qc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Xe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(qa()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Xa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const J=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:J}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{J(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Qa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
|
|
@@ -11,18 +11,18 @@ import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as
|
|
|
11
11
|
flex-direction: column;
|
|
12
12
|
align-items: center;
|
|
13
13
|
background-color: ${e=>e.theme.colors.grey4};
|
|
14
|
-
`,Wa=ea.getLocalizedStrings().dateFormat,si={overlayWidth:new Fa(100,100,58)},Nr=[$r,ct],oi=new Set(Nr),ci=Pe((function(e,a){const n=a.currentTenant?.companyId;return{plaidConnectionDetails:Ms(e,n,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Ns(e.depositAccountState,e.depositAccountListState)}}),(function(e,a){const{navigate:n,currentTenant:t,isCashbackInfoFetchStateCompleted:s,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:b,controllerEmails:h,paymentDetails:A,productInformation:u,cashbackInformation:m,paymentSourceInformation:F,creditAccountInformation:w,debitAccountInformation:p,paymentInitiatedDate:v,sourcePage:L}=a,{tenantEmailDomain:S}=t,l=()=>{e(zn(!0));const C=aa(t);C!=null&&C!==""&&e(Pa(C,!0,!0)),e(
|
|
14
|
+
`,Wa=ea.getLocalizedStrings().dateFormat,si={overlayWidth:new Fa(100,100,58)},Nr=[$r,ct],oi=new Set(Nr),ci=Pe((function(e,a){const n=a.currentTenant?.companyId;return{plaidConnectionDetails:Ms(e,n,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Ns(e.depositAccountState,e.depositAccountListState)}}),(function(e,a){const{navigate:n,currentTenant:t,isCashbackInfoFetchStateCompleted:s,isCreditCardInfoFetchStateCompleted:g,isDebitCardInfoFetchStateCompleted:b,controllerEmails:h,paymentDetails:A,productInformation:u,cashbackInformation:m,paymentSourceInformation:F,creditAccountInformation:w,debitAccountInformation:p,paymentInitiatedDate:v,sourcePage:L}=a,{tenantEmailDomain:S}=t,l=()=>{e(zn(!0));const C=aa(t);C!=null&&C!==""&&e(Pa(C,!0,!0)),e(Ze(!0))};return{onBackNavigation:()=>{if(s&&g&&b&&m!=null&&ae.trackCardsPayEarlyFormClick(h,u,m,"Back",A.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:A.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:A.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:A.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:A.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:v?.add(3,"day").format(Wa.visual.MMMDCommaYYYYformat),paymentInitiatedDate:v?.format(Wa.visual.MMMDCommaYYYYformat)},F,w,p),L==="cardPaymentHistory")a.closeDrawerHandler(!0),e(Yn());else{const C=ta(S);n(C)}},onUpdatePaymentAccountStatus:(C,B,k)=>{e(Gs(C,B,"bill_pay","bill_pay_detail",k))},onEstablishConnectionSuccess:()=>{e(Pa(t.companyId,!0))},onFetchLinkTokenClick:C=>{e(Hs("external_account",C))},onEstablishConnectionClick:C=>{e(Vs(C,t.companyId,"charge_card_payment","charge_cards"))},onEventReceived:C=>{oi.has(C)&&l()},onPusherSubscribed:l}}))(st(ic)),zt=({isPaymentDrawerOpen:e,closeDrawerHandler:a,pageName:n,creditAccountSpentAmount:t,productInformation:s,sourcePage:g,creditAccountInformation:b,debitAccountInformation:h,cashbackInformation:A,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:m,isCashbackInfoFetchStateCompleted:F,paymentInitiatedDate:w,retryRepayment:p})=>{const v=de(),{useDynamicConfig:L}=le(),S=d((N=>Gn(N))),{creditAccount:l}=d((N=>ua(N))),C=d((N=>fe(N))),B=Ot(),k=va(),_=me(),D=te.getSignedInUser(),$=Le(),[E,y]=r.useState(!1),[R,i]=r.useState(!1),{configValue:f}=L(Xe.zeniCardsConfig),j=f.credit_card_auto_pay_threshold_by_company_id?.[C.companyId]??f.default_credit_card_auto_pay_threshold??vc,G=Kn($?.loggedInUserRoleMap),U=js($?.loggedInUserRoleMap),x=d((N=>wa(N,C.companyId))),z=x.companyChargeCardInfo?.primaryFundingAccount,V=x.allFundingAccounts.find((N=>N.id===z?.accountId)),T=d((N=>da(N,C.companyId))),P=la(T.controllers);r.useEffect((()=>{if(S.fetchState!=="Completed"&&S.fetchState!=="In-Progress"&&_(zn()),S.fetchState==="Completed"&&!R){const N=C.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,X=S.transferFromAccounts.find((O=>O.id===N));let c;if(g==="cardPaymentHistory"&&p){const O=p.paymentAccountId!=null?S.transferFromAccounts.find((Z=>Z.id===p.paymentAccountId)):void 0;c={amount:p.amount,isAutoRepayment:C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:O??X}}else c={amount:{amount:l.balance.amount+l.hold.amount,currencyCode:l.balance.currencyCode,currencySymbol:l.balance.currencySymbol},isAutoRepayment:C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:yn(),transferFrom:X};_(gn(c)),i(!0)}}),[S.fetchState,R,g,p,S.transferFromAccounts,C.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,C.companyChargeCardInfo?.info?.isAutoPayEnabled,l.balance.amount,l.balance.currencyCode,l.balance.currencySymbol,l.hold.amount,_]);const K={isZeniCheckingEnabled:C.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:V?.accType==="depositAccount",creditCardPaymentSourceAccountName:V?.label,creditCardPaymentSourceAccountType:V?.accType,creditCardPaymentSourceLastFourDigits:V?.accountLast4,creditCardPaymentSourceBalance:V?.accountBalance?.available?.amount??0};if(r.useEffect((()=>{x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&_(Pa(C.companyId,!0))}),[x.fetchState]),r.useEffect((()=>{S.updateStatus==="Completed"&&A!=null&&F&&m&&u&&ae.trackCardsPayEarlyPayNowClick(P,s,A,S.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:S.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:S.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:S.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:S.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:w?.add(3,"day").format(Wa.visual.MMMDCommaYYYYformat),paymentInitiatedDate:w?.format(Wa.visual.MMMDCommaYYYYformat)},K,b,h)}),[S.updateStatus,A,F,m,u,w]),r.useEffect((()=>{S.fetchState==="Completed"&&A!=null&&F&&m&&u&&!E&&e&&R&&A!=null&&(ae.trackCardsPayEarlyFormView(P,s,A,n,C.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,l.balance.amount,K,b,h),y(!0))}),[S,F,m,u,E,e,R]),D==null)throw Error("Can't access invite people page without signing in...");const J=()=>{a(!0),_(Yn())},I=aa(C),M={events:e?ha(I,Nr):[],eventCallback:(N,X,c)=>{c.onEventReceived(N)},onSubscribed:N=>{N.onPusherSubscribed()}};return o.jsx(o.Fragment,{children:o.jsx(Ar,{onClose:()=>{J()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:si.overlayWidth.valuePercentage(k),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:B.colors.black,opacity:.75,cursor:"pointer"}}},children:o.jsx(ii,{onClick:N=>N.stopPropagation(),children:o.jsx(ci,{...M,closeDrawerHandler:a,navigate:v,paymentDetails:S,creditAccountSpentAmount:t,onTransferClick:()=>{F&&m&&u&&A!=null&&ae.trackCardsPayEarlyFormClick(P,s,A,"Pay Now",S.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:S.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:S.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:S.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:S.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},K,b,h),_($s({companyId:C.companyId}))},onDismissClick:J,onSaveChangesToLocalStore:N=>{_(gn(N))},currentTenant:C,hasZeniAccountsAdminAccess:G,isZeniAccountsUser:U,productInformation:s,sourcePage:g,controllerEmails:P,autoPayThreshold:j,paymentSourceInformation:K,creditAccountInformation:b,debitAccountInformation:h,cashbackInformation:A,isCashbackInfoFetchStateCompleted:F,isCreditCardInfoFetchStateCompleted:m,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:w})})})})},ii=Ne(Tc)`
|
|
15
15
|
display: flex;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
|
-
`,Yt=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,je=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Za=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const a=e;return typeof a.transaction_id=="string"&&typeof a.amount=="number"&&typeof a.currency_code=="string"&&typeof a.currency_symbol=="string"&&typeof a.direction=="string"&&!!Za(a.transaction_status)&&!!Za(a.transaction_type)},Wt=(e,a)=>{const n=e?.card_status;if(!Za(n))return null;const t=e?.is_locked_by_admin;return{cardId:a,cardStatus:n,isLockedByAdmin:typeof t=="boolean"?t:void 0}},At=[Lr,Rr,Or,Ur,jr,pa,Vt,ct,Ht,Gt,Kt],Vr=[Ra,La],di=new Set([...At,...Vr]),bt=ea.getLocalizedStrings().dateFormat,li=Pe((function(e,a){const{includeCreditAccountInfo:n,cardId:t,signedInUserToken:s,isChargeCardFeatureEnabled:g}=a,b=te.getSignedInUser(),h=e.tenantState.currentTenantId,A={userId:b?.userId??"",sessionId:b?.zeniSessionId??"",tenantId:h??""},u=Tt(e,t,n,g),m=Xs(e,t),F=eo(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:m,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:A,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${yr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s,receiptsEmail:Zn(e.tenantState,h)}}),(function(e,a){const{cardId:n,currentTenant:t,navigate:s,location:g,cardProviderId:b,includeCreditAccountInfo:h,setIsPaymentOpen:A,controllerEmails:u,productInformation:m,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:p,debitAccountInformation:v,isChargeCardFeatureEnabled:L}=a,{tenantEmailDomain:S}=t;return{onEventReceived:(l,C)=>{(({event:B,data:k,cardId:_,dispatch:D,subscribedEvents:$})=>{const E=Yt(k);switch(B){case Ra:case La:return void D(_a(!0));case Lr:{const y=ie(E?.card_id);if(y==null||y!==_)return;const R=ie(E?.transaction_id),i=E?.transaction_status;return R!=null&&Za(i)?void D(Js({transactionId:R,transactionStatus:i})):void D(oa(_,null,null,!0))}case pa:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=Wt(E,y);return R!=null?void D(Ft(R)):void D(ba(_,!0))}case Vt:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.currency_code),i=ie(E?.currency_symbol),f=je(E?.balance);return R!=null&&i!=null&&f!=null?(D(qs({cardId:y,currencyCode:R,currencySymbol:i,balance:f,hold:je(E?.hold),dailyPurchaseSpends:je(E?.daily_purchase_spends),monthlyPurchaseSpends:je(E?.monthly_purchase_spends),dailyWithdrawals:je(E?.daily_withdrawals),monthlyWithdrawals:je(E?.monthly_withdrawals)})),void D(qe(!0))):(D(ba(_,!0)),void D(qe(!0)))}case ct:{const y=ie(E?.currency_code),R=ie(E?.currency_symbol),i=je(E?.available_amount),f=je(E?.balance_amount);return y!=null&&R!=null&&i!=null&&f!=null?void D(Zs({currencyCode:y,currencySymbol:R,available:i,balance:f,hold:je(E?.hold_amount),cashback:je(E?.cashback_amount)})):void D(qe(!0))}case Rr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ws({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case Or:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ys({cardId:y,declineReason:ie(E?.decline_reason),transaction:R})):void D(oa(_,null,null,!0))}case Ur:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(zs({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case jr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.transaction_id),i=E?.attachment_file_paths;return R!=null&&Array.isArray(i)&&i.every((f=>typeof f=="string"))?void D(Ks({cardId:y,transactionId:R,attachmentFilePaths:i})):void D(oa(_,null,null,!0))}case Ht:case Gt:case Kt:{const y=ie(E?.card_id);if(y==null||y!==_)return;D(ba(_,!0))}}})({event:l,data:C,cardId:n,dispatch:e,subscribedEvents:di})},onPusherSubscribed:()=>{e(ba(n,!0)),e(oa(n,null,null,!0)),e(qe(!0))},onReloadTransactions:()=>{e(ka(n,h,L))},onFetchChargeCardTransactionList:(l,C)=>{e(oa(n,l,C))},onUpdateScrollYOffset:l=>{},onGetOtp:l=>{b!=null&&e(at(l,"ChargeCardHolder",n))},onResendOtp:l=>{b!=null&&e(et(l,"ChargeCardHolder",n))},onVerifyOtp:(l,C)=>{b!=null&&e(Xa(l,C,"ChargeCardHolder",n))},onVerifyOtpSuccess:l=>{l!=null&&te.saveZeniOtpTokenForCardHolder(l,n)},onColorCodeChange:l=>{e(oo(n,l))},onLockChargeCard:(l,C)=>{e(nr(l,n,C))},onUnlockChargeCard:l=>{e(tr(l,n))},onCloseChargeCard:l=>{e(ar(n,l))},onFetchChargeCardsRecurringExpenses:()=>{e(er([n]))},updateChargeCardName:(l,C)=>{e(Xn(l,n,C))},updateChargeCardTransactionAttachments:(l,C)=>{C!=null&&e(so({transactionId:l,data:C}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(l,C,B,k)=>{e(ro({chargeCardId:C,transactionId:l,fetchState:B,error:k}))},updateChargeCardTransactionReceiptsShowTick:(l,C,B)=>{e(no({chargeCardId:C,transactionId:l,shouldShowTick:B}))},onChargeCardRevokeInviteClick:()=>{e(Qn(n))},updateChargeCardTransactionIsViewReceiptClicked:(l,C,B)=>{e(to({chargeCardId:C,transactionId:l,isViewReceiptClicked:B}))},onChargeCardTransactionRowClick:(l,C)=>{const B=ke(g.state?.pathnameStackToGoBack,g.pathname);s(`../../transaction/${l}/${C}`,{state:{pathnameStackToGoBack:B}})},onBackClick:()=>{const l=we(g.state?.pathnameStackToGoBack),C=ta(S);s(C,{state:{pathnameStackToGoBack:l.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ao())},onUpdateDebitCardPinAttempt:l=>{e(Jn(n,l)),l==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(l,C)=>{l?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):C!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:C.message}]}))},updateSpendLimit(l,C,B,k){e(qn(l,C,B.code,k))},shouldOpenCreditCardPaymentDrawer(l){l&&F!=null&&ae.trackCardsPayEarlyClick(u,m,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:t.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},p,v),A(l)}}}))(st(lc));function ui(){const e=de(),a=me(),n=he(),{cardId:t}=Me(),[s,g]=r.useState(!1),[b,h]=r.useState(!1),{useDynamicConfig:A}=le(),u=te.getSignedInUser(),m=d((Y=>fe(Y))),F=d((Y=>qa(Y).firstViewAfterActivation)),w=d((Y=>Y.classListState.fetchState)),{configValue:p}=A(Qe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:v}=A(Qe.zeniCardsConfig),L=v.enable_card_controls_for_company_ids,S=v.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(L)&&L.includes(m.companyId),[l,C]=r.useState(!1),[B,k]=r.useState(!1),{useFeatureGate:_}=le(),{isFeatureEnabled:D}=_(W.isChargeCardFeatureEnabled),{isFeatureEnabled:$}=_(W.isDebitCardFeatureEnabled),E=Be($,m),y=Re({isDebitCardFeatureEnabled:$,isBankingOnlyTenant:E}),{isFeatureEnabled:R}=_(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:i}=_(W.isCardsCommentingEnabled),f=xe(m),j=Fe(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:D,isBookKeepingTenant:f,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:G}),x=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,V=!m.userRole.includes("charge_card_user")&&U&&z;if(t==null)throw Error("Empty card id is not valid...");const T=d((Y=>wa(Y,m.companyId))),{creditAccount:P,creditAccountRepayment:K}=d((Y=>ua(Y))),Z=te.getZeniOtpTokenForCardHolder(t),I=d((Y=>Tt(Y,t,V,U))),{isAiCfoAccessEnabled:M,onAskAiCfoClick:N}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const Q=d((Y=>ma(Y))),c=I.chargeCard,O=Le(),q=ve(O?.loggedInUserRoleMap),se=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_virtual_debit_card",X=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_physical_credit_card",Ve=c?.type.code==="business_virtual_debit_card"||c?.type.code==="business_virtual_credit_card",Ae=c?.type.code==="business_virtual_debit_card",ge=Ba(U,z,q,P,K),re=Dr(se,I),be=$t(q,Q),ue=Xe(U,y,x,z),oe=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Se=d((Y=>da(Y,m.companyId))),ee=la(Se.controllers),De=d((Y=>c?.cardCreatedByUser?.userId!=null?Ga(Y.userRoleState,c?.cardCreatedByUser?.userId):void 0)),Te=d((Y=>De?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:De?.accountingClassIDs[0],reportId:"class_list"}):void 0)),Ce=d((Y=>c?.cardHolderUser?.userId!=null?Ga(Y.userRoleState,c?.cardHolderUser?.userId):void 0)),J=d((Y=>Ce?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:Ce?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=m?.userRole,na=d((Y=>Ca(Y,!1,y,D).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Y=ta(m.tenantEmailDomain);e(Y)}}),[Oa,na.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&Ve&&(g(!0),setTimeout((()=>{a(za()),Ae&&a(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,Ve,Ae]),r.useEffect((()=>{l||I.fetchState==="Completed"||I.fetchState==="In-Progress"||t==null||(C(!0),a(ka(t,V,U,!1)))}),[l,I,t,a]),r.useEffect((()=>{!B&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&se&&oe&&q&&(k(!0),a(Wn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[B,I,a,oe,q]),r.useEffect((()=>{Q.fetchState!=="Completed"&&Q.fetchState!=="In-Progress"&&q&&a(_a()),w!=="Completed"&&w!=="In-Progress"&&a(Nn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&a(Qs({chargeCardId:t})),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&a(Pa(m.companyId,!0))}),[Q.fetchState,a,q,w,I.transactionStatistics.fetchState,T.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||U&&P.fetchState!=="Completed"||c==null||I.transactionStatistics.fetchState!=="Completed"||se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Y=c.type.code.includes("physical"),ye=Y?c.cardActivationAttemptHistory[0]?.timestamp:c.createTime;ae.trackCardsCardDetailView(ee,ue,{cardId:t,cardName:c.cardName,cardType:c.type.code.includes("credit")?"credit":"debit",cardCategory:Y?"physical":"virtual",cardLimit:Sa(c.limit.amount),cardLastFourDigits:c.accountLast4,cardStatus:c.status.code,cardAssignedDate:c.createTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:c.providerCardCreateTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:ye?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:c.creditLimitFrequency.name,cardSpentAmount:Sa(c.balance.amount),cardAvailableLimit:Sa(c.available.amount),cardUtilizationPercent:c.limit.amount>0?Math.round((c.limit.amount-c.available.amount)/c.limit.amount*100):0,cardUtilizationAmount:Sa(c.limit.amount-c.available.amount),totalNumberOfDeclinedTransactions:I.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:I.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:I.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:I.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:I.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:I.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:kt(c.cardCreatedByUser,!1),cardIssuedByEmail:c.cardCreatedByUser?.email,cardIssuedByUserId:c.cardCreatedByUser?.userId,cardIssuedByRole:De?.userRoles,cardIssuedByDepartment:Te?.className},{cardholderName:kt(c.cardHolderUser,!1),cardholderEmail:c.cardHolderUser?.email,cardholderRole:Ce?.userRoles,cardholderUserId:c.cardHolderUser?.userId,cardholderDepartment:J?.className},ge,re)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,P.fetchState,q]),u==null)throw Error("Can't access card detail page without signing in...");const dt=aa(m),Ea=q?[...At,...Vr]:At,ra={events:ha(dt,Ea),eventCallback:(Y,ye,ce)=>{ce.onEventReceived(Y,ye)},onSubscribed:Y=>{Y.onPusherSubscribed()}},Aa=()=>{if(t!=null&&c!=null){const{ownerName:Y,cardName:ye,utilisation:ce,limit:He,frequency:Ye,cardColor:Ge}=St(c),Ke=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageViewed(t,Y,ye,ce,He,Ye,Ge,Ke)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Y=I.chargeCard;if(Y?.status.code==="inactive"||se&&Y?.isPinSet===!1||X&&F){const ye=_e(m.tenantEmailDomain,t,u,c,F);e(ye)}}}),[I.fetchState]);const lt=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:He,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageClicked(t,ce,He,Ye,Ge,Ke,Y,sa,ye)}},ut=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:He,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsVerifyPopUpClick(t,ce,He,Ye,Ge,Ke,Y,sa,ye)}},pe=P.balance.amount+P.hold.amount,Ua=m.companyChargeCardInfo?.info?.primaryFundingAccount,Da=T.allFundingAccounts.find((Y=>Y.id===Ua?.accountId)),ja=I.chargeCard!=null,$a=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!$a&&se&&q&&I.depositAccountLimitFetchState.fetchState!=="Completed"?o.jsx(dc,{}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?o.jsx(Ut,{analytics:ae,onLoad:Aa}):null,b===!0?o.jsx(zt,{closeDrawerHandler:()=>h(!1),isPaymentDrawerOpen:b,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!se||!q||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||P.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!q||Q.fetchState==="Completed",paymentInitiatedDate:K.initiatedRepaymentDate}):null,o.jsx(li,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:u,location:n,navigate:e,setIsPaymentOpen:h,cardIssuedByRoles:De?.userRoles,cardIssuedByDepartmentName:Te?.className,cardHolderRoles:Ce?.userRoles,cardHolderDepartmentName:J?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:y,isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:z,isCardControlsEnabled:S,isEarlyPayEnabled:R,controllerEmails:ee,chargeCardCashbackDetailState:Q,productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:m,cardProviderId:I.chargeCard?.cardProviderID,cardId:t,creditAccount:P,creditAccountRepayment:K,includeCreditAccountInfo:V,signedInUserToken:Z,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:p.documentAiReceiptMaxSizeLimitBytes!=null?p.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:M,onAskAiCfoClick:N,isCardsCommentingEnabled:i})]}):o.jsx(ot,{})}const St=e=>{const a=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,n=e.cardName,t=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,g=e.creditLimitFrequency.name;return{ownerName:a,cardName:n,utilisation:t,cardColor:e.cardColorCode??"",frequency:g,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:mi,subheadline:Ci,pageTitle:pi}}}}=ea.getLocalizedStrings(),Hr=[pa,ct,Mr,La,Ra,it,Kt,Zc,Ht,Gt,Vt],hi=new Set(Hr),Dt=jt(((e,a,n,t)=>{e(ia(a,n,t,!0))}),400),fi=Ne.div`
|
|
18
|
+
`,Yt=e=>e!=null&&typeof e=="object"?e:null,ie=e=>typeof e=="string"?e:void 0,je=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Ja=e=>e!=null&&typeof e=="object"&&typeof e.code=="string"&&typeof e.name=="string",gt=e=>{if(e==null||typeof e!="object")return!1;const a=e;return typeof a.transaction_id=="string"&&typeof a.amount=="number"&&typeof a.currency_code=="string"&&typeof a.currency_symbol=="string"&&typeof a.direction=="string"&&!!Ja(a.transaction_status)&&!!Ja(a.transaction_type)},Wt=(e,a)=>{const n=e?.card_status;if(!Ja(n))return null;const t=e?.is_locked_by_admin;return{cardId:a,cardStatus:n,isLockedByAdmin:typeof t=="boolean"?t:void 0}},At=[Lr,Rr,Or,Ur,jr,pa,Vt,ct,Ht,Gt,Kt],Vr=[Ra,La],di=new Set([...At,...Vr]),bt=ea.getLocalizedStrings().dateFormat,li=Pe((function(e,a){const{includeCreditAccountInfo:n,cardId:t,signedInUserToken:s,isChargeCardFeatureEnabled:g}=a,b=te.getSignedInUser(),h=e.tenantState.currentTenantId,A={userId:b?.userId??"",sessionId:b?.zeniSessionId??"",tenantId:h??""},u=Tt(e,t,n,g),m=Qs(e,t),F=eo(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:m,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:A,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${yr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s,receiptsEmail:Jn(e.tenantState,h)}}),(function(e,a){const{cardId:n,currentTenant:t,navigate:s,location:g,cardProviderId:b,includeCreditAccountInfo:h,setIsPaymentOpen:A,controllerEmails:u,productInformation:m,cashbackInformation:F,primaryFundingAccountDetails:w,creditAccountInformation:p,debitAccountInformation:v,isChargeCardFeatureEnabled:L}=a,{tenantEmailDomain:S}=t;return{onEventReceived:(l,C)=>{(({event:B,data:k,cardId:_,dispatch:D,subscribedEvents:$})=>{const E=Yt(k);switch(B){case Ra:case La:return void D(_a(!0));case Lr:{const y=ie(E?.card_id);if(y==null||y!==_)return;const R=ie(E?.transaction_id),i=E?.transaction_status;return R!=null&&Ja(i)?void D(qs({transactionId:R,transactionStatus:i})):void D(oa(_,null,null,!0))}case pa:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=Wt(E,y);return R!=null?void D(Ft(R)):void D(ba(_,!0))}case Vt:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.currency_code),i=ie(E?.currency_symbol),f=je(E?.balance);return R!=null&&i!=null&&f!=null?(D(Zs({cardId:y,currencyCode:R,currencySymbol:i,balance:f,hold:je(E?.hold),dailyPurchaseSpends:je(E?.daily_purchase_spends),monthlyPurchaseSpends:je(E?.monthly_purchase_spends),dailyWithdrawals:je(E?.daily_withdrawals),monthlyWithdrawals:je(E?.monthly_withdrawals)})),void D(Ze(!0))):(D(ba(_,!0)),void D(Ze(!0)))}case ct:{const y=ie(E?.currency_code),R=ie(E?.currency_symbol),i=je(E?.available_amount),f=je(E?.balance_amount);return y!=null&&R!=null&&i!=null&&f!=null?void D(Js({currencyCode:y,currencySymbol:R,available:i,balance:f,hold:je(E?.hold_amount),cashback:je(E?.cashback_amount)})):void D(Ze(!0))}case Rr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ws({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case Or:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(Ys({cardId:y,declineReason:ie(E?.decline_reason),transaction:R})):void D(oa(_,null,null,!0))}case Ur:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=E?.transaction;return gt(R)?void D(zs({cardId:y,transaction:R})):void D(oa(_,null,null,!0))}case jr:{const y=ie(E?.card_id)??_;if(y!==_)return;const R=ie(E?.transaction_id),i=E?.attachment_file_paths;return R!=null&&Array.isArray(i)&&i.every((f=>typeof f=="string"))?void D(Ks({cardId:y,transactionId:R,attachmentFilePaths:i})):void D(oa(_,null,null,!0))}case Ht:case Gt:case Kt:{const y=ie(E?.card_id);if(y==null||y!==_)return;D(ba(_,!0))}}})({event:l,data:C,cardId:n,dispatch:e,subscribedEvents:di})},onPusherSubscribed:()=>{e(ba(n,!0)),e(oa(n,null,null,!0)),e(Ze(!0))},onReloadTransactions:()=>{e(ka(n,h,L))},onFetchChargeCardTransactionList:(l,C)=>{e(oa(n,l,C))},onUpdateScrollYOffset:l=>{},onGetOtp:l=>{b!=null&&e(at(l,"ChargeCardHolder",n))},onResendOtp:l=>{b!=null&&e(et(l,"ChargeCardHolder",n))},onVerifyOtp:(l,C)=>{b!=null&&e(Qa(l,C,"ChargeCardHolder",n))},onVerifyOtpSuccess:l=>{l!=null&&te.saveZeniOtpTokenForCardHolder(l,n)},onColorCodeChange:l=>{e(oo(n,l))},onLockChargeCard:(l,C)=>{e(nr(l,n,C))},onUnlockChargeCard:l=>{e(tr(l,n))},onCloseChargeCard:l=>{e(ar(n,l))},onFetchChargeCardsRecurringExpenses:()=>{e(er([n]))},updateChargeCardName:(l,C)=>{e(Qn(l,n,C))},updateChargeCardTransactionAttachments:(l,C)=>{C!=null&&e(so({transactionId:l,data:C}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(l,C,B,k)=>{e(ro({chargeCardId:C,transactionId:l,fetchState:B,error:k}))},updateChargeCardTransactionReceiptsShowTick:(l,C,B)=>{e(no({chargeCardId:C,transactionId:l,shouldShowTick:B}))},onChargeCardRevokeInviteClick:()=>{e(Xn(n))},updateChargeCardTransactionIsViewReceiptClicked:(l,C,B)=>{e(to({chargeCardId:C,transactionId:l,isViewReceiptClicked:B}))},onChargeCardTransactionRowClick:(l,C)=>{const B=ke(g.state?.pathnameStackToGoBack,g.pathname);s(`../../transaction/${l}/${C}`,{state:{pathnameStackToGoBack:B}})},onBackClick:()=>{const l=we(g.state?.pathnameStackToGoBack),C=ta(S);s(C,{state:{pathnameStackToGoBack:l.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(ao())},onUpdateDebitCardPinAttempt:l=>{e(qn(n,l)),l==="success"&&e(ze({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(l,C)=>{l?e(ze({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):C!=null&&e(ze({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:C.message}]}))},updateSpendLimit(l,C,B,k){e(Zn(l,C,B.code,k))},shouldOpenCreditCardPaymentDrawer(l){l&&F!=null&&ae.trackCardsPayEarlyClick(u,m,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:t.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:w?.accType==="depositAccount",creditCardPaymentSourceAccountName:w?.label,creditCardPaymentSourceAccountType:w?.accType,creditCardPaymentSourceLastFourDigits:w?.accountLast4,creditCardPaymentSourceBalance:w?.accountBalance?.available?.amount??0},p,v),A(l)}}}))(st(lc));function ui(){const e=de(),a=me(),n=he(),{cardId:t}=Me(),[s,g]=r.useState(!1),[b,h]=r.useState(!1),{useDynamicConfig:A}=le(),u=te.getSignedInUser(),m=d((Y=>fe(Y))),F=d((Y=>Za(Y).firstViewAfterActivation)),w=d((Y=>Y.classListState.fetchState)),{configValue:p}=A(Xe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:v}=A(Xe.zeniCardsConfig),L=v.enable_card_controls_for_company_ids,S=v.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(L)&&L.includes(m.companyId),[l,C]=r.useState(!1),[B,k]=r.useState(!1),{useFeatureGate:_}=le(),{isFeatureEnabled:D}=_(W.isChargeCardFeatureEnabled),{isFeatureEnabled:$}=_(W.isDebitCardFeatureEnabled),E=Be($,m),y=Re({isDebitCardFeatureEnabled:$,isBankingOnlyTenant:E}),{isFeatureEnabled:R}=_(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:i}=_(W.isCardsCommentingEnabled),f=xe(m),j=Fe(m),G=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:D,isBookKeepingTenant:f,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:G}),x=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,V=!m.userRole.includes("charge_card_user")&&U&&z;if(t==null)throw Error("Empty card id is not valid...");const T=d((Y=>wa(Y,m.companyId))),{creditAccount:P,creditAccountRepayment:K}=d((Y=>ua(Y))),J=te.getZeniOtpTokenForCardHolder(t),I=d((Y=>Tt(Y,t,V,U))),{isAiCfoAccessEnabled:M,onAskAiCfoClick:N}=xa({mobileExploreReferrer:"Card Detail"});Lt({isDataReady:I.fetchState==="Completed"});const X=d((Y=>ma(Y))),c=I.chargeCard,O=Le(),Z=ve(O?.loggedInUserRoleMap),se=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_virtual_debit_card",Q=c?.type.code==="business_physical_debit_card"||c?.type.code==="business_physical_credit_card",Ve=c?.type.code==="business_virtual_debit_card"||c?.type.code==="business_virtual_credit_card",Ae=c?.type.code==="business_virtual_debit_card",ge=Ba(U,z,Z,P,K),re=Dr(se,I),be=$t(Z,X),ue=Qe(U,y,x,z),oe=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Se=d((Y=>da(Y,m.companyId))),ee=la(Se.controllers),De=d((Y=>c?.cardCreatedByUser?.userId!=null?Ga(Y.userRoleState,c?.cardCreatedByUser?.userId):void 0)),Te=d((Y=>De?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:De?.accountingClassIDs[0],reportId:"class_list"}):void 0)),Ce=d((Y=>c?.cardHolderUser?.userId!=null?Ga(Y.userRoleState,c?.cardHolderUser?.userId):void 0)),q=d((Y=>Ce?.accountingClassIDs[0]!=null?Ka(Y.classState,{classId:Ce?.accountingClassIDs[0],reportId:"class_list"}):void 0)),fa=m?.userRole,na=d((Y=>Ca(Y,!1,y,D).revokeCardInvite)),Oa=ya(na.saveStatus.fetchState);if(r.useEffect((()=>{if(Oa==="In-Progress"&&na.saveStatus.fetchState==="Completed"){const Y=ta(m.tenantEmailDomain);e(Y)}}),[Oa,na.saveStatus.fetchState,e,m.tenantEmailDomain]),r.useEffect((()=>{F&&s===!1&&Ve&&(g(!0),setTimeout((()=>{a(za()),Ae&&a(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[F,s,Ve,Ae]),r.useEffect((()=>{l||I.fetchState==="Completed"||I.fetchState==="In-Progress"||t==null||(C(!0),a(ka(t,V,U,!1)))}),[l,I,t,a]),r.useEffect((()=>{!B&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&se&&oe&&Z&&(k(!0),a(Wn({depositAccountId:I.chargeCard?.connectedAccountId})))}),[B,I,a,oe,Z]),r.useEffect((()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&Z&&a(_a()),w!=="Completed"&&w!=="In-Progress"&&a(Nn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&a(Xs({chargeCardId:t})),T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&a(Pa(m.companyId,!0))}),[X.fetchState,a,Z,w,I.transactionStatistics.fetchState,T.fetchState]),r.useEffect((()=>{if(!(I.fetchState!=="Completed"||U&&P.fetchState!=="Completed"||c==null||I.transactionStatistics.fetchState!=="Completed"||se&&Z&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Y=c.type.code.includes("physical"),ye=Y?c.cardActivationAttemptHistory[0]?.timestamp:c.createTime;ae.trackCardsCardDetailView(ee,ue,{cardId:t,cardName:c.cardName,cardType:c.type.code.includes("credit")?"credit":"debit",cardCategory:Y?"physical":"virtual",cardLimit:Sa(c.limit.amount),cardLastFourDigits:c.accountLast4,cardStatus:c.status.code,cardAssignedDate:c.createTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:c.providerCardCreateTime?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:ye?.format(bt.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:c.creditLimitFrequency.name,cardSpentAmount:Sa(c.balance.amount),cardAvailableLimit:Sa(c.available.amount),cardUtilizationPercent:c.limit.amount>0?Math.round((c.limit.amount-c.available.amount)/c.limit.amount*100):0,cardUtilizationAmount:Sa(c.limit.amount-c.available.amount),totalNumberOfDeclinedTransactions:I.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:I.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:I.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:I.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:I.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:I.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:I.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:kt(c.cardCreatedByUser,!1),cardIssuedByEmail:c.cardCreatedByUser?.email,cardIssuedByUserId:c.cardCreatedByUser?.userId,cardIssuedByRole:De?.userRoles,cardIssuedByDepartment:Te?.className},{cardholderName:kt(c.cardHolderUser,!1),cardholderEmail:c.cardHolderUser?.email,cardholderRole:Ce?.userRoles,cardholderUserId:c.cardHolderUser?.userId,cardholderDepartment:q?.className},ge,re)}}),[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,P.fetchState,Z]),u==null)throw Error("Can't access card detail page without signing in...");const dt=aa(m),Ea=Z?[...At,...Vr]:At,ra={events:ha(dt,Ea),eventCallback:(Y,ye,ce)=>{ce.onEventReceived(Y,ye)},onSubscribed:Y=>{Y.onPusherSubscribed()}},Aa=()=>{if(t!=null&&c!=null){const{ownerName:Y,cardName:ye,utilisation:ce,limit:He,frequency:Ye,cardColor:Ge}=St(c),Ke=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageViewed(t,Y,ye,ce,He,Ye,Ge,Ke)}};r.useEffect((()=>{if(I.fetchState==="Completed"){const Y=I.chargeCard;if(Y?.status.code==="inactive"||se&&Y?.isPinSet===!1||Q&&F){const ye=_e(m.tenantEmailDomain,t,u,c,F);e(ye)}}}),[I.fetchState]);const lt=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:He,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsDetailPageClicked(t,ce,He,Ye,Ge,Ke,Y,sa,ye)}},ut=(Y,ye)=>{if(t!=null&&c!=null){const{ownerName:ce,cardName:He,utilisation:Ye,limit:Ge,frequency:Ke}=St(c),sa=c.cardHolderUserId===u.userId;ae.trackCardsVerifyPopUpClick(t,ce,He,Ye,Ge,Ke,Y,sa,ye)}},pe=P.balance.amount+P.hold.amount,Ua=m.companyChargeCardInfo?.info?.primaryFundingAccount,Da=T.allFundingAccounts.find((Y=>Y.id===Ua?.accountId)),ja=I.chargeCard!=null,$a=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||na.saveStatus.fetchState==="In-Progress"||!$a&&se&&Z&&I.depositAccountLimitFetchState.fetchState!=="Completed"?o.jsx(dc,{}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?o.jsx(Ut,{analytics:ae,onLoad:Aa}):null,b===!0?o.jsx(zt,{closeDrawerHandler:()=>h(!1),isPaymentDrawerOpen:b,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!se||!Z||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||P.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!Z||X.fetchState==="Completed",paymentInitiatedDate:K.initiatedRepaymentDate}):null,o.jsx(li,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Rt(),signedInUser:u,location:n,navigate:e,setIsPaymentOpen:h,cardIssuedByRoles:De?.userRoles,cardIssuedByDepartmentName:Te?.className,cardHolderRoles:Ce?.userRoles,cardHolderDepartmentName:q?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:y,isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:z,isCardControlsEnabled:S,isEarlyPayEnabled:R,controllerEmails:ee,chargeCardCashbackDetailState:X,productInformation:ue,creditAccountInformation:ge,debitAccountInformation:re,cashbackInformation:be,classListFetchState:w,primaryFundingAccountDetails:Da,currentTenant:m,cardProviderId:I.chargeCard?.cardProviderID,cardId:t,creditAccount:P,creditAccountRepayment:K,includeCreditAccountInfo:V,signedInUserToken:J,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:p.documentAiReceiptMaxSizeLimitBytes!=null?p.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:M,onAskAiCfoClick:N,isCardsCommentingEnabled:i})]}):o.jsx(ot,{})}const St=e=>{const a=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,n=e.cardName,t=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,g=e.creditLimitFrequency.name;return{ownerName:a,cardName:n,utilisation:t,cardColor:e.cardColorCode??"",frequency:g,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:mi,subheadline:Ci,pageTitle:pi}}}}=ea.getLocalizedStrings(),Hr=[pa,ct,Mr,La,Ra,it,Kt,Jc,Ht,Gt,Vt],hi=new Set(Hr),Dt=jt(((e,a,n,t)=>{e(ia(a,n,t,!0))}),400),fi=Ne.div`
|
|
19
19
|
display: flex;
|
|
20
20
|
width: 100%;
|
|
21
21
|
flex: 1 1 auto;
|
|
22
22
|
flex-direction: column;
|
|
23
23
|
align-items: center;
|
|
24
24
|
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,gi=Pe((function(e,a){const n=Ca(e,a.includeCreditAccountDebitSummaryAndCashbackInfo,a.isDebitCardFeatureEnabled&&a.isDebitCardSetupEnabled,a.isChargeCardFeatureEnabled&&a.isChargeCardSetupEnabled);return{chargeCardListView:n,rowActionView:mo(e),bulkActionView:Co(e),companyLegalName:a.currentTenant.companyName,admins:a.admins,searchText:n.searchText,uiState:n.uiState,signedInUser:a.signedInUser,receiptsEmail:Zn(e.tenantState,a.currentTenant.tenantId)}}),(function(e,a){const{navigateAndClearBulkSelection:n,currentTenant:t,location:s,signedInUser:g,chargeCardListState:b,includeCreditAccountDebitSummaryAndCashbackInfo:h,isChargeCardFeatureEnabled:A,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:p,isChargeCardTOSAccepted:v,controllerEmails:L,depositAccountListWithDebitCardIssued:S,primaryFundingAccountDetails:l,chargeCardSetUpViewFetchState:C,productInformation:B,cashbackInformation:k,creditAccountInformation:_,debitAccountInformation:D,updatePayNowInfoTooltip:$,isUserHasCardsAdminLevelAccess:E}=a,{tenantEmailDomain:y}=t,{cards:R}=b;return{onChargeCardRowClick:(i,f)=>{const j=Pr(R,i);let G;j!=null&&((x=>{const z=x.limit.amount-x.available.amount,V=`${x.cardHolderUser?.firstName.toLowerCase()} ${x.cardHolderUser?.lastName.toLowerCase()}`,T=x.cardName,P=x.department?.className??"",K=x.limit.amount,Z=x.creditLimitFrequency.name;ae.trackCardsListRowClicked(V,T,P,z,K,Z,g.userId===x.cardHolderUserId)})(j),ca(F,w,S)&&ae.trackCardsCardListRowClick(L,B,"Card Row Item","row_clicked",f+1,{cardOwner:kt(j.cardHolderUser,!1),cardName:j.cardName,cardType:j.type.code.includes("credit")?"credit":"debit",cardStatus:j.status.code,cardUtilizationAmount:Sa(j.limit.amount-j.available.amount),cardUtilizationPercent:j.limit.amount>0?Math.round((j.limit.amount-j.available.amount)/j.limit.amount*100):0,cardLimit:Sa(j.limit.amount)},k,_,D)),G=j?.status.code==="request_on_hold"&&g.userId===j.cardHolderUserId?wr(y):_e(y,i,g,j);const U=ke(s.state?.pathnameStackToGoBack,s.pathname);n(G,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:i=>{e(er(i))},onFetchDepositAccountLimit:i=>{e(Wn({depositAccountId:i}))},onChargeCardResendInviteClick:i=>{e(Io(i))},onChargeCardRevokeInviteClick:i=>{e(Qn(i))},onLockChargeCardList:(i,f)=>{e(yo(i,f))},onUnlockChargeCardList:i=>{e(So(i))},onCloseChargeCardList:(i,f)=>{e(bo(i,f))},onRevokeChargeCardList:i=>{e(go(i))},updateChargeCardListSpendLimit(i,f,j){e(fo(i,f,j.code))},onLockChargeCard:(i,f)=>{e(nr(E,i,f))},onUnlockChargeCard:i=>{e(tr(E,i))},onCloseChargeCard:(i,f)=>{e(ar(i,f))},onUpdateSpendLimit(i,f,j,G){e(qn(i,f,j.code,G))},updateChargeCardName:(i,f)=>{e(Xn(E,i,f))},onClickSetupIcon:()=>{ae.trackCardsListPageClicked("settings"),ca(F,w,S)&&k!=null&&ae.trackCardsSettingsClick(L,B,k,_,D);const i=xc(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{ae.trackCardsListPageClicked("new card"),ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"New Button","card_creation_initiated","Card List",_,D);const i=bi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(i,f)=>{ca(F,w,S)&&k!=null&&ae.trackCardsCardListSortClick(L,B,k,"Sort Icon","sort",i,f==="ascending"?"ASC":"DESC","Cards List",_,D),e(It({uiState:{sortKey:i,sortOrder:f}}))},onSearchTextChanged:i=>{e(ho(i))},onReloadCards:()=>{e(ia(h,F&&w,A&&m,!0))},onLetsGoClick:()=>{n("./onboard")},onBackClick:()=>{n("../../")},onTotalCashbackClick:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsCashbackOverviewClick(L,B,k,"Cashback Overview","cashback_details_viewed",_,D),n("./cashback")},onClickStatementsIcon:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsStatementsClick(L,B,k,_,D),n("./statements")},onCreateNowClick:i=>{ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"Promo Banner","card_creation_initiated","Card List",_,D),n(`./new?cardType=${i}`)},onPromoCardClick:i=>{n(i==="debit"&&F&&!p||i==="credit"&&u&&!v?`../promo?cardPromoType=${i}`:"./setup")},navigateToCreditCardPaymentPage:(i,f)=>{C==="Completed"&&t.company!=null&&k!=null&&ae.trackCardsPayEarlyClick(L,B,k,"Card List",i,f,{isZeniCheckingEnabled:t.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:l?.accType==="depositAccount",creditCardPaymentSourceAccountName:l?.label,creditCardPaymentSourceAccountType:l?.accType,creditCardPaymentSourceLastFourDigits:l?.accountLast4,creditCardPaymentSourceBalance:l?.accountBalance?.available?.amount??0},_,D);const j=Si(y);n(j)},navigateToCreditCardPaymentHistoryPage:()=>{const i=yi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:$,onSetRowActionCardId:i=>{e(po(i))},onSetBulkActionCardIds:i=>{e(rr(i))},onEventReceived:i=>{hi.has(i)&&Dt(e,h,F&&w,A&&m)},onPusherSubscribed:()=>{Dt(e,h,F&&w,A&&m)}}}))(st(Cc));function kn({isPaymentDrawerOpen:e}){const a=de(),n=me(),t=he(),s=r.useCallback(((H,Ue)=>{n(rr([])),a(H,Ue)}),[n,a]),[g,b]=r.useState(!1),[h,A]=r.useState(te.getPayNowInfoTooltip()??!1),u=H=>{te.savePayNowInfoTooltip(H),A(H)},[m,F]=r.useState(!1),w=te.getSignedInUser(),p=d((H=>fe(H))),[v,L]=r.useState(!1),[S,l]=r.useState(!1),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Cards"}),k=p.userRole.includes("charge_card_user"),_=!k,D=!!p.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:$,useDynamicConfig:E}=le(),{isFeatureEnabled:y}=$(W.isCashbackFeatureEnabled),{isFeatureEnabled:R}=$(W.isChargeCardFeatureEnabled),{isFeatureEnabled:i}=$(W.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=$(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=$(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=$(W.isCardsCommentingEnabled),{isFeatureEnabled:U}=$(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:x}=$(W.isCardPolicyEnabled),{isFeatureEnabled:z}=$(W.isAiCardCreationEnabled),V=Be(i,p),T=Re({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:V}),P=Fe(p),K=xe(p),Z=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Oe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:Z}),M=_r({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K}),{configValue:N}=E(Qe.zeniCardsConfig),Q=Le(),c=ve(Q?.loggedInUserRoleMap),O=d((H=>da(H,p.companyId))),q=la(O.controllers),se=N.charge_card_cashback_rate_per_transaction!=null?N.charge_card_cashback_rate_per_transaction:.0175,X=N.credit_card_pay_now_threshold_by_company_id?.[p.companyId]??N.default_credit_card_pay_now_threshold??Fc,Ve=N.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(N.enable_card_controls_for_company_ids)&&N.enable_card_controls_for_company_ids.includes(p.companyId),Ae=!!p.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!p.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!p.companyChargeCardInfo?.info?.isChargeCardEnabled,be=!!p.company?.companyChargeCardInfo?.isChargeCardEnabled,ue=!!p.company?.companyDebitCardInfo?.isDebitCardEnabled,oe=d((H=>Gn(H))),Se=ya(oe.updateStatus),ee=d((H=>Ca(H,_,T&&D,I&&re))),De=d((H=>co(H))),Te=d((H=>io(H))),Ce=d((H=>lo(H))),J=d((H=>uo(H))),fa=d((H=>Ce==null?[]:Mn(H.aiCfoState,Ce).filter((Ue=>Ue.kind==="creating_cards"))),_t),na=ya(Te.fetchState);r.useEffect((()=>{na==="In-Progress"&&Te.fetchState==="Completed"&&Ce!=null&&fa.forEach((H=>{n(yt({chatSessionId:Ce,id:H.id,entityIds:J,kind:"created_cards"}))}))}),[n,Te.fetchState,Ce,J,fa,na]);const Oa=ee.cards.filter((H=>H.type.code.includes("debit"))).map((H=>H.connectedAccountId)),dt=[...new Set(Oa)],Ea=d((H=>ma(H))),ra=d((H=>tt(H,dt))),Aa=d((H=>wa(H,p.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find((H=>H.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>c===!0&&x===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(p.tenantEmailDomain??"")!==!0),[c,x,pe,p.tenantEmailDomain]),[ja,$a]=r.useState(Da);r.useEffect((()=>{$a(Da())}),[Da]);const Y=()=>{te.saveCardPolicyPopupSeen(p.tenantEmailDomain??"",!0),$a(!1)},ye=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uc({isDataReady:pe==="Completed",pageContext:ye?"cards_creation":"cards"});const{creditAccountRepayment:ce}=d((H=>ua(H))),He=d((H=>qa(H).firstViewAfterActivation)),{areTenantIdsInSync:Ye}=Ir(),Ge=$t(c,Ea),Ke=Ba(I,re,c,Ua,ce),sa=Mt(T,D,c,ra,ee.debitCardSummary),mt=Xe(I,T,D,re),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<X*ee.creditAccount.limit.amount/100)&&u(!0)}),[pe,X,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ce.initiatedRepayments.amount===0&&ce.fetchState==="Completed"||Se==="In-Progress"&&oe.updateStatus==="Completed")u(!1),b(!0);else if(ce.initiatedRepayments.amount>0&&ce.fetchState==="Completed"){b(!1),document.body.style.overflow="auto";const H=ta(p.tenantEmailDomain);s(H)}}),[e,ce.initiatedRepayments.amount,ce.fetchState,Se,oe.updateStatus,s,p.tenantEmailDomain]),r.useEffect((()=>{!v&&(re||D)&&(be||ue)&&Ye&&(L(!0),n(ia(_,T&&D,I&&re,!1)))}),[v,_,n,Ye,be,ue]),r.useEffect((()=>{He&&m===!1&&(F(!0),setTimeout((()=>{n(za())}),5e3))}),[He,m]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&k&&ee.cards.length===1&&(ee.cards[0].status.code==="inactive"&&ee.cards[0].type.code==="business_physical_credit_card"?s(`./${ee.cards[0].id}/activate`):ee.cards[0].status.code!=="request_on_hold"&&(t.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,k,t.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&k){const H=ee.cards.length,Ue=ee.cards.filter((We=>We.cardHolderUserId===w?.userId)).filter((We=>We.status.code==="request_on_hold"));Ue.length>0&&H===Ue.length&&s("./onboard")}}),[pe,ee.cards,k,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ce.fetchState!=="Completed"||T&&D&&c&&ra.fetchState!=="Completed"||ae.trackCardsCardListView(q,mt,Ge,Ke,sa)}),[pe,Ua,ce.fetchState,ra.fetchState,c]),w==null)throw Error("Can't access charge card list page without signing in...");const Yr=d((H=>sr(H.userState,H.userRoleState,H.userListViewState,"cardAdmin"))),Zt=xt(Q?.loggedInUserRoleMap),qt=H=>{l(H)},Wr=ee.creditAccount.limit,Zr=()=>{b(!1),s("..")},qr=p.companyChargeCardInfo?.info!=null&&Ia({cardInfo:p.companyChargeCardInfo.info,isProductVisible:I&&be,isTOSAccepted:Ae,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Zt}),Jr=p.companyDebitCardInfo?.info!=null&&Ia({cardInfo:p.companyDebitCardInfo.info,isProductVisible:T&&ue,isTOSAccepted:ge,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Zt}),Qr=qr||Jr,Jt=(function(H){const{isEmptyCardsState:Ue,isChargeCardAdmin:We,isFileUploadEnabled:an}=H,tn=de(),Ma=he(),{tenantEmailDomain:Na}=Me(),{isAiCfoOpen:ns,setIsAiCfoOpen:nn}=fr(),rs=gr(),ss=br(),rn=d((Ie=>$n(Ie))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:on}=Br("cards_creation"),cn=r.useMemo((()=>xr(sn,on,3)),[sn,on]),[Va,pt]=r.useState(""),dn=ss&&rs&&Na!=null&&!ns,ga=r.useCallback((Ie=>{if(Na==null)return;const os=ke(Ma.state?.pathnameStackToGoBack,Ma.pathname);tn(`/${Na}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:os,referrer:"cards_hero",aiCfoInitialQuestion:Ie,aiCfoShouldSubmit:Ie!=null&&Ie.trim().length>0}})}),[Ma.pathname,Ma.state,tn,Na]),ln=r.useCallback((Ie=>{Ie.trim().length!==0&&(pt(""),ga(Ie))}),[ga]),un=r.useCallback((()=>{const Ie=Va.trim();Ie.length!==0&&(pt(""),ga(Ie))}),[Va,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((Ie=>{pt(Ie)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&Ue&&We)return{aiAgentName:pi,headline:mi,subheadline:Ci,promptChips:cn,composer:{currentInput:Va,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Va,dn,We,Ue,an,rn,Cn,hn,pn,ln,mn,un,cn])})({isEmptyCardsState:ye,isChargeCardAdmin:c,isFileUploadEnabled:U}),Qt=z&&Jt!=null?o.jsx(Sr,{...Jt}):null,{isCardsShuttingDown:Xt,shutdownContent:en}=kr(p.tenantId,p.company?.managementInfo?.receiverEmails),Xr=Xt===!0&&en!=null?o.jsx(mc,{shutdownContent:en}):null,es=C&&Qt==null,as=aa(p),ts={events:ha(as,Hr),eventCallback:(H,Ue,We)=>{We.onEventReceived(H)},onSubscribed:H=>{H.onPusherSubscribed()}};return re||D?o.jsxs(o.Fragment,{children:[pe==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{ae.trackPageLoaded(Er.Event.cardsListPage),(I&&!re||T&&!D)&&ae.trackCardsPromoView(q,{isCreditCardOffered:I,isDebitCardOffered:T,isDebitCardEnabled:D,isCreditCardEnabled:re},"Banner",T&&!D?"Debit Card":I&&!re?"Credit Card":"","Card List")}}),o.jsx(nt,{showConfetti:He})]}):null,g===!0?o.jsx(zt,{closeDrawerHandler:Zr,isPaymentDrawerOpen:g,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isDebitCardInfoFetchStateCompleted:!(T&&D&&c)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ce.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!c||Ea.fetchState==="Completed",paymentInitiatedDate:ce.initiatedRepaymentDate}):null,o.jsxs(fi,{children:[o.jsx(Ee,{isAppContentDrawerOpen:S,handleDrawerToggle:qt}),o.jsx(gi,{...ts,isCashbackFeatureEnabled:y,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:T,isCreditCardProductVisibleForExpressInterest:M,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:h,creditCardPayNowThreshold:X,signedInUser:w,chargeCardListState:ee,location:t,admins:Yr.users,navigateAndClearBulkSelection:s,currentTenant:p,isCardControlsEnabled:Ve,companyChargeCardInfoCreditAccountLimit:p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:p.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:c,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{qt(!0)},creditLimit:Wr,isChargeCardSetupEnabled:re,isChargeCardEnabledOnCompany:be,isDebitCardSetupEnabled:D,isDebitCardEnabledOnCompany:ue,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:se,controllerEmails:q,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Ae,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isAiCfoAccessEnabled:es,onAskAiCfoClick:B,isCardsCommentingEnabled:G,cardsAiCfoHero:Qt,cardsShutdownBanner:Xr,isCardsShuttingDown:Xt,onClickPolicyIcon:c&&x?()=>a(Ii(p.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Y,pendingCreationCount:De})]})]}):(Ae||ge)&&c===!0?o.jsx(Je,{to:"../setup"}):Qr?o.jsx(Je,{to:"../promo"}):o.jsx(Ta,{fetchState:pe})}const bi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,yi=e=>`/${e}/cards/payment-history`,Ii=e=>`/${e}/cards/policy`,Gr=[$r,Mr],ki=new Set(Gr),Ei=Pe((function(e){const a=te.getSignedInUser(),n=fe(e),t=e.tenantState.currentTenantId,s=or(e),g={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:t??""},b=n?.companyName??"",h=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:ko(n),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:g,companyName:b,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:h}}),(function(e,a){const{location:n,navigate:t}=a;return{onBackClick:()=>{const s=we(n.state?.pathnameStackToGoBack),g=s.poppedPathname??"..";t(g,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,g)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:g}}})},onFiltersChange:s=>{e(Ao({filters:s}))},onReloadPayments:()=>{e(Ha(!0))},onEventReceived:s=>{ki.has(s)&&e(Ha(!0))},onPusherSubscribed:()=>{e(Ha(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Eo({uiState:{downloadState:s}}))}}}))(st(pc));function Ai(){const e=de(),a=he(),n=me(),{areTenantIdsInSync:t}=Ir(),{useFeatureGate:s}=le();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const g=d((c=>fe(c))),b=d((c=>or(c))),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(null),L=!g.userRole.includes("charge_card_user"),S=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:l}=s(W.isChargeCardFeatureEnabled),{isFeatureEnabled:C}=s(W.isDebitCardFeatureEnabled),B=Be(C,g),k=Re({isDebitCardFeatureEnabled:C,isBankingOnlyTenant:B}),_=Fe(g),D=xe(g),$=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Oe({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:l,isBookKeepingTenant:D,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:$}),y=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,R=Le(),i=ve(R?.loggedInUserRoleMap),f=d((c=>Ca(c,L,k&&S,E&&y))),j=r.useMemo((()=>{const c=f.cards.filter((O=>O.type.code.includes("debit")));return[...new Set(c.map((O=>O.connectedAccountId)))]}),[f.cards]),G=d((c=>ma(c))),U=d((c=>tt(c,j))),{creditAccountRepayment:x}=d((c=>ua(c))),z=r.useMemo((()=>$t(i,G)),[i,G]),V=r.useMemo((()=>Ba(E,y,i,f.creditAccount,x)),[E,y,i,f.creditAccount,x]),T=r.useMemo((()=>Mt(k,S,i,U,f.debitCardSummary)),[k,S,i,U,f.debitCardSummary]),P=r.useMemo((()=>Xe(E,k,S,y)),[E,k,S,y]),K=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Z=r.useMemo((()=>p!=null?b.repaymentHistory.find((c=>c.cardRepaymentId===p)):void 0),[p,b.repaymentHistory]),I=r.useCallback((c=>{v(c),n(ia(L,k&&S,E&&y,!1)),w(!0)}),[n,L,k,S,E,y]),M=r.useCallback((()=>{w(!1),v(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{h||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(A(!0),n(Ha()))}),[h,n,b.fetchState]),r.useEffect((()=>{!u&&(y||S)&&t&&(m(!0),n(ia(L,!1,E&&y,!1)))}),[u,y,S,t,n,L,E]);const N=aa(g),Q={events:ha(N,Gr),eventCallback:(c,O,q)=>{q.onEventReceived(c)},onSubscribed:c=>{c.onPusherSubscribed()}};return o.jsxs(o.Fragment,{children:[F?o.jsx(zt,{closeDrawerHandler:M,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:K,productInformation:P,creditAccountInformation:V,debitAccountInformation:T,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(k&&S&&i)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!i||G.fetchState==="Completed",paymentInitiatedDate:x.initiatedRepaymentDate,retryRepayment:Z}):null,o.jsx(Ei,{...Q,location:a,navigate:e,accountInfoByAccountId:b.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=Ne.div`
|
|
25
|
+
`,gi=Pe((function(e,a){const n=Ca(e,a.includeCreditAccountDebitSummaryAndCashbackInfo,a.isDebitCardFeatureEnabled&&a.isDebitCardSetupEnabled,a.isChargeCardFeatureEnabled&&a.isChargeCardSetupEnabled);return{chargeCardListView:n,rowActionView:mo(e),bulkActionView:Co(e),companyLegalName:a.currentTenant.companyName,admins:a.admins,searchText:n.searchText,uiState:n.uiState,signedInUser:a.signedInUser,receiptsEmail:Jn(e.tenantState,a.currentTenant.tenantId)}}),(function(e,a){const{navigateAndClearBulkSelection:n,currentTenant:t,location:s,signedInUser:g,chargeCardListState:b,includeCreditAccountDebitSummaryAndCashbackInfo:h,isChargeCardFeatureEnabled:A,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:m,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:w,isDebitCardTOSAccepted:p,isChargeCardTOSAccepted:v,controllerEmails:L,depositAccountListWithDebitCardIssued:S,primaryFundingAccountDetails:l,chargeCardSetUpViewFetchState:C,productInformation:B,cashbackInformation:k,creditAccountInformation:_,debitAccountInformation:D,updatePayNowInfoTooltip:$,isUserHasCardsAdminLevelAccess:E}=a,{tenantEmailDomain:y}=t,{cards:R}=b;return{onChargeCardRowClick:(i,f)=>{const j=Pr(R,i);let G;j!=null&&((x=>{const z=x.limit.amount-x.available.amount,V=`${x.cardHolderUser?.firstName.toLowerCase()} ${x.cardHolderUser?.lastName.toLowerCase()}`,T=x.cardName,P=x.department?.className??"",K=x.limit.amount,J=x.creditLimitFrequency.name;ae.trackCardsListRowClicked(V,T,P,z,K,J,g.userId===x.cardHolderUserId)})(j),ca(F,w,S)&&ae.trackCardsCardListRowClick(L,B,"Card Row Item","row_clicked",f+1,{cardOwner:kt(j.cardHolderUser,!1),cardName:j.cardName,cardType:j.type.code.includes("credit")?"credit":"debit",cardStatus:j.status.code,cardUtilizationAmount:Sa(j.limit.amount-j.available.amount),cardUtilizationPercent:j.limit.amount>0?Math.round((j.limit.amount-j.available.amount)/j.limit.amount*100):0,cardLimit:Sa(j.limit.amount)},k,_,D)),G=j?.status.code==="request_on_hold"&&g.userId===j.cardHolderUserId?wr(y):_e(y,i,g,j);const U=ke(s.state?.pathnameStackToGoBack,s.pathname);n(G,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:i=>{e(er(i))},onFetchDepositAccountLimit:i=>{e(Wn({depositAccountId:i}))},onChargeCardResendInviteClick:i=>{e(Io(i))},onChargeCardRevokeInviteClick:i=>{e(Xn(i))},onLockChargeCardList:(i,f)=>{e(yo(i,f))},onUnlockChargeCardList:i=>{e(So(i))},onCloseChargeCardList:(i,f)=>{e(bo(i,f))},onRevokeChargeCardList:i=>{e(go(i))},updateChargeCardListSpendLimit(i,f,j){e(fo(i,f,j.code))},onLockChargeCard:(i,f)=>{e(nr(E,i,f))},onUnlockChargeCard:i=>{e(tr(E,i))},onCloseChargeCard:(i,f)=>{e(ar(i,f))},onUpdateSpendLimit(i,f,j,G){e(Zn(i,f,j.code,G))},updateChargeCardName:(i,f)=>{e(Qn(E,i,f))},onClickSetupIcon:()=>{ae.trackCardsListPageClicked("settings"),ca(F,w,S)&&k!=null&&ae.trackCardsSettingsClick(L,B,k,_,D);const i=xc(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{ae.trackCardsListPageClicked("new card"),ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"New Button","card_creation_initiated","Card List",_,D);const i=bi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(i,f)=>{ca(F,w,S)&&k!=null&&ae.trackCardsCardListSortClick(L,B,k,"Sort Icon","sort",i,f==="ascending"?"ASC":"DESC","Cards List",_,D),e(It({uiState:{sortKey:i,sortOrder:f}}))},onSearchTextChanged:i=>{e(ho(i))},onReloadCards:()=>{e(ia(h,F&&w,A&&m,!0))},onLetsGoClick:()=>{n("./onboard")},onBackClick:()=>{n("../../")},onTotalCashbackClick:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsCashbackOverviewClick(L,B,k,"Cashback Overview","cashback_details_viewed",_,D),n("./cashback")},onClickStatementsIcon:()=>{ca(F,w,S)&&k!=null&&ae.trackCardsStatementsClick(L,B,k,_,D),n("./statements")},onCreateNowClick:i=>{ca(F,w,S)&&k!=null&&ae.trackCardsNewCardClick(L,B,k,"Promo Banner","card_creation_initiated","Card List",_,D),n(`./new?cardType=${i}`)},onPromoCardClick:i=>{n(i==="debit"&&F&&!p||i==="credit"&&u&&!v?`../promo?cardPromoType=${i}`:"./setup")},navigateToCreditCardPaymentPage:(i,f)=>{C==="Completed"&&t.company!=null&&k!=null&&ae.trackCardsPayEarlyClick(L,B,k,"Card List",i,f,{isZeniCheckingEnabled:t.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:l?.accType==="depositAccount",creditCardPaymentSourceAccountName:l?.label,creditCardPaymentSourceAccountType:l?.accType,creditCardPaymentSourceLastFourDigits:l?.accountLast4,creditCardPaymentSourceBalance:l?.accountBalance?.available?.amount??0},_,D);const j=Si(y);n(j)},navigateToCreditCardPaymentHistoryPage:()=>{const i=yi(y),f=ke(s.state?.pathnameStackToGoBack,s.pathname);n(i,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:$,onSetRowActionCardId:i=>{e(po(i))},onSetBulkActionCardIds:i=>{e(rr(i))},onEventReceived:i=>{hi.has(i)&&Dt(e,h,F&&w,A&&m)},onPusherSubscribed:()=>{Dt(e,h,F&&w,A&&m)}}}))(st(Cc));function kn({isPaymentDrawerOpen:e}){const a=de(),n=me(),t=he(),s=r.useCallback(((H,Ue)=>{n(rr([])),a(H,Ue)}),[n,a]),[g,b]=r.useState(!1),[h,A]=r.useState(te.getPayNowInfoTooltip()??!1),u=H=>{te.savePayNowInfoTooltip(H),A(H)},[m,F]=r.useState(!1),w=te.getSignedInUser(),p=d((H=>fe(H))),[v,L]=r.useState(!1),[S,l]=r.useState(!1),{isAiCfoAccessEnabled:C,onAskAiCfoClick:B}=xa({mobileExploreReferrer:"Cards"}),k=p.userRole.includes("charge_card_user"),_=!k,D=!!p.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:$,useDynamicConfig:E}=le(),{isFeatureEnabled:y}=$(W.isCashbackFeatureEnabled),{isFeatureEnabled:R}=$(W.isChargeCardFeatureEnabled),{isFeatureEnabled:i}=$(W.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=$(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=$(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:G}=$(W.isCardsCommentingEnabled),{isFeatureEnabled:U}=$(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:x}=$(W.isCardPolicyEnabled),{isFeatureEnabled:z}=$(W.isAiCardCreationEnabled),V=Be(i,p),T=Re({isDebitCardFeatureEnabled:i,isBankingOnlyTenant:V}),P=Fe(p),K=xe(p),J=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Oe({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:J}),M=_r({isCardsOnlyTenant:P,isChargeCardFeatureEnabled:R,isBookKeepingTenant:K}),{configValue:N}=E(Xe.zeniCardsConfig),X=Le(),c=ve(X?.loggedInUserRoleMap),O=d((H=>da(H,p.companyId))),Z=la(O.controllers),se=N.charge_card_cashback_rate_per_transaction!=null?N.charge_card_cashback_rate_per_transaction:.0175,Q=N.credit_card_pay_now_threshold_by_company_id?.[p.companyId]??N.default_credit_card_pay_now_threshold??Fc,Ve=N.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(N.enable_card_controls_for_company_ids)&&N.enable_card_controls_for_company_ids.includes(p.companyId),Ae=!!p.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,ge=!!p.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!p.companyChargeCardInfo?.info?.isChargeCardEnabled,be=!!p.company?.companyChargeCardInfo?.isChargeCardEnabled,ue=!!p.company?.companyDebitCardInfo?.isDebitCardEnabled,oe=d((H=>Gn(H))),Se=ya(oe.updateStatus),ee=d((H=>Ca(H,_,T&&D,I&&re))),De=d((H=>co(H))),Te=d((H=>io(H))),Ce=d((H=>lo(H))),q=d((H=>uo(H))),fa=d((H=>Ce==null?[]:Mn(H.aiCfoState,Ce).filter((Ue=>Ue.kind==="creating_cards"))),_t),na=ya(Te.fetchState);r.useEffect((()=>{na==="In-Progress"&&Te.fetchState==="Completed"&&Ce!=null&&fa.forEach((H=>{n(yt({chatSessionId:Ce,id:H.id,entityIds:q,kind:"created_cards"}))}))}),[n,Te.fetchState,Ce,q,fa,na]);const Oa=ee.cards.filter((H=>H.type.code.includes("debit"))).map((H=>H.connectedAccountId)),dt=[...new Set(Oa)],Ea=d((H=>ma(H))),ra=d((H=>tt(H,dt))),Aa=d((H=>wa(H,p.companyId))),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find((H=>H.id===lt?.accountId)),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback((()=>c===!0&&x===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(p.tenantEmailDomain??"")!==!0),[c,x,pe,p.tenantEmailDomain]),[ja,$a]=r.useState(Da);r.useEffect((()=>{$a(Da())}),[Da]);const Y=()=>{te.saveCardPolicyPopupSeen(p.tenantEmailDomain??"",!0),$a(!1)},ye=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;uc({isDataReady:pe==="Completed",pageContext:ye?"cards_creation":"cards"});const{creditAccountRepayment:ce}=d((H=>ua(H))),He=d((H=>Za(H).firstViewAfterActivation)),{areTenantIdsInSync:Ye}=Ir(),Ge=$t(c,Ea),Ke=Ba(I,re,c,Ua,ce),sa=Mt(T,D,c,ra,ee.debitCardSummary),mt=Qe(I,T,D,re),Ct=ee.creditAccount.balance.amount+ee.creditAccount.hold.amount;if(r.useEffect((()=>{pe==="Completed"&&(te.getPayNowInfoTooltip()==null||Ct<Q*ee.creditAccount.limit.amount/100)&&u(!0)}),[pe,Q,Ct,ee.creditAccount.limit.amount]),r.useEffect((()=>{if(e!=null&&e===!0&&ce.initiatedRepayments.amount===0&&ce.fetchState==="Completed"||Se==="In-Progress"&&oe.updateStatus==="Completed")u(!1),b(!0);else if(ce.initiatedRepayments.amount>0&&ce.fetchState==="Completed"){b(!1),document.body.style.overflow="auto";const H=ta(p.tenantEmailDomain);s(H)}}),[e,ce.initiatedRepayments.amount,ce.fetchState,Se,oe.updateStatus,s,p.tenantEmailDomain]),r.useEffect((()=>{!v&&(re||D)&&(be||ue)&&Ye&&(L(!0),n(ia(_,T&&D,I&&re,!1)))}),[v,_,n,Ye,be,ue]),r.useEffect((()=>{He&&m===!1&&(F(!0),setTimeout((()=>{n(za())}),5e3))}),[He,m]),r.useEffect((()=>()=>{Dt.flush()}),[]),r.useEffect((()=>{pe==="Completed"&&k&&ee.cards.length===1&&(ee.cards[0].status.code==="inactive"&&ee.cards[0].type.code==="business_physical_credit_card"?s(`./${ee.cards[0].id}/activate`):ee.cards[0].status.code!=="request_on_hold"&&(t.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))}),[pe,k,t.state,s,ee.cards]),r.useEffect((()=>{if(pe==="Completed"&&k){const H=ee.cards.length,Ue=ee.cards.filter((We=>We.cardHolderUserId===w?.userId)).filter((We=>We.status.code==="request_on_hold"));Ue.length>0&&H===Ue.length&&s("./onboard")}}),[pe,ee.cards,k,s,w?.userId]),r.useEffect((()=>{pe!=="Completed"||I&&ce.fetchState!=="Completed"||T&&D&&c&&ra.fetchState!=="Completed"||ae.trackCardsCardListView(Z,mt,Ge,Ke,sa)}),[pe,Ua,ce.fetchState,ra.fetchState,c]),w==null)throw Error("Can't access charge card list page without signing in...");const Yr=d((H=>sr(H.userState,H.userRoleState,H.userListViewState,"cardAdmin"))),Jt=xt(X?.loggedInUserRoleMap),Zt=H=>{l(H)},Wr=ee.creditAccount.limit,Jr=()=>{b(!1),s("..")},Zr=p.companyChargeCardInfo?.info!=null&&Ia({cardInfo:p.companyChargeCardInfo.info,isProductVisible:I&&be,isTOSAccepted:Ae,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Jt}),qr=p.companyDebitCardInfo?.info!=null&&Ia({cardInfo:p.companyDebitCardInfo.info,isProductVisible:T&&ue,isTOSAccepted:ge,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:Jt}),Xr=Zr||qr,qt=(function(H){const{isEmptyCardsState:Ue,isChargeCardAdmin:We,isFileUploadEnabled:an}=H,tn=de(),Ma=he(),{tenantEmailDomain:Na}=Me(),{isAiCfoOpen:ns,setIsAiCfoOpen:nn}=fr(),rs=gr(),ss=br(),rn=d((Ie=>$n(Ie))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:sn,isResolved:on}=Br("cards_creation"),cn=r.useMemo((()=>xr(sn,on,3)),[sn,on]),[Va,pt]=r.useState(""),dn=ss&&rs&&Na!=null&&!ns,ga=r.useCallback((Ie=>{if(Na==null)return;const os=ke(Ma.state?.pathnameStackToGoBack,Ma.pathname);tn(`/${Na}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:os,referrer:"cards_hero",aiCfoInitialQuestion:Ie,aiCfoShouldSubmit:Ie!=null&&Ie.trim().length>0}})}),[Ma.pathname,Ma.state,tn,Na]),ln=r.useCallback((Ie=>{Ie.trim().length!==0&&(pt(""),ga(Ie))}),[ga]),un=r.useCallback((()=>{const Ie=Va.trim();Ie.length!==0&&(pt(""),ga(Ie))}),[Va,ga]),mn=r.useCallback((()=>{}),[]),Cn=r.useCallback((Ie=>{pt(Ie)}),[]),pn=r.useCallback((()=>{nn(!0)}),[nn]),hn=r.useCallback((()=>{ga(void 0)}),[ga]);return r.useMemo((()=>{if(dn&&Ue&&We)return{aiAgentName:pi,headline:mi,subheadline:Ci,promptChips:cn,composer:{currentInput:Va,isSubmitting:rn,isFileUploadEnabled:an,onInputChange:Cn,onSubmit:un,onStopSubmit:mn},onPromptClick:ln,onOpenSidePanel:pn,onOpenFullView:hn,dataTestIdPrefix:"cards-ai-cfo-hero"}}),[Va,dn,We,Ue,an,rn,Cn,hn,pn,ln,mn,un,cn])})({isEmptyCardsState:ye,isChargeCardAdmin:c,isFileUploadEnabled:U}),Xt=z&&qt!=null?o.jsx(Sr,{...qt}):null,{isCardsShuttingDown:Qt,shutdownContent:en}=kr(p.tenantId,p.company?.managementInfo?.receiverEmails),Qr=Qt===!0&&en!=null?o.jsx(mc,{shutdownContent:en}):null,es=C&&Xt==null,as=aa(p),ts={events:ha(as,Hr),eventCallback:(H,Ue,We)=>{We.onEventReceived(H)},onSubscribed:H=>{H.onPusherSubscribed()}};return re||D?o.jsxs(o.Fragment,{children:[pe==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{ae.trackPageLoaded(Er.Event.cardsListPage),(I&&!re||T&&!D)&&ae.trackCardsPromoView(Z,{isCreditCardOffered:I,isDebitCardOffered:T,isDebitCardEnabled:D,isCreditCardEnabled:re},"Banner",T&&!D?"Debit Card":I&&!re?"Credit Card":"","Card List")}}),o.jsx(nt,{showConfetti:He})]}):null,g===!0?o.jsx(zt,{closeDrawerHandler:Jr,isPaymentDrawerOpen:g,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isDebitCardInfoFetchStateCompleted:!(T&&D&&c)||ra.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ce.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!c||Ea.fetchState==="Completed",paymentInitiatedDate:ce.initiatedRepaymentDate}):null,o.jsxs(fi,{children:[o.jsx(Ee,{isAppContentDrawerOpen:S,handleDrawerToggle:Zt}),o.jsx(gi,{...ts,isCashbackFeatureEnabled:y,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:T,isCreditCardProductVisibleForExpressInterest:M,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:h,creditCardPayNowThreshold:Q,signedInUser:w,chargeCardListState:ee,location:t,admins:Yr.users,navigateAndClearBulkSelection:s,currentTenant:p,isCardControlsEnabled:Ve,companyChargeCardInfoCreditAccountLimit:p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:p.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:c,includeCreditAccountDebitSummaryAndCashbackInfo:_,onClickMenuIcon:()=>{Zt(!0)},creditLimit:Wr,isChargeCardSetupEnabled:re,isChargeCardEnabledOnCompany:be,isDebitCardSetupEnabled:D,isDebitCardEnabledOnCompany:ue,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:se,controllerEmails:Z,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:ra,isChargeCardTOSAccepted:Ae,isDebitCardTOSAccepted:ge,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:Ke,debitAccountInformation:sa,cashbackInformation:Ge,isAiCfoAccessEnabled:es,onAskAiCfoClick:B,isCardsCommentingEnabled:G,cardsAiCfoHero:Xt,cardsShutdownBanner:Qr,isCardsShuttingDown:Qt,onClickPolicyIcon:c&&x?()=>a(Ii(p.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Y,pendingCreationCount:De})]})]}):(Ae||ge)&&c===!0?o.jsx(qe,{to:"../setup"}):Xr?o.jsx(qe,{to:"../promo"}):o.jsx(Ta,{fetchState:pe})}const bi=e=>`/${e}/cards/new`,Si=e=>`/${e}/cards/payment`,yi=e=>`/${e}/cards/payment-history`,Ii=e=>`/${e}/cards/policy`,Gr=[$r,Mr],ki=new Set(Gr),Ei=Pe((function(e){const a=te.getSignedInUser(),n=fe(e),t=e.tenantState.currentTenantId,s=or(e),g={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:t??""},b=n?.companyName??"",h=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:ko(n),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:g,companyName:b,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:h}}),(function(e,a){const{location:n,navigate:t}=a;return{onBackClick:()=>{const s=we(n.state?.pathnameStackToGoBack),g=s.poppedPathname??"..";t(g,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,g)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:g}}})},onFiltersChange:s=>{e(Ao({filters:s}))},onReloadPayments:()=>{e(Ha(!0))},onEventReceived:s=>{ki.has(s)&&e(Ha(!0))},onPusherSubscribed:()=>{e(Ha(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Eo({uiState:{downloadState:s}}))}}}))(st(pc));function Ai(){const e=de(),a=he(),n=me(),{areTenantIdsInSync:t}=Ir(),{useFeatureGate:s}=le();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const g=d((c=>fe(c))),b=d((c=>or(c))),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(null),L=!g.userRole.includes("charge_card_user"),S=!!g.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:l}=s(W.isChargeCardFeatureEnabled),{isFeatureEnabled:C}=s(W.isDebitCardFeatureEnabled),B=Be(C,g),k=Re({isDebitCardFeatureEnabled:C,isBankingOnlyTenant:B}),_=Fe(g),D=xe(g),$=g.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Oe({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:l,isBookKeepingTenant:D,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:$}),y=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,R=Le(),i=ve(R?.loggedInUserRoleMap),f=d((c=>Ca(c,L,k&&S,E&&y))),j=r.useMemo((()=>{const c=f.cards.filter((O=>O.type.code.includes("debit")));return[...new Set(c.map((O=>O.connectedAccountId)))]}),[f.cards]),G=d((c=>ma(c))),U=d((c=>tt(c,j))),{creditAccountRepayment:x}=d((c=>ua(c))),z=r.useMemo((()=>$t(i,G)),[i,G]),V=r.useMemo((()=>Ba(E,y,i,f.creditAccount,x)),[E,y,i,f.creditAccount,x]),T=r.useMemo((()=>Mt(k,S,i,U,f.debitCardSummary)),[k,S,i,U,f.debitCardSummary]),P=r.useMemo((()=>Qe(E,k,S,y)),[E,k,S,y]),K=f.creditAccount.balance.amount+f.creditAccount.hold.amount,J=r.useMemo((()=>p!=null?b.repaymentHistory.find((c=>c.cardRepaymentId===p)):void 0),[p,b.repaymentHistory]),I=r.useCallback((c=>{v(c),n(ia(L,k&&S,E&&y,!1)),w(!0)}),[n,L,k,S,E,y]),M=r.useCallback((()=>{w(!1),v(null),document.body.style.overflow="auto"}),[]);r.useEffect((()=>{h||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(A(!0),n(Ha()))}),[h,n,b.fetchState]),r.useEffect((()=>{!u&&(y||S)&&t&&(m(!0),n(ia(L,!1,E&&y,!1)))}),[u,y,S,t,n,L,E]);const N=aa(g),X={events:ha(N,Gr),eventCallback:(c,O,Z)=>{Z.onEventReceived(c)},onSubscribed:c=>{c.onPusherSubscribed()}};return o.jsxs(o.Fragment,{children:[F?o.jsx(zt,{closeDrawerHandler:M,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:K,productInformation:P,creditAccountInformation:V,debitAccountInformation:T,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(k&&S&&i)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!E||x.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!i||G.fetchState==="Completed",paymentInitiatedDate:x.initiatedRepaymentDate,retryRepayment:J}):null,o.jsx(Ei,{...X,location:a,navigate:e,accountInfoByAccountId:b.accountInfoByAccountId,onRetryPaymentClick:I})]})}const En=Ne.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
height: 100vh;
|
|
28
28
|
width: 100%;
|
|
@@ -31,7 +31,7 @@ import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as
|
|
|
31
31
|
overflow: auto;
|
|
32
32
|
align-items: center;
|
|
33
33
|
background-color: ${e=>e.theme.colors.grey4};
|
|
34
|
-
`,An=ea.getLocalizedStrings().months;function Di(){const e=de(),a=me(),n=he(),{creditAccount:t,creditAccountRepayment:s}=d((P=>ua(P))),g=`${yr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${t.id}`,[b,h]=r.useState(!1),[A,u]=r.useState(!1),m=d((P=>Do(P))),{useFeatureGate:F}=le(),w=d((P=>fe(P))),{isFeatureEnabled:p}=F(W.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=F(W.isDebitCardFeatureEnabled),{isFeatureEnabled:L}=F(W.isCardsCommentingEnabled),S=Tr(L?w.companyId:void 0,{clearParams:L&&m.fetchState==="Completed"}),l=Be(v,w),C=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),B=Fe(w),k=xe(w),_=w.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=Oe({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:C,chargeCardsCreditAccountLimit:_}),$=!!w.companyDebitCardInfo?.info?.isDebitCardEnabled,E=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,y=d((P=>da(P,w.companyId))),R=la(y.controllers),i=d((P=>cr(P))),f=i.cards.filter((P=>P.type.code.includes("debit"))).map((P=>P.connectedAccountId)),j=[...new Set(f)],G=d((P=>tt(P,j))),U=d((P=>_o(P)));r.useEffect((()=>{A||t.fetchState==="Completed"||t.fetchState==="In-Progress"||(h(!0),a(
|
|
34
|
+
`,An=ea.getLocalizedStrings().months;function Di(){const e=de(),a=me(),n=he(),{creditAccount:t,creditAccountRepayment:s}=d((P=>ua(P))),g=`${yr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${t.id}`,[b,h]=r.useState(!1),[A,u]=r.useState(!1),m=d((P=>Do(P))),{useFeatureGate:F}=le(),w=d((P=>fe(P))),{isFeatureEnabled:p}=F(W.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=F(W.isDebitCardFeatureEnabled),{isFeatureEnabled:L}=F(W.isCardsCommentingEnabled),S=Tr(L?w.companyId:void 0,{clearParams:L&&m.fetchState==="Completed"}),l=Be(v,w),C=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),B=Fe(w),k=xe(w),_=w.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,D=Oe({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:p,isBookKeepingTenant:k,isDebitCardProductVisible:C,chargeCardsCreditAccountLimit:_}),$=!!w.companyDebitCardInfo?.info?.isDebitCardEnabled,E=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,y=d((P=>da(P,w.companyId))),R=la(y.controllers),i=d((P=>cr(P))),f=i.cards.filter((P=>P.type.code.includes("debit"))).map((P=>P.connectedAccountId)),j=[...new Set(f)],G=d((P=>tt(P,j))),U=d((P=>_o(P)));r.useEffect((()=>{A||t.fetchState==="Completed"||t.fetchState==="In-Progress"||(h(!0),a(Ze()))}),[b,a,t.fetchState]),r.useEffect((()=>{A||t.fetchState!=="Completed"||t.id==null||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),a(Po(t.id)))}),[A,a,t.fetchState,t.id,m.fetchState]),r.useEffect((()=>{G.fetchState!=="Completed"&&G.fetchState!=="In-Progress"&&C&&$&&a(ir()),i.fetchState!=="Completed"&&i.fetchState!=="In-Progress"&&a($e()),U.fetchState!=="Completed"&&U.fetchState!=="In-Progress"&&C&&$&&a(wo()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&D&&E&&a(vt())}),[G.fetchState,C,$,i.fetchState,U.fetchState,s.fetchState,D,E]),r.useEffect((()=>{if(m.fetchState==="Completed"&&t.fetchState==="Completed"&&s.fetchState==="Completed"&&i.fetchState==="Completed"&&(!C||!$||G.fetchState==="Completed"&&U.fetchState==="Completed")){let P="",K="";if(m.statements.length>0){const N=m.statements[m.statements.length-1].period,[X,c]=N.split("-"),O=m.statements[0].period,[Z,se]=O.split("-");P=`${An[parseInt(c)-1]} ${X}`,K=`${An[parseInt(se)-1]} ${Z}`}const J=Qe(D,C,$,E),I=Ba(D,E,!0,t,s),M=Mt(C,$,!0,G,U);ae.trackCardsCreditCardStatementsView(R,J,{numberOfStatements:m.statements.length,oldestStatementMonthYear:P,latestStatementMonthYear:K},I,M)}}),[m.fetchState,t.fetchState,s.fetchState,G.fetchState,i.fetchState,U.fetchState]);const x=()=>{const P=we(n.state?.pathnameStackToGoBack),K=P.poppedPathname??"..";e(K,{state:{pathnameStackToGoBack:P.newStack}})},z=d((P=>ma(P))),V=te.getSignedInUser(),T={userId:V?.userId??"",sessionId:V?.zeniSessionId??"",tenantId:w.tenantId??""};if(V==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return o.jsx(En,{children:o.jsx(hc,{onBackClick:x})});{const P=Qe(D,C,$,E);return o.jsx(En,{children:o.jsx(fc,{currentTenantCompanyName:w.companyName,statementListView:m,productInformation:P,onBackClick:x,authParams:T,controllerEmails:R,isChargeCardFeatureEnabled:D,isDebitCardFeatureEnabled:C,isDebitCardSetupEnabled:$,isChargeCardSetupEnabled:E,isCardsCommentingEnabled:L,initialOpenThreadRequest:S,chargeCardCashbackDetailState:z,creditAccount:t,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:G,debitCardSummary:U,downloadEndPoint:g})})}}const Kr=[pa,it],_i=new Set(Kr),Pi={containerWidth:new Fa(100,58)},wi=({appContent:e})=>{const a=va(),n=me(),t=de(),s=he(),{useDynamicConfig:g}=le(),[b,h]=r.useState(!1),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),v=r.useRef(!1),L=r.useRef(null);r.useEffect((()=>()=>{L.current!=null&&(clearTimeout(L.current),L.current=null)}),[]);const[S,l]=r.useState(!1),[C,B]=r.useState(!1),k=te.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const _=d((M=>fe(M))),{configValue:D}=g(Xe.zeniCardsConfig),$=d((M=>To(M))),{tenantEmailDomain:E}=_,y=d((M=>M.settingsViewState.profile.fetchState)),R=d((M=>M.chargeCardListState.fetchState)),i=d((M=>M.settingsViewState.profile.userId)),f=d((M=>M.chargeCardConfigState.fetchState));r.useEffect((()=>{b===!1&&y!=="In-Progress"&&y!=="Completed"&&(n(vo()),h(!0)),A===!1&&f!=="In-Progress"&&f!=="Completed"&&(n(qa()),u(!0)),m===!1&&R==="Not-Started"&&(F(!0),n($e()))}),[b,m,R,A,f]),r.useEffect((()=>{y==="Completed"&&S===!1&&i!=null&&R==="Completed"&&$.cards.length>0&&(n(Fo({userId:i})),n(dr({cardId:$.cards[$.cards.length-1].id})),l(!0))}),[y,S,i,R]),r.useEffect((()=>{if(!w&&$.fetchState==="Completed"&&$.cards.length===0){const M=we(s.state?.pathnameStackToGoBack),N=M.poppedPathname??ta(E);t(N,{state:{pathnameStackToGoBack:M.newStack}})}}),[$.fetchState,$.cards,w]);const j=d((M=>Za(M))),G=ya(j.updateStatus.fetchState),U=j.currentDisplayedCardId,{useFeatureGate:x}=le(),{isFeatureEnabled:z}=x(W.isChargeCardFeatureEnabled),V=!!_.companyChargeCardInfo?.info?.isChargeCardEnabled,T=!_.userRole.includes("charge_card_user")&&z&&V,P=d((M=>U!=null?lr(M.chargeCardState,U):null)),K=()=>{U!=null&&(v.current=!0,L.current!=null&&clearTimeout(L.current),L.current=setTimeout((()=>{v.current=!1,L.current=null}),5e3),n(ka(U,T,!0)),n($e(!0)),p(!0))},J=aa(_);Nt({events:ha(J,Kr),onSubscribed:()=>{n($e(!0))},onEvent:(M,N)=>{if(!_i.has(M))return;const X=Yt(N),c=v.current;if(M===pa){const Z=ie(X?.card_id)??U;if(Z!=null){const se=Wt(X,Z);if(se!=null)return n(Ft(se)),void(Z!==U||c||K())}}if(M===it)return void n($e(!0));const O=ie(X?.card_id)??U;(U==null||O===U)&&U!=null?c||K():n($e(!0))}}),r.useEffect((()=>{if(w&&U!=null&&P!=null&&P.status.code!=="request_on_hold"){const M=_e(_.tenantEmailDomain,U,k,P),N=ke(s.state?.pathnameStackToGoBack,s.pathname);n(xo()),P?.type.code==="business_virtual_credit_card"&&n(Xa()),t(M,{state:{pathnameStackToGoBack:N},replace:!0}),v.current=!1,L.current!=null&&(clearTimeout(L.current),L.current=null)}}),[w,P?.status.code]),r.useEffect((()=>{G==="In-Progress"&&j.updateStatus.fetchState==="Completed"&&setTimeout(K,3e3)}),[G,j.updateStatus.fetchState]);const I=M=>{B(M)};if(y!=="Completed"||$.cards.length===0)return o.jsxs(Dn,{children:[o.jsx(Ee,{isAppContentDrawerOpen:C,handleDrawerToggle:I}),o.jsx(gc,{})]});if(i==null)throw Error("Can't access my userId.");return o.jsxs(Dn,{children:[o.jsx(Ee,{isAppContentDrawerOpen:C,handleDrawerToggle:I}),o.jsx(Ti,{chargeCardListView:$,cardUserOnboardingView:j,navigate:t,currentTenant:_,myUserId:i,location:s,chargeCardCashbackRatePerTransaction:D.charge_card_cashback_rate_per_transaction!=null?D.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?o.jsx(vi,{windowSize:a,children:e}):null]})},Ti=Pe((function(e,{currentTenant:a,cardUserOnboardingView:n,chargeCardListView:t,myUserId:s}){const g=Ca(e,!1,!1,!1);let b=!1;return g.fetchState==="Completed"&&g.cards.length<=1&&(b=!0),{cards:t.cards,showMenuIcon:b,companyLegalName:a.companyName,twoFAView:n.twoFAView,cardUserOnboardingLocalData:n.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:n.isDOBPresent,onboardingProgressStatus:n.onboardingProgressStatus}}),(function(e,a){const{navigate:n,cardUserOnboardingView:t,location:s,currentTenant:g}=a,{tenantEmailDomain:b}=g;return{updateCardUserOnboardingLocalData:h=>{e(bn({localData:h}))},onGetOtp:h=>{if(t.cardUserOnboardingLocalData!=null){const A={...t.cardUserOnboardingLocalData,phone:h};e(bn({localData:A}))}e(at(h,"CardUserOnboarding"))},onResendOtp:h=>{e(et(h,"CardUserOnboarding"))},onVerifyOtp:(h,A)=>{e(Qa(h,A,"CardUserOnboarding"))},onVerifyOtpSuccess:h=>{e(Bo()),h!=null&&te.saveZeniOtpToken(h)},setCurrentDisplayedCardId:h=>{e(dr({cardId:h}))},onBackClick:()=>{const h=we(s.state?.pathnameStackToGoBack),A=h.poppedPathname??ta(b);n(A,{state:{pathnameStackToGoBack:h.newStack}})}}}))(bc),vi=Ne.div`
|
|
35
35
|
display: flex;
|
|
36
36
|
flex-direction: column;
|
|
37
37
|
width: ${e=>`${Pi.containerWidth.value(e.windowSize)}%`};
|
|
@@ -44,7 +44,7 @@ import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as
|
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: center;
|
|
46
46
|
background-color: ${e=>e.theme.colors.grey4};
|
|
47
|
-
`,Fi={containerWidth:new Fa(100,58)},xi=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),[v,L]=r.useState(!1),S=te.getSignedInUser();if(S==null)throw Error("Can't access onboarding card page without signing in...");const l=d((T=>fe(T)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=b(
|
|
47
|
+
`,Fi={containerWidth:new Fa(100,58)},xi=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),[m,F]=r.useState(!1),[w,p]=r.useState(!1),[v,L]=r.useState(!1),S=te.getSignedInUser();if(S==null)throw Error("Can't access onboarding card page without signing in...");const l=d((T=>fe(T)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:C}=b(Xe.zeniCardsConfig),B=d((T=>Lo(T,s))),{isFeatureEnabled:k}=h(W.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=h(W.isDebitCardFeatureEnabled),D=Be(_,l),$=Re({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:D}),E=Fe(l),y=xe(l),R=l.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Oe({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:k,isBookKeepingTenant:y,isDebitCardProductVisible:$,chargeCardsCreditAccountLimit:R}),f=B.chargeCard,j=d((T=>T.chargeCardConfigState.fetchState));r.useEffect((()=>{A===!1&&j!=="In-Progress"&&j!=="Completed"&&(n(qa()),u(!0)),m===!1&&B.fetchState==="Not-Started"&&(F(!0),n(ka(s,!1,i)))}),[m,B.fetchState,A,j]);const G=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(w===!1&&(G===!1||G&&f.status?.code!=="active"||G&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==S.userId)){const T=_e(l.tenantEmailDomain,s,S,f,!0),P=ke(g.state?.pathnameStackToGoBack,g.pathname);t(T,{state:{pathnameStackToGoBack:P}})}else if(w&&B.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){n(Ro({chargeCardId:s}));const T=_e(l.tenantEmailDomain,s,S,f,!0),P=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Xa()),t(T,{state:{pathnameStackToGoBack:P}})}}}),[B.fetchState,f?.type.code,w,B.isRefreshingViewInBackground]);const U=te.getZeniOtpTokenForCardHolder(s),x=d((T=>Vn(T.userState,S.userId))),z=()=>{f?.isPinSet!==!0&&n(ba(s,!0))};r.useEffect((()=>{B.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),p(!0))}),[B.updateDebitCardPinAttemptFetchState.fetchState]);const V=T=>{L(T)};if(j!=="Completed"||f==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(x?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(Ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:v,handleDrawerToggle:V}),o.jsx(Bi,{cardId:s,card:f,phone:x.phone,signedInUser:S,isSandboxEnv:Rt(),debitCardDetailState:B,signedInUserToken:U,navigate:t,currentTenant:l,location:g,chargeCardCashbackRatePerTransaction:C.charge_card_cashback_rate_per_transaction!=null?C.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{V(!0)}}),e!=null?o.jsx(Li,{windowSize:a,children:e}):null]})},Bi=Pe((function(e,{debitCardDetailState:a,cardId:n}){const t=Hn(e,n),s=a.updateStatus,g=Ca(e,!1,!1,!1);let b=!1;return g.fetchState==="Completed"&&g.cards.length<=1&&(b=!0),{showMenuIcon:b,vgsVaultId:rt.cardVaultId,twoFAView:t,setPinWaitStatus:s}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,debitCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdateDebitCardPinAttempt:u=>{e(qn(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Qa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onSetPinSuccess:()=>{e(Oo({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(Sc),Li=Ne.div`
|
|
48
48
|
display: flex;
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
width: ${e=>`${Fi.containerWidth.value(e.windowSize)}%`};
|
|
@@ -68,4 +68,4 @@ import{j as o}from"./liveblocks-CkQ2CY6T.js";import{u as me,j as d,h as de,g as
|
|
|
68
68
|
overflow: auto;
|
|
69
69
|
align-items: center;
|
|
70
70
|
background-color: ${e=>e.theme.colors.grey4};
|
|
71
|
-
`,Hi=Pe((function(e,a){const{myPendingActivationChargeCardListState:n}=a;return{myPendingActivationChargeCardListView:n,uiState:n.uiState,signedInUser:a.signedInUser}}),(function(e,a){const{navigate:n,currentTenant:t,location:s,signedInUser:g,myPendingActivationChargeCardListState:b}=a,{tenantEmailDomain:h}=t,{cards:A}=b;return{onChargeCardRowClick:u=>{const m=Pr(A,u),F=_e(h,u,g,m),w=ke(s.state?.pathnameStackToGoBack,s.pathname);n(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(u,m)=>{e(It({uiState:{sortKey:u,sortOrder:m}}))},onReloadCards:()=>{e($e())},onBackClick:()=>{const u=t.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),n("../")}}}))(Ac);function Gi(){const e=de(),a=me(),n=he(),t=Ot(),[s,g]=r.useState(!1),b=d((x=>Go(x))),h=d((x=>fe(x))),A=d((x=>da(x,h.companyId))),u=la(A.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=m(W.isDebitCardFeatureEnabled),p=Be(w,h),v=Re({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:p}),L=!!h.companyDebitCardInfo?.info?.isDebitCardEnabled,S=!!h.companyChargeCardInfo?.info?.isChargeCardEnabled,l=Le(),C=Fe(h),B=xe(h),k=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Oe({isCardsOnlyTenant:C,isChargeCardFeatureEnabled:F,isBookKeepingTenant:B,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:k}),D=ve(l?.loggedInUserRoleMap),$=d((x=>ma(x))),{creditAccount:E,creditAccountRepayment:y}=d((x=>ua(x))),R=d((x=>cr(x))).cards.filter((x=>x.type.code.includes("debit"))).map((x=>x.connectedAccountId)),i=[...new Set(R)],f=d((x=>tt(x,i)));r.useEffect((()=>{s||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(g(!0),a($e()),a(Ja()))}),[s,a,b.fetchState]),r.useEffect((()=>{if(b.fetchState==="Completed"&&b.cards.length===1&&j!=null){const x=_e(h.tenantEmailDomain,b.cards[0].id,j,b.cards[0]);e(x,{state:{message:n.state?.message}})}}),[b.fetchState,b.cards]);const j=te.getSignedInUser();r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&_&&S&&D&&a(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&D&&a(vt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&v&&L&&D&&a(ir())}),[E.fetchState,y.fetchState,a,f.fetchState,v,L,D,_,S]);const G=aa(h);if(Nt({events:ha(G,zr),onEvent:(x,z)=>{if(!Ni.has(x))return;const V=Yt(z);if(x===pa){const T=ie(V?.card_id);if(T!=null){const P=Wt(V,T);if(P!=null)return void a(Ft(P))}}a($e(!0))},onSubscribed:()=>{a($e(!0))}}),j==null)throw Error("Can't access address page without signing in...");const U=b.cards!=null&&b.cards.length>0;if(b.fetchState==="Completed"||U){const x=Xe(_,v,L,S);return o.jsx(Vi,{children:o.jsx(Hi,{navigate:e,currentTenant:h,signedInUser:j,productInformation:x,myPendingActivationChargeCardListState:b,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:S,chargeCardCashbackDetailState:$,creditAccount:E,creditAccountRepayment:y,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:n})})}return o.jsx(Ta,{fetchState:"In-Progress",style:{backgroundColor:t.colors.grey5}})}const Ki=Pe((function(e,a){const{companyId:n,companyLegalName:t}=a;return{chargeCardSetupView:wa(e,n),admins:a.adminList,companyLegalName:t}}),(function(e,a){const{navigate:n,companyId:t,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:g,isChargeCardSetupEnabled:b,signedInUser:h,location:A,productInformation:u,isEarlyPayEnabled:m,controllerEmails:F,chargeCardsCreditAccountLimit:w}=a;return{onSetupButtonClick:p=>{if(h!=null&&ae.trackCardsPromoPageClicked("enable cards"),s)switch(ae.trackCardsEnableCardsClick(F,u,"Cards Promo"),p){case"credit":e(Ze(t,!0,"charge_cards",m,!1));break;case"debit":e(Ze(t,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?Ze(t,!0,"debit_cards",m,!0):Ze(t,!0,"charge_cards__debit_cards",m,!1))}else switch(ae.trackCardsSetupCardsClick(F,u,"Cards Promo"),p){case"credit":e(Ze(t,!1,"charge_cards",m,!1));break;case"debit":e(Ze(t,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?Ze(t,!1,"debit_cards",m,!0):Ze(t,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const p=we(A.state?.pathnameStackToGoBack);let v=p.poppedPathname;v==null&&(v=g||b?"..":"../.."),n(v,{state:{pathnameStackToGoBack:p.newStack}})},onLetsGoClick:()=>{n("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Qa()),n("../",{relative:"path"})):n("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Yo(t))}}}))(Pc),zi=()=>{const e=Dc(),a=de(),{tenantEmailDomain:n}=Me(),[t]=_n(),s=t.get("cardPromoType"),g=me(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),{isFeatureEnabled:m}=h(W.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=h(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),{configValue:p}=b(Qe.zeniCardsConfig),v=d((J=>fe(J))),L=d((J=>da(J,v.companyId))),S=la(L.controllers),l=p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,C=he(),B=te.getSignedInUserTenant(n)?.companyId??v.companyId,k=d((J=>wa(J,B))),_=k.primaryFundingAccount,D=v.companyBillPayInfo?.info,$=Fe(v),E=xe(v),y=Be(m,v),R=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Re({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:y}),f=Oe({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:R}),j=_r({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E}),G=i&&f===!1,U=D?.businessVerificationStatus?.code==="verified"&&(G||_?.accType==="depositAccount"||Ko(_?.providerVerificationStatus?.code??"")),x=te.getSignedInUser(),z=!!v.companyZeniAccountInfo?.info?.isZeniAccountEnabled,V=!!v.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,T=!!v.company?.companyChargeCardInfo?.isChargeCardEnabled,P=!!v.company?.companyDebitCardInfo?.isDebitCardEnabled,K=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,Z=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,I=!!v.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,M=J=>{u(J)},N=d((J=>J.chargeCardSetupViewState.fetchState));if(x==null)throw Error("Can't access Charge Card promo page without signing in...");const Q=Le(),c=ve(Q?.loggedInUserRoleMap),O=xt(Q?.loggedInUserRoleMap),[q,se]=r.useState(!1),[X,Ve]=r.useState(!1),[Ae,ge]=r.useState(!1);r.useEffect((()=>{q===!1&&C.state?.message==="activation"&&se(!0)}),[C.state]),r.useEffect((()=>{X||N!=="Not-Started"||B==null||(Ve(!0),g(Pa(B,!0)))}),[X,N,B,g]);const re=v.companyChargeCardInfo?.info!=null&&Ia({cardInfo:v.companyChargeCardInfo.info,isProductVisible:j&&T,isTOSAccepted:V,isSetupEnabled:K,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),be=v.companyDebitCardInfo?.info!=null&&Ia({cardInfo:v.companyDebitCardInfo.info,isProductVisible:i&&P,isTOSAccepted:I,isSetupEnabled:Z,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),ue=i&&be&&j&&R>=0&&re?"debit_and_credit":i&&be?"debit":"credit",oe=Bc(s,ue),Se=k?.chargeCardTermsDetails?.fetchStatus?.fetchState,ee=r.useRef(null);r.useEffect((()=>{Se==="In-Progress"?ee.current=oe:Se!=="Error"&&Se!=="Not-Started"||(ee.current=null)}),[Se,oe]);const De=Se!=="In-Progress"&&Se!=="Completed"||ee.current==null?oe:ee.current;r.useEffect((()=>{oe==="credit"&&(K||j===!1&&Z)||oe==="debit"&&Z||oe==="debit_and_credit"&&Z&&K?a("../"):(oe==="debit_and_credit"&&V===!0&&I===!0||oe==="credit"&&(V===!0||j===!1&&I===!0)||oe==="debit"&&I===!0)&&c===!0&&a("../setup")}),[U,K,Z,oe,V,I]),r.useEffect((()=>{Ae||(g(zo("cardAdmin")),ge(!0))}),[Ae]);const Te=d((J=>sr(J.userState,J.userRoleState,J.userListViewState,"cardAdmin"))),Ce=Xe(j,i,Z,K);return(J=>{switch(J){case"credit":return T;case"debit":return P;case"debit_and_credit":return T&&P;default:return!1}})(De)?(re||be)&&N==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{if(ae.trackPageLoaded(Er.Event.cardsPromoPage),!!j&&!K||!!i&&!Z||!!j&&!!i&&!Z&&!K){const J=Yi({isDebitCardSetupEnabled:Z,isChargeCardSetupEnabled:K,isCreditCardProductVisibleForExpressInterest:j,isDebitCardProductVisible:i});ae.trackCardsPromoView(S,Ce,"Page",J,"Promo Page")}}}),o.jsx(nt,{showConfetti:q}),o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:M}),o.jsx(Ki,{signedInUser:x,location:C,meetingUrl:e("charge_card_promo"),showEnableCardButton:U,isCompanyBusinessVerificationAndPaymentSetUpDone:U,isChargeCardSetupEnabled:K,isDebitCardSetupEnabled:Z,companyLegalName:v.companyName,adminList:Te.users,isCheckingEnabled:z,navigate:a,companyId:B,cardPromoType:De,controllerEmails:S,productInformation:Ce,isCreditCardProductVisible:f,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:F,cashbackRate:l,chargeCardsCreditAccountLimit:R,onClickMenuIcon:()=>{M(!0)}})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:M}),o.jsx(_c,{})]}):o.jsx(Je,{to:"../",replace:!0})},Yi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:a,isCreditCardProductVisibleForExpressInterest:n,isDebitCardProductVisible:t})=>n&&t&&!e&&!a?"Credit & Debit Card":n&&!a?"Credit Card":t&&!e?"Debit Card":"";function Id(){const e=he(),a=d((Q=>fe(Q))),{useFeatureGate:n}=le(),{isFeatureEnabled:t}=n(W.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=n(W.isDebitCardFeatureEnabled),{isFeatureEnabled:g}=n(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:b}=n(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:h}=n(W.isCardPolicyEnabled),A=Be(s,a),u=Re({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:A}),m=wc(a,t,s),F=!!a.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!a.company?.companyDebitCardInfo.isDebitCardTOSAccepted,p=!!a.company?.companyChargeCardInfo?.isChargeCardEnabled,v=!!a.company?.companyDebitCardInfo?.isDebitCardEnabled,L=!!a.companyChargeCardInfo?.info?.isChargeCardEnabled,S=!!a.companyDebitCardInfo?.info?.isDebitCardEnabled,l=Le(),C=ve(l?.loggedInUserRoleMap),{isCardsShuttingDown:B}=kr(a.tenantId,a.company?.managementInfo?.receiverEmails),k=xt(l?.loggedInUserRoleMap),{isFeatureEnabled:_}=n(W.isCashbackFeatureEnabled),D=a.userRole.includes("charge_card_user"),$=!D,E=!D&&L,y=a?.userRole!=null&&Wo(a?.userRole),R=(a?.company==null||a.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&Zo(l?.loggedInUserRoleMap),i=qo(l?.loggedInUserRoleMap),f=(a?.company==null||a.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Jo(l?.loggedInUserRoleMap),{isFeatureEnabled:j}=n(W.isDepositAccountsFeatureEnabled),G=j&&!y&&Kn(l?.loggedInUserRoleMap),U=L&&p&&!y,x=S&&v&&!y,z=m&&!y&&ve(l?.loggedInUserRoleMap),V=Qo(l?.loggedInUserRoleMap),T=Fe(a),P=xe(a),K=a.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Z=Oe({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:t,isBookKeepingTenant:P,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:K}),I=a.companyChargeCardInfo?.info!=null&&Ia({cardInfo:a.companyChargeCardInfo.info,isProductVisible:Z&&p,isTOSAccepted:F,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),M=a.companyDebitCardInfo?.info!=null&&Ia({cardInfo:a.companyDebitCardInfo.info,isProductVisible:u&&v,isTOSAccepted:w,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),N=I||M;return o.jsxs(cs,{children:[C?o.jsx(ne,{path:"setup",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:V,isUserHasOnlyBillPayAccess:i,productType:"charge_cards",type:"setup"})}):null,C?o.jsx(ne,{path:"verification",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isUserHasOnlyBillPayAccess:i,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:V,productType:"charge_cards",type:"verification"})}):null,C&&h?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"policy",element:o.jsx(Yc,{})}),o.jsx(ne,{path:"policy/new",element:o.jsx(jc,{})}),o.jsx(ne,{path:"policy/:templateId/edit",element:o.jsx(Vc,{})})]}):null,o.jsx(ne,{path:"promo",element:o.jsx(zi,{})}),U||x?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"/",element:o.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&g?o.jsx(ne,{path:"payment",element:o.jsx(kn,{isPaymentDrawerOpen:!0})}):null,o.jsx(ne,{path:"activate",element:o.jsx(Gi,{})}),o.jsx(ne,{path:"onboard",element:o.jsx(wi,{})}),C&&B!==!0?o.jsx(ne,{path:"new",element:o.jsx(Mi,{})}):C?o.jsx(ne,{path:"new",element:o.jsx(Je,{to:"..",replace:!0})}):null,_&&$?o.jsx(ne,{path:"cashback",element:o.jsx(Qc,{})}):null,E?o.jsx(ne,{path:"statements",element:o.jsx(Di,{})}):null,z&&b&&L?o.jsx(ne,{path:"payment-history",element:o.jsx(Ai,{})}):null,o.jsx(ne,{path:":cardId/activate",element:o.jsx(ai,{})}),o.jsx(ne,{path:":cardId/setPin",element:o.jsx(xi,{})}),o.jsx(ne,{path:":cardId/addToWallet",element:o.jsx(Wc,{})}),o.jsx(ne,{path:":cardId/*",element:o.jsx(ui,{})}),o.jsx(ne,{path:"*",element:o.jsx(ot,{})})]}):(F||w)&&C?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../setup"})}):N?o.jsx(ne,{path:"*",element:o.jsx(Je,{to:"../promo",state:e.state})}):o.jsx(ne,{path:"*",element:null})]})}export{Id as default};
|
|
71
|
+
`,Hi=Pe((function(e,a){const{myPendingActivationChargeCardListState:n}=a;return{myPendingActivationChargeCardListView:n,uiState:n.uiState,signedInUser:a.signedInUser}}),(function(e,a){const{navigate:n,currentTenant:t,location:s,signedInUser:g,myPendingActivationChargeCardListState:b}=a,{tenantEmailDomain:h}=t,{cards:A}=b;return{onChargeCardRowClick:u=>{const m=Pr(A,u),F=_e(h,u,g,m),w=ke(s.state?.pathnameStackToGoBack,s.pathname);n(F,{state:{pathnameStackToGoBack:w}})},onColumnSortConfigChanged:(u,m)=>{e(It({uiState:{sortKey:u,sortOrder:m}}))},onReloadCards:()=>{e($e())},onBackClick:()=>{const u=t.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),n("../")}}}))(Ac);function Gi(){const e=de(),a=me(),n=he(),t=Ot(),[s,g]=r.useState(!1),b=d((x=>Go(x))),h=d((x=>fe(x))),A=d((x=>da(x,h.companyId))),u=la(A.controllers),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=m(W.isDebitCardFeatureEnabled),p=Be(w,h),v=Re({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:p}),L=!!h.companyDebitCardInfo?.info?.isDebitCardEnabled,S=!!h.companyChargeCardInfo?.info?.isChargeCardEnabled,l=Le(),C=Fe(h),B=xe(h),k=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,_=Oe({isCardsOnlyTenant:C,isChargeCardFeatureEnabled:F,isBookKeepingTenant:B,isDebitCardProductVisible:v,chargeCardsCreditAccountLimit:k}),D=ve(l?.loggedInUserRoleMap),$=d((x=>ma(x))),{creditAccount:E,creditAccountRepayment:y}=d((x=>ua(x))),R=d((x=>cr(x))).cards.filter((x=>x.type.code.includes("debit"))).map((x=>x.connectedAccountId)),i=[...new Set(R)],f=d((x=>tt(x,i)));r.useEffect((()=>{s||b.fetchState==="Completed"||b.fetchState==="In-Progress"||(g(!0),a($e()),a(qa()))}),[s,a,b.fetchState]),r.useEffect((()=>{if(b.fetchState==="Completed"&&b.cards.length===1&&j!=null){const x=_e(h.tenantEmailDomain,b.cards[0].id,j,b.cards[0]);e(x,{state:{message:n.state?.message}})}}),[b.fetchState,b.cards]);const j=te.getSignedInUser();r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&_&&S&&D&&a(Ze()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&D&&a(vt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&v&&L&&D&&a(ir())}),[E.fetchState,y.fetchState,a,f.fetchState,v,L,D,_,S]);const G=aa(h);if(Nt({events:ha(G,zr),onEvent:(x,z)=>{if(!Ni.has(x))return;const V=Yt(z);if(x===pa){const T=ie(V?.card_id);if(T!=null){const P=Wt(V,T);if(P!=null)return void a(Ft(P))}}a($e(!0))},onSubscribed:()=>{a($e(!0))}}),j==null)throw Error("Can't access address page without signing in...");const U=b.cards!=null&&b.cards.length>0;if(b.fetchState==="Completed"||U){const x=Qe(_,v,L,S);return o.jsx(Vi,{children:o.jsx(Hi,{navigate:e,currentTenant:h,signedInUser:j,productInformation:x,myPendingActivationChargeCardListState:b,isChargeCardFeatureEnabled:_,isDebitCardFeatureEnabled:v,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:S,chargeCardCashbackDetailState:$,creditAccount:E,creditAccountRepayment:y,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:n})})}return o.jsx(Ta,{fetchState:"In-Progress",style:{backgroundColor:t.colors.grey5}})}const Ki=Pe((function(e,a){const{companyId:n,companyLegalName:t}=a;return{chargeCardSetupView:wa(e,n),admins:a.adminList,companyLegalName:t}}),(function(e,a){const{navigate:n,companyId:t,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:g,isChargeCardSetupEnabled:b,signedInUser:h,location:A,productInformation:u,isEarlyPayEnabled:m,controllerEmails:F,chargeCardsCreditAccountLimit:w}=a;return{onSetupButtonClick:p=>{if(h!=null&&ae.trackCardsPromoPageClicked("enable cards"),s)switch(ae.trackCardsEnableCardsClick(F,u,"Cards Promo"),p){case"credit":e(Je(t,!0,"charge_cards",m,!1));break;case"debit":e(Je(t,!0,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?Je(t,!0,"debit_cards",m,!0):Je(t,!0,"charge_cards__debit_cards",m,!1))}else switch(ae.trackCardsSetupCardsClick(F,u,"Cards Promo"),p){case"credit":e(Je(t,!1,"charge_cards",m,!1));break;case"debit":e(Je(t,!1,"debit_cards",m,!1));break;case"debit_and_credit":e(w===0?Je(t,!1,"debit_cards",m,!0):Je(t,!1,"charge_cards__debit_cards",m,!1))}},onBackClick:()=>{const p=we(A.state?.pathnameStackToGoBack);let v=p.poppedPathname;v==null&&(v=g||b?"..":"../.."),n(v,{state:{pathnameStackToGoBack:p.newStack}})},onLetsGoClick:()=>{n("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),n("../",{relative:"path"})):n("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Yo(t))}}}))(Pc),zi=()=>{const e=Dc(),a=de(),{tenantEmailDomain:n}=Me(),[t]=_n(),s=t.get("cardPromoType"),g=me(),{useDynamicConfig:b,useFeatureGate:h}=le(),[A,u]=r.useState(!1),{isFeatureEnabled:m}=h(W.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=h(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),{configValue:p}=b(Xe.zeniCardsConfig),v=d((q=>fe(q))),L=d((q=>da(q,v.companyId))),S=la(L.controllers),l=p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,C=he(),B=te.getSignedInUserTenant(n)?.companyId??v.companyId,k=d((q=>wa(q,B))),_=k.primaryFundingAccount,D=v.companyBillPayInfo?.info,$=Fe(v),E=xe(v),y=Be(m,v),R=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,i=Re({isDebitCardFeatureEnabled:m,isBankingOnlyTenant:y}),f=Oe({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E,isDebitCardProductVisible:i,chargeCardsCreditAccountLimit:R}),j=_r({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:w,isBookKeepingTenant:E}),G=i&&f===!1,U=D?.businessVerificationStatus?.code==="verified"&&(G||_?.accType==="depositAccount"||Ko(_?.providerVerificationStatus?.code??"")),x=te.getSignedInUser(),z=!!v.companyZeniAccountInfo?.info?.isZeniAccountEnabled,V=!!v.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,T=!!v.company?.companyChargeCardInfo?.isChargeCardEnabled,P=!!v.company?.companyDebitCardInfo?.isDebitCardEnabled,K=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,J=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,I=!!v.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,M=q=>{u(q)},N=d((q=>q.chargeCardSetupViewState.fetchState));if(x==null)throw Error("Can't access Charge Card promo page without signing in...");const X=Le(),c=ve(X?.loggedInUserRoleMap),O=xt(X?.loggedInUserRoleMap),[Z,se]=r.useState(!1),[Q,Ve]=r.useState(!1),[Ae,ge]=r.useState(!1);r.useEffect((()=>{Z===!1&&C.state?.message==="activation"&&se(!0)}),[C.state]),r.useEffect((()=>{Q||N!=="Not-Started"||B==null||(Ve(!0),g(Pa(B,!0)))}),[Q,N,B,g]);const re=v.companyChargeCardInfo?.info!=null&&Ia({cardInfo:v.companyChargeCardInfo.info,isProductVisible:j&&T,isTOSAccepted:V,isSetupEnabled:K,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),be=v.companyDebitCardInfo?.info!=null&&Ia({cardInfo:v.companyDebitCardInfo.info,isProductVisible:i&&P,isTOSAccepted:I,isSetupEnabled:J,isUserHasCardsAdminLevelAccess:c,isUserHasCardsAccess:O}),ue=i&&be&&j&&R>=0&&re?"debit_and_credit":i&&be?"debit":"credit",oe=Bc(s,ue),Se=k?.chargeCardTermsDetails?.fetchStatus?.fetchState,ee=r.useRef(null);r.useEffect((()=>{Se==="In-Progress"?ee.current=oe:Se!=="Error"&&Se!=="Not-Started"||(ee.current=null)}),[Se,oe]);const De=Se!=="In-Progress"&&Se!=="Completed"||ee.current==null?oe:ee.current;r.useEffect((()=>{oe==="credit"&&(K||j===!1&&J)||oe==="debit"&&J||oe==="debit_and_credit"&&J&&K?a("../"):(oe==="debit_and_credit"&&V===!0&&I===!0||oe==="credit"&&(V===!0||j===!1&&I===!0)||oe==="debit"&&I===!0)&&c===!0&&a("../setup")}),[U,K,J,oe,V,I]),r.useEffect((()=>{Ae||(g(zo("cardAdmin")),ge(!0))}),[Ae]);const Te=d((q=>sr(q.userState,q.userRoleState,q.userListViewState,"cardAdmin"))),Ce=Qe(j,i,J,K);return(q=>{switch(q){case"credit":return T;case"debit":return P;case"debit_and_credit":return T&&P;default:return!1}})(De)?(re||be)&&N==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ut,{analytics:ae,onLoad:()=>{if(ae.trackPageLoaded(Er.Event.cardsPromoPage),!!j&&!K||!!i&&!J||!!j&&!!i&&!J&&!K){const q=Yi({isDebitCardSetupEnabled:J,isChargeCardSetupEnabled:K,isCreditCardProductVisibleForExpressInterest:j,isDebitCardProductVisible:i});ae.trackCardsPromoView(S,Ce,"Page",q,"Promo Page")}}}),o.jsx(nt,{showConfetti:Z}),o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:M}),o.jsx(Ki,{signedInUser:x,location:C,meetingUrl:e("charge_card_promo"),showEnableCardButton:U,isCompanyBusinessVerificationAndPaymentSetUpDone:U,isChargeCardSetupEnabled:K,isDebitCardSetupEnabled:J,companyLegalName:v.companyName,adminList:Te.users,isCheckingEnabled:z,navigate:a,companyId:B,cardPromoType:De,controllerEmails:S,productInformation:Ce,isCreditCardProductVisible:f,isDebitCardFeatureEnabled:m,isEarlyPayEnabled:F,cashbackRate:l,chargeCardsCreditAccountLimit:R,onClickMenuIcon:()=>{M(!0)}})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:A,handleDrawerToggle:M}),o.jsx(_c,{})]}):o.jsx(qe,{to:"../",replace:!0})},Yi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:a,isCreditCardProductVisibleForExpressInterest:n,isDebitCardProductVisible:t})=>n&&t&&!e&&!a?"Credit & Debit Card":n&&!a?"Credit Card":t&&!e?"Debit Card":"";function Id(){const e=he(),a=d((X=>fe(X))),{useFeatureGate:n}=le(),{isFeatureEnabled:t}=n(W.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=n(W.isDebitCardFeatureEnabled),{isFeatureEnabled:g}=n(W.isEarlyPayFeatureEnabled),{isFeatureEnabled:b}=n(W.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:h}=n(W.isCardPolicyEnabled),A=Be(s,a),u=Re({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:A}),m=wc(a,t,s),F=!!a.company?.companyChargeCardInfo.isChargeCardTOSAccepted,w=!!a.company?.companyDebitCardInfo.isDebitCardTOSAccepted,p=!!a.company?.companyChargeCardInfo?.isChargeCardEnabled,v=!!a.company?.companyDebitCardInfo?.isDebitCardEnabled,L=!!a.companyChargeCardInfo?.info?.isChargeCardEnabled,S=!!a.companyDebitCardInfo?.info?.isDebitCardEnabled,l=Le(),C=ve(l?.loggedInUserRoleMap),{isCardsShuttingDown:B}=kr(a.tenantId,a.company?.managementInfo?.receiverEmails),k=xt(l?.loggedInUserRoleMap),{isFeatureEnabled:_}=n(W.isCashbackFeatureEnabled),D=a.userRole.includes("charge_card_user"),$=!D,E=!D&&L,y=a?.userRole!=null&&Wo(a?.userRole),R=(a?.company==null||a.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&Jo(l?.loggedInUserRoleMap),i=Zo(l?.loggedInUserRoleMap),f=(a?.company==null||a.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&qo(l?.loggedInUserRoleMap),{isFeatureEnabled:j}=n(W.isDepositAccountsFeatureEnabled),G=j&&!y&&Kn(l?.loggedInUserRoleMap),U=L&&p&&!y,x=S&&v&&!y,z=m&&!y&&ve(l?.loggedInUserRoleMap),V=Xo(l?.loggedInUserRoleMap),T=Fe(a),P=xe(a),K=a.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,J=Oe({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:t,isBookKeepingTenant:P,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:K}),I=a.companyChargeCardInfo?.info!=null&&Ia({cardInfo:a.companyChargeCardInfo.info,isProductVisible:J&&p,isTOSAccepted:F,isSetupEnabled:L,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),M=a.companyDebitCardInfo?.info!=null&&Ia({cardInfo:a.companyDebitCardInfo.info,isProductVisible:u&&v,isTOSAccepted:w,isSetupEnabled:S,isUserHasCardsAdminLevelAccess:C,isUserHasCardsAccess:k}),N=I||M;return o.jsxs(cs,{children:[C?o.jsx(ne,{path:"setup",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:V,isUserHasOnlyBillPayAccess:i,productType:"charge_cards",type:"setup"})}):null,C?o.jsx(ne,{path:"verification",element:o.jsx(Sn,{isBillPayAdminLevelAccess:R,isUserHasOnlyBillPayAccess:i,isReimbursementAdminLevelAccess:f,isZeniAccountAdminLevelAccess:G,isChargeCardAdminLevelAccess:z,isUserHasOnlyCardAccess:V,productType:"charge_cards",type:"verification"})}):null,C&&h?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"policy",element:o.jsx(Yc,{})}),o.jsx(ne,{path:"policy/new",element:o.jsx(jc,{})}),o.jsx(ne,{path:"policy/:templateId/edit",element:o.jsx(Vc,{})})]}):null,o.jsx(ne,{path:"promo",element:o.jsx(zi,{})}),U||x?o.jsxs(o.Fragment,{children:[o.jsx(ne,{path:"/",element:o.jsx(kn,{isPaymentDrawerOpen:!1})}),z&&g?o.jsx(ne,{path:"payment",element:o.jsx(kn,{isPaymentDrawerOpen:!0})}):null,o.jsx(ne,{path:"activate",element:o.jsx(Gi,{})}),o.jsx(ne,{path:"onboard",element:o.jsx(wi,{})}),C&&B!==!0?o.jsx(ne,{path:"new",element:o.jsx(Mi,{})}):C?o.jsx(ne,{path:"new",element:o.jsx(qe,{to:"..",replace:!0})}):null,_&&$?o.jsx(ne,{path:"cashback",element:o.jsx(Xc,{})}):null,E?o.jsx(ne,{path:"statements",element:o.jsx(Di,{})}):null,z&&b&&L?o.jsx(ne,{path:"payment-history",element:o.jsx(Ai,{})}):null,o.jsx(ne,{path:":cardId/activate",element:o.jsx(ai,{})}),o.jsx(ne,{path:":cardId/setPin",element:o.jsx(xi,{})}),o.jsx(ne,{path:":cardId/addToWallet",element:o.jsx(Wc,{})}),o.jsx(ne,{path:":cardId/*",element:o.jsx(ui,{})}),o.jsx(ne,{path:"*",element:o.jsx(ot,{})})]}):(F||w)&&C?o.jsx(ne,{path:"*",element:o.jsx(qe,{to:"../setup"})}):N?o.jsx(ne,{path:"*",element:o.jsx(qe,{to:"../promo",state:e.state})}):o.jsx(ne,{path:"*",element:null})]})}export{Id as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-CrgMd6cu.js";import{a as g}from"./sentry-C0JeJOxU.js";import{h as w,u as k,g as x,i as T,j as O,l as E}from"./core-CesISa_L.js";import{z as C,bp as F,a6 as P,k as A,S as V,q as b,bq as j,ac as L,aE as U,p as B}from"./index-D7arCk2M.js";import{fB as N,gF as M,AG as R,gA as _,c7 as G,X9 as z,bn as q,u1 as X,tR as Y,md as Z,nO as S,Xa as H,bE as $,cD as D,nZ as J,o7 as K}from"./zeni-epic-state-B9V6b-sD.js";import"./mui-DBCQIIXU.js";import{d as Q}from"./routePaths-Da5NL2pW.js";import{M as W}from"./MobileAppDrawer-DWfh55e9.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="daf62152-8d7b-42bd-8aaf-9adc11391803",n._sentryDebugIdIdentifier="sentry-dbid-daf62152-8d7b-42bd-8aaf-9adc11391803")}catch{}})();const ee=E((function(n){const t=_(n),i=C.getSignedInUser(),p=N(n),c=p.tenantId,l={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=G(p?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:l,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:q(i)}}),(function(n,t){const{companyId:i,currentTenant:p,navigate:c,location:l}=t,{tenantEmailDomain:f}=p;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(K())},onAddressClick:e=>{const a=Q(f,e),o=B(l.state?.pathnameStackToGoBack,l.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?D(u):void 0,meetingLink:y!=""&&y!=null?D(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n(H(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(Z({files:e}))},onDeleteFile:e=>{n(Y(e))},onEditFileName:(e,a)=>{n(X(e,a.split(".")[0]))}}}))(j);function de(){const n=w(),t=k(),i=x(),{tenantEmailDomain:p}=T(),[c,l]=g.useState(!1),[f,e]=g.useState(!1),a=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>N(s))),d=r.companyId??C.getSignedInUserTenant(p)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||a!=="Not-Started"||d==null||(l(!0),t(M(d)))}),[c,a,d,t]),g.useEffect((()=>{o==="Not-Started"&&t(R())}),[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:A,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as I}from"./liveblocks-CrgMd6cu.js";import{a as o}from"./sentry-C0JeJOxU.js";import{u as R,h as k,g as H,j as C,N as j}from"./core-CesISa_L.js";import{SV as q,fB as z,gh as G,pw as V,gJ as A,gg as B,ge as J,Tf as K,gd as O}from"./zeni-epic-state-B9V6b-sD.js";import{u as Q,z as E,L as D,G as M,K as W}from"./index-D7arCk2M.js";import{n as X}from"./mui-DBCQIIXU.js";import{P as h,a as _}from"./AccountMappingScreen-UrK9tRbM.js";import{t as Y}from"./getLocaleForTenant-ncGMGLNW.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-CfxNJwBb.js";import"./recharts-Bsi9TAsl.js";import"./analytics-F_dCijCm.js";import"./plaid-nYfe67yC.js";import"./dnd-C6bwm0uz.js";import"./stripe-cKAAJElX.js";import"./lottie-CKWYnB4Q.js";import"./lexical-BnZJ_Q_K.js";import"./pdf-CPWsdPSJ.js";import"./utils-DTqrFXzb.js";import"./MobileAppDrawer-DWfh55e9.js";import"./InboxNotificationsProvider-BzQISC6s.js";import"./useTaskManagerAccess-CCBB-yeF.js";import"./accountMappingHelper-uI5S9sNL.js";import"./empty-BU4Pahc0.js";import"./pdf-lib-BBXjnQzB.js";import"./index-CQe5P8WB.js";import"./url-oDWzN2ME.js";import"./index-D4vxEYY4.js";import"./decodeURIComponentSafe-B3NnThvD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="2090b9db-1f32-4376-a169-e6361ec22e6f",t._sentryDebugIdIdentifier="sentry-dbid-2090b9db-1f32-4376-a169-e6361ec22e6f")}catch{}})();const te=X.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1 1 auto;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
background-color: ${t=>t.theme.colors.background};
|
|
10
|
+
box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
+
`;function je(){const t=R(),i=k(),v=H(),{setLoading:c,clearAllLoading:m}=Q(),S=o.useRef(!1),b=o.useRef(!1),N=o.useRef(!1),p=o.useRef(!1),{code:U,realmId:$,state:L}=Z(v.search),f=U!==""&&$!==""&&L!=="";f&&(N.current=!0);const w=sessionStorage.getItem(h),u=w===_.pending,F=w===_.ready,x=C((s=>q(s))),e=C((s=>z(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,d=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{c(D.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(D.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,c]),o.useEffect((()=>{e.tenantId==null&&!b.current&&a!=null&&(b.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(V(a.userId)))}),[b,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(D.CONNECTION_AUTH),t(A(a.userId,e.tenantId)))}),[d]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(B(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),J(a?.userId,a?.zeniSessionId,e.tenantId),M.updateAppLocaleID(Y(K(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(A(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.tenantsCoreDetailsInOrder.length,n]);const T=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&d==="In-Progress"&&(p.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||T)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return p.current&&d==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):p.current&&d==="Error"?(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(f||N.current||p.current||y!==!0||(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,T,d,f,y,e.tenantEmailDomain,m,t,i]),T)return null;if(f||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const P=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return F?I.jsx(j,{to:P,replace:!0}):I.jsx(j,{to:"/",replace:!0})}export{je as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-CrgMd6cu.js";import{z as a}from"./index-D7arCk2M.js";import{g as n}from"./QBOConnectionScreen-CfxNJwBb.js";import"./sentry-C0JeJOxU.js";import{g as p,N as s}from"./core-CesISa_L.js";import"./zeni-epic-state-B9V6b-sD.js";import"./recharts-Bsi9TAsl.js";import"./mui-DBCQIIXU.js";import"./analytics-F_dCijCm.js";import"./plaid-nYfe67yC.js";import"./dnd-C6bwm0uz.js";import"./stripe-cKAAJElX.js";import"./lottie-CKWYnB4Q.js";import"./lexical-BnZJ_Q_K.js";import"./pdf-CPWsdPSJ.js";import"./utils-DTqrFXzb.js";import"./empty-BU4Pahc0.js";import"./pdf-lib-BBXjnQzB.js";import"./index-CQe5P8WB.js";import"./url-oDWzN2ME.js";import"./index-D4vxEYY4.js";import"./decodeURIComponentSafe-B3NnThvD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="c18cd95e-770d-4ff7-92bf-3374948ea538",t._sentryDebugIdIdentifier="sentry-dbid-c18cd95e-770d-4ff7-92bf-3374948ea538")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),d=a.getSignedInUser()?.userId??"";if(f(o,r,e,d)===!0){const m=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:m})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|