@zeniai/web-app-ui 5.0.4-dev → 5.0.5-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 (115) hide show
  1. package/dist/assets/AddressRoutes-BJ6qdoLD.js +1 -0
  2. package/dist/assets/AddressScreen-CTET3dvy.js +9 -0
  3. package/dist/assets/{AiCfoScreen-BHQknTzK.js → AiCfoScreen-C696xm-F.js} +3 -3
  4. package/dist/assets/{BillPayApprovalRoutes-BjYSk6ti.js → BillPayApprovalRoutes-D5NqeVu0.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CHzCnxpe.js → BillPayRoutes-Ck98EEir.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-j2FAzNjV.js → BusinessVerificationPageScreen-Bp1i3y8M.js} +2 -2
  7. package/dist/assets/{ChargeCardRoutes-C761-FAb.js → ChargeCardRoutes-Brqn9urb.js} +7 -7
  8. package/dist/assets/CompanyPassportScreen-Co-nMIHe.js +1 -0
  9. package/dist/assets/{ConnectionAuthScreen-Ei8QSx21.js → ConnectionAuthScreen-Y4nfaNNV.js} +1 -1
  10. package/dist/assets/CustomerOnboardingAuthScreen-gxNylpwG.js +1 -0
  11. package/dist/assets/{CustomerOnboardingRoutes-CK9QfpeW.js → CustomerOnboardingRoutes-BRWqx_0f.js} +4 -4
  12. package/dist/assets/{DashboardRoutes-C2kxyP02.js → DashboardRoutes-B3U1f4u1.js} +3 -3
  13. package/dist/assets/{DefaultTenantHome-DduNDlJB.js → DefaultTenantHome-C4r-hTkj.js} +1 -1
  14. package/dist/assets/{DomesticWireDetailScreen-Cj8iAPXf.js → DomesticWireDetailScreen-CzTl9QXc.js} +3 -3
  15. package/dist/assets/DrawerScreen-Wjya0jbS.js +1 -0
  16. package/dist/assets/{EntityDetailRoutes-CCSZXrNV.js → EntityDetailRoutes-BiBUkyBy.js} +1 -1
  17. package/dist/assets/{ExpenseAutomationRoutes-D95clzaF.js → ExpenseAutomationRoutes-Mno1g-90.js} +3 -3
  18. package/dist/assets/FeaturePreviewScreen-DfsTuVkN.js +1 -0
  19. package/dist/assets/MagicLinkRoutes-BxQ-5ayp.js +72 -0
  20. package/dist/assets/MagicLinkSignInScreen-DaLkRpCV.js +12 -0
  21. package/dist/assets/{MobileAppDrawer-D0-D1IIa.js → MobileAppDrawer-Clk7FI85.js} +1 -1
  22. package/dist/assets/NotFoundScreen-CAOLTLHp.js +1 -0
  23. package/dist/assets/{NotificationRoutes-fnITeGvC.js → NotificationRoutes-Et6v_O-z.js} +1 -1
  24. package/dist/assets/{PandLWithForecastRoutes-DXeM7QQi.js → PandLWithForecastRoutes-PVFrj_hl.js} +1 -1
  25. package/dist/assets/PeopleRoutes-AzcRD0Yf.js +22 -0
  26. package/dist/assets/PerformanceRoutes-GWU_y7En.js +1 -0
  27. package/dist/assets/{Preview-RTK9mHhj.js → Preview-MGBTnTFX.js} +1 -1
  28. package/dist/assets/{QBOConnectionScreen-CMvaIZxf.js → QBOConnectionScreen-CcDeJYBx.js} +1 -1
  29. package/dist/assets/{ReferralListScreen-CU0cqYp3.js → ReferralListScreen-DgyLr49m.js} +2 -2
  30. package/dist/assets/{ReimbursementApprovalRoutes-DghBrXt3.js → ReimbursementApprovalRoutes-D5db9hma.js} +1 -1
  31. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CnM97Nh_.js → ReimbursementApprovalRuleDetailScreen-N-cMdQ-A.js} +1 -1
  32. package/dist/assets/{ReimbursementRoutes-BlPwJb9-.js → ReimbursementRoutes-JgtzXn1e.js} +8 -8
  33. package/dist/assets/{ReportsRoutes-OsfHQ-oH.js → ReportsRoutes-Bzvx_8qb.js} +1 -1
  34. package/dist/assets/RewardsRoutes-DHQCeZWs.js +1 -0
  35. package/dist/assets/ScreenRoutes-CsRNaB7V.js +2 -0
  36. package/dist/assets/{SettingsRoutes-DZ_F2Kb6.js → SettingsRoutes-DNYnZ26G.js} +7 -7
  37. package/dist/assets/{SetupPagesScreen-B8Rno5B2.js → SetupPagesScreen-CmJWX7Ir.js} +1 -1
  38. package/dist/assets/SignInScreen-DxjD1CPo.js +1 -0
  39. package/dist/assets/{SignOutScreen-C7mRBzAo.js → SignOutScreen-tGSzKdMS.js} +1 -1
  40. package/dist/assets/{TaskListScreen-xi0Q2QtO.js → TaskListScreen-TQmA5ZGq.js} +2 -2
  41. package/dist/assets/{TaskRoutes-B_fERi8e.js → TaskRoutes-DBh6aj7c.js} +2 -2
  42. package/dist/assets/TransactionDetailRoutes-Cjt29p_e.js +1 -0
  43. package/dist/assets/{TransactionDetailScreen-Bgfn35GF.js → TransactionDetailScreen-BQZTcMhs.js} +2 -2
  44. package/dist/assets/{TransactionListRoutes-B3VXniAo.js → TransactionListRoutes-CcuSwiOJ.js} +1 -1
  45. package/dist/assets/{TreasuryRoutes-CLsu4EBs.js → TreasuryRoutes-DpMwhemK.js} +6 -6
  46. package/dist/assets/{VendorsRoutes-DTiBYFq_.js → VendorsRoutes-frUR5tPv.js} +19 -19
  47. package/dist/assets/WiseConfirmationScreen-B2x2znqS.js +12 -0
  48. package/dist/assets/{ZeniAccountRoutes-D7fsKNF6.js → ZeniAccountRoutes-D-YpoVj0.js} +11 -11
  49. package/dist/assets/{ZeniAccountStatementScreen-CD8WdGq8.js → ZeniAccountStatementScreen-C3hVq6G3.js} +1 -1
  50. package/dist/assets/{accountMappingHelper-BvCdqdBq.js → accountMappingHelper-QKMWvJHt.js} +1 -1
  51. package/dist/assets/{analytics-Cp5F-UjF.js → analytics-vyykHm3I.js} +1 -1
  52. package/dist/assets/{analyticsHelper-BTOyHFla.js → analyticsHelper-MCISw32F.js} +1 -1
  53. package/dist/assets/{core-DZE88rLA.js → core-a8i-_0Kh.js} +1 -1
  54. package/dist/assets/{decodeURIComponentSafe--utjO_hD.js → decodeURIComponentSafe-B_IVipCF.js} +1 -1
  55. package/dist/assets/{dnd-B4DEM2bW.js → dnd-CDdU3ON0.js} +1 -1
  56. package/dist/assets/{empty-DTOnM0RR.js → empty-9qzWTKUd.js} +1 -1
  57. package/dist/assets/{empty-CRf4YhY4.js → empty-wLiJa_AW.js} +1 -1
  58. package/dist/assets/{emptyVideoElement-BgQif9Ia.js → emptyVideoElement-CLFouTmB.js} +1 -1
  59. package/dist/assets/{epic-BzOmBklW.js → epic-CvkQWhDA.js} +1 -1
  60. package/dist/assets/getLocaleForTenant-C0C8sNl1.js +1 -0
  61. package/dist/assets/{index-DpHHAj1V.js → index-BgPY0rlK.js} +1 -1
  62. package/dist/assets/{index-BET54Nt-.js → index-CJiQhPf1.js} +10412 -10401
  63. package/dist/assets/{index-j9ZiGcsv.js → index-DTPu_Uy6.js} +1 -1
  64. package/dist/assets/{index-CofKdFHU.js → index-DYi-byqV.js} +2 -2
  65. package/dist/assets/{index-ChZJ__M2.js → index-DfNhtpOm.js} +1 -1
  66. package/dist/assets/{index-BWIeQAsg.js → index-DvmHdckU.js} +1 -1
  67. package/dist/assets/{index-CTObQYXg.js → index-HUopGLCJ.js} +1 -1
  68. package/dist/assets/{lexical-Bp_BNV6r.js → lexical-BzneVI9m.js} +1 -1
  69. package/dist/assets/{liveblocks-Cqbf2YvG.js → liveblocks-ZAKgWoPK.js} +1 -1
  70. package/dist/assets/{lottie-BMcMDJUW.js → lottie-DN0gYkdx.js} +1 -1
  71. package/dist/assets/{mui-B4xUUoCx.js → mui-B8yatdty.js} +1 -1
  72. package/dist/assets/{pathToGoBack-H4XoSP95.js → pathToGoBack-EHg1lj9D.js} +1 -1
  73. package/dist/assets/{pdf-DYKlsr3c.js → pdf-C4rebPwh.js} +3 -3
  74. package/dist/assets/{pdf-lib-vymaIDnW.js → pdf-lib-OiZx9iEf.js} +1 -1
  75. package/dist/assets/{plaid-G98kqTnM.js → plaid-CP3hLhCR.js} +1 -1
  76. package/dist/assets/{pusher-D7P3EdsP.js → pusher-BCOUDezq.js} +1 -1
  77. package/dist/assets/{react-CLdnK8kQ.js → react-B7vOmlcy.js} +1 -1
  78. package/dist/assets/{react-CuhJdsIn.js → react-BEOXxta6.js} +1 -1
  79. package/dist/assets/{react-BmZ57NU9.js → react-C3aQn_52.js} +1 -1
  80. package/dist/assets/{react-BEWrpOF5.js → react-DHgntsyD.js} +1 -1
  81. package/dist/assets/{react-4qgRGAdN.js → react-DWmQOvam.js} +1 -1
  82. package/dist/assets/{react-Bhe_slJS.js → react-DqZkiZdy.js} +1 -1
  83. package/dist/assets/{recharts-3_XOsuaw.js → recharts-BhJEeZEG.js} +1 -1
  84. package/dist/assets/{routePaths-BNouI24c.js → routePaths-BJH4smh2.js} +1 -1
  85. package/dist/assets/{sentry-gLPXz4Yq.js → sentry-Bp45iw9z.js} +1 -1
  86. package/dist/assets/{url-DpALAoIG.js → url-DV9yGLNd.js} +1 -1
  87. package/dist/assets/{url-DMg8GQjt.js → url-asQ2Q_hT.js} +1 -1
  88. package/dist/assets/useAskAiCfoHostNavButtonProps-YJt2mAQE.js +1 -0
  89. package/dist/assets/{useDeviceId-CMDzs7Gm.js → useDeviceId-AHvFaHki.js} +1 -1
  90. package/dist/assets/useFetchSuggestedQuestionsWhenReady-bhvjxs2J.js +1 -0
  91. package/dist/assets/{useInitialThreadRequest-DFJpueCY.js → useInitialThreadRequest-zJW0Aqvd.js} +1 -1
  92. package/dist/assets/{utils-oW6HiHsc.js → utils-ikosPjSL.js} +1 -1
  93. package/dist/assets/{withTransactionSidePanel-DiiilNMM.js → withTransactionSidePanel-CslN6Fxb.js} +2 -2
  94. package/dist/assets/{zeni-epic-state-Cc2P4FPR.js → zeni-epic-state-ZCc1K30S.js} +3 -3
  95. package/dist/index.html +1 -1
  96. package/package.json +2 -2
  97. package/dist/assets/AddressRoutes-BfOuxooD.js +0 -1
  98. package/dist/assets/AddressScreen-tCLozkzY.js +0 -9
  99. package/dist/assets/CompanyPassportScreen-BVtucNEF.js +0 -1
  100. package/dist/assets/CustomerOnboardingAuthScreen-CYRzq56g.js +0 -1
  101. package/dist/assets/DrawerScreen-Dv_UzQOo.js +0 -1
  102. package/dist/assets/FeaturePreviewScreen-3Cs41rNa.js +0 -1
  103. package/dist/assets/MagicLinkRoutes-DqbOY0pO.js +0 -72
  104. package/dist/assets/MagicLinkSignInScreen-cJxTn6Z5.js +0 -12
  105. package/dist/assets/NotFoundScreen-BM3DcBu4.js +0 -1
  106. package/dist/assets/PeopleRoutes-DWNHtx0-.js +0 -22
  107. package/dist/assets/PerformanceRoutes-B2---Xlh.js +0 -1
  108. package/dist/assets/RewardsRoutes-DCXhofuE.js +0 -1
  109. package/dist/assets/ScreenRoutes-DsynOrE_.js +0 -2
  110. package/dist/assets/SignInScreen-rwU-QvmY.js +0 -1
  111. package/dist/assets/TransactionDetailRoutes-Bid-ev7j.js +0 -1
  112. package/dist/assets/WiseConfirmationScreen-DCTQj8ux.js +0 -12
  113. package/dist/assets/getLocaleForTenant-CPndpwIp.js +0 -1
  114. package/dist/assets/useAskAiCfoHostNavButtonProps-CIwJkrUG.js +0 -1
  115. package/dist/assets/useFetchSuggestedQuestionsWhenReady-CZP4Iues.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-Cqbf2YvG.js";import{j as ue,l as la,h as me,g as S,u as ye,k as ge,N as ya,q as mt,n as Jt,o as te}from"./core-DZE88rLA.js";import{eM as ie,br as Be,NJ as _a,eR as Se,eS as Ie,eT as Ae,fK as Me,co as ze,NK as $e,NL as $a,su as Sa,jg as Ia,NM as Aa,gy as ca,yY as aa,y_ as Ga,y$ as Ya,j6 as Ct,NN as Ge,yM as pt,NO as Qt,NP as Xt,yP as wa,NQ as en,Ma as Pa,qG as ht,yV as Za,gJ as an,NR as ft,NS as Ye,bp as tn,NT as nn,fA as Ta,fz as Fa,zt as rn,fy as va,LS as sn,NU as gt,cN as bt,cJ as on,M9 as ua,A3 as cn,NV as rt,zF as xa,NW as yt,A4 as dn,MA as ln,A5 as un,A$ as mn,rQ as Cn,AV as pn,ze as St,z7 as hn,NX as fn,fM as gn,zn as It,zr as At,fL as bn,NY as yn,zR as Et,NZ as Sn,N_ as In,N$ as An,zp as kt,za as Dt,yS as _t,zj as wt,zh as Pt,zl as En,yZ as st,O0 as Tt,O1 as La,zC as Ea,IR as Ft,cK as Ka,O2 as kn,O3 as Dn,O4 as _n,O5 as wn,zz as Ha,zY as Pn,zU as Tn,zv as Fn,zW as vn,zM as xn,zO as Ln,O6 as vt,A2 as xt,Gm as Bn,O7 as On,O8 as Rn,O9 as Un,Oa as Lt,Ob as Nn,Ap as jn,zE as Bt,zy as da,zD as Vn,Oc as Hn,Od as Mn,yJ as zn,Oe as Ot,Of as Rt,Og as $n,yL as Gn,yK as ot,Oh as Yn,Oi as Zn,Oj as Kn,IN as Wn,Ok as Wa,Ol as qn,vk as Ut,jQ as Jn,gz as Qn,Au as Xn,Om as Nt,On as er,Av as ar,Oo as tr,db as nr,so as rr,Ak as sr,Ae as Le,bu as or,bC as ir,ct as cr,bD as dr,I2 as lr}from"./zeni-epic-state-Cc2P4FPR.js";import{z as X,j as Re,a as oe,i as Z,B as Ze,bU as Ba,c3 as ur,p as ve,c4 as mr,c5 as Cr,Z as ma,aI as Fe,r as be,bb as qa,c6 as pr,x as Ca,h as Oa,m as Ja,d as J,D as Qa,c7 as hr,F as jt,al as Xa,bn as Xe,c8 as Ma,c9 as fr,w as et,a1 as gr,ca as br,ao as Vt,Q as za,H as Ht,f as Mt,cb as yr,cc as Sr,cd as Ir,ce as Ar,cf as Er,o as ka,cg as kr,ch as Dr,ci as Na,v as _r,cj as wr,ck as Pr,cl as Tr,cm as Fr,a4 as vr}from"./index-BET54Nt-.js";import{n as _e,D as zt,S as xr}from"./mui-B4xUUoCx.js";import{a as c}from"./sentry-gLPXz4Yq.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Oe,f as Ue,A as Lr,h as at,P as Br,i as tt,s as ea,j as Gt,k as He,l as Yt,m as Or,n as Zt,p as Rr,S as it}from"./SetupPagesScreen-B8Rno5B2.js";import Ra from"./NotFoundScreen-BM3DcBu4.js";import{M as ha}from"./MobileAppDrawer-D0-D1IIa.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-CIwJkrUG.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-CZP4Iues.js";import{v as ct}from"./utils-oW6HiHsc.js";import{t as Ur}from"./AddressScreen-tCLozkzY.js";import"./recharts-3_XOsuaw.js";import"./lottie-BMcMDJUW.js";import"./analytics-Cp5F-UjF.js";import"./plaid-G98kqTnM.js";import"./dnd-B4DEM2bW.js";import"./stripe-DMRn4zHo.js";import"./lexical-Bp_BNV6r.js";import"./pdf-DYKlsr3c.js";import"./analyticsHelper-BTOyHFla.js";import"./routePaths-BNouI24c.js";import"./BusinessVerificationPageScreen-j2FAzNjV.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="307a5ef7-480f-4804-8dac-be84621aca39",e._sentryDebugIdIdentifier="sentry-dbid-307a5ef7-480f-4804-8dac-be84621aca39")}catch{}})();function Nr(){const e=ue(),{cardId:t}=la(),a=me(),r=X.getSignedInUser(),n=S(G=>ie(G)),u=Re(),m=Be(u?.loggedInUserRoleMap),{useFeatureGate:C}=oe();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=S(G=>_a(G).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const D=n.userRole.includes("charge_card_user"),{isFeatureEnabled:A}=C(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:B}=C(Z.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(B,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,O=S(G=>Me(G,n.companyId)),N=ze(O.controllers),{creditAccount:T,creditAccountRepayment:P}=S(G=>$e(G)),j=S(G=>G.classListState.fetchState),p=!D&&l&&f,d=S(G=>$a(G,t,p,l)),[_,F]=c.useState(!1),U=d.chargeCard,M=U?.cardCreatedByUser?.userId,W=S(G=>M!=null?Sa(G.userRoleState,M):void 0),y=W?.accountingClassIDs[0],x=S(G=>y!=null?Ia(G.classState,{classId:y,reportId:"class_list"}):void 0),$=U?.cardHolderUser?.userId,R=S(G=>$!=null?Sa(G.userRoleState,$):void 0),Y=R?.accountingClassIDs[0],E=S(G=>Y!=null?Ia(G.classState,{classId:Y,reportId:"class_list"}):void 0),q=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",K=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&q&&(o(!0),setTimeout(()=>{a(Aa()),K&&a(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,q,K]),c.useEffect(()=>{_||d.fetchState==="Completed"||d.fetchState==="In-Progress"||t==null||(F(!0),a(aa(t,p,!1)))},[_,d,t,a]),c.useEffect(()=>{if(d.fetchState==="Completed"&&(q===!1||q&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const G=fe(n.tenantEmailDomain,t,r,U,i);e(G)}},[d.fetchState,i,q]),c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&l&&f&&m&&a(Ya()),j!=="Completed"&&j!=="In-Progress"&&a(Ct())},[T.fetchState,P.fetchState,a,l,f,m,j]);const z=()=>{if(r!=null&&t!=null){a(Aa());const G=fe(n.tenantEmailDomain,t,r);e(G)}},Ce=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",ae=Oe(l,g,w,f),L=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ze,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:N,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:L,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:j,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:x?.className,cardHolderRoles:R?.userRoles,cardHolderDepartmentName:E?.className})]})}const jr=ge(function(e){const t=Ge(e);return{insightsData:t.insight,cashbackByPeriod:t.cashbackByPeriod,uiState:t.uiState,cashbackSummary:t.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(t,a)=>{e(Qt({uiState:{sortKey:t,sortOrder:a}}))}}})(Cr);function Vr(){const e=ue(),t=me(),a=ye(),r=X.getSignedInUser(),n=S(o=>ie(o)),[u,m]=c.useState(!1),C=S(o=>Ge(o)),I=c.useCallback(()=>{const o=ve(a.state?.pathnameStackToGoBack),i=o.poppedPathname??Hr(n.tenantEmailDomain);e(i,{state:{pathnameStackToGoBack:o.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{u||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(m(!0),t(pt()))},[u,C,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return C.fetchState==="In-Progress"?s.jsx(mr,{onBackClick:I}):C.cashbackSummary.cashbackEarned.amount===0&&C.fetchState==="Completed"?s.jsx(Ra,{}):s.jsx(jr,{onBackClick:I})}const Hr=e=>`/${e}/cards`,Mr={containerWidth:new Ca(100,58)},zr=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m}=oe(),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(!1),v=X.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const k=S(E=>ie(E));if(n==null)throw Error("Empty card id is not valid...");const{configValue:h}=m(Fe.zeniCardsConfig),b=h.max_charge_card_activation_attempts_by_card_id,g=S(E=>Xt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:O}=oe(),{isFeatureEnabled:N}=O(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=O(Z.isDebitCardFeatureEnabled),P=Ae(T,k),j=Ee({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:P}),p=!!k.companyChargeCardInfo?.info?.isChargeCardEnabled,d=k.userRole.includes("charge_card_user"),_=Se(k),F=Ie(k),U=k.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,M=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:N,isBookKeepingTenant:F,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:U}),W=!d&&M&&p;c.useEffect(()=>{C===!1&&w!=="In-Progress"&&w!=="Completed"&&(a(wa()),I(!0)),o===!1&&g.fetchState==="Not-Started"&&(i(!0),a(aa(n,W,M)))},[o,g.fetchState,C,w]);const y=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(D===!1&&(y===!1||y&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==v.userId)){const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);r(E,{state:{pathnameStackToGoBack:q}})}else if(D&&g.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){a(en({chargeCardId:n}));const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(E,{state:{pathnameStackToGoBack:q}})}}},[g.fetchState,l?.type.code,D,g.isRefreshingViewInBackground]);const x=X.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Za(n,!0))};c.useEffect(()=>{g.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&D===!1&&(setTimeout(R,3e3),A(!0))},[g.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Y=E=>{B(E)};if(w!=="Completed"||l==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if($?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Y}),s.jsx($r,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:$.phone,signedInUser:v,isSandboxEnv:qa(),chargeCardDetailState:g,signedInUserToken:x,navigate:r,currentTenant:k,location:u,maxChargeCardActivationAttempts:b[n]!=null?b[n]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Y(!0)}}),e!=null?s.jsx(Gr,{windowSize:t,children:e}):null]})},$r=ge(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const u=an(e.addressState,a);if(u==null)throw Error("Can't access shippingAddress.");const m=ft(e,n),C=t.updateStatus,I=Ye(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(tn())||i,showMenuIcon:o,shippingAddress:u,vgsVaultId:Oa.cardVaultId,twoFAView:m,activationWaitStatus:C,isRefreshingViewInBackground:t.isRefreshingViewInBackground}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,chargeCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdatePhysicalChargeCardAttempt:o=>{e(rn(r,o))},onResendOtp:o=>{C!=null&&e(Fa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{C!=null&&e(Ta(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&X.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(nn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(pr),Gr=_e.div`
1
+ import{j as s}from"./liveblocks-ZAKgWoPK.js";import{j as ue,l as la,h as me,g as S,u as ye,k as ge,N as ya,q as mt,n as Qt,o as te}from"./core-a8i-_0Kh.js";import{eM as ie,br as Be,NJ as _a,eR as Se,eS as Ie,eT as Ae,fK as Me,co as ze,NK as $e,NL as $a,su as Sa,jg as Ia,NM as Aa,gy as ca,yY as aa,y_ as Ga,y$ as Ya,j6 as Ct,NN as Ge,yM as pt,NO as Jt,NP as Xt,yP as wa,NQ as en,Ma as Pa,qG as ht,yV as Za,gJ as an,NR as ft,NS as Ye,bp as tn,NT as nn,fA as Ta,fz as Fa,zt as rn,fy as va,LS as sn,NU as gt,cN as bt,cJ as on,M9 as ua,A3 as cn,NV as rt,zF as xa,NW as yt,A4 as dn,MA as ln,A5 as un,A$ as mn,rQ as Cn,AV as pn,ze as St,z7 as hn,NX as fn,fM as gn,zn as It,zr as At,fL as bn,NY as yn,zR as Et,NZ as Sn,N_ as In,N$ as An,zp as kt,za as Dt,yS as _t,zj as wt,zh as Pt,zl as En,yZ as st,O0 as Tt,O1 as La,zC as Ea,IR as Ft,cK as Ka,O2 as kn,O3 as Dn,O4 as _n,O5 as wn,zz as Ha,zY as Pn,zU as Tn,zv as Fn,zW as vn,zM as xn,zO as Ln,O6 as vt,A2 as xt,Gm as Bn,O7 as On,O8 as Rn,O9 as Un,Oa as Lt,Ob as Nn,Ap as jn,zE as Bt,zy as da,zD as Vn,Oc as Hn,Od as Mn,yJ as zn,Oe as Ot,Of as Rt,Og as $n,yL as Gn,yK as ot,Oh as Yn,Oi as Zn,Oj as Kn,IN as Wn,Ok as Wa,Ol as qn,vk as Ut,jQ as Qn,gz as Jn,Au as Xn,Om as Nt,On as er,Av as ar,Oo as tr,db as nr,so as rr,Ak as sr,Ae as Le,bu as or,bC as ir,ct as cr,bD as dr,I2 as lr}from"./zeni-epic-state-ZCc1K30S.js";import{z as X,j as Re,a as oe,i as Z,B as Ze,bU as Ba,c3 as ur,p as ve,c4 as mr,c5 as Cr,Z as ma,aI as Fe,q as be,bb as qa,c6 as pr,w as Ca,h as Oa,m as Qa,d as Q,D as Ja,c7 as hr,I as jt,al as Xa,bn as Xe,c8 as Ma,c9 as fr,v as et,a1 as gr,ca as br,ao as Vt,O as za,J as Ht,f as Mt,cb as yr,cc as Sr,cd as Ir,ce as Ar,cf as Er,o as ka,cg as kr,ch as Dr,ci as Na,Q as _r,cj as wr,ck as Pr,cl as Tr,cm as Fr,a4 as vr}from"./index-CJiQhPf1.js";import{n as _e,D as zt,S as xr}from"./mui-B8yatdty.js";import{a as c}from"./sentry-Bp45iw9z.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Oe,f as Ue,A as Lr,h as at,P as Br,i as tt,s as ea,j as Gt,k as He,l as Yt,m as Or,n as Zt,p as Rr,S as it}from"./SetupPagesScreen-CmJWX7Ir.js";import Ra from"./NotFoundScreen-CAOLTLHp.js";import{M as ha}from"./MobileAppDrawer-Clk7FI85.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-YJt2mAQE.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-bhvjxs2J.js";import{v as ct}from"./utils-ikosPjSL.js";import{t as Ur}from"./AddressScreen-CTET3dvy.js";import"./recharts-BhJEeZEG.js";import"./lottie-DN0gYkdx.js";import"./analytics-vyykHm3I.js";import"./plaid-CP3hLhCR.js";import"./dnd-CDdU3ON0.js";import"./stripe-DMRn4zHo.js";import"./lexical-BzneVI9m.js";import"./pdf-C4rebPwh.js";import"./analyticsHelper-MCISw32F.js";import"./routePaths-BJH4smh2.js";import"./BusinessVerificationPageScreen-Bp1i3y8M.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="bc8c3001-f797-46c3-b52c-435862b78746",e._sentryDebugIdIdentifier="sentry-dbid-bc8c3001-f797-46c3-b52c-435862b78746")}catch{}})();function Nr(){const e=ue(),{cardId:t}=la(),a=me(),r=X.getSignedInUser(),n=S(G=>ie(G)),u=Re(),m=Be(u?.loggedInUserRoleMap),{useFeatureGate:C}=oe();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=S(G=>_a(G).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const D=n.userRole.includes("charge_card_user"),{isFeatureEnabled:A}=C(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:B}=C(Z.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(B,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,O=S(G=>Me(G,n.companyId)),N=ze(O.controllers),{creditAccount:T,creditAccountRepayment:P}=S(G=>$e(G)),j=S(G=>G.classListState.fetchState),p=!D&&l&&f,d=S(G=>$a(G,t,p,l)),[_,F]=c.useState(!1),U=d.chargeCard,M=U?.cardCreatedByUser?.userId,W=S(G=>M!=null?Sa(G.userRoleState,M):void 0),y=W?.accountingClassIDs[0],x=S(G=>y!=null?Ia(G.classState,{classId:y,reportId:"class_list"}):void 0),$=U?.cardHolderUser?.userId,R=S(G=>$!=null?Sa(G.userRoleState,$):void 0),Y=R?.accountingClassIDs[0],E=S(G=>Y!=null?Ia(G.classState,{classId:Y,reportId:"class_list"}):void 0),q=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",K=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&q&&(o(!0),setTimeout(()=>{a(Aa()),K&&a(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,q,K]),c.useEffect(()=>{_||d.fetchState==="Completed"||d.fetchState==="In-Progress"||t==null||(F(!0),a(aa(t,p,!1)))},[_,d,t,a]),c.useEffect(()=>{if(d.fetchState==="Completed"&&(q===!1||q&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const G=fe(n.tenantEmailDomain,t,r,U,i);e(G)}},[d.fetchState,i,q]),c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&l&&f&&m&&a(Ya()),j!=="Completed"&&j!=="In-Progress"&&a(Ct())},[T.fetchState,P.fetchState,a,l,f,m,j]);const z=()=>{if(r!=null&&t!=null){a(Aa());const G=fe(n.tenantEmailDomain,t,r);e(G)}},Ce=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",ae=Oe(l,g,w,f),L=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ze,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:N,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:L,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:j,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:x?.className,cardHolderRoles:R?.userRoles,cardHolderDepartmentName:E?.className})]})}const jr=ge(function(e){const t=Ge(e);return{insightsData:t.insight,cashbackByPeriod:t.cashbackByPeriod,uiState:t.uiState,cashbackSummary:t.cashbackSummary}},function(e){return{onColumnSortConfigChanged:(t,a)=>{e(Jt({uiState:{sortKey:t,sortOrder:a}}))}}})(Cr);function Vr(){const e=ue(),t=me(),a=ye(),r=X.getSignedInUser(),n=S(o=>ie(o)),[u,m]=c.useState(!1),C=S(o=>Ge(o)),I=c.useCallback(()=>{const o=ve(a.state?.pathnameStackToGoBack),i=o.poppedPathname??Hr(n.tenantEmailDomain);e(i,{state:{pathnameStackToGoBack:o.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{u||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(m(!0),t(pt()))},[u,C,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return C.fetchState==="In-Progress"?s.jsx(mr,{onBackClick:I}):C.cashbackSummary.cashbackEarned.amount===0&&C.fetchState==="Completed"?s.jsx(Ra,{}):s.jsx(jr,{onBackClick:I})}const Hr=e=>`/${e}/cards`,Mr={containerWidth:new Ca(100,58)},zr=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m}=oe(),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(!1),v=X.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const k=S(E=>ie(E));if(n==null)throw Error("Empty card id is not valid...");const{configValue:h}=m(Fe.zeniCardsConfig),b=h.max_charge_card_activation_attempts_by_card_id,g=S(E=>Xt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:O}=oe(),{isFeatureEnabled:N}=O(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=O(Z.isDebitCardFeatureEnabled),P=Ae(T,k),j=Ee({isDebitCardFeatureEnabled:T,isBankingOnlyTenant:P}),p=!!k.companyChargeCardInfo?.info?.isChargeCardEnabled,d=k.userRole.includes("charge_card_user"),_=Se(k),F=Ie(k),U=k.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,M=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:N,isBookKeepingTenant:F,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:U}),W=!d&&M&&p;c.useEffect(()=>{C===!1&&w!=="In-Progress"&&w!=="Completed"&&(a(wa()),I(!0)),o===!1&&g.fetchState==="Not-Started"&&(i(!0),a(aa(n,W,M)))},[o,g.fetchState,C,w]);const y=l?.type.code==="business_physical_credit_card"||l?.type.code==="business_physical_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(D===!1&&(y===!1||y&&l?.status?.code!=="inactive"||l?.cardHolderUserId!==v.userId)){const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);r(E,{state:{pathnameStackToGoBack:q}})}else if(D&&g.isRefreshingViewInBackground===!1&&l?.status?.code==="active"){a(en({chargeCardId:n}));const E=fe(k.tenantEmailDomain,n,v,l,!0),q=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(E,{state:{pathnameStackToGoBack:q}})}}},[g.fetchState,l?.type.code,D,g.isRefreshingViewInBackground]);const x=X.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Za(n,!0))};c.useEffect(()=>{g.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&D===!1&&(setTimeout(R,3e3),A(!0))},[g.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Y=E=>{B(E)};if(w!=="Completed"||l==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if($?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Y}),s.jsx($r,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:$.phone,signedInUser:v,isSandboxEnv:qa(),chargeCardDetailState:g,signedInUserToken:x,navigate:r,currentTenant:k,location:u,maxChargeCardActivationAttempts:b[n]!=null?b[n]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Y(!0)}}),e!=null?s.jsx(Gr,{windowSize:t,children:e}):null]})},$r=ge(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const u=an(e.addressState,a);if(u==null)throw Error("Can't access shippingAddress.");const m=ft(e,n),C=t.updateStatus,I=Ye(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(tn())||i,showMenuIcon:o,shippingAddress:u,vgsVaultId:Oa.cardVaultId,twoFAView:m,activationWaitStatus:C,isRefreshingViewInBackground:t.isRefreshingViewInBackground}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,chargeCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdatePhysicalChargeCardAttempt:o=>{e(rn(r,o))},onResendOtp:o=>{C!=null&&e(Fa(o,"ChargeCardHolder",r))},onVerifyOtp:(o,i)=>{C!=null&&e(Ta(o,i,"ChargeCardHolder",r))},onVerifyOtpSuccess:o=>{o!=null&&X.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(nn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(pr),Gr=_e.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${Mr.containerWidth.value(e.windowSize)}%`};
@@ -11,18 +11,18 @@ import{j as s}from"./liveblocks-Cqbf2YvG.js";import{j as ue,l as la,h as me,g as
11
11
  flex-direction: column;
12
12
  align-items: center;
13
13
  background-color: ${e=>e.theme.colors.grey4};
14
- `,Da=Qa.getLocalizedStrings().dateFormat,Zr={overlayWidth:new Ca(100,100,58)},Kr=ge(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:ln(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:un(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:u,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:D,cashbackInformation:A,paymentSourceInformation:f,creditAccountInformation:B,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&J.trackCardsPayEarlyFormClick(o,D,A,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:k?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:k?.format(Da.visual.MMMDCommaYYYYformat)},f,B,v),h==="cardPaymentHistory")t.closeDrawerHandler(!0),e(yt());else{const g=Ue(b);a(g)}},onUpdatePaymentAccountStatus:(g,l,w)=>{e(pn(g,l,"bill_pay","bill_pay_detail",w))},onEstablishConnectionSuccess:()=>{e(xa(r.companyId,!0))},onFetchLinkTokenClick:g=>{e(Cn("external_account",g))},onEstablishConnectionClick:g=>{e(mn(g,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${b}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{u?window.open(`/${b}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(hr),nt=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:u,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:D,paymentInitiatedDate:A,retryRepayment:f})=>{const B=ue(),{useDynamicConfig:v}=oe(),{configValue:k}=v(Fe.zeniAccountsConfig),h=sn(k),b=S(z=>gt(z)),{creditAccount:g}=S(z=>$e(z)),l=S(z=>ie(z)),w=Ja(),O=ma(),N=me(),T=X.getSignedInUser(),P=Re(),[j,p]=c.useState(!1),[d,_]=c.useState(!1),{configValue:F}=v(Fe.zeniCardsConfig),U=F.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??F.default_credit_card_auto_pay_threshold??Lr,M=bt(P?.loggedInUserRoleMap),W=on(P?.loggedInUserRoleMap),y=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,x=S(z=>ua(z,l.companyId)),$=x.companyChargeCardInfo?.primaryFundingAccount,R=x.allFundingAccounts.find(z=>z.id===$?.accountId),Y=S(z=>Me(z,l.companyId)),E=ze(Y.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&N(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(L=>L.id===z);let ae;if(u==="cardPaymentHistory"&&f){const L=f.paymentAccountId!=null?b.transferFromAccounts.find(pe=>pe.id===f.paymentAccountId):void 0;ae={amount:f.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:L??Ce}}else ae={amount:{amount:g.balance.amount+g.hold.amount,currencyCode:g.balance.currencyCode,currencySymbol:g.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:Ce};N(rt(ae)),_(!0)}},[b.fetchState,d,u,f,b.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,g.balance.amount,g.balance.currencyCode,g.balance.currencySymbol,g.hold.amount,N]);const q={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:R?.accType==="depositAccount",creditCardPaymentSourceAccountName:R?.label,creditCardPaymentSourceAccountType:R?.accType,creditCardPaymentSourceLastFourDigits:R?.accountLast4,creditCardPaymentSourceBalance:R?.accountBalance?.available?.amount??0};if(c.useEffect(()=>{x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&N(xa(l.companyId,!0))},[x.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&J.trackCardsPayEarlyPayNowClick(E,n,I,b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:A?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:A?.format(Da.visual.MMMDCommaYYYYformat)},q,m,C)},[b.updateStatus,I,D,i,o,A]),c.useEffect(()=>{b.fetchState==="Completed"&&I!=null&&D&&i&&o&&!j&&e&&d&&I!=null&&(J.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,j,e,d]),T==null)throw Error("Can't access invite people page without signing in...");const K=()=>{t(!0),N(yt())};return s.jsx(s.Fragment,{children:s.jsx(zt,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Zr.overlayWidth.valuePercentage(O),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:s.jsx(Wr,{onClick:z=>z.stopPropagation(),children:s.jsx(Kr,{closeDrawerHandler:t,navigate:B,paymentDetails:b,creditAccountSpentAmount:r,onTransferClick:()=>{D&&i&&o&&I!=null&&J.trackCardsPayEarlyFormClick(E,n,I,"Pay Now",b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},q,m,C),N(dn({companyId:l.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:z=>{N(rt(z))},currentTenant:l,hasZeniAccountsAdminAccess:M,isZeniAccountsUser:W,isZeniAccountSetupEnabled:y,productInformation:n,sourcePage:u,controllerEmails:E,autoPayThreshold:U,paymentSourceInformation:q,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isCashbackInfoFetchStateCompleted:D,isCreditCardInfoFetchStateCompleted:i,isDebitCardInfoFetchStateCompleted:o,paymentInitiatedDate:A,maxInsuredAmount:h.maxInsuredAmount})})})})},Wr=_e(xr)`
14
+ `,Da=Ja.getLocalizedStrings().dateFormat,Zr={overlayWidth:new Ca(100,100,58)},Kr=ge(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:ln(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:un(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:u,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:D,cashbackInformation:A,paymentSourceInformation:f,creditAccountInformation:B,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&Q.trackCardsPayEarlyFormClick(o,D,A,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:k?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:k?.format(Da.visual.MMMDCommaYYYYformat)},f,B,v),h==="cardPaymentHistory")t.closeDrawerHandler(!0),e(yt());else{const g=Ue(b);a(g)}},onUpdatePaymentAccountStatus:(g,l,w)=>{e(pn(g,l,"bill_pay","bill_pay_detail",w))},onEstablishConnectionSuccess:()=>{e(xa(r.companyId,!0))},onFetchLinkTokenClick:g=>{e(Cn("external_account",g))},onEstablishConnectionClick:g=>{e(mn(g,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${b}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{u?window.open(`/${b}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(hr),nt=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:u,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:D,paymentInitiatedDate:A,retryRepayment:f})=>{const B=ue(),{useDynamicConfig:v}=oe(),{configValue:k}=v(Fe.zeniAccountsConfig),h=sn(k),b=S(z=>gt(z)),{creditAccount:g}=S(z=>$e(z)),l=S(z=>ie(z)),w=Qa(),O=ma(),N=me(),T=X.getSignedInUser(),P=Re(),[j,p]=c.useState(!1),[d,_]=c.useState(!1),{configValue:F}=v(Fe.zeniCardsConfig),U=F.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??F.default_credit_card_auto_pay_threshold??Lr,M=bt(P?.loggedInUserRoleMap),W=on(P?.loggedInUserRoleMap),y=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,x=S(z=>ua(z,l.companyId)),$=x.companyChargeCardInfo?.primaryFundingAccount,R=x.allFundingAccounts.find(z=>z.id===$?.accountId),Y=S(z=>Me(z,l.companyId)),E=ze(Y.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&N(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(L=>L.id===z);let ae;if(u==="cardPaymentHistory"&&f){const L=f.paymentAccountId!=null?b.transferFromAccounts.find(pe=>pe.id===f.paymentAccountId):void 0;ae={amount:f.amount,isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:L??Ce}}else ae={amount:{amount:g.balance.amount+g.hold.amount,currencyCode:g.balance.currencyCode,currencySymbol:g.balance.currencySymbol},isAutoRepayment:l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,idempotencyKey:ct(),transferFrom:Ce};N(rt(ae)),_(!0)}},[b.fetchState,d,u,f,b.transferFromAccounts,l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,l.companyChargeCardInfo?.info?.isAutoPayEnabled,g.balance.amount,g.balance.currencyCode,g.balance.currencySymbol,g.hold.amount,N]);const q={isZeniCheckingEnabled:l.companyZeniAccountInfo?.info?.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:R?.accType==="depositAccount",creditCardPaymentSourceAccountName:R?.label,creditCardPaymentSourceAccountType:R?.accType,creditCardPaymentSourceLastFourDigits:R?.accountLast4,creditCardPaymentSourceBalance:R?.accountBalance?.available?.amount??0};if(c.useEffect(()=>{x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&N(xa(l.companyId,!0))},[x.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&Q.trackCardsPayEarlyPayNowClick(E,n,I,b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:A?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:A?.format(Da.visual.MMMDCommaYYYYformat)},q,m,C)},[b.updateStatus,I,D,i,o,A]),c.useEffect(()=>{b.fetchState==="Completed"&&I!=null&&D&&i&&o&&!j&&e&&d&&I!=null&&(Q.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,j,e,d]),T==null)throw Error("Can't access invite people page without signing in...");const K=()=>{t(!0),N(yt())};return s.jsx(s.Fragment,{children:s.jsx(zt,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Zr.overlayWidth.valuePercentage(O),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:w.colors.black,opacity:.75,cursor:"pointer"}}},children:s.jsx(Wr,{onClick:z=>z.stopPropagation(),children:s.jsx(Kr,{closeDrawerHandler:t,navigate:B,paymentDetails:b,creditAccountSpentAmount:r,onTransferClick:()=>{D&&i&&o&&I!=null&&Q.trackCardsPayEarlyFormClick(E,n,I,"Pay Now",b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},q,m,C),N(dn({companyId:l.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:z=>{N(rt(z))},currentTenant:l,hasZeniAccountsAdminAccess:M,isZeniAccountsUser:W,isZeniAccountSetupEnabled:y,productInformation:n,sourcePage:u,controllerEmails:E,autoPayThreshold:U,paymentSourceInformation:q,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isCashbackInfoFetchStateCompleted:D,isCreditCardInfoFetchStateCompleted:i,isDebitCardInfoFetchStateCompleted:o,paymentInitiatedDate:A,maxInsuredAmount:h.maxInsuredAmount})})})})},Wr=_e(xr)`
15
15
  display: flex;
16
16
  min-height: 100%;
17
17
  flex-direction: column;
18
- `,qt="charge-card-transaction-update",ja=Qa.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=X.getSignedInUser(),C=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:C??""},o=$a(e,r,a,u),i=fn(e,r),D=gn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId:Oa.cardVaultId,transactionAttachmentsEndpointToFetch:`${za}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${za}/card_transaction_attachment`,authParams:I,isSnackbarOpen:D.isSnackbarOpen,cardsEndPoint:`${Vt.cardMicroServiceBaseUrl}`,signedInUserToken:o.twoFAView.token??n}},function(e,t){const{cardId:a,currentTenant:r,navigate:n,location:u,cardProviderId:m,includeCreditAccountInfo:C,setIsPaymentOpen:I,controllerEmails:o,productInformation:i,cashbackInformation:D,primaryFundingAccountDetails:A,creditAccountInformation:f,debitAccountInformation:B,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:k}=r;return{onEventReceived:h=>{h===qt&&(e(Za(a,!0)),e(st(a,null,null,!0)))},onReloadTransactions:()=>{e(aa(a,C,v))},onFetchChargeCardTransactionList:(h,b)=>{e(st(a,h,b))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{m!=null&&e(va(h,"ChargeCardHolder",a))},onResendOtp:h=>{m!=null&&e(Fa(h,"ChargeCardHolder",a))},onVerifyOtp:(h,b)=>{m!=null&&e(Ta(h,b,"ChargeCardHolder",a))},onVerifyOtpSuccess:h=>{h!=null&&X.saveZeniOtpTokenForCardHolder(h,a)},onColorCodeChange:h=>{e(En(a,h))},onLockChargeCard:(h,b)=>{e(Pt(h,a,b))},onUnlockChargeCard:h=>{e(wt(h,a))},onCloseChargeCard:h=>{e(_t(a,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Dt([a]))},updateChargeCardName:(h,b)=>{e(kt(h,a,b))},updateChargeCardTransactionAttachments:(h,b)=>{b!=null&&e(An({transactionId:h,data:b}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,b,g,l)=>{e(In({chargeCardId:b,transactionId:h,fetchState:g,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,b,g)=>{e(Sn({chargeCardId:b,transactionId:h,shouldShowTick:g}))},onChargeCardRevokeInviteClick:()=>{e(Et(a))},updateChargeCardTransactionIsViewReceiptClicked:(h,b,g)=>{e(yn({chargeCardId:b,transactionId:h,isViewReceiptClicked:g}))},onChargeCardTransactionRowClick:(h,b)=>{const g=be(u.state?.pathnameStackToGoBack,u.pathname);n(`../../transaction/${h}/${b}`,{state:{pathnameStackToGoBack:g}})},onBackClick:()=>{const h=ve(u.state?.pathnameStackToGoBack),b=Ue(k);n(b,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(bn())},onUpdateDebitCardPinAttempt:h=>{e(At(a,h)),h==="success"&&e(ca({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,b)=>{h?e(ca({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):b!=null&&e(ca({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b.message}]}))},updateSpendLimit(h,b,g,l){e(It(h,b,g.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&D!=null&&J.trackCardsPayEarlyClick(o,i,D,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:A?.accType==="depositAccount",creditCardPaymentSourceAccountName:A?.label,creditCardPaymentSourceAccountType:A?.accType,creditCardPaymentSourceLastFourDigits:A?.accountLast4,creditCardPaymentSourceBalance:A?.accountBalance?.available?.amount??0},f,B),I(h)}}})(gr(br));function Jr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=X.getSignedInUser(),i=S(V=>ie(V)),D=S(V=>_a(V).firstViewAfterActivation),A=S(V=>V.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:B}=I(Fe.zeniCardsConfig),v=B.enable_card_controls_for_company_ids,k=B.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[h,b]=c.useState(!1),[g,l]=c.useState(!1),{useFeatureGate:w}=oe(),{isFeatureEnabled:O}=w(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=w(Z.isDebitCardFeatureEnabled),T=Ae(N,i),P=Ee({isDebitCardFeatureEnabled:N,isBankingOnlyTenant:T}),{isFeatureEnabled:j}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Z.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:O,isBookKeepingTenant:d,isDebitCardProductVisible:P,chargeCardsCreditAccountLimit:F}),M=!!i.companyDebitCardInfo?.info?.isDebitCardEnabled,W=!!i.companyChargeCardInfo?.info?.isChargeCardEnabled,y=!i.userRole.includes("charge_card_user")&&U&&W;if(r==null)throw Error("Empty card id is not valid...");const x=S(V=>ua(V,i.companyId)),{creditAccount:$,creditAccountRepayment:R}=S(V=>$e(V)),Y=X.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,U)),{isAiCfoOpen:q,setIsAiCfoOpen:K}=jt(),{isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce}=Kt({isAiCfoOpen:q,setIsAiCfoOpen:K,mobileExploreReferrer:"Card Detail"});Wt({isDataReady:E.fetchState==="Completed"});const ae=S(V=>Ge(V)),L=E.chargeCard,pe=Re(),G=Be(pe?.loggedInUserRoleMap),ce=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_virtual_debit_card",we=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_physical_credit_card",re=L?.type.code==="business_virtual_debit_card"||L?.type.code==="business_virtual_credit_card",ne=L?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),Q=$t(ce,E),Ke=at(G,ae),Ne=Oe(U,P,M,W),Pe=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",ee=S(V=>Me(V,i.companyId)),We=ze(ee.controllers),qe=S(V=>L?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,L?.cardCreatedByUser?.userId):void 0),fa=S(V=>qe?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:qe?.accountingClassIDs[0],reportId:"class_list"}):void 0),se=S(V=>L?.cardHolderUser?.userId!=null?Sa(V.userRoleState,L?.cardHolderUser?.userId):void 0),ta=S(V=>se?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:se?.accountingClassIDs[0],reportId:"class_list"}):void 0),le=i?.userRole,xe=S(V=>Ye(V,!1,P,O).revokeCardInvite),na=Xa(xe.saveStatus.fetchState);if(c.useEffect(()=>{if(na==="In-Progress"&&xe.saveStatus.fetchState==="Completed"){const V=Ue(i.tenantEmailDomain);e(V)}},[na,xe.saveStatus.fetchState,e,i.tenantEmailDomain]),c.useEffect(()=>{D&&n===!1&&re&&(u(!0),setTimeout(()=>{t(Aa()),ne&&t(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[D,n,re,ne]),c.useEffect(()=>{h||E.fetchState==="Completed"||E.fetchState==="In-Progress"||r==null||(b(!0),t(aa(r,y,U,!1)))},[h,E,r,t]),c.useEffect(()=>{!g&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ce&&Pe&&G&&(l(!0),t(St({depositAccountId:E.chargeCard?.connectedAccountId})))},[g,E,t,Pe,G]),c.useEffect(()=>{ae.fetchState!=="Completed"&&ae.fetchState!=="In-Progress"&&G&&t(pt()),A!=="Completed"&&A!=="In-Progress"&&t(Ct()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&t(hn({chargeCardId:r})),x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&t(xa(i.companyId,!0))},[ae.fetchState,t,G,A,E.transactionStatistics.fetchState,x.fetchState]),c.useEffect(()=>{if(!(E.fetchState!=="Completed"||U&&$.fetchState!=="Completed"||L==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=L.type.code.includes("physical"),he=V?L.cardActivationAttemptHistory[0]?.timestamp:L.createTime;J.trackCardsCardDetailView(We,Ne,{cardId:r,cardName:L.cardName,cardType:L.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Xe(L.limit.amount),cardLastFourDigits:L.accountLast4,cardStatus:L.status.code,cardAssignedDate:L.createTime?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:L.providerCardCreateTime?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:L.creditLimitFrequency.name,cardSpentAmount:Xe(L.balance.amount),cardAvailableLimit:Xe(L.available.amount),cardUtilizationPercent:L.limit.amount>0?Math.round((L.limit.amount-L.available.amount)/L.limit.amount*100):0,cardUtilizationAmount:Xe(L.limit.amount-L.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:Ma(L.cardCreatedByUser,!1),cardIssuedByEmail:L.cardCreatedByUser?.email,cardIssuedByUserId:L.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(L.cardHolderUser,!1),cardholderEmail:L.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:L.cardHolderUser?.userId,cardholderDepartment:ta?.className},de,Q)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,$.fetchState,G]),o==null)throw Error("Can't access card detail page without signing in...");const Je=i.companyId??X.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Je!=null?[`private-${Je}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&L!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:je,frequency:Qe,cardColor:H}=Va(L),De=L.cardHolderUserId===o.userId;J.trackCardsDetailPageViewed(r,V,he,Te,je,Qe,H,De)}};c.useEffect(()=>{if(E.fetchState==="Completed"){const V=E.chargeCard;if(V?.status.code==="inactive"||ce&&V?.isPinSet===!1||we&&D){const he=fe(i.tenantEmailDomain,r,o,L,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:je,utilisation:Qe,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;J.trackCardsDetailPageClicked(r,Te,je,Qe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:je,utilisation:Qe,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;J.trackCardsVerifyPopUpClick(r,Te,je,Qe,H,De,V,Ve,he)}},Ua=$.balance.amount+$.hold.amount,ga=i.companyChargeCardInfo?.info?.primaryFundingAccount,ba=x.allFundingAccounts.find(V=>V.id===ga?.accountId);return r==null||E.fetchState==="Error"?s.jsx(Ra,{}):E.fetchState==="In-Progress"||E.fetchState==="Not-Started"||xe.saveStatus.fetchState==="In-Progress"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(fr,{}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:J,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:Ne,creditAccountInformation:de,debitAccountInformation:Q,cashbackInformation:Ke,creditAccountSpentAmount:Ua,isDebitCardInfoFetchStateCompleted:!ce||!G||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||$.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!G||ae.fetchState==="Completed",paymentInitiatedDate:R.initiatedRepaymentDate}):null,s.jsx(qr,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ia,onFireOnClickAnalytics:oa,isSandboxEnv:qa(),signedInUser:o,location:a,navigate:e,setIsPaymentOpen:C,cardIssuedByRoles:qe?.userRoles,cardIssuedByDepartmentName:fa?.className,cardHolderRoles:se?.userRoles,cardHolderDepartmentName:ta?.className,loggedInUserRole:le,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:P,isDebitCardSetupEnabled:M,isChargeCardSetupEnabled:W,isCardControlsEnabled:k,isEarlyPayEnabled:j,controllerEmails:We,chargeCardCashbackDetailState:ae,productInformation:Ne,creditAccountInformation:de,debitAccountInformation:Q,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Y,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce,isCardsCommentingEnabled:p})]})}const Va=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,u=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:u,limit:n}},Qr=_e.div`
18
+ `,qt="charge-card-transaction-update",ja=Ja.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=X.getSignedInUser(),C=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:C??""},o=$a(e,r,a,u),i=fn(e,r),D=gn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId:Oa.cardVaultId,transactionAttachmentsEndpointToFetch:`${za}/card_transaction_attachments`,transactionAttachmentEndpointToDownload:`${za}/card_transaction_attachment`,authParams:I,isSnackbarOpen:D.isSnackbarOpen,cardsEndPoint:`${Vt.cardMicroServiceBaseUrl}`,signedInUserToken:o.twoFAView.token??n}},function(e,t){const{cardId:a,currentTenant:r,navigate:n,location:u,cardProviderId:m,includeCreditAccountInfo:C,setIsPaymentOpen:I,controllerEmails:o,productInformation:i,cashbackInformation:D,primaryFundingAccountDetails:A,creditAccountInformation:f,debitAccountInformation:B,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:k}=r;return{onEventReceived:h=>{h===qt&&(e(Za(a,!0)),e(st(a,null,null,!0)))},onReloadTransactions:()=>{e(aa(a,C,v))},onFetchChargeCardTransactionList:(h,b)=>{e(st(a,h,b))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{m!=null&&e(va(h,"ChargeCardHolder",a))},onResendOtp:h=>{m!=null&&e(Fa(h,"ChargeCardHolder",a))},onVerifyOtp:(h,b)=>{m!=null&&e(Ta(h,b,"ChargeCardHolder",a))},onVerifyOtpSuccess:h=>{h!=null&&X.saveZeniOtpTokenForCardHolder(h,a)},onColorCodeChange:h=>{e(En(a,h))},onLockChargeCard:(h,b)=>{e(Pt(h,a,b))},onUnlockChargeCard:h=>{e(wt(h,a))},onCloseChargeCard:h=>{e(_t(a,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Dt([a]))},updateChargeCardName:(h,b)=>{e(kt(h,a,b))},updateChargeCardTransactionAttachments:(h,b)=>{b!=null&&e(An({transactionId:h,data:b}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,b,g,l)=>{e(In({chargeCardId:b,transactionId:h,fetchState:g,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,b,g)=>{e(Sn({chargeCardId:b,transactionId:h,shouldShowTick:g}))},onChargeCardRevokeInviteClick:()=>{e(Et(a))},updateChargeCardTransactionIsViewReceiptClicked:(h,b,g)=>{e(yn({chargeCardId:b,transactionId:h,isViewReceiptClicked:g}))},onChargeCardTransactionRowClick:(h,b)=>{const g=be(u.state?.pathnameStackToGoBack,u.pathname);n(`../../transaction/${h}/${b}`,{state:{pathnameStackToGoBack:g}})},onBackClick:()=>{const h=ve(u.state?.pathnameStackToGoBack),b=Ue(k);n(b,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(bn())},onUpdateDebitCardPinAttempt:h=>{e(At(a,h)),h==="success"&&e(ca({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,b)=>{h?e(ca({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):b!=null&&e(ca({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b.message}]}))},updateSpendLimit(h,b,g,l){e(It(h,b,g.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&D!=null&&Q.trackCardsPayEarlyClick(o,i,D,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:A?.accType==="depositAccount",creditCardPaymentSourceAccountName:A?.label,creditCardPaymentSourceAccountType:A?.accType,creditCardPaymentSourceLastFourDigits:A?.accountLast4,creditCardPaymentSourceBalance:A?.accountBalance?.available?.amount??0},f,B),I(h)}}})(gr(br));function Qr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=X.getSignedInUser(),i=S(V=>ie(V)),D=S(V=>_a(V).firstViewAfterActivation),A=S(V=>V.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:B}=I(Fe.zeniCardsConfig),v=B.enable_card_controls_for_company_ids,k=B.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[h,b]=c.useState(!1),[g,l]=c.useState(!1),{useFeatureGate:w}=oe(),{isFeatureEnabled:O}=w(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=w(Z.isDebitCardFeatureEnabled),T=Ae(N,i),P=Ee({isDebitCardFeatureEnabled:N,isBankingOnlyTenant:T}),{isFeatureEnabled:j}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Z.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:O,isBookKeepingTenant:d,isDebitCardProductVisible:P,chargeCardsCreditAccountLimit:F}),M=!!i.companyDebitCardInfo?.info?.isDebitCardEnabled,W=!!i.companyChargeCardInfo?.info?.isChargeCardEnabled,y=!i.userRole.includes("charge_card_user")&&U&&W;if(r==null)throw Error("Empty card id is not valid...");const x=S(V=>ua(V,i.companyId)),{creditAccount:$,creditAccountRepayment:R}=S(V=>$e(V)),Y=X.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,U)),{isAiCfoOpen:q,setIsAiCfoOpen:K}=jt(),{isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce}=Kt({isAiCfoOpen:q,setIsAiCfoOpen:K,mobileExploreReferrer:"Card Detail"});Wt({isDataReady:E.fetchState==="Completed"});const ae=S(V=>Ge(V)),L=E.chargeCard,pe=Re(),G=Be(pe?.loggedInUserRoleMap),ce=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_virtual_debit_card",we=L?.type.code==="business_physical_debit_card"||L?.type.code==="business_physical_credit_card",re=L?.type.code==="business_virtual_debit_card"||L?.type.code==="business_virtual_credit_card",ne=L?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),J=$t(ce,E),Ke=at(G,ae),Ne=Oe(U,P,M,W),Pe=E.depositAccountLimitFetchState.fetchState!=="Completed"&&E.depositAccountLimitFetchState.fetchState!=="In-Progress",ee=S(V=>Me(V,i.companyId)),We=ze(ee.controllers),qe=S(V=>L?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,L?.cardCreatedByUser?.userId):void 0),fa=S(V=>qe?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:qe?.accountingClassIDs[0],reportId:"class_list"}):void 0),se=S(V=>L?.cardHolderUser?.userId!=null?Sa(V.userRoleState,L?.cardHolderUser?.userId):void 0),ta=S(V=>se?.accountingClassIDs[0]!=null?Ia(V.classState,{classId:se?.accountingClassIDs[0],reportId:"class_list"}):void 0),le=i?.userRole,xe=S(V=>Ye(V,!1,P,O).revokeCardInvite),na=Xa(xe.saveStatus.fetchState);if(c.useEffect(()=>{if(na==="In-Progress"&&xe.saveStatus.fetchState==="Completed"){const V=Ue(i.tenantEmailDomain);e(V)}},[na,xe.saveStatus.fetchState,e,i.tenantEmailDomain]),c.useEffect(()=>{D&&n===!1&&re&&(u(!0),setTimeout(()=>{t(Aa()),ne&&t(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[D,n,re,ne]),c.useEffect(()=>{h||E.fetchState==="Completed"||E.fetchState==="In-Progress"||r==null||(b(!0),t(aa(r,y,U,!1)))},[h,E,r,t]),c.useEffect(()=>{!g&&E.fetchState==="Completed"&&E.chargeCard?.connectedAccountId!=null&&ce&&Pe&&G&&(l(!0),t(St({depositAccountId:E.chargeCard?.connectedAccountId})))},[g,E,t,Pe,G]),c.useEffect(()=>{ae.fetchState!=="Completed"&&ae.fetchState!=="In-Progress"&&G&&t(pt()),A!=="Completed"&&A!=="In-Progress"&&t(Ct()),E.transactionStatistics.fetchState!=="Completed"&&E.transactionStatistics.fetchState!=="In-Progress"&&t(hn({chargeCardId:r})),x.fetchState!=="Completed"&&x.fetchState!=="In-Progress"&&t(xa(i.companyId,!0))},[ae.fetchState,t,G,A,E.transactionStatistics.fetchState,x.fetchState]),c.useEffect(()=>{if(!(E.fetchState!=="Completed"||U&&$.fetchState!=="Completed"||L==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=L.type.code.includes("physical"),he=V?L.cardActivationAttemptHistory[0]?.timestamp:L.createTime;Q.trackCardsCardDetailView(We,Ne,{cardId:r,cardName:L.cardName,cardType:L.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Xe(L.limit.amount),cardLastFourDigits:L.accountLast4,cardStatus:L.status.code,cardAssignedDate:L.createTime?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:L.providerCardCreateTime?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(ja.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:L.creditLimitFrequency.name,cardSpentAmount:Xe(L.balance.amount),cardAvailableLimit:Xe(L.available.amount),cardUtilizationPercent:L.limit.amount>0?Math.round((L.limit.amount-L.available.amount)/L.limit.amount*100):0,cardUtilizationAmount:Xe(L.limit.amount-L.available.amount),totalNumberOfDeclinedTransactions:E.transactionStatistics.statistics.totalNumberOfDeclinedTransactions,numberOfDeclinedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfDeclinedTransactionsCurrentMonth,totalNumberOfPaidTransactions:E.transactionStatistics.statistics.totalNumberOfPaidTransactions,numberOfPaidTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfPaidTransactionsCurrentMonth,totalNumberOfCanceledTransactions:E.transactionStatistics.statistics.totalNumberOfCanceledTransactions,numberOfCanceledTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfCanceledTransactionsCurrentMonth,totalNumberOfAuthorizedTransactions:E.transactionStatistics.statistics.totalNumberOfAuthorizedTransactions,numberOfAuthorizedTransactionsCurrentMonth:E.transactionStatistics.statistics.numberOfAuthorizedTransactionsCurrentMonth,totalNumberOfTransactionsWithReceipts:E.transactionStatistics.statistics.totalNumberOfTransactionsWithReceipts,numberOfTransactionsWithReceiptsCurrentMonth:E.transactionStatistics.statistics.numberOfTransactionsWithReceiptsCurrentMonth},{cardIssuedByName:Ma(L.cardCreatedByUser,!1),cardIssuedByEmail:L.cardCreatedByUser?.email,cardIssuedByUserId:L.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(L.cardHolderUser,!1),cardholderEmail:L.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:L.cardHolderUser?.userId,cardholderDepartment:ta?.className},de,J)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,$.fetchState,G]),o==null)throw Error("Can't access card detail page without signing in...");const Qe=i.companyId??X.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Qe!=null?[`private-${Qe}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&L!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:je,frequency:Je,cardColor:H}=Va(L),De=L.cardHolderUserId===o.userId;Q.trackCardsDetailPageViewed(r,V,he,Te,je,Je,H,De)}};c.useEffect(()=>{if(E.fetchState==="Completed"){const V=E.chargeCard;if(V?.status.code==="inactive"||ce&&V?.isPinSet===!1||we&&D){const he=fe(i.tenantEmailDomain,r,o,L,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:je,utilisation:Je,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;Q.trackCardsDetailPageClicked(r,Te,je,Je,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&L!=null){const{ownerName:Te,cardName:je,utilisation:Je,limit:H,frequency:De}=Va(L),Ve=L.cardHolderUserId===o.userId;Q.trackCardsVerifyPopUpClick(r,Te,je,Je,H,De,V,Ve,he)}},Ua=$.balance.amount+$.hold.amount,ga=i.companyChargeCardInfo?.info?.primaryFundingAccount,ba=x.allFundingAccounts.find(V=>V.id===ga?.accountId);return r==null||E.fetchState==="Error"?s.jsx(Ra,{}):E.fetchState==="In-Progress"||E.fetchState==="Not-Started"||xe.saveStatus.fetchState==="In-Progress"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(fr,{}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:Q,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:Ne,creditAccountInformation:de,debitAccountInformation:J,cashbackInformation:Ke,creditAccountSpentAmount:Ua,isDebitCardInfoFetchStateCompleted:!ce||!G||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!U||$.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!G||ae.fetchState==="Completed",paymentInitiatedDate:R.initiatedRepaymentDate}):null,s.jsx(qr,{...ra,hideSorting:!0,onColumnSortConfigChanged:()=>{},onFireVerifyPopOnClickAnalytics:ia,onFireOnClickAnalytics:oa,isSandboxEnv:qa(),signedInUser:o,location:a,navigate:e,setIsPaymentOpen:C,cardIssuedByRoles:qe?.userRoles,cardIssuedByDepartmentName:fa?.className,cardHolderRoles:se?.userRoles,cardHolderDepartmentName:ta?.className,loggedInUserRole:le,isChargeCardFeatureEnabled:U,isDebitCardFeatureEnabled:P,isDebitCardSetupEnabled:M,isChargeCardSetupEnabled:W,isCardControlsEnabled:k,isEarlyPayEnabled:j,controllerEmails:We,chargeCardCashbackDetailState:ae,productInformation:Ne,creditAccountInformation:de,debitAccountInformation:J,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Y,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce,isCardsCommentingEnabled:p})]})}const Va=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,u=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:u,limit:n}},Jr=_e.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
- `,Xr=ge(function(e,t){const a=Ye(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:kn(e),bulkActionView:Dn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:u,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:C,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:A,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:B,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:O,updatePayNowInfoTooltip:N,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:j}=m;return{onChargeCardRowClick:(p,d)=>{const _=Yt(j,p);let F;_!=null&&((M=>{const W=M.limit.amount-M.available.amount,y=`${M.cardHolderUser?.firstName.toLowerCase()} ${M.cardHolderUser?.lastName.toLowerCase()}`,x=M.cardName,$=M.department?.className??"",R=M.limit.amount,Y=M.creditLimitFrequency.name;J.trackCardsListRowClicked(y,x,$,W,R,Y,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&J.trackCardsCardListRowClick(v,g,"Card Row Item","row_clicked",d+1,{cardOwner:Ma(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Xe(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Xe(_.limit.amount)},l,w,O)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Zt(P):fe(P,p,u,_);const U=be(n.state?.pathnameStackToGoBack,n.pathname);a(F,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:p=>{e(Dt(p))},onFetchDepositAccountLimit:p=>{e(St({depositAccountId:p}))},onChargeCardResendInviteClick:p=>{e(Ln(p))},onChargeCardRevokeInviteClick:p=>{e(Et(p))},onLockChargeCardList:(p,d)=>{e(xn(p,d))},onUnlockChargeCardList:p=>{e(vn(p))},onCloseChargeCardList:(p,d)=>{e(Fn(p,d))},onRevokeChargeCardList:p=>{e(Tn(p))},updateChargeCardListSpendLimit(p,d,_){e(Pn(p,d,_.code))},onLockChargeCard:(p,d)=>{e(Pt(T,p,d))},onUnlockChargeCard:p=>{e(wt(T,p))},onCloseChargeCard:(p,d)=>{e(_t(p,d))},onUpdateSpendLimit(p,d,_,F){e(It(p,d,_.code,F))},updateChargeCardName:(p,d)=>{e(kt(T,p,d))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&J.trackCardsSettingsClick(v,g,l,w,O);const p=Or(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&J.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,O);const p=es(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onColumnSortConfigChanged:(p,d)=>{He(D,A,k)&&l!=null&&J.trackCardsCardListSortClick(v,g,l,"Sort Icon","sort",p,d==="ascending"?"ASC":"DESC","Cards List",w,O),e(Ha({uiState:{sortKey:p,sortOrder:d}}))},onSearchTextChanged:p=>{e(wn(p))},onReloadCards:()=>{e(Ea(C,D&&A,I&&i,!0))},onLetsGoClick:()=>{a("./onboard")},onBackClick:()=>{a("../../")},onTotalCashbackClick:()=>{He(D,A,k)&&l!=null&&J.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,O),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&J.trackCardsStatementsClick(v,g,l,w,O),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&J.trackCardsNewCardClick(v,g,l,"Promo Banner","card_creation_initiated","Card List",w,O),a(`./new?cardType=${p}`)},onPromoCardClick:p=>{a(p==="debit"&&D&&!f||p==="credit"&&o&&!B?`../promo?cardPromoType=${p}`:"./setup")},navigateToCreditCardPaymentPage:(p,d)=>{b==="Completed"&&r.company!=null&&l!=null&&J.trackCardsPayEarlyClick(v,g,l,"Card List",p,d,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},w,O);const _=as(P);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const p=ts(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},shouldShowPayNowInfoTooltip:N,onSetRowActionCardId:p=>{e(_n(p))},onSetBulkActionCardIds:p=>{e(Tt(p))}}})(yr);function dt({isPaymentDrawerOpen:e}){const t=ue(),a=me(),r=ye(),n=c.useCallback((H,De)=>{a(Tt([])),t(H,De)},[a,t]),[u,m]=c.useState(!1),[C,I]=c.useState(X.getPayNowInfoTooltip()??!1),o=H=>{X.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=X.getSignedInUser(),f=S(H=>ie(H)),[B,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=jt(),{isAiCfoAccessEnabled:l,onAskAiCfoClick:w}=Kt({isAiCfoOpen:b,setIsAiCfoOpen:g,mobileExploreReferrer:"Cards"}),O=f.userRole.includes("charge_card_user"),N=!O,T=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:P,useDynamicConfig:j}=oe(),{isFeatureEnabled:p}=P(Z.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Z.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),x=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Y=ke({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=j(Fe.zeniCardsConfig),K=Re(),z=Be(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),L=q.charge_card_cashback_rate_per_transaction!=null?q.charge_card_cashback_rate_per_transaction:.0175,pe=q.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??q.default_credit_card_pay_now_threshold??Br,G=q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(q.enable_card_controls_for_company_ids)&&q.enable_card_controls_for_company_ids.includes(f.companyId),ce=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,we=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,ne=S(H=>gt(H)),de=Xa(ne.updateStatus),Q=S(H=>Ye(H,N,y&&T,Y&&re)),Ke=Q.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),Ne=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>La(H,Ne)),We=S(H=>ua(H,f.companyId)),qe=We.companyChargeCardInfo?.primaryFundingAccount,fa=We.allFundingAccounts.find(H=>H.id===qe?.accountId),se=Q.fetchState,ta=Q.creditAccount;Wt({isDataReady:se==="Completed"});const{creditAccountRepayment:le}=S(H=>$e(H)),xe=S(H=>_a(H).firstViewAfterActivation),{areTenantIdsInSync:na}=Ht(),Je=at(z,Pe),ra=pa(Y,re,z,ta,le),sa=tt(y,T,z,ee,Q.debitCardSummary),oa=Oe(Y,y,T,re),ia=Q.creditAccount.balance.amount+Q.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(X.getPayNowInfoTooltip()==null||ia<pe*Q.creditAccount.limit.amount/100)&&o(!0)},[se,pe,ia,Q.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&le.initiatedRepayments.amount===0&&le.fetchState==="Completed"||de==="In-Progress"&&ne.updateStatus==="Completed")o(!1),m(!0);else if(le.initiatedRepayments.amount>0&&le.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const H=Ue(f.tenantEmailDomain);n(H)}},[e,le.initiatedRepayments.amount,le.fetchState,de,ne.updateStatus,n,f.tenantEmailDomain]),c.useEffect(()=>{!B&&(re||T)&&na&&(v(!0),a(Ea(N,y&&T,Y&&re,!1)))},[B,N,a,na]),c.useEffect(()=>{xe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[xe,i]),c.useEffect(()=>{se==="Completed"&&O&&Q.cards.length===1&&(Q.cards[0].status.code==="inactive"&&Q.cards[0].type.code==="business_physical_credit_card"?n(`./${Q.cards[0].id}/activate`):Q.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${Q.cards[0].id}`)))},[se,O,r.state,n,Q.cards]),c.useEffect(()=>{if(se==="Completed"&&O){const H=Q.cards.length,De=Q.cards.filter(Ve=>Ve.cardHolderUserId===A?.userId).filter(Ve=>Ve.status.code==="request_on_hold");De.length>0&&H===De.length&&n("./onboard")}},[se,Q.cards,O,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Y&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||J.trackCardsCardListView(ae,oa,Je,ra,sa)},[se,ta,le.fetchState,ee.fetchState,z]),A==null)throw Error("Can't access charge card list page without signing in...");const Ua=S(H=>Ft(H.userState,H.userRoleState,H.userListViewState,"cardAdmin")),ga=Ka(K?.loggedInUserRoleMap),ba=H=>{h(H)},V=Q.creditAccount.limit,he=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:Y,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),je=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:y,isTOSAccepted:we,isSetupEnabled:T,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga});return re||T?s.jsxs(s.Fragment,{children:[se==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:J,onLoad:()=>{J.trackPageLoaded(Mt.Event.cardsListPage),(Y&&!re||y&&!T)&&J.trackCardsPromoView(ae,{isCreditCardOffered:Y,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Y&&!re?"Credit Card":"","Card List")}}),s.jsx(Ba,{showConfetti:xe})]}):null,u===!0?s.jsx(nt,{closeDrawerHandler:he,isPaymentDrawerOpen:u,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:ia,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Y||le.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!z||Pe.fetchState==="Completed",paymentInitiatedDate:le.initiatedRepaymentDate}):null,s.jsxs(Qr,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:ba}),s.jsx(Xr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Y,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:E,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:C,creditCardPayNowThreshold:pe,signedInUser:A,chargeCardListState:Q,location:r,admins:Ua.users,navigateAndClearBulkSelection:n,currentTenant:f,isCardControlsEnabled:G,companyChargeCardInfoCreditAccountLimit:f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:f.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:z,includeCreditAccountDebitSummaryAndCashbackInfo:N,onClickMenuIcon:()=>{ba(!0)},creditLimit:V,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:T,isEarlyPayEnabled:F,isChargeCardPaymentHistoryFeatureEnabled:U,cashbackRate:L,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||je?s.jsx(ya,{to:"../promo"}):s.jsx(Ze,{fetchState:se})}const es=e=>`/${e}/cards/new`,as=e=>`/${e}/cards/payment`,ts=e=>`/${e}/cards/payment-history`,ns=ge(function(e){const t=X.getSignedInUser(),a=ie(e),r=e.tenantState.currentTenantId,n=vt(e),u={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",C=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:Bn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:u,companyName:m,spendManagementEndPoint:`${za}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:C}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),u=n.poppedPathname??"..";r(u,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,u)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:u}}})},onFiltersChange:n=>{e(Rn({filters:n}))},onReloadPayments:()=>{e(xt(!0))},onSearchTextChanged:n=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:n})},updateDownloadStateHandler:n=>{e(On({uiState:{downloadState:n}}))}}})(Sr);function rs(){const e=ue(),t=ye(),a=me(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=oe();if(X.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const u=S(K=>ie(K)),m=S(K=>vt(K)),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Z.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),O=Ie(u),N=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=ke({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:h,isBookKeepingTenant:O,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:N}),P=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,j=Re(),p=Be(j?.loggedInUserRoleMap),d=S(K=>Ye(K,v,l&&k,T&&P)),_=c.useMemo(()=>{const K=d.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(K.map(z=>z.connectedAccountId))]},[d.cards]),F=S(K=>Ge(K)),U=S(K=>La(K,_)),{creditAccountRepayment:M}=S(K=>$e(K)),W=c.useMemo(()=>at(p,F),[p,F]),y=c.useMemo(()=>pa(T,P,p,d.creditAccount,M),[T,P,p,d.creditAccount,M]),x=c.useMemo(()=>tt(l,k,p,U,d.debitCardSummary),[l,k,p,U,d.debitCardSummary]),$=c.useMemo(()=>Oe(T,l,k,P),[T,l,k,P]),R=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Y=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{B(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),B(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{C||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(xt()))},[C,a,m.fetchState]),c.useEffect(()=>{!o&&(P||k)&&r&&(i(!0),a(Ea(v,!1,T&&P,!1)))},[o,P,k,r,a,v,T]),s.jsxs(s.Fragment,{children:[D?s.jsx(nt,{closeDrawerHandler:q,isPaymentDrawerOpen:D,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:R,productInformation:$,creditAccountInformation:y,debitAccountInformation:x,cashbackInformation:W,isDebitCardInfoFetchStateCompleted:!(l&&k&&p)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!T||M.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!p||F.fetchState==="Completed",paymentInitiatedDate:M.initiatedRepaymentDate,retryRepayment:Y}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
25
+ `,Xr=ge(function(e,t){const a=Ye(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:kn(e),bulkActionView:Dn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:u,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:C,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:A,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:B,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:O,updatePayNowInfoTooltip:N,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:j}=m;return{onChargeCardRowClick:(p,d)=>{const _=Yt(j,p);let F;_!=null&&((M=>{const W=M.limit.amount-M.available.amount,y=`${M.cardHolderUser?.firstName.toLowerCase()} ${M.cardHolderUser?.lastName.toLowerCase()}`,x=M.cardName,$=M.department?.className??"",R=M.limit.amount,Y=M.creditLimitFrequency.name;Q.trackCardsListRowClicked(y,x,$,W,R,Y,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&Q.trackCardsCardListRowClick(v,g,"Card Row Item","row_clicked",d+1,{cardOwner:Ma(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Xe(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Xe(_.limit.amount)},l,w,O)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Zt(P):fe(P,p,u,_);const U=be(n.state?.pathnameStackToGoBack,n.pathname);a(F,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:p=>{e(Dt(p))},onFetchDepositAccountLimit:p=>{e(St({depositAccountId:p}))},onChargeCardResendInviteClick:p=>{e(Ln(p))},onChargeCardRevokeInviteClick:p=>{e(Et(p))},onLockChargeCardList:(p,d)=>{e(xn(p,d))},onUnlockChargeCardList:p=>{e(vn(p))},onCloseChargeCardList:(p,d)=>{e(Fn(p,d))},onRevokeChargeCardList:p=>{e(Tn(p))},updateChargeCardListSpendLimit(p,d,_){e(Pn(p,d,_.code))},onLockChargeCard:(p,d)=>{e(Pt(T,p,d))},onUnlockChargeCard:p=>{e(wt(T,p))},onCloseChargeCard:(p,d)=>{e(_t(p,d))},onUpdateSpendLimit(p,d,_,F){e(It(p,d,_.code,F))},updateChargeCardName:(p,d)=>{e(kt(T,p,d))},onClickSetupIcon:()=>{Q.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&Q.trackCardsSettingsClick(v,g,l,w,O);const p=Or(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{Q.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&Q.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,O);const p=es(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onColumnSortConfigChanged:(p,d)=>{He(D,A,k)&&l!=null&&Q.trackCardsCardListSortClick(v,g,l,"Sort Icon","sort",p,d==="ascending"?"ASC":"DESC","Cards List",w,O),e(Ha({uiState:{sortKey:p,sortOrder:d}}))},onSearchTextChanged:p=>{e(wn(p))},onReloadCards:()=>{e(Ea(C,D&&A,I&&i,!0))},onLetsGoClick:()=>{a("./onboard")},onBackClick:()=>{a("../../")},onTotalCashbackClick:()=>{He(D,A,k)&&l!=null&&Q.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,O),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&Q.trackCardsStatementsClick(v,g,l,w,O),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&Q.trackCardsNewCardClick(v,g,l,"Promo Banner","card_creation_initiated","Card List",w,O),a(`./new?cardType=${p}`)},onPromoCardClick:p=>{a(p==="debit"&&D&&!f||p==="credit"&&o&&!B?`../promo?cardPromoType=${p}`:"./setup")},navigateToCreditCardPaymentPage:(p,d)=>{b==="Completed"&&r.company!=null&&l!=null&&Q.trackCardsPayEarlyClick(v,g,l,"Card List",p,d,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},w,O);const _=as(P);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const p=ts(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},shouldShowPayNowInfoTooltip:N,onSetRowActionCardId:p=>{e(_n(p))},onSetBulkActionCardIds:p=>{e(Tt(p))}}})(yr);function dt({isPaymentDrawerOpen:e}){const t=ue(),a=me(),r=ye(),n=c.useCallback((H,De)=>{a(Tt([])),t(H,De)},[a,t]),[u,m]=c.useState(!1),[C,I]=c.useState(X.getPayNowInfoTooltip()??!1),o=H=>{X.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=X.getSignedInUser(),f=S(H=>ie(H)),[B,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=jt(),{isAiCfoAccessEnabled:l,onAskAiCfoClick:w}=Kt({isAiCfoOpen:b,setIsAiCfoOpen:g,mobileExploreReferrer:"Cards"}),O=f.userRole.includes("charge_card_user"),N=!O,T=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:P,useDynamicConfig:j}=oe(),{isFeatureEnabled:p}=P(Z.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Z.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),x=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Y=ke({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=j(Fe.zeniCardsConfig),K=Re(),z=Be(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),L=q.charge_card_cashback_rate_per_transaction!=null?q.charge_card_cashback_rate_per_transaction:.0175,pe=q.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??q.default_credit_card_pay_now_threshold??Br,G=q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(q.enable_card_controls_for_company_ids)&&q.enable_card_controls_for_company_ids.includes(f.companyId),ce=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,we=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,ne=S(H=>gt(H)),de=Xa(ne.updateStatus),J=S(H=>Ye(H,N,y&&T,Y&&re)),Ke=J.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),Ne=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>La(H,Ne)),We=S(H=>ua(H,f.companyId)),qe=We.companyChargeCardInfo?.primaryFundingAccount,fa=We.allFundingAccounts.find(H=>H.id===qe?.accountId),se=J.fetchState,ta=J.creditAccount;Wt({isDataReady:se==="Completed"});const{creditAccountRepayment:le}=S(H=>$e(H)),xe=S(H=>_a(H).firstViewAfterActivation),{areTenantIdsInSync:na}=Ht(),Qe=at(z,Pe),ra=pa(Y,re,z,ta,le),sa=tt(y,T,z,ee,J.debitCardSummary),oa=Oe(Y,y,T,re),ia=J.creditAccount.balance.amount+J.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(X.getPayNowInfoTooltip()==null||ia<pe*J.creditAccount.limit.amount/100)&&o(!0)},[se,pe,ia,J.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&le.initiatedRepayments.amount===0&&le.fetchState==="Completed"||de==="In-Progress"&&ne.updateStatus==="Completed")o(!1),m(!0);else if(le.initiatedRepayments.amount>0&&le.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const H=Ue(f.tenantEmailDomain);n(H)}},[e,le.initiatedRepayments.amount,le.fetchState,de,ne.updateStatus,n,f.tenantEmailDomain]),c.useEffect(()=>{!B&&(re||T)&&na&&(v(!0),a(Ea(N,y&&T,Y&&re,!1)))},[B,N,a,na]),c.useEffect(()=>{xe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[xe,i]),c.useEffect(()=>{se==="Completed"&&O&&J.cards.length===1&&(J.cards[0].status.code==="inactive"&&J.cards[0].type.code==="business_physical_credit_card"?n(`./${J.cards[0].id}/activate`):J.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${J.cards[0].id}`)))},[se,O,r.state,n,J.cards]),c.useEffect(()=>{if(se==="Completed"&&O){const H=J.cards.length,De=J.cards.filter(Ve=>Ve.cardHolderUserId===A?.userId).filter(Ve=>Ve.status.code==="request_on_hold");De.length>0&&H===De.length&&n("./onboard")}},[se,J.cards,O,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Y&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||Q.trackCardsCardListView(ae,oa,Qe,ra,sa)},[se,ta,le.fetchState,ee.fetchState,z]),A==null)throw Error("Can't access charge card list page without signing in...");const Ua=S(H=>Ft(H.userState,H.userRoleState,H.userListViewState,"cardAdmin")),ga=Ka(K?.loggedInUserRoleMap),ba=H=>{h(H)},V=J.creditAccount.limit,he=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:Y,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),je=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:y,isTOSAccepted:we,isSetupEnabled:T,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga});return re||T?s.jsxs(s.Fragment,{children:[se==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:Q,onLoad:()=>{Q.trackPageLoaded(Mt.Event.cardsListPage),(Y&&!re||y&&!T)&&Q.trackCardsPromoView(ae,{isCreditCardOffered:Y,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Y&&!re?"Credit Card":"","Card List")}}),s.jsx(Ba,{showConfetti:xe})]}):null,u===!0?s.jsx(nt,{closeDrawerHandler:he,isPaymentDrawerOpen:u,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:ia,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Qe,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Y||le.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!z||Pe.fetchState==="Completed",paymentInitiatedDate:le.initiatedRepaymentDate}):null,s.jsxs(Jr,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:ba}),s.jsx(Xr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Y,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:E,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:C,creditCardPayNowThreshold:pe,signedInUser:A,chargeCardListState:J,location:r,admins:Ua.users,navigateAndClearBulkSelection:n,currentTenant:f,isCardControlsEnabled:G,companyChargeCardInfoCreditAccountLimit:f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,isCompanyInterestedInChargeCard:f.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,isUserHasCardsAdminLevelAccess:z,includeCreditAccountDebitSummaryAndCashbackInfo:N,onClickMenuIcon:()=>{ba(!0)},creditLimit:V,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:T,isEarlyPayEnabled:F,isChargeCardPaymentHistoryFeatureEnabled:U,cashbackRate:L,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Qe,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||je?s.jsx(ya,{to:"../promo"}):s.jsx(Ze,{fetchState:se})}const es=e=>`/${e}/cards/new`,as=e=>`/${e}/cards/payment`,ts=e=>`/${e}/cards/payment-history`,ns=ge(function(e){const t=X.getSignedInUser(),a=ie(e),r=e.tenantState.currentTenantId,n=vt(e),u={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",C=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:Bn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:u,companyName:m,spendManagementEndPoint:`${za}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:C}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),u=n.poppedPathname??"..";r(u,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,u)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:u}}})},onFiltersChange:n=>{e(Rn({filters:n}))},onReloadPayments:()=>{e(xt(!0))},onSearchTextChanged:n=>{e({type:"chargeCardPaymentHistory/updatePaymentHistorySearchText",payload:n})},updateDownloadStateHandler:n=>{e(On({uiState:{downloadState:n}}))}}})(Sr);function rs(){const e=ue(),t=ye(),a=me(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=oe();if(X.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const u=S(K=>ie(K)),m=S(K=>vt(K)),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Z.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),O=Ie(u),N=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=ke({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:h,isBookKeepingTenant:O,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:N}),P=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,j=Re(),p=Be(j?.loggedInUserRoleMap),d=S(K=>Ye(K,v,l&&k,T&&P)),_=c.useMemo(()=>{const K=d.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(K.map(z=>z.connectedAccountId))]},[d.cards]),F=S(K=>Ge(K)),U=S(K=>La(K,_)),{creditAccountRepayment:M}=S(K=>$e(K)),W=c.useMemo(()=>at(p,F),[p,F]),y=c.useMemo(()=>pa(T,P,p,d.creditAccount,M),[T,P,p,d.creditAccount,M]),x=c.useMemo(()=>tt(l,k,p,U,d.debitCardSummary),[l,k,p,U,d.debitCardSummary]),$=c.useMemo(()=>Oe(T,l,k,P),[T,l,k,P]),R=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Y=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{B(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),B(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{C||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(xt()))},[C,a,m.fetchState]),c.useEffect(()=>{!o&&(P||k)&&r&&(i(!0),a(Ea(v,!1,T&&P,!1)))},[o,P,k,r,a,v,T]),s.jsxs(s.Fragment,{children:[D?s.jsx(nt,{closeDrawerHandler:q,isPaymentDrawerOpen:D,pageName:"Payment History",sourcePage:"cardPaymentHistory",creditAccountSpentAmount:R,productInformation:$,creditAccountInformation:y,debitAccountInformation:x,cashbackInformation:W,isDebitCardInfoFetchStateCompleted:!(l&&k&&p)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!T||M.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!p||F.fetchState==="Completed",paymentInitiatedDate:M.initiatedRepaymentDate,retryRepayment:Y}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
26
26
  display: flex;
27
27
  height: 100vh;
28
28
  width: 100%;
@@ -31,7 +31,7 @@ import{j as s}from"./liveblocks-Cqbf2YvG.js";import{j as ue,l as la,h as me,g as
31
31
  overflow: auto;
32
32
  align-items: center;
33
33
  background-color: ${e=>e.theme.colors.grey4};
34
- `,ut=Qa.getLocalizedStrings().months;function ss(){const e=ue(),t=me(),a=ye(),{creditAccount:r,creditAccountRepayment:n}=S(y=>$e(y)),u=`${Vt.cardMicroServiceBaseUrl}/1.0/credit-accounts/${r.id}`,[m,C]=c.useState(!1),[I,o]=c.useState(!1),i=S(y=>Un(y)),{useFeatureGate:D}=oe(),A=S(y=>ie(y)),{isFeatureEnabled:f}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=D(Z.isDebitCardFeatureEnabled),v=Ae(B,A),k=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:v}),h=Se(A),b=Ie(A),g=A.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=ke({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:f,isBookKeepingTenant:b,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:g}),w=!!A.companyDebitCardInfo?.info?.isDebitCardEnabled,O=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,N=S(y=>Me(y,A.companyId)),T=ze(N.controllers),P=S(y=>Lt(y)),j=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(j)],d=S(y=>La(y,p)),_=S(y=>Nn(y));c.useEffect(()=>{I||r.fetchState==="Completed"||r.fetchState==="In-Progress"||(C(!0),t(Ga()))},[m,t,r.fetchState]),c.useEffect(()=>{I||r.fetchState!=="Completed"||r.id==null||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(o(!0),t(jn(r.id)))},[I,t,r.fetchState,r.id,i.fetchState]),c.useEffect(()=>{d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&k&&w&&t(Bt()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&t(da()),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&k&&w&&t(Vn()),n.fetchState!=="Completed"&&n.fetchState!=="In-Progress"&&l&&O&&t(Ya())},[d.fetchState,k,w,P.fetchState,_.fetchState,n.fetchState,l,O]),c.useEffect(()=>{if(i.fetchState==="Completed"&&r.fetchState==="Completed"&&n.fetchState==="Completed"&&P.fetchState==="Completed"&&(!k||!w||d.fetchState==="Completed"&&_.fetchState==="Completed")){let y="",x="";if(i.statements.length>0){const E=i.statements[i.statements.length-1].period,[q,K]=E.split("-"),z=i.statements[0].period,[Ce,ae]=z.split("-");y=`${ut[parseInt(K)-1]} ${q}`,x=`${ut[parseInt(ae)-1]} ${Ce}`}const $=Oe(l,k,w,O),R=pa(l,O,!0,r,n),Y=tt(k,w,!0,d,_);J.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:x},R,Y)}},[i.fetchState,r.fetchState,n.fetchState,d.fetchState,P.fetchState,_.fetchState]);const F=()=>{const y=ve(a.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},U=S(y=>Ge(y)),M=X.getSignedInUser(),W={userId:M?.userId??"",sessionId:M?.zeniSessionId??"",tenantId:A.tenantId??""};if(M==null)throw Error("Can't access address page without signing in...");if(i.fetchState!=="Completed")return s.jsx(lt,{children:s.jsx(Ir,{onBackClick:F})});{const y=Oe(l,k,w,O);return s.jsx(lt,{children:s.jsx(Ar,{currentTenantCompanyName:A.companyName,statementListView:i,productInformation:y,onBackClick:F,authParams:W,controllerEmails:T,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:O,chargeCardCashbackDetailState:U,creditAccount:r,creditAccountRepayment:n,depositAccountListWithDebitCardIssued:d,debitCardSummary:_,downloadEndPoint:u})})}}const os={containerWidth:new Ca(100,58)},is=({appContent:e})=>{const t=ma(),a=me(),r=ue(),n=ye(),{useDynamicConfig:u}=oe(),[m,C]=c.useState(!1),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[B,v]=c.useState(!1),[k,h]=c.useState(!1),b=X.getSignedInUser();if(b==null)throw Error("Can't access onboarding card page without signing in...");const g=S(R=>ie(R)),{configValue:l}=u(Fe.zeniCardsConfig),w=S(R=>Hn(R)),{tenantEmailDomain:O}=g,N=S(R=>R.settingsViewState.profile.fetchState),T=S(R=>R.chargeCardListState.fetchState),P=S(R=>R.settingsViewState.profile.userId),j=S(R=>R.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(Mn()),C(!0)),I===!1&&j!=="In-Progress"&&j!=="Completed"&&(a(wa()),o(!0)),i===!1&&T==="Not-Started"&&(D(!0),a(da()))},[m,i,T,I,j]),c.useEffect(()=>{N==="Completed"&&B===!1&&P!=null&&T==="Completed"&&w.cards.length>0&&(a(zn({userId:P})),a(Ot({cardId:w.cards[w.cards.length-1].id})),v(!0))},[N,B,P,T]),c.useEffect(()=>{if(!A&&w.fetchState==="Completed"&&w.cards.length===0){const R=ve(n.state?.pathnameStackToGoBack),Y=R.poppedPathname??Ue(O);r(Y,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Xa(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Z.isChargeCardFeatureEnabled),M=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!g.userRole.includes("charge_card_user")&&U&&M,y=S(R=>_!=null?Rt(R.chargeCardState,_):null),x=()=>{_!=null&&(a(aa(_,W,!0)),a(da()),f(!0))};c.useEffect(()=>{if(A&&_!=null&&y!=null&&y.status.code!=="request_on_hold"){const R=fe(g.tenantEmailDomain,_,b,y),Y=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Y},replace:!0})}},[A,y?.status.code]),c.useEffect(()=>{d==="In-Progress"&&p.updateStatus.fetchState==="Completed"&&setTimeout(x,3e3)},[d,p.updateStatus.fetchState]);const $=R=>{h(R)};if(!A&&T!=="Completed"||N!=="Completed"||w.cards.length===0)return s.jsx(Ze,{fetchState:"In-Progress"});if(P==null)throw Error("Can't access my userId.");return s.jsxs(ls,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:$}),s.jsx(cs,{chargeCardListView:w,cardUserOnboardingView:p,navigate:r,currentTenant:g,myUserId:P,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?s.jsx(ds,{windowSize:t,children:e}):null]})},cs=ge(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:u}=t,{tenantEmailDomain:m}=u;return{updateCardUserOnboardingLocalData:C=>{e(ot({localData:C}))},onGetOtp:C=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:C};e(ot({localData:I}))}e(va(C,"CardUserOnboarding"))},onResendOtp:C=>{e(Fa(C,"CardUserOnboarding"))},onVerifyOtp:(C,I)=>{e(Ta(C,I,"CardUserOnboarding"))},onVerifyOtpSuccess:C=>{e(Gn()),C!=null&&X.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Ot({cardId:C}))},onBackClick:()=>{const C=ve(n.state?.pathnameStackToGoBack),I=C.poppedPathname??Ue(m);a(I,{state:{pathnameStackToGoBack:C.newStack}})}}})(Er),ds=_e.div`
34
+ `,ut=Ja.getLocalizedStrings().months;function ss(){const e=ue(),t=me(),a=ye(),{creditAccount:r,creditAccountRepayment:n}=S(y=>$e(y)),u=`${Vt.cardMicroServiceBaseUrl}/1.0/credit-accounts/${r.id}`,[m,C]=c.useState(!1),[I,o]=c.useState(!1),i=S(y=>Un(y)),{useFeatureGate:D}=oe(),A=S(y=>ie(y)),{isFeatureEnabled:f}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=D(Z.isDebitCardFeatureEnabled),v=Ae(B,A),k=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:v}),h=Se(A),b=Ie(A),g=A.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=ke({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:f,isBookKeepingTenant:b,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:g}),w=!!A.companyDebitCardInfo?.info?.isDebitCardEnabled,O=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,N=S(y=>Me(y,A.companyId)),T=ze(N.controllers),P=S(y=>Lt(y)),j=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(j)],d=S(y=>La(y,p)),_=S(y=>Nn(y));c.useEffect(()=>{I||r.fetchState==="Completed"||r.fetchState==="In-Progress"||(C(!0),t(Ga()))},[m,t,r.fetchState]),c.useEffect(()=>{I||r.fetchState!=="Completed"||r.id==null||i.fetchState==="Completed"||i.fetchState==="In-Progress"||(o(!0),t(jn(r.id)))},[I,t,r.fetchState,r.id,i.fetchState]),c.useEffect(()=>{d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&k&&w&&t(Bt()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&t(da()),_.fetchState!=="Completed"&&_.fetchState!=="In-Progress"&&k&&w&&t(Vn()),n.fetchState!=="Completed"&&n.fetchState!=="In-Progress"&&l&&O&&t(Ya())},[d.fetchState,k,w,P.fetchState,_.fetchState,n.fetchState,l,O]),c.useEffect(()=>{if(i.fetchState==="Completed"&&r.fetchState==="Completed"&&n.fetchState==="Completed"&&P.fetchState==="Completed"&&(!k||!w||d.fetchState==="Completed"&&_.fetchState==="Completed")){let y="",x="";if(i.statements.length>0){const E=i.statements[i.statements.length-1].period,[q,K]=E.split("-"),z=i.statements[0].period,[Ce,ae]=z.split("-");y=`${ut[parseInt(K)-1]} ${q}`,x=`${ut[parseInt(ae)-1]} ${Ce}`}const $=Oe(l,k,w,O),R=pa(l,O,!0,r,n),Y=tt(k,w,!0,d,_);Q.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:x},R,Y)}},[i.fetchState,r.fetchState,n.fetchState,d.fetchState,P.fetchState,_.fetchState]);const F=()=>{const y=ve(a.state?.pathnameStackToGoBack),x=y.poppedPathname??"..";e(x,{state:{pathnameStackToGoBack:y.newStack}})},U=S(y=>Ge(y)),M=X.getSignedInUser(),W={userId:M?.userId??"",sessionId:M?.zeniSessionId??"",tenantId:A.tenantId??""};if(M==null)throw Error("Can't access address page without signing in...");if(i.fetchState!=="Completed")return s.jsx(lt,{children:s.jsx(Ir,{onBackClick:F})});{const y=Oe(l,k,w,O);return s.jsx(lt,{children:s.jsx(Ar,{currentTenantCompanyName:A.companyName,statementListView:i,productInformation:y,onBackClick:F,authParams:W,controllerEmails:T,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:k,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:O,chargeCardCashbackDetailState:U,creditAccount:r,creditAccountRepayment:n,depositAccountListWithDebitCardIssued:d,debitCardSummary:_,downloadEndPoint:u})})}}const os={containerWidth:new Ca(100,58)},is=({appContent:e})=>{const t=ma(),a=me(),r=ue(),n=ye(),{useDynamicConfig:u}=oe(),[m,C]=c.useState(!1),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[B,v]=c.useState(!1),[k,h]=c.useState(!1),b=X.getSignedInUser();if(b==null)throw Error("Can't access onboarding card page without signing in...");const g=S(R=>ie(R)),{configValue:l}=u(Fe.zeniCardsConfig),w=S(R=>Hn(R)),{tenantEmailDomain:O}=g,N=S(R=>R.settingsViewState.profile.fetchState),T=S(R=>R.chargeCardListState.fetchState),P=S(R=>R.settingsViewState.profile.userId),j=S(R=>R.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(Mn()),C(!0)),I===!1&&j!=="In-Progress"&&j!=="Completed"&&(a(wa()),o(!0)),i===!1&&T==="Not-Started"&&(D(!0),a(da()))},[m,i,T,I,j]),c.useEffect(()=>{N==="Completed"&&B===!1&&P!=null&&T==="Completed"&&w.cards.length>0&&(a(zn({userId:P})),a(Ot({cardId:w.cards[w.cards.length-1].id})),v(!0))},[N,B,P,T]),c.useEffect(()=>{if(!A&&w.fetchState==="Completed"&&w.cards.length===0){const R=ve(n.state?.pathnameStackToGoBack),Y=R.poppedPathname??Ue(O);r(Y,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Xa(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Z.isChargeCardFeatureEnabled),M=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!g.userRole.includes("charge_card_user")&&U&&M,y=S(R=>_!=null?Rt(R.chargeCardState,_):null),x=()=>{_!=null&&(a(aa(_,W,!0)),a(da()),f(!0))};c.useEffect(()=>{if(A&&_!=null&&y!=null&&y.status.code!=="request_on_hold"){const R=fe(g.tenantEmailDomain,_,b,y),Y=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Y},replace:!0})}},[A,y?.status.code]),c.useEffect(()=>{d==="In-Progress"&&p.updateStatus.fetchState==="Completed"&&setTimeout(x,3e3)},[d,p.updateStatus.fetchState]);const $=R=>{h(R)};if(!A&&T!=="Completed"||N!=="Completed"||w.cards.length===0)return s.jsx(Ze,{fetchState:"In-Progress"});if(P==null)throw Error("Can't access my userId.");return s.jsxs(ls,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:$}),s.jsx(cs,{chargeCardListView:w,cardUserOnboardingView:p,navigate:r,currentTenant:g,myUserId:P,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?s.jsx(ds,{windowSize:t,children:e}):null]})},cs=ge(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:u}=t,{tenantEmailDomain:m}=u;return{updateCardUserOnboardingLocalData:C=>{e(ot({localData:C}))},onGetOtp:C=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:C};e(ot({localData:I}))}e(va(C,"CardUserOnboarding"))},onResendOtp:C=>{e(Fa(C,"CardUserOnboarding"))},onVerifyOtp:(C,I)=>{e(Ta(C,I,"CardUserOnboarding"))},onVerifyOtpSuccess:C=>{e(Gn()),C!=null&&X.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Ot({cardId:C}))},onBackClick:()=>{const C=ve(n.state?.pathnameStackToGoBack),I=C.poppedPathname??Ue(m);a(I,{state:{pathnameStackToGoBack:C.newStack}})}}})(Er),ds=_e.div`
35
35
  display: flex;
36
36
  flex-direction: column;
37
37
  width: ${e=>`${os.containerWidth.value(e.windowSize)}%`};
@@ -59,7 +59,7 @@ import{j as s}from"./liveblocks-Cqbf2YvG.js";import{j as ue,l as la,h as me,g as
59
59
  align-items: center;
60
60
  background-color: ${e=>e.theme.colors.grey4};
61
61
  box-shadow: ${e=>`${ka.sp0} 2px ${ka.sp1} ${e.theme.colors.dropShadowNormal}`};
62
- `,fs={overlayWidth:new Ca(Na[12],Na[12],Na[9])},gs=ge(function(e,t){const a=Wa(e,!1,!1),r=t.lineId,n=a.customAddress[r],u=a.customAddressStatus[r]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:t.googleAPIKey,customAddress:n,customAddressStatus:u,lineId:r}},function(e,t){const{newCustomAddressId:a,lineId:r,chargeCardTypeOption:n}=t;return{onSubmitHandler:u=>{a!=null&&e(Ut(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`));const m=Ur(u);e(Jn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Qn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(qn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Ja(),n=ma(),u=()=>{t()},m=S(C=>Wn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,C))?.newAddressId;return s.jsx(zt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(C,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&u(),children:s.jsx(gs,{googleAPIKey:Oa.googleMapsAPIKey,onDismissClick:u,lineId:e,chargeCardTypeOption:a,newCustomAddressId:m})})},ys=ge(function(e,t){const{isChargeCardFeatureEnabled:a,isDebitCardFeatureEnabled:r,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C}=t,I=Wa(e,a&&m,r&&C);return{companyName:t.companyName,signedInUser:t.signedInUser,issueChargeCards:I,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isDebitCardFeatureEnabled:r,isChargeCardFeatureEnabled:a,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C,cardHolderCandidates:I.userList.map(o=>o.user).filter(Boolean),allRoles:I.userList.map(o=>o.userRole),allAccountingClasses:I.allAccountingClasses,userList:I.userList}},function(e,t){return{onIssueCardClick:()=>{e(ar())},onSaveChangesToLocalStore:a=>{e(er(a))},onDismissClick:()=>{e(Nt()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=X.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),B=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:k}),[b,g]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{b||(g(!0),a(Xn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,O=D.companyName,N=S(y=>Wa(y,h&&l,f&&w)),T=N.fetchState,P=N.issueCardStatus.fetchState,j=N.lastSelfIssuedDebitCardId,p=S(y=>j!=null?Rt(y.chargeCardState,j):void 0),[d,_]=c.useState(null),[F,U]=c.useState(null),M=()=>{_(null)},W=(y,x)=>{_(y),U(x)};return c.useEffect(()=>{if(P==="Completed"){if(j!=null&&p?.type.code==="business_virtual_debit_card"){let y;y=p?.status.code==="request_on_hold"&&e.userId===p.cardHolderUserId?Zt(D.tenantEmailDomain):fe(D.tenantEmailDomain,j,e,p),t(y)}else t("../");a(Nt())}},[P,j]),T==="Completed"?s.jsxs(s.Fragment,{children:[d!==null&&F!==null?s.jsx(bs,{closeDrawerHandler:M,lineId:d,chargeCardTypeOption:F}):null,s.jsx(ys,{companyName:O,signedInUser:e,themeState:r,isIssuePhysicalCardEnabled:C,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:t,fetchState:N.fetchState,openAddAddressDrawerHandler:W,defaultCardType:u==="creditCard"||u==="debitCard"?u:void 0})]}):T==="Error"?s.jsx(Ra,{}):s.jsx(wr,{})}const Is=_e.div`
62
+ `,fs={overlayWidth:new Ca(Na[12],Na[12],Na[9])},gs=ge(function(e,t){const a=Wa(e,!1,!1),r=t.lineId,n=a.customAddress[r],u=a.customAddressStatus[r]??{fetchState:"Not-Started",error:void 0};return{googleAPIKey:t.googleAPIKey,customAddress:n,customAddressStatus:u,lineId:r}},function(e,t){const{newCustomAddressId:a,lineId:r,chargeCardTypeOption:n}=t;return{onSubmitHandler:u=>{a!=null&&e(Ut(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`));const m=Ur(u);e(Qn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Jn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(qn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Qa(),n=ma(),u=()=>{t()},m=S(C=>Wn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,C))?.newAddressId;return s.jsx(zt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(C,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&u(),children:s.jsx(gs,{googleAPIKey:Oa.googleMapsAPIKey,onDismissClick:u,lineId:e,chargeCardTypeOption:a,newCustomAddressId:m})})},ys=ge(function(e,t){const{isChargeCardFeatureEnabled:a,isDebitCardFeatureEnabled:r,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C}=t,I=Wa(e,a&&m,r&&C);return{companyName:t.companyName,signedInUser:t.signedInUser,issueChargeCards:I,isIssuePhysicalCardEnabled:n,isIssuePhysicalDebitCardEnabled:u,isDebitCardFeatureEnabled:r,isChargeCardFeatureEnabled:a,isChargeCardSetupEnabled:m,isDebitCardSetupEnabled:C,cardHolderCandidates:I.userList.map(o=>o.user).filter(Boolean),allRoles:I.userList.map(o=>o.userRole),allAccountingClasses:I.allAccountingClasses,userList:I.userList}},function(e,t){return{onIssueCardClick:()=>{e(ar())},onSaveChangesToLocalStore:a=>{e(er(a))},onDismissClick:()=>{e(Nt()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=X.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),B=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:k}),[b,g]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{b||(g(!0),a(Xn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,O=D.companyName,N=S(y=>Wa(y,h&&l,f&&w)),T=N.fetchState,P=N.issueCardStatus.fetchState,j=N.lastSelfIssuedDebitCardId,p=S(y=>j!=null?Rt(y.chargeCardState,j):void 0),[d,_]=c.useState(null),[F,U]=c.useState(null),M=()=>{_(null)},W=(y,x)=>{_(y),U(x)};return c.useEffect(()=>{if(P==="Completed"){if(j!=null&&p?.type.code==="business_virtual_debit_card"){let y;y=p?.status.code==="request_on_hold"&&e.userId===p.cardHolderUserId?Zt(D.tenantEmailDomain):fe(D.tenantEmailDomain,j,e,p),t(y)}else t("../");a(Nt())}},[P,j]),T==="Completed"?s.jsxs(s.Fragment,{children:[d!==null&&F!==null?s.jsx(bs,{closeDrawerHandler:M,lineId:d,chargeCardTypeOption:F}):null,s.jsx(ys,{companyName:O,signedInUser:e,themeState:r,isIssuePhysicalCardEnabled:C,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:t,fetchState:N.fetchState,openAddAddressDrawerHandler:W,defaultCardType:u==="creditCard"||u==="debitCard"?u:void 0})]}):T==="Error"?s.jsx(Ra,{}):s.jsx(wr,{})}const Is=_e.div`
63
63
  display: flex;
64
64
  height: 100vh;
65
65
  width: 100%;
@@ -68,4 +68,4 @@ import{j as s}from"./liveblocks-Cqbf2YvG.js";import{j as ue,l as la,h as me,g as
68
68
  overflow: auto;
69
69
  align-items: center;
70
70
  background-color: ${e=>e.theme.colors.grey4};
71
- `,As=ge(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:u,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:C}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=Yt(I,o),D=fe(C,o,u,i),A=be(n.state?.pathnameStackToGoBack,n.pathname);a(D,{state:{pathnameStackToGoBack:A}})},onColumnSortConfigChanged:(o,i)=>{e(Ha({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(da())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Ha({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=ue(),t=me(),a=ye(),r=Ja(),[n,u]=c.useState(!1),m=S(F=>tr(F)),C=S(F=>ie(F)),I=S(F=>Me(F,C.companyId)),o=ze(I.controllers),{useFeatureGate:i}=oe(),{isFeatureEnabled:D}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Z.isDebitCardFeatureEnabled),f=Ae(A,C),B=Ee({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:f}),v=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,k=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Re(),b=Se(C),g=Ie(C),l=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=ke({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:D,isBookKeepingTenant:g,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:l}),O=Be(h?.loggedInUserRoleMap),N=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),j=S(F=>Lt(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(j)],d=S(F=>La(F,p));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),t(da()),t(wa()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&_!=null){const F=fe(C.tenantEmailDomain,m.cards[0].id,_,m.cards[0]);e(F,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const _=X.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&O&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&O&&t(Ya()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&B&&v&&O&&t(Bt())},[T.fetchState,P.fetchState,t,d.fetchState,B,v,O,w,k]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(Ze,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const F=Oe(w,B,v,k);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:C,signedInUser:_,productInformation:F,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:k,chargeCardCashbackDetailState:N,creditAccount:T,creditAccountRepayment:P,depositAccountListWithDebitCardIssued:d,controllerEmails:o,location:a})})}}const ks=ge(function(e,t){const{companyId:a,companyLegalName:r}=t;return{chargeCardSetupView:ua(e,a),admins:t.adminList,companyLegalName:r,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,t){const{navigate:a,companyId:r,isCompanyBusinessVerificationAndPaymentSetUpDone:n,isDebitCardSetupEnabled:u,isChargeCardSetupEnabled:m,signedInUser:C,location:I,productInformation:o,isEarlyPayEnabled:i,controllerEmails:D,chargeCardsCreditAccountLimit:A}=t;return{onSetupButtonClick:f=>{if(C!=null&&J.trackCardsPromoPageClicked("enable cards"),n)switch(J.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!0,"charge_cards",i,!1));break;case"debit":e(Le(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!0,"debit_cards",i,!0):Le(r,!0,"charge_cards__debit_cards",i,!1))}else switch(J.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!1,"charge_cards",i,!1));break;case"debit":e(Le(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!1,"debit_cards",i,!0):Le(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let B=f.poppedPathname;B==null&&(B=u||m?"..":"../.."),a(B,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(sr(r))}}})(Fr),Ds=()=>{const e=ue(),{tenantEmailDomain:t}=la(),[a]=mt(),r=a.get("cardPromoType"),n=me(),{useDynamicConfig:u,useFeatureGate:m}=oe(),[C,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Z.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),B=S(ee=>Me(ee,f.companyId)),v=ze(B.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=X.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,O=Se(f),N=Ie(f),T=Ae(o,f),P=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,j=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:T}),p=ke({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:D,isBookKeepingTenant:N,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:P}),d=Gt({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:D,isBookKeepingTenant:N}),_=j&&p===!1,F=w?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||nr(l?.providerVerificationStatus?.code??"")),U=X.getSignedInUser(),M=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,W=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,y=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,x=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,$=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,R=ee=>{I(ee)},Y=S(ee=>ee.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Re(),q=Be(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,L]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Y!=="Not-Started"||b==null||(L(!0),n(xa(b,!0)))},[ae,Y,b,n]);const ce=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:d,isTOSAccepted:W,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),we=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:j,isTOSAccepted:$,isSetupEnabled:x,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=j&&we&&d&&P>=0&&ce?"debit_and_credit":j&&we?"debit":"credit",ne=Rr(r,re),de=g?.chargeCardTermsDetails?.fetchStatus?.fetchState,Q=c.useRef(null);c.useEffect(()=>{de==="In-Progress"?Q.current=ne:de!=="Error"&&de!=="Not-Started"||(Q.current=null)},[de,ne]);const Ke=de!=="In-Progress"&&de!=="Completed"||Q.current==null?ne:Q.current;c.useEffect(()=>{ne==="credit"&&(y||d===!1&&x)||ne==="debit"&&x||ne==="debit_and_credit"&&x&&y?e("../"):(ne==="debit_and_credit"&&W===!0&&$===!0||ne==="credit"&&(W===!0||d===!1&&$===!0)||ne==="debit"&&$===!0)&&q===!0&&e("../setup")},[F,y,x,ne,W,$]),c.useEffect(()=>{pe||(n(rr("cardAdmin")),G(!0))},[pe]);const Ne=S(ee=>Ft(ee.userState,ee.userRoleState,ee.userListViewState,"cardAdmin")),Pe=Oe(d,j,x,y);return(ce||we)&&Y==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!j&&!x||!!d&&!!j&&!x&&!y){const ee=_s({isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:j});J.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(Ba,{showConfetti:z}),s.jsx(ha,{isAppContentDrawerOpen:C,handleDrawerToggle:R}),s.jsx(ks,{signedInUser:U,location:h,showEnableCardButton:F,isCompanyBusinessVerificationAndPaymentSetUpDone:F,isChargeCardSetupEnabled:y,isDebitCardSetupEnabled:x,companyLegalName:f.companyName,adminList:Ne.users,isCheckingEnabled:M,navigate:e,companyId:b,cardPromoType:Ke,controllerEmails:v,productInformation:Pe,isCreditCardProductVisible:p,isDebitCardFeatureEnabled:o,isEarlyPayEnabled:i,cashbackRate:k,chargeCardsCreditAccountLimit:P,onClickMenuIcon:()=>{R(!0)}})]}):s.jsx(Ze,{fetchState:"Not-Started"})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Js(){const e=ye(),t=S(Y=>ie(Y)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),C=Ae(n,t),I=Ee({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:C}),o=vr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,A=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,B=Re(),v=Be(B?.loggedInUserRoleMap),k=Ka(B?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Z.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),O=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!w)&&ir(B?.loggedInUserRoleMap),N=cr(B?.loggedInUserRoleMap),T=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!w)&&dr(B?.loggedInUserRoleMap),{isFeatureEnabled:P}=a(Z.isDepositAccountsFeatureEnabled),j=P&&!w&&bt(B?.loggedInUserRoleMap),p=A&&!w,d=f&&!w,_=o&&!w&&Be(B?.loggedInUserRoleMap),F=lr(B?.loggedInUserRoleMap),U=Se(t),M=Ie(t),W=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=ke({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:r,isBookKeepingTenant:M,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:W}),x=t.companyChargeCardInfo?.info!=null&&ea({cardInfo:t.companyChargeCardInfo.info,isProductVisible:y,isTOSAccepted:i,isSetupEnabled:A,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),$=t.companyDebitCardInfo?.info!=null&&ea({cardInfo:t.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:D,isSetupEnabled:f,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),R=x||$;return s.jsxs(Jt,{children:[v?s.jsx(te,{path:"setup",element:s.jsx(it,{isBillPayAdminLevelAccess:O,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,isUserHasOnlyBillPayAccess:N,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(te,{path:"verification",element:s.jsx(it,{isBillPayAdminLevelAccess:O,isUserHasOnlyBillPayAccess:N,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,productType:"charge_cards",type:"verification"})}):null,s.jsx(te,{path:"promo",element:s.jsx(Ds,{})}),p||d?s.jsxs(s.Fragment,{children:[s.jsx(te,{path:"/",element:s.jsx(dt,{isPaymentDrawerOpen:!1})}),_&&u?s.jsx(te,{path:"payment",element:s.jsx(dt,{isPaymentDrawerOpen:!0})}):null,s.jsx(te,{path:"activate",element:s.jsx(Es,{})}),s.jsx(te,{path:"onboard",element:s.jsx(is,{})}),v?s.jsx(te,{path:"new",element:s.jsx(Ss,{})}):null,h&&g?s.jsx(te,{path:"cashback",element:s.jsx(Vr,{})}):null,l?s.jsx(te,{path:"statements",element:s.jsx(ss,{})}):null,_&&m&&A?s.jsx(te,{path:"payment-history",element:s.jsx(rs,{})}):null,s.jsx(te,{path:":cardId/activate",element:s.jsx(zr,{})}),s.jsx(te,{path:":cardId/setPin",element:s.jsx(ms,{})}),s.jsx(te,{path:":cardId/addToWallet",element:s.jsx(Nr,{})}),s.jsx(te,{path:":cardId/*",element:s.jsx(Jr,{})}),s.jsx(te,{path:"*",element:s.jsx(Ra,{})})]}):(i||D)&&v?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../setup"})}):R?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../promo",state:e.state})}):s.jsx(te,{path:"*",element:null})]})}export{Js as default};
71
+ `,As=ge(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:u,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:C}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=Yt(I,o),D=fe(C,o,u,i),A=be(n.state?.pathnameStackToGoBack,n.pathname);a(D,{state:{pathnameStackToGoBack:A}})},onColumnSortConfigChanged:(o,i)=>{e(Ha({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(da())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Ha({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=ue(),t=me(),a=ye(),r=Qa(),[n,u]=c.useState(!1),m=S(F=>tr(F)),C=S(F=>ie(F)),I=S(F=>Me(F,C.companyId)),o=ze(I.controllers),{useFeatureGate:i}=oe(),{isFeatureEnabled:D}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Z.isDebitCardFeatureEnabled),f=Ae(A,C),B=Ee({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:f}),v=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,k=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Re(),b=Se(C),g=Ie(C),l=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=ke({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:D,isBookKeepingTenant:g,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:l}),O=Be(h?.loggedInUserRoleMap),N=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),j=S(F=>Lt(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(j)],d=S(F=>La(F,p));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),t(da()),t(wa()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&_!=null){const F=fe(C.tenantEmailDomain,m.cards[0].id,_,m.cards[0]);e(F,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const _=X.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&O&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&O&&t(Ya()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&B&&v&&O&&t(Bt())},[T.fetchState,P.fetchState,t,d.fetchState,B,v,O,w,k]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(Ze,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const F=Oe(w,B,v,k);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:C,signedInUser:_,productInformation:F,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:k,chargeCardCashbackDetailState:N,creditAccount:T,creditAccountRepayment:P,depositAccountListWithDebitCardIssued:d,controllerEmails:o,location:a})})}}const ks=ge(function(e,t){const{companyId:a,companyLegalName:r}=t;return{chargeCardSetupView:ua(e,a),admins:t.adminList,companyLegalName:r,meetingUrl:"https://meetings.hubspot.com/niharn/demo-zeni-charge-cards?embed=true"}},function(e,t){const{navigate:a,companyId:r,isCompanyBusinessVerificationAndPaymentSetUpDone:n,isDebitCardSetupEnabled:u,isChargeCardSetupEnabled:m,signedInUser:C,location:I,productInformation:o,isEarlyPayEnabled:i,controllerEmails:D,chargeCardsCreditAccountLimit:A}=t;return{onSetupButtonClick:f=>{if(C!=null&&Q.trackCardsPromoPageClicked("enable cards"),n)switch(Q.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!0,"charge_cards",i,!1));break;case"debit":e(Le(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!0,"debit_cards",i,!0):Le(r,!0,"charge_cards__debit_cards",i,!1))}else switch(Q.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(Le(r,!1,"charge_cards",i,!1));break;case"debit":e(Le(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Le(r,!1,"debit_cards",i,!0):Le(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let B=f.poppedPathname;B==null&&(B=u||m?"..":"../.."),a(B,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(sr(r))}}})(Fr),Ds=()=>{const e=ue(),{tenantEmailDomain:t}=la(),[a]=mt(),r=a.get("cardPromoType"),n=me(),{useDynamicConfig:u,useFeatureGate:m}=oe(),[C,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Z.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),B=S(ee=>Me(ee,f.companyId)),v=ze(B.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=X.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,O=Se(f),N=Ie(f),T=Ae(o,f),P=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,j=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:T}),p=ke({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:D,isBookKeepingTenant:N,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:P}),d=Gt({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:D,isBookKeepingTenant:N}),_=j&&p===!1,F=w?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||nr(l?.providerVerificationStatus?.code??"")),U=X.getSignedInUser(),M=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,W=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,y=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,x=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,$=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,R=ee=>{I(ee)},Y=S(ee=>ee.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Re(),q=Be(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,L]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Y!=="Not-Started"||b==null||(L(!0),n(xa(b,!0)))},[ae,Y,b,n]);const ce=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:d,isTOSAccepted:W,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),we=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:j,isTOSAccepted:$,isSetupEnabled:x,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=j&&we&&d&&P>=0&&ce?"debit_and_credit":j&&we?"debit":"credit",ne=Rr(r,re),de=g?.chargeCardTermsDetails?.fetchStatus?.fetchState,J=c.useRef(null);c.useEffect(()=>{de==="In-Progress"?J.current=ne:de!=="Error"&&de!=="Not-Started"||(J.current=null)},[de,ne]);const Ke=de!=="In-Progress"&&de!=="Completed"||J.current==null?ne:J.current;c.useEffect(()=>{ne==="credit"&&(y||d===!1&&x)||ne==="debit"&&x||ne==="debit_and_credit"&&x&&y?e("../"):(ne==="debit_and_credit"&&W===!0&&$===!0||ne==="credit"&&(W===!0||d===!1&&$===!0)||ne==="debit"&&$===!0)&&q===!0&&e("../setup")},[F,y,x,ne,W,$]),c.useEffect(()=>{pe||(n(rr("cardAdmin")),G(!0))},[pe]);const Ne=S(ee=>Ft(ee.userState,ee.userRoleState,ee.userListViewState,"cardAdmin")),Pe=Oe(d,j,x,y);return(ce||we)&&Y==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:Q,onLoad:()=>{if(Q.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!j&&!x||!!d&&!!j&&!x&&!y){const ee=_s({isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:j});Q.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(Ba,{showConfetti:z}),s.jsx(ha,{isAppContentDrawerOpen:C,handleDrawerToggle:R}),s.jsx(ks,{signedInUser:U,location:h,showEnableCardButton:F,isCompanyBusinessVerificationAndPaymentSetUpDone:F,isChargeCardSetupEnabled:y,isDebitCardSetupEnabled:x,companyLegalName:f.companyName,adminList:Ne.users,isCheckingEnabled:M,navigate:e,companyId:b,cardPromoType:Ke,controllerEmails:v,productInformation:Pe,isCreditCardProductVisible:p,isDebitCardFeatureEnabled:o,isEarlyPayEnabled:i,cashbackRate:k,chargeCardsCreditAccountLimit:P,onClickMenuIcon:()=>{R(!0)}})]}):s.jsx(Ze,{fetchState:"Not-Started"})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Qs(){const e=ye(),t=S(Y=>ie(Y)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),C=Ae(n,t),I=Ee({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:C}),o=vr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,A=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,B=Re(),v=Be(B?.loggedInUserRoleMap),k=Ka(B?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Z.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),O=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!w)&&ir(B?.loggedInUserRoleMap),N=cr(B?.loggedInUserRoleMap),T=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!w)&&dr(B?.loggedInUserRoleMap),{isFeatureEnabled:P}=a(Z.isDepositAccountsFeatureEnabled),j=P&&!w&&bt(B?.loggedInUserRoleMap),p=A&&!w,d=f&&!w,_=o&&!w&&Be(B?.loggedInUserRoleMap),F=lr(B?.loggedInUserRoleMap),U=Se(t),M=Ie(t),W=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=ke({isCardsOnlyTenant:U,isChargeCardFeatureEnabled:r,isBookKeepingTenant:M,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:W}),x=t.companyChargeCardInfo?.info!=null&&ea({cardInfo:t.companyChargeCardInfo.info,isProductVisible:y,isTOSAccepted:i,isSetupEnabled:A,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),$=t.companyDebitCardInfo?.info!=null&&ea({cardInfo:t.companyDebitCardInfo.info,isProductVisible:I,isTOSAccepted:D,isSetupEnabled:f,isUserHasCardsAdminLevelAccess:v,isUserHasCardsAccess:k}),R=x||$;return s.jsxs(Qt,{children:[v?s.jsx(te,{path:"setup",element:s.jsx(it,{isBillPayAdminLevelAccess:O,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,isUserHasOnlyBillPayAccess:N,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(te,{path:"verification",element:s.jsx(it,{isBillPayAdminLevelAccess:O,isUserHasOnlyBillPayAccess:N,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,productType:"charge_cards",type:"verification"})}):null,s.jsx(te,{path:"promo",element:s.jsx(Ds,{})}),p||d?s.jsxs(s.Fragment,{children:[s.jsx(te,{path:"/",element:s.jsx(dt,{isPaymentDrawerOpen:!1})}),_&&u?s.jsx(te,{path:"payment",element:s.jsx(dt,{isPaymentDrawerOpen:!0})}):null,s.jsx(te,{path:"activate",element:s.jsx(Es,{})}),s.jsx(te,{path:"onboard",element:s.jsx(is,{})}),v?s.jsx(te,{path:"new",element:s.jsx(Ss,{})}):null,h&&g?s.jsx(te,{path:"cashback",element:s.jsx(Vr,{})}):null,l?s.jsx(te,{path:"statements",element:s.jsx(ss,{})}):null,_&&m&&A?s.jsx(te,{path:"payment-history",element:s.jsx(rs,{})}):null,s.jsx(te,{path:":cardId/activate",element:s.jsx(zr,{})}),s.jsx(te,{path:":cardId/setPin",element:s.jsx(ms,{})}),s.jsx(te,{path:":cardId/addToWallet",element:s.jsx(Nr,{})}),s.jsx(te,{path:":cardId/*",element:s.jsx(Qr,{})}),s.jsx(te,{path:"*",element:s.jsx(Ra,{})})]}):(i||D)&&v?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../setup"})}):R?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../promo",state:e.state})}):s.jsx(te,{path:"*",element:null})]})}export{Qs as default};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-ZAKgWoPK.js";import{a as g}from"./sentry-Bp45iw9z.js";import{j as w,h as k,u as x,l as T,g as O,k as E}from"./core-a8i-_0Kh.js";import{z as C,aZ as F,v as P,d as L,f as V,aa as N,a_ as j,ao as A,ap as M,q as U}from"./index-CJiQhPf1.js";import{eM as D,fC as B,rf as _,fx as R,b$ as z,Lf as G,bm as Y,pn as Z,pb as $,jI as q,lc as S,Lg as H,bB as J,cr as b,lk as K,ln as Q}from"./zeni-epic-state-ZCc1K30S.js";import"./mui-B8yatdty.js";import{c as W}from"./routePaths-BJH4smh2.js";import{M as X}from"./MobileAppDrawer-Clk7FI85.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]="b639a60f-642c-4d36-85d0-94d544c7dd3d",t._sentryDebugIdIdentifier="sentry-dbid-b639a60f-642c-4d36-85d0-94d544c7dd3d")}catch{}})();const ee=E(function(t){const a=R(t),i=C.getSignedInUser(),l=D(t),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&a.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(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:`${A.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(Q())},onAddressClick:e=>{const n=W(f,e),o=U(p.state?.pathnameStackToGoBack,p.pathname);c(n,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{t(K({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.subIndustry?.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:M(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?J(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(H(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($(e))},onEditFileName:(e,n)=>{t(Z(e,n.split(".")[0]))}}})(j);function de(){const t=w(),a=k(),i=x(),{tenantEmailDomain:l}=T(),[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??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect(()=>{c||n!=="Not-Started"||d==null||(p(!0),a(B(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(F,{onGoHome:()=>t("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:L,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:t,location:i,isLoading:y,currentTenant:r,isSettings:N(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-Cqbf2YvG.js";import{a}from"./sentry-gLPXz4Yq.js";import{h as D,u as v,g as u,N as w}from"./core-DZE88rLA.js";import{H_ as _,eM as A,fj as O,m3 as j,fJ as h,fi as U,eN as L,I6 as F}from"./zeni-epic-state-Cc2P4FPR.js";import{u as H,z as p,L as g,D as $,o as k}from"./index-BET54Nt-.js";import{n as z}from"./mui-B4xUUoCx.js";import{t as R}from"./getLocaleForTenant-CPndpwIp.js";import{g as P,Q as G}from"./QBOConnectionScreen-CMvaIZxf.js";import"./recharts-3_XOsuaw.js";import"./lottie-BMcMDJUW.js";import"./analytics-Cp5F-UjF.js";import"./plaid-G98kqTnM.js";import"./dnd-B4DEM2bW.js";import"./stripe-DMRn4zHo.js";import"./lexical-Bp_BNV6r.js";import"./pdf-DYKlsr3c.js";import"./utils-oW6HiHsc.js";import"./empty-DTOnM0RR.js";import"./pdf-lib-vymaIDnW.js";import"./index-j9ZiGcsv.js";import"./url-DMg8GQjt.js";import"./index-BWIeQAsg.js";import"./decodeURIComponentSafe--utjO_hD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="90c8535a-7421-4913-8938-db06dfde49a0",t._sentryDebugIdIdentifier="sentry-dbid-90c8535a-7421-4913-8938-db06dfde49a0")}catch{}})();const J=z.div`
1
+ import{j as C}from"./liveblocks-ZAKgWoPK.js";import{a}from"./sentry-Bp45iw9z.js";import{h as D,u as v,g as u,N as w}from"./core-a8i-_0Kh.js";import{H_ as _,eM as A,fj as O,m3 as j,fJ as h,fi as U,eN as L,I6 as F}from"./zeni-epic-state-ZCc1K30S.js";import{u as H,z as p,L as g,D as $,o as k}from"./index-CJiQhPf1.js";import{n as z}from"./mui-B8yatdty.js";import{t as R}from"./getLocaleForTenant-C0C8sNl1.js";import{g as P,Q as G}from"./QBOConnectionScreen-CcDeJYBx.js";import"./recharts-BhJEeZEG.js";import"./lottie-DN0gYkdx.js";import"./analytics-vyykHm3I.js";import"./plaid-CP3hLhCR.js";import"./dnd-CDdU3ON0.js";import"./stripe-DMRn4zHo.js";import"./lexical-BzneVI9m.js";import"./pdf-C4rebPwh.js";import"./utils-ikosPjSL.js";import"./empty-9qzWTKUd.js";import"./pdf-lib-OiZx9iEf.js";import"./index-DTPu_Uy6.js";import"./url-asQ2Q_hT.js";import"./index-DvmHdckU.js";import"./decodeURIComponentSafe-B_IVipCF.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="90c8535a-7421-4913-8938-db06dfde49a0",t._sentryDebugIdIdentifier="sentry-dbid-90c8535a-7421-4913-8938-db06dfde49a0")}catch{}})();const J=z.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  flex-direction: row;
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-ZAKgWoPK.js";import{z as m}from"./index-CJiQhPf1.js";import{g as n}from"./QBOConnectionScreen-CcDeJYBx.js";import"./sentry-Bp45iw9z.js";import{u as p,N as a}from"./core-a8i-_0Kh.js";import"./zeni-epic-state-ZCc1K30S.js";import"./recharts-BhJEeZEG.js";import"./mui-B8yatdty.js";import"./lottie-DN0gYkdx.js";import"./analytics-vyykHm3I.js";import"./plaid-CP3hLhCR.js";import"./dnd-CDdU3ON0.js";import"./stripe-DMRn4zHo.js";import"./lexical-BzneVI9m.js";import"./pdf-C4rebPwh.js";import"./utils-ikosPjSL.js";import"./empty-9qzWTKUd.js";import"./pdf-lib-OiZx9iEf.js";import"./index-DTPu_Uy6.js";import"./url-asQ2Q_hT.js";import"./index-DvmHdckU.js";import"./decodeURIComponentSafe-B_IVipCF.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="34360189-ad08-40f6-93e1-76035a2c6a6d",t._sentryDebugIdIdentifier="sentry-dbid-34360189-ad08-40f6-93e1-76035a2c6a6d")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),s=m.getSignedInUser()?.userId??"";if(f(o,r,e,s)===!0){const d=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(a,{to:d})}return i.jsx(a,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,8 +1,8 @@
1
- import{j as a}from"./liveblocks-Cqbf2YvG.js";import{t as $e,A as Ce}from"./AddressScreen-tCLozkzY.js";import Me from"./NotFoundScreen-BM3DcBu4.js";import{a as g}from"./sentry-gLPXz4Yq.js";import{j as oe,u as se,h as ie,l as re,g as D,N as E,k as ce,i as ze,n as Ke,o as z}from"./core-DZE88rLA.js";import{v as de,j as le,z as B,a as ue,m as Qe,i as _,r as V,w as W,d as N,B as je,f as Y,ak as qe,Z as Ze,al as Ie,h as te,am as He,an as ke,o as We,ao as Xe,ap as Ee,aq as Ye}from"./index-BET54Nt-.js";import{bm as Je,eM as ee,fb as et,eT as pe,eR as me,bu as tt,m1 as at,f7 as nt,bL as ot,iM as ae,iP as ve,IK as st,bQ as it,b$ as ge,rt as fe,re as rt,IW as J,ru as _e,Gq as ct,jQ as Ue,IX as Ve,IY as dt,IZ as lt,I_ as ut,iK as pt,iN as mt,rg as Be,rs as gt,bB as Te,cr as ft,rG as xe,pn as ht,pb as yt,jI as St,fA as bt,fz as Ct,fy as It,I$ as kt,r8 as Et,rH as Tt,rK as xt,rN as Ot,rT as Pt,cR as At}from"./zeni-epic-state-Cc2P4FPR.js";import{n as he}from"./mui-B4xUUoCx.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-CMvaIZxf.js";import"./recharts-3_XOsuaw.js";import"./lottie-BMcMDJUW.js";import"./analytics-Cp5F-UjF.js";import"./plaid-G98kqTnM.js";import"./dnd-B4DEM2bW.js";import"./stripe-DMRn4zHo.js";import"./lexical-Bp_BNV6r.js";import"./pdf-DYKlsr3c.js";import"./utils-oW6HiHsc.js";import"./empty-DTOnM0RR.js";import"./pdf-lib-vymaIDnW.js";import"./index-j9ZiGcsv.js";import"./url-DMg8GQjt.js";import"./index-BWIeQAsg.js";import"./decodeURIComponentSafe--utjO_hD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="18425397-fc50-4e96-9ef5-a69f049877cd",t._sentryDebugIdIdentifier="sentry-dbid-18425397-fc50-4e96-9ef5-a69f049877cd")}catch{}})();const wt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(qe),jt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,S]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),f=Je(i),{useFeatureGate:m}=ue(),k=Qe(),{isFeatureEnabled:T}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:x}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:I}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:h}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),$=C||U&&f,c=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),w=c.company!=null&&et(c.company),R=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const j=pe(F,c),P=me(c),A=[],q=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,M=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,K=c?.userRole!=null&&tt(c?.userRole),v=b?.resources?.find(l=>l.resource==="/bills")==null&&!K,Q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(q===!1&&A.push("top_expenses"),M===!1&&A.push("task_card"),v===!1&&A.push("bill_pay_card","bill_pay_promo_card"),Q===!1&&A.push("reimbursement_card","reimbursement_promo_card"),I===!1&&A.push("zeni_accounts_promo_card"),h===!1&&A.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||j||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,A)))},[d,O,j,P,i,c.tenantId,s]),g.useEffect(()=>{(j||P)&&setTimeout(()=>{S(!0)},5e3)},[j,P]),O!=="Completed")return a.jsx(E,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(j)return a.jsx(E,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(W,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(Y.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:x,shouldFetchZeniAccountsPromoCard:I,shouldFetchRewardsPlanCard:h,isExpenseAutomationEnabledForUser:$,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(je,{fetchState:"In-Progress",style:{backgroundColor:k.colors.grey5}})},Oe=he.div`
1
+ import{j as a}from"./liveblocks-ZAKgWoPK.js";import{t as $e,A as Ce}from"./AddressScreen-CTET3dvy.js";import Me from"./NotFoundScreen-CAOLTLHp.js";import{a as g}from"./sentry-Bp45iw9z.js";import{j as oe,u as se,h as ie,l as re,g as D,N as E,k as ce,i as ze,n as Qe,o as z}from"./core-a8i-_0Kh.js";import{Q as de,j as le,z as B,a as ue,m as qe,i as _,q as V,v as W,d as N,B as we,f as Y,ak as Ke,Z as Ze,al as Ie,h as te,am as He,an as ke,o as We,ao as Xe,ap as Ee,aq as Ye}from"./index-CJiQhPf1.js";import{bm as Je,eM as ee,fb as et,eT as pe,eR as me,bu as tt,m1 as at,f7 as nt,bL as ot,iM as ae,iP as ve,IK as st,bQ as it,b$ as ge,rt as he,re as rt,IW as J,ru as _e,Gq as ct,jQ as Ue,IX as Ve,IY as dt,IZ as lt,I_ as ut,iK as pt,iN as mt,rg as Be,rs as gt,bB as Te,cr as ht,rG as xe,pn as ft,pb as yt,jI as bt,fA as St,fz as Ct,fy as It,I$ as kt,r8 as Et,rH as Tt,rK as xt,rN as Ot,rT as Pt,cR as At}from"./zeni-epic-state-ZCc1K30S.js";import{n as fe}from"./mui-B8yatdty.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-CcDeJYBx.js";import"./recharts-BhJEeZEG.js";import"./lottie-DN0gYkdx.js";import"./analytics-vyykHm3I.js";import"./plaid-CP3hLhCR.js";import"./dnd-CDdU3ON0.js";import"./stripe-DMRn4zHo.js";import"./lexical-BzneVI9m.js";import"./pdf-C4rebPwh.js";import"./utils-ikosPjSL.js";import"./empty-9qzWTKUd.js";import"./pdf-lib-OiZx9iEf.js";import"./index-DTPu_Uy6.js";import"./url-asQ2Q_hT.js";import"./index-DvmHdckU.js";import"./decodeURIComponentSafe-B_IVipCF.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="235e108f-1b5a-439c-9914-3cc8ea55eb4a",t._sentryDebugIdIdentifier="sentry-dbid-235e108f-1b5a-439c-9914-3cc8ea55eb4a")}catch{}})();const jt=ce(function(t,o){const s=[];o.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),o.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),o.shouldFetchZeniAccountsPromoCard===!1&&s.push("zeni_accounts_promo_card"),o.shouldFetchRewardsPlanCard===!1&&s.push("rewards_card"),o.isExpenseAutomationEnabledForUser===!1&&s.push("expense_automation_card");const u=nt(t,s,o.signedInUser,o.isExpenseAutomationFeatureEnabledV2,o.isExpenseAutomationEnabledForUser,o.isTreasuryEnabled);return{dashboardFetchState:ot(u.reportsInOrder.map(d=>({fetchState:d.fetchState,error:d.error}))).fetchState}},function(t,o){const{themeState:s,navigate:u,location:d}=o;return{onZeniLogoClick:()=>{s.toggle()},onDashboardFetchDone:()=>{const r=V(d.state?.pathnameStackToGoBack,d.pathname);u("../../dashboard",{state:{pathnameStackToGoBack:r,message:"activation"}})}}})(Ke),wt=()=>{const t=oe(),o=se(),s=ie(),u=de(),[d,r]=g.useState(!1),[p,b]=g.useState(!1),{tenantEmailDomain:e}=re(),n=le(),i=B.getSignedInUser(),h=Je(i),{useFeatureGate:m}=ue(),k=qe(),{isFeatureEnabled:T}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:x}=m(_.isArAgingFeatureEnabled),{isFeatureEnabled:I}=m(_.isDepositAccountsFeatureEnabled),{isFeatureEnabled:f}=m(_.isReferralFeatureEnabled),{isFeatureEnabled:U}=m(_.isExpenseAutomationEnabled),{isFeatureEnabled:C}=m(_.isExpenseAutomationEnabledV2),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),$=C||U&&h,c=D(l=>ee(l)),{isFeatureEnabled:L}=m(_.isTreasuryEnabled),j=c.company!=null&&et(c.company),R=L&&j,O=D(l=>l.onboardingCustomerViewState.fetchState),S=c.excludedResources,G=c.companyId??B.getSignedInUserTenant(e)?.companyId;if(i==null)throw Error("Can't access onboarding flow without signing in...");const w=pe(F,c),P=me(c),A=[],K=S?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,M=S?.resources?.find(l=>l.resource==="/reports/task_card")==null,Q=c?.userRole!=null&&tt(c?.userRole),v=S?.resources?.find(l=>l.resource==="/bills")==null&&!Q,q=S?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&A.push("top_expenses"),M===!1&&A.push("task_card"),v===!1&&A.push("bill_pay_card","bill_pay_promo_card"),q===!1&&A.push("reimbursement_card","reimbursement_promo_card"),I===!1&&A.push("zeni_accounts_promo_card"),f===!1&&A.push("rewards_card"),g.useEffect(()=>{O!=="Completed"||d||w||P||(r(!0),s(at(i.userId,G,c.tenantId,!0,!1,A)))},[d,O,w,P,i,c.tenantId,s]),g.useEffect(()=>{(w||P)&&setTimeout(()=>{b(!0)},5e3)},[w,P]),O!=="Completed")return a.jsx(E,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(w)return a.jsx(E,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(E,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(W,{analytics:N,onLoad:l=>(Z=>Z.trackPageLoaded(Y.Event.onboardingDashboardActivation))(l)}),a.jsx(jt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:T,isArAgingFeatureEnabled:x,shouldFetchZeniAccountsPromoCard:I,shouldFetchRewardsPlanCard:f,isExpenseAutomationEnabledForUser:$,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:R,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(we,{fetchState:"In-Progress",style:{backgroundColor:k.colors.grey5}})},Oe=fe.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${t=>t.theme.colors.grey4};
5
- `,Pe=he.div`
5
+ `,Pe=fe.div`
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
  align-items: center;
@@ -16,8 +16,8 @@ import{j as a}from"./liveblocks-Cqbf2YvG.js";import{t as $e,A as Ce}from"./Addre
16
16
  }
17
17
 
18
18
  ${t=>t.windowSize!=="small"?"overflow: auto;":""}
19
- `,Ae=ce(function(t,o){const{companyId:s,isAdmin:u,currentTenant:d,isOnAddressPage:r}=o,p=B.getSignedInUser(),S=d.tenantId,e={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:S??""},n=ee(t),i=fe(t,s),f=Ve(t),m=ge(d?.userRole??[])&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",k=dt(t.userRoleConfigState);return{onboardingCustomerView:i,analytics:N,isRefreshingViewInBackground:!1,isDisabled:m,companyTitles:k.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Xe.fileMicroServiceBaseUrl,authParams:e},signedInUser:B.getSignedInUser(),currentTenant:d,isAdmin:u,isOnAddressPage:r,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:f,isCardPaymentPopupOpen:!1,stripeKey:te.stripeKey}},function(t,o){const{companyId:s,currentTenant:u,themeState:d,navigate:r,location:p}=o,{tenantEmailDomain:S}=u;return{onFetchLinkTokenClick:(e,n)=>{t(Pt(e,n))},onEstablishConnectionClick:(e,n)=>{t(Ot(e,n))},onUpdatePaymentAccountStatus:(e,n,i)=>{t(xt(e,n,i))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(Tt(!1,e,n))},onEstablishConnectionSuccess:()=>{t(Et(s,!0,!1))},handleOnConnectClick:()=>{N.trackOnboardingConnectQBO(),ne.handleClick()},updateQBOPopupState:e=>{t(J({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(i=>{const{officerType:f,userId:m,name:k,email:T,ssn:x,nationalityCountryCode:I,dob:h,phone:U,syncToken:C,selectDocument:F,role:$,ownership:c,isSelectedForVerification:L,userVerificationStatus:w,fileIds:R,isPhoneVerified:O}=i;let b;return F.selectDocumentType==="driverLicense"?b="driving_license":F.selectDocumentType==="passport"?b="passport":F.selectDocumentType==="stateId"?b="id_document":F.selectDocumentType==="ssnCard"&&(b="social_security_card"),{officerType:f,userId:m,firstName:k.firstName,lastName:k.lastName,email:T,ssn:x,nationalityCountryCode:I?.selectedOption!=null?Ee(I.selectedOption):void 0,phone:U,birthday:h!=null?Te(h?.toString()):h,syncToken:C,titleAtCompany:$.selectedOption,ownershipInCompany:c,documentTypeSelectedForVerification:b,isSelectedForVerification:L,userVerificationStatus:w,fileIds:R,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:O}});t(xe({officers:n}))},onGetOtp:(e,n)=>{t(It(e,"CustomerOnboarding")),n!=null&&t(kt({officerType:n,phone:e}))},onResendOtp:e=>{t(Ct(e,"CustomerOnboarding"))},onVerifyOtp:(e,n)=>{t(bt(e,n,"CustomerOnboarding"))},updateFilesEntity:e=>{t(St({files:e}))},onDeleteFile:e=>{t(yt(e))},onEditFileName:(e,n)=>{t(ht(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:i,companyIndustryType:f,companyLegalName:m,companyTaxId:k,companyWebsite:T,companyPhone:x,primaryContactEmail:I,primaryContactName:h,primaryContactUserId:U,primaryContactSyncToken:C,syncToken:F,fileIds:$,typeOfIncorporation:c,stateOfIncorporation:L,incDate:w,companySourceOfFunds:R,companySourceOfFundsDescription:O,companySubIndustry:b,countriesOfOperations:G,purposeOfAccount:j,purposeOfAccountDescription:P,regulatedStatus:A,regulatedStatusDescription:q,transactionVolume:M,transactionVolumeDescription:K,usNexus:v,usNexusTypes:Q}=e,l={companyId:s,companyDescription:n,companyIndustry:i.selectedOption,companyIndustryType:f?.selectedOption??"",companyLegalName:m,taxIdOrEIN:k,website:T!=""&&T!=null?ft(T):void 0,phone:x,syncToken:F,fileIds:$,incDate:w!=null?Te(w?.toString()):w,typeOfIncorporation:c?.selectedOption??"",stateOfIncorporation:L?.selectedOption??"",companySourceOfFunds:R?.selectedOption??"",companySourceOfFundsDescription:O,companySubIndustry:b?.selectedOption??"",countriesOfOperations:G?.selectedOptions.map(H=>H.length===2?H:Ee(H))??[],purposeOfAccount:j?.selectedOption??"",purposeOfAccountDescription:P,regulatedStatus:A??"",regulatedStatusDescription:q,transactionVolume:M?.selectedOption??"",transactionVolumeDescription:K,usNexus:v,usNexusTypes:Q?.selectedOptions??[]},Z={userId:U,firstName:h.firstName,lastName:h.lastName,email:I,syncToken:C};t(xe({companyDetails:l,primaryContactDetails:Z}))},onAddressClick:(e,n)=>{const i=De(S,e,n),f=V(p.state?.pathnameStackToGoBack,p.pathname);r(i,{state:{pathnameStackToGoBack:f}})},onRegisteredAddressClick:(e,n)=>{const i=De(S,e,n),f=V(p.state?.pathnameStackToGoBack,p.pathname);r(i,{state:{pathnameStackToGoBack:f}})},onUpdateCustomerView:(e,n,i)=>{t(gt(s,!1,n,i,e))},onAddressEditHandler:e=>{if(e!=null){const n=$e(e);t(Ue({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);t(Be(s,!1,!1)),r("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(_e({step:e}))},onZeniLogoClick:()=>{d.toggle()},handleLogOutClick:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);r("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleCreateCardSetupIntent:e=>{t(ve(e))},handleConfirmCardSetupIntent:e=>{t(mt(e))},updateCardPaymentModalState:e=>{t(J({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,n,i)=>{t(pt(e,n,i))},handleFetchPaymentSources:()=>{t(ae())},resetCardPaymentViewState:()=>{t(ut())},handleResetCardPaymentErrorStatuses:()=>{t(lt())},redirectToProductSuitePage:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);r(`/${S}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})}}})(He),X=({taxCFOCustomer:t=!1,isOnAddressPage:o=!1,appContent:s})=>{const u=oe(),d=se(),r=ie(),p=Ze(),S=de(),[e,n]=g.useState(!1),[i,f]=g.useState(!1),[m,k]=g.useState(!1),{tenantEmailDomain:T}=re(),x=le(),{useFeatureGate:I}=ue(),{isFeatureEnabled:h}=I(_.isDebitCardFeatureEnabled),U=ze("/:tenantEmailDomain/onboarding")!==null&&d.search?.includes("code"),C=D(y=>y.onboardingCustomerViewState.fetchState),F=D(y=>y.onboardingCustomerViewState.currentStep),$=D(y=>y.onboardingCustomerViewState.uiState),c=D(y=>ee(y)),L=D(y=>y.userRoleConfigState.fetchState),w=D(y=>y.cardPaymentViewState),R=Ie(w.addCardPaymentSourceStatus.fetchState),O=w.addCardPaymentSourceStatus.fetchState,{code:b,realmId:G,state:j}=Dt(d.search),P=c.externalConnections?.accounting[0],A=P?.connectionType,q=P?.connectionName,M=P?.connectionId??"",K=B.getSignedInUser()?.userId??"";g.useEffect(()=>{i||(f(!0),r(ae()))},[i,r]),g.useEffect(()=>{m||(ve(["card"]),k(!0))},[m]),g.useEffect(()=>{R==="In-Progress"&&O==="Completed"&&r(ae())},[R,O]),g.useEffect(()=>{Ft(b,G,j,M,K)===!0&&c.externalConnections?.saveConnectionState!=="In-Progress"&&C==="Completed"&&(r(st(c.tenantId,{connection_type:A??"accounting",connection_name:q??"quickbooks_online",authorization_code:b,realm_id:G,connection_id:M,user_id:K},it(window.location.origin+"/onboarding/auth"))),N.trackOnboardingSaveQBOConnection(G,M),u(d.pathname))},[b,G,j,d.pathname,C]),g.useEffect(()=>{ne.isInitiated===!1&&C==="Completed"&&ne.init("/onboarding/auth",c.tenantEmailDomain)},[C]);const v=c.companyId??B.getSignedInUserTenant(T)?.companyId,Q=ge(c?.userRole??[]),l=D(y=>fe(y,v));g.useEffect(()=>{e||C!=="Not-Started"||v==null||(n(!0),r(rt(v,!0,!U)))},[e,C,v]),g.useEffect(()=>{c.externalConnections?.saveConnectionState!=="Completed"&&c.externalConnections?.saveConnectionState!=="Error"||!$.isQBOPopupOpen||F!=="qbo_connection"||r(J({isQBOPopupOpen:!1}))},[c.externalConnections?.saveConnectionState]),g.useEffect(()=>{C==="Completed"&&U&&(r(_e({step:"qbo_connection"})),r(J({isQBOPopupOpen:!0})))},[U,C]),g.useEffect(()=>{L==="Not-Started"&&r(ct(!0))},[L,r]);const Z=Ie(l.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&l.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Z==null&&r(Ue({addressType:"company_registered_address",addressToCreate:l.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[l.companyDetailsLocalData?.addressStatus?.addressToCreate,l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const H=l.isInterimEmailSent;if(B.getSignedInUser()==null)throw Error("Can't access onboarding flow without signing in...");const Le=pe(h,c),Re=me(c),ye=c.company?.companyOnboardingInfo.isOnboardingCompleted,Se=y=>y.trackPageLoaded(Y.Event.onboardingPage),be=c.productSettings.isOtherProductsEnabled,Ge=c.productSettings.isTreasuryEnabled;if(ye===!0){if(!be)return Ge?a.jsx(E,{to:"../../treasury"}):Le?a.jsx(E,{to:"../../checking"}):Re?a.jsx(E,{to:"../../cards"}):a.jsx(E,{to:"../../dashboard"});const y=l.updateStatus.fetchState==="In-Progress";if(be&&!y)return t?a.jsxs(Oe,{children:[a.jsx(W,{analytics:N,onLoad:Ne=>Se(Ne)}),a.jsx(Ae,{navigate:u,location:d,companyId:v,currentTenant:c,isAdmin:Q,isOnAddressPage:o,themeState:S,googleAPIKey:te.googleMapsAPIKey}),s!=null?a.jsx(Pe,{windowSize:p,children:s}):null]}):a.jsx(E,{to:"../../onboarding/thankyou"})}else if(ye===!1&&x?.loggedInUserRoleMap!=null)return H===!0?a.jsx(E,{to:"../../onboarding/thankyou"}):a.jsxs(Oe,{children:[a.jsx(W,{analytics:N,onLoad:y=>Se(y)}),a.jsx(Ae,{navigate:u,location:d,companyId:v,currentTenant:c,isAdmin:Q,isOnAddressPage:o,themeState:S,googleAPIKey:te.googleMapsAPIKey}),s!=null?a.jsx(Pe,{windowSize:p,children:s}):null]});return null};function De(t,o,s){let u=`/${t}/onboarding/address`;return u=s!=null?u.concat(`/edit/${o}/${encodeURIComponent(s)}`):u.concat(`/new/${o}`),u}const Fe=he.div`
19
+ `,Ae=ce(function(t,o){const{companyId:s,isAdmin:u,currentTenant:d,isOnAddressPage:r}=o,p=B.getSignedInUser(),b=d.tenantId,e={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:b??""},n=ee(t),i=he(t,s),h=Ve(t),m=ge(d?.userRole??[])&&i.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",k=dt(t.userRoleConfigState);return{onboardingCustomerView:i,analytics:N,isRefreshingViewInBackground:!1,isDisabled:m,companyTitles:k.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Xe.fileMicroServiceBaseUrl,authParams:e},signedInUser:B.getSignedInUser(),currentTenant:d,isAdmin:u,isOnAddressPage:r,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:h,isCardPaymentPopupOpen:!1,stripeKey:te.stripeKey}},function(t,o){const{companyId:s,currentTenant:u,themeState:d,navigate:r,location:p}=o,{tenantEmailDomain:b}=u;return{onFetchLinkTokenClick:(e,n)=>{t(Pt(e,n))},onEstablishConnectionClick:(e,n)=>{t(Ot(e,n))},onUpdatePaymentAccountStatus:(e,n,i)=>{t(xt(e,n,i))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(Tt(!1,e,n))},onEstablishConnectionSuccess:()=>{t(Et(s,!0,!1))},handleOnConnectClick:()=>{N.trackOnboardingConnectQBO(),ne.handleClick()},updateQBOPopupState:e=>{t(J({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(i=>{const{officerType:h,userId:m,name:k,email:T,ssn:x,nationalityCountryCode:I,dob:f,phone:U,syncToken:C,selectDocument:F,role:$,ownership:c,isSelectedForVerification:L,userVerificationStatus:j,fileIds:R,isPhoneVerified:O}=i;let S;return F.selectDocumentType==="driverLicense"?S="driving_license":F.selectDocumentType==="passport"?S="passport":F.selectDocumentType==="stateId"?S="id_document":F.selectDocumentType==="ssnCard"&&(S="social_security_card"),{officerType:h,userId:m,firstName:k.firstName,lastName:k.lastName,email:T,ssn:x,nationalityCountryCode:I?.selectedOption!=null?Ee(I.selectedOption):void 0,phone:U,birthday:f!=null?Te(f?.toString()):f,syncToken:C,titleAtCompany:$.selectedOption,ownershipInCompany:c,documentTypeSelectedForVerification:S,isSelectedForVerification:L,userVerificationStatus:j,fileIds:R,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:O}});t(xe({officers:n}))},onGetOtp:(e,n)=>{t(It(e,"CustomerOnboarding")),n!=null&&t(kt({officerType:n,phone:e}))},onResendOtp:e=>{t(Ct(e,"CustomerOnboarding"))},onVerifyOtp:(e,n)=>{t(St(e,n,"CustomerOnboarding"))},updateFilesEntity:e=>{t(bt({files:e}))},onDeleteFile:e=>{t(yt(e))},onEditFileName:(e,n)=>{t(ft(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:i,companyIndustryType:h,companyLegalName:m,companyTaxId:k,companyWebsite:T,companyPhone:x,primaryContactEmail:I,primaryContactName:f,primaryContactUserId:U,primaryContactSyncToken:C,syncToken:F,fileIds:$,typeOfIncorporation:c,stateOfIncorporation:L,incDate:j,companySourceOfFunds:R,companySourceOfFundsDescription:O,companySubIndustry:S,countriesOfOperations:G,purposeOfAccount:w,purposeOfAccountDescription:P,regulatedStatus:A,regulatedStatusDescription:K,transactionVolume:M,transactionVolumeDescription:Q,usNexus:v,usNexusTypes:q}=e,l={companyId:s,companyDescription:n,companyIndustry:i.selectedOption,companyIndustryType:h?.selectedOption??"",companyLegalName:m,taxIdOrEIN:k,website:T!=""&&T!=null?ht(T):void 0,phone:x,syncToken:F,fileIds:$,incDate:j!=null?Te(j?.toString()):j,typeOfIncorporation:c?.selectedOption??"",stateOfIncorporation:L?.selectedOption??"",companySourceOfFunds:R?.selectedOption??"",companySourceOfFundsDescription:O,companySubIndustry:S?.selectedOption??"",countriesOfOperations:G?.selectedOptions.map(H=>H.length===2?H:Ee(H))??[],purposeOfAccount:w?.selectedOption??"",purposeOfAccountDescription:P,regulatedStatus:A??"",regulatedStatusDescription:K,transactionVolume:M?.selectedOption??"",transactionVolumeDescription:Q,usNexus:v,usNexusTypes:q?.selectedOptions??[]},Z={userId:U,firstName:f.firstName,lastName:f.lastName,email:I,syncToken:C};t(xe({companyDetails:l,primaryContactDetails:Z}))},onAddressClick:(e,n)=>{const i=De(b,e,n),h=V(p.state?.pathnameStackToGoBack,p.pathname);r(i,{state:{pathnameStackToGoBack:h}})},onRegisteredAddressClick:(e,n)=>{const i=De(b,e,n),h=V(p.state?.pathnameStackToGoBack,p.pathname);r(i,{state:{pathnameStackToGoBack:h}})},onUpdateCustomerView:(e,n,i)=>{t(gt(s,!1,n,i,e))},onAddressEditHandler:e=>{if(e!=null){const n=$e(e);t(Ue({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);t(Be(s,!1,!1)),r("./activation",{state:{pathnameStackToGoBack:e}})},onUpdateStep:e=>{t(_e({step:e}))},onZeniLogoClick:()=>{d.toggle()},handleLogOutClick:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);r("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleCreateCardSetupIntent:e=>{t(ve(e))},handleConfirmCardSetupIntent:e=>{t(mt(e))},updateCardPaymentModalState:e=>{t(J({isCardPaymentPopupOpen:e}))},handleAddCardPaymentSource:(e,n,i)=>{t(pt(e,n,i))},handleFetchPaymentSources:()=>{t(ae())},resetCardPaymentViewState:()=>{t(ut())},handleResetCardPaymentErrorStatuses:()=>{t(lt())},redirectToProductSuitePage:()=>{const e=V(p.state?.pathnameStackToGoBack,p.pathname);r(`/${b}/onboarding/thankyou`,{state:{pathnameStackToGoBack:e,message:"OnboardingThankyou"},replace:!0})}}})(He),X=({taxCFOCustomer:t=!1,isOnAddressPage:o=!1,appContent:s})=>{const u=oe(),d=se(),r=ie(),p=Ze(),b=de(),[e,n]=g.useState(!1),[i,h]=g.useState(!1),[m,k]=g.useState(!1),{tenantEmailDomain:T}=re(),x=le(),{useFeatureGate:I}=ue(),{isFeatureEnabled:f}=I(_.isDebitCardFeatureEnabled),U=ze("/:tenantEmailDomain/onboarding")!==null&&d.search?.includes("code"),C=D(y=>y.onboardingCustomerViewState.fetchState),F=D(y=>y.onboardingCustomerViewState.currentStep),$=D(y=>y.onboardingCustomerViewState.uiState),c=D(y=>ee(y)),L=D(y=>y.userRoleConfigState.fetchState),j=D(y=>y.cardPaymentViewState),R=Ie(j.addCardPaymentSourceStatus.fetchState),O=j.addCardPaymentSourceStatus.fetchState,{code:S,realmId:G,state:w}=Dt(d.search),P=c.externalConnections?.accounting[0],A=P?.connectionType,K=P?.connectionName,M=P?.connectionId??"",Q=B.getSignedInUser()?.userId??"";g.useEffect(()=>{i||(h(!0),r(ae()))},[i,r]),g.useEffect(()=>{m||(ve(["card"]),k(!0))},[m]),g.useEffect(()=>{R==="In-Progress"&&O==="Completed"&&r(ae())},[R,O]),g.useEffect(()=>{Ft(S,G,w,M,Q)===!0&&c.externalConnections?.saveConnectionState!=="In-Progress"&&C==="Completed"&&(r(st(c.tenantId,{connection_type:A??"accounting",connection_name:K??"quickbooks_online",authorization_code:S,realm_id:G,connection_id:M,user_id:Q},it(window.location.origin+"/onboarding/auth"))),N.trackOnboardingSaveQBOConnection(G,M),u(d.pathname))},[S,G,w,d.pathname,C]),g.useEffect(()=>{ne.isInitiated===!1&&C==="Completed"&&ne.init("/onboarding/auth",c.tenantEmailDomain)},[C]);const v=c.companyId??B.getSignedInUserTenant(T)?.companyId,q=ge(c?.userRole??[]),l=D(y=>he(y,v));g.useEffect(()=>{e||C!=="Not-Started"||v==null||(n(!0),r(rt(v,!0,!U)))},[e,C,v]),g.useEffect(()=>{c.externalConnections?.saveConnectionState!=="Completed"&&c.externalConnections?.saveConnectionState!=="Error"||!$.isQBOPopupOpen||F!=="qbo_connection"||r(J({isQBOPopupOpen:!1}))},[c.externalConnections?.saveConnectionState]),g.useEffect(()=>{C==="Completed"&&U&&(r(_e({step:"qbo_connection"})),r(J({isQBOPopupOpen:!0})))},[U,C]),g.useEffect(()=>{L==="Not-Started"&&r(ct(!0))},[L,r]);const Z=Ie(l.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&l.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Z==null&&r(Ue({addressType:"company_registered_address",addressToCreate:l.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[l.companyDetailsLocalData?.addressStatus?.addressToCreate,l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const H=l.isInterimEmailSent;if(B.getSignedInUser()==null)throw Error("Can't access onboarding flow without signing in...");const Le=pe(f,c),Re=me(c),ye=c.company?.companyOnboardingInfo.isOnboardingCompleted,be=y=>y.trackPageLoaded(Y.Event.onboardingPage),Se=c.productSettings.isOtherProductsEnabled,Ge=c.productSettings.isTreasuryEnabled;if(ye===!0){if(!Se)return Ge?a.jsx(E,{to:"../../treasury"}):Le?a.jsx(E,{to:"../../checking"}):Re?a.jsx(E,{to:"../../cards"}):a.jsx(E,{to:"../../dashboard"});const y=l.updateStatus.fetchState==="In-Progress";if(Se&&!y)return t?a.jsxs(Oe,{children:[a.jsx(W,{analytics:N,onLoad:Ne=>be(Ne)}),a.jsx(Ae,{navigate:u,location:d,companyId:v,currentTenant:c,isAdmin:q,isOnAddressPage:o,themeState:b,googleAPIKey:te.googleMapsAPIKey}),s!=null?a.jsx(Pe,{windowSize:p,children:s}):null]}):a.jsx(E,{to:"../../onboarding/thankyou"})}else if(ye===!1&&x?.loggedInUserRoleMap!=null)return H===!0?a.jsx(E,{to:"../../onboarding/thankyou"}):a.jsxs(Oe,{children:[a.jsx(W,{analytics:N,onLoad:y=>be(y)}),a.jsx(Ae,{navigate:u,location:d,companyId:v,currentTenant:c,isAdmin:q,isOnAddressPage:o,themeState:b,googleAPIKey:te.googleMapsAPIKey}),s!=null?a.jsx(Pe,{windowSize:p,children:s}):null]});return null};function De(t,o,s){let u=`/${t}/onboarding/address`;return u=s!=null?u.concat(`/edit/${o}/${encodeURIComponent(s)}`):u.concat(`/new/${o}`),u}const Fe=fe.div`
20
20
  display: flex;
21
21
  height: 100vh;
22
22
  background-color: ${t=>t.theme.colors.grey4};
23
- `,we=ce(function(t,o){const{companyId:s,currentTenant:u}=o,d=fe(t,s),r=Ve(t);return{hasVerifiedBankAccount:(d.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(r.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:ge(u?.userRole??[])&&d.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:B.getSignedInUser(),currentTenant:u,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}},function(t,o){const{currentTenant:s,themeState:u,navigate:d,location:r}=o,{tenantEmailDomain:p}=s;return{onZeniLogoClick:()=>{u.toggle()},handleLogOutClick:()=>{const S=V(r.state?.pathnameStackToGoBack,r.pathname);d("/signout",{replace:!0,state:{pathnameStackToGoBack:S,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleUpdatePaymentAddressDetailClick:()=>{const S=V(r.state?.pathnameStackToGoBack,r.pathname);d(`/${p}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:S,message:"UpdatePaymentAddressDetail"}})}}})(Ye),vt=()=>{const t=oe(),o=ie(),s=se(),u=de(),{useFeatureGate:d}=ue(),{isFeatureEnabled:r}=d(_.isDebitCardFeatureEnabled),{tenantEmailDomain:p}=re(),S=le(),[e,n]=g.useState(!1);g.useEffect(()=>{e===!1&&s.state?.message==="OnboardingThankyou"&&n(!0)},[s.state]);const i=D(h=>ee(h)),f=i.productSettings.isOtherProductsEnabled;g.useEffect(()=>{o(Be(m,!1,!f))},[]);const m=i.companyId??B.getSignedInUserTenant(p)?.companyId;if(S.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const k=pe(r,i),T=me(i),x=D(h=>h.onboardingCustomerViewState.updateStatus.fetchState),I=i.company?.companyOnboardingInfo.isOnboardingCompleted;return I!==!0||f?x==="Completed"&&I===!0&&f&&S?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(W,{analytics:N,onLoad:h=>{h.trackPageLoaded(Y.Event.onboardingLandingPage,"Onboarding",At(i.productSettings))}}),a.jsx(we,{navigate:t,showUpdatePaymentDetailButton:f,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):x==="Completed"&&I===!1&&S?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(W,{analytics:N,onLoad:h=>{h.trackPageLoaded(Y.Event.onboardingInterimPage)}}),a.jsx(we,{navigate:t,showUpdatePaymentDetailButton:f,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):a.jsx(je,{fetchState:x}):k?a.jsx(E,{to:"../../checking"}):T?a.jsx(E,{to:"../../cards"}):a.jsx(E,{to:"../../dashboard"})};function oa(){return a.jsxs(Ke,{children:[a.jsx(z,{path:"/",element:a.jsx(X,{})}),a.jsx(z,{path:"/billing/edit",element:a.jsx(X,{taxCFOCustomer:!0})}),a.jsx(z,{path:"/thankyou",element:a.jsx(vt,{})}),a.jsx(z,{path:"/activation",element:a.jsx(jt,{})}),a.jsx(z,{path:"/address/edit/:addressType/:addressId",element:a.jsx(X,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(z,{path:"/address/new/:addressType",element:a.jsx(X,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(z,{path:"*",element:a.jsx(Me,{})})]})}export{oa as default};
23
+ `,je=ce(function(t,o){const{companyId:s,currentTenant:u}=o,d=he(t,s),r=Ve(t);return{hasVerifiedBankAccount:(d.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(r.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:ge(u?.userRole??[])&&d.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:B.getSignedInUser(),currentTenant:u,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}},function(t,o){const{currentTenant:s,themeState:u,navigate:d,location:r}=o,{tenantEmailDomain:p}=s;return{onZeniLogoClick:()=>{u.toggle()},handleLogOutClick:()=>{const b=V(r.state?.pathnameStackToGoBack,r.pathname);d("/signout",{replace:!0,state:{pathnameStackToGoBack:b,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleUpdatePaymentAddressDetailClick:()=>{const b=V(r.state?.pathnameStackToGoBack,r.pathname);d(`/${p}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:b,message:"UpdatePaymentAddressDetail"}})}}})(Ye),vt=()=>{const t=oe(),o=ie(),s=se(),u=de(),{useFeatureGate:d}=ue(),{isFeatureEnabled:r}=d(_.isDebitCardFeatureEnabled),{tenantEmailDomain:p}=re(),b=le(),[e,n]=g.useState(!1);g.useEffect(()=>{e===!1&&s.state?.message==="OnboardingThankyou"&&n(!0)},[s.state]);const i=D(f=>ee(f)),h=i.productSettings.isOtherProductsEnabled;g.useEffect(()=>{o(Be(m,!1,!h))},[]);const m=i.companyId??B.getSignedInUserTenant(p)?.companyId;if(b.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const k=pe(r,i),T=me(i),x=D(f=>f.onboardingCustomerViewState.updateStatus.fetchState),I=i.company?.companyOnboardingInfo.isOnboardingCompleted;return I!==!0||h?x==="Completed"&&I===!0&&h&&b?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(W,{analytics:N,onLoad:f=>{f.trackPageLoaded(Y.Event.onboardingLandingPage,"Onboarding",At(i.productSettings))}}),a.jsx(je,{navigate:t,showUpdatePaymentDetailButton:h,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):x==="Completed"&&I===!1&&b?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(W,{analytics:N,onLoad:f=>{f.trackPageLoaded(Y.Event.onboardingInterimPage)}}),a.jsx(je,{navigate:t,showUpdatePaymentDetailButton:h,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):a.jsx(we,{fetchState:x}):k?a.jsx(E,{to:"../../checking"}):T?a.jsx(E,{to:"../../cards"}):a.jsx(E,{to:"../../dashboard"})};function oa(){return a.jsxs(Qe,{children:[a.jsx(z,{path:"/",element:a.jsx(X,{})}),a.jsx(z,{path:"/billing/edit",element:a.jsx(X,{taxCFOCustomer:!0})}),a.jsx(z,{path:"/thankyou",element:a.jsx(vt,{})}),a.jsx(z,{path:"/activation",element:a.jsx(wt,{})}),a.jsx(z,{path:"/address/edit/:addressType/:addressId",element:a.jsx(X,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(z,{path:"/address/new/:addressType",element:a.jsx(X,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(z,{path:"*",element:a.jsx(Me,{})})]})}export{oa as default};