@zeniai/web-app-ui 5.0.23-qa → 5.0.24-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 (119) hide show
  1. package/dist/assets/AddressRoutes-CWm4LI2A.js +1 -0
  2. package/dist/assets/AddressScreen-BRfd-CkJ.js +9 -0
  3. package/dist/assets/{AiCfoScreen-VeT_S5hK.js → AiCfoScreen-CSI2_D3j.js} +1 -1
  4. package/dist/assets/BillPayApprovalRoutes-CVMR--P9.js +1 -0
  5. package/dist/assets/{BillPayRoutes-Vb4S1Y8K.js → BillPayRoutes-CiAJiA46.js} +5 -5
  6. package/dist/assets/{BusinessVerificationPageScreen-B2ABlcef.js → BusinessVerificationPageScreen-surI_CG-.js} +2 -2
  7. package/dist/assets/{ChargeCardRoutes-0wgJAAT_.js → ChargeCardRoutes-DfK6AK1Y.js} +8 -8
  8. package/dist/assets/CompanyPassportScreen-D3MdOGSR.js +1 -0
  9. package/dist/assets/{ConnectionAuthScreen-DTlZGYMJ.js → ConnectionAuthScreen-m1ZrPmfY.js} +1 -1
  10. package/dist/assets/CustomerOnboardingAuthScreen-C_ov5V1M.js +1 -0
  11. package/dist/assets/{CustomerOnboardingRoutes-CR3VCOF1.js → CustomerOnboardingRoutes-igtoru6q.js} +3 -3
  12. package/dist/assets/{DashboardRoutes-D3n4VoSd.js → DashboardRoutes-btp07KOK.js} +3 -3
  13. package/dist/assets/{DefaultTenantHome-D7hhMq-x.js → DefaultTenantHome-wOBWCdoB.js} +1 -1
  14. package/dist/assets/{DomesticWireDetailScreen-D2qfhgns.js → DomesticWireDetailScreen-Cq9OTpl5.js} +3 -3
  15. package/dist/assets/DrawerScreen-BddqtTBk.js +1 -0
  16. package/dist/assets/EntityDetailRoutes-J5KxaFpN.js +1 -0
  17. package/dist/assets/{ExpenseAutomationRoutes-v2u24arD.js → ExpenseAutomationRoutes-XSCKWGJC.js} +3 -3
  18. package/dist/assets/FeaturePreviewScreen-C7s5EUEI.js +1 -0
  19. package/dist/assets/{MagicLinkRoutes-CXWkfGXB.js → MagicLinkRoutes-Bnt1hH7o.js} +6 -6
  20. package/dist/assets/MagicLinkSignInScreen-CiUBjUKX.js +12 -0
  21. package/dist/assets/{MobileAppDrawer-Jd5aa9gg.js → MobileAppDrawer-BTO_dO8H.js} +1 -1
  22. package/dist/assets/NotFoundScreen-CQPWWkLY.js +1 -0
  23. package/dist/assets/{NotificationRoutes-BZkZ0nNy.js → NotificationRoutes-DfFcHUc_.js} +1 -1
  24. package/dist/assets/{PandLWithForecastRoutes-DuWjgRje.js → PandLWithForecastRoutes-CY2JRBex.js} +1 -1
  25. package/dist/assets/PeopleRoutes-Ah1x0pI6.js +22 -0
  26. package/dist/assets/PerformanceRoutes-D-In2h69.js +1 -0
  27. package/dist/assets/{Preview-C3YwU0I2.js → Preview-1xmWdeBW.js} +1 -1
  28. package/dist/assets/{QBOConnectionScreen-CBYjGz6H.js → QBOConnectionScreen-D6CMF20W.js} +1 -1
  29. package/dist/assets/ReferralListScreen-D4dSsS9f.js +5 -0
  30. package/dist/assets/{ReimbursementApprovalRoutes-BxtQgQ3i.js → ReimbursementApprovalRoutes-CQWk5hg2.js} +1 -1
  31. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DPNcDo-z.js → ReimbursementApprovalRuleDetailScreen-CLK4qljf.js} +1 -1
  32. package/dist/assets/{ReimbursementRoutes-C4Oi6zv2.js → ReimbursementRoutes-Dle1xRUS.js} +1 -1
  33. package/dist/assets/{ReportsRoutes-BebY5YS1.js → ReportsRoutes-BVE7O3pM.js} +1 -1
  34. package/dist/assets/RewardsRoutes-BUOQCgBW.js +1 -0
  35. package/dist/assets/{ScreenRoutes-DAveqqpw.js → ScreenRoutes-CU85YNC5.js} +2 -2
  36. package/dist/assets/{SettingsRoutes-C_1R1lRs.js → SettingsRoutes-C1UlKVfn.js} +4 -4
  37. package/dist/assets/{SetupPagesScreen-BatnW9Lm.js → SetupPagesScreen-D5f_S2gA.js} +1 -1
  38. package/dist/assets/SignInScreen-nIZ9894Z.js +1 -0
  39. package/dist/assets/SignOutScreen-BBR56tjP.js +9 -0
  40. package/dist/assets/{TaskListScreen-CR9B7ON8.js → TaskListScreen-vtDblzrs.js} +2 -2
  41. package/dist/assets/TaskRoutes-6NyFYqIE.js +9 -0
  42. package/dist/assets/TransactionDetailRoutes-D3tlJJHj.js +1 -0
  43. package/dist/assets/{TransactionDetailScreen-DZUEdFp2.js → TransactionDetailScreen-DORvf_A0.js} +2 -2
  44. package/dist/assets/{TransactionListRoutes-DA-II3iy.js → TransactionListRoutes-Dm17WsQR.js} +1 -1
  45. package/dist/assets/TreasuryRoutes-B_ttsGpb.js +37 -0
  46. package/dist/assets/{VendorsRoutes-SiTspMG6.js → VendorsRoutes-xehzdyOP.js} +13 -13
  47. package/dist/assets/WiseConfirmationScreen-BURwrNzz.js +12 -0
  48. package/dist/assets/{ZeniAccountRoutes-4nO_DRj9.js → ZeniAccountRoutes-D4VHQXPj.js} +10 -10
  49. package/dist/assets/ZeniAccountStatementScreen-DCQ_lEqk.js +9 -0
  50. package/dist/assets/{accountMappingHelper-CJzGKxCi.js → accountMappingHelper-Dr0t2P70.js} +1 -1
  51. package/dist/assets/{analytics-B8BYlogo.js → analytics-Cm9Z6TfJ.js} +1 -1
  52. package/dist/assets/{analyticsHelper-D2Lkt_0_.js → analyticsHelper-ByMo5A8t.js} +1 -1
  53. package/dist/assets/{core-C_FlMzhB.js → core-CNZua1e0.js} +1 -1
  54. package/dist/assets/{decodeURIComponentSafe-Bq-dYOxp.js → decodeURIComponentSafe-Dac6kcoy.js} +1 -1
  55. package/dist/assets/{dnd-CTZ8xt4P.js → dnd-Dmzop572.js} +1 -1
  56. package/dist/assets/{empty-8tyTORBQ.js → empty-BLoZtodd.js} +1 -1
  57. package/dist/assets/{empty-Ba3wQ_0C.js → empty-LpcvzIsm.js} +1 -1
  58. package/dist/assets/{emptyVideoElement-CMq3v722.js → emptyVideoElement-BStHdDf2.js} +1 -1
  59. package/dist/assets/{epic-DcM6ZH0h.js → epic-D5Ru76Np.js} +1 -1
  60. package/dist/assets/getLocaleForTenant-BYC6p0GO.js +1 -0
  61. package/dist/assets/{index-C2TFXiJV.js → index-CUFof7Jj.js} +1 -1
  62. package/dist/assets/{index-BabuXr6y.js → index-Co04ey3-.js} +10566 -10403
  63. package/dist/assets/{index-DlR0ZNoW.js → index-DFcSZnAP.js} +1 -1
  64. package/dist/assets/{index-DKffoxhZ.js → index-DdDiPMGa.js} +1 -1
  65. package/dist/assets/{index-8DvIGOR_.js → index-QWM1qpc0.js} +1 -1
  66. package/dist/assets/{index-BU1P3OoO.js → index-jE-fly2Z.js} +1 -1
  67. package/dist/assets/{index-6WoOptp-.js → index-rFuUBpwP.js} +2 -2
  68. package/dist/assets/{lexical-BmFHbDfb.js → lexical-Dt1gfKRx.js} +1 -1
  69. package/dist/assets/{liveblocks-DXiLz49w.js → liveblocks-CGYcZ7Lh.js} +1 -1
  70. package/dist/assets/{lottie-Bi_BmPss.js → lottie-BoyaSool.js} +1 -1
  71. package/dist/assets/{mui-D4wswOer.js → mui-DtCOffvy.js} +1 -1
  72. package/dist/assets/{pathToGoBack-D9SmrC7Q.js → pathToGoBack-gmEN-6lU.js} +1 -1
  73. package/dist/assets/{pdf-BUMfUQyN.js → pdf-DPV5Ar9D.js} +4 -4
  74. package/dist/assets/{pdf-lib-BiL5LzBn.js → pdf-lib-CE0iOBgb.js} +1 -1
  75. package/dist/assets/{plaid-CknlBCWN.js → plaid-DpI35xEc.js} +1 -1
  76. package/dist/assets/{pusher-919nhfWF.js → pusher-B4AT968C.js} +1 -1
  77. package/dist/assets/{react-CO9qvT1d.js → react-BTtkL9eY.js} +1 -1
  78. package/dist/assets/{react-BegT7c31.js → react-CSl1Gs8y.js} +1 -1
  79. package/dist/assets/{react-CxtHJFJc.js → react-Cuwn10s4.js} +1 -1
  80. package/dist/assets/{react-DORUVTyV.js → react-DbRkstrq.js} +1 -1
  81. package/dist/assets/{react-tG70id2q.js → react-gN9MAt-j.js} +1 -1
  82. package/dist/assets/{react-OYc9lUHZ.js → react-xRWOC5n2.js} +1 -1
  83. package/dist/assets/{recharts-BjJxsXby.js → recharts-Dq7pGiC-.js} +1 -1
  84. package/dist/assets/{routePaths-Du0f4vF0.js → routePaths-CHVZiiJU.js} +1 -1
  85. package/dist/assets/{sentry-C8WyuRaf.js → sentry-DCGk37l1.js} +1 -1
  86. package/dist/assets/{url-CK7SN0RL.js → url-C3uYKzo6.js} +1 -1
  87. package/dist/assets/{url-rqOciRjJ.js → url-Cg5cCxLh.js} +1 -1
  88. package/dist/assets/{useAskAiCfoHostNavButtonProps-CM6KSCVu.js → useAskAiCfoHostNavButtonProps-BW2SwSZE.js} +1 -1
  89. package/dist/assets/{useDeviceId-DFIMsX1U.js → useDeviceId-SQLvKnL0.js} +1 -1
  90. package/dist/assets/useFetchSuggestedQuestionsWhenReady-cPo0or_6.js +1 -0
  91. package/dist/assets/{useInitialThreadRequest-PIljdErr.js → useInitialThreadRequest-BV4XmA3t.js} +1 -1
  92. package/dist/assets/{utils-l6Jt_9tl.js → utils-DWAOcXZK.js} +1 -1
  93. package/dist/assets/{withTransactionSidePanel-BeLe_Kr7.js → withTransactionSidePanel-ykEXkuoH.js} +3 -3
  94. package/dist/assets/{zeni-epic-state-BP6Uj047.js → zeni-epic-state-eW2EQdSt.js} +3 -3
  95. package/dist/index.html +1 -1
  96. package/package.json +2 -2
  97. package/dist/assets/AddressRoutes-BUvoDB1G.js +0 -1
  98. package/dist/assets/AddressScreen-eeo6LcCG.js +0 -9
  99. package/dist/assets/BillPayApprovalRoutes-B3yMYaND.js +0 -1
  100. package/dist/assets/CompanyPassportScreen-DVWLNjCs.js +0 -1
  101. package/dist/assets/CustomerOnboardingAuthScreen-v9d5sdON.js +0 -1
  102. package/dist/assets/DrawerScreen-B4dcA_LN.js +0 -1
  103. package/dist/assets/EntityDetailRoutes-6Vf4c0CK.js +0 -1
  104. package/dist/assets/FeaturePreviewScreen-3Jf-sujQ.js +0 -1
  105. package/dist/assets/MagicLinkSignInScreen-D1VdpvOF.js +0 -12
  106. package/dist/assets/NotFoundScreen-DG_ouxiW.js +0 -1
  107. package/dist/assets/PeopleRoutes-DAqZunqX.js +0 -22
  108. package/dist/assets/PerformanceRoutes-ArSreWe6.js +0 -1
  109. package/dist/assets/ReferralListScreen-D6S_Namj.js +0 -5
  110. package/dist/assets/RewardsRoutes-D3ZdanqE.js +0 -1
  111. package/dist/assets/SignInScreen-DztMfSvO.js +0 -1
  112. package/dist/assets/SignOutScreen-DMjdePlb.js +0 -9
  113. package/dist/assets/TaskRoutes-C3kXaPvb.js +0 -9
  114. package/dist/assets/TransactionDetailRoutes-v7cR8Xnn.js +0 -1
  115. package/dist/assets/TreasuryRoutes-CO1mD9L_.js +0 -37
  116. package/dist/assets/WiseConfirmationScreen-9IfsZKyz.js +0 -12
  117. package/dist/assets/ZeniAccountStatementScreen-CFC4jyF3.js +0 -9
  118. package/dist/assets/getLocaleForTenant-BZmydyUi.js +0 -1
  119. package/dist/assets/useFetchSuggestedQuestionsWhenReady-CqG_ou6v.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-DXiLz49w.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 Xt,o as te}from"./core-C_FlMzhB.js";import{eM as ie,br as Be,NW as _a,eQ as Se,eR as Ie,eS as Ae,fK as Me,co as ze,NX as $e,NY as $a,sH as Sa,ju as Ia,NZ as Aa,gy as ca,z9 as aa,zb as Ga,zc as Za,jk as Ct,N_ as Ge,yZ as pt,N$ as Qt,O0 as Jt,z0 as wa,O1 as en,Mn as Pa,qT as ht,z6 as Ya,gJ as an,O2 as ft,O3 as Ze,bp as tn,O4 as nn,fz as Ta,fy as Fa,zG as rn,fx as va,M3 as sn,O5 as gt,cN as bt,cJ as on,Mm as ua,Ag as cn,O6 as rt,zS as xa,O7 as yt,Ah as dn,MN as ln,Ai as un,Bc as mn,s1 as Cn,B6 as pn,zr as St,zk as hn,O8 as fn,fM as gn,zA as It,zE as At,fL as bn,O9 as yn,A2 as Et,Oa as Sn,Ob as In,Oc as An,zC as kt,zn as Dt,z3 as _t,zw as wt,zu as Pt,zy as En,za as st,Od as Tt,Oe as Oa,zP as Ea,J2 as Ft,cK as Ka,Of as kn,Og as Dn,Oh as _n,Oi as wn,zM as Ha,A9 as Pn,A5 as Tn,zI as Fn,A7 as vn,zZ as xn,z$ as On,Oj as vt,Af as xt,Gz as Bn,Ok as Ln,Ol as Rn,Om as Un,On as Ot,Oo as jn,AC as Nn,zR as Bt,zL as da,zQ as Vn,Op as Hn,Oq as Mn,yW as zn,Or as Lt,Os as Rt,Ot as $n,yY as Gn,yX as ot,Ou as Zn,Ov as Yn,Ow as Kn,I_ as Wn,Ox as Wa,Oy as qn,vx as Ut,k2 as Xn,gz as Qn,AH as Jn,Oz as jt,OA as er,AI as ar,OB as tr,db as nr,sB as rr,Ax as sr,Ar as Oe,bu as or,bC as ir,ct as cr,bD as dr,If as lr}from"./zeni-epic-state-BP6Uj047.js";import{z as J,S as Re,s as oe,c as Y,B as Ye,bX as Ba,c6 as ur,q as ve,c7 as mr,c8 as Cr,K as ma,aI as Fe,r as be,be as qa,c9 as pr,A as Ca,j as La,h as Xa,d as X,D as Qa,ca as hr,I as Nt,al as Ja,bq as Je,cb as Ma,cc as fr,v as et,a1 as gr,cd as br,ao as Vt,T as za,J as Ht,f as Mt,ce as yr,cf as Sr,cg as Ir,ch as Ar,ci as Er,o as ka,cj as kr,ck as Dr,cl as ja,E as _r,cm as wr,cn as Pr,co as Tr,cp as Fr,a4 as vr}from"./index-BabuXr6y.js";import{n as _e,D as zt,S as xr}from"./mui-D4wswOer.js";import{a as c}from"./sentry-C8WyuRaf.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Le,f as Ue,A as Or,h as at,P as Br,i as tt,s as ea,j as Gt,k as He,l as Zt,m as Lr,n as Yt,p as Rr,S as it}from"./SetupPagesScreen-BatnW9Lm.js";import Ra from"./NotFoundScreen-DG_ouxiW.js";import{M as ha}from"./MobileAppDrawer-Jd5aa9gg.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-CM6KSCVu.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-CqG_ou6v.js";import{v as ct}from"./utils-l6Jt_9tl.js";import{t as Ur}from"./AddressScreen-eeo6LcCG.js";import"./recharts-BjJxsXby.js";import"./analytics-B8BYlogo.js";import"./plaid-CknlBCWN.js";import"./dnd-CTZ8xt4P.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bi_BmPss.js";import"./lexical-BmFHbDfb.js";import"./pdf-BUMfUQyN.js";import"./analyticsHelper-D2Lkt_0_.js";import"./routePaths-Du0f4vF0.js";import"./BusinessVerificationPageScreen-B2ABlcef.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]="7235ed89-db9a-498e-afad-94997b51eaf1",e._sentryDebugIdIdentifier="sentry-dbid-7235ed89-db9a-498e-afad-94997b51eaf1")}catch{}})();function jr(){const e=ue(),{cardId:t}=la(),a=me(),r=J.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(Y.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:B}=C(Y.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,L=S(G=>Me(G,n.companyId)),j=ze(L.controllers),{creditAccount:T,creditAccountRepayment:P}=S(G=>$e(G)),N=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),Z=R?.accountingClassIDs[0],E=S(G=>Z!=null?Ia(G.classState,{classId:Z,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(Za()),N!=="Completed"&&N!=="In-Progress"&&a(Ct())},[T.fetchState,P.fetchState,a,l,f,m,N]);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=Le(l,g,w,f),O=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ye,{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:j,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:O,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:N,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:x?.className,cardHolderRoles:R?.userRoles,cardHolderDepartmentName:E?.className})]})}const Nr=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=J.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(Nr,{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=J.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=>Jt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:L}=oe(),{isFeatureEnabled:j}=L(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=L(Y.isDebitCardFeatureEnabled),P=Ae(T,k),N=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:j,isBookKeepingTenant:F,isDebitCardProductVisible:N,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=J.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Ya(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 Z=E=>{B(E)};if(w!=="Completed"||l==null)return s.jsx(Ye,{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(Zr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Z}),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:()=>{Z(!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=Ze(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:La.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&&J.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-CGYcZ7Lh.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 Xt,o as te}from"./core-CNZua1e0.js";import{eM as ie,br as Le,NW as _a,eQ as Se,eR as Ie,eS as Ae,fK as Me,co as ze,NX as $e,NY as $a,sH as Sa,ju as Ia,NZ as Aa,gy as ca,z9 as aa,zb as Ga,zc as Za,jk as Ct,N_ as Ge,yZ as pt,N$ as Qt,O0 as Jt,z0 as wa,O1 as en,Mn as Pa,qT as ht,z6 as Ya,gJ as an,O2 as ft,O3 as Ze,bp as tn,O4 as nn,fz as Ta,fy as Fa,zG as rn,fx as va,M3 as sn,O5 as gt,cN as bt,cJ as on,Mm as ua,Ag as cn,O6 as rt,zS as xa,O7 as yt,Ah as dn,MN as ln,Ai as un,Bc as mn,s1 as Cn,B6 as pn,zr as St,zk as hn,O8 as fn,fM as gn,zA as It,zE as At,fL as bn,O9 as yn,A2 as Et,Oa as Sn,Ob as In,Oc as An,zC as kt,zn as Dt,z3 as _t,zw as wt,zu as Pt,zy as En,za as st,Od as Tt,Oe as Oa,zP as Ea,J2 as Ft,cK as Ka,Of as kn,Og as Dn,Oh as _n,Oi as wn,zM as Ha,A9 as Pn,A5 as Tn,zI as Fn,A7 as vn,zZ as xn,z$ as On,Oj as vt,Af as xt,Gz as Ln,Ok as Bn,Ol as Rn,Om as Un,On as Ot,Oo as jn,AC as Nn,zR as Lt,zL as da,zQ as Vn,Op as Hn,Oq as Mn,yW as zn,Or as Bt,Os as Rt,Ot as $n,yY as Gn,yX as ot,Ou as Zn,Ov as Yn,Ow as Kn,I_ as Wn,Ox as Wa,Oy as qn,vx as Ut,k2 as Xn,gz as Qn,AH as Jn,Oz as jt,OA as er,AI as ar,OB as tr,db as nr,sB as rr,Ax as sr,Ar as Oe,bu as or,bC as ir,ct as cr,bD as dr,If as lr}from"./zeni-epic-state-eW2EQdSt.js";import{z as J,S as Re,i as oe,c as Y,x as Ye,bX as La,c6 as ur,p as ve,c7 as mr,c8 as Cr,K as ma,aI as Fe,n as be,be as qa,c9 as pr,C as Ca,j as Ba,h as Xa,d as X,D as Qa,ca as hr,H as Nt,al as Ja,bq as Je,cb as Ma,cc as fr,y as et,a1 as gr,cd as br,ao as Vt,M as za,I as Ht,f as Mt,ce as yr,cf as Sr,cg as Ir,ch as Ar,ci as Er,o as ka,cj as kr,ck as Dr,cl as ja,v as _r,cm as wr,cn as Pr,co as Tr,cp as Fr,a4 as vr}from"./index-Co04ey3-.js";import{n as _e,D as zt,S as xr}from"./mui-DtCOffvy.js";import{a as c}from"./sentry-DCGk37l1.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Be,f as Ue,A as Or,h as at,P as Lr,i as tt,s as ea,j as Gt,k as He,l as Zt,m as Br,n as Yt,p as Rr,S as it}from"./SetupPagesScreen-D5f_S2gA.js";import Ra from"./NotFoundScreen-CQPWWkLY.js";import{M as ha}from"./MobileAppDrawer-BTO_dO8H.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-BW2SwSZE.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-cPo0or_6.js";import{v as ct}from"./utils-DWAOcXZK.js";import{t as Ur}from"./AddressScreen-BRfd-CkJ.js";import"./recharts-Dq7pGiC-.js";import"./analytics-Cm9Z6TfJ.js";import"./plaid-DpI35xEc.js";import"./dnd-Dmzop572.js";import"./stripe-DMRn4zHo.js";import"./lottie-BoyaSool.js";import"./lexical-Dt1gfKRx.js";import"./pdf-DPV5Ar9D.js";import"./analyticsHelper-ByMo5A8t.js";import"./routePaths-CHVZiiJU.js";import"./BusinessVerificationPageScreen-surI_CG-.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]="37d1b417-9bfa-439d-a730-1e2b35336af9",e._sentryDebugIdIdentifier="sentry-dbid-37d1b417-9bfa-439d-a730-1e2b35336af9")}catch{}})();function jr(){const e=ue(),{cardId:t}=la(),a=me(),r=J.getSignedInUser(),n=S(G=>ie(G)),u=Re(),m=Le(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(Y.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:L}=C(Y.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(L,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:L,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,B=S(G=>Me(G,n.companyId)),j=ze(B.controllers),{creditAccount:T,creditAccountRepayment:P}=S(G=>$e(G)),N=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),Z=R?.accountingClassIDs[0],E=S(G=>Z!=null?Ia(G.classState,{classId:Z,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(Za()),N!=="Completed"&&N!=="In-Progress"&&a(Ct())},[T.fetchState,P.fetchState,a,l,f,m,N]);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=Be(l,g,w,f),O=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ye,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(La,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:O,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:N,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:x?.className,cardHolderRoles:R?.userRoles,cardHolderDepartmentName:E?.className})]})}const Nr=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=J.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(Nr,{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,L]=c.useState(!1),v=J.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=>Jt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:B}=oe(),{isFeatureEnabled:j}=B(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=B(Y.isDebitCardFeatureEnabled),P=Ae(T,k),N=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:j,isBookKeepingTenant:F,isDebitCardProductVisible:N,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=J.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Ya(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 Z=E=>{L(E)};if(w!=="Completed"||l==null)return s.jsx(Ye,{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(Zr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Z}),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:()=>{Z(!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=Ze(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:Ba.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&&J.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-DXiLz49w.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,Yr={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&&X.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=Xa(),L=ma(),j=me(),T=J.getSignedInUser(),P=Re(),[N,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??Or,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),Z=S(z=>Me(z,l.companyId)),E=ze(Z.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(O=>O.id===z);let ae;if(u==="cardPaymentHistory"&&f){const O=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:O??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};j(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,j]);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"&&j(xa(l.companyId,!0))},[x.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&X.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&&!N&&e&&d&&I!=null&&(X.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,N,e,d]),T==null)throw Error("Can't access invite people page without signing in...");const K=()=>{t(!0),j(yt())};return s.jsx(s.Fragment,{children:s.jsx(zt,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Yr.overlayWidth.valuePercentage(L),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&&X.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),j(dn({companyId:l.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:z=>{j(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=Qa.getLocalizedStrings().dateFormat,Yr={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:L,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&X.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,L,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 L=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=Xa(),B=ma(),j=me(),T=J.getSignedInUser(),P=Re(),[N,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??Or,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),Z=S(z=>Me(z,l.companyId)),E=ze(Z.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(O=>O.id===z);let ae;if(u==="cardPaymentHistory"&&f){const O=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:O??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};j(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,j]);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"&&j(xa(l.companyId,!0))},[x.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&X.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&&!N&&e&&d&&I!=null&&(X.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,N,e,d]),T==null)throw Error("Can't access invite people page without signing in...");const K=()=>{t(!0),j(yt())};return s.jsx(s.Fragment,{children:s.jsx(zt,{onClose:()=>{K()},anchor:"right",transitionDuration:250,open:e,PaperProps:{style:{width:Yr.overlayWidth.valuePercentage(B),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:L,paymentDetails:b,creditAccountSpentAmount:r,onTransferClick:()=>{D&&i&&o&&I!=null&&X.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),j(dn({companyId:l.companyId}))},onDismissClick:K,onSaveChangesToLocalStore:z=>{j(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",Na=Qa.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=J.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:La.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(Ya(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&&J.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&&X.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 Xr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=J.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:L}=w(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=w(Y.isDebitCardFeatureEnabled),T=Ae(j,i),P=Ee({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:T}),{isFeatureEnabled:N}=w(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Y.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:L,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)),Z=J.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,U)),{isAiCfoOpen:q,setIsAiCfoOpen:K}=Nt(),{isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce}=Kt({isAiCfoOpen:q,setIsAiCfoOpen:K,mobileExploreReferrer:"Card Detail"});Wt({isDataReady:E.fetchState==="Completed"});const ae=S(V=>Ge(V)),O=E.chargeCard,pe=Re(),G=Be(pe?.loggedInUserRoleMap),ce=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",we=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_physical_credit_card",re=O?.type.code==="business_virtual_debit_card"||O?.type.code==="business_virtual_credit_card",ne=O?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),Q=$t(ce,E),Ke=at(G,ae),je=Le(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=>O?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,O?.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=>O?.cardHolderUser?.userId!=null?Sa(V.userRoleState,O?.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=>Ze(V,!1,P,L).revokeCardInvite),na=Ja(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"||O==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=O.type.code.includes("physical"),he=V?O.cardActivationAttemptHistory[0]?.timestamp:O.createTime;X.trackCardsCardDetailView(We,je,{cardId:r,cardName:O.cardName,cardType:O.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Je(O.limit.amount),cardLastFourDigits:O.accountLast4,cardStatus:O.status.code,cardAssignedDate:O.createTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:O.providerCardCreateTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:O.creditLimitFrequency.name,cardSpentAmount:Je(O.balance.amount),cardAvailableLimit:Je(O.available.amount),cardUtilizationPercent:O.limit.amount>0?Math.round((O.limit.amount-O.available.amount)/O.limit.amount*100):0,cardUtilizationAmount:Je(O.limit.amount-O.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(O.cardCreatedByUser,!1),cardIssuedByEmail:O.cardCreatedByUser?.email,cardIssuedByUserId:O.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(O.cardHolderUser,!1),cardholderEmail:O.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:O.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 Xe=i.companyId??J.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Xe!=null?[`private-${Xe}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&O!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:Ne,frequency:Qe,cardColor:H}=Va(O),De=O.cardHolderUserId===o.userId;X.trackCardsDetailPageViewed(r,V,he,Te,Ne,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,O,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&O!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(O),Ve=O.cardHolderUserId===o.userId;X.trackCardsDetailPageClicked(r,Te,Ne,Qe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&O!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(O),Ve=O.cardHolderUserId===o.userId;X.trackCardsVerifyPopUpClick(r,Te,Ne,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:X,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:je,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:N,controllerEmails:We,chargeCardCashbackDetailState:ae,productInformation:je,creditAccountInformation:de,debitAccountInformation:Q,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Z,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",Na=Qa.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=J.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:Ba.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:L,isChargeCardFeatureEnabled:v}=t,{tenantEmailDomain:k}=r;return{onEventReceived:h=>{h===qt&&(e(Ya(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&&J.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&&X.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,L),I(h)}}})(gr(br));function Xr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=J.getSignedInUser(),i=S(V=>ie(V)),D=S(V=>_a(V).firstViewAfterActivation),A=S(V=>V.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:L}=I(Fe.zeniCardsConfig),v=L.enable_card_controls_for_company_ids,k=L.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:B}=w(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=w(Y.isDebitCardFeatureEnabled),T=Ae(j,i),P=Ee({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:T}),{isFeatureEnabled:N}=w(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Y.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,U=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:B,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)),Z=J.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,U)),{isAiCfoOpen:q,setIsAiCfoOpen:K}=Nt(),{isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce}=Kt({isAiCfoOpen:q,setIsAiCfoOpen:K,mobileExploreReferrer:"Card Detail"});Wt({isDataReady:E.fetchState==="Completed"});const ae=S(V=>Ge(V)),O=E.chargeCard,pe=Re(),G=Le(pe?.loggedInUserRoleMap),ce=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_virtual_debit_card",we=O?.type.code==="business_physical_debit_card"||O?.type.code==="business_physical_credit_card",re=O?.type.code==="business_virtual_debit_card"||O?.type.code==="business_virtual_credit_card",ne=O?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),Q=$t(ce,E),Ke=at(G,ae),je=Be(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=>O?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,O?.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=>O?.cardHolderUser?.userId!=null?Sa(V.userRoleState,O?.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=>Ze(V,!1,P,B).revokeCardInvite),na=Ja(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"||O==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=O.type.code.includes("physical"),he=V?O.cardActivationAttemptHistory[0]?.timestamp:O.createTime;X.trackCardsCardDetailView(We,je,{cardId:r,cardName:O.cardName,cardType:O.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Je(O.limit.amount),cardLastFourDigits:O.accountLast4,cardStatus:O.status.code,cardAssignedDate:O.createTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:O.providerCardCreateTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:O.creditLimitFrequency.name,cardSpentAmount:Je(O.balance.amount),cardAvailableLimit:Je(O.available.amount),cardUtilizationPercent:O.limit.amount>0?Math.round((O.limit.amount-O.available.amount)/O.limit.amount*100):0,cardUtilizationAmount:Je(O.limit.amount-O.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(O.cardCreatedByUser,!1),cardIssuedByEmail:O.cardCreatedByUser?.email,cardIssuedByUserId:O.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(O.cardHolderUser,!1),cardholderEmail:O.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:O.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 Xe=i.companyId??J.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Xe!=null?[`private-${Xe}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&O!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:Ne,frequency:Qe,cardColor:H}=Va(O),De=O.cardHolderUserId===o.userId;X.trackCardsDetailPageViewed(r,V,he,Te,Ne,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,O,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&O!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(O),Ve=O.cardHolderUserId===o.userId;X.trackCardsDetailPageClicked(r,Te,Ne,Qe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&O!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(O),Ve=O.cardHolderUserId===o.userId;X.trackCardsVerifyPopUpClick(r,Te,Ne,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(La,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:X,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:je,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:N,controllerEmails:We,chargeCardCashbackDetailState:ae,productInformation:je,creditAccountInformation:de,debitAccountInformation:Q,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Z,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`
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
- `,Jr=ge(function(e,t){const a=Ze(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:L,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:N}=m;return{onChargeCardRowClick:(p,d)=>{const _=Zt(N,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,Z=M.creditLimitFrequency.name;X.trackCardsListRowClicked(y,x,$,W,R,Z,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&X.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:Je(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Je(_.limit.amount)},l,w,L)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Yt(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(On(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:()=>{X.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&X.trackCardsSettingsClick(v,g,l,w,L);const p=Lr(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{X.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&X.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,L);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&&X.trackCardsCardListSortClick(v,g,l,"Sort Icon","sort",p,d==="ascending"?"ASC":"DESC","Cards List",w,L),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&&X.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,L),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&X.trackCardsStatementsClick(v,g,l,w,L),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&X.trackCardsNewCardClick(v,g,l,"Promo Banner","card_creation_initiated","Card List",w,L),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&&X.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,L);const _=as(P);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const p=ts(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},shouldShowPayNowInfoTooltip:j,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(J.getPayNowInfoTooltip()??!1),o=H=>{J.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=J.getSignedInUser(),f=S(H=>ie(H)),[B,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=Nt(),{isAiCfoAccessEnabled:l,onAskAiCfoClick:w}=Kt({isAiCfoOpen:b,setIsAiCfoOpen:g,mobileExploreReferrer:"Cards"}),L=f.userRole.includes("charge_card_user"),j=!L,T=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:P,useDynamicConfig:N}=oe(),{isFeatureEnabled:p}=P(Y.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Y.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),x=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Z=ke({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=N(Fe.zeniCardsConfig),K=Re(),z=Be(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),O=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=Ja(ne.updateStatus),Q=S(H=>Ze(H,j,y&&T,Z&&re)),Ke=Q.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),je=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>Oa(H,je)),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(),Xe=at(z,Pe),ra=pa(Z,re,z,ta,le),sa=tt(y,T,z,ee,Q.debitCardSummary),oa=Le(Z,y,T,re),ia=Q.creditAccount.balance.amount+Q.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(J.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(j,y&&T,Z&&re,!1)))},[B,j,a,na]),c.useEffect(()=>{xe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[xe,i]),c.useEffect(()=>{se==="Completed"&&L&&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,L,r.state,n,Q.cards]),c.useEffect(()=>{if(se==="Completed"&&L){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,L,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Z&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||X.trackCardsCardListView(ae,oa,Xe,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:Z,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),Ne=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:X,onLoad:()=>{X.trackPageLoaded(Mt.Event.cardsListPage),(Z&&!re||y&&!T)&&X.trackCardsPromoView(ae,{isCreditCardOffered:Z,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Z&&!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:Xe,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Z||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(Jr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Z,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:j,onClickMenuIcon:()=>{ba(!0)},creditLimit:V,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:T,isEarlyPayEnabled:F,isChargeCardPaymentHistoryFeatureEnabled:U,cashbackRate:O,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Xe,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||Ne?s.jsx(ya,{to:"../promo"}):s.jsx(Ye,{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=J.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(Ln({uiState:{downloadState:n}}))}}})(Sr);function rs(){const e=ue(),t=ye(),a=me(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=oe();if(J.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(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Y.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),L=Ie(u),j=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=ke({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:h,isBookKeepingTenant:L,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:j}),P=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,N=Re(),p=Be(N?.loggedInUserRoleMap),d=S(K=>Ze(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=>Oa(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(()=>Le(T,l,k,P),[T,l,k,P]),R=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Z=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:Z}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
25
+ `,Jr=ge(function(e,t){const a=Ze(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:L,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:B,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:N}=m;return{onChargeCardRowClick:(p,d)=>{const _=Zt(N,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,Z=M.creditLimitFrequency.name;X.trackCardsListRowClicked(y,x,$,W,R,Z,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&X.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:Je(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Je(_.limit.amount)},l,w,B)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Yt(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(On(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:()=>{X.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&X.trackCardsSettingsClick(v,g,l,w,B);const p=Br(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{X.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&X.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,B);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&&X.trackCardsCardListSortClick(v,g,l,"Sort Icon","sort",p,d==="ascending"?"ASC":"DESC","Cards List",w,B),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&&X.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,B),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&X.trackCardsStatementsClick(v,g,l,w,B),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&X.trackCardsNewCardClick(v,g,l,"Promo Banner","card_creation_initiated","Card List",w,B),a(`./new?cardType=${p}`)},onPromoCardClick:p=>{a(p==="debit"&&D&&!f||p==="credit"&&o&&!L?`../promo?cardPromoType=${p}`:"./setup")},navigateToCreditCardPaymentPage:(p,d)=>{b==="Completed"&&r.company!=null&&l!=null&&X.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,B);const _=as(P);a(_)},navigateToCreditCardPaymentHistoryPage:()=>{const p=ts(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},shouldShowPayNowInfoTooltip:j,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(J.getPayNowInfoTooltip()??!1),o=H=>{J.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=J.getSignedInUser(),f=S(H=>ie(H)),[L,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=Nt(),{isAiCfoAccessEnabled:l,onAskAiCfoClick:w}=Kt({isAiCfoOpen:b,setIsAiCfoOpen:g,mobileExploreReferrer:"Cards"}),B=f.userRole.includes("charge_card_user"),j=!B,T=!!f.companyDebitCardInfo?.info?.isDebitCardEnabled,{useFeatureGate:P,useDynamicConfig:N}=oe(),{isFeatureEnabled:p}=P(Y.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Y.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Y.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),x=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Z=ke({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:x,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=N(Fe.zeniCardsConfig),K=Re(),z=Le(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),O=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??Lr,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=Ja(ne.updateStatus),Q=S(H=>Ze(H,j,y&&T,Z&&re)),Ke=Q.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),je=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>Oa(H,je)),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(),Xe=at(z,Pe),ra=pa(Z,re,z,ta,le),sa=tt(y,T,z,ee,Q.debitCardSummary),oa=Be(Z,y,T,re),ia=Q.creditAccount.balance.amount+Q.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(J.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(()=>{!L&&(re||T)&&na&&(v(!0),a(Ea(j,y&&T,Z&&re,!1)))},[L,j,a,na]),c.useEffect(()=>{xe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[xe,i]),c.useEffect(()=>{se==="Completed"&&B&&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,B,r.state,n,Q.cards]),c.useEffect(()=>{if(se==="Completed"&&B){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,B,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Z&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||X.trackCardsCardListView(ae,oa,Xe,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:Z,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),Ne=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:X,onLoad:()=>{X.trackPageLoaded(Mt.Event.cardsListPage),(Z&&!re||y&&!T)&&X.trackCardsPromoView(ae,{isCreditCardOffered:Z,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Z&&!re?"Credit Card":"","Card List")}}),s.jsx(La,{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:Xe,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Z||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(Jr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Z,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:j,onClickMenuIcon:()=>{ba(!0)},creditLimit:V,isChargeCardSetupEnabled:re,isDebitCardSetupEnabled:T,isEarlyPayEnabled:F,isChargeCardPaymentHistoryFeatureEnabled:U,cashbackRate:O,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Xe,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||Ne?s.jsx(ya,{to:"../promo"}):s.jsx(Ye,{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=J.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:Ln(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(Bn({uiState:{downloadState:n}}))}}})(Sr);function rs(){const e=ue(),t=ye(),a=me(),{areTenantIdsInSync:r}=Ht(),{useFeatureGate:n}=oe();if(J.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,L]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Y.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),B=Ie(u),j=u.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,T=ke({isCardsOnlyTenant:w,isChargeCardFeatureEnabled:h,isBookKeepingTenant:B,isDebitCardProductVisible:l,chargeCardsCreditAccountLimit:j}),P=!!u.companyChargeCardInfo?.info?.isChargeCardEnabled,N=Re(),p=Le(N?.loggedInUserRoleMap),d=S(K=>Ze(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=>Oa(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(()=>Be(T,l,k,P),[T,l,k,P]),R=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Z=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{L(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),L(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:Z}):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-DXiLz49w.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(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=D(Y.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,L=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,j=S(y=>Me(y,A.companyId)),T=ze(j.controllers),P=S(y=>Ot(y)),N=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(N)],d=S(y=>Oa(y,p)),_=S(y=>jn(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(Nn(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&&L&&t(Za())},[d.fetchState,k,w,P.fetchState,_.fetchState,n.fetchState,l,L]),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 $=Le(l,k,w,L),R=pa(l,L,!0,r,n),Z=tt(k,w,!0,d,_);X.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:x},R,Z)}},[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=J.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=Le(l,k,w,L);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:L,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=J.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:L}=g,j=S(R=>R.settingsViewState.profile.fetchState),T=S(R=>R.chargeCardListState.fetchState),P=S(R=>R.settingsViewState.profile.userId),N=S(R=>R.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&j!=="In-Progress"&&j!=="Completed"&&(a(Mn()),C(!0)),I===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(wa()),o(!0)),i===!1&&T==="Not-Started"&&(D(!0),a(da()))},[m,i,T,I,N]),c.useEffect(()=>{j==="Completed"&&B===!1&&P!=null&&T==="Completed"&&w.cards.length>0&&(a(zn({userId:P})),a(Lt({cardId:w.cards[w.cards.length-1].id})),v(!0))},[j,B,P,T]),c.useEffect(()=>{if(!A&&w.fetchState==="Completed"&&w.cards.length===0){const R=ve(n.state?.pathnameStackToGoBack),Z=R.poppedPathname??Ue(L);r(Z,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Ja(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Y.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),Z=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Z},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"||j!=="Completed"||w.cards.length===0)return s.jsx(Ye,{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=Ze(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&&J.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Lt({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=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(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:L}=D(Y.isDebitCardFeatureEnabled),v=Ae(L,A),k=Ee({isDebitCardFeatureEnabled:L,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,B=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,j=S(y=>Me(y,A.companyId)),T=ze(j.controllers),P=S(y=>Ot(y)),N=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(N)],d=S(y=>Oa(y,p)),_=S(y=>jn(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(Nn(r.id)))},[I,t,r.fetchState,r.id,i.fetchState]),c.useEffect(()=>{d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&k&&w&&t(Lt()),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&&B&&t(Za())},[d.fetchState,k,w,P.fetchState,_.fetchState,n.fetchState,l,B]),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 $=Be(l,k,w,B),R=pa(l,B,!0,r,n),Z=tt(k,w,!0,d,_);X.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:x},R,Z)}},[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=J.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=Be(l,k,w,B);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:B,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),[L,v]=c.useState(!1),[k,h]=c.useState(!1),b=J.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:B}=g,j=S(R=>R.settingsViewState.profile.fetchState),T=S(R=>R.chargeCardListState.fetchState),P=S(R=>R.settingsViewState.profile.userId),N=S(R=>R.chargeCardConfigState.fetchState);c.useEffect(()=>{m===!1&&j!=="In-Progress"&&j!=="Completed"&&(a(Mn()),C(!0)),I===!1&&N!=="In-Progress"&&N!=="Completed"&&(a(wa()),o(!0)),i===!1&&T==="Not-Started"&&(D(!0),a(da()))},[m,i,T,I,N]),c.useEffect(()=>{j==="Completed"&&L===!1&&P!=null&&T==="Completed"&&w.cards.length>0&&(a(zn({userId:P})),a(Bt({cardId:w.cards[w.cards.length-1].id})),v(!0))},[j,L,P,T]),c.useEffect(()=>{if(!A&&w.fetchState==="Completed"&&w.cards.length===0){const R=ve(n.state?.pathnameStackToGoBack),Z=R.poppedPathname??Ue(B);r(Z,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Ja(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Y.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),Z=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Z},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"||j!=="Completed"||w.cards.length===0)return s.jsx(Ye,{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=Ze(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&&J.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Bt({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)}%`};
@@ -44,7 +44,7 @@ import{j as s}from"./liveblocks-DXiLz49w.js";import{j as ue,l as la,h as me,g as
44
44
  flex-direction: column;
45
45
  align-items: center;
46
46
  background-color: ${e=>e.theme.colors.grey4};
47
- `,us={containerWidth:new Ca(100,58)},ms=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m,useFeatureGate:C}=oe(),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[B,v]=c.useState(!1),k=J.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const h=S(x=>ie(x));if(n==null)throw Error("Empty card id is not valid...");const{configValue:b}=m(Fe.zeniCardsConfig),g=S(x=>Zn(x,n)),{isFeatureEnabled:l}=C(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Y.isDebitCardFeatureEnabled),L=Ae(w,h),j=Ee({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:L}),T=Se(h),P=Ie(h),N=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=ke({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:l,isBookKeepingTenant:P,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:N}),d=g.chargeCard,_=S(x=>x.chargeCardConfigState.fetchState);c.useEffect(()=>{I===!1&&_!=="In-Progress"&&_!=="Completed"&&(a(wa()),o(!0)),i===!1&&g.fetchState==="Not-Started"&&(D(!0),a(aa(n,!1,p)))},[i,g.fetchState,I,_]);const F=d?.type.code==="business_physical_debit_card"||d?.type.code==="business_virtual_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(A===!1&&(F===!1||F&&d.status?.code!=="active"||F&&d.status.code==="active"&&d.isPinSet||d.cardHolderUserId!==k.userId)){const x=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);r(x,{state:{pathnameStackToGoBack:$}})}else if(A&&g.isRefreshingViewInBackground===!1&&d?.isPinSet===!0){a(Yn({chargeCardId:n}));const x=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(x,{state:{pathnameStackToGoBack:$}})}}},[g.fetchState,d?.type.code,A,g.isRefreshingViewInBackground]);const U=J.getZeniOtpTokenForCardHolder(n),M=S(x=>ht(x.userState,k.userId)),W=()=>{d?.isPinSet!==!0&&a(Ya(n,!0))};c.useEffect(()=>{g.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(W,3e3),f(!0))},[g.updateDebitCardPinAttemptFetchState.fetchState]);const y=x=>{v(x)};if(_!=="Completed"||d==null)return s.jsx(Ye,{fetchState:"In-Progress"});if(M?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(hs,{children:[s.jsx(ha,{isAppContentDrawerOpen:B,handleDrawerToggle:y}),s.jsx(Cs,{cardId:n,card:d,phone:M.phone,signedInUser:k,isSandboxEnv:qa(),debitCardDetailState:g,signedInUserToken:U,navigate:r,currentTenant:h,location:u,chargeCardCashbackRatePerTransaction:b.charge_card_cashback_rate_per_transaction!=null?b.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{y(!0)}}),e!=null?s.jsx(ps,{windowSize:t,children:e}):null]})},Cs=ge(function(e,{debitCardDetailState:t,cardId:a}){const r=ft(e,a),n=t.updateStatus,u=Ze(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{showMenuIcon:m,vgsVaultId:La.cardVaultId,twoFAView:r,setPinWaitStatus:n}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,debitCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdateDebitCardPinAttempt:o=>{e(At(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&&J.saveZeniOtpTokenForCardHolder(o,r)},onSetPinSuccess:()=>{e(Kn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("activate")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(kr),ps=_e.div`
47
+ `,us={containerWidth:new Ca(100,58)},ms=({appContent:e})=>{const t=ma(),a=me(),r=ue(),{cardId:n}=la(),u=ye(),{useDynamicConfig:m,useFeatureGate:C}=oe(),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[L,v]=c.useState(!1),k=J.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const h=S(x=>ie(x));if(n==null)throw Error("Empty card id is not valid...");const{configValue:b}=m(Fe.zeniCardsConfig),g=S(x=>Zn(x,n)),{isFeatureEnabled:l}=C(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Y.isDebitCardFeatureEnabled),B=Ae(w,h),j=Ee({isDebitCardFeatureEnabled:w,isBankingOnlyTenant:B}),T=Se(h),P=Ie(h),N=h.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,p=ke({isCardsOnlyTenant:T,isChargeCardFeatureEnabled:l,isBookKeepingTenant:P,isDebitCardProductVisible:j,chargeCardsCreditAccountLimit:N}),d=g.chargeCard,_=S(x=>x.chargeCardConfigState.fetchState);c.useEffect(()=>{I===!1&&_!=="In-Progress"&&_!=="Completed"&&(a(wa()),o(!0)),i===!1&&g.fetchState==="Not-Started"&&(D(!0),a(aa(n,!1,p)))},[i,g.fetchState,I,_]);const F=d?.type.code==="business_physical_debit_card"||d?.type.code==="business_virtual_debit_card";c.useEffect(()=>{if(g.fetchState==="Completed"){if(A===!1&&(F===!1||F&&d.status?.code!=="active"||F&&d.status.code==="active"&&d.isPinSet||d.cardHolderUserId!==k.userId)){const x=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);r(x,{state:{pathnameStackToGoBack:$}})}else if(A&&g.isRefreshingViewInBackground===!1&&d?.isPinSet===!0){a(Yn({chargeCardId:n}));const x=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(x,{state:{pathnameStackToGoBack:$}})}}},[g.fetchState,d?.type.code,A,g.isRefreshingViewInBackground]);const U=J.getZeniOtpTokenForCardHolder(n),M=S(x=>ht(x.userState,k.userId)),W=()=>{d?.isPinSet!==!0&&a(Ya(n,!0))};c.useEffect(()=>{g.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(W,3e3),f(!0))},[g.updateDebitCardPinAttemptFetchState.fetchState]);const y=x=>{v(x)};if(_!=="Completed"||d==null)return s.jsx(Ye,{fetchState:"In-Progress"});if(M?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(hs,{children:[s.jsx(ha,{isAppContentDrawerOpen:L,handleDrawerToggle:y}),s.jsx(Cs,{cardId:n,card:d,phone:M.phone,signedInUser:k,isSandboxEnv:qa(),debitCardDetailState:g,signedInUserToken:U,navigate:r,currentTenant:h,location:u,chargeCardCashbackRatePerTransaction:b.charge_card_cashback_rate_per_transaction!=null?b.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{y(!0)}}),e!=null?s.jsx(ps,{windowSize:t,children:e}):null]})},Cs=ge(function(e,{debitCardDetailState:t,cardId:a}){const r=ft(e,a),n=t.updateStatus,u=Ze(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{showMenuIcon:m,vgsVaultId:Ba.cardVaultId,twoFAView:r,setPinWaitStatus:n}},function(e,t){const{navigate:a,cardId:r,location:n,currentTenant:u,debitCardDetailState:m}=t,C=m.chargeCard?.cardProviderID,{tenantEmailDomain:I}=u;return{onGetOtp:o=>{C!=null&&e(va(o,"ChargeCardHolder",r))},onUpdateDebitCardPinAttempt:o=>{e(At(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&&J.saveZeniOtpTokenForCardHolder(o,r)},onSetPinSuccess:()=>{e(Kn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("activate")===!0?Ue(I):o.poppedPathname;a(i,{state:{pathnameStackToGoBack:o.newStack}})}}})(kr),ps=_e.div`
48
48
  display: flex;
49
49
  flex-direction: column;
50
50
  width: ${e=>`${us.containerWidth.value(e.windowSize)}%`};
@@ -59,7 +59,7 @@ import{j as s}from"./liveblocks-DXiLz49w.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(ja[12],ja[12],ja[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(Xn({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=Xa(),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:La.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(jt()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=J.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Y.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Y.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Y.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(Jn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,L=D.companyName,j=S(y=>Wa(y,h&&l,f&&w)),T=j.fetchState,P=j.issueCardStatus.fetchState,N=j.lastSelfIssuedDebitCardId,p=S(y=>N!=null?Rt(y.chargeCardState,N):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(N!=null&&p?.type.code==="business_virtual_debit_card"){let y;y=p?.status.code==="request_on_hold"&&e.userId===p.cardHolderUserId?Yt(D.tenantEmailDomain):fe(D.tenantEmailDomain,N,e,p),t(y)}else t("../");a(jt())}},[P,N]),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:L,signedInUser:e,themeState:r,isIssuePhysicalCardEnabled:C,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:t,fetchState:j.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(ja[12],ja[12],ja[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(Xn({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=Xa(),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:Ba.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(jt()),t.navigate("../")},resetCustomAddressByLineID:(a,r)=>{e(Ut(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=J.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Y.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Y.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Y.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),L=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:L,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(Jn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,B=D.companyName,j=S(y=>Wa(y,h&&l,f&&w)),T=j.fetchState,P=j.issueCardStatus.fetchState,N=j.lastSelfIssuedDebitCardId,p=S(y=>N!=null?Rt(y.chargeCardState,N):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(N!=null&&p?.type.code==="business_virtual_debit_card"){let y;y=p?.status.code==="request_on_hold"&&e.userId===p.cardHolderUserId?Yt(D.tenantEmailDomain):fe(D.tenantEmailDomain,N,e,p),t(y)}else t("../");a(jt())}},[P,N]),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:B,signedInUser:e,themeState:r,isIssuePhysicalCardEnabled:C,isIssuePhysicalDebitCardEnabled:I,isDebitCardFeatureEnabled:f,isChargeCardFeatureEnabled:h,isChargeCardSetupEnabled:l,isDebitCardSetupEnabled:w,navigate:t,fetchState:j.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-DXiLz49w.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=Zt(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=Xa(),[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(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Y.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}),L=Be(h?.loggedInUserRoleMap),j=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),N=S(F=>Ot(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(N)],d=S(F=>Oa(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 _=J.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&L&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&L&&t(Za()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&B&&v&&L&&t(Bt())},[T.fetchState,P.fetchState,t,d.fetchState,B,v,L,w,k]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(Ye,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const F=Le(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:j,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&&X.trackCardsPromoPageClicked("enable cards"),n)switch(X.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(Oe(r,!0,"charge_cards",i,!1));break;case"debit":e(Oe(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Oe(r,!0,"debit_cards",i,!0):Oe(r,!0,"charge_cards__debit_cards",i,!1))}else switch(X.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(Oe(r,!1,"charge_cards",i,!1));break;case"debit":e(Oe(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Oe(r,!1,"debit_cards",i,!0):Oe(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(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Y.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=J.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,L=Se(f),j=Ie(f),T=Ae(o,f),P=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,N=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:T}),p=ke({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:P}),d=Gt({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j}),_=N&&p===!1,F=w?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||nr(l?.providerVerificationStatus?.code??"")),U=J.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)},Z=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,O]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Z!=="Not-Started"||b==null||(O(!0),n(xa(b,!0)))},[ae,Z,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:N,isTOSAccepted:$,isSetupEnabled:x,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=N&&we&&d&&P>=0&&ce?"debit_and_credit":N&&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 je=S(ee=>Ft(ee.userState,ee.userRoleState,ee.userListViewState,"cardAdmin")),Pe=Le(d,N,x,y);return(ce||we)&&Z==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:X,onLoad:()=>{if(X.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!N&&!x||!!d&&!!N&&!x&&!y){const ee=_s({isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:N});X.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:je.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(Ye,{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 Xs(){const e=ye(),t=S(Z=>ie(Z)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Y.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(Y.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),L=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!w)&&ir(B?.loggedInUserRoleMap),j=cr(B?.loggedInUserRoleMap),T=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!w)&&dr(B?.loggedInUserRoleMap),{isFeatureEnabled:P}=a(Y.isDepositAccountsFeatureEnabled),N=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(Xt,{children:[v?s.jsx(te,{path:"setup",element:s.jsx(it,{isBillPayAdminLevelAccess:L,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,isUserHasOnlyBillPayAccess:j,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(te,{path:"verification",element:s.jsx(it,{isBillPayAdminLevelAccess:L,isUserHasOnlyBillPayAccess:j,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,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(jr,{})}),s.jsx(te,{path:":cardId/*",element:s.jsx(Xr,{})}),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{Xs 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=Zt(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=Xa(),[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(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Y.isDebitCardFeatureEnabled),f=Ae(A,C),L=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:L,chargeCardsCreditAccountLimit:l}),B=Le(h?.loggedInUserRoleMap),j=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),N=S(F=>Ot(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(N)],d=S(F=>Oa(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 _=J.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&B&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&B&&t(Za()),d.fetchState!=="Completed"&&d.fetchState!=="In-Progress"&&L&&v&&B&&t(Lt())},[T.fetchState,P.fetchState,t,d.fetchState,L,v,B,w,k]),_==null)throw Error("Can't access address page without signing in...");if(m.fetchState!=="Completed")return s.jsx(Ye,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5}});{const F=Be(w,L,v,k);return s.jsx(Is,{children:s.jsx(As,{navigate:e,currentTenant:C,signedInUser:_,productInformation:F,myPendingActivationChargeCardListState:m,isChargeCardFeatureEnabled:w,isDebitCardFeatureEnabled:L,isDebitCardSetupEnabled:v,isChargeCardSetupEnabled:k,chargeCardCashbackDetailState:j,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&&X.trackCardsPromoPageClicked("enable cards"),n)switch(X.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(Oe(r,!0,"charge_cards",i,!1));break;case"debit":e(Oe(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Oe(r,!0,"debit_cards",i,!0):Oe(r,!0,"charge_cards__debit_cards",i,!1))}else switch(X.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(Oe(r,!1,"charge_cards",i,!1));break;case"debit":e(Oe(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?Oe(r,!1,"debit_cards",i,!0):Oe(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let L=f.poppedPathname;L==null&&(L=u||m?"..":"../.."),a(L,{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(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Y.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),L=S(ee=>Me(ee,f.companyId)),v=ze(L.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=J.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,B=Se(f),j=Ie(f),T=Ae(o,f),P=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,N=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:T}),p=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:P}),d=Gt({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:D,isBookKeepingTenant:j}),_=N&&p===!1,F=w?.businessVerificationStatus?.code==="verified"&&(_||l?.accType==="depositAccount"||nr(l?.providerVerificationStatus?.code??"")),U=J.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)},Z=S(ee=>ee.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Re(),q=Le(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,O]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Z!=="Not-Started"||b==null||(O(!0),n(xa(b,!0)))},[ae,Z,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:N,isTOSAccepted:$,isSetupEnabled:x,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=N&&we&&d&&P>=0&&ce?"debit_and_credit":N&&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 je=S(ee=>Ft(ee.userState,ee.userRoleState,ee.userListViewState,"cardAdmin")),Pe=Be(d,N,x,y);return(ce||we)&&Z==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:X,onLoad:()=>{if(X.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!N&&!x||!!d&&!!N&&!x&&!y){const ee=_s({isDebitCardSetupEnabled:x,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:N});X.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(La,{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:je.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(Ye,{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 Xs(){const e=ye(),t=S(Z=>ie(Z)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Y.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Y.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Y.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Y.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,L=Re(),v=Le(L?.loggedInUserRoleMap),k=Ka(L?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Y.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),B=(t?.company==null||t.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!w)&&ir(L?.loggedInUserRoleMap),j=cr(L?.loggedInUserRoleMap),T=(t?.company==null||t.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!w)&&dr(L?.loggedInUserRoleMap),{isFeatureEnabled:P}=a(Y.isDepositAccountsFeatureEnabled),N=P&&!w&&bt(L?.loggedInUserRoleMap),p=A&&!w,d=f&&!w,_=o&&!w&&Le(L?.loggedInUserRoleMap),F=lr(L?.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(Xt,{children:[v?s.jsx(te,{path:"setup",element:s.jsx(it,{isBillPayAdminLevelAccess:B,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,isChargeCardAdminLevelAccess:_,isUserHasOnlyCardAccess:F,isUserHasOnlyBillPayAccess:j,productType:"charge_cards",type:"setup"})}):null,v?s.jsx(te,{path:"verification",element:s.jsx(it,{isBillPayAdminLevelAccess:B,isUserHasOnlyBillPayAccess:j,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:N,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(jr,{})}),s.jsx(te,{path:":cardId/*",element:s.jsx(Xr,{})}),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{Xs as default};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-CGYcZ7Lh.js";import{a as g}from"./sentry-DCGk37l1.js";import{j as w,h as k,u as x,l as T,g as O,k as E}from"./core-CNZua1e0.js";import{z as C,b0 as F,y as P,d as L,f as V,aa as b,b1 as j,ao as A,ap as B,n as U}from"./index-Co04ey3-.js";import{eM as D,fB as M,rs as _,fw as R,b$ as z,Ls as G,bm as Y,pA as $,po as q,jW as H,lq as S,Lt as W,bB as Z,cr as N,ly as J,lB as K}from"./zeni-epic-state-eW2EQdSt.js";import"./mui-DtCOffvy.js";import{c as Q}from"./routePaths-CHVZiiJU.js";import{M as X}from"./MobileAppDrawer-BTO_dO8H.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new n.Error().stack;t&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[t]="aeae6fa2-06cf-4466-8133-b171bed1a320",n._sentryDebugIdIdentifier="sentry-dbid-aeae6fa2-06cf-4466-8133-b171bed1a320")}catch{}})();const ee=E(function(n){const t=R(n),i=C.getSignedInUser(),l=D(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=z(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=G(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:p,filesEndPoint:`${A.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}},function(n,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(K())},onAddressClick:e=>{const a=Q(f,e),o=U(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?N(u):void 0,meetingLink:y!=""&&y!=null?N(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:B(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?Z(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n(W(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(H({files:e}))},onDeleteFile:e=>{n(q(e))},onEditFileName:(e,a)=>{n($(e,a.split(".")[0]))}}})(j);function de(){const n=w(),t=k(),i=x(),{tenantEmailDomain:l}=T(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),a=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||a!=="Not-Started"||d==null||(p(!0),t(M(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(_())},[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:L,onLoad:s=>s.trackPageLoaded(V.Event.companyPassport,b(i)?"Settings":"Company Passport")}),b(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:b(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-DXiLz49w.js";import{a}from"./sentry-C8WyuRaf.js";import{h as D,u as v,g as u,N as w}from"./core-C_FlMzhB.js";import{Ib as A,eM as O,fi as _,mh as j,fJ as E,fh as U,eN as L,Ij as F}from"./zeni-epic-state-BP6Uj047.js";import{u as $,z as c,L as g,D as k,o as H}from"./index-BabuXr6y.js";import{n as z}from"./mui-D4wswOer.js";import{t as R}from"./getLocaleForTenant-BZmydyUi.js";import{g as P,Q as G}from"./QBOConnectionScreen-CBYjGz6H.js";import"./recharts-BjJxsXby.js";import"./analytics-B8BYlogo.js";import"./plaid-CknlBCWN.js";import"./dnd-CTZ8xt4P.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bi_BmPss.js";import"./lexical-BmFHbDfb.js";import"./pdf-BUMfUQyN.js";import"./utils-l6Jt_9tl.js";import"./empty-8tyTORBQ.js";import"./pdf-lib-BiL5LzBn.js";import"./index-8DvIGOR_.js";import"./url-CK7SN0RL.js";import"./index-BU1P3OoO.js";import"./decodeURIComponentSafe-Bq-dYOxp.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]="c08af164-5c04-4610-8810-33ba1b562bd6",t._sentryDebugIdIdentifier="sentry-dbid-c08af164-5c04-4610-8810-33ba1b562bd6")}catch{}})();const J=z.div`
1
+ import{j as C}from"./liveblocks-CGYcZ7Lh.js";import{a}from"./sentry-DCGk37l1.js";import{h as D,u as v,g as u,N as w}from"./core-CNZua1e0.js";import{Ib as A,eM as O,fi as _,mh as j,fJ as E,fh as U,eN as L,Ij as F}from"./zeni-epic-state-eW2EQdSt.js";import{u as $,z as c,L as g,D as k,o as H}from"./index-Co04ey3-.js";import{n as z}from"./mui-DtCOffvy.js";import{t as R}from"./getLocaleForTenant-BYC6p0GO.js";import{g as P,Q as G}from"./QBOConnectionScreen-D6CMF20W.js";import"./recharts-Dq7pGiC-.js";import"./analytics-Cm9Z6TfJ.js";import"./plaid-DpI35xEc.js";import"./dnd-Dmzop572.js";import"./stripe-DMRn4zHo.js";import"./lottie-BoyaSool.js";import"./lexical-Dt1gfKRx.js";import"./pdf-DPV5Ar9D.js";import"./utils-DWAOcXZK.js";import"./empty-BLoZtodd.js";import"./pdf-lib-CE0iOBgb.js";import"./index-QWM1qpc0.js";import"./url-C3uYKzo6.js";import"./index-jE-fly2Z.js";import"./decodeURIComponentSafe-Dac6kcoy.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]="c08af164-5c04-4610-8810-33ba1b562bd6",t._sentryDebugIdIdentifier="sentry-dbid-c08af164-5c04-4610-8810-33ba1b562bd6")}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 d}from"./liveblocks-CGYcZ7Lh.js";import{z as n}from"./index-Co04ey3-.js";import{g as p}from"./QBOConnectionScreen-D6CMF20W.js";import"./sentry-DCGk37l1.js";import{u as a,N as i}from"./core-CNZua1e0.js";import"./zeni-epic-state-eW2EQdSt.js";import"./recharts-Dq7pGiC-.js";import"./mui-DtCOffvy.js";import"./analytics-Cm9Z6TfJ.js";import"./plaid-DpI35xEc.js";import"./dnd-Dmzop572.js";import"./stripe-DMRn4zHo.js";import"./lottie-BoyaSool.js";import"./lexical-Dt1gfKRx.js";import"./pdf-DPV5Ar9D.js";import"./utils-DWAOcXZK.js";import"./empty-BLoZtodd.js";import"./pdf-lib-CE0iOBgb.js";import"./index-QWM1qpc0.js";import"./url-C3uYKzo6.js";import"./index-jE-fly2Z.js";import"./decodeURIComponentSafe-Dac6kcoy.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]="b68d0d57-e81d-4cfb-97e6-d4dd5e5b7ebd",t._sentryDebugIdIdentifier="sentry-dbid-b68d0d57-e81d-4cfb-97e6-d4dd5e5b7ebd")}catch{}})();const U=()=>{const t=a(),{code:o,realmId:r,state:e}=p(t.search),s=n.getSignedInUser()?.userId??"";if(f(o,r,e,s)===!0){const m=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return d.jsx(i,{to:m})}return d.jsx(i,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-DXiLz49w.js";import{t as $e,A as Ce}from"./AddressScreen-eeo6LcCG.js";import ze from"./NotFoundScreen-DG_ouxiW.js";import{a as g}from"./sentry-C8WyuRaf.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 Me,n as Qe,o as M}from"./core-C_FlMzhB.js";import{E as de,S as le,z as B,s as ue,h as qe,c as _,r as V,v as H,d as N,B as je,f as X,ak as Ke,K as Je,al as Ie,j as te,am as Ze,an as ke,o as He,ao as We,ap as Ee,aq as Xe}from"./index-BabuXr6y.js";import{bm as Ye,eM as ee,fa as et,eS as pe,eQ as me,bu as tt,mf as at,f6 as nt,bL as ot,i_ as ae,j1 as ve,IX as st,bQ as it,b$ as ge,rG as fe,rr as rt,J7 as Y,rH as _e,GD as ct,k2 as Ue,J8 as Ve,J9 as dt,Ja as lt,Jb as ut,iY as pt,i$ as mt,rt as Be,rF as gt,bB as Te,cr as ft,rT as xe,pA as ht,po as yt,jW as St,fz as bt,fy as Ct,fx as It,Jc as kt,rl as Et,rU as Tt,rX as xt,r_ as Ot,s4 as Pt,cR as At}from"./zeni-epic-state-BP6Uj047.js";import{n as he}from"./mui-D4wswOer.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-CBYjGz6H.js";import"./recharts-BjJxsXby.js";import"./analytics-B8BYlogo.js";import"./plaid-CknlBCWN.js";import"./dnd-CTZ8xt4P.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bi_BmPss.js";import"./lexical-BmFHbDfb.js";import"./pdf-BUMfUQyN.js";import"./utils-l6Jt_9tl.js";import"./empty-8tyTORBQ.js";import"./pdf-lib-BiL5LzBn.js";import"./index-8DvIGOR_.js";import"./url-CK7SN0RL.js";import"./index-BU1P3OoO.js";import"./decodeURIComponentSafe-Bq-dYOxp.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]="5947ffaf-e56d-4c9a-b402-8027156a68b6",t._sentryDebugIdIdentifier="sentry-dbid-5947ffaf-e56d-4c9a-b402-8027156a68b6")}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"}})}}})(Ke),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=Ye(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),G=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),b=c.excludedResources,R=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=[],K=b?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,z=b?.resources?.find(l=>l.resource==="/reports/task_card")==null,Q=c?.userRole!=null&&tt(c?.userRole),v=b?.resources?.find(l=>l.resource==="/bills")==null&&!Q,q=b?.resources?.find(l=>l.resource==="/reimbursements")==null;if(K===!1&&A.push("top_expenses"),z===!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,R,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(H,{analytics:N,onLoad:l=>(J=>J.trackPageLoaded(X.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:G,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(je,{fetchState:"In-Progress",style:{backgroundColor:k.colors.grey5}})},Oe=he.div`
1
+ import{j as a}from"./liveblocks-CGYcZ7Lh.js";import{t as $e,A as Ce}from"./AddressScreen-BRfd-CkJ.js";import ze from"./NotFoundScreen-CQPWWkLY.js";import{a as g}from"./sentry-DCGk37l1.js";import{j as oe,u as se,h as ie,l as re,g as D,N as x,k as ce,i as Me,n as Qe,o as M}from"./core-CNZua1e0.js";import{v as de,S as le,z as B,i as ue,h as qe,c as _,n as V,y as H,d as N,x as je,f as X,ak as Ke,K as Je,al as Ie,j as te,am as Ze,an as ke,o as He,ao as We,ap as xe,aq as Xe}from"./index-Co04ey3-.js";import{bm as Ye,eM as ee,fa as et,eS as pe,eQ as me,bu as tt,mf as at,f6 as nt,bL as ot,i_ as ae,j1 as ve,IX as st,bQ as it,b$ as ge,rG as fe,rr as rt,J7 as Y,rH as _e,GD as ct,k2 as Ue,J8 as Ve,J9 as dt,Ja as lt,Jb as ut,iY as pt,i$ as mt,rt as Be,rF as gt,bB as Ee,cr as ft,rT as Te,pA as ht,po as yt,jW as bt,fz as St,fy as Ct,fx as It,Jc as kt,rl as xt,rU as Et,rX as Tt,r_ as Ot,s4 as Pt,cR as At}from"./zeni-epic-state-eW2EQdSt.js";import{n as he}from"./mui-DtCOffvy.js";import{g as Dt,h as Ft,q as ne}from"./QBOConnectionScreen-D6CMF20W.js";import"./recharts-Dq7pGiC-.js";import"./analytics-Cm9Z6TfJ.js";import"./plaid-DpI35xEc.js";import"./dnd-Dmzop572.js";import"./stripe-DMRn4zHo.js";import"./lottie-BoyaSool.js";import"./lexical-Dt1gfKRx.js";import"./pdf-DPV5Ar9D.js";import"./utils-DWAOcXZK.js";import"./empty-BLoZtodd.js";import"./pdf-lib-CE0iOBgb.js";import"./index-QWM1qpc0.js";import"./url-C3uYKzo6.js";import"./index-jE-fly2Z.js";import"./decodeURIComponentSafe-Dac6kcoy.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]="f2c31ff3-df79-4b94-a84b-c53db2878b9f",t._sentryDebugIdIdentifier="sentry-dbid-f2c31ff3-df79-4b94-a84b-c53db2878b9f")}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"}})}}})(Ke),jt=()=>{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(),f=Ye(i),{useFeatureGate:m}=ue(),k=qe(),{isFeatureEnabled:E}=m(_.isApAgingFeatureEnabled),{isFeatureEnabled:T}=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),G=L&&w,O=D(l=>l.onboardingCustomerViewState.fetchState),S=c.excludedResources,R=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=[],K=S?.resources?.find(l=>l.resource==="/reports/top_expenses")==null,z=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"),z===!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,R,c.tenantId,!0,!1,A)))},[d,O,j,P,i,c.tenantId,s]),g.useEffect(()=>{(j||P)&&setTimeout(()=>{b(!0)},5e3)},[j,P]),O!=="Completed")return a.jsx(x,{to:"../"});if(O==="Completed"&&p){const l=V(o.state?.pathnameStackToGoBack,o.pathname);if(j)return a.jsx(x,{to:"../../checking",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}});if(P)return a.jsx(x,{to:"../../cards",state:{...o.state,pathnameStackToGoBack:l,message:"activation"}})}return n?.loggedInUserRoleMap!=null?a.jsxs(a.Fragment,{children:[a.jsx(H,{analytics:N,onLoad:l=>(J=>J.trackPageLoaded(X.Event.onboardingDashboardActivation))(l)}),a.jsx(wt,{navigate:t,location:o,themeState:u,signedInUser:i,isApAgingFeatureEnabled:E,isArAgingFeatureEnabled:T,shouldFetchZeniAccountsPromoCard:I,shouldFetchRewardsPlanCard:h,isExpenseAutomationEnabledForUser:$,isExpenseAutomationFeatureEnabledV2:C,isTreasuryEnabled:G,loggedInUserRoleMap:n?.loggedInUserRoleMap})]}):a.jsx(je,{fetchState:"In-Progress",style:{backgroundColor:k.colors.grey5}})},Oe=he.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${t=>t.theme.colors.grey4};
@@ -16,8 +16,8 @@ import{j as a}from"./liveblocks-DXiLz49w.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:We.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(Y({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:G,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:G,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:G,companySourceOfFundsDescription:O,companySubIndustry:b,countriesOfOperations:R,purposeOfAccount:j,purposeOfAccountDescription:P,regulatedStatus:A,regulatedStatusDescription:K,transactionVolume:z,transactionVolumeDescription:Q,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:G?.selectedOption??"",companySourceOfFundsDescription:O,companySubIndustry:b?.selectedOption??"",countriesOfOperations:R?.selectedOptions.map(Z=>Z.length===2?Z:Ee(Z))??[],purposeOfAccount:j?.selectedOption??"",purposeOfAccountDescription:P,regulatedStatus:A??"",regulatedStatusDescription:K,transactionVolume:z?.selectedOption??"",transactionVolumeDescription:Q,usNexus:v,usNexusTypes:q?.selectedOptions??[]},J={userId:U,firstName:h.firstName,lastName:h.lastName,email:I,syncToken:C};t(xe({companyDetails:l,primaryContactDetails:J}))},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(Y({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})}}})(Ze),W=({taxCFOCustomer:t=!1,isOnAddressPage:o=!1,appContent:s})=>{const u=oe(),d=se(),r=ie(),p=Je(),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=Me("/: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),G=Ie(w.addCardPaymentSourceStatus.fetchState),O=w.addCardPaymentSourceStatus.fetchState,{code:b,realmId:R,state:j}=Dt(d.search),P=c.externalConnections?.accounting[0],A=P?.connectionType,K=P?.connectionName,z=P?.connectionId??"",Q=B.getSignedInUser()?.userId??"";g.useEffect(()=>{i||(f(!0),r(ae()))},[i,r]),g.useEffect(()=>{m||(ve(["card"]),k(!0))},[m]),g.useEffect(()=>{G==="In-Progress"&&O==="Completed"&&r(ae())},[G,O]),g.useEffect(()=>{Ft(b,R,j,z,Q)===!0&&c.externalConnections?.saveConnectionState!=="In-Progress"&&C==="Completed"&&(r(st(c.tenantId,{connection_type:A??"accounting",connection_name:K??"quickbooks_online",authorization_code:b,realm_id:R,connection_id:z,user_id:Q},it(window.location.origin+"/onboarding/auth"))),N.trackOnboardingSaveQBOConnection(R,z),u(d.pathname))},[b,R,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(Y({isQBOPopupOpen:!1}))},[c.externalConnections?.saveConnectionState]),g.useEffect(()=>{C==="Completed"&&U&&(r(_e({step:"qbo_connection"})),r(Y({isQBOPopupOpen:!0})))},[U,C]),g.useEffect(()=>{L==="Not-Started"&&r(ct(!0))},[L,r]);const J=Ie(l.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&l.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&J==null&&r(Ue({addressType:"company_registered_address",addressToCreate:l.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[l.companyDetailsLocalData?.addressStatus?.addressToCreate,l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Z=l.isInterimEmailSent;if(B.getSignedInUser()==null)throw Error("Can't access onboarding flow without signing in...");const Le=pe(h,c),Ge=me(c),ye=c.company?.companyOnboardingInfo.isOnboardingCompleted,Se=y=>y.trackPageLoaded(X.Event.onboardingPage),be=c.productSettings.isOtherProductsEnabled,Re=c.productSettings.isTreasuryEnabled;if(ye===!0){if(!be)return Re?a.jsx(E,{to:"../../treasury"}):Le?a.jsx(E,{to:"../../checking"}):Ge?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(H,{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 Z===!0?a.jsx(E,{to:"../../onboarding/thankyou"}):a.jsxs(Oe,{children:[a.jsx(H,{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=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:We.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:b}=u;return{onFetchLinkTokenClick:(e,n)=>{t(Pt(e,n))},onEstablishConnectionClick:(e,n)=>{t(Ot(e,n))},onUpdatePaymentAccountStatus:(e,n,i)=>{t(Tt(e,n,i))},onUpdatePaymentAccountLoginStatus:(e,n)=>{t(Et(!1,e,n))},onEstablishConnectionSuccess:()=>{t(xt(s,!0,!1))},handleOnConnectClick:()=>{N.trackOnboardingConnectQBO(),ne.handleClick()},updateQBOPopupState:e=>{t(Y({isQBOPopupOpen:e}))},onCompanyOfficerUpdated:e=>{const n=e.map(i=>{const{officerType:f,userId:m,name:k,email:E,ssn:T,nationalityCountryCode:I,dob:h,phone:U,syncToken:C,selectDocument:F,role:$,ownership:c,isSelectedForVerification:L,userVerificationStatus:w,fileIds:G,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:f,userId:m,firstName:k.firstName,lastName:k.lastName,email:E,ssn:T,nationalityCountryCode:I?.selectedOption!=null?xe(I.selectedOption):void 0,phone:U,birthday:h!=null?Ee(h?.toString()):h,syncToken:C,titleAtCompany:$.selectedOption,ownershipInCompany:c,documentTypeSelectedForVerification:S,isSelectedForVerification:L,userVerificationStatus:w,fileIds:G,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:O}});t(Te({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(ht(e,n.split(".")[0]))},onCompanyDetailsChanged:e=>{const{companyDescription:n,companyIndustry:i,companyIndustryType:f,companyLegalName:m,companyTaxId:k,companyWebsite:E,companyPhone:T,primaryContactEmail:I,primaryContactName:h,primaryContactUserId:U,primaryContactSyncToken:C,syncToken:F,fileIds:$,typeOfIncorporation:c,stateOfIncorporation:L,incDate:w,companySourceOfFunds:G,companySourceOfFundsDescription:O,companySubIndustry:S,countriesOfOperations:R,purposeOfAccount:j,purposeOfAccountDescription:P,regulatedStatus:A,regulatedStatusDescription:K,transactionVolume:z,transactionVolumeDescription:Q,usNexus:v,usNexusTypes:q}=e,l={companyId:s,companyDescription:n,companyIndustry:i.selectedOption,companyIndustryType:f?.selectedOption??"",companyLegalName:m,taxIdOrEIN:k,website:E!=""&&E!=null?ft(E):void 0,phone:T,syncToken:F,fileIds:$,incDate:w!=null?Ee(w?.toString()):w,typeOfIncorporation:c?.selectedOption??"",stateOfIncorporation:L?.selectedOption??"",companySourceOfFunds:G?.selectedOption??"",companySourceOfFundsDescription:O,companySubIndustry:S?.selectedOption??"",countriesOfOperations:R?.selectedOptions.map(Z=>Z.length===2?Z:xe(Z))??[],purposeOfAccount:j?.selectedOption??"",purposeOfAccountDescription:P,regulatedStatus:A??"",regulatedStatusDescription:K,transactionVolume:z?.selectedOption??"",transactionVolumeDescription:Q,usNexus:v,usNexusTypes:q?.selectedOptions??[]},J={userId:U,firstName:h.firstName,lastName:h.lastName,email:I,syncToken:C};t(Te({companyDetails:l,primaryContactDetails:J}))},onAddressClick:(e,n)=>{const i=De(b,e,n),f=V(p.state?.pathnameStackToGoBack,p.pathname);r(i,{state:{pathnameStackToGoBack:f}})},onRegisteredAddressClick:(e,n)=>{const i=De(b,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(Y({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})}}})(Ze),W=({taxCFOCustomer:t=!1,isOnAddressPage:o=!1,appContent:s})=>{const u=oe(),d=se(),r=ie(),p=Je(),b=de(),[e,n]=g.useState(!1),[i,f]=g.useState(!1),[m,k]=g.useState(!1),{tenantEmailDomain:E}=re(),T=le(),{useFeatureGate:I}=ue(),{isFeatureEnabled:h}=I(_.isDebitCardFeatureEnabled),U=Me("/: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),G=Ie(w.addCardPaymentSourceStatus.fetchState),O=w.addCardPaymentSourceStatus.fetchState,{code:S,realmId:R,state:j}=Dt(d.search),P=c.externalConnections?.accounting[0],A=P?.connectionType,K=P?.connectionName,z=P?.connectionId??"",Q=B.getSignedInUser()?.userId??"";g.useEffect(()=>{i||(f(!0),r(ae()))},[i,r]),g.useEffect(()=>{m||(ve(["card"]),k(!0))},[m]),g.useEffect(()=>{G==="In-Progress"&&O==="Completed"&&r(ae())},[G,O]),g.useEffect(()=>{Ft(S,R,j,z,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:R,connection_id:z,user_id:Q},it(window.location.origin+"/onboarding/auth"))),N.trackOnboardingSaveQBOConnection(R,z),u(d.pathname))},[S,R,j,d.pathname,C]),g.useEffect(()=>{ne.isInitiated===!1&&C==="Completed"&&ne.init("/onboarding/auth",c.tenantEmailDomain)},[C]);const v=c.companyId??B.getSignedInUserTenant(E)?.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(Y({isQBOPopupOpen:!1}))},[c.externalConnections?.saveConnectionState]),g.useEffect(()=>{C==="Completed"&&U&&(r(_e({step:"qbo_connection"})),r(Y({isQBOPopupOpen:!0})))},[U,C]),g.useEffect(()=>{L==="Not-Started"&&r(ct(!0))},[L,r]);const J=Ie(l.companyDetailsLocalData?.addressStatus);g.useEffect(()=>{l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&l.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&J==null&&r(Ue({addressType:"company_registered_address",addressToCreate:l.companyDetailsLocalData?.addressStatus?.addressToCreate}))},[l.companyDetailsLocalData?.addressStatus?.addressToCreate,l.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Z=l.isInterimEmailSent;if(B.getSignedInUser()==null)throw Error("Can't access onboarding flow without signing in...");const Le=pe(h,c),Ge=me(c),ye=c.company?.companyOnboardingInfo.isOnboardingCompleted,be=y=>y.trackPageLoaded(X.Event.onboardingPage),Se=c.productSettings.isOtherProductsEnabled,Re=c.productSettings.isTreasuryEnabled;if(ye===!0){if(!Se)return Re?a.jsx(x,{to:"../../treasury"}):Le?a.jsx(x,{to:"../../checking"}):Ge?a.jsx(x,{to:"../../cards"}):a.jsx(x,{to:"../../dashboard"});const y=l.updateStatus.fetchState==="In-Progress";if(Se&&!y)return t?a.jsxs(Oe,{children:[a.jsx(H,{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(x,{to:"../../onboarding/thankyou"})}else if(ye===!1&&T?.loggedInUserRoleMap!=null)return Z===!0?a.jsx(x,{to:"../../onboarding/thankyou"}):a.jsxs(Oe,{children:[a.jsx(H,{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=he.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"}})}}})(Xe),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(H,{analytics:N,onLoad:h=>{h.trackPageLoaded(X.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(H,{analytics:N,onLoad:h=>{h.trackPageLoaded(X.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(Qe,{children:[a.jsx(M,{path:"/",element:a.jsx(W,{})}),a.jsx(M,{path:"/billing/edit",element:a.jsx(W,{taxCFOCustomer:!0})}),a.jsx(M,{path:"/thankyou",element:a.jsx(vt,{})}),a.jsx(M,{path:"/activation",element:a.jsx(jt,{})}),a.jsx(M,{path:"/address/edit/:addressType/:addressId",element:a.jsx(W,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(M,{path:"/address/new/:addressType",element:a.jsx(W,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(M,{path:"*",element:a.jsx(ze,{})})]})}export{oa as default};
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 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"}})}}})(Xe),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(h=>ee(h)),f=i.productSettings.isOtherProductsEnabled;g.useEffect(()=>{o(Be(m,!1,!f))},[]);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),E=me(i),T=D(h=>h.onboardingCustomerViewState.updateStatus.fetchState),I=i.company?.companyOnboardingInfo.isOnboardingCompleted;return I!==!0||f?T==="Completed"&&I===!0&&f&&b?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(H,{analytics:N,onLoad:h=>{h.trackPageLoaded(X.Event.onboardingLandingPage,"Onboarding",At(i.productSettings))}}),a.jsx(we,{navigate:t,showUpdatePaymentDetailButton:f,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):T==="Completed"&&I===!1&&b?.loggedInUserRoleMap!=null?a.jsxs(Fe,{children:[a.jsx(H,{analytics:N,onLoad:h=>{h.trackPageLoaded(X.Event.onboardingInterimPage)}}),a.jsx(we,{navigate:t,showUpdatePaymentDetailButton:f,location:s,companyId:m,currentTenant:i,themeState:u,isVisitingFirstTime:e})]}):a.jsx(je,{fetchState:T}):k?a.jsx(x,{to:"../../checking"}):E?a.jsx(x,{to:"../../cards"}):a.jsx(x,{to:"../../dashboard"})};function oa(){return a.jsxs(Qe,{children:[a.jsx(M,{path:"/",element:a.jsx(W,{})}),a.jsx(M,{path:"/billing/edit",element:a.jsx(W,{taxCFOCustomer:!0})}),a.jsx(M,{path:"/thankyou",element:a.jsx(vt,{})}),a.jsx(M,{path:"/activation",element:a.jsx(jt,{})}),a.jsx(M,{path:"/address/edit/:addressType/:addressId",element:a.jsx(W,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(M,{path:"/address/new/:addressType",element:a.jsx(W,{isOnAddressPage:!0,appContent:a.jsx(Ce,{})})}),a.jsx(M,{path:"*",element:a.jsx(ze,{})})]})}export{oa as default};