@zeniai/web-app-ui 5.1.84-qa → 5.1.85-dev

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.
Files changed (131) hide show
  1. package/dist/assets/AddressRoutes-DpMeCgDh.js +1 -0
  2. package/dist/assets/AddressScreen-jEbIVhK3.js +9 -0
  3. package/dist/assets/{AiCfoScreen-vm8TgXHz.js → AiCfoScreen-D2GxwJyN.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-FbpvVFpO.js → BillPayApprovalRoutes-Csh9SPnU.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-BBunGCd_.js → BillPayRoutes-Dg9I-63-.js} +12 -12
  6. package/dist/assets/{BusinessVerificationPageScreen-BemUa4lP.js → BusinessVerificationPageScreen-BLuK4dS7.js} +2 -2
  7. package/dist/assets/{CardsAiCfoScreen-DnFZCESR.js → CardsAiCfoScreen-D8ZPE13M.js} +1 -1
  8. package/dist/assets/{ChargeCardRoutes-CDBIrLG_.js → ChargeCardRoutes-CyGButQm.js} +11 -11
  9. package/dist/assets/{CompanyPassportScreen-DOwRqzCZ.js → CompanyPassportScreen--SPdIRlf.js} +1 -1
  10. package/dist/assets/{ConnectionAuthScreen-eSgLC-0p.js → ConnectionAuthScreen-C8nHjroP.js} +1 -1
  11. package/dist/assets/CustomerOnboardingAuthScreen-C6uz2GLr.js +1 -0
  12. package/dist/assets/CustomerOnboardingRoutes-Dk5stUMd.js +30 -0
  13. package/dist/assets/{DashboardRoutes-CMiZYJvT.js → DashboardRoutes-B2SXqHam.js} +3 -3
  14. package/dist/assets/{DefaultTenantHome-CN_7Hj_x.js → DefaultTenantHome-DDzJzPvG.js} +1 -1
  15. package/dist/assets/DomesticWireDetailScreen-DDaUfwcf.js +18 -0
  16. package/dist/assets/DrawerScreen-DZ4DkgHO.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-CFPPv2Q-.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-ja43rssL.js → ExpenseAutomationRoutes-B0EQq9x4.js} +1 -1
  19. package/dist/assets/FeaturePreviewScreen-Dgm-EaRp.js +1 -0
  20. package/dist/assets/{HubSpotOAuthCallbackScreen-C9y2gd0x.js → HubSpotOAuthCallbackScreen-DiHy3hck.js} +1 -1
  21. package/dist/assets/MagicLinkRoutes-CPrGkntv.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-BHI5Ju3h.js +12 -0
  23. package/dist/assets/MobileAppDrawer-ChAhLGZE.js +1 -0
  24. package/dist/assets/NotFoundScreen-By2F-w6l.js +1 -0
  25. package/dist/assets/{NotificationRoutes-zN961sSS.js → NotificationRoutes-0mjOYLwF.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-_yz0BOYy.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-CSm9JBFf.js +1 -0
  28. package/dist/assets/PeopleRoutes-DF4Scn5d.js +22 -0
  29. package/dist/assets/PerformanceRoutes-C0h70RAc.js +1 -0
  30. package/dist/assets/{Preview-ISngChjL.js → Preview-D29JeEmY.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-qYa7d8c5.js → QBOConnectionScreen-CwZNkZEW.js} +1 -1
  32. package/dist/assets/ReferralListScreen-C3Yy7aIK.js +5 -0
  33. package/dist/assets/{ReimbursementApprovalRoutes-DYomUyE_.js → ReimbursementApprovalRoutes-DAVTSD8z.js} +1 -1
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CYfGAlTN.js → ReimbursementApprovalRuleDetailScreen-CtUn349v.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes-Bq2oGVuB.js → ReimbursementRoutes-BYbEE0sN.js} +6 -6
  36. package/dist/assets/{ReportsRoutes-EvgLxoWK.js → ReportsRoutes-Cb8uSh4z.js} +1 -1
  37. package/dist/assets/RewardsRoutes-BqWi3Rha.js +1 -0
  38. package/dist/assets/ScreenRoutes-CFWhfVwu.js +2 -0
  39. package/dist/assets/{SettingsRoutes-Ex6tMm4V.js → SettingsRoutes-Dqo8Gg1_.js} +8 -8
  40. package/dist/assets/{SetupPagesScreen-arp-xD8G.js → SetupPagesScreen-Drdx2Cz2.js} +5 -5
  41. package/dist/assets/{SignInScreen-Cnen6_pH.js → SignInScreen-HaZFyYNm.js} +1 -1
  42. package/dist/assets/SignOutScreen-DGQ597Ur.js +9 -0
  43. package/dist/assets/{TaskListScreen-Dhy8ix5-.js → TaskListScreen-B2sNWFUZ.js} +2 -2
  44. package/dist/assets/TaskRoutes-DqlemW4d.js +9 -0
  45. package/dist/assets/{TransactionDetailRoutes-DKxOtjev.js → TransactionDetailRoutes-BBXGE-Zw.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-_im9Z8Wp.js → TransactionDetailScreen-D7m7OZhn.js} +2 -2
  47. package/dist/assets/{TransactionListRoutes-B1LNvKrw.js → TransactionListRoutes-C8nLf9Ob.js} +1 -1
  48. package/dist/assets/{TreasuryRoutes-KyOcUpTl.js → TreasuryRoutes-CAqMFzPt.js} +6 -6
  49. package/dist/assets/{VendorsRoutes-DXrOiAFt.js → VendorsRoutes-kgQCFQez.js} +1 -1
  50. package/dist/assets/WiseConfirmationScreen-Dj8vTbGW.js +12 -0
  51. package/dist/assets/{ZeniAccountRoutes-B0cjJSze.js → ZeniAccountRoutes-B85icQ0n.js} +11 -11
  52. package/dist/assets/ZeniAccountStatementScreen-CPK7RprH.js +9 -0
  53. package/dist/assets/{accountMappingHelper-D2RcsfN-.js → accountMappingHelper-B3v4RMhl.js} +1 -1
  54. package/dist/assets/{analytics-tFci0ZBb.js → analytics-7PXXxPIN.js} +1 -1
  55. package/dist/assets/{analyticsHelper-ChmdJD3i.js → analyticsHelper-Ce6ZNBVM.js} +1 -1
  56. package/dist/assets/{core-DeUqRkPV.js → core-BDPZcSG4.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-CyCKv9fm.js → decodeURIComponentSafe-BR3AOxh5.js} +1 -1
  58. package/dist/assets/{dnd-D4M435ki.js → dnd-fU8QmJ8U.js} +1 -1
  59. package/dist/assets/{empty-BH80piSN.js → empty-CM59KsLF.js} +1 -1
  60. package/dist/assets/{empty-CATUDLyl.js → empty-DridEUN5.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-D3zWnZNH.js → emptyVideoElement--ZfOaFPu.js} +1 -1
  62. package/dist/assets/epic-D7C6_Y7q.js +2 -0
  63. package/dist/assets/getLocaleForTenant-5gC9KZpR.js +1 -0
  64. package/dist/assets/{index-Cg4JV2tz.js → index-B1tuor_E.js} +15819 -15778
  65. package/dist/assets/{index-CdJHhYvK.js → index-BAkEFBVP.js} +1 -1
  66. package/dist/assets/{index-Cui_f-re.js → index-BEZZznbS.js} +2 -2
  67. package/dist/assets/{index-DQY0qMVc.js → index-BZG4Ai-c.js} +1 -1
  68. package/dist/assets/{index-Ba2LM3_a.js → index-CAEfbAkM.js} +1 -1
  69. package/dist/assets/{index-BzKh0w9C.js → index-DA1h5kq3.js} +1 -1
  70. package/dist/assets/{index-DMEUlT9B.js → index-DNm9oOTV.js} +1 -1
  71. package/dist/assets/{index-BXpflzP0.js → index-TPK5ayqQ.js} +1 -1
  72. package/dist/assets/{lexical-Crk5An9T.js → lexical-_D-pPLdL.js} +1 -1
  73. package/dist/assets/{liveblocks-BPCHZ54B.js → liveblocks-B2nLBm11.js} +1 -1
  74. package/dist/assets/{lottie-DQW6ZBGJ.js → lottie--jYlW6ya.js} +1 -1
  75. package/dist/assets/{mui-DAoDgA6_.js → mui-HaM5aBuG.js} +1 -1
  76. package/dist/assets/{pathToGoBack-DmHMCg55.js → pathToGoBack-Bp5QCbKd.js} +1 -1
  77. package/dist/assets/{pdf-BmUuf0hA.js → pdf-CbrAe2yy.js} +3 -3
  78. package/dist/assets/{pdf-lib-CMNFUiif.js → pdf-lib-CHfVanCJ.js} +1 -1
  79. package/dist/assets/{plaid-DZBIDYbN.js → plaid-DuKDxXr2.js} +1 -1
  80. package/dist/assets/{pusher-DD0rfcGn.js → pusher-p1571_5u.js} +1 -1
  81. package/dist/assets/{react-1LeuQGyO.js → react-BvU2rtwe.js} +1 -1
  82. package/dist/assets/{react-CtScDveW.js → react-BzGU_BeP.js} +1 -1
  83. package/dist/assets/{react-CnUKx70_.js → react-CXLD6oJa.js} +1 -1
  84. package/dist/assets/{react-RNiFReiF.js → react-D7-m9gXP.js} +1 -1
  85. package/dist/assets/{react-DaxHAkja.js → react-DZP7sDw7.js} +1 -1
  86. package/dist/assets/{react-BGma4OjX.js → react-Di2JdnAu.js} +1 -1
  87. package/dist/assets/{recharts-Cfsnd24w.js → recharts-srrgu-jp.js} +1 -1
  88. package/dist/assets/{routePaths-ZBpdAu85.js → routePaths-DbVBNvPC.js} +1 -1
  89. package/dist/assets/{sentry-BRxO83Sz.js → sentry-CLlo3TXi.js} +1 -1
  90. package/dist/assets/{url-Ddgc_6Ci.js → url-DqIeqdCZ.js} +1 -1
  91. package/dist/assets/{url-BNgn1u9R.js → url-ky0ROLAQ.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CBYHTRds.js → useAiCfoDashboardSuggestedQuestionsChips-Dpypv2iO.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-CtdOXC4O.js +1 -0
  94. package/dist/assets/useCashManagementBanner-DTfbqox_.js +1 -0
  95. package/dist/assets/{useChargeCardPusherEvents-V_hkDTjD.js → useChargeCardPusherEvents-BSAOVtAf.js} +1 -1
  96. package/dist/assets/{useDeviceId-CqK68Bon.js → useDeviceId-CQ3pf2OT.js} +1 -1
  97. package/dist/assets/useEmailConnectResultRefresh-7EeCPqR2.js +1 -0
  98. package/dist/assets/{useInitialThreadRequest-ezroE2PL.js → useInitialThreadRequest-DaoYHqyn.js} +1 -1
  99. package/dist/assets/{utils-CliqhjB9.js → utils-BPOASmy-.js} +1 -1
  100. package/dist/assets/{withTransactionSidePanel-C46PLUnx.js → withTransactionSidePanel-DKz4VB48.js} +3 -3
  101. package/dist/assets/{zeni-epic-state-RQhLkJm1.js → zeni-epic-state-pQFlpfOQ.js} +6 -6
  102. package/dist/index.html +1 -1
  103. package/package.json +4 -4
  104. package/dist/assets/AddressRoutes-Ccf9Jzub.js +0 -1
  105. package/dist/assets/AddressScreen-LMssN7FX.js +0 -9
  106. package/dist/assets/CustomerOnboardingAuthScreen-ncY-NEh-.js +0 -1
  107. package/dist/assets/CustomerOnboardingRoutes-B7lDaTsh.js +0 -30
  108. package/dist/assets/DomesticWireDetailScreen-Cv3NmzhE.js +0 -18
  109. package/dist/assets/DrawerScreen-BhiWQ24H.js +0 -1
  110. package/dist/assets/EntityDetailRoutes-ByTo3npP.js +0 -1
  111. package/dist/assets/FeaturePreviewScreen-C06JMkep.js +0 -1
  112. package/dist/assets/MagicLinkRoutes-J_peQ2Kr.js +0 -72
  113. package/dist/assets/MagicLinkSignInScreen-BrcIm0S_.js +0 -12
  114. package/dist/assets/MobileAppDrawer-Dq7Q8eux.js +0 -1
  115. package/dist/assets/NotFoundScreen-Pc5_gWES.js +0 -1
  116. package/dist/assets/OAuthConsentScreen-BcIsICN8.js +0 -1
  117. package/dist/assets/PandLWithForecastRoutes-CH-3rMiZ.js +0 -1
  118. package/dist/assets/PeopleRoutes-DoKx4_Vx.js +0 -22
  119. package/dist/assets/PerformanceRoutes-CY0ggQd1.js +0 -1
  120. package/dist/assets/ReferralListScreen-Ag_OjFfe.js +0 -5
  121. package/dist/assets/RewardsRoutes-ChURoNZ3.js +0 -1
  122. package/dist/assets/ScreenRoutes-5hQmRTrc.js +0 -2
  123. package/dist/assets/SignOutScreen-DL3hdB8P.js +0 -9
  124. package/dist/assets/TaskRoutes-Be5K8H0B.js +0 -9
  125. package/dist/assets/WiseConfirmationScreen-KzsdBPe6.js +0 -12
  126. package/dist/assets/ZeniAccountStatementScreen-z_z-XrxU.js +0 -9
  127. package/dist/assets/epic-PiSl2fGp.js +0 -2
  128. package/dist/assets/getLocaleForTenant-D1Wuxi1h.js +0 -1
  129. package/dist/assets/useAskAiCfoHostNavButtonProps-Be_j-VoW.js +0 -1
  130. package/dist/assets/useCashManagementBanner-Cn0LqRpJ.js +0 -1
  131. package/dist/assets/useEmailConnectResultRefresh-4EEjP-eP.js +0 -1
@@ -1,7 +1,7 @@
1
- import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as he,i as Ve,N as oa,s as _t,n as Pe,t as An,o as ts,p as ce}from"./core-DeUqRkPV.js";import{f8 as Pt,RT as ns,fk as wt,bt as Fe,RU as rs,RV as ss,eZ as pn,RW as Dn,f6 as _n,RX as Pn,RY as wn,RZ as vn,R_ as Tn,f7 as Fn,fj as xn,R$ as Bn,S0 as cs,fd as os,fc as is,S1 as ds,C2 as Rn,fm as ia,S2 as ls,S3 as us,e$ as ms,e_ as Cs,fz as Ye,ff as Ln,fe as On,S4 as ps,fg as hs,Bz as fs,By as gs,BC as Ss,BE as bs,fs as ys,eW as Un,S5 as Is,S6 as ks,fx as jn,S7 as Es,fy as yt,BK as As,BH as Ds,eX as ge,S8 as qa,fC as xe,fD as Be,fE as Re,gw as da,cv as la,S9 as ua,Sa as vt,uQ as $a,kF as za,Sb as Ya,Ci as ka,fn as Qe,Ck as Tt,kv as Mn,Sc as ma,C6 as _a,Sd as _s,Se as Ps,C9 as Qa,Sf as ws,Qf as Xa,fi as Nn,Cf as Sa,hV as vs,Sg as Vn,f9 as Ca,bo as Ts,Sh as Fs,gh as Ja,gg as et,CO as xs,gf as at,PX as Bs,Si as Hn,co as Gn,cQ as Rs,Qe as wa,Dn as $n,Sj as hn,CZ as Pa,Sk as zn,Do as Ls,QD as Os,Dp as Us,Eu as js,ub as Ms,Eo as Ns,Sl as Vs,Cj as sa,Sm as Hs,Sn as Gs,So as $s,Sp as zs,Sq as Ys,Sr as Ft,Ss as Ks,Cz as Yn,Cs as Zs,St as Ws,gy as qs,CI as Kn,CM as Zn,gx as Qs,Su as Xs,D9 as Wn,Sv as Js,Sw as ec,Sx as ac,CK as qn,Cv as Qn,Cc as Xn,CE as Jn,CC as er,CG as tc,Sy as ar,Sz as nc,fu as rc,fv as sc,fw as cc,SA as tt,fo as tr,cS as xt,SB as oc,SC as ic,SD as dc,SE as lc,CU as It,Dg as uc,Dc as mc,CQ as Cc,De as pc,D4 as hc,D6 as fc,SF as nr,Dm as Ga,Kd as gc,SG as Sc,SH as bc,SI as yc,SJ as rr,SK as Ic,DJ as kc,CY as sr,CT as Ne,CX as Ec,SL as Ac,SM as Dc,C3 as _c,SN as cr,fh as or,SO as Pc,C5 as wc,C4 as fn,SP as vc,SQ as Tc,SR as Fc,MK as xc,SS as Bt,ST as Bc,xR as ir,ld as Rc,hL as Lc,DO as Oc,SU as dr,f3 as Uc,f4 as jc,SV as Mc,dj as Nc,fl as Vc,DE as Hc,Dy as qe,bs as Gc,bJ as $c,cA as zc,bK as Yc,LX as Kc}from"./zeni-epic-state-RQhLkJm1.js";import{I as Le,cq as lr,s as we,cr as ur,cs as mr,ct as Zc,a as Je,$ as Rt,cu as Wc,cv as qc,X as Cr,c as pr,_ as hr,v as ye,Q as ue,e as K,aq as ya,cw as fr,cx as Qc,cy as Xc,z as te,y as va,cf as nt,cz as Jc,cA as eo,cB as ao,Z as Ta,aR as Ke,bs as Lt,cC as to,D as Fa,n as rt,m as Ot,f as J,a8 as st,cD as no,bF as ba,cE as kt,cF as ro,J as Ut,cG as so,at as gr,a3 as Et,cH as co,Y as Sr,h as br,cI as oo,cJ as io,cK as lo,cL as uo,cM as mo,cN as Co,o as Ka,cO as po,cP as ho,cQ as ht,A as fo,cR as go,cS as So,cT as bo,cU as yo,cV as Io,i as ko}from"./index-Cg4JV2tz.js";import{n as He,D as yr,S as Eo}from"./mui-DAoDgA6_.js";import{a as r}from"./sentry-BRxO83Sz.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-Be_j-VoW.js";import{M as Ie}from"./MobileAppDrawer-Dq7Q8eux.js";import{d as jt}from"./recharts-Cfsnd24w.js";import{g as _e,a as Ba,b as Ir,c as Oe,d as Ue,e as Xe,f as ea,h as aa,A as Ao,i as Mt,P as Do,j as Nt,s as Ia,k as kr,l as ca,m as Er,n as _o,o as Ar,p as Po,S as gn}from"./SetupPagesScreen-arp-xD8G.js";import{u as Dr}from"./useInitialThreadRequest-ezroE2PL.js";import ct from"./NotFoundScreen-Pc5_gWES.js";import{u as Vt}from"./useChargeCardPusherEvents-V_hkDTjD.js";import{n as Sn}from"./utils-CliqhjB9.js";import{t as wo}from"./AddressScreen-LMssN7FX.js";import"./analytics-tFci0ZBb.js";import"./plaid-DZBIDYbN.js";import"./dnd-D4M435ki.js";import"./stripe-DMRn4zHo.js";import"./lottie-DQW6ZBGJ.js";import"./lexical-Crk5An9T.js";import"./pdf-BmUuf0hA.js";import"./analyticsHelper-ChmdJD3i.js";import"./routePaths-ZBpdAu85.js";import"./BusinessVerificationPageScreen-BemUa4lP.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="37cc87da-9aaf-41ff-976a-ab3db272268a",e._sentryDebugIdIdentifier="sentry-dbid-37cc87da-9aaf-41ff-976a-ab3db272268a")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Pr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>ns(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:bn}}}=Je.getLocalizedStrings(),To=e=>Ln(e,!1),Fo=e=>On(e.name,!1);function xo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(rs()),a(ss()),a(pn())},[a]);const v=i(A=>Dn(A.cardPolicyState)),m=i(A=>_n(A.cardPolicyState)),M=i(A=>Pn(A.cardPolicyState)),B=i(A=>wn(A.cardPolicyState)),R=i(A=>vn(A.cardPolicyState)),p=i(A=>Tn(A.cardPolicyState)),h=i(A=>Fn(A.cardPolicyState)),T=i(A=>Pt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),w=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(xn())},[a,v]),Pr();const E=i(A=>Bn(A.createCardPolicyState)),U=i(A=>cs(A.createCardPolicyState)),y=i(A=>os(A.cardPolicyState)),k=i(A=>is(A.cardPolicyState)),x=i(A=>ds(A.createCardPolicyState)),d=i(A=>Rn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>m.map(To),[m]),j=r.useMemo(()=>h.map(Fo),[h]),H=r.useMemo(()=>d.cards.filter(A=>!lr(A.status.code)).map(_r),[d.cards]),O=v==="Completed"&&d.fetchState==="Completed"&&w==="Completed";r.useEffect(()=>{O&&x==null&&a(ls({cardsMasterList:H,defaultRequireReceiptAmount:l,suggestedAllowMerchants:M,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[w,a,O,x,H,l,M,B,R,p]);const L=r.useMemo(()=>jt(A=>{a(wt(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),$=E.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const A=we(n.state?.pathnameStackToGoBack),W=A.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(A=>{a(us(A))},[a]),I=r.useCallback(A=>{const W=ur(A);a(ms({templates:[W]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(Cs(A))},[a]),Z=r.useCallback(()=>{a(pn())},[a]),X=r.useRef($);r.useEffect(()=>{const A=X.current;X.current=$,$==="Completed"&&A!=="Completed"&&U!=null&&(a(Ye({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?E.error?.message??bn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:bn.createPageTitle,onBackClick:D,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Zc,{formDraft:x,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:y,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:u,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Z})]}):c.jsx(oa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Bo}}}=Je.getLocalizedStrings(),Ro=e=>Ln(e,!1),Lo=e=>On(e.name,!1);function Oo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),b=Le(),g=Fe(b?.loggedInUserRoleMap),[S,P]=r.useState(!1),u=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ps(o)),M=i(o=>Dn(o.cardPolicyState)),B=i(o=>_n(o.cardPolicyState)),R=i(o=>Pn(o.cardPolicyState)),p=i(o=>wn(o.cardPolicyState)),h=i(o=>vn(o.cardPolicyState)),T=i(o=>Tn(o.cardPolicyState)),l=i(o=>Fn(o.cardPolicyState)),w=i(o=>Pt(o.cardPolicyState)),E=i(o=>Rn(o)),U=i(o=>a!=null?hs(o.cardPolicyState,a):void 0),y=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?fs(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(gs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(xn())},[s,M]),Pr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{E.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[E.fetchState,s]);const x=r.useMemo(()=>B.map(Ro),[B]),d=r.useMemo(()=>l.map(Lo),[l]),f=r.useMemo(()=>E.cards.filter(o=>!lr(o.status.code)).map(_r),[E.cards]);Rt({isDataReady:y!=null});const j=r.useMemo(()=>{if(y!=null)return Wc({draft:y,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[y,f,x,d,k,R,p,h,T]),[H,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||H!=null||j==null||(L.current=!0,O(j))},[H,j]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=m.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),A=o.poppedPathname??G;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const A=ur(o);s(Ss(A)),s(bs(a))},[s,a]),Z=r.useRef(D);r.useEffect(()=>{const o=Z.current;Z.current=D,D==="Completed"&&o!=="Completed"&&(s(Ye({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?m.updateFetchState.error?.message??Bo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(oa,{to:"..",replace:!0}):H!=null&&M==="Completed"&&E.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(qc,{templateName:m.template?.name??"",formDraft:H,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:v,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:v})]})}function wr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function vr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(ys(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=Je.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=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:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),u=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=C(K.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Is(_)),R=i(_=>Bn(_.createCardPolicyState)),p=i(_=>ks(_.createCardPolicyState)),h=i(_=>p==null?[]:jn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,l=i(_=>Es(_.createCardPolicyState)),w=ya(R.fetchState);r.useEffect(()=>{if(w==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:l,kind:"created_policy"}))});else if(w==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:Je.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ye({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,l,h,w]);const E=B.fetchState.fetchState;r.useEffect(()=>{E!=="Not-Started"&&E!=="Error"||a(As())},[a,E]);const U=B.archiveFetchState.fetchState,y=ya(U);r.useEffect(()=>{y==="In-Progress"&&U==="Completed"&&a(Ye({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,y]);const k=r.useMemo(()=>B.templates.map(No),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=k.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Z}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=Cr(),A=pr(),W=hr(),ne=i(oe=>Un(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=vr("card_policy"),ve=r.useMemo(()=>wr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=W&&A&&Z!=null&&!X,re=r.useCallback(oe=>{if(Z==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Z}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Z]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:b,isFileUploadEnabled:F}),f=v&&d!=null?c.jsx(fr,{...d}):null,j=m&&f==null,H=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(Ds(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Qc,{onBackClick:H,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{policies:k,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:H,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:M})]})}function Ho(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),b=Le(),g=Fe(b?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(K.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(K.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),l=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:v,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),w=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(q=>da(q,s.companyId)),U=la(E.controllers),{creditAccount:y,creditAccountRepayment:k}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&l&&m,f=i(q=>vt(q,n,d,l)),[j,H]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Z=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(u(!0),setTimeout(()=>{t(Ya()),Z&&t(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Z]),r.useEffect(()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(H(!0),t(ka(n,d,!1)))},[j,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Mn())},[y.fetchState,k.fetchState,t,l,m,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ya());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Xe(l,T,w,m),W=Ba(l,m,g,y,k),ne=Ir(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Jc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:y,classListFetchState:x,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Tr="charge-card-transaction-update",Fr="charge-card-transaction-created",xr="charge-card-transaction-declined",Br="charge-card-transaction-updated",Rr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Go="charge-card-department-updated",Lr="charge-card-repayment-completed",Or="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ra],zo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(_s({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Yo(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(M=>ge(M)),{useFeatureGate:b}=ue(),{isFeatureEnabled:g}=b(K.isCardsCommentingEnabled),[S,P]=r.useState(!1),u=i(M=>ma(M)),C=Dr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback(()=>{const M=we(t.state?.pathnameStackToGoBack),B=M.poppedPathname??Ko(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(Vt({events:ha(v,$o),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(zo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(eo,{onBackClick:F})}const Ko=e=>`/${e}/cards`,Zo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ke.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Ps(I,s)),l=T.chargeCard,w=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:E}=ue(),{isFeatureEnabled:U}=E(K.isChargeCardFeatureEnabled),{isFeatureEnabled:y}=E(K.isDebitCardFeatureEnabled),k=Re(y,R),x=Oe({isDebitCardFeatureEnabled:y,isBankingOnlyTenant:k}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),j=xe(R),H=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:U,isBookKeepingTenant:H,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&w!=="In-Progress"&&w!=="Completed"&&(t(Qa()),P(!0)),u===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,T.fetchState,S,w]);const $=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(ws({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,l?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Nn(I.userState,B.userId)),G=()=>{l?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),v(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=I=>{M(I)};if(w!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Xo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(qo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=vs(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const g=Vn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let u=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ts())||C,showMenuIcon:u,shippingAddress:b,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(xs(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(Fs({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(to),Qo=He.div`
1
+ import{j as c}from"./liveblocks-B2nLBm11.js";import{u as me,j as i,h as le,g as he,i as Ve,N as oa,s as _t,n as Pe,t as An,o as ts,p as ce}from"./core-BDPZcSG4.js";import{f8 as Pt,RT as ns,fk as wt,bt as Fe,RU as rs,RV as ss,eZ as pn,RW as Dn,f6 as _n,RX as Pn,RY as wn,RZ as vn,R_ as Tn,f7 as Fn,fj as xn,R$ as Bn,S0 as cs,fd as os,fc as is,S1 as ds,C2 as Rn,fm as ia,S2 as ls,S3 as us,e$ as ms,e_ as Cs,fz as Ke,ff as Ln,fe as On,S4 as ps,fg as hs,Bz as fs,By as gs,BC as Ss,BE as bs,fs as ys,eW as Un,S5 as Is,S6 as ks,fx as jn,S7 as Es,fy as yt,BK as As,BH as Ds,eX as ge,S8 as qa,fC as xe,fD as Be,fE as Re,gw as da,cv as la,S9 as ua,Sa as vt,uQ as $a,kF as za,Sb as Ka,Ci as ka,fn as Qe,Ck as Tt,kv as Mn,Sc as ma,C6 as _a,Sd as _s,Se as Ps,C9 as Qa,Sf as ws,Qf as Xa,fi as Nn,Cf as Sa,hV as vs,Sg as Vn,f9 as Ca,bo as Ts,Sh as Fs,gh as Ja,gg as et,CO as xs,gf as at,PX as Bs,Si as Hn,co as Gn,cQ as Rs,Qe as wa,Dn as $n,Sj as hn,CZ as Pa,Sk as zn,Do as Ls,QD as Os,Dp as Us,Eu as js,ub as Ms,Eo as Ns,Sl as Vs,Cj as sa,Sm as Hs,Sn as Gs,So as $s,Sp as zs,Sq as Ks,Sr as Ft,Ss as Zs,Cz as Kn,Cs as Ys,St as Ws,gy as qs,CI as Zn,CM as Yn,gx as Qs,Su as Xs,D9 as Wn,Sv as Js,Sw as ec,Sx as ac,CK as qn,Cv as Qn,Cc as Xn,CE as Jn,CC as er,CG as tc,Sy as ar,Sz as nc,fu as rc,fv as sc,fw as cc,SA as tt,fo as tr,cS as xt,SB as oc,SC as ic,SD as dc,SE as lc,CU as It,Dg as uc,Dc as mc,CQ as Cc,De as pc,D4 as hc,D6 as fc,SF as nr,Dm as Ga,Kd as gc,SG as Sc,SH as bc,SI as yc,SJ as rr,SK as Ic,DJ as kc,CY as sr,CT as Ne,CX as Ec,SL as Ac,SM as Dc,C3 as _c,SN as cr,fh as or,SO as Pc,C5 as wc,C4 as fn,SP as vc,SQ as Tc,SR as Fc,MK as xc,SS as Bt,ST as Bc,xR as ir,ld as Rc,hL as Lc,DO as Oc,SU as dr,f3 as Uc,f4 as jc,SV as Mc,dj as Nc,fl as Vc,DE as Hc,Dy as qe,bs as Gc,bJ as $c,cA as zc,bK as Kc,LX as Zc}from"./zeni-epic-state-pQFlpfOQ.js";import{k as Le,cq as lr,q as we,cr as ur,cs as mr,ct as Yc,a as Je,$ as Rt,cu as Wc,cv as qc,X as Cr,c as pr,Z as hr,r as ye,V as ue,Q as Z,aq as ya,cw as fr,cx as Qc,cy as Xc,z as te,B as va,cf as nt,cz as Jc,cA as eo,cB as ao,K as Ta,aR as Ze,bs as Lt,cC as to,x as Fa,m as rt,y as Ot,d as J,a8 as st,cD as no,bF as ba,cE as kt,cF as ro,v as Ut,cG as so,at as gr,a3 as Et,cH as co,Y as Sr,f as br,cI as oo,cJ as io,cK as lo,cL as uo,cM as mo,cN as Co,o as Za,cO as po,cP as ho,cQ as ht,T as fo,cR as go,cS as So,cT as bo,cU as yo,cV as Io,i as ko}from"./index-B1tuor_E.js";import{n as He,D as yr,S as Eo}from"./mui-HaM5aBuG.js";import{a as r}from"./sentry-CLlo3TXi.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-CtdOXC4O.js";import{M as Ie}from"./MobileAppDrawer-ChAhLGZE.js";import{d as jt}from"./recharts-srrgu-jp.js";import{g as _e,a as Ba,b as Ir,c as Oe,d as Ue,e as Xe,f as ea,h as aa,A as Ao,i as Mt,P as Do,j as Nt,s as Ia,k as kr,l as ca,m as Er,n as _o,o as Ar,p as Po,S as gn}from"./SetupPagesScreen-Drdx2Cz2.js";import{u as Dr}from"./useInitialThreadRequest-DaoYHqyn.js";import ct from"./NotFoundScreen-By2F-w6l.js";import{u as Vt}from"./useChargeCardPusherEvents-BSAOVtAf.js";import{n as Sn}from"./utils-BPOASmy-.js";import{t as wo}from"./AddressScreen-jEbIVhK3.js";import"./analytics-7PXXxPIN.js";import"./plaid-DuKDxXr2.js";import"./dnd-fU8QmJ8U.js";import"./stripe-DMRn4zHo.js";import"./lottie--jYlW6ya.js";import"./lexical-_D-pPLdL.js";import"./pdf-CbrAe2yy.js";import"./analyticsHelper-Ce6ZNBVM.js";import"./routePaths-DbVBNvPC.js";import"./BusinessVerificationPageScreen-BLuK4dS7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3f9c1a95-3062-4553-a640-d91aa0c65eb1",e._sentryDebugIdIdentifier="sentry-dbid-3f9c1a95-3062-4553-a640-d91aa0c65eb1")}catch{}})();const vo=e=>{const n=e.cardHolderUser,t=`${n.firstName??""} ${n.lastName??""}`.trim()||n.email||n.userId;return{userId:n.userId,displayName:t,roleLabel:e.cardHolderRoles?.titleAtCompany}},_r=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:vo(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Pr(){const e=me(),n=i(a=>Pt(a.cardPolicyState)),t=i(a=>ns(a.cardPolicyState));r.useEffect(()=>{t!==""||n==="Completed"&&t===""||n==="In-Progress"||e(wt())},[e,n,t])}const{spendManagement:{chargeCard:{cardPolicyPage:bn}}}=Je.getLocalizedStrings(),To=e=>Ln(e,!1),Fo=e=>On(e.name,!1);function xo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(A=>{S(A)},[]),u=r.useCallback(()=>{P(!0)},[P]),{isAiCfoAccessEnabled:C,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect(()=>()=>{a(rs()),a(ss()),a(pn())},[a]);const v=i(A=>Dn(A.cardPolicyState)),m=i(A=>_n(A.cardPolicyState)),M=i(A=>Pn(A.cardPolicyState)),B=i(A=>wn(A.cardPolicyState)),R=i(A=>vn(A.cardPolicyState)),p=i(A=>Tn(A.cardPolicyState)),h=i(A=>Fn(A.cardPolicyState)),T=i(A=>Pt(A.cardPolicyState)),l=i(A=>A.chargeCardConfigState.receiptRequiredAboveAmount.amount),w=i(A=>A.chargeCardConfigState.fetchState);r.useEffect(()=>{v!=="Completed"&&v!=="In-Progress"&&a(xn())},[a,v]),Pr();const E=i(A=>Bn(A.createCardPolicyState)),U=i(A=>cs(A.createCardPolicyState)),y=i(A=>os(A.cardPolicyState)),k=i(A=>is(A.cardPolicyState)),x=i(A=>ds(A.createCardPolicyState)),d=i(A=>Rn(A));r.useEffect(()=>{d.fetchState==="Not-Started"&&a(ia(!1,!1,!1))},[d.fetchState,a]);const f=r.useMemo(()=>m.map(To),[m]),j=r.useMemo(()=>h.map(Fo),[h]),H=r.useMemo(()=>d.cards.filter(A=>!lr(A.status.code)).map(_r),[d.cards]),O=v==="Completed"&&d.fetchState==="Completed"&&w==="Completed";r.useEffect(()=>{O&&x==null&&a(ls({cardsMasterList:H,defaultRequireReceiptAmount:l,suggestedAllowMerchants:M,suggestedBlockMerchants:B,suggestedAllowCategories:R,suggestedBlockCategories:p}))},[w,a,O,x,H,l,M,B,R,p]);const L=r.useMemo(()=>jt(A=>{a(wt(A))},250),[a]);r.useEffect(()=>()=>{L.cancel()},[L]);const z=r.useCallback(A=>{L(A)},[L]),$=E.fetchState,_=t!=null?`/${t}/cards/policy`:"..",D=r.useCallback(()=>{const A=we(n.state?.pathnameStackToGoBack),W=A.poppedPathname??_;e(W,{state:{pathnameStackToGoBack:A.newStack}})},[n.state,e,_]),G=r.useCallback(()=>{e(_)},[e,_]),Q=r.useCallback(A=>{a(us(A))},[a]),I=r.useCallback(A=>{const W=ur(A);a(ms({templates:[W]}))},[a]),N=r.useCallback(A=>{A.length!==0&&a(Cs(A))},[a]),Y=r.useCallback(()=>{a(pn())},[a]),X=r.useRef($);r.useEffect(()=>{const A=X.current;X.current=$,$==="Completed"&&A!=="Completed"&&U!=null&&(a(Ke({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(_))},[a,$,U,e,_]);const o=$==="Error"?E.error?.message??bn.createPolicyGenericErrorMessage:void 0;return b&&t!=null?x==null?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(mr,{showUploadDocumentSection:!0,navBarTitle:bn.createPageTitle,onBackClick:D,onClickMenuIcon:u,isAiCfoAccessEnabled:C,onAskAiCfoClick:F})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Yc,{formDraft:x,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:T==="In-Progress",onVendorSearchTextChange:z,submitState:$,submitErrorMessage:o,documentUploadState:y,uploadedFileName:k,isAiCfoAccessEnabled:C,onAskAiCfoClick:F,onBackClick:D,onCancelClick:G,onClickMenuIcon:u,onFormChange:Q,onSubmit:I,onUploadDocument:N,onRemoveDocument:Y})]}):c.jsx(oa,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:Bo}}}=Je.getLocalizedStrings(),Ro=e=>Ln(e,!1),Lo=e=>On(e.name,!1);function Oo(){const e=le(),n=he(),{tenantEmailDomain:t,templateId:a}=Ve(),s=me(),b=Le(),g=Fe(b?.loggedInUserRoleMap),[S,P]=r.useState(!1),u=r.useCallback(o=>{P(o)},[]),C=r.useCallback(()=>{u(!0)},[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),m=i(o=>ps(o)),M=i(o=>Dn(o.cardPolicyState)),B=i(o=>_n(o.cardPolicyState)),R=i(o=>Pn(o.cardPolicyState)),p=i(o=>wn(o.cardPolicyState)),h=i(o=>vn(o.cardPolicyState)),T=i(o=>Tn(o.cardPolicyState)),l=i(o=>Fn(o.cardPolicyState)),w=i(o=>Pt(o.cardPolicyState)),E=i(o=>Rn(o)),U=i(o=>a!=null?hs(o.cardPolicyState,a):void 0),y=r.useMemo(()=>m.templateId===a&&m.formDraft!=null?m.formDraft:U!=null?fs(U):void 0,[m.templateId,m.formDraft,U,a]);r.useEffect(()=>{if(a==null)return;const o=m.detailFetchState.fetchState;m.templateId===a&&(o==="Completed"||o==="In-Progress")||U!=null||s(gs(a))},[s,a,m.templateId,m.detailFetchState.fetchState,U]),r.useEffect(()=>{M!=="Completed"&&M!=="In-Progress"&&s(xn())},[s,M]),Pr();const k=i(o=>o.chargeCardConfigState.receiptRequiredAboveAmount.amount);r.useEffect(()=>{E.fetchState==="Not-Started"&&s(ia(!1,!1,!1))},[E.fetchState,s]);const x=r.useMemo(()=>B.map(Ro),[B]),d=r.useMemo(()=>l.map(Lo),[l]),f=r.useMemo(()=>E.cards.filter(o=>!lr(o.status.code)).map(_r),[E.cards]);Rt({isDataReady:y!=null});const j=r.useMemo(()=>{if(y!=null)return Wc({draft:y,cardRows:f,categorySearchOptions:x,vendorSearchOptions:d,defaultRequireReceiptAmount:k,suggestedAllowMerchants:R,suggestedBlockMerchants:p,suggestedAllowCategories:h,suggestedBlockCategories:T})},[y,f,x,d,k,R,p,h,T]),[H,O]=r.useState(void 0),L=r.useRef(!1);r.useEffect(()=>{L.current||H!=null||j==null||(L.current=!0,O(j))},[H,j]);const z=r.useCallback(o=>{O(o)},[]),$=r.useMemo(()=>jt(o=>{s(wt(o))},250),[s]);r.useEffect(()=>()=>{$.cancel()},[$]);const _=r.useCallback(o=>{$(o)},[$]),D=m.updateFetchState.fetchState,G=t!=null?`/${t}/cards/policy`:"..",Q=r.useCallback(()=>{const o=we(n.state?.pathnameStackToGoBack),A=o.poppedPathname??G;e(A,{state:{pathnameStackToGoBack:o.newStack}})},[n.state,e,G]),I=r.useCallback(()=>{e(G)},[e,G]),N=r.useCallback(o=>{if(a==null)return;const A=ur(o);s(Ss(A)),s(bs(a))},[s,a]),Y=r.useRef(D);r.useEffect(()=>{const o=Y.current;Y.current=D,D==="Completed"&&o!=="Completed"&&(s(Ke({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(G))},[s,D,e,G]);const X=D==="Error"?m.updateFetchState.error?.message??Bo.updatePolicyGenericErrorMessage:void 0;return!g||t==null||a==null?c.jsx(oa,{to:"..",replace:!0}):H!=null&&M==="Completed"&&E.fetchState==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(qc,{templateName:m.template?.name??"",formDraft:H,vendorSearchOptions:d,categorySearchOptions:x,isVendorSearchLoading:w==="In-Progress",onVendorSearchTextChange:_,submitState:D,submitErrorMessage:X,isAiCfoAccessEnabled:F,onAskAiCfoClick:v,onBackClick:Q,onCancelClick:I,onClickMenuIcon:C,onFormChange:z,onSubmit:N})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:u}),c.jsx(mr,{showUploadDocumentSection:!1,navBarTitle:m.template?.name,onBackClick:Q,onClickMenuIcon:C,isAiCfoAccessEnabled:F,onAskAiCfoClick:v})]})}function wr(e,n,t){return n?e.filter(a=>a!=null&&a.trim().length>0).slice(0,t):[]}function vr(e){return i(n=>e==null||e===""?{chips:ft,isResolved:!1}:function(t){const a=t?.fetchState,s=a==="Completed"||a==="Error";return{chips:a==="Completed"?t?.suggestedQuestions??ft:ft,isResolved:s}}(ys(n,e)),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Uo,subheadline:jo,pageTitle:Mo}}}}=Je.getLocalizedStrings(),No=e=>{const n=e.cardsCount>0?e.cardsCount:e.appliedCards.length,t=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,a=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:n,vendorRestrictionsCount:t,categoryRestrictionsCount:a}};function Vo(){const e=le(),n=he(),{tenantEmailDomain:t}=Ve(),a=me(),s=Le(),b=Fe(s?.loggedInUserRoleMap),[g,S]=r.useState(!1),P=r.useCallback(_=>{S(_)},[]),u=r.useCallback(()=>{P(!0)},[P]),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:v}=C(Z.isCardPolicyEnabled),{isAiCfoAccessEnabled:m,onAskAiCfoClick:M}=xa({mobileExploreReferrer:"Card Policy"}),B=i(_=>Is(_)),R=i(_=>Bn(_.createCardPolicyState)),p=i(_=>ks(_.createCardPolicyState)),h=i(_=>p==null?[]:jn(_.aiCfoState,p).filter(D=>D.kind==="creating_policy"),_t),T=R.fetchState==="In-Progress"?Math.max(h.length,1):0,l=i(_=>Es(_.createCardPolicyState)),w=ya(R.fetchState);r.useEffect(()=>{if(w==="In-Progress"&&R.fetchState==="Completed"&&p!=null)h.forEach(_=>{a(yt({chatSessionId:p,id:_.id,entityIds:l,kind:"created_policy"}))});else if(w==="In-Progress"&&R.fetchState==="Error"&&p!=null){h.forEach(D=>{a(yt({chatSessionId:p,id:D.id,kind:"errored_policy"}))});const _=R.error?.message!=null&&R.error.message.length>0?R.error.message:Je.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;a(Ke({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:_}]}))}},[R.error?.message,R.fetchState,a,p,l,h,w]);const E=B.fetchState.fetchState;r.useEffect(()=>{E!=="Not-Started"&&E!=="Error"||a(As())},[a,E]);const U=B.archiveFetchState.fetchState,y=ya(U);r.useEffect(()=>{y==="In-Progress"&&U==="Completed"&&a(Ke({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))},[U,a,y]);const k=r.useMemo(()=>B.templates.map(No),[B.templates]);Rt({isDataReady:B.fetchState.fetchState==="Completed"});const x=k.length>0||T>0,d=function(_){const{hasAnyPolicies:D,isChargeCardAdmin:G,isFileUploadEnabled:Q}=_,I=le(),N=he(),{tenantEmailDomain:Y}=Ve(),{isAiCfoOpen:X,setIsAiCfoOpen:o}=Cr(),A=pr(),W=hr(),ne=i(oe=>Un(oe)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:q,isResolved:ke}=vr("card_policy"),ve=r.useMemo(()=>wr(q,ke,3),[q,ke]),[fe,se]=r.useState(""),Ee=W&&A&&Y!=null&&!X,re=r.useCallback(oe=>{if(Y==null)return;const fa=ye(N.state?.pathnameStackToGoBack,N.pathname);I(`/${Y}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:oe,aiCfoShouldSubmit:oe!=null&&oe.trim().length>0}})},[N.pathname,N.state,I,Y]),Ce=r.useCallback(oe=>{oe.trim().length!==0&&(se(""),re(oe))},[re]),Ae=r.useCallback(()=>{const oe=fe.trim();oe.length!==0&&(se(""),re(oe))},[fe,re]),ee=r.useCallback(()=>{},[]),Te=r.useCallback(oe=>{se(oe)},[]),De=r.useCallback(()=>{o(!0)},[o]),ae=r.useCallback(()=>{re(void 0)},[re]);return r.useMemo(()=>{if(Ee&&!D&&G)return{aiAgentName:Mo,headline:Uo,subheadline:jo,promptChips:ve,composer:{currentInput:fe,isSubmitting:ne,isFileUploadEnabled:Q,onInputChange:Te,onSubmit:Ae,onStopSubmit:ee},onPromptClick:Ce,onOpenSidePanel:De,onOpenFullView:ae,dataTestIdPrefix:"card-policy-ai-cfo-hero"}},[fe,D,Ee,G,Q,ne,Te,ae,De,Ce,ee,Ae,ve])}({hasAnyPolicies:x,isChargeCardAdmin:b,isFileUploadEnabled:F}),f=v&&d!=null?c.jsx(fr,{...d}):null,j=m&&f==null,H=r.useCallback(()=>{const _=we(n.state?.pathnameStackToGoBack),D=_.poppedPathname??"..";e(D,{state:{pathnameStackToGoBack:_.newStack}})},[n.state,e]),O=r.useCallback(()=>{t!=null&&e(`/${t}/cards/policy/new`)},[e,t]),L=r.useCallback(_=>{t!=null&&e(`/${t}/cards/policy/${_}/edit`)},[e,t]),z=r.useCallback(_=>{a(Ds(_))},[a]),$=B.fetchState.fetchState;return!x&&$!=="Completed"&&$!=="Error"?c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Qc,{onBackClick:H,onNewPolicyClick:O,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:M})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:g,handleDrawerToggle:P}),c.jsx(Xc,{policies:k,archivingTemplateId:B.archiveTargetTemplateId,pendingCreationCount:T,onBackClick:H,onNewPolicyClick:O,onEditPolicyClick:L,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:M})]})}function Ho(){const e=le(),{cardId:n}=Ve(),t=me(),a=te.getSignedInUser(),s=i(q=>ge(q)),b=Le(),g=Fe(b?.loggedInUserRoleMap),{useFeatureGate:S}=ue();if(a==null)throw Error("Can't access Add To Wallet Page without signing in...");const[P,u]=r.useState(!1),C=i(q=>qa(q).firstViewAfterActivation);if(n==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:v}=S(Z.isChargeCardFeatureEnabled),m=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:M}=S(Z.isDebitCardFeatureEnabled),B=xe(s),R=Be(s),p=Re(M,s),h=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),l=Ue({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:v,isBookKeepingTenant:R,isDebitCardProductVisible:T,chargeCardsCreditAccountLimit:h}),w=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(q=>da(q,s.companyId)),U=la(E.controllers),{creditAccount:y,creditAccountRepayment:k}=i(q=>ua(q)),x=i(q=>q.classListState.fetchState),d=!F&&l&&m,f=i(q=>vt(q,n,d,l)),[j,H]=r.useState(!1),O=f.chargeCard,L=O?.cardCreatedByUser?.userId,z=i(q=>L!=null?$a(q.userRoleState,L):void 0),$=z?.accountingClassIDs[0],_=i(q=>$!=null?za(q.classState,{classId:$,reportId:"class_list"}):void 0),D=O?.cardHolderUser?.userId,G=i(q=>D!=null?$a(q.userRoleState,D):void 0),Q=G?.accountingClassIDs[0],I=i(q=>Q!=null?za(q.classState,{classId:Q,reportId:"class_list"}):void 0),N=O?.type.code==="business_physical_credit_card"||O?.type.code==="business_physical_debit_card",Y=O?.type.code==="business_physical_debit_card";r.useEffect(()=>{C&&P===!1&&N&&(u(!0),setTimeout(()=>{t(Ka()),Y&&t(Ke({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[C,P,N,Y]),r.useEffect(()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||n==null||(H(!0),t(ka(n,d,!1)))},[j,f,n,t]),r.useEffect(()=>{if(f.fetchState==="Completed"&&(N===!1||N&&O?.status?.code!=="active"||O?.cardHolderUserId!==a.userId||C===!1&&P===!1||O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card")){const q=_e(s.tenantEmailDomain,n,a,O,C);e(q)}},[f.fetchState,C,N]),r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&l&&m&&g&&t(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&l&&m&&g&&t(Tt()),x!=="Completed"&&x!=="In-Progress"&&t(Mn())},[y.fetchState,k.fetchState,t,l,m,g,x]);const X=()=>{if(a!=null&&n!=null){t(Ka());const q=_e(s.tenantEmailDomain,n,a);e(q)}},o=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",A=Xe(l,T,w,m),W=Ba(l,m,g,y,k),ne=Ir(o,f);return f.fetchState!=="Completed"?c.jsx(va,{fetchState:"In-Progress"}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:C}),c.jsx(Jc,{onGotItClick:X,isDebitCard:O?.type.code==="business_physical_debit_card",controllerEmails:U,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:T,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:m,productInformation:A,creditAccountInformation:W,debitAccountInformation:ne,chargeCardDetailView:f,creditAccount:y,classListFetchState:x,creditAccountRepayment:k,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:_?.className,cardHolderRoles:G?.userRoles,cardHolderDepartmentName:I?.className})]})}const Tr="charge-card-transaction-update",Fr="charge-card-transaction-created",xr="charge-card-transaction-declined",Br="charge-card-transaction-updated",Rr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Ht="charge-card-spending-updated",ot="credit-account-balance-updated",it="charge-card-created",Gt="charge-card-limit-updated",$t="charge-card-limit-reset",zt="charge-card-renamed",Go="charge-card-department-updated",Lr="charge-card-repayment-completed",Or="charge-card-payment-date-updated",Ra="charge-card-cashback-redeemed",La="charge-card-cashback-earned",ha=(e,n)=>e==null||e===""?[]:n.map(t=>`private-encrypted-${e}.${t}`),$o=[La,Ra],zo=Pe(function(e){const n=ma(e);return{insightsData:n.insight,cashbackByPeriod:n.cashbackByPeriod,uiState:n.uiState,cashbackSummary:n.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(n,t)=>{e(_s({uiState:{sortKey:n,sortOrder:t}}))}}})(ao);function Ko(){const e=le(),n=me(),t=he(),a=te.getSignedInUser(),s=i(M=>ge(M)),{useFeatureGate:b}=ue(),{isFeatureEnabled:g}=b(Z.isCardsCommentingEnabled),[S,P]=r.useState(!1),u=i(M=>ma(M)),C=Dr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback(()=>{const M=we(t.state?.pathnameStackToGoBack),B=M.poppedPathname??Zo(s.tenantEmailDomain);e(B,{state:{pathnameStackToGoBack:M.newStack}})},[e,t,s.tenantEmailDomain]),v=ea(s);if(Vt({events:ha(v,$o),onEvent:M=>{switch(M){case La:case Ra:return void n(_a(!0))}},onSubscribed:()=>{n(_a(!0))}}),r.useEffect(()=>{S||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(P(!0),n(_a()))},[S,u,n]),a==null)throw Error("Can't access cashback detail page without signing in...");const m=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||m?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?c.jsx(ct,{}):c.jsx(zo,{onBackClick:F,isCardsCommentingEnabled:g,initialOpenThreadRequest:C}):c.jsx(eo,{onBackClick:F})}const Zo=e=>`/${e}/cards`,Yo={containerWidth:new Fa(100,58)},Wo=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g}=ue(),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(!1),B=te.getSignedInUser();if(B==null)throw Error("Can't access onboarding card page without signing in...");const R=i(I=>ge(I));if(s==null)throw Error("Empty card id is not valid...");const{configValue:p}=g(Ze.zeniCardsConfig),h=p.max_charge_card_activation_attempts_by_card_id,T=i(I=>Ps(I,s)),l=T.chargeCard,w=i(I=>I.chargeCardConfigState.fetchState),{useFeatureGate:E}=ue(),{isFeatureEnabled:U}=E(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:y}=E(Z.isDebitCardFeatureEnabled),k=Re(y,R),x=Oe({isDebitCardFeatureEnabled:y,isBankingOnlyTenant:k}),d=!!R.companyChargeCardInfo?.info?.isChargeCardEnabled,f=R.userRole.includes("charge_card_user"),j=xe(R),H=Be(R),O=R.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,L=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:U,isBookKeepingTenant:H,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:O}),z=!f&&L&&d;r.useEffect(()=>{S===!1&&w!=="In-Progress"&&w!=="Completed"&&(t(Qa()),P(!0)),u===!1&&T.fetchState==="Not-Started"&&(C(!0),t(ka(s,z,L)))},[u,T.fetchState,S,w]);const $=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(F===!1&&($===!1||$&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==B.userId)){const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);a(I,{state:{pathnameStackToGoBack:N}})}else if(F&&T.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){t(ws({chargeCardId:s}));const I=_e(R.tenantEmailDomain,s,B,l,!0),N=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(I,{state:{pathnameStackToGoBack:N}})}}},[T.fetchState,l?.type.code,F,T.isRefreshingViewInBackground]);const _=te.getZeniOtpTokenForCardHolder(s),D=i(I=>Nn(I.userState,B.userId)),G=()=>{l?.status?.code!=="active"&&t(Sa(s,!0))};r.useEffect(()=>{T.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(I=>I.statusCode==="success")===!0&&F===!1&&(setTimeout(G,3e3),v(!0))},[T.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Q=I=>{M(I)};if(w!=="Completed"||l==null)return c.jsx(va,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(D?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(Xo,{children:[c.jsx(Ie,{isAppContentDrawerOpen:m,handleDrawerToggle:Q}),c.jsx(qo,{cardId:s,card:l,shippingAddressId:l.shippingAddressId,phone:D.phone,signedInUser:B,isSandboxEnv:Lt(),chargeCardDetailState:T,signedInUserToken:_,navigate:a,currentTenant:R,location:b,maxChargeCardActivationAttempts:h[s]!=null?h[s]:p.default_max_charge_card_activation_attempts!=null?p.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:p.charge_card_cashback_rate_per_transaction!=null?p.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Q(!0)}}),e!=null?c.jsx(Qo,{windowSize:n,children:e}):null]})},qo=Pe(function(e,{chargeCardDetailState:n,shippingAddressId:t,location:a,cardId:s}){const b=vs(e.addressState,t);if(b==null)throw Error("Can't access shippingAddress.");const g=Vn(e,s),S=n.updateStatus,P=Ca(e,!1,!1,!1);let u=!1;P.fetchState==="Completed"&&P.cards.length<=1&&(u=!0);const C=a.state?.message==="comingFromV2UrlPath";return{showActivatePage:n.chargeCard?.providerCardCreateTime!=null&&n.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Ts())||C,showMenuIcon:u,shippingAddress:b,vgsVaultId:rt.cardVaultId,twoFAView:g,activationWaitStatus:S,isRefreshingViewInBackground:n.isRefreshingViewInBackground}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,chargeCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdatePhysicalChargeCardAttempt:u=>{e(xs(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onCVVActivateSuccess:()=>{e(Fs({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(to),Qo=He.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
- width: ${e=>`${Zo.containerWidth.value(e.windowSize)}%`};
4
+ width: ${e=>`${Yo.containerWidth.value(e.windowSize)}%`};
5
5
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
6
6
  `,Xo=He.div`
7
7
  display: flex;
@@ -11,18 +11,18 @@ import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as
11
11
  flex-direction: column;
12
12
  align-items: center;
13
13
  background-color: ${e=>e.theme.colors.grey4};
14
- `,Za=Je.getLocalizedStrings().dateFormat,Jo={overlayWidth:new Fa(100,100,58)},Ur=[Lr,ot],ei=new Set(Ur),ai=Pe(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Os(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Us(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:b,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:P,controllerEmails:u,paymentDetails:C,productInformation:F,cashbackInformation:v,paymentSourceInformation:m,creditAccountInformation:M,debitAccountInformation:B,paymentInitiatedDate:R,sourcePage:p}=n,{tenantEmailDomain:h}=a,T=()=>{e($n(!0));const l=ea(a);l!=null&&l!==""&&e(Pa(l,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(g&&S&&P&&v!=null&&J.trackCardsPayEarlyFormClick(u,F,v,"Back",C.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:C.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:C.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:C.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:C.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:R?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:R?.format(Za.visual.MMMDCommaYYYYformat)},m,M,B),p==="cardPaymentHistory")n.closeDrawerHandler(!0),e(zn());else{const l=aa(h);t(l)}},onUpdatePaymentAccountStatus:(l,w,E)=>{e(Ns(l,w,"bill_pay","bill_pay_detail",E))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:l=>{e(Ms("external_account",l))},onEstablishConnectionClick:l=>{e(js(l,a.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{s?window.open(`/${h}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{b?window.open(`/${h}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:l=>{ei.has(l)&&T()},onPusherSubscribed:T}})(st(no)),Yt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:b,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:C,isCashbackInfoFetchStateCompleted:F,paymentInitiatedDate:v,retryRepayment:m})=>{const M=le(),{useDynamicConfig:B}=ue(),{configValue:R}=B(Ke.zeniAccountsConfig),p=Bs(R),h=i(A=>Hn(A)),{creditAccount:T}=i(A=>ua(A)),l=i(A=>ge(A)),w=Ot(),E=Ta(),U=me(),y=te.getSignedInUser(),k=Le(),[x,d]=r.useState(!1),[f,j]=r.useState(!1),{configValue:H}=B(Ke.zeniCardsConfig),O=H.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??H.default_credit_card_auto_pay_threshold??Ao,L=Gn(k?.loggedInUserRoleMap),z=Rs(k?.loggedInUserRoleMap),$=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,_=i(A=>wa(A,l.companyId)),D=_.companyChargeCardInfo?.primaryFundingAccount,G=_.allFundingAccounts.find(A=>A.id===D?.accountId),Q=i(A=>da(A,l.companyId)),I=la(Q.controllers);r.useEffect(()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&U($n()),h.fetchState==="Completed"&&!f){const A=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,W=h.transferFromAccounts.find(q=>q.id===A);let ne;if(b==="cardPaymentHistory"&&m){const q=m.paymentAccountId!=null?h.transferFromAccounts.find(ke=>ke.id===m.paymentAccountId):void 0;ne={amount:m.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:q??W}}else ne={amount:{amount:T.balance.amount+T.hold.amount,currencyCode:T.balance.currencyCode,currencySymbol:T.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:W};U(hn(ne)),j(!0)}},[h.fetchState,f,b,m,h.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,T.balance.amount,T.balance.currencyCode,T.balance.currencySymbol,T.hold.amount,U]);const N={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:G?.accType==="depositAccount",creditCardPaymentSourceAccountName:G?.label,creditCardPaymentSourceAccountType:G?.accType,creditCardPaymentSourceLastFourDigits:G?.accountLast4,creditCardPaymentSourceBalance:G?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&U(Pa(l.companyId,!0))},[_.fetchState]),r.useEffect(()=>{h.updateStatus==="Completed"&&P!=null&&F&&C&&u&&J.trackCardsPayEarlyPayNowClick(I,s,P,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:v?.add(3,"day").format(Za.visual.MMMDCommaYYYYformat),paymentInitiatedDate:v?.format(Za.visual.MMMDCommaYYYYformat)},N,g,S)},[h.updateStatus,P,F,C,u,v]),r.useEffect(()=>{h.fetchState==="Completed"&&P!=null&&F&&C&&u&&!x&&e&&f&&P!=null&&(J.trackCardsPayEarlyFormView(I,s,P,t,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,T.balance.amount,N,g,S),d(!0))},[h,F,C,u,x,e,f]),y==null)throw Error("Can't access invite people page without signing in...");const Z=()=>{n(!0),U(zn())},X=ea(l),o={events:e?ha(X,Ur):[],eventCallback:(A,W,ne)=>{ne.onEventReceived(A)},onSubscribed:A=>{A.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(yr,{onClose:()=>{Z()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Jo.overlayWidth.valuePercentage(E),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(ti,{onClick:A=>A.stopPropagation(),children:c.jsx(ai,{...o,closeDrawerHandler:n,navigate:M,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{F&&C&&u&&P!=null&&J.trackCardsPayEarlyFormClick(I,s,P,"Pay Now",h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},N,g,S),U(Ls({companyId:l.companyId}))},onDismissClick:Z,onSaveChangesToLocalStore:A=>{U(hn(A))},currentTenant:l,hasZeniAccountsAdminAccess:L,isZeniAccountsUser:z,isZeniAccountSetupEnabled:$,productInformation:s,sourcePage:b,controllerEmails:I,autoPayThreshold:O,paymentSourceInformation:N,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isCashbackInfoFetchStateCompleted:F,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:v,maxInsuredAmount:p.maxInsuredAmount})})})})},ti=He(Eo)`
14
+ `,Ya=Je.getLocalizedStrings().dateFormat,Jo={overlayWidth:new Fa(100,100,58)},Ur=[Lr,ot],ei=new Set(Ur),ai=Pe(function(e,n){const t=n.currentTenant?.companyId;return{plaidConnectionDetails:Os(e,t,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:Us(e.depositAccountState,e.depositAccountListState)}},function(e,n){const{navigate:t,currentTenant:a,hasZeniAccountsAdminAccess:s,isZeniAccountsUser:b,isCashbackInfoFetchStateCompleted:g,isCreditCardInfoFetchStateCompleted:S,isDebitCardInfoFetchStateCompleted:P,controllerEmails:u,paymentDetails:C,productInformation:F,cashbackInformation:v,paymentSourceInformation:m,creditAccountInformation:M,debitAccountInformation:B,paymentInitiatedDate:R,sourcePage:p}=n,{tenantEmailDomain:h}=a,T=()=>{e($n(!0));const l=ea(a);l!=null&&l!==""&&e(Pa(l,!0,!0)),e(Qe(!0))};return{onBackNavigation:()=>{if(g&&S&&P&&v!=null&&J.trackCardsPayEarlyFormClick(u,F,v,"Back",C.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:C.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:C.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:C.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:C.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:R?.add(3,"day").format(Ya.visual.MMMDCommaYYYYformat),paymentInitiatedDate:R?.format(Ya.visual.MMMDCommaYYYYformat)},m,M,B),p==="cardPaymentHistory")n.closeDrawerHandler(!0),e(zn());else{const l=aa(h);t(l)}},onUpdatePaymentAccountStatus:(l,w,E)=>{e(Ns(l,w,"bill_pay","bill_pay_detail",E))},onEstablishConnectionSuccess:()=>{e(Pa(a.companyId,!0))},onFetchLinkTokenClick:l=>{e(Ms("external_account",l))},onEstablishConnectionClick:l=>{e(js(l,a.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{s?window.open(`/${h}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{b?window.open(`/${h}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onEventReceived:l=>{ei.has(l)&&T()},onPusherSubscribed:T}})(st(no)),Kt=({isPaymentDrawerOpen:e,closeDrawerHandler:n,pageName:t,creditAccountSpentAmount:a,productInformation:s,sourcePage:b,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isDebitCardInfoFetchStateCompleted:u,isCreditCardInfoFetchStateCompleted:C,isCashbackInfoFetchStateCompleted:F,paymentInitiatedDate:v,retryRepayment:m})=>{const M=le(),{useDynamicConfig:B}=ue(),{configValue:R}=B(Ze.zeniAccountsConfig),p=Bs(R),h=i(A=>Hn(A)),{creditAccount:T}=i(A=>ua(A)),l=i(A=>ge(A)),w=Ot(),E=Ta(),U=me(),y=te.getSignedInUser(),k=Le(),[x,d]=r.useState(!1),[f,j]=r.useState(!1),{configValue:H}=B(Ze.zeniCardsConfig),O=H.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??H.default_credit_card_auto_pay_threshold??Ao,L=Gn(k?.loggedInUserRoleMap),z=Rs(k?.loggedInUserRoleMap),$=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,_=i(A=>wa(A,l.companyId)),D=_.companyChargeCardInfo?.primaryFundingAccount,G=_.allFundingAccounts.find(A=>A.id===D?.accountId),Q=i(A=>da(A,l.companyId)),I=la(Q.controllers);r.useEffect(()=>{if(h.fetchState!=="Completed"&&h.fetchState!=="In-Progress"&&U($n()),h.fetchState==="Completed"&&!f){const A=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,W=h.transferFromAccounts.find(q=>q.id===A);let ne;if(b==="cardPaymentHistory"&&m){const q=m.paymentAccountId!=null?h.transferFromAccounts.find(ke=>ke.id===m.paymentAccountId):void 0;ne={amount:m.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:q??W}}else ne={amount:{amount:T.balance.amount+T.hold.amount,currencyCode:T.balance.currencyCode,currencySymbol:T.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:Sn(),transferFrom:W};U(hn(ne)),j(!0)}},[h.fetchState,f,b,m,h.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,T.balance.amount,T.balance.currencyCode,T.balance.currencySymbol,T.hold.amount,U]);const N={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:G?.accType==="depositAccount",creditCardPaymentSourceAccountName:G?.label,creditCardPaymentSourceAccountType:G?.accType,creditCardPaymentSourceLastFourDigits:G?.accountLast4,creditCardPaymentSourceBalance:G?.accountBalance?.available?.amount??0};if(r.useEffect(()=>{_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&U(Pa(l.companyId,!0))},[_.fetchState]),r.useEffect(()=>{h.updateStatus==="Completed"&&P!=null&&F&&C&&u&&J.trackCardsPayEarlyPayNowClick(I,s,P,h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:v?.add(3,"day").format(Ya.visual.MMMDCommaYYYYformat),paymentInitiatedDate:v?.format(Ya.visual.MMMDCommaYYYYformat)},N,g,S)},[h.updateStatus,P,F,C,u,v]),r.useEffect(()=>{h.fetchState==="Completed"&&P!=null&&F&&C&&u&&!x&&e&&f&&P!=null&&(J.trackCardsPayEarlyFormView(I,s,P,t,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,T.balance.amount,N,g,S),d(!0))},[h,F,C,u,x,e,f]),y==null)throw Error("Can't access invite people page without signing in...");const Y=()=>{n(!0),U(zn())},X=ea(l),o={events:e?ha(X,Ur):[],eventCallback:(A,W,ne)=>{ne.onEventReceived(A)},onSubscribed:A=>{A.onPusherSubscribed()}};return c.jsx(c.Fragment,{children:c.jsx(yr,{onClose:()=>{Y()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Jo.overlayWidth.valuePercentage(E),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:c.jsx(ti,{onClick:A=>A.stopPropagation(),children:c.jsx(ai,{...o,closeDrawerHandler:n,navigate:M,paymentDetails:h,creditAccountSpentAmount:a,onTransferClick:()=>{F&&C&&u&&P!=null&&J.trackCardsPayEarlyFormClick(I,s,P,"Pay Now",h.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:h.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:h.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:h.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:h.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},N,g,S),U(Ls({companyId:l.companyId}))},onDismissClick:Y,onSaveChangesToLocalStore:A=>{U(hn(A))},currentTenant:l,hasZeniAccountsAdminAccess:L,isZeniAccountsUser:z,isZeniAccountSetupEnabled:$,productInformation:s,sourcePage:b,controllerEmails:I,autoPayThreshold:O,paymentSourceInformation:N,creditAccountInformation:g,debitAccountInformation:S,cashbackInformation:P,isCashbackInfoFetchStateCompleted:F,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:u,paymentInitiatedDate:v,maxInsuredAmount:p.maxInsuredAmount})})})})},ti=He(Eo)`
15
15
  display: flex;
16
16
  min-height: 100%;
17
17
  flex-direction: column;
18
- `,Kt=e=>e!=null&&typeof e=="object"?e:null,de=e=>typeof e=="string"?e:void 0,Me=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=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 n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Wa(n.transaction_status)&&!!Wa(n.transaction_type)},Zt=(e,n)=>{const t=e?.card_status;if(!Wa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},At=[Tr,Fr,xr,Br,Rr,pa,Ht,ot,Gt,$t,zt],jr=[La,Ra],ni=new Set([...At,...jr]),St=Je.getLocalizedStrings().dateFormat,ri=Pe(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:b}=n,g=te.getSignedInUser(),S=e.tenantState.currentTenantId,P={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},u=vt(e,a,t,b),C=Ws(e,a),F=qs(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:P,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${gr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:b,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:P,controllerEmails:u,productInformation:C,cashbackInformation:F,primaryFundingAccountDetails:v,creditAccountInformation:m,debitAccountInformation:M,isChargeCardFeatureEnabled:B}=n,{tenantEmailDomain:R}=a;return{onEventReceived:(p,h)=>{(({event:T,data:l,cardId:w,dispatch:E,subscribedEvents:U})=>{const y=Kt(l);switch(T){case La:case Ra:return void E(_a(!0));case Tr:{const k=de(y?.card_id);if(k==null||k!==w)return;const x=de(y?.transaction_id),d=y?.transaction_status;return x!=null&&Wa(d)?void E(Ks({transactionId:x,transactionStatus:d})):void E(sa(w,null,null,!0))}case pa:{const k=de(y?.card_id)??w;if(k!==w)return;const x=Zt(y,k);return x!=null?void E(Ft(x)):void E(Sa(w,!0))}case Ht:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.currency_code),d=de(y?.currency_symbol),f=Me(y?.balance);return x!=null&&d!=null&&f!=null?(E(Ys({cardId:k,currencyCode:x,currencySymbol:d,balance:f,hold:Me(y?.hold),dailyPurchaseSpends:Me(y?.daily_purchase_spends),monthlyPurchaseSpends:Me(y?.monthly_purchase_spends),dailyWithdrawals:Me(y?.daily_withdrawals),monthlyWithdrawals:Me(y?.monthly_withdrawals)})),void E(Qe(!0))):(E(Sa(w,!0)),void E(Qe(!0)))}case ot:{const k=de(y?.currency_code),x=de(y?.currency_symbol),d=Me(y?.available_amount),f=Me(y?.balance_amount);return k!=null&&x!=null&&d!=null&&f!=null?void E(zs({currencyCode:k,currencySymbol:x,available:d,balance:f,hold:Me(y?.hold_amount),cashback:Me(y?.cashback_amount)})):void E(Qe(!0))}case Fr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E($s({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case xr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Gs({cardId:k,declineReason:de(y?.decline_reason),transaction:x})):void E(sa(w,null,null,!0))}case Br:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Hs({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case Rr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.transaction_id),d=y?.attachment_file_paths;return x!=null&&Array.isArray(d)&&d.every(f=>typeof f=="string")?void E(Vs({cardId:k,transactionId:x,attachmentFilePaths:d})):void E(sa(w,null,null,!0))}case Gt:case $t:case zt:{const k=de(y?.card_id);if(k==null||k!==w)return;E(Sa(w,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ni})},onPusherSubscribed:()=>{e(Sa(t,!0)),e(sa(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,B))},onFetchChargeCardTransactionList:(p,h)=>{e(sa(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{g!=null&&e(at(p,"ChargeCardHolder",t))},onResendOtp:p=>{g!=null&&e(et(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{g!=null&&e(Ja(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&te.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(tc(t,p))},onLockChargeCard:(p,h)=>{e(er(p,t,h))},onUnlockChargeCard:p=>{e(Jn(p,t))},onCloseChargeCard:p=>{e(Xn(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(Qn([t]))},updateChargeCardName:(p,h)=>{e(qn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(ac({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,T,l)=>{e(ec({chargeCardId:h,transactionId:p,fetchState:T,error:l}))},updateChargeCardTransactionReceiptsShowTick:(p,h,T)=>{e(Js({chargeCardId:h,transactionId:p,shouldShowTick:T}))},onChargeCardRevokeInviteClick:()=>{e(Wn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,T)=>{e(Xs({chargeCardId:h,transactionId:p,isViewReceiptClicked:T}))},onChargeCardTransactionRowClick:(p,h)=>{const T=ye(b.state?.pathnameStackToGoBack,b.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:T}})},onBackClick:()=>{const p=we(b.state?.pathnameStackToGoBack),h=aa(R);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Qs())},onUpdateDebitCardPinAttempt:p=>{e(Zn(t,p)),p==="success"&&e(Ye({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(Ye({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(Ye({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,T,l){e(Kn(p,h,T.code,l))},shouldOpenCreditCardPaymentDrawer(p){p&&F!=null&&J.trackCardsPayEarlyClick(u,C,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:v?.accType==="depositAccount",creditCardPaymentSourceAccountName:v?.label,creditCardPaymentSourceAccountType:v?.accType,creditCardPaymentSourceLastFourDigits:v?.accountLast4,creditCardPaymentSourceBalance:v?.accountBalance?.available?.amount??0},m,M),P(p)}}})(st(so));function si(){const e=le(),n=me(),t=he(),{cardId:a}=Ve(),[s,b]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:P}=ue(),u=te.getSignedInUser(),C=i(Y=>ge(Y)),F=i(Y=>qa(Y).firstViewAfterActivation),v=i(Y=>Y.classListState.fetchState),{configValue:m}=P(Ke.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:M}=P(Ke.zeniCardsConfig),B=M.enable_card_controls_for_company_ids,R=M.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(B)&&B.includes(C.companyId),[p,h]=r.useState(!1),[T,l]=r.useState(!1),{useFeatureGate:w}=ue(),{isFeatureEnabled:E}=w(K.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=w(K.isDebitCardFeatureEnabled),y=Re(U,C),k=Oe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:y}),{isFeatureEnabled:x}=w(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=w(K.isCardsCommentingEnabled),f=Be(C),j=xe(C),H=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:E,isBookKeepingTenant:f,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:H}),L=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const _=i(Y=>wa(Y,C.companyId)),{creditAccount:D,creditAccountRepayment:G}=i(Y=>ua(Y)),Q=te.getZeniOtpTokenForCardHolder(a),I=i(Y=>vt(Y,a,$,O)),{isAiCfoAccessEnabled:N,onAskAiCfoClick:Z}=xa({mobileExploreReferrer:"Card Detail"});Rt({isDataReady:I.fetchState==="Completed"});const X=i(Y=>ma(Y)),o=I.chargeCard,A=Le(),W=Fe(A?.loggedInUserRoleMap),ne=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",ve=o?.type.code==="business_virtual_debit_card",fe=Ba(O,z,W,D,G),se=Ir(ne,I),Ee=Mt(W,X),re=Xe(O,k,L,z),Ce=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Ae=i(Y=>da(Y,C.companyId)),ee=la(Ae.controllers),Te=i(Y=>o?.cardCreatedByUser?.userId!=null?$a(Y.userRoleState,o?.cardCreatedByUser?.userId):void 0),De=i(Y=>Te?.accountingClassIDs[0]!=null?za(Y.classState,{classId:Te?.accountingClassIDs[0],reportId:"class_list"}):void 0),ae=i(Y=>o?.cardHolderUser?.userId!=null?$a(Y.userRoleState,o?.cardHolderUser?.userId):void 0),oe=i(Y=>ae?.accountingClassIDs[0]!=null?za(Y.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0),fa=C?.userRole,ta=i(Y=>Ca(Y,!1,k,E).revokeCardInvite),Oa=ya(ta.saveStatus.fetchState);if(r.useEffect(()=>{if(Oa==="In-Progress"&&ta.saveStatus.fetchState==="Completed"){const Y=aa(C.tenantEmailDomain);e(Y)}},[Oa,ta.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect(()=>{F&&s===!1&&ke&&(b(!0),setTimeout(()=>{n(Ya()),ve&&n(Ye({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[F,s,ke,ve]),r.useEffect(()=>{p||I.fetchState==="Completed"||I.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,$,O,!1)))},[p,I,a,n]),r.useEffect(()=>{!T&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&ne&&Ce&&W&&(l(!0),n(Yn({depositAccountId:I.chargeCard?.connectedAccountId})))},[T,I,n,Ce,W]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&W&&n(_a()),v!=="Completed"&&v!=="In-Progress"&&n(Mn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&n(Zs({chargeCardId:a})),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))},[X.fetchState,n,W,v,I.transactionStatistics.fetchState,_.fetchState]),r.useEffect(()=>{if(!(I.fetchState!=="Completed"||O&&D.fetchState!=="Completed"||o==null||I.transactionStatistics.fetchState!=="Completed"||ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const Y=o.type.code.includes("physical"),Se=Y?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;J.trackCardsCardDetailView(ee,re,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:Y?"physical":"virtual",cardLimit:ba(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:Se?.format(St.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:ba(o.balance.amount),cardAvailableLimit:ba(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:ba(o.limit.amount-o.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(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:Te?.userRoles,cardIssuedByDepartment:De?.className},{cardholderName:kt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:ae?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:oe?.className},fe,se)}},[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,D.fetchState,W]),u==null)throw Error("Can't access card detail page without signing in...");const dt=ea(C),Ea=W?[...At,...jr]:At,na={events:ha(dt,Ea),eventCallback:(Y,Se,ie)=>{ie.onEventReceived(Y,Se)},onSubscribed:Y=>{Y.onPusherSubscribed()}},Aa=()=>{if(a!=null&&o!=null){const{ownerName:Y,cardName:Se,utilisation:ie,limit:Ge,frequency:Ze,cardColor:$e}=bt(o),ze=o.cardHolderUserId===u.userId;J.trackCardsDetailPageViewed(a,Y,Se,ie,Ge,Ze,$e,ze)}};r.useEffect(()=>{if(I.fetchState==="Completed"){const Y=I.chargeCard;if(Y?.status.code==="inactive"||ne&&Y?.isPinSet===!1||q&&F){const Se=_e(C.tenantEmailDomain,a,u,o,F);e(Se)}}},[I.fetchState]);const lt=(Y,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ze,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;J.trackCardsDetailPageClicked(a,ie,Ge,Ze,$e,ze,Y,ra,Se)}},ut=(Y,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ze,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;J.trackCardsVerifyPopUpClick(a,ie,Ge,Ze,$e,ze,Y,ra,Se)}},pe=D.balance.amount+D.hold.amount,Ua=C.companyChargeCardInfo?.info?.primaryFundingAccount,Da=_.allFundingAccounts.find(Y=>Y.id===Ua?.accountId),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||ta.saveStatus.fetchState==="In-Progress"||!Ma&&ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(ro,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?c.jsx(Ut,{analytics:J,onLoad:Aa}):null,g===!0?c.jsx(Yt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!ne||!W||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||D.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!W||X.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsx(ri,{...na,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Lt(),signedInUser:u,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:Te?.userRoles,cardIssuedByDepartmentName:De?.className,cardHolderRoles:ae?.userRoles,cardHolderDepartmentName:oe?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:z,isCardControlsEnabled:R,isEarlyPayEnabled:x,controllerEmails:ee,chargeCardCashbackDetailState:X,productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,classListFetchState:v,primaryFundingAccountDetails:Da,currentTenant:C,cardProviderId:I.chargeCard?.cardProviderID,cardId:a,creditAccount:D,creditAccountRepayment:G,includeCreditAccountInfo:$,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:m.documentAiReceiptMaxSizeLimitBytes!=null?m.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:Z,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const bt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,b=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:b,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ci,subheadline:oi,pageTitle:ii}}}}=Je.getLocalizedStrings(),Mr=[pa,ot,Or,Ra,La,it,zt,Go,Gt,$t,Ht],di=new Set(Mr),Dt=jt((e,n,t,a)=>{e(ia(n,t,a,!0))},400),li=He.div`
18
+ `,Zt=e=>e!=null&&typeof e=="object"?e:null,de=e=>typeof e=="string"?e:void 0,Me=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,Wa=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 n=e;return typeof n.transaction_id=="string"&&typeof n.amount=="number"&&typeof n.currency_code=="string"&&typeof n.currency_symbol=="string"&&typeof n.direction=="string"&&!!Wa(n.transaction_status)&&!!Wa(n.transaction_type)},Yt=(e,n)=>{const t=e?.card_status;if(!Wa(t))return null;const a=e?.is_locked_by_admin;return{cardId:n,cardStatus:t,isLockedByAdmin:typeof a=="boolean"?a:void 0}},At=[Tr,Fr,xr,Br,Rr,pa,Ht,ot,Gt,$t,zt],jr=[La,Ra],ni=new Set([...At,...jr]),St=Je.getLocalizedStrings().dateFormat,ri=Pe(function(e,n){const{includeCreditAccountInfo:t,cardId:a,signedInUserToken:s,isChargeCardFeatureEnabled:b}=n,g=te.getSignedInUser(),S=e.tenantState.currentTenantId,P={userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:S??""},u=vt(e,a,t,b),C=Ws(e,a),F=qs(e);return{chargeCardDetailView:u,chargeCardsRecurringExpensesState:C,vgsVaultId:rt.cardVaultId,transactionAttachmentsEndpointToFetch:`${Et}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${Et}/card_transaction_attachment`,authParams:P,isSnackbarOpen:F.isSnackbarOpen,cardsEndPoint:`${gr.cardMicroServiceBaseUrl}`,signedInUserToken:u.twoFAView.token??s}},function(e,n){const{cardId:t,currentTenant:a,navigate:s,location:b,cardProviderId:g,includeCreditAccountInfo:S,setIsPaymentOpen:P,controllerEmails:u,productInformation:C,cashbackInformation:F,primaryFundingAccountDetails:v,creditAccountInformation:m,debitAccountInformation:M,isChargeCardFeatureEnabled:B}=n,{tenantEmailDomain:R}=a;return{onEventReceived:(p,h)=>{(({event:T,data:l,cardId:w,dispatch:E,subscribedEvents:U})=>{const y=Zt(l);switch(T){case La:case Ra:return void E(_a(!0));case Tr:{const k=de(y?.card_id);if(k==null||k!==w)return;const x=de(y?.transaction_id),d=y?.transaction_status;return x!=null&&Wa(d)?void E(Zs({transactionId:x,transactionStatus:d})):void E(sa(w,null,null,!0))}case pa:{const k=de(y?.card_id)??w;if(k!==w)return;const x=Yt(y,k);return x!=null?void E(Ft(x)):void E(Sa(w,!0))}case Ht:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.currency_code),d=de(y?.currency_symbol),f=Me(y?.balance);return x!=null&&d!=null&&f!=null?(E(Ks({cardId:k,currencyCode:x,currencySymbol:d,balance:f,hold:Me(y?.hold),dailyPurchaseSpends:Me(y?.daily_purchase_spends),monthlyPurchaseSpends:Me(y?.monthly_purchase_spends),dailyWithdrawals:Me(y?.daily_withdrawals),monthlyWithdrawals:Me(y?.monthly_withdrawals)})),void E(Qe(!0))):(E(Sa(w,!0)),void E(Qe(!0)))}case ot:{const k=de(y?.currency_code),x=de(y?.currency_symbol),d=Me(y?.available_amount),f=Me(y?.balance_amount);return k!=null&&x!=null&&d!=null&&f!=null?void E(zs({currencyCode:k,currencySymbol:x,available:d,balance:f,hold:Me(y?.hold_amount),cashback:Me(y?.cashback_amount)})):void E(Qe(!0))}case Fr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E($s({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case xr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Gs({cardId:k,declineReason:de(y?.decline_reason),transaction:x})):void E(sa(w,null,null,!0))}case Br:{const k=de(y?.card_id)??w;if(k!==w)return;const x=y?.transaction;return gt(x)?void E(Hs({cardId:k,transaction:x})):void E(sa(w,null,null,!0))}case Rr:{const k=de(y?.card_id)??w;if(k!==w)return;const x=de(y?.transaction_id),d=y?.attachment_file_paths;return x!=null&&Array.isArray(d)&&d.every(f=>typeof f=="string")?void E(Vs({cardId:k,transactionId:x,attachmentFilePaths:d})):void E(sa(w,null,null,!0))}case Gt:case $t:case zt:{const k=de(y?.card_id);if(k==null||k!==w)return;E(Sa(w,!0))}}})({event:p,data:h,cardId:t,dispatch:e,subscribedEvents:ni})},onPusherSubscribed:()=>{e(Sa(t,!0)),e(sa(t,null,null,!0)),e(Qe(!0))},onReloadTransactions:()=>{e(ka(t,S,B))},onFetchChargeCardTransactionList:(p,h)=>{e(sa(t,p,h))},onUpdateScrollYOffset:p=>{},onGetOtp:p=>{g!=null&&e(at(p,"ChargeCardHolder",t))},onResendOtp:p=>{g!=null&&e(et(p,"ChargeCardHolder",t))},onVerifyOtp:(p,h)=>{g!=null&&e(Ja(p,h,"ChargeCardHolder",t))},onVerifyOtpSuccess:p=>{p!=null&&te.saveZeniOtpTokenForCardHolder(p,t)},onColorCodeChange:p=>{e(tc(t,p))},onLockChargeCard:(p,h)=>{e(er(p,t,h))},onUnlockChargeCard:p=>{e(Jn(p,t))},onCloseChargeCard:p=>{e(Xn(t,p))},onFetchChargeCardsRecurringExpenses:()=>{e(Qn([t]))},updateChargeCardName:(p,h)=>{e(qn(p,t,h))},updateChargeCardTransactionAttachments:(p,h)=>{h!=null&&e(ac({transactionId:p,data:h}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(p,h,T,l)=>{e(ec({chargeCardId:h,transactionId:p,fetchState:T,error:l}))},updateChargeCardTransactionReceiptsShowTick:(p,h,T)=>{e(Js({chargeCardId:h,transactionId:p,shouldShowTick:T}))},onChargeCardRevokeInviteClick:()=>{e(Wn(t))},updateChargeCardTransactionIsViewReceiptClicked:(p,h,T)=>{e(Xs({chargeCardId:h,transactionId:p,isViewReceiptClicked:T}))},onChargeCardTransactionRowClick:(p,h)=>{const T=ye(b.state?.pathnameStackToGoBack,b.pathname);s(`../../transaction/${p}/${h}`,{state:{pathnameStackToGoBack:T}})},onBackClick:()=>{const p=we(b.state?.pathnameStackToGoBack),h=aa(R);s(h,{state:{pathnameStackToGoBack:p.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(Qs())},onUpdateDebitCardPinAttempt:p=>{e(Yn(t,p)),p==="success"&&e(Ke({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(p,h)=>{p?e(Ke({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):h!=null&&e(Ke({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:h.message}]}))},updateSpendLimit(p,h,T,l){e(Zn(p,h,T.code,l))},shouldOpenCreditCardPaymentDrawer(p){p&&F!=null&&J.trackCardsPayEarlyClick(u,C,F,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:a.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:v?.accType==="depositAccount",creditCardPaymentSourceAccountName:v?.label,creditCardPaymentSourceAccountType:v?.accType,creditCardPaymentSourceLastFourDigits:v?.accountLast4,creditCardPaymentSourceBalance:v?.accountBalance?.available?.amount??0},m,M),P(p)}}})(st(so));function si(){const e=le(),n=me(),t=he(),{cardId:a}=Ve(),[s,b]=r.useState(!1),[g,S]=r.useState(!1),{useDynamicConfig:P}=ue(),u=te.getSignedInUser(),C=i(K=>ge(K)),F=i(K=>qa(K).firstViewAfterActivation),v=i(K=>K.classListState.fetchState),{configValue:m}=P(Ze.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:M}=P(Ze.zeniCardsConfig),B=M.enable_card_controls_for_company_ids,R=M.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(B)&&B.includes(C.companyId),[p,h]=r.useState(!1),[T,l]=r.useState(!1),{useFeatureGate:w}=ue(),{isFeatureEnabled:E}=w(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=w(Z.isDebitCardFeatureEnabled),y=Re(U,C),k=Oe({isDebitCardFeatureEnabled:U,isBankingOnlyTenant:y}),{isFeatureEnabled:x}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:d}=w(Z.isCardsCommentingEnabled),f=Be(C),j=xe(C),H=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,O=Ue({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:E,isBookKeepingTenant:f,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:H}),L=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,z=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,$=!C.userRole.includes("charge_card_user")&&O&&z;if(a==null)throw Error("Empty card id is not valid...");const _=i(K=>wa(K,C.companyId)),{creditAccount:D,creditAccountRepayment:G}=i(K=>ua(K)),Q=te.getZeniOtpTokenForCardHolder(a),I=i(K=>vt(K,a,$,O)),{isAiCfoAccessEnabled:N,onAskAiCfoClick:Y}=xa({mobileExploreReferrer:"Card Detail"});Rt({isDataReady:I.fetchState==="Completed"});const X=i(K=>ma(K)),o=I.chargeCard,A=Le(),W=Fe(A?.loggedInUserRoleMap),ne=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_virtual_debit_card",q=o?.type.code==="business_physical_debit_card"||o?.type.code==="business_physical_credit_card",ke=o?.type.code==="business_virtual_debit_card"||o?.type.code==="business_virtual_credit_card",ve=o?.type.code==="business_virtual_debit_card",fe=Ba(O,z,W,D,G),se=Ir(ne,I),Ee=Mt(W,X),re=Xe(O,k,L,z),Ce=I.depositAccountLimitFetchState.fetchState!=="Completed"&&I.depositAccountLimitFetchState.fetchState!=="In-Progress",Ae=i(K=>da(K,C.companyId)),ee=la(Ae.controllers),Te=i(K=>o?.cardCreatedByUser?.userId!=null?$a(K.userRoleState,o?.cardCreatedByUser?.userId):void 0),De=i(K=>Te?.accountingClassIDs[0]!=null?za(K.classState,{classId:Te?.accountingClassIDs[0],reportId:"class_list"}):void 0),ae=i(K=>o?.cardHolderUser?.userId!=null?$a(K.userRoleState,o?.cardHolderUser?.userId):void 0),oe=i(K=>ae?.accountingClassIDs[0]!=null?za(K.classState,{classId:ae?.accountingClassIDs[0],reportId:"class_list"}):void 0),fa=C?.userRole,ta=i(K=>Ca(K,!1,k,E).revokeCardInvite),Oa=ya(ta.saveStatus.fetchState);if(r.useEffect(()=>{if(Oa==="In-Progress"&&ta.saveStatus.fetchState==="Completed"){const K=aa(C.tenantEmailDomain);e(K)}},[Oa,ta.saveStatus.fetchState,e,C.tenantEmailDomain]),r.useEffect(()=>{F&&s===!1&&ke&&(b(!0),setTimeout(()=>{n(Ka()),ve&&n(Ke({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[F,s,ke,ve]),r.useEffect(()=>{p||I.fetchState==="Completed"||I.fetchState==="In-Progress"||a==null||(h(!0),n(ka(a,$,O,!1)))},[p,I,a,n]),r.useEffect(()=>{!T&&I.fetchState==="Completed"&&I.chargeCard?.connectedAccountId!=null&&ne&&Ce&&W&&(l(!0),n(Kn({depositAccountId:I.chargeCard?.connectedAccountId})))},[T,I,n,Ce,W]),r.useEffect(()=>{X.fetchState!=="Completed"&&X.fetchState!=="In-Progress"&&W&&n(_a()),v!=="Completed"&&v!=="In-Progress"&&n(Mn()),I.transactionStatistics.fetchState!=="Completed"&&I.transactionStatistics.fetchState!=="In-Progress"&&n(Ys({chargeCardId:a})),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&n(Pa(C.companyId,!0))},[X.fetchState,n,W,v,I.transactionStatistics.fetchState,_.fetchState]),r.useEffect(()=>{if(!(I.fetchState!=="Completed"||O&&D.fetchState!=="Completed"||o==null||I.transactionStatistics.fetchState!=="Completed"||ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed")){const K=o.type.code.includes("physical"),Se=K?o.cardActivationAttemptHistory[0]?.timestamp:o.createTime;J.trackCardsCardDetailView(ee,re,{cardId:a,cardName:o.cardName,cardType:o.type.code.includes("credit")?"credit":"debit",cardCategory:K?"physical":"virtual",cardLimit:ba(o.limit.amount),cardLastFourDigits:o.accountLast4,cardStatus:o.status.code,cardAssignedDate:o.createTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:o.providerCardCreateTime?.format(St.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:Se?.format(St.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:o.creditLimitFrequency.name,cardSpentAmount:ba(o.balance.amount),cardAvailableLimit:ba(o.available.amount),cardUtilizationPercent:o.limit.amount>0?Math.round((o.limit.amount-o.available.amount)/o.limit.amount*100):0,cardUtilizationAmount:ba(o.limit.amount-o.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(o.cardCreatedByUser,!1),cardIssuedByEmail:o.cardCreatedByUser?.email,cardIssuedByUserId:o.cardCreatedByUser?.userId,cardIssuedByRole:Te?.userRoles,cardIssuedByDepartment:De?.className},{cardholderName:kt(o.cardHolderUser,!1),cardholderEmail:o.cardHolderUser?.email,cardholderRole:ae?.userRoles,cardholderUserId:o.cardHolderUser?.userId,cardholderDepartment:oe?.className},fe,se)}},[I.fetchState,I.depositAccountLimitFetchState.fetchState,I.transactionStatistics.fetchState,D.fetchState,W]),u==null)throw Error("Can't access card detail page without signing in...");const dt=ea(C),Ea=W?[...At,...jr]:At,na={events:ha(dt,Ea),eventCallback:(K,Se,ie)=>{ie.onEventReceived(K,Se)},onSubscribed:K=>{K.onPusherSubscribed()}},Aa=()=>{if(a!=null&&o!=null){const{ownerName:K,cardName:Se,utilisation:ie,limit:Ge,frequency:Ye,cardColor:$e}=bt(o),ze=o.cardHolderUserId===u.userId;J.trackCardsDetailPageViewed(a,K,Se,ie,Ge,Ye,$e,ze)}};r.useEffect(()=>{if(I.fetchState==="Completed"){const K=I.chargeCard;if(K?.status.code==="inactive"||ne&&K?.isPinSet===!1||q&&F){const Se=_e(C.tenantEmailDomain,a,u,o,F);e(Se)}}},[I.fetchState]);const lt=(K,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ye,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;J.trackCardsDetailPageClicked(a,ie,Ge,Ye,$e,ze,K,ra,Se)}},ut=(K,Se)=>{if(a!=null&&o!=null){const{ownerName:ie,cardName:Ge,utilisation:Ye,limit:$e,frequency:ze}=bt(o),ra=o.cardHolderUserId===u.userId;J.trackCardsVerifyPopUpClick(a,ie,Ge,Ye,$e,ze,K,ra,Se)}},pe=D.balance.amount+D.hold.amount,Ua=C.companyChargeCardInfo?.info?.primaryFundingAccount,Da=_.allFundingAccounts.find(K=>K.id===Ua?.accountId),ja=I.chargeCard!=null,Ma=I.depositAccountLimit!=null;return I.fetchState!=="Error"||ja?!ja&&(I.fetchState==="In-Progress"||I.fetchState==="Not-Started")||ta.saveStatus.fetchState==="In-Progress"||!Ma&&ne&&W&&I.depositAccountLimitFetchState.fetchState!=="Completed"?c.jsx(ro,{}):c.jsxs(c.Fragment,{children:[c.jsx(nt,{showConfetti:F}),I.fetchState==="Completed"?c.jsx(Ut,{analytics:J,onLoad:Aa}):null,g===!0?c.jsx(Kt,{closeDrawerHandler:()=>S(!1),isPaymentDrawerOpen:g,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,creditAccountSpentAmount:pe,isDebitCardInfoFetchStateCompleted:!ne||!W||I.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!O||D.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!W||X.fetchState==="Completed",paymentInitiatedDate:G.initiatedRepaymentDate}):null,c.jsx(ri,{...na,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ut,onFireOnClickAnalytics:lt,isSandboxEnv:Lt(),signedInUser:u,location:t,navigate:e,setIsPaymentOpen:S,cardIssuedByRoles:Te?.userRoles,cardIssuedByDepartmentName:De?.className,cardHolderRoles:ae?.userRoles,cardHolderDepartmentName:oe?.className,loggedInUserRole:fa,isChargeCardFeatureEnabled:O,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:L,isChargeCardSetupEnabled:z,isCardControlsEnabled:R,isEarlyPayEnabled:x,controllerEmails:ee,chargeCardCashbackDetailState:X,productInformation:re,creditAccountInformation:fe,debitAccountInformation:se,cashbackInformation:Ee,classListFetchState:v,primaryFundingAccountDetails:Da,currentTenant:C,cardProviderId:I.chargeCard?.cardProviderID,cardId:a,creditAccount:D,creditAccountRepayment:G,includeCreditAccountInfo:$,signedInUserToken:Q,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:m.documentAiReceiptMaxSizeLimitBytes!=null?m.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:N,onAskAiCfoClick:Y,isCardsCommentingEnabled:d})]}):c.jsx(ct,{})}const bt=e=>{const n=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,t=e.cardName,a=(e.limit.amount??0)-(e.available.amount??0),s=e.limit.amount,b=e.creditLimitFrequency.name;return{ownerName:n,cardName:t,utilisation:a,cardColor:e.cardColorCode??"",frequency:b,limit:s}},{spendManagement:{chargeCard:{cardsAiCfoHero:{headline:ci,subheadline:oi,pageTitle:ii}}}}=Je.getLocalizedStrings(),Mr=[pa,ot,Or,Ra,La,it,zt,Go,Gt,$t,Ht],di=new Set(Mr),Dt=jt((e,n,t,a)=>{e(ia(n,t,a,!0))},400),li=He.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
- `,ui=Pe(function(e,n){const t=Ca(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:oc(e),bulkActionView:ic(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:b,chargeCardListState:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:P,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:v,isDebitCardTOSAccepted:m,isChargeCardTOSAccepted:M,controllerEmails:B,depositAccountListWithDebitCardIssued:R,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:T,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:E,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:y}=n,{tenantEmailDomain:k}=a,{cards:x}=g;return{onChargeCardRowClick:(d,f)=>{const j=Er(x,d);let H;j!=null&&((L=>{const z=L.limit.amount-L.available.amount,$=`${L.cardHolderUser?.firstName.toLowerCase()} ${L.cardHolderUser?.lastName.toLowerCase()}`,_=L.cardName,D=L.department?.className??"",G=L.limit.amount,Q=L.creditLimitFrequency.name;J.trackCardsListRowClicked($,_,D,z,G,Q,b.userId===L.cardHolderUserId)})(j),ca(F,v,R)&&J.trackCardsCardListRowClick(B,T,"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:ba(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:ba(j.limit.amount)},l,w,E)),H=j?.status.code==="request_on_hold"&&b.userId===j.cardHolderUserId?Ar(k):_e(k,d,b,j);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(H,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Qn(d))},onFetchDepositAccountLimit:d=>{e(Yn({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(fc(d))},onChargeCardRevokeInviteClick:d=>{e(Wn(d))},onLockChargeCardList:(d,f)=>{e(hc(d,f))},onUnlockChargeCardList:d=>{e(pc(d))},onCloseChargeCardList:(d,f)=>{e(Cc(d,f))},onRevokeChargeCardList:d=>{e(mc(d))},updateChargeCardListSpendLimit(d,f,j){e(uc(d,f,j.code))},onLockChargeCard:(d,f)=>{e(er(y,d,f))},onUnlockChargeCard:d=>{e(Jn(y,d))},onCloseChargeCard:(d,f)=>{e(Xn(d,f))},onUpdateSpendLimit(d,f,j,H){e(Kn(d,f,j.code,H))},updateChargeCardName:(d,f)=>{e(qn(y,d,f))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),ca(F,v,R)&&l!=null&&J.trackCardsSettingsClick(B,T,l,w,E);const d=_o(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),ca(F,v,R)&&l!=null&&J.trackCardsNewCardClick(B,T,l,"New Button","card_creation_initiated","Card List",w,E);const d=mi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(d,f)=>{ca(F,v,R)&&l!=null&&J.trackCardsCardListSortClick(B,T,l,"Sort Icon","sort",d,f==="ascending"?"ASC":"DESC","Cards List",w,E),e(It({uiState:{sortKey:d,sortOrder:f}}))},onSearchTextChanged:d=>{e(lc(d))},onReloadCards:()=>{e(ia(S,F&&v,P&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{ca(F,v,R)&&l!=null&&J.trackCardsCashbackOverviewClick(B,T,l,"Cashback Overview","cashback_details_viewed",w,E),t("./cashback")},onClickStatementsIcon:()=>{ca(F,v,R)&&l!=null&&J.trackCardsStatementsClick(B,T,l,w,E),t("./statements")},onCreateNowClick:d=>{ca(F,v,R)&&l!=null&&J.trackCardsNewCardClick(B,T,l,"Promo Banner","card_creation_initiated","Card List",w,E),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&F&&!m||d==="credit"&&u&&!M?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,f)=>{h==="Completed"&&a.company!=null&&l!=null&&J.trackCardsPayEarlyClick(B,T,l,"Card List",d,f,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},w,E);const j=Ci(k);t(j)},navigateToCreditCardPaymentHistoryPage:()=>{const d=pi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(dc(d))},onSetBulkActionCardIds:d=>{e(ar(d))},onEventReceived:d=>{di.has(d)&&Dt(e,S,F&&v,P&&C)},onPusherSubscribed:()=>{Dt(e,S,F&&v,P&&C)}}})(st(oo));function yn({isPaymentDrawerOpen:e}){const n=le(),t=me(),a=he(),s=r.useCallback((V,je)=>{t(ar([])),n(V,je)},[t,n]),[b,g]=r.useState(!1),[S,P]=r.useState(te.getPayNowInfoTooltip()??!1),u=V=>{te.savePayNowInfoTooltip(V),P(V)},[C,F]=r.useState(!1),v=te.getSignedInUser(),m=i(V=>ge(V)),[M,B]=r.useState(!1),[R,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Cards"}),l=m.userRole.includes("charge_card_user"),w=!l,E=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:y}=ue(),{isFeatureEnabled:k}=U(K.isCashbackFeatureEnabled),{isFeatureEnabled:x}=U(K.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(K.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=U(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=U(K.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:H}=U(K.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(K.isAiCfoFileUploadEnabled),{isFeatureEnabled:L}=U(K.isCardPolicyEnabled),{isFeatureEnabled:z}=U(K.isAiCardCreationEnabled),$=Re(d,m),_=Oe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:$}),D=xe(m),G=Be(m),Q=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Ue({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G,isDebitCardProductVisible:_,chargeCardsCreditAccountLimit:Q}),N=kr({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G}),{configValue:Z}=y(Ke.zeniCardsConfig),X=Le(),o=Fe(X?.loggedInUserRoleMap),A=i(V=>da(V,m.companyId)),W=la(A.controllers),ne=Z.charge_card_cashback_rate_per_transaction!=null?Z.charge_card_cashback_rate_per_transaction:.0175,q=Z.credit_card_pay_now_threshold_by_company_id?.[m.companyId]??Z.default_credit_card_pay_now_threshold??Do,ke=Z.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(Z.enable_card_controls_for_company_ids)&&Z.enable_card_controls_for_company_ids.includes(m.companyId),ve=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,fe=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,se=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,re=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,Ce=i(V=>Hn(V)),Ae=ya(Ce.updateStatus),ee=i(V=>Ca(V,w,_&&E,I&&se)),Te=i(V=>nc(V)),De=i(V=>rc(V)),ae=i(V=>sc(V)),oe=i(V=>cc(V)),fa=i(V=>ae==null?[]:jn(V.aiCfoState,ae).filter(je=>je.kind==="creating_cards"),_t),ta=ya(De.fetchState);r.useEffect(()=>{ta==="In-Progress"&&De.fetchState==="Completed"&&ae!=null&&fa.forEach(V=>{t(yt({chatSessionId:ae,id:V.id,entityIds:oe,kind:"created_cards"}))})},[t,De.fetchState,ae,oe,fa,ta]);const Oa=ee.cards.filter(V=>V.type.code.includes("debit")).map(V=>V.connectedAccountId),dt=[...new Set(Oa)],Ea=i(V=>ma(V)),na=i(V=>tt(V,dt)),Aa=i(V=>wa(V,m.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find(V=>V.id===lt?.accountId),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback(()=>o===!0&&L===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(m.tenantEmailDomain??"")!==!0,[o,L,pe,m.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect(()=>{Ma(Da())},[Da]);const Y=()=>{te.saveCardPolicyPopupSeen(m.tenantEmailDomain??"",!0),Ma(!1)},Se=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;co({isDataReady:pe==="Completed",pageContext:Se?"cards_creation":"cards"});const{creditAccountRepayment:ie}=i(V=>ua(V)),Ge=i(V=>qa(V).firstViewAfterActivation),{areTenantIdsInSync:Ze}=Sr(),$e=Mt(o,Ea),ze=Ba(I,se,o,Ua,ie),ra=Nt(_,E,o,na,ee.debitCardSummary),mt=Xe(I,_,E,se),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&&ie.initiatedRepayments.amount===0&&ie.fetchState==="Completed"||Ae==="In-Progress"&&Ce.updateStatus==="Completed")u(!1),g(!0);else if(ie.initiatedRepayments.amount>0&&ie.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const V=aa(m.tenantEmailDomain);s(V)}},[e,ie.initiatedRepayments.amount,ie.fetchState,Ae,Ce.updateStatus,s,m.tenantEmailDomain]),r.useEffect(()=>{!M&&(se||E)&&(Ee||re)&&Ze&&(B(!0),t(ia(w,_&&E,I&&se,!1)))},[M,w,t,Ze,Ee,re]),r.useEffect(()=>{Ge&&C===!1&&(F(!0),setTimeout(()=>{t(Ya())},5e3))},[Ge,C]),r.useEffect(()=>()=>{Dt.flush()},[]),r.useEffect(()=>{pe==="Completed"&&l&&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"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))},[pe,l,a.state,s,ee.cards]),r.useEffect(()=>{if(pe==="Completed"&&l){const V=ee.cards.length,je=ee.cards.filter(We=>We.cardHolderUserId===v?.userId).filter(We=>We.status.code==="request_on_hold");je.length>0&&V===je.length&&s("./onboard")}},[pe,ee.cards,l,s,v?.userId]),r.useEffect(()=>{pe!=="Completed"||I&&ie.fetchState!=="Completed"||_&&E&&o&&na.fetchState!=="Completed"||J.trackCardsCardListView(W,mt,$e,ze,ra)},[pe,Ua,ie.fetchState,na.fetchState,o]),v==null)throw Error("Can't access charge card list page without signing in...");const Gr=i(V=>tr(V.userState,V.userRoleState,V.userListViewState,"cardAdmin")),Wt=xt(X?.loggedInUserRoleMap),qt=V=>{p(V)},$r=ee.creditAccount.limit,zr=()=>{g(!1),s("..")},Yr=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:I&&Ee,isTOSAccepted:ve,isSetupEnabled:se,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Kr=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:_&&re,isTOSAccepted:fe,isSetupEnabled:E,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Zr=Yr||Kr,Qt=function(V){const{isEmptyCardsState:je,isChargeCardAdmin:We,isFileUploadEnabled:Jt}=V,en=le(),Na=he(),{tenantEmailDomain:Va}=Ve(),{isAiCfoOpen:Xr,setIsAiCfoOpen:an}=Cr(),Jr=pr(),es=hr(),tn=i(be=>Un(be)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:nn,isResolved:rn}=vr("cards_creation"),sn=r.useMemo(()=>wr(nn,rn,3),[nn,rn]),[Ha,pt]=r.useState(""),cn=es&&Jr&&Va!=null&&!Xr,ga=r.useCallback(be=>{if(Va==null)return;const as=ye(Na.state?.pathnameStackToGoBack,Na.pathname);en(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:as,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})},[Na.pathname,Na.state,en,Va]),on=r.useCallback(be=>{be.trim().length!==0&&(pt(""),ga(be))},[ga]),dn=r.useCallback(()=>{const be=Ha.trim();be.length!==0&&(pt(""),ga(be))},[Ha,ga]),ln=r.useCallback(()=>{},[]),un=r.useCallback(be=>{pt(be)},[]),mn=r.useCallback(()=>{an(!0)},[an]),Cn=r.useCallback(()=>{ga(void 0)},[ga]);return r.useMemo(()=>{if(cn&&je&&We)return{aiAgentName:ii,headline:ci,subheadline:oi,promptChips:sn,composer:{currentInput:Ha,isSubmitting:tn,isFileUploadEnabled:Jt,onInputChange:un,onSubmit:dn,onStopSubmit:ln},onPromptClick:on,onOpenSidePanel:mn,onOpenFullView:Cn,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,cn,We,je,Jt,tn,un,Cn,mn,on,ln,dn,sn])}({isEmptyCardsState:Se,isChargeCardAdmin:o,isFileUploadEnabled:O}),Xt=z&&Qt!=null?c.jsx(fr,{...Qt}):null,Wr=h&&Xt==null,qr=ea(m),Qr={events:ha(qr,Mr),eventCallback:(V,je,We)=>{We.onEventReceived(V)},onSubscribed:V=>{V.onPusherSubscribed()}};return se||E?c.jsxs(c.Fragment,{children:[pe==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:J,onLoad:()=>{J.trackPageLoaded(br.Event.cardsListPage),(I&&!se||_&&!E)&&J.trackCardsPromoView(W,{isCreditCardOffered:I,isDebitCardOffered:_,isDebitCardEnabled:E,isCreditCardEnabled:se},"Banner",_&&!E?"Debit Card":I&&!se?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:Ge})]}):null,b===!0?c.jsx(Yt,{closeDrawerHandler:zr,isPaymentDrawerOpen:b,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isDebitCardInfoFetchStateCompleted:!(_&&E&&o)||na.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ie.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||Ea.fetchState==="Completed",paymentInitiatedDate:ie.initiatedRepaymentDate}):null,c.jsxs(li,{children:[c.jsx(Ie,{isAppContentDrawerOpen:R,handleDrawerToggle:qt}),c.jsx(ui,{...Qr,isCashbackFeatureEnabled:k,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:v,chargeCardListState:ee,location:a,admins:Gr.users,navigateAndClearBulkSelection:s,currentTenant:m,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:m.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:w,onClickMenuIcon:()=>{qt(!0)},creditLimit:$r,isChargeCardSetupEnabled:se,isChargeCardEnabledOnCompany:Ee,isDebitCardSetupEnabled:E,isDebitCardEnabledOnCompany:re,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:ne,controllerEmails:W,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:na,isChargeCardTOSAccepted:ve,isDebitCardTOSAccepted:fe,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isAiCfoAccessEnabled:Wr,onAskAiCfoClick:T,isCardsCommentingEnabled:H,cardsAiCfoHero:Xt,onClickPolicyIcon:o&&L?()=>n(hi(m.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:Y,pendingCreationCount:Te})]})]}):(ve||fe)&&o===!0?c.jsx(oa,{to:"../setup"}):Zr?c.jsx(oa,{to:"../promo"}):c.jsx(va,{fetchState:pe})}const mi=e=>`/${e}/cards/new`,Ci=e=>`/${e}/cards/payment`,pi=e=>`/${e}/cards/payment-history`,hi=e=>`/${e}/cards/policy`,Nr=[Lr,Or],fi=new Set(Nr),gi=Pe(function(e){const n=te.getSignedInUser(),t=ge(e),a=e.tenantState.currentTenantId,s=nr(e),b={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:gc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:b,companyName:g,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=we(t.state?.pathnameStackToGoBack),b=s.poppedPathname??"..";a(b,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,b)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:b}}})},onFiltersChange:s=>{e(bc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{fi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Sc({uiState:{downloadState:s}}))}}})(st(io));function Si(){const e=le(),n=he(),t=me(),{areTenantIdsInSync:a}=Sr(),{useFeatureGate:s}=ue();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const b=i(o=>ge(o)),g=i(o=>nr(o)),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(null),B=!b.userRole.includes("charge_card_user"),R=!!b.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(K.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(K.isDebitCardFeatureEnabled),T=Re(h,b),l=Oe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:T}),w=xe(b),E=Be(b),U=b.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=Ue({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:p,isBookKeepingTenant:E,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:U}),k=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,x=Le(),d=Fe(x?.loggedInUserRoleMap),f=i(o=>Ca(o,B,l&&R,y&&k)),j=r.useMemo(()=>{const o=f.cards.filter(A=>A.type.code.includes("debit"));return[...new Set(o.map(A=>A.connectedAccountId))]},[f.cards]),H=i(o=>ma(o)),O=i(o=>tt(o,j)),{creditAccountRepayment:L}=i(o=>ua(o)),z=r.useMemo(()=>Mt(d,H),[d,H]),$=r.useMemo(()=>Ba(y,k,d,f.creditAccount,L),[y,k,d,f.creditAccount,L]),_=r.useMemo(()=>Nt(l,R,d,O,f.debitCardSummary),[l,R,d,O,f.debitCardSummary]),D=r.useMemo(()=>Xe(y,l,R,k),[y,l,R,k]),G=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Q=r.useMemo(()=>m!=null?g.repaymentHistory.find(o=>o.cardRepaymentId===m):void 0,[m,g.repaymentHistory]),I=r.useCallback(o=>{M(o),t(ia(B,l&&R,y&&k,!1)),v(!0)},[t,B,l,R,y,k]),N=r.useCallback(()=>{v(!1),M(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(P(!0),t(Ga()))},[S,t,g.fetchState]),r.useEffect(()=>{!u&&(k||R)&&a&&(C(!0),t(ia(B,!1,y&&k,!1)))},[u,k,R,a,t,B,y]);const Z=ea(b),X={events:ha(Z,Nr),eventCallback:(o,A,W)=>{W.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[F?c.jsx(Yt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:G,productInformation:D,creditAccountInformation:$,debitAccountInformation:_,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(l&&R&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!y||L.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||H.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(gi,{...X,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:I})]})}const In=He.div`
25
+ `,ui=Pe(function(e,n){const t=Ca(e,n.includeCreditAccountDebitSummaryAndCashbackInfo,n.isDebitCardFeatureEnabled&&n.isDebitCardSetupEnabled,n.isChargeCardFeatureEnabled&&n.isChargeCardSetupEnabled);return{chargeCardListView:t,rowActionView:oc(e),bulkActionView:ic(e),companyLegalName:n.currentTenant.companyName,admins:n.admins,searchText:t.searchText,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigateAndClearBulkSelection:t,currentTenant:a,location:s,signedInUser:b,chargeCardListState:g,includeCreditAccountDebitSummaryAndCashbackInfo:S,isChargeCardFeatureEnabled:P,isCreditCardProductVisibleForExpressInterest:u,isChargeCardSetupEnabled:C,isDebitCardFeatureEnabled:F,isDebitCardSetupEnabled:v,isDebitCardTOSAccepted:m,isChargeCardTOSAccepted:M,controllerEmails:B,depositAccountListWithDebitCardIssued:R,primaryFundingAccountDetails:p,chargeCardSetUpViewFetchState:h,productInformation:T,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:E,updatePayNowInfoTooltip:U,isUserHasCardsAdminLevelAccess:y}=n,{tenantEmailDomain:k}=a,{cards:x}=g;return{onChargeCardRowClick:(d,f)=>{const j=Er(x,d);let H;j!=null&&((L=>{const z=L.limit.amount-L.available.amount,$=`${L.cardHolderUser?.firstName.toLowerCase()} ${L.cardHolderUser?.lastName.toLowerCase()}`,_=L.cardName,D=L.department?.className??"",G=L.limit.amount,Q=L.creditLimitFrequency.name;J.trackCardsListRowClicked($,_,D,z,G,Q,b.userId===L.cardHolderUserId)})(j),ca(F,v,R)&&J.trackCardsCardListRowClick(B,T,"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:ba(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:ba(j.limit.amount)},l,w,E)),H=j?.status.code==="request_on_hold"&&b.userId===j.cardHolderUserId?Ar(k):_e(k,d,b,j);const O=ye(s.state?.pathnameStackToGoBack,s.pathname);t(H,{state:{pathnameStackToGoBack:O}})},onFetchChargeCardsRecurringExpenses:d=>{e(Qn(d))},onFetchDepositAccountLimit:d=>{e(Kn({depositAccountId:d}))},onChargeCardResendInviteClick:d=>{e(fc(d))},onChargeCardRevokeInviteClick:d=>{e(Wn(d))},onLockChargeCardList:(d,f)=>{e(hc(d,f))},onUnlockChargeCardList:d=>{e(pc(d))},onCloseChargeCardList:(d,f)=>{e(Cc(d,f))},onRevokeChargeCardList:d=>{e(mc(d))},updateChargeCardListSpendLimit(d,f,j){e(uc(d,f,j.code))},onLockChargeCard:(d,f)=>{e(er(y,d,f))},onUnlockChargeCard:d=>{e(Jn(y,d))},onCloseChargeCard:(d,f)=>{e(Xn(d,f))},onUpdateSpendLimit(d,f,j,H){e(Zn(d,f,j.code,H))},updateChargeCardName:(d,f)=>{e(qn(y,d,f))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),ca(F,v,R)&&l!=null&&J.trackCardsSettingsClick(B,T,l,w,E);const d=_o(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),ca(F,v,R)&&l!=null&&J.trackCardsNewCardClick(B,T,l,"New Button","card_creation_initiated","Card List",w,E);const d=mi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},onColumnSortConfigChanged:(d,f)=>{ca(F,v,R)&&l!=null&&J.trackCardsCardListSortClick(B,T,l,"Sort Icon","sort",d,f==="ascending"?"ASC":"DESC","Cards List",w,E),e(It({uiState:{sortKey:d,sortOrder:f}}))},onSearchTextChanged:d=>{e(lc(d))},onReloadCards:()=>{e(ia(S,F&&v,P&&C,!0))},onLetsGoClick:()=>{t("./onboard")},onBackClick:()=>{t("../../")},onTotalCashbackClick:()=>{ca(F,v,R)&&l!=null&&J.trackCardsCashbackOverviewClick(B,T,l,"Cashback Overview","cashback_details_viewed",w,E),t("./cashback")},onClickStatementsIcon:()=>{ca(F,v,R)&&l!=null&&J.trackCardsStatementsClick(B,T,l,w,E),t("./statements")},onCreateNowClick:d=>{ca(F,v,R)&&l!=null&&J.trackCardsNewCardClick(B,T,l,"Promo Banner","card_creation_initiated","Card List",w,E),t(`./new?cardType=${d}`)},onPromoCardClick:d=>{t(d==="debit"&&F&&!m||d==="credit"&&u&&!M?`../promo?cardPromoType=${d}`:"./setup")},navigateToCreditCardPaymentPage:(d,f)=>{h==="Completed"&&a.company!=null&&l!=null&&J.trackCardsPayEarlyClick(B,T,l,"Card List",d,f,{isZeniCheckingEnabled:a.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:p?.accType==="depositAccount",creditCardPaymentSourceAccountName:p?.label,creditCardPaymentSourceAccountType:p?.accType,creditCardPaymentSourceLastFourDigits:p?.accountLast4,creditCardPaymentSourceBalance:p?.accountBalance?.available?.amount??0},w,E);const j=Ci(k);t(j)},navigateToCreditCardPaymentHistoryPage:()=>{const d=pi(k),f=ye(s.state?.pathnameStackToGoBack,s.pathname);t(d,{state:{pathnameStackToGoBack:f}})},shouldShowPayNowInfoTooltip:U,onSetRowActionCardId:d=>{e(dc(d))},onSetBulkActionCardIds:d=>{e(ar(d))},onEventReceived:d=>{di.has(d)&&Dt(e,S,F&&v,P&&C)},onPusherSubscribed:()=>{Dt(e,S,F&&v,P&&C)}}})(st(oo));function yn({isPaymentDrawerOpen:e}){const n=le(),t=me(),a=he(),s=r.useCallback((V,je)=>{t(ar([])),n(V,je)},[t,n]),[b,g]=r.useState(!1),[S,P]=r.useState(te.getPayNowInfoTooltip()??!1),u=V=>{te.savePayNowInfoTooltip(V),P(V)},[C,F]=r.useState(!1),v=te.getSignedInUser(),m=i(V=>ge(V)),[M,B]=r.useState(!1),[R,p]=r.useState(!1),{isAiCfoAccessEnabled:h,onAskAiCfoClick:T}=xa({mobileExploreReferrer:"Cards"}),l=m.userRole.includes("charge_card_user"),w=!l,E=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:U,useDynamicConfig:y}=ue(),{isFeatureEnabled:k}=U(Z.isCashbackFeatureEnabled),{isFeatureEnabled:x}=U(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:d}=U(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:f}=U(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:j}=U(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:H}=U(Z.isCardsCommentingEnabled),{isFeatureEnabled:O}=U(Z.isAiCfoFileUploadEnabled),{isFeatureEnabled:L}=U(Z.isCardPolicyEnabled),{isFeatureEnabled:z}=U(Z.isAiCardCreationEnabled),$=Re(d,m),_=Oe({isDebitCardFeatureEnabled:d,isBankingOnlyTenant:$}),D=xe(m),G=Be(m),Q=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,I=Ue({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G,isDebitCardProductVisible:_,chargeCardsCreditAccountLimit:Q}),N=kr({isCardsOnlyTenant:D,isChargeCardFeatureEnabled:x,isBookKeepingTenant:G}),{configValue:Y}=y(Ze.zeniCardsConfig),X=Le(),o=Fe(X?.loggedInUserRoleMap),A=i(V=>da(V,m.companyId)),W=la(A.controllers),ne=Y.charge_card_cashback_rate_per_transaction!=null?Y.charge_card_cashback_rate_per_transaction:.0175,q=Y.credit_card_pay_now_threshold_by_company_id?.[m.companyId]??Y.default_credit_card_pay_now_threshold??Do,ke=Y.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(Y.enable_card_controls_for_company_ids)&&Y.enable_card_controls_for_company_ids.includes(m.companyId),ve=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,fe=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,se=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,Ee=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,re=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,Ce=i(V=>Hn(V)),Ae=ya(Ce.updateStatus),ee=i(V=>Ca(V,w,_&&E,I&&se)),Te=i(V=>nc(V)),De=i(V=>rc(V)),ae=i(V=>sc(V)),oe=i(V=>cc(V)),fa=i(V=>ae==null?[]:jn(V.aiCfoState,ae).filter(je=>je.kind==="creating_cards"),_t),ta=ya(De.fetchState);r.useEffect(()=>{ta==="In-Progress"&&De.fetchState==="Completed"&&ae!=null&&fa.forEach(V=>{t(yt({chatSessionId:ae,id:V.id,entityIds:oe,kind:"created_cards"}))})},[t,De.fetchState,ae,oe,fa,ta]);const Oa=ee.cards.filter(V=>V.type.code.includes("debit")).map(V=>V.connectedAccountId),dt=[...new Set(Oa)],Ea=i(V=>ma(V)),na=i(V=>tt(V,dt)),Aa=i(V=>wa(V,m.companyId)),lt=Aa.companyChargeCardInfo?.primaryFundingAccount,ut=Aa.allFundingAccounts.find(V=>V.id===lt?.accountId),pe=ee.fetchState,Ua=ee.creditAccount,Da=r.useCallback(()=>o===!0&&L===!0&&pe==="Completed"&&te.getCardPolicyPopupSeen(m.tenantEmailDomain??"")!==!0,[o,L,pe,m.tenantEmailDomain]),[ja,Ma]=r.useState(Da);r.useEffect(()=>{Ma(Da())},[Da]);const K=()=>{te.saveCardPolicyPopupSeen(m.tenantEmailDomain??"",!0),Ma(!1)},Se=pe==="Completed"&&!ee.hasCreditCard&&!ee.hasDebitCard;co({isDataReady:pe==="Completed",pageContext:Se?"cards_creation":"cards"});const{creditAccountRepayment:ie}=i(V=>ua(V)),Ge=i(V=>qa(V).firstViewAfterActivation),{areTenantIdsInSync:Ye}=Sr(),$e=Mt(o,Ea),ze=Ba(I,se,o,Ua,ie),ra=Nt(_,E,o,na,ee.debitCardSummary),mt=Xe(I,_,E,se),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&&ie.initiatedRepayments.amount===0&&ie.fetchState==="Completed"||Ae==="In-Progress"&&Ce.updateStatus==="Completed")u(!1),g(!0);else if(ie.initiatedRepayments.amount>0&&ie.fetchState==="Completed"){g(!1),document.body.style.overflow="auto";const V=aa(m.tenantEmailDomain);s(V)}},[e,ie.initiatedRepayments.amount,ie.fetchState,Ae,Ce.updateStatus,s,m.tenantEmailDomain]),r.useEffect(()=>{!M&&(se||E)&&(Ee||re)&&Ye&&(B(!0),t(ia(w,_&&E,I&&se,!1)))},[M,w,t,Ye,Ee,re]),r.useEffect(()=>{Ge&&C===!1&&(F(!0),setTimeout(()=>{t(Ka())},5e3))},[Ge,C]),r.useEffect(()=>()=>{Dt.flush()},[]),r.useEffect(()=>{pe==="Completed"&&l&&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"&&(a.state?.message==="comingFromCardDetail"?s("../../"):s(`./${ee.cards[0].id}`)))},[pe,l,a.state,s,ee.cards]),r.useEffect(()=>{if(pe==="Completed"&&l){const V=ee.cards.length,je=ee.cards.filter(We=>We.cardHolderUserId===v?.userId).filter(We=>We.status.code==="request_on_hold");je.length>0&&V===je.length&&s("./onboard")}},[pe,ee.cards,l,s,v?.userId]),r.useEffect(()=>{pe!=="Completed"||I&&ie.fetchState!=="Completed"||_&&E&&o&&na.fetchState!=="Completed"||J.trackCardsCardListView(W,mt,$e,ze,ra)},[pe,Ua,ie.fetchState,na.fetchState,o]),v==null)throw Error("Can't access charge card list page without signing in...");const Gr=i(V=>tr(V.userState,V.userRoleState,V.userListViewState,"cardAdmin")),Wt=xt(X?.loggedInUserRoleMap),qt=V=>{p(V)},$r=ee.creditAccount.limit,zr=()=>{g(!1),s("..")},Kr=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:I&&Ee,isTOSAccepted:ve,isSetupEnabled:se,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Zr=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:_&&re,isTOSAccepted:fe,isSetupEnabled:E,isUserHasCardsAdminLevelAccess:o,isUserHasCardsAccess:Wt}),Yr=Kr||Zr,Qt=function(V){const{isEmptyCardsState:je,isChargeCardAdmin:We,isFileUploadEnabled:Jt}=V,en=le(),Na=he(),{tenantEmailDomain:Va}=Ve(),{isAiCfoOpen:Xr,setIsAiCfoOpen:an}=Cr(),Jr=pr(),es=hr(),tn=i(be=>Un(be)).createSessionAndSubmitState.fetchState==="In-Progress",{chips:nn,isResolved:rn}=vr("cards_creation"),sn=r.useMemo(()=>wr(nn,rn,3),[nn,rn]),[Ha,pt]=r.useState(""),cn=es&&Jr&&Va!=null&&!Xr,ga=r.useCallback(be=>{if(Va==null)return;const as=ye(Na.state?.pathnameStackToGoBack,Na.pathname);en(`/${Va}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:as,referrer:"cards_hero",aiCfoInitialQuestion:be,aiCfoShouldSubmit:be!=null&&be.trim().length>0}})},[Na.pathname,Na.state,en,Va]),on=r.useCallback(be=>{be.trim().length!==0&&(pt(""),ga(be))},[ga]),dn=r.useCallback(()=>{const be=Ha.trim();be.length!==0&&(pt(""),ga(be))},[Ha,ga]),ln=r.useCallback(()=>{},[]),un=r.useCallback(be=>{pt(be)},[]),mn=r.useCallback(()=>{an(!0)},[an]),Cn=r.useCallback(()=>{ga(void 0)},[ga]);return r.useMemo(()=>{if(cn&&je&&We)return{aiAgentName:ii,headline:ci,subheadline:oi,promptChips:sn,composer:{currentInput:Ha,isSubmitting:tn,isFileUploadEnabled:Jt,onInputChange:un,onSubmit:dn,onStopSubmit:ln},onPromptClick:on,onOpenSidePanel:mn,onOpenFullView:Cn,dataTestIdPrefix:"cards-ai-cfo-hero"}},[Ha,cn,We,je,Jt,tn,un,Cn,mn,on,ln,dn,sn])}({isEmptyCardsState:Se,isChargeCardAdmin:o,isFileUploadEnabled:O}),Xt=z&&Qt!=null?c.jsx(fr,{...Qt}):null,Wr=h&&Xt==null,qr=ea(m),Qr={events:ha(qr,Mr),eventCallback:(V,je,We)=>{We.onEventReceived(V)},onSubscribed:V=>{V.onPusherSubscribed()}};return se||E?c.jsxs(c.Fragment,{children:[pe==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:J,onLoad:()=>{J.trackPageLoaded(br.Event.cardsListPage),(I&&!se||_&&!E)&&J.trackCardsPromoView(W,{isCreditCardOffered:I,isDebitCardOffered:_,isDebitCardEnabled:E,isCreditCardEnabled:se},"Banner",_&&!E?"Debit Card":I&&!se?"Credit Card":"","Card List")}}),c.jsx(nt,{showConfetti:Ge})]}):null,b===!0?c.jsx(Kt,{closeDrawerHandler:zr,isPaymentDrawerOpen:b,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:Ct,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isDebitCardInfoFetchStateCompleted:!(_&&E&&o)||na.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!I||ie.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!o||Ea.fetchState==="Completed",paymentInitiatedDate:ie.initiatedRepaymentDate}):null,c.jsxs(li,{children:[c.jsx(Ie,{isAppContentDrawerOpen:R,handleDrawerToggle:qt}),c.jsx(ui,{...Qr,isCashbackFeatureEnabled:k,isChargeCardFeatureEnabled:I,isDebitCardFeatureEnabled:_,isCreditCardProductVisibleForExpressInterest:N,updatePayNowInfoTooltip:u,showPayNowInfoTooltip:S,creditCardPayNowThreshold:q,signedInUser:v,chargeCardListState:ee,location:a,admins:Gr.users,navigateAndClearBulkSelection:s,currentTenant:m,isCardControlsEnabled:ke,companyChargeCardInfoCreditAccountLimit:m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:m.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:o,includeCreditAccountDebitSummaryAndCashbackInfo:w,onClickMenuIcon:()=>{qt(!0)},creditLimit:$r,isChargeCardSetupEnabled:se,isChargeCardEnabledOnCompany:Ee,isDebitCardSetupEnabled:E,isDebitCardEnabledOnCompany:re,isEarlyPayEnabled:f,isChargeCardPaymentHistoryFeatureEnabled:j,cashbackRate:ne,controllerEmails:W,chargeCardCashbackDetailState:Ea,depositAccountListWithDebitCardIssued:na,isChargeCardTOSAccepted:ve,isDebitCardTOSAccepted:fe,primaryFundingAccountDetails:ut,chargeCardSetUpViewFetchState:Aa.fetchState,productInformation:mt,creditAccountInformation:ze,debitAccountInformation:ra,cashbackInformation:$e,isAiCfoAccessEnabled:Wr,onAskAiCfoClick:T,isCardsCommentingEnabled:H,cardsAiCfoHero:Xt,onClickPolicyIcon:o&&L?()=>n(hi(m.tenantEmailDomain)):void 0,isPolicyIntroTooltipVisible:ja,onPolicyIntroTooltipClose:K,pendingCreationCount:Te})]})]}):(ve||fe)&&o===!0?c.jsx(oa,{to:"../setup"}):Yr?c.jsx(oa,{to:"../promo"}):c.jsx(va,{fetchState:pe})}const mi=e=>`/${e}/cards/new`,Ci=e=>`/${e}/cards/payment`,pi=e=>`/${e}/cards/payment-history`,hi=e=>`/${e}/cards/policy`,Nr=[Lr,Or],fi=new Set(Nr),gi=Pe(function(e){const n=te.getSignedInUser(),t=ge(e),a=e.tenantState.currentTenantId,s=nr(e),b={userId:n?.userId??"",sessionId:n?.zeniSessionId??"",tenantId:a??""},g=t?.companyName??"",S=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:s.fetchState,filters:s.filters,isZeniTenant:gc(t),repaymentList:s.repaymentHistory,searchText:s.searchText,repaymentHistoryUsers:s.repaymentHistoryUsers,sortConfig:{sortKey:s.uiState.sortKey,sortOrder:s.uiState.sortOrder},downloadParams:{authParams:b,companyName:g,spendManagementEndPoint:`${Et}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:S}},function(e,n){const{location:t,navigate:a}=n;return{onBackClick:()=>{const s=we(t.state?.pathnameStackToGoBack),b=s.poppedPathname??"..";a(b,{state:{pathnameStackToGoBack:s.newStack}})},onColumnSortConfigChanged:(s,b)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:s,sortOrder:b}}})},onFiltersChange:s=>{e(bc({filters:s}))},onReloadPayments:()=>{e(Ga(!0))},onEventReceived:s=>{fi.has(s)&&e(Ga(!0))},onPusherSubscribed:()=>{e(Ga(!0))},onSearchTextChanged:s=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:s})},updateDownloadStateHandler:s=>{e(Sc({uiState:{downloadState:s}}))}}})(st(io));function Si(){const e=le(),n=he(),t=me(),{areTenantIdsInSync:a}=Sr(),{useFeatureGate:s}=ue();if(te.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const b=i(o=>ge(o)),g=i(o=>nr(o)),[S,P]=r.useState(!1),[u,C]=r.useState(!1),[F,v]=r.useState(!1),[m,M]=r.useState(null),B=!b.userRole.includes("charge_card_user"),R=!!b.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:p}=s(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:h}=s(Z.isDebitCardFeatureEnabled),T=Re(h,b),l=Oe({isDebitCardFeatureEnabled:h,isBankingOnlyTenant:T}),w=xe(b),E=Be(b),U=b.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=Ue({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:p,isBookKeepingTenant:E,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:U}),k=!!b.companyChargeCardInfo?.info?.isChargeCardEnabled,x=Le(),d=Fe(x?.loggedInUserRoleMap),f=i(o=>Ca(o,B,l&&R,y&&k)),j=r.useMemo(()=>{const o=f.cards.filter(A=>A.type.code.includes("debit"));return[...new Set(o.map(A=>A.connectedAccountId))]},[f.cards]),H=i(o=>ma(o)),O=i(o=>tt(o,j)),{creditAccountRepayment:L}=i(o=>ua(o)),z=r.useMemo(()=>Mt(d,H),[d,H]),$=r.useMemo(()=>Ba(y,k,d,f.creditAccount,L),[y,k,d,f.creditAccount,L]),_=r.useMemo(()=>Nt(l,R,d,O,f.debitCardSummary),[l,R,d,O,f.debitCardSummary]),D=r.useMemo(()=>Xe(y,l,R,k),[y,l,R,k]),G=f.creditAccount.balance.amount+f.creditAccount.hold.amount,Q=r.useMemo(()=>m!=null?g.repaymentHistory.find(o=>o.cardRepaymentId===m):void 0,[m,g.repaymentHistory]),I=r.useCallback(o=>{M(o),t(ia(B,l&&R,y&&k,!1)),v(!0)},[t,B,l,R,y,k]),N=r.useCallback(()=>{v(!1),M(null),document.body.style.overflow="auto"},[]);r.useEffect(()=>{S||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(P(!0),t(Ga()))},[S,t,g.fetchState]),r.useEffect(()=>{!u&&(k||R)&&a&&(C(!0),t(ia(B,!1,y&&k,!1)))},[u,k,R,a,t,B,y]);const Y=ea(b),X={events:ha(Y,Nr),eventCallback:(o,A,W)=>{W.onEventReceived(o)},onSubscribed:o=>{o.onPusherSubscribed()}};return c.jsxs(c.Fragment,{children:[F?c.jsx(Kt,{closeDrawerHandler:N,isPaymentDrawerOpen:F,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:G,productInformation:D,creditAccountInformation:$,debitAccountInformation:_,cashbackInformation:z,isDebitCardInfoFetchStateCompleted:!(l&&R&&d)||O.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!y||L.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!d||H.fetchState==="Completed",paymentInitiatedDate:L.initiatedRepaymentDate,retryRepayment:Q}):null,c.jsx(gi,{...X,location:n,navigate:e,accountInfoByAccountId:g.accountInfoByAccountId,onRetryPaymentClick:I})]})}const In=He.div`
26
26
  display: flex;
27
27
  height: 100vh;
28
28
  width: 100%;
@@ -31,7 +31,7 @@ import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as
31
31
  overflow: auto;
32
32
  align-items: center;
33
33
  background-color: ${e=>e.theme.colors.grey4};
34
- `,kn=Je.getLocalizedStrings().months;function bi(){const e=le(),n=me(),t=he(),{creditAccount:a,creditAccountRepayment:s}=i(D=>ua(D)),b=`${gr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[P,u]=r.useState(!1),C=i(D=>yc(D)),{useFeatureGate:F}=ue(),v=i(D=>ge(D)),{isFeatureEnabled:m}=F(K.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=F(K.isDebitCardFeatureEnabled),{isFeatureEnabled:B}=F(K.isCardsCommentingEnabled),R=Dr(B?v.companyId:void 0,{clearParams:B&&C.fetchState==="Completed"}),p=Re(M,v),h=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),T=xe(v),l=Be(v),w=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Ue({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:m,isBookKeepingTenant:l,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:w}),U=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,y=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,k=i(D=>da(D,v.companyId)),x=la(k.controllers),d=i(D=>rr(D)),f=d.cards.filter(D=>D.type.code.includes("debit")).map(D=>D.connectedAccountId),j=[...new Set(f)],H=i(D=>tt(D,j)),O=i(D=>Ic(D));r.useEffect(()=>{P||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))},[g,n,a.fetchState]),r.useEffect(()=>{P||a.fetchState!=="Completed"||a.id==null||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(u(!0),n(kc(a.id)))},[P,n,a.fetchState,a.id,C.fetchState]),r.useEffect(()=>{H.fetchState!=="Completed"&&H.fetchState!=="In-Progress"&&h&&U&&n(sr()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&n(Ne()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&U&&n(Ec()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&E&&y&&n(Tt())},[H.fetchState,h,U,d.fetchState,O.fetchState,s.fetchState,E,y]),r.useEffect(()=>{if(C.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&d.fetchState==="Completed"&&(!h||!U||H.fetchState==="Completed"&&O.fetchState==="Completed")){let D="",G="";if(C.statements.length>0){const Z=C.statements[C.statements.length-1].period,[X,o]=Z.split("-"),A=C.statements[0].period,[W,ne]=A.split("-");D=`${kn[parseInt(o)-1]} ${X}`,G=`${kn[parseInt(ne)-1]} ${W}`}const Q=Xe(E,h,U,y),I=Ba(E,y,!0,a,s),N=Nt(h,U,!0,H,O);J.trackCardsCreditCardStatementsView(x,Q,{numberOfStatements:C.statements.length,oldestStatementMonthYear:D,latestStatementMonthYear:G},I,N)}},[C.fetchState,a.fetchState,s.fetchState,H.fetchState,d.fetchState,O.fetchState]);const L=()=>{const D=we(t.state?.pathnameStackToGoBack),G=D.poppedPathname??"..";e(G,{state:{pathnameStackToGoBack:D.newStack}})},z=i(D=>ma(D)),$=te.getSignedInUser(),_={userId:$?.userId??"",sessionId:$?.zeniSessionId??"",tenantId:v.tenantId??""};if($==null)throw Error("Can't access address page without signing in...");if(C.fetchState!=="Completed")return c.jsx(In,{children:c.jsx(lo,{onBackClick:L})});{const D=Xe(E,h,U,y);return c.jsx(In,{children:c.jsx(uo,{currentTenantCompanyName:v.companyName,statementListView:C,productInformation:D,onBackClick:L,authParams:_,controllerEmails:x,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:y,isCardsCommentingEnabled:B,initialOpenThreadRequest:R,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:H,debitCardSummary:O,downloadEndPoint:b})})}}const Vr=[pa,it],yi=new Set(Vr),Ii={containerWidth:new Fa(100,58)},ki=({appContent:e})=>{const n=Ta(),t=me(),a=le(),s=he(),{useDynamicConfig:b}=ue(),[g,S]=r.useState(!1),[P,u]=r.useState(!1),[C,F]=r.useState(!1),[v,m]=r.useState(!1),M=r.useRef(!1),B=r.useRef(null);r.useEffect(()=>()=>{B.current!=null&&(clearTimeout(B.current),B.current=null)},[]);const[R,p]=r.useState(!1),[h,T]=r.useState(!1),l=te.getSignedInUser();if(l==null)throw Error("Can't access onboarding card page without signing in...");const w=i(N=>ge(N)),{configValue:E}=b(Ke.zeniCardsConfig),U=i(N=>Ac(N)),{tenantEmailDomain:y}=w,k=i(N=>N.settingsViewState.profile.fetchState),x=i(N=>N.chargeCardListState.fetchState),d=i(N=>N.settingsViewState.profile.userId),f=i(N=>N.chargeCardConfigState.fetchState);r.useEffect(()=>{g===!1&&k!=="In-Progress"&&k!=="Completed"&&(t(Dc()),S(!0)),P===!1&&f!=="In-Progress"&&f!=="Completed"&&(t(Qa()),u(!0)),C===!1&&x==="Not-Started"&&(F(!0),t(Ne()))},[g,C,x,P,f]),r.useEffect(()=>{k==="Completed"&&R===!1&&d!=null&&x==="Completed"&&U.cards.length>0&&(t(_c({userId:d})),t(cr({cardId:U.cards[U.cards.length-1].id})),p(!0))},[k,R,d,x]),r.useEffect(()=>{if(!v&&U.fetchState==="Completed"&&U.cards.length===0){const N=we(s.state?.pathnameStackToGoBack),Z=N.poppedPathname??aa(y);a(Z,{state:{pathnameStackToGoBack:N.newStack}})}},[U.fetchState,U.cards,v]);const j=i(N=>qa(N)),H=ya(j.updateStatus.fetchState),O=j.currentDisplayedCardId,{useFeatureGate:L}=ue(),{isFeatureEnabled:z}=L(K.isChargeCardFeatureEnabled),$=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!w.userRole.includes("charge_card_user")&&z&&$,D=i(N=>O!=null?or(N.chargeCardState,O):null),G=()=>{O!=null&&(M.current=!0,B.current!=null&&clearTimeout(B.current),B.current=setTimeout(()=>{M.current=!1,B.current=null},5e3),t(ka(O,_,!0)),t(Ne(!0)),m(!0))},Q=ea(w);Vt({events:ha(Q,Vr),onSubscribed:()=>{t(Ne(!0))},onEvent:(N,Z)=>{if(!yi.has(N))return;const X=Kt(Z),o=M.current;if(N===pa){const W=de(X?.card_id)??O;if(W!=null){const ne=Zt(X,W);if(ne!=null)return t(Ft(ne)),void(W!==O||o||G())}}if(N===it)return void t(Ne(!0));const A=de(X?.card_id)??O;(O==null||A===O)&&O!=null?o||G():t(Ne(!0))}}),r.useEffect(()=>{if(v&&O!=null&&D!=null&&D.status.code!=="request_on_hold"){const N=_e(w.tenantEmailDomain,O,l,D),Z=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Pc()),D?.type.code==="business_virtual_credit_card"&&t(Xa()),a(N,{state:{pathnameStackToGoBack:Z},replace:!0}),M.current=!1,B.current!=null&&(clearTimeout(B.current),B.current=null)}},[v,D?.status.code]),r.useEffect(()=>{H==="In-Progress"&&j.updateStatus.fetchState==="Completed"&&setTimeout(G,3e3)},[H,j.updateStatus.fetchState]);const I=N=>{T(N)};if(k!=="Completed"||U.cards.length===0)return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(mo,{})]});if(d==null)throw Error("Can't access my userId.");return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(Ei,{chargeCardListView:U,cardUserOnboardingView:j,navigate:a,currentTenant:w,myUserId:d,location:s,chargeCardCashbackRatePerTransaction:E.charge_card_cashback_rate_per_transaction!=null?E.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?c.jsx(Ai,{windowSize:n,children:e}):null]})},Ei=Pe(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{cards:a.cards,showMenuIcon:g,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}},function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:b}=n,{tenantEmailDomain:g}=b;return{updateCardUserOnboardingLocalData:S=>{e(fn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const P={...a.cardUserOnboardingLocalData,phone:S};e(fn({localData:P}))}e(at(S,"CardUserOnboarding"))},onResendOtp:S=>{e(et(S,"CardUserOnboarding"))},onVerifyOtp:(S,P)=>{e(Ja(S,P,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(wc()),S!=null&&te.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(cr({cardId:S}))},onBackClick:()=>{const S=we(s.state?.pathnameStackToGoBack),P=S.poppedPathname??aa(g);t(P,{state:{pathnameStackToGoBack:S.newStack}})}}})(Co),Ai=He.div`
34
+ `,kn=Je.getLocalizedStrings().months;function bi(){const e=le(),n=me(),t=he(),{creditAccount:a,creditAccountRepayment:s}=i(D=>ua(D)),b=`${gr.cardMicroServiceBaseUrl}/1.0/credit-accounts/${a.id}`,[g,S]=r.useState(!1),[P,u]=r.useState(!1),C=i(D=>yc(D)),{useFeatureGate:F}=ue(),v=i(D=>ge(D)),{isFeatureEnabled:m}=F(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:M}=F(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:B}=F(Z.isCardsCommentingEnabled),R=Dr(B?v.companyId:void 0,{clearParams:B&&C.fetchState==="Completed"}),p=Re(M,v),h=Oe({isDebitCardFeatureEnabled:M,isBankingOnlyTenant:p}),T=xe(v),l=Be(v),w=v.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,E=Ue({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:m,isBookKeepingTenant:l,isDebitCardProductVisible:h,chargeCardsCreditAccountLimit:w}),U=!!v.companyDebitCardInfo?.info?.isDebitCardEnabled,y=!!v.companyChargeCardInfo?.info?.isChargeCardEnabled,k=i(D=>da(D,v.companyId)),x=la(k.controllers),d=i(D=>rr(D)),f=d.cards.filter(D=>D.type.code.includes("debit")).map(D=>D.connectedAccountId),j=[...new Set(f)],H=i(D=>tt(D,j)),O=i(D=>Ic(D));r.useEffect(()=>{P||a.fetchState==="Completed"||a.fetchState==="In-Progress"||(S(!0),n(Qe()))},[g,n,a.fetchState]),r.useEffect(()=>{P||a.fetchState!=="Completed"||a.id==null||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(u(!0),n(kc(a.id)))},[P,n,a.fetchState,a.id,C.fetchState]),r.useEffect(()=>{H.fetchState!=="Completed"&&H.fetchState!=="In-Progress"&&h&&U&&n(sr()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&n(Ne()),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&h&&U&&n(Ec()),s.fetchState!=="Completed"&&s.fetchState!=="In-Progress"&&E&&y&&n(Tt())},[H.fetchState,h,U,d.fetchState,O.fetchState,s.fetchState,E,y]),r.useEffect(()=>{if(C.fetchState==="Completed"&&a.fetchState==="Completed"&&s.fetchState==="Completed"&&d.fetchState==="Completed"&&(!h||!U||H.fetchState==="Completed"&&O.fetchState==="Completed")){let D="",G="";if(C.statements.length>0){const Y=C.statements[C.statements.length-1].period,[X,o]=Y.split("-"),A=C.statements[0].period,[W,ne]=A.split("-");D=`${kn[parseInt(o)-1]} ${X}`,G=`${kn[parseInt(ne)-1]} ${W}`}const Q=Xe(E,h,U,y),I=Ba(E,y,!0,a,s),N=Nt(h,U,!0,H,O);J.trackCardsCreditCardStatementsView(x,Q,{numberOfStatements:C.statements.length,oldestStatementMonthYear:D,latestStatementMonthYear:G},I,N)}},[C.fetchState,a.fetchState,s.fetchState,H.fetchState,d.fetchState,O.fetchState]);const L=()=>{const D=we(t.state?.pathnameStackToGoBack),G=D.poppedPathname??"..";e(G,{state:{pathnameStackToGoBack:D.newStack}})},z=i(D=>ma(D)),$=te.getSignedInUser(),_={userId:$?.userId??"",sessionId:$?.zeniSessionId??"",tenantId:v.tenantId??""};if($==null)throw Error("Can't access address page without signing in...");if(C.fetchState!=="Completed")return c.jsx(In,{children:c.jsx(lo,{onBackClick:L})});{const D=Xe(E,h,U,y);return c.jsx(In,{children:c.jsx(uo,{currentTenantCompanyName:v.companyName,statementListView:C,productInformation:D,onBackClick:L,authParams:_,controllerEmails:x,isChargeCardFeatureEnabled:E,isDebitCardFeatureEnabled:h,isDebitCardSetupEnabled:U,isChargeCardSetupEnabled:y,isCardsCommentingEnabled:B,initialOpenThreadRequest:R,chargeCardCashbackDetailState:z,creditAccount:a,creditAccountRepayment:s,depositAccountListWithDebitCardIssued:H,debitCardSummary:O,downloadEndPoint:b})})}}const Vr=[pa,it],yi=new Set(Vr),Ii={containerWidth:new Fa(100,58)},ki=({appContent:e})=>{const n=Ta(),t=me(),a=le(),s=he(),{useDynamicConfig:b}=ue(),[g,S]=r.useState(!1),[P,u]=r.useState(!1),[C,F]=r.useState(!1),[v,m]=r.useState(!1),M=r.useRef(!1),B=r.useRef(null);r.useEffect(()=>()=>{B.current!=null&&(clearTimeout(B.current),B.current=null)},[]);const[R,p]=r.useState(!1),[h,T]=r.useState(!1),l=te.getSignedInUser();if(l==null)throw Error("Can't access onboarding card page without signing in...");const w=i(N=>ge(N)),{configValue:E}=b(Ze.zeniCardsConfig),U=i(N=>Ac(N)),{tenantEmailDomain:y}=w,k=i(N=>N.settingsViewState.profile.fetchState),x=i(N=>N.chargeCardListState.fetchState),d=i(N=>N.settingsViewState.profile.userId),f=i(N=>N.chargeCardConfigState.fetchState);r.useEffect(()=>{g===!1&&k!=="In-Progress"&&k!=="Completed"&&(t(Dc()),S(!0)),P===!1&&f!=="In-Progress"&&f!=="Completed"&&(t(Qa()),u(!0)),C===!1&&x==="Not-Started"&&(F(!0),t(Ne()))},[g,C,x,P,f]),r.useEffect(()=>{k==="Completed"&&R===!1&&d!=null&&x==="Completed"&&U.cards.length>0&&(t(_c({userId:d})),t(cr({cardId:U.cards[U.cards.length-1].id})),p(!0))},[k,R,d,x]),r.useEffect(()=>{if(!v&&U.fetchState==="Completed"&&U.cards.length===0){const N=we(s.state?.pathnameStackToGoBack),Y=N.poppedPathname??aa(y);a(Y,{state:{pathnameStackToGoBack:N.newStack}})}},[U.fetchState,U.cards,v]);const j=i(N=>qa(N)),H=ya(j.updateStatus.fetchState),O=j.currentDisplayedCardId,{useFeatureGate:L}=ue(),{isFeatureEnabled:z}=L(Z.isChargeCardFeatureEnabled),$=!!w.companyChargeCardInfo?.info?.isChargeCardEnabled,_=!w.userRole.includes("charge_card_user")&&z&&$,D=i(N=>O!=null?or(N.chargeCardState,O):null),G=()=>{O!=null&&(M.current=!0,B.current!=null&&clearTimeout(B.current),B.current=setTimeout(()=>{M.current=!1,B.current=null},5e3),t(ka(O,_,!0)),t(Ne(!0)),m(!0))},Q=ea(w);Vt({events:ha(Q,Vr),onSubscribed:()=>{t(Ne(!0))},onEvent:(N,Y)=>{if(!yi.has(N))return;const X=Zt(Y),o=M.current;if(N===pa){const W=de(X?.card_id)??O;if(W!=null){const ne=Yt(X,W);if(ne!=null)return t(Ft(ne)),void(W!==O||o||G())}}if(N===it)return void t(Ne(!0));const A=de(X?.card_id)??O;(O==null||A===O)&&O!=null?o||G():t(Ne(!0))}}),r.useEffect(()=>{if(v&&O!=null&&D!=null&&D.status.code!=="request_on_hold"){const N=_e(w.tenantEmailDomain,O,l,D),Y=ye(s.state?.pathnameStackToGoBack,s.pathname);t(Pc()),D?.type.code==="business_virtual_credit_card"&&t(Xa()),a(N,{state:{pathnameStackToGoBack:Y},replace:!0}),M.current=!1,B.current!=null&&(clearTimeout(B.current),B.current=null)}},[v,D?.status.code]),r.useEffect(()=>{H==="In-Progress"&&j.updateStatus.fetchState==="Completed"&&setTimeout(G,3e3)},[H,j.updateStatus.fetchState]);const I=N=>{T(N)};if(k!=="Completed"||U.cards.length===0)return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(mo,{})]});if(d==null)throw Error("Can't access my userId.");return c.jsxs(En,{children:[c.jsx(Ie,{isAppContentDrawerOpen:h,handleDrawerToggle:I}),c.jsx(Ei,{chargeCardListView:U,cardUserOnboardingView:j,navigate:a,currentTenant:w,myUserId:d,location:s,chargeCardCashbackRatePerTransaction:E.charge_card_cashback_rate_per_transaction!=null?E.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{I(!0)}}),e!=null?c.jsx(Ai,{windowSize:n,children:e}):null]})},Ei=Pe(function(e,{currentTenant:n,cardUserOnboardingView:t,chargeCardListView:a,myUserId:s}){const b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{cards:a.cards,showMenuIcon:g,companyLegalName:n.companyName,twoFAView:t.twoFAView,cardUserOnboardingLocalData:t.cardUserOnboardingLocalData??{userId:s},isDOBDisabled:t.isDOBPresent,onboardingProgressStatus:t.onboardingProgressStatus}},function(e,n){const{navigate:t,cardUserOnboardingView:a,location:s,currentTenant:b}=n,{tenantEmailDomain:g}=b;return{updateCardUserOnboardingLocalData:S=>{e(fn({localData:S}))},onGetOtp:S=>{if(a.cardUserOnboardingLocalData!=null){const P={...a.cardUserOnboardingLocalData,phone:S};e(fn({localData:P}))}e(at(S,"CardUserOnboarding"))},onResendOtp:S=>{e(et(S,"CardUserOnboarding"))},onVerifyOtp:(S,P)=>{e(Ja(S,P,"CardUserOnboarding"))},onVerifyOtpSuccess:S=>{e(wc()),S!=null&&te.saveZeniOtpToken(S)},setCurrentDisplayedCardId:S=>{e(cr({cardId:S}))},onBackClick:()=>{const S=we(s.state?.pathnameStackToGoBack),P=S.poppedPathname??aa(g);t(P,{state:{pathnameStackToGoBack:S.newStack}})}}})(Co),Ai=He.div`
35
35
  display: flex;
36
36
  flex-direction: column;
37
37
  width: ${e=>`${Ii.containerWidth.value(e.windowSize)}%`};
@@ -44,12 +44,12 @@ import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as
44
44
  flex-direction: column;
45
45
  align-items: center;
46
46
  background-color: ${e=>e.theme.colors.grey4};
47
- `,Di={containerWidth:new Fa(100,58)},_i=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g,useFeatureGate:S}=ue(),[P,u]=r.useState(!1),[C,F]=r.useState(!1),[v,m]=r.useState(!1),[M,B]=r.useState(!1),R=te.getSignedInUser();if(R==null)throw Error("Can't access onboarding card page without signing in...");const p=i(_=>ge(_));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ke.zeniCardsConfig),T=i(_=>vc(_,s)),{isFeatureEnabled:l}=S(K.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=S(K.isDebitCardFeatureEnabled),E=Re(w,p),U=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:E}),y=xe(p),k=Be(p),x=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Ue({isCardsOnlyTenant:y,isChargeCardFeatureEnabled:l,isBookKeepingTenant:k,isDebitCardProductVisible:U,chargeCardsCreditAccountLimit:x}),f=T.chargeCard,j=i(_=>_.chargeCardConfigState.fetchState);r.useEffect(()=>{P===!1&&j!=="In-Progress"&&j!=="Completed"&&(t(Qa()),u(!0)),C===!1&&T.fetchState==="Not-Started"&&(F(!0),t(ka(s,!1,d)))},[C,T.fetchState,P,j]);const H=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(v===!1&&(H===!1||H&&f.status?.code!=="active"||H&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==R.userId)){const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);a(_,{state:{pathnameStackToGoBack:D}})}else if(v&&T.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){t(Tc({chargeCardId:s}));const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(_,{state:{pathnameStackToGoBack:D}})}}},[T.fetchState,f?.type.code,v,T.isRefreshingViewInBackground]);const O=te.getZeniOtpTokenForCardHolder(s),L=i(_=>Nn(_.userState,R.userId)),z=()=>{f?.isPinSet!==!0&&t(Sa(s,!0))};r.useEffect(()=>{T.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),m(!0))},[T.updateDebitCardPinAttemptFetchState.fetchState]);const $=_=>{B(_)};if(j!=="Completed"||f==null)return c.jsx(va,{fetchState:"In-Progress"});if(L?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(vi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:M,handleDrawerToggle:$}),c.jsx(Pi,{cardId:s,card:f,phone:L.phone,signedInUser:R,isSandboxEnv:Lt(),debitCardDetailState:T,signedInUserToken:O,navigate:a,currentTenant:p,location:b,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?c.jsx(wi,{windowSize:n,children:e}):null]})},Pi=Pe(function(e,{debitCardDetailState:n,cardId:t}){const a=Vn(e,t),s=n.updateStatus,b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{showMenuIcon:g,vgsVaultId:rt.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,debitCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:u=>{e(Zn(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onSetPinSuccess:()=>{e(Fc({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(po),wi=He.div`
47
+ `,Di={containerWidth:new Fa(100,58)},_i=({appContent:e})=>{const n=Ta(),t=me(),a=le(),{cardId:s}=Ve(),b=he(),{useDynamicConfig:g,useFeatureGate:S}=ue(),[P,u]=r.useState(!1),[C,F]=r.useState(!1),[v,m]=r.useState(!1),[M,B]=r.useState(!1),R=te.getSignedInUser();if(R==null)throw Error("Can't access onboarding card page without signing in...");const p=i(_=>ge(_));if(s==null)throw Error("Empty card id is not valid...");const{configValue:h}=g(Ze.zeniCardsConfig),T=i(_=>vc(_,s)),{isFeatureEnabled:l}=S(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=S(Z.isDebitCardFeatureEnabled),E=Re(w,p),U=Oe({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:E}),y=xe(p),k=Be(p),x=p.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,d=Ue({isCardsOnlyTenant:y,isChargeCardFeatureEnabled:l,isBookKeepingTenant:k,isDebitCardProductVisible:U,chargeCardsCreditAccountLimit:x}),f=T.chargeCard,j=i(_=>_.chargeCardConfigState.fetchState);r.useEffect(()=>{P===!1&&j!=="In-Progress"&&j!=="Completed"&&(t(Qa()),u(!0)),C===!1&&T.fetchState==="Not-Started"&&(F(!0),t(ka(s,!1,d)))},[C,T.fetchState,P,j]);const H=f?.type.code==="business_physical_debit_card"||f?.type.code==="business_virtual_debit_card";r.useEffect(()=>{if(T.fetchState==="Completed"){if(v===!1&&(H===!1||H&&f.status?.code!=="active"||H&&f.status.code==="active"&&f.isPinSet||f.cardHolderUserId!==R.userId)){const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);a(_,{state:{pathnameStackToGoBack:D}})}else if(v&&T.isRefreshingViewInBackground===!1&&f?.isPinSet===!0){t(Tc({chargeCardId:s}));const _=_e(p.tenantEmailDomain,s,R,f,!0),D=ye(b.state?.pathnameStackToGoBack,b.pathname);t(Xa()),a(_,{state:{pathnameStackToGoBack:D}})}}},[T.fetchState,f?.type.code,v,T.isRefreshingViewInBackground]);const O=te.getZeniOtpTokenForCardHolder(s),L=i(_=>Nn(_.userState,R.userId)),z=()=>{f?.isPinSet!==!0&&t(Sa(s,!0))};r.useEffect(()=>{T.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(z,3e3),m(!0))},[T.updateDebitCardPinAttemptFetchState.fetchState]);const $=_=>{B(_)};if(j!=="Completed"||f==null)return c.jsx(va,{fetchState:"In-Progress"});if(L?.phone==null)throw Error("Can't access user phone number.");return c.jsxs(vi,{children:[c.jsx(Ie,{isAppContentDrawerOpen:M,handleDrawerToggle:$}),c.jsx(Pi,{cardId:s,card:f,phone:L.phone,signedInUser:R,isSandboxEnv:Lt(),debitCardDetailState:T,signedInUserToken:O,navigate:a,currentTenant:p,location:b,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?c.jsx(wi,{windowSize:n,children:e}):null]})},Pi=Pe(function(e,{debitCardDetailState:n,cardId:t}){const a=Vn(e,t),s=n.updateStatus,b=Ca(e,!1,!1,!1);let g=!1;return b.fetchState==="Completed"&&b.cards.length<=1&&(g=!0),{showMenuIcon:g,vgsVaultId:rt.cardVaultId,twoFAView:a,setPinWaitStatus:s}},function(e,n){const{navigate:t,cardId:a,location:s,currentTenant:b,debitCardDetailState:g}=n,S=g.chargeCard?.cardProviderID,{tenantEmailDomain:P}=b;return{onGetOtp:u=>{S!=null&&e(at(u,"ChargeCardHolder",a))},onUpdateDebitCardPinAttempt:u=>{e(Yn(a,u))},onResendOtp:u=>{S!=null&&e(et(u,"ChargeCardHolder",a))},onVerifyOtp:(u,C)=>{S!=null&&e(Ja(u,C,"ChargeCardHolder",a))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,a)},onSetPinSuccess:()=>{e(Fc({chargeCardId:a}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),C=u.poppedPathname==null||u.poppedPathname.includes("activate")===!0?aa(P):u.poppedPathname;t(C,{state:{pathnameStackToGoBack:u.newStack}})}}})(po),wi=He.div`
48
48
  display: flex;
49
49
  flex-direction: column;
50
50
  width: ${e=>`${Di.containerWidth.value(e.windowSize)}%`};
51
51
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
52
- box-shadow: ${e=>`${Ka.sp0} 2px ${Ka.sp1} ${e.theme.colors.dropShadowNormal}`};
52
+ box-shadow: ${e=>`${Za.sp0} 2px ${Za.sp1} ${e.theme.colors.dropShadowNormal}`};
53
53
  `,vi=He.div`
54
54
  display: flex;
55
55
  min-height: 100%;
@@ -58,8 +58,8 @@ import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as
58
58
  flex-direction: column;
59
59
  align-items: center;
60
60
  background-color: ${e=>e.theme.colors.grey4};
61
- box-shadow: ${e=>`${Ka.sp0} 2px ${Ka.sp1} ${e.theme.colors.dropShadowNormal}`};
62
- `,Ti={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Fi=Pe(function(e,n){const t=Bt(e,!1,!1),a=n.lineId,s=t.customAddress[a],b=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:b,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:b=>{t!=null&&e(ir(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=wo(b);e(Rc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Lc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Bc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(ho),xi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Ot(),s=Ta(),b=()=>{n()},g=i(S=>xc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S))?.newAddressId;return c.jsx(yr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Ti.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,P)=>(P==="backdropClick"||P==="escapeKeyDown")&&b(),children:c.jsx(Fi,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:b,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},Bi=Pe(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,P=Bt(e,t&&g,a&&S);return{issueChargeCards:P,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:P.userList.map(u=>u.user).filter(Boolean),allRoles:P.userList.map(u=>u.userRole),allAccountingClasses:P.allAccountingClasses,userList:P.userList}},function(e,n){return{onIssueCardClick:()=>{e(jc())},onSaveChangesToLocalStore:t=>{e(Uc(t))},onDismissClick:()=>{e(dr()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(ir(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(So);function Ri(){const e=te.getSignedInUser(),n=le(),t=me(),a=fo(),[s]=An(),b=s.get("cardType"),{useFeatureGate:g}=ue(),{isFeatureEnabled:S}=g(K.isIssuePhysicalCardEnabled),{isFeatureEnabled:P}=g(K.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:u}=g(K.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(K.isChargeCardFeatureEnabled),F=i(z=>ge(z)),v=Re(u,F),m=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:v}),M=xe(F),B=Be(F),R=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:C,isBookKeepingTenant:B,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:R}),[h,T]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{h||(T(!0),t(Oc(m&&w,p&&l,!1)))},[h,T,t]);const l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!F.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(z=>Bt(z,p&&l,m&&w)),U=E.fetchState,y=E.issueCardStatus.fetchState,k=E.lastSelfIssuedDebitCardId,x=i(z=>k!=null?or(z.chargeCardState,k):void 0),[d,f]=r.useState(null),[j,H]=r.useState(null),O=()=>{f(null)},L=(z,$)=>{f(z),H($)};return r.useEffect(()=>{if(y==="Completed"){if(k!=null&&x?.type.code==="business_virtual_debit_card"){let z;z=x?.status.code==="request_on_hold"&&e.userId===x.cardHolderUserId?Ar(F.tenantEmailDomain):_e(F.tenantEmailDomain,k,e,x),n(z)}else n("../");t(dr())}},[y,k]),U==="Completed"?c.jsxs(c.Fragment,{children:[d!==null&&j!==null?c.jsx(xi,{closeDrawerHandler:O,lineId:d,chargeCardTypeOption:j}):null,c.jsx(Bi,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:P,isDebitCardFeatureEnabled:m,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:n,fetchState:E.fetchState,openAddAddressDrawerHandler:L,defaultCardType:b==="creditCard"||b==="debitCard"?b:void 0})]}):U==="Error"?c.jsx(ct,{}):c.jsx(go,{})}const Hr=[pa,it],Li=new Set(Hr),Oi=He.div`
61
+ box-shadow: ${e=>`${Za.sp0} 2px ${Za.sp1} ${e.theme.colors.dropShadowNormal}`};
62
+ `,Ti={overlayWidth:new Fa(ht[12],ht[12],ht[9])},Fi=Pe(function(e,n){const t=Bt(e,!1,!1),a=n.lineId,s=t.customAddress[a],b=t.customAddressStatus[a]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:n.googleAPIKey,customAddress:s,customAddressStatus:b,lineId:a}},function(e,n){const{newCustomAddressId:t,lineId:a,chargeCardTypeOption:s}=n;return{onSubmitHandler:b=>{t!=null&&e(ir(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`));const g=wo(b);e(Rc({addressType:`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`,addressToCreate:g})),e(Lc(`${s==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},onDismissClick:()=>{n.onDismissClick(),t!=null&&e(Bc({addressId:t,cardLineId:a,cardType:s==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(ho),xi=({lineId:e,closeDrawerHandler:n,chargeCardTypeOption:t})=>{const a=Ot(),s=Ta(),b=()=>{n()},g=i(S=>xc(`${t==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,S))?.newAddressId;return c.jsx(yr,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:Ti.overlayWidth.valuePercentage(s),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:a.colors.black,cursor:"pointer"}}},onClose:(S,P)=>(P==="backdropClick"||P==="escapeKeyDown")&&b(),children:c.jsx(Fi,{googleAPIKey:rt.googleMapsAPIKey,onDismissClick:b,lineId:e,chargeCardTypeOption:t,newCustomAddressId:g})})},Bi=Pe(function(e,n){const{isChargeCardFeatureEnabled:t,isDebitCardFeatureEnabled:a,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S}=n,P=Bt(e,t&&g,a&&S);return{issueChargeCards:P,isIssuePhysicalCardEnabled:s,isIssuePhysicalDebitCardEnabled:b,isDebitCardFeatureEnabled:a,isChargeCardFeatureEnabled:t,isChargeCardSetupEnabled:g,isDebitCardSetupEnabled:S,cardHolderCandidates:P.userList.map(u=>u.user).filter(Boolean),allRoles:P.userList.map(u=>u.userRole),allAccountingClasses:P.allAccountingClasses,userList:P.userList}},function(e,n){return{onIssueCardClick:()=>{e(jc())},onSaveChangesToLocalStore:t=>{e(Uc(t))},onDismissClick:()=>{e(dr()),n.navigate("../")},resetCustomAddressByLineID:(t,a)=>{e(ir(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${t}_address`))},openAddAddressDrawerHandler:n.openAddAddressDrawerHandler}})(So);function Ri(){const e=te.getSignedInUser(),n=le(),t=me(),a=fo(),[s]=An(),b=s.get("cardType"),{useFeatureGate:g}=ue(),{isFeatureEnabled:S}=g(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:P}=g(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:u}=g(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Z.isChargeCardFeatureEnabled),F=i(z=>ge(z)),v=Re(u,F),m=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:v}),M=xe(F),B=Be(F),R=F.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=Ue({isCardsOnlyTenant:M,isChargeCardFeatureEnabled:C,isBookKeepingTenant:B,isDebitCardProductVisible:m,chargeCardsCreditAccountLimit:R}),[h,T]=r.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");r.useEffect(()=>{h||(T(!0),t(Oc(m&&w,p&&l,!1)))},[h,T,t]);const l=!!F.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!F.companyDebitCardInfo?.info?.isDebitCardEnabled,E=i(z=>Bt(z,p&&l,m&&w)),U=E.fetchState,y=E.issueCardStatus.fetchState,k=E.lastSelfIssuedDebitCardId,x=i(z=>k!=null?or(z.chargeCardState,k):void 0),[d,f]=r.useState(null),[j,H]=r.useState(null),O=()=>{f(null)},L=(z,$)=>{f(z),H($)};return r.useEffect(()=>{if(y==="Completed"){if(k!=null&&x?.type.code==="business_virtual_debit_card"){let z;z=x?.status.code==="request_on_hold"&&e.userId===x.cardHolderUserId?Ar(F.tenantEmailDomain):_e(F.tenantEmailDomain,k,e,x),n(z)}else n("../");t(dr())}},[y,k]),U==="Completed"?c.jsxs(c.Fragment,{children:[d!==null&&j!==null?c.jsx(xi,{closeDrawerHandler:O,lineId:d,chargeCardTypeOption:j}):null,c.jsx(Bi,{themeState:a,isIssuePhysicalCardEnabled:S,isIssuePhysicalDebitCardEnabled:P,isDebitCardFeatureEnabled:m,isChargeCardFeatureEnabled:p,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:n,fetchState:E.fetchState,openAddAddressDrawerHandler:L,defaultCardType:b==="creditCard"||b==="debitCard"?b:void 0})]}):U==="Error"?c.jsx(ct,{}):c.jsx(go,{})}const Hr=[pa,it],Li=new Set(Hr),Oi=He.div`
63
63
  display: flex;
64
64
  height: 100vh;
65
65
  width: 100%;
@@ -68,4 +68,4 @@ import{j as c}from"./liveblocks-BPCHZ54B.js";import{u as me,j as i,h as le,g as
68
68
  overflow: auto;
69
69
  align-items: center;
70
70
  background-color: ${e=>e.theme.colors.grey4};
71
- `,Ui=Pe(function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:b,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:P}=g;return{onChargeCardRowClick:u=>{const C=Er(P,u),F=_e(S,u,b,C),v=ye(s.state?.pathnameStackToGoBack,s.pathname);t(F,{state:{pathnameStackToGoBack:v}})},onColumnSortConfigChanged:(u,C)=>{e(It({uiState:{sortKey:u,sortOrder:C}}))},onReloadCards:()=>{e(Ne())},onBackClick:()=>{const u=a.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(bo);function ji(){const e=le(),n=me(),t=he(),a=Ot(),[s,b]=r.useState(!1),g=i(L=>Mc(L)),S=i(L=>ge(L)),P=i(L=>da(L,S.companyId)),u=la(P.controllers),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(K.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=C(K.isDebitCardFeatureEnabled),m=Re(v,S),M=Oe({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:m}),B=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,R=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Le(),h=xe(S),T=Be(S),l=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Ue({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:F,isBookKeepingTenant:T,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:l}),E=Fe(p?.loggedInUserRoleMap),U=i(L=>ma(L)),{creditAccount:y,creditAccountRepayment:k}=i(L=>ua(L)),x=i(L=>rr(L)).cards.filter(L=>L.type.code.includes("debit")).map(L=>L.connectedAccountId),d=[...new Set(x)],f=i(L=>tt(L,d));r.useEffect(()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(b(!0),n(Ne()),n(Qa()))},[s,n,g.fetchState]),r.useEffect(()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&j!=null){const L=_e(S.tenantEmailDomain,g.cards[0].id,j,g.cards[0]);e(L,{state:{message:t.state?.message}})}},[g.fetchState,g.cards]);const j=te.getSignedInUser();r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&w&&R&&E&&n(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&E&&n(Tt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&M&&B&&E&&n(sr())},[y.fetchState,k.fetchState,n,f.fetchState,M,B,E,w,R]);const H=ea(S);if(Vt({events:ha(H,Hr),onEvent:(L,z)=>{if(!Li.has(L))return;const $=Kt(z);if(L===pa){const _=de($?.card_id);if(_!=null){const D=Zt($,_);if(D!=null)return void n(Ft(D))}}n(Ne(!0))},onSubscribed:()=>{n(Ne(!0))}}),j==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const L=Xe(w,M,B,R);return c.jsx(Oi,{children:c.jsx(Ui,{navigate:e,currentTenant:S,signedInUser:j,productInformation:L,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:M,isDebitCardSetupEnabled:B,isChargeCardSetupEnabled:R,chargeCardCashbackDetailState:U,creditAccount:y,creditAccountRepayment:k,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const Mi=Pe(function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:b,isChargeCardSetupEnabled:g,signedInUser:S,location:P,productInformation:u,isEarlyPayEnabled:C,controllerEmails:F,chargeCardsCreditAccountLimit:v}=n;return{onSetupButtonClick:m=>{if(S!=null&&J.trackCardsPromoPageClicked("enable cards"),s)switch(J.trackCardsEnableCardsClick(F,u,"Cards Promo"),m){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(J.trackCardsSetupCardsClick(F,u,"Cards Promo"),m){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const m=we(P.state?.pathnameStackToGoBack);let M=m.poppedPathname;M==null&&(M=b||g?"..":"../.."),t(M,{state:{pathnameStackToGoBack:m.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Hc(a))}}})(Io),Ni=()=>{const e=le(),{tenantEmailDomain:n}=Ve(),[t]=An(),a=t.get("cardPromoType"),s=me(),{useDynamicConfig:b,useFeatureGate:g}=ue(),[S,P]=r.useState(!1),{isFeatureEnabled:u}=g(K.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:F}=g(K.isChargeCardFeatureEnabled),{configValue:v}=b(Ke.zeniCardsConfig),m=i(ae=>ge(ae)),M=i(ae=>da(ae,m.companyId)),B=la(M.controllers),R=v.charge_card_cashback_rate_per_transaction!=null?v.charge_card_cashback_rate_per_transaction:.0175,p=he(),h=te.getSignedInUserTenant(n)?.companyId??m.companyId,T=i(ae=>wa(ae,h)),l=T.primaryFundingAccount,w=m.companyBillPayInfo?.info,E=xe(m),U=Be(m),y=Re(u,m),k=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:y}),d=Ue({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:k}),f=kr({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U}),j=x&&d===!1,H=w?.businessVerificationStatus?.code==="verified"&&(j||l?.accType==="depositAccount"||Nc(l?.providerVerificationStatus?.code??"")),O=te.getSignedInUser(),L=!!m.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,$=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,_=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,D=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,G=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,Q=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,I=ae=>{P(ae)},N=i(ae=>ae.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const Z=Le(),X=Fe(Z?.loggedInUserRoleMap),o=xt(Z?.loggedInUserRoleMap),[A,W]=r.useState(!1),[ne,q]=r.useState(!1),[ke,ve]=r.useState(!1);r.useEffect(()=>{A===!1&&p.state?.message==="activation"&&W(!0)},[p.state]),r.useEffect(()=>{ne||N!=="Not-Started"||h==null||(q(!0),s(Pa(h,!0)))},[ne,N,h,s]);const fe=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:f&&$,isTOSAccepted:z,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:X,isUserHasCardsAccess:o}),se=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:x&&_,isTOSAccepted:Q,isSetupEnabled:G,isUserHasCardsAdminLevelAccess:X,isUserHasCardsAccess:o}),Ee=x&&se&&f&&k>=0&&fe?"debit_and_credit":x&&se?"debit":"credit",re=Po(a,Ee),Ce=T?.chargeCardTermsDetails?.fetchStatus?.fetchState,Ae=r.useRef(null);r.useEffect(()=>{Ce==="In-Progress"?Ae.current=re:Ce!=="Error"&&Ce!=="Not-Started"||(Ae.current=null)},[Ce,re]);const ee=Ce!=="In-Progress"&&Ce!=="Completed"||Ae.current==null?re:Ae.current;r.useEffect(()=>{re==="credit"&&(D||f===!1&&G)||re==="debit"&&G||re==="debit_and_credit"&&G&&D?e("../"):(re==="debit_and_credit"&&z===!0&&Q===!0||re==="credit"&&(z===!0||f===!1&&Q===!0)||re==="debit"&&Q===!0)&&X===!0&&e("../setup")},[H,D,G,re,z,Q]),r.useEffect(()=>{ke||(s(Vc("cardAdmin")),ve(!0))},[ke]);const Te=i(ae=>tr(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin")),De=Xe(f,x,G,D);return(ae=>{switch(ae){case"credit":return $;case"debit":return _;case"debit_and_credit":return $&&_;default:return!1}})(ee)?(fe||se)&&N==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(br.Event.cardsPromoPage),!!f&&!D||!!x&&!G||!!f&&!!x&&!G&&!D){const ae=Vi({isDebitCardSetupEnabled:G,isChargeCardSetupEnabled:D,isCreditCardProductVisibleForExpressInterest:f,isDebitCardProductVisible:x});J.trackCardsPromoView(B,De,"Page",ae,"Promo Page")}}}),c.jsx(nt,{showConfetti:A}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(Mi,{signedInUser:O,location:p,showEnableCardButton:H,isCompanyBusinessVerificationAndPaymentSetUpDone:H,isChargeCardSetupEnabled:D,isDebitCardSetupEnabled:G,companyLegalName:m.companyName,adminList:Te.users,isCheckingEnabled:L,navigate:e,companyId:h,cardPromoType:ee,controllerEmails:B,productInformation:De,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:u,isEarlyPayEnabled:C,cashbackRate:R,chargeCardsCreditAccountLimit:k,onClickMenuIcon:()=>{I(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(yo,{})]}):c.jsx(oa,{to:"../",replace:!0})},Vi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function Cd(){const e=he(),n=i(Z=>ge(Z)),{useFeatureGate:t}=ue(),{isFeatureEnabled:a}=t(K.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(K.isDebitCardFeatureEnabled),{isFeatureEnabled:b}=t(K.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(K.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(K.isCardPolicyEnabled),P=Re(s,n),u=Oe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:P}),C=ko(n,a,s),F=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,v=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,m=!!n.company?.companyChargeCardInfo?.isChargeCardEnabled,M=!!n.company?.companyDebitCardInfo?.isDebitCardEnabled,B=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,R=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,p=Le(),h=Fe(p?.loggedInUserRoleMap),T=xt(p?.loggedInUserRoleMap),{isFeatureEnabled:l}=t(K.isCashbackFeatureEnabled),w=n.userRole.includes("charge_card_user"),E=!w,U=!w&&B,y=n?.userRole!=null&&Gc(n?.userRole),k=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&$c(p?.loggedInUserRoleMap),x=zc(p?.loggedInUserRoleMap),d=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Yc(p?.loggedInUserRoleMap),{isFeatureEnabled:f}=t(K.isDepositAccountsFeatureEnabled),j=f&&!y&&Gn(p?.loggedInUserRoleMap),H=B&&m&&!y,O=R&&M&&!y,L=C&&!y&&Fe(p?.loggedInUserRoleMap),z=Kc(p?.loggedInUserRoleMap),$=xe(n),_=Be(n),D=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,G=Ue({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:a,isBookKeepingTenant:_,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:D}),Q=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:G&&m,isTOSAccepted:F,isSetupEnabled:B,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:T}),I=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:u&&M,isTOSAccepted:v,isSetupEnabled:R,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:T}),N=Q||I;return c.jsxs(ts,{children:[h?c.jsx(ce,{path:"setup",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,isUserHasOnlyBillPayAccess:x,productType:"charge_cards",type:"setup"})}):null,h?c.jsx(ce,{path:"verification",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isUserHasOnlyBillPayAccess:x,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,productType:"charge_cards",type:"verification"})}):null,h&&S?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"policy",element:c.jsx(Vo,{})}),c.jsx(ce,{path:"policy/new",element:c.jsx(xo,{})}),c.jsx(ce,{path:"policy/:templateId/edit",element:c.jsx(Oo,{})})]}):null,c.jsx(ce,{path:"promo",element:c.jsx(Ni,{})}),H||O?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"/",element:c.jsx(yn,{isPaymentDrawerOpen:!1})}),L&&b?c.jsx(ce,{path:"payment",element:c.jsx(yn,{isPaymentDrawerOpen:!0})}):null,c.jsx(ce,{path:"activate",element:c.jsx(ji,{})}),c.jsx(ce,{path:"onboard",element:c.jsx(ki,{})}),h?c.jsx(ce,{path:"new",element:c.jsx(Ri,{})}):null,l&&E?c.jsx(ce,{path:"cashback",element:c.jsx(Yo,{})}):null,U?c.jsx(ce,{path:"statements",element:c.jsx(bi,{})}):null,L&&g&&B?c.jsx(ce,{path:"payment-history",element:c.jsx(Si,{})}):null,c.jsx(ce,{path:":cardId/activate",element:c.jsx(Wo,{})}),c.jsx(ce,{path:":cardId/setPin",element:c.jsx(_i,{})}),c.jsx(ce,{path:":cardId/addToWallet",element:c.jsx(Ho,{})}),c.jsx(ce,{path:":cardId/*",element:c.jsx(si,{})}),c.jsx(ce,{path:"*",element:c.jsx(ct,{})})]}):(F||v)&&h?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../setup"})}):N?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../promo",state:e.state})}):c.jsx(ce,{path:"*",element:null})]})}export{Cd as default};
71
+ `,Ui=Pe(function(e,n){const{myPendingActivationChargeCardListState:t}=n;return{myPendingActivationChargeCardListView:t,uiState:t.uiState,signedInUser:n.signedInUser}},function(e,n){const{navigate:t,currentTenant:a,location:s,signedInUser:b,myPendingActivationChargeCardListState:g}=n,{tenantEmailDomain:S}=a,{cards:P}=g;return{onChargeCardRowClick:u=>{const C=Er(P,u),F=_e(S,u,b,C),v=ye(s.state?.pathnameStackToGoBack,s.pathname);t(F,{state:{pathnameStackToGoBack:v}})},onColumnSortConfigChanged:(u,C)=>{e(It({uiState:{sortKey:u,sortOrder:C}}))},onReloadCards:()=>{e(Ne())},onBackClick:()=>{const u=a.userRole.includes("charge_card_user");e(It({uiState:{sortKey:u?"cardName":"owner",sortOrder:"ascending"}})),t("../")}}})(bo);function ji(){const e=le(),n=me(),t=he(),a=Ot(),[s,b]=r.useState(!1),g=i(L=>Mc(L)),S=i(L=>ge(L)),P=i(L=>da(L,S.companyId)),u=la(P.controllers),{useFeatureGate:C}=ue(),{isFeatureEnabled:F}=C(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:v}=C(Z.isDebitCardFeatureEnabled),m=Re(v,S),M=Oe({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:m}),B=!!S.companyDebitCardInfo?.info?.isDebitCardEnabled,R=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,p=Le(),h=xe(S),T=Be(S),l=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=Ue({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:F,isBookKeepingTenant:T,isDebitCardProductVisible:M,chargeCardsCreditAccountLimit:l}),E=Fe(p?.loggedInUserRoleMap),U=i(L=>ma(L)),{creditAccount:y,creditAccountRepayment:k}=i(L=>ua(L)),x=i(L=>rr(L)).cards.filter(L=>L.type.code.includes("debit")).map(L=>L.connectedAccountId),d=[...new Set(x)],f=i(L=>tt(L,d));r.useEffect(()=>{s||g.fetchState==="Completed"||g.fetchState==="In-Progress"||(b(!0),n(Ne()),n(Qa()))},[s,n,g.fetchState]),r.useEffect(()=>{if(g.fetchState==="Completed"&&g.cards.length===1&&j!=null){const L=_e(S.tenantEmailDomain,g.cards[0].id,j,g.cards[0]);e(L,{state:{message:t.state?.message}})}},[g.fetchState,g.cards]);const j=te.getSignedInUser();r.useEffect(()=>{y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&w&&R&&E&&n(Qe()),k.fetchState!=="Completed"&&k.fetchState!=="In-Progress"&&E&&n(Tt()),f.fetchState!=="Completed"&&f.fetchState!=="In-Progress"&&M&&B&&E&&n(sr())},[y.fetchState,k.fetchState,n,f.fetchState,M,B,E,w,R]);const H=ea(S);if(Vt({events:ha(H,Hr),onEvent:(L,z)=>{if(!Li.has(L))return;const $=Zt(z);if(L===pa){const _=de($?.card_id);if(_!=null){const D=Yt($,_);if(D!=null)return void n(Ft(D))}}n(Ne(!0))},onSubscribed:()=>{n(Ne(!0))}}),j==null)throw Error("Can't access address page without signing in...");const O=g.cards!=null&&g.cards.length>0;if(g.fetchState==="Completed"||O){const L=Xe(w,M,B,R);return c.jsx(Oi,{children:c.jsx(Ui,{navigate:e,currentTenant:S,signedInUser:j,productInformation:L,myPendingActivationChargeCardListState:g,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:M,isDebitCardSetupEnabled:B,isChargeCardSetupEnabled:R,chargeCardCashbackDetailState:U,creditAccount:y,creditAccountRepayment:k,depositAccountListWithDebitCardIssued:f,controllerEmails:u,location:t})})}return c.jsx(va,{fetchState:"In-Progress",style:{backgroundColor:a.colors.grey5}})}const Mi=Pe(function(e,n){const{companyId:t,companyLegalName:a}=n;return{chargeCardSetupView:wa(e,t),admins:n.adminList,companyLegalName:a,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,n){const{navigate:t,companyId:a,isCompanyBusinessVerificationAndPaymentSetUpDone:s,isDebitCardSetupEnabled:b,isChargeCardSetupEnabled:g,signedInUser:S,location:P,productInformation:u,isEarlyPayEnabled:C,controllerEmails:F,chargeCardsCreditAccountLimit:v}=n;return{onSetupButtonClick:m=>{if(S!=null&&J.trackCardsPromoPageClicked("enable cards"),s)switch(J.trackCardsEnableCardsClick(F,u,"Cards Promo"),m){case"credit":e(qe(a,!0,"charge_cards",C,!1));break;case"debit":e(qe(a,!0,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!0,"debit_cards",C,!0):qe(a,!0,"charge_cards__debit_cards",C,!1))}else switch(J.trackCardsSetupCardsClick(F,u,"Cards Promo"),m){case"credit":e(qe(a,!1,"charge_cards",C,!1));break;case"debit":e(qe(a,!1,"debit_cards",C,!1));break;case"debit_and_credit":e(v===0?qe(a,!1,"debit_cards",C,!0):qe(a,!1,"charge_cards__debit_cards",C,!1))}},onBackClick:()=>{const m=we(P.state?.pathnameStackToGoBack);let M=m.poppedPathname;M==null&&(M=b||g?"..":"../.."),t(M,{state:{pathnameStackToGoBack:m.newStack}})},onLetsGoClick:()=>{t("./onboard")},onSetupChargeCardSuccess:()=>{s?(e(Xa()),t("../",{relative:"path"})):t("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(Hc(a))}}})(Io),Ni=()=>{const e=le(),{tenantEmailDomain:n}=Ve(),[t]=An(),a=t.get("cardPromoType"),s=me(),{useDynamicConfig:b,useFeatureGate:g}=ue(),[S,P]=r.useState(!1),{isFeatureEnabled:u}=g(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:C}=g(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:F}=g(Z.isChargeCardFeatureEnabled),{configValue:v}=b(Ze.zeniCardsConfig),m=i(ae=>ge(ae)),M=i(ae=>da(ae,m.companyId)),B=la(M.controllers),R=v.charge_card_cashback_rate_per_transaction!=null?v.charge_card_cashback_rate_per_transaction:.0175,p=he(),h=te.getSignedInUserTenant(n)?.companyId??m.companyId,T=i(ae=>wa(ae,h)),l=T.primaryFundingAccount,w=m.companyBillPayInfo?.info,E=xe(m),U=Be(m),y=Re(u,m),k=m.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isDebitCardFeatureEnabled:u,isBankingOnlyTenant:y}),d=Ue({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U,isDebitCardProductVisible:x,chargeCardsCreditAccountLimit:k}),f=kr({isCardsOnlyTenant:E,isChargeCardFeatureEnabled:F,isBookKeepingTenant:U}),j=x&&d===!1,H=w?.businessVerificationStatus?.code==="verified"&&(j||l?.accType==="depositAccount"||Nc(l?.providerVerificationStatus?.code??"")),O=te.getSignedInUser(),L=!!m.companyZeniAccountInfo?.info?.isZeniAccountEnabled,z=!!m.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,$=!!m.company?.companyChargeCardInfo?.isChargeCardEnabled,_=!!m.company?.companyDebitCardInfo?.isDebitCardEnabled,D=!!m.companyChargeCardInfo?.info?.isChargeCardEnabled,G=!!m.companyDebitCardInfo?.info?.isDebitCardEnabled,Q=!!m.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,I=ae=>{P(ae)},N=i(ae=>ae.chargeCardSetupViewState.fetchState);if(O==null)throw Error("Can't access Charge Card promo page without signing in...");const Y=Le(),X=Fe(Y?.loggedInUserRoleMap),o=xt(Y?.loggedInUserRoleMap),[A,W]=r.useState(!1),[ne,q]=r.useState(!1),[ke,ve]=r.useState(!1);r.useEffect(()=>{A===!1&&p.state?.message==="activation"&&W(!0)},[p.state]),r.useEffect(()=>{ne||N!=="Not-Started"||h==null||(q(!0),s(Pa(h,!0)))},[ne,N,h,s]);const fe=m.companyChargeCardInfo?.info!=null&&Ia({cardInfo:m.companyChargeCardInfo.info,isProductVisible:f&&$,isTOSAccepted:z,isSetupEnabled:D,isUserHasCardsAdminLevelAccess:X,isUserHasCardsAccess:o}),se=m.companyDebitCardInfo?.info!=null&&Ia({cardInfo:m.companyDebitCardInfo.info,isProductVisible:x&&_,isTOSAccepted:Q,isSetupEnabled:G,isUserHasCardsAdminLevelAccess:X,isUserHasCardsAccess:o}),Ee=x&&se&&f&&k>=0&&fe?"debit_and_credit":x&&se?"debit":"credit",re=Po(a,Ee),Ce=T?.chargeCardTermsDetails?.fetchStatus?.fetchState,Ae=r.useRef(null);r.useEffect(()=>{Ce==="In-Progress"?Ae.current=re:Ce!=="Error"&&Ce!=="Not-Started"||(Ae.current=null)},[Ce,re]);const ee=Ce!=="In-Progress"&&Ce!=="Completed"||Ae.current==null?re:Ae.current;r.useEffect(()=>{re==="credit"&&(D||f===!1&&G)||re==="debit"&&G||re==="debit_and_credit"&&G&&D?e("../"):(re==="debit_and_credit"&&z===!0&&Q===!0||re==="credit"&&(z===!0||f===!1&&Q===!0)||re==="debit"&&Q===!0)&&X===!0&&e("../setup")},[H,D,G,re,z,Q]),r.useEffect(()=>{ke||(s(Vc("cardAdmin")),ve(!0))},[ke]);const Te=i(ae=>tr(ae.userState,ae.userRoleState,ae.userListViewState,"cardAdmin")),De=Xe(f,x,G,D);return(ae=>{switch(ae){case"credit":return $;case"debit":return _;case"debit_and_credit":return $&&_;default:return!1}})(ee)?(fe||se)&&N==="Completed"?c.jsxs(c.Fragment,{children:[c.jsx(Ut,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(br.Event.cardsPromoPage),!!f&&!D||!!x&&!G||!!f&&!!x&&!G&&!D){const ae=Vi({isDebitCardSetupEnabled:G,isChargeCardSetupEnabled:D,isCreditCardProductVisibleForExpressInterest:f,isDebitCardProductVisible:x});J.trackCardsPromoView(B,De,"Page",ae,"Promo Page")}}}),c.jsx(nt,{showConfetti:A}),c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(Mi,{signedInUser:O,location:p,showEnableCardButton:H,isCompanyBusinessVerificationAndPaymentSetUpDone:H,isChargeCardSetupEnabled:D,isDebitCardSetupEnabled:G,companyLegalName:m.companyName,adminList:Te.users,isCheckingEnabled:L,navigate:e,companyId:h,cardPromoType:ee,controllerEmails:B,productInformation:De,isCreditCardProductVisible:d,isDebitCardFeatureEnabled:u,isEarlyPayEnabled:C,cashbackRate:R,chargeCardsCreditAccountLimit:k,onClickMenuIcon:()=>{I(!0)}})]}):c.jsxs(c.Fragment,{children:[c.jsx(Ie,{isAppContentDrawerOpen:S,handleDrawerToggle:I}),c.jsx(yo,{})]}):c.jsx(oa,{to:"../",replace:!0})},Vi=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:n,isCreditCardProductVisibleForExpressInterest:t,isDebitCardProductVisible:a})=>t&&a&&!e&&!n?"Credit & Debit Card":t&&!n?"Credit Card":a&&!e?"Debit Card":"";function Cd(){const e=he(),n=i(Y=>ge(Y)),{useFeatureGate:t}=ue(),{isFeatureEnabled:a}=t(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:s}=t(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:b}=t(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:g}=t(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:S}=t(Z.isCardPolicyEnabled),P=Re(s,n),u=Oe({isDebitCardFeatureEnabled:s,isBankingOnlyTenant:P}),C=ko(n,a,s),F=!!n.company?.companyChargeCardInfo.isChargeCardTOSAccepted,v=!!n.company?.companyDebitCardInfo.isDebitCardTOSAccepted,m=!!n.company?.companyChargeCardInfo?.isChargeCardEnabled,M=!!n.company?.companyDebitCardInfo?.isDebitCardEnabled,B=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,R=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,p=Le(),h=Fe(p?.loggedInUserRoleMap),T=xt(p?.loggedInUserRoleMap),{isFeatureEnabled:l}=t(Z.isCashbackFeatureEnabled),w=n.userRole.includes("charge_card_user"),E=!w,U=!w&&B,y=n?.userRole!=null&&Gc(n?.userRole),k=(n?.company==null||n.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!y)&&$c(p?.loggedInUserRoleMap),x=zc(p?.loggedInUserRoleMap),d=(n?.company==null||n.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!y)&&Kc(p?.loggedInUserRoleMap),{isFeatureEnabled:f}=t(Z.isDepositAccountsFeatureEnabled),j=f&&!y&&Gn(p?.loggedInUserRoleMap),H=B&&m&&!y,O=R&&M&&!y,L=C&&!y&&Fe(p?.loggedInUserRoleMap),z=Zc(p?.loggedInUserRoleMap),$=xe(n),_=Be(n),D=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,G=Ue({isCardsOnlyTenant:$,isChargeCardFeatureEnabled:a,isBookKeepingTenant:_,isDebitCardProductVisible:u,chargeCardsCreditAccountLimit:D}),Q=n.companyChargeCardInfo?.info!=null&&Ia({cardInfo:n.companyChargeCardInfo.info,isProductVisible:G&&m,isTOSAccepted:F,isSetupEnabled:B,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:T}),I=n.companyDebitCardInfo?.info!=null&&Ia({cardInfo:n.companyDebitCardInfo.info,isProductVisible:u&&M,isTOSAccepted:v,isSetupEnabled:R,isUserHasCardsAdminLevelAccess:h,isUserHasCardsAccess:T}),N=Q||I;return c.jsxs(ts,{children:[h?c.jsx(ce,{path:"setup",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,isUserHasOnlyBillPayAccess:x,productType:"charge_cards",type:"setup"})}):null,h?c.jsx(ce,{path:"verification",element:c.jsx(gn,{isBillPayAdminLevelAccess:k,isUserHasOnlyBillPayAccess:x,isReimbursementAdminLevelAccess:d,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:L,isUserHasOnlyCardAccess:z,productType:"charge_cards",type:"verification"})}):null,h&&S?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"policy",element:c.jsx(Vo,{})}),c.jsx(ce,{path:"policy/new",element:c.jsx(xo,{})}),c.jsx(ce,{path:"policy/:templateId/edit",element:c.jsx(Oo,{})})]}):null,c.jsx(ce,{path:"promo",element:c.jsx(Ni,{})}),H||O?c.jsxs(c.Fragment,{children:[c.jsx(ce,{path:"/",element:c.jsx(yn,{isPaymentDrawerOpen:!1})}),L&&b?c.jsx(ce,{path:"payment",element:c.jsx(yn,{isPaymentDrawerOpen:!0})}):null,c.jsx(ce,{path:"activate",element:c.jsx(ji,{})}),c.jsx(ce,{path:"onboard",element:c.jsx(ki,{})}),h?c.jsx(ce,{path:"new",element:c.jsx(Ri,{})}):null,l&&E?c.jsx(ce,{path:"cashback",element:c.jsx(Ko,{})}):null,U?c.jsx(ce,{path:"statements",element:c.jsx(bi,{})}):null,L&&g&&B?c.jsx(ce,{path:"payment-history",element:c.jsx(Si,{})}):null,c.jsx(ce,{path:":cardId/activate",element:c.jsx(Wo,{})}),c.jsx(ce,{path:":cardId/setPin",element:c.jsx(_i,{})}),c.jsx(ce,{path:":cardId/addToWallet",element:c.jsx(Ho,{})}),c.jsx(ce,{path:":cardId/*",element:c.jsx(si,{})}),c.jsx(ce,{path:"*",element:c.jsx(ct,{})})]}):(F||v)&&h?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../setup"})}):N?c.jsx(ce,{path:"*",element:c.jsx(oa,{to:"../promo",state:e.state})}):c.jsx(ce,{path:"*",element:null})]})}export{Cd as default};
@@ -1 +1 @@
1
- import{j as m}from"./liveblocks-BPCHZ54B.js";import{a as g}from"./sentry-BRxO83Sz.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-DeUqRkPV.js";import{z as N,bd as P,J as F,f as V,h as j,af as C,be as A,at as L,au as U,v as B}from"./index-Cg4JV2tz.js";import{eX as D,gj as M,tC as _,ge as G,c6 as R,Pk as z,bn as Y,rC as q,rq as H,l5 as J,mG as S,Pl as Q,bE as X,cy as h,mQ as Z,mT as $}from"./zeni-epic-state-RQhLkJm1.js";import"./mui-DAoDgA6_.js";import{d as K}from"./routePaths-ZBpdAu85.js";import{M as W}from"./MobileAppDrawer-Dq7Q8eux.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="4ea14f42-67f8-47d7-8da7-3913c6dff3d2",t._sentryDebugIdIdentifier="sentry-dbid-4ea14f42-67f8-47d7-8da7-3913c6dff3d2")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t($())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(Z({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:b}=r,v={companyInfo:{...n,website:u!=""&&u!=null?h(u):void 0,meetingLink:y!=""&&y!=null?h(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?X(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:b.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(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=>{t(Q(e))},onCompanyOfficerUpdated:e=>{t(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=>{t(J({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=k(),{tenantEmailDomain:l}=x(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
1
+ import{j as m}from"./liveblocks-B2nLBm11.js";import{a as g}from"./sentry-CLlo3TXi.js";import{h as w,u as T,g as k,i as x,j as O,n as E}from"./core-BDPZcSG4.js";import{z as N,bd as P,v as F,d as V,f as j,af as C,be as A,at as L,au as U,r as B}from"./index-B1tuor_E.js";import{eX as D,gj as M,tC as _,ge as G,c6 as R,Pk as z,bn as Y,rC as q,rq as H,l5 as Q,mG as S,Pl as X,bE as Z,cy as b,mQ as $,mT as J}from"./zeni-epic-state-pQFlpfOQ.js";import"./mui-HaM5aBuG.js";import{d as K}from"./routePaths-DbVBNvPC.js";import{M as W}from"./MobileAppDrawer-ChAhLGZE.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="f4096088-e97b-4c2f-95a5-8c019376f510",t._sentryDebugIdIdentifier="sentry-dbid-f4096088-e97b-4c2f-95a5-8c019376f510")}catch{}})();const ee=E(function(t){const a=G(t),i=N.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(t.companyConfigState),n=t.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:a.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:a,allIndustries:e.companyIndustries??[],allNationalityCountries:n,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(t,a){const{companyId:i,currentTenant:l,navigate:c,location:p}=a,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let n=e.href;n.includes("http")||(n="https://".concat(n)),window.open(n,"_blank")},onSaveAll:()=>{t(J())},onAddressClick:e=>{const n=K(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t($({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:n,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=n,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...n,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:n.industry.selectedOption,companyIndustryType:n.companyIndustryType?.selectedOption??void 0,companySubIndustry:n.companySubIndustry?.selectedOption??void 0,businessModel:n.businessModel.selectedOption??"",companySourceOfFunds:n.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:n.companySourceOfFundsDescription??void 0,countriesOfOperations:n.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:n.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:n.transactionVolumeDescription??void 0,regulatedStatus:n.regulatedStatus??void 0,regulatedStatusDescription:n.regulatedStatusDescription??void 0,usNexus:n.usNexus??void 0,usNexusTypes:n.usNexusTypes?.selectedOptions??[],purposeOfAccount:n.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:n.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(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]}};t(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{t(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{t(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=>{t(X(e))},onCompanyOfficerUpdated:e=>{t(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=>{t(Q({files:e}))},onDeleteFile:e=>{t(H(e))},onEditFileName:(e,n)=>{t(q(e,n.split(".")[0]))}}})(A);function de(){const t=w(),a=T(),i=k(),{tenantEmailDomain:l}=x(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),n=O(s=>s.companyViewState.passportView.fetchState),o=O(s=>s.companyConfigState.fetchState),r=O(s=>D(s)),d=r.companyId??N.getSignedInUserTenant(l)?.companyId;if(N.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(M(d)))},[c,n,d,a]),g.useEffect(()=>{o==="Not-Started"&&a(_())},[o,a]);const u=s=>{e(s)},y=n==="Not-Started"||n==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&n==="Error"?m.jsx(P,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(F,{analytics:V,onLoad:s=>s.trackPageLoaded(j.Event.companyPassport,C(i)?"Settings":"Company Passport")}),C(i)?m.jsx(W,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:C(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};