@zeniai/web-app-ui 5.0.55-dev → 5.0.56-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 (113) hide show
  1. package/dist/assets/AddressRoutes-T4qftw_1.js +1 -0
  2. package/dist/assets/AddressScreen-BklJKutc.js +9 -0
  3. package/dist/assets/{AiCfoScreen-bBUSfHWB.js → AiCfoScreen-B4xK4s4e.js} +3 -3
  4. package/dist/assets/{BillPayApprovalRoutes-2hXuGhl9.js → BillPayApprovalRoutes-SfFy4Q3x.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-zS41FDXZ.js → BillPayRoutes-C_kzPWNw.js} +4 -4
  6. package/dist/assets/{BusinessVerificationPageScreen-Ct3skeMe.js → BusinessVerificationPageScreen-DgymQkoP.js} +2 -2
  7. package/dist/assets/{ChargeCardRoutes-CuAdoqYf.js → ChargeCardRoutes-DKy3Qza2.js} +8 -8
  8. package/dist/assets/CompanyPassportScreen-Q42ItsTK.js +1 -0
  9. package/dist/assets/{ConnectionAuthScreen-p0yF5-7Y.js → ConnectionAuthScreen-DWjSQZql.js} +1 -1
  10. package/dist/assets/CustomerOnboardingAuthScreen-CTfinB3p.js +1 -0
  11. package/dist/assets/{CustomerOnboardingRoutes-CpFbCHUf.js → CustomerOnboardingRoutes-BeIEf537.js} +4 -4
  12. package/dist/assets/{DashboardRoutes-DDAZzkgF.js → DashboardRoutes-DmT1zvbt.js} +3 -3
  13. package/dist/assets/{DefaultTenantHome-ChgUq64m.js → DefaultTenantHome-CkOir1h_.js} +1 -1
  14. package/dist/assets/{DomesticWireDetailScreen-ByrLTF-k.js → DomesticWireDetailScreen-Ba2RcbCG.js} +3 -3
  15. package/dist/assets/DrawerScreen-GbmWLeG7.js +1 -0
  16. package/dist/assets/{EntityDetailRoutes-QqB5pqCq.js → EntityDetailRoutes-EYGmcLTc.js} +1 -1
  17. package/dist/assets/{ExpenseAutomationRoutes-CL2KITKF.js → ExpenseAutomationRoutes-CO8PFCnO.js} +4 -4
  18. package/dist/assets/FeaturePreviewScreen-BbZ1xf4z.js +1 -0
  19. package/dist/assets/{MagicLinkRoutes-CBolYQjL.js → MagicLinkRoutes-CohCNxyX.js} +18 -18
  20. package/dist/assets/MagicLinkSignInScreen-B2CB3dkp.js +12 -0
  21. package/dist/assets/{MobileAppDrawer-BeJ-If8M.js → MobileAppDrawer-n8t03yaO.js} +1 -1
  22. package/dist/assets/NotFoundScreen-DpPEAqIa.js +1 -0
  23. package/dist/assets/{NotificationRoutes-B1POEpf-.js → NotificationRoutes-TwQiwNf3.js} +1 -1
  24. package/dist/assets/{PandLWithForecastRoutes-mNWJpjrX.js → PandLWithForecastRoutes-Wtfusoui.js} +1 -1
  25. package/dist/assets/{PeopleRoutes-Du_86K0g.js → PeopleRoutes-7E-ffjBJ.js} +5 -5
  26. package/dist/assets/PerformanceRoutes-CHrolr76.js +1 -0
  27. package/dist/assets/{Preview-CPDm5N-k.js → Preview-CktKjgWY.js} +1 -1
  28. package/dist/assets/{QBOConnectionScreen-BhcOl23Z.js → QBOConnectionScreen-DyznN-F2.js} +1 -1
  29. package/dist/assets/{ReferralListScreen-DEbwuGTl.js → ReferralListScreen-Dy8iQFPt.js} +2 -2
  30. package/dist/assets/{ReimbursementApprovalRoutes-BkkSOVv_.js → ReimbursementApprovalRoutes-BbOdeAtw.js} +1 -1
  31. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BcGzbUnN.js → ReimbursementApprovalRuleDetailScreen-DuDkeiAm.js} +1 -1
  32. package/dist/assets/{ReimbursementRoutes-CEjpsr8X.js → ReimbursementRoutes-BOMyJgrz.js} +4 -4
  33. package/dist/assets/{ReportsRoutes-UBnZ8bDz.js → ReportsRoutes-BSTB7uRz.js} +1 -1
  34. package/dist/assets/RewardsRoutes-vMUR4VOs.js +1 -0
  35. package/dist/assets/{ScreenRoutes-DtZbWTGl.js → ScreenRoutes-D4dqaFnm.js} +2 -2
  36. package/dist/assets/{SettingsRoutes-DCgs4OLl.js → SettingsRoutes-r9Ej5ZGq.js} +4 -4
  37. package/dist/assets/{SetupPagesScreen-BsOpxM3t.js → SetupPagesScreen-BaBZaUCN.js} +1 -1
  38. package/dist/assets/{SignInScreen-CY67jsy0.js → SignInScreen-Nl88Hc6C.js} +1 -1
  39. package/dist/assets/{SignOutScreen-5lq_Evk4.js → SignOutScreen-D4lUsOmx.js} +1 -1
  40. package/dist/assets/{TaskListScreen-DFdZjWgl.js → TaskListScreen-Bvnm9IXP.js} +2 -2
  41. package/dist/assets/{TaskRoutes-D1q4DIf6.js → TaskRoutes-BAXcXFEg.js} +2 -2
  42. package/dist/assets/TransactionDetailRoutes-DLz2n5Pp.js +1 -0
  43. package/dist/assets/{TransactionDetailScreen-uOgH9UNp.js → TransactionDetailScreen-BARgRHWT.js} +2 -2
  44. package/dist/assets/{TransactionListRoutes-BQchWm8T.js → TransactionListRoutes-FB1Nag0X.js} +1 -1
  45. package/dist/assets/{TreasuryRoutes-BtpbVTG-.js → TreasuryRoutes-D09j5H5F.js} +5 -5
  46. package/dist/assets/{VendorsRoutes-DZy6VVP0.js → VendorsRoutes-CMOWuwxW.js} +1 -1
  47. package/dist/assets/WiseConfirmationScreen-BburOEIH.js +12 -0
  48. package/dist/assets/{ZeniAccountRoutes-CQIW5-uh.js → ZeniAccountRoutes-CvMBgZsl.js} +10 -10
  49. package/dist/assets/ZeniAccountStatementScreen-CqjHqKdC.js +9 -0
  50. package/dist/assets/{accountMappingHelper-CQSFsM6N.js → accountMappingHelper-BOSY12FJ.js} +1 -1
  51. package/dist/assets/{analytics-ByrfXPqG.js → analytics-CcGmsyc8.js} +1 -1
  52. package/dist/assets/{analyticsHelper-BZYQYc1O.js → analyticsHelper-DJMvFBQ1.js} +1 -1
  53. package/dist/assets/{core-DcM32IW_.js → core-DkPdadc6.js} +1 -1
  54. package/dist/assets/{decodeURIComponentSafe-mAxyJdJ8.js → decodeURIComponentSafe-h3wJzOm1.js} +1 -1
  55. package/dist/assets/{dnd-36WXho_9.js → dnd-D-YvLFfj.js} +1 -1
  56. package/dist/assets/{empty-GSTAUqhH.js → empty-C7PzWdR6.js} +1 -1
  57. package/dist/assets/{empty-lHXrwReA.js → empty-ohi5JxHm.js} +1 -1
  58. package/dist/assets/{emptyVideoElement-Bsa6If51.js → emptyVideoElement-B09QwhYv.js} +1 -1
  59. package/dist/assets/epic-DC-PDk7m.js +2 -0
  60. package/dist/assets/getLocaleForTenant-FjCgXmXO.js +1 -0
  61. package/dist/assets/{index-Bw9qJkeB.js → index-8VSOxL6k.js} +1 -1
  62. package/dist/assets/{index-CR2DVZE0.js → index-BIUa1dNl.js} +2 -2
  63. package/dist/assets/{index-Dq0r4E9j.js → index-BVoPsTXN.js} +1 -1
  64. package/dist/assets/{index-DSBNuTzQ.js → index-CpD5ML2i.js} +12483 -12422
  65. package/dist/assets/{index-p7Us2Fcf.js → index-CxVN3Ojx.js} +1 -1
  66. package/dist/assets/{index-DTGcnfLC.js → index-DHz0Faq_.js} +1 -1
  67. package/dist/assets/{index-CjaQ8-D2.js → index-ufE2I9Jb.js} +1 -1
  68. package/dist/assets/{lexical-CYAYrhLa.js → lexical-Sc7rk4Y7.js} +1 -1
  69. package/dist/assets/{liveblocks-BeS4QmMp.js → liveblocks-tcXs1fes.js} +1 -1
  70. package/dist/assets/{lottie-Bdncx-qB.js → lottie-CwApzZxI.js} +1 -1
  71. package/dist/assets/{mui--qrGbwFJ.js → mui-DbdGpDJj.js} +1 -1
  72. package/dist/assets/{pathToGoBack-Cn4t6MOa.js → pathToGoBack-D9y2NyzP.js} +1 -1
  73. package/dist/assets/{pdf-6nmWWkz8.js → pdf-DG2fyOfp.js} +4 -4
  74. package/dist/assets/{pdf-lib-rQgtUIvp.js → pdf-lib-fmjHY_Su.js} +1 -1
  75. package/dist/assets/{plaid-BZ0BFqP0.js → plaid-UeHpA8su.js} +1 -1
  76. package/dist/assets/{pusher-4QLniNXV.js → pusher-CH-5kFcN.js} +1 -1
  77. package/dist/assets/{react-DKUlDjBa.js → react-BTMxDr8F.js} +1 -1
  78. package/dist/assets/{react-DCTwOcr5.js → react-CAp_bFar.js} +1 -1
  79. package/dist/assets/{react-BszWSDWQ.js → react-CFEMacjg.js} +1 -1
  80. package/dist/assets/{react-BOWjwOm8.js → react-CjW2GUTT.js} +1 -1
  81. package/dist/assets/{react-C3zOniDH.js → react-D3qpynvt.js} +1 -1
  82. package/dist/assets/{react-BFaux__7.js → react-P8ikJhK3.js} +1 -1
  83. package/dist/assets/{recharts-DoWl4vaN.js → recharts-D0a4NFa9.js} +1 -1
  84. package/dist/assets/{routePaths-Dr0mF--c.js → routePaths-D7wc65Bl.js} +1 -1
  85. package/dist/assets/{sentry-BlmJH5WH.js → sentry-DNuKG-9f.js} +1 -1
  86. package/dist/assets/{url-BG92tf7R.js → url-Bxb4Dr7g.js} +1 -1
  87. package/dist/assets/{url-AJ2wpRsW.js → url-EFuL_PC5.js} +1 -1
  88. package/dist/assets/useAskAiCfoHostNavButtonProps-BtZXhZ4f.js +1 -0
  89. package/dist/assets/{useDeviceId-DaD3aMiS.js → useDeviceId-DoEHbao8.js} +1 -1
  90. package/dist/assets/useFetchSuggestedQuestionsWhenReady-Bhmav9DR.js +1 -0
  91. package/dist/assets/{useInitialThreadRequest-82Lo2xWZ.js → useInitialThreadRequest-DId3URPK.js} +1 -1
  92. package/dist/assets/{utils-RmRP6xA4.js → utils-BmJyX3cx.js} +1 -1
  93. package/dist/assets/{withTransactionSidePanel-ClKqbF5a.js → withTransactionSidePanel-CzkV98Uv.js} +1 -1
  94. package/dist/assets/{zeni-epic-state-ChnjRetZ.js → zeni-epic-state-CSoWjbAn.js} +3 -3
  95. package/dist/index.html +1 -1
  96. package/package.json +3 -3
  97. package/dist/assets/AddressRoutes-DNt7Duo0.js +0 -1
  98. package/dist/assets/AddressScreen-he1e1kGg.js +0 -9
  99. package/dist/assets/CompanyPassportScreen-DOP3-8BK.js +0 -1
  100. package/dist/assets/CustomerOnboardingAuthScreen-VyI92nJg.js +0 -1
  101. package/dist/assets/DrawerScreen-CRCi_azE.js +0 -1
  102. package/dist/assets/FeaturePreviewScreen-PkNswvQo.js +0 -1
  103. package/dist/assets/MagicLinkSignInScreen-D6iPjuvI.js +0 -12
  104. package/dist/assets/NotFoundScreen-BQueQzhs.js +0 -1
  105. package/dist/assets/PerformanceRoutes-CX1dBnw2.js +0 -1
  106. package/dist/assets/RewardsRoutes-q5pGdj79.js +0 -1
  107. package/dist/assets/TransactionDetailRoutes-D9aq9a6c.js +0 -1
  108. package/dist/assets/WiseConfirmationScreen-DvTv7iw3.js +0 -12
  109. package/dist/assets/ZeniAccountStatementScreen-DfMsxUlV.js +0 -9
  110. package/dist/assets/epic-DhZTt5cl.js +0 -2
  111. package/dist/assets/getLocaleForTenant-h7G676lL.js +0 -1
  112. package/dist/assets/useAskAiCfoHostNavButtonProps-DDxvherx.js +0 -1
  113. package/dist/assets/useFetchSuggestedQuestionsWhenReady-SU-quGCv.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-BeS4QmMp.js";import{j as ue,l as la,h as me,g as S,u as ye,k as ge,N as ya,q as mt,n as Jt,o as te}from"./core-DcM32IW_.js";import{eN as ie,bs as Be,NZ as _a,eR as Se,eS as Ie,eT as Ae,fO as Me,cq as ze,N_ as $e,N$ as $a,sL as Sa,jy as Ia,O0 as Aa,gC as ca,zd as aa,zf as Ga,zg as Ya,jo as Ct,O1 as Ge,z1 as pt,O2 as Xt,O3 as Qt,z4 as wa,O4 as en,Mq as Pa,qX as ht,za as Za,gN as an,O5 as ft,O6 as Ye,bq as tn,O7 as nn,fz as Ta,fy as Fa,zK as rn,fx as va,M6 as sn,O8 as gt,cj as bt,cL as on,Mp as ua,Ak as cn,O9 as rt,zW as Oa,Oa as yt,Al as dn,MQ as ln,Am as un,Bg as mn,s5 as Cn,Ba as pn,zv as St,zo as hn,Ob as fn,fQ as gn,zE as It,zI as At,fP as bn,Oc as yn,A6 as Et,Od as Sn,Oe as In,Of as An,zG as kt,zr as Dt,z7 as _t,zA as wt,zy as Pt,zC as En,ze as st,Og as Tt,Oh as xa,zT as Ea,J5 as Ft,cM as Ka,Oi as kn,Oj as Dn,Ok as _n,Ol as wn,zQ as Ha,Ad as Pn,A9 as Tn,zM as Fn,Ab as vn,A1 as On,A3 as xn,Om as vt,Aj as Ot,GD as Bn,On as Ln,Oo as Rn,Op as Un,Oq as xt,Or as jn,AG as Nn,zV as Bt,zP as da,zU as Vn,Os as Hn,Ot as Mn,y_ as zn,Ou as Lt,Ov as Rt,Ow as $n,z0 as Gn,y$ as ot,Ox as Yn,Oy as Zn,Oz as Kn,J1 as Wn,OA as Wa,OB as qn,vB as Ut,k6 as Jn,gD as Xn,AL as Qn,OC as jt,OD as er,AM as ar,OE as tr,dc as nr,sF as rr,AB as sr,Av as xe,bv as or,bD as ir,cv as cr,bE as dr,Ik as lr}from"./zeni-epic-state-ChnjRetZ.js";import{z as Q,k as Re,a as oe,p as Z,B as Ze,bY as Ba,c7 as ur,r as ve,c8 as mr,c9 as Cr,q as ma,aJ as Fe,v as be,bf as qa,ca as pr,F as Ca,j as La,h as Ja,d as J,D as Xa,cb as hr,M as Nt,am as Qa,br as Qe,cc as Ma,cd as fr,C as et,a2 as gr,ce as br,ap as Vt,R as za,N as Ht,f as Mt,cf as yr,cg as Sr,ch as Ir,ci as Ar,cj as Er,o as ka,ck as kr,cl as Dr,cm as ja,y as _r,cn as wr,co as Pr,cp as Tr,cq as Fr,a5 as vr}from"./index-DSBNuTzQ.js";import{n as _e,D as zt,S as Or}from"./mui--qrGbwFJ.js";import{a as c}from"./sentry-BlmJH5WH.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 xr,h as at,P as Br,i as tt,s as ea,j as Gt,k as He,l as Yt,m as Lr,n as Zt,p as Rr,S as it}from"./SetupPagesScreen-BsOpxM3t.js";import Ra from"./NotFoundScreen-BQueQzhs.js";import{M as ha}from"./MobileAppDrawer-BeJ-If8M.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-DDxvherx.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-SU-quGCv.js";import{v as ct}from"./utils-RmRP6xA4.js";import{t as Ur}from"./AddressScreen-he1e1kGg.js";import"./recharts-DoWl4vaN.js";import"./analytics-ByrfXPqG.js";import"./plaid-BZ0BFqP0.js";import"./dnd-36WXho_9.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bdncx-qB.js";import"./lexical-CYAYrhLa.js";import"./pdf-6nmWWkz8.js";import"./analyticsHelper-BZYQYc1O.js";import"./routePaths-Dr0mF--c.js";import"./BusinessVerificationPageScreen-Ct3skeMe.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]="3158504b-dcd0-403b-a083-8e6e08ab7378",e._sentryDebugIdIdentifier="sentry-dbid-3158504b-dcd0-403b-a083-8e6e08ab7378")}catch{}})();function jr(){const e=ue(),{cardId:t}=la(),a=me(),r=Q.getSignedInUser(),n=S(G=>ie(G)),u=Re(),m=Be(u?.loggedInUserRoleMap),{useFeatureGate:C}=oe();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=S(G=>_a(G).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const D=n.userRole.includes("charge_card_user"),{isFeatureEnabled:A}=C(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:B}=C(Z.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(B,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,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],O=S(G=>y!=null?Ia(G.classState,{classId:y,reportId:"class_list"}):void 0),$=U?.cardHolderUser?.userId,R=S(G=>$!=null?Sa(G.userRoleState,$):void 0),Y=R?.accountingClassIDs[0],E=S(G=>Y!=null?Ia(G.classState,{classId:Y,reportId:"class_list"}):void 0),q=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",K=U?.type.code==="business_physical_debit_card";c.useEffect(()=>{i&&I===!1&&q&&(o(!0),setTimeout(()=>{a(Aa()),K&&a(ca({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))},5e3))},[i,I,q,K]),c.useEffect(()=>{_||d.fetchState==="Completed"||d.fetchState==="In-Progress"||t==null||(F(!0),a(aa(t,p,!1)))},[_,d,t,a]),c.useEffect(()=>{if(d.fetchState==="Completed"&&(q===!1||q&&U?.status?.code!=="active"||U?.cardHolderUserId!==r.userId||i===!1&&I===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const G=fe(n.tenantEmailDomain,t,r,U,i);e(G)}},[d.fetchState,i,q]),c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&l&&f&&m&&a(Ya()),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),x=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ze,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:x,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:N,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:O?.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(Xt({uiState:{sortKey:t,sortOrder:a}}))}}})(Cr);function Vr(){const e=ue(),t=me(),a=ye(),r=Q.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=Q.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=>Qt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:L}=oe(),{isFeatureEnabled:j}=L(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=L(Z.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 O=Q.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),R=()=>{l?.status?.code!=="active"&&a(Za(n,!0))};c.useEffect(()=>{g.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&D===!1&&(setTimeout(R,3e3),A(!0))},[g.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Y=E=>{B(E)};if(w!=="Completed"||l==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if($?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Y}),s.jsx($r,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:$.phone,signedInUser:v,isSandboxEnv:qa(),chargeCardDetailState:g,signedInUserToken:O,navigate:r,currentTenant:k,location:u,maxChargeCardActivationAttempts:b[n]!=null?b[n]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Y(!0)}}),e!=null?s.jsx(Gr,{windowSize:t,children:e}):null]})},$r=ge(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const u=an(e.addressState,a);if(u==null)throw Error("Can't access shippingAddress.");const m=ft(e,n),C=t.updateStatus,I=Ye(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(tn())||i,showMenuIcon:o,shippingAddress:u,vgsVaultId: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&&Q.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-tcXs1fes.js";import{j as ue,l as la,h as me,g as S,u as ye,k as ge,N as ya,q as mt,n as Jt,o as te}from"./core-DkPdadc6.js";import{eN as ie,bs as Be,NZ as _a,eR as Se,eS as Ie,eT as Ae,fO as Me,cq as ze,N_ as $e,N$ as $a,sL as Sa,jy as Ia,O0 as Aa,gC as ca,zd as aa,zf as Ga,zg as Ya,jo as Ct,O1 as Ge,z1 as pt,O2 as Qt,O3 as Xt,z4 as wa,O4 as en,Mq as Pa,qX as ht,za as Za,gN as an,O5 as ft,O6 as Ye,bq as tn,O7 as nn,fz as Ta,fy as Fa,zK as rn,fx as va,M6 as sn,O8 as gt,cj as bt,cL as on,Mp as ua,Ak as cn,O9 as rt,zW as Oa,Oa as yt,Al as dn,MQ as ln,Am as un,Bg as mn,s5 as Cn,Ba as pn,zv as St,zo as hn,Ob as fn,fQ as gn,zE as It,zI as At,fP as bn,Oc as yn,A6 as Et,Od as Sn,Oe as In,Of as An,zG as kt,zr as Dt,z7 as _t,zA as wt,zy as Pt,zC as En,ze as st,Og as Tt,Oh as xa,zT as Ea,J5 as Ft,cM as Ka,Oi as kn,Oj as Dn,Ok as _n,Ol as wn,zQ as Ha,Ad as Pn,A9 as Tn,zM as Fn,Ab as vn,A1 as On,A3 as xn,Om as vt,Aj as Ot,GD as Bn,On as Ln,Oo as Un,Op as Rn,Oq as xt,Or as jn,AG as Nn,zV as Bt,zP as da,zU as Vn,Os as Hn,Ot as Mn,y_ as zn,Ou as Lt,Ov as Ut,Ow as $n,z0 as Gn,y$ as ot,Ox as Yn,Oy as Zn,Oz as Kn,J1 as Wn,OA as Wa,OB as qn,vB as Rt,k6 as Jn,gD as Qn,AL as Xn,OC as jt,OD as er,AM as ar,OE as tr,dc as nr,sF as rr,AB as sr,Av as xe,bv as or,bD as ir,cv as cr,bE as dr,Ik as lr}from"./zeni-epic-state-CSoWjbAn.js";import{z as X,j as Ue,a as oe,p as Z,B as Ze,bY as Ba,c7 as ur,m as ve,c8 as mr,c9 as Cr,q as ma,aJ as Fe,r as be,bf as qa,ca as pr,E as Ca,i as La,h as Ja,d as J,D as Qa,cb as hr,M as Nt,am as Xa,br as Xe,cc as Ma,cd as fr,x as et,a2 as gr,ce as br,ap as Vt,U as za,Q as Ht,f as Mt,cf as yr,cg as Sr,ch as Ir,ci as Ar,cj as Er,o as ka,ck as kr,cl as Dr,cm as ja,$ as _r,cn as wr,co as Pr,cp as Tr,cq as Fr,a5 as vr}from"./index-CpD5ML2i.js";import{n as _e,D as zt,S as Or}from"./mui-DbdGpDJj.js";import{a as c}from"./sentry-DNuKG-9f.js";import{g as fe,a as pa,b as $t,c as Ee,d as ke,e as Le,f as Re,A as xr,h as at,P as Br,i as tt,s as ea,j as Gt,k as He,l as Yt,m as Lr,n as Zt,p as Ur,S as it}from"./SetupPagesScreen-BaBZaUCN.js";import Ua from"./NotFoundScreen-DpPEAqIa.js";import{M as ha}from"./MobileAppDrawer-n8t03yaO.js";import{u as Kt}from"./useAskAiCfoHostNavButtonProps-BtZXhZ4f.js";import{c as Wt}from"./useFetchSuggestedQuestionsWhenReady-Bhmav9DR.js";import{v as ct}from"./utils-BmJyX3cx.js";import{t as Rr}from"./AddressScreen-BklJKutc.js";import"./recharts-D0a4NFa9.js";import"./analytics-CcGmsyc8.js";import"./plaid-UeHpA8su.js";import"./dnd-D-YvLFfj.js";import"./stripe-DMRn4zHo.js";import"./lottie-CwApzZxI.js";import"./lexical-Sc7rk4Y7.js";import"./pdf-DG2fyOfp.js";import"./analyticsHelper-DJMvFBQ1.js";import"./routePaths-D7wc65Bl.js";import"./BusinessVerificationPageScreen-DgymQkoP.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]="076edd1f-e708-4776-aa9c-12547b7987dd",e._sentryDebugIdIdentifier="sentry-dbid-076edd1f-e708-4776-aa9c-12547b7987dd")}catch{}})();function jr(){const e=ue(),{cardId:t}=la(),a=me(),r=X.getSignedInUser(),n=S(G=>ie(G)),u=Ue(),m=Be(u?.loggedInUserRoleMap),{useFeatureGate:C}=oe();if(r==null)throw Error("Can't access Add To Wallet Page without signing in...");const[I,o]=c.useState(!1),i=S(G=>_a(G).firstViewAfterActivation);if(t==null)throw Error("Empty card id is not valid...");const D=n.userRole.includes("charge_card_user"),{isFeatureEnabled:A}=C(Z.isChargeCardFeatureEnabled),f=!!n.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:B}=C(Z.isDebitCardFeatureEnabled),v=Se(n),k=Ie(n),h=Ae(B,n),b=n.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,g=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:h}),l=ke({isCardsOnlyTenant:v,isChargeCardFeatureEnabled:A,isBookKeepingTenant:k,isDebitCardProductVisible:g,chargeCardsCreditAccountLimit:b}),w=!!n.companyDebitCardInfo?.info?.isDebitCardEnabled,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),R=d.chargeCard,M=R?.cardCreatedByUser?.userId,W=S(G=>M!=null?Sa(G.userRoleState,M):void 0),y=W?.accountingClassIDs[0],O=S(G=>y!=null?Ia(G.classState,{classId:y,reportId:"class_list"}):void 0),$=R?.cardHolderUser?.userId,U=S(G=>$!=null?Sa(G.userRoleState,$):void 0),Y=U?.accountingClassIDs[0],E=S(G=>Y!=null?Ia(G.classState,{classId:Y,reportId:"class_list"}):void 0),q=R?.type.code==="business_physical_credit_card"||R?.type.code==="business_physical_debit_card",K=R?.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&&R?.status?.code!=="active"||R?.cardHolderUserId!==r.userId||i===!1&&I===!1||R?.type.code==="business_physical_debit_card"||R?.type.code==="business_virtual_debit_card")){const G=fe(n.tenantEmailDomain,t,r,R,i);e(G)}},[d.fetchState,i,q]),c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&l&&f&&m&&a(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&l&&f&&m&&a(Ya()),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=R?.type.code==="business_physical_debit_card"||R?.type.code==="business_virtual_debit_card",ae=Le(l,g,w,f),x=pa(l,f,m,T,P),pe=$t(Ce,d);return d.fetchState!=="Completed"?s.jsx(Ze,{fetchState:"In-Progress"}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:i}),s.jsx(ur,{onGotItClick:z,isDebitCard:R?.type.code==="business_physical_debit_card",controllerEmails:j,isChargeCardFeatureEnabled:l,isDebitCardFeatureEnabled:g,isDebitCardSetupEnabled:w,isChargeCardSetupEnabled:f,productInformation:ae,creditAccountInformation:x,debitAccountInformation:pe,chargeCardDetailView:d,creditAccount:T,classListFetchState:N,creditAccountRepayment:P,cardIssuedByRoles:W?.userRoles,cardIssuedByDepartmentName:O?.className,cardHolderRoles:U?.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=X.getSignedInUser(),n=S(o=>ie(o)),[u,m]=c.useState(!1),C=S(o=>Ge(o)),I=c.useCallback(()=>{const o=ve(a.state?.pathnameStackToGoBack),i=o.poppedPathname??Hr(n.tenantEmailDomain);e(i,{state:{pathnameStackToGoBack:o.newStack}})},[e,a,n.tenantEmailDomain]);if(c.useEffect(()=>{u||C.fetchState==="Completed"||C.fetchState==="In-Progress"||(m(!0),t(pt()))},[u,C,t]),r==null)throw Error("Can't access cashback detail page without signing in...");return C.fetchState==="In-Progress"?s.jsx(mr,{onBackClick:I}):C.cashbackSummary.cashbackEarned.amount===0&&C.fetchState==="Completed"?s.jsx(Ua,{}):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=X.getSignedInUser();if(v==null)throw Error("Can't access onboarding card page without signing in...");const k=S(E=>ie(E));if(n==null)throw Error("Empty card id is not valid...");const{configValue:h}=m(Fe.zeniCardsConfig),b=h.max_charge_card_activation_attempts_by_card_id,g=S(E=>Xt(E,n)),l=g.chargeCard,w=S(E=>E.chargeCardConfigState.fetchState),{useFeatureGate:L}=oe(),{isFeatureEnabled:j}=L(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:T}=L(Z.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),R=k.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,M=ke({isCardsOnlyTenant:_,isChargeCardFeatureEnabled:j,isBookKeepingTenant:F,isDebitCardProductVisible:N,chargeCardsCreditAccountLimit:R}),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 O=X.getZeniOtpTokenForCardHolder(n),$=S(E=>ht(E.userState,v.userId)),U=()=>{l?.status?.code!=="active"&&a(Za(n,!0))};c.useEffect(()=>{g.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&l?.cardActivationAttemptHistory.some(E=>E.statusCode==="success")===!0&&D===!1&&(setTimeout(U,3e3),A(!0))},[g.updatePhysicalChargeCardAttemptFetchState.fetchState,l?.cardActivationAttemptHistory]);const Y=E=>{B(E)};if(w!=="Completed"||l==null)return s.jsx(Ze,{fetchState:"In-Progress"});if(l.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if($?.phone==null)throw Error("Can't access user phone number.");return s.jsxs(Yr,{children:[s.jsx(ha,{isAppContentDrawerOpen:f,handleDrawerToggle:Y}),s.jsx($r,{cardId:n,card:l,shippingAddressId:l.shippingAddressId,phone:$.phone,signedInUser:v,isSandboxEnv:qa(),chargeCardDetailState:g,signedInUserToken:O,navigate:r,currentTenant:k,location:u,maxChargeCardActivationAttempts:b[n]!=null?b[n]:h.default_max_charge_card_activation_attempts!=null?h.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:h.charge_card_cashback_rate_per_transaction!=null?h.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Y(!0)}}),e!=null?s.jsx(Gr,{windowSize:t,children:e}):null]})},$r=ge(function(e,{chargeCardDetailState:t,shippingAddressId:a,location:r,cardId:n}){const u=an(e.addressState,a);if(u==null)throw Error("Can't access shippingAddress.");const m=ft(e,n),C=t.updateStatus,I=Ye(e,!1,!1,!1);let o=!1;I.fetchState==="Completed"&&I.cards.length<=1&&(o=!0);const i=r.state?.message==="comingFromV2UrlPath";return{showActivatePage:t.chargeCard?.providerCardCreateTime!=null&&t.chargeCard.providerCardCreateTime.add(24,"h").isBefore(tn())||i,showMenuIcon:o,shippingAddress:u,vgsVaultId: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&&X.saveZeniOtpTokenForCardHolder(o,r)},onCVVActivateSuccess:()=>{e(nn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("onboard")===!0?Re(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-BeS4QmMp.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=Xa.getLocalizedStrings().dateFormat,Zr={overlayWidth:new Ca(100,100,58)},Kr=ge(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:ln(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:un(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:u,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:D,cashbackInformation:A,paymentSourceInformation:f,creditAccountInformation:B,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&J.trackCardsPayEarlyFormClick(o,D,A,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:k?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:k?.format(Da.visual.MMMDCommaYYYYformat)},f,B,v),h==="cardPaymentHistory")t.closeDrawerHandler(!0),e(yt());else{const g=Ue(b);a(g)}},onUpdatePaymentAccountStatus:(g,l,w)=>{e(pn(g,l,"bill_pay","bill_pay_detail",w))},onEstablishConnectionSuccess:()=>{e(Oa(r.companyId,!0))},onFetchLinkTokenClick:g=>{e(Cn("external_account",g))},onEstablishConnectionClick:g=>{e(mn(g,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${b}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{u?window.open(`/${b}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(hr),nt=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:u,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:D,paymentInitiatedDate:A,retryRepayment:f})=>{const B=ue(),{useDynamicConfig:v}=oe(),{configValue:k}=v(Fe.zeniAccountsConfig),h=sn(k),b=S(z=>gt(z)),{creditAccount:g}=S(z=>$e(z)),l=S(z=>ie(z)),w=Ja(),L=ma(),j=me(),T=Q.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??xr,M=bt(P?.loggedInUserRoleMap),W=on(P?.loggedInUserRoleMap),y=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,O=S(z=>ua(z,l.companyId)),$=O.companyChargeCardInfo?.primaryFundingAccount,R=O.allFundingAccounts.find(z=>z.id===$?.accountId),Y=S(z=>Me(z,l.companyId)),E=ze(Y.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(x=>x.id===z);let ae;if(u==="cardPaymentHistory"&&f){const x=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:x??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(()=>{O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&j(Oa(l.companyId,!0))},[O.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&J.trackCardsPayEarlyPayNowClick(E,n,I,b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:A?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:A?.format(Da.visual.MMMDCommaYYYYformat)},q,m,C)},[b.updateStatus,I,D,i,o,A]),c.useEffect(()=>{b.fetchState==="Completed"&&I!=null&&D&&i&&o&&!N&&e&&d&&I!=null&&(J.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,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:Zr.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&&J.trackCardsPayEarlyFormClick(E,n,I,"Pay Now",b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},q,m,C),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(Or)`
14
+ `,Da=Qa.getLocalizedStrings().dateFormat,Zr={overlayWidth:new Ca(100,100,58)},Kr=ge(function(e,t){const a=t.currentTenant?.companyId;return{plaidConnectionDetails:ln(e,a,"zeni_accounts","external_account").plaidConnectionDetails,depositAccountListView:un(e.depositAccountState,e.depositAccountListState)}},function(e,t){const{navigate:a,currentTenant:r,hasZeniAccountsAdminAccess:n,isZeniAccountsUser:u,isCashbackInfoFetchStateCompleted:m,isCreditCardInfoFetchStateCompleted:C,isDebitCardInfoFetchStateCompleted:I,controllerEmails:o,paymentDetails:i,productInformation:D,cashbackInformation:A,paymentSourceInformation:f,creditAccountInformation:B,debitAccountInformation:v,paymentInitiatedDate:k,sourcePage:h}=t,{tenantEmailDomain:b}=r;return{onBackNavigation:()=>{if(m&&C&&I&&A!=null&&J.trackCardsPayEarlyFormClick(o,D,A,"Back",i.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:i.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:i.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:i.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:i.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:k?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:k?.format(Da.visual.MMMDCommaYYYYformat)},f,B,v),h==="cardPaymentHistory")t.closeDrawerHandler(!0),e(yt());else{const g=Re(b);a(g)}},onUpdatePaymentAccountStatus:(g,l,w)=>{e(pn(g,l,"bill_pay","bill_pay_detail",w))},onEstablishConnectionSuccess:()=>{e(Oa(r.companyId,!0))},onFetchLinkTokenClick:g=>{e(Cn("external_account",g))},onEstablishConnectionClick:g=>{e(mn(g,r.companyId,"charge_card_payment","charge_cards"))},onSignUpAccountClick:()=>{n?window.open(`/${b}/checking/promo`,"_blank"):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")},onMoveMoneyClick:()=>{u?window.open(`/${b}/checking/transfer`):window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}})(hr),nt=({isPaymentDrawerOpen:e,closeDrawerHandler:t,pageName:a,creditAccountSpentAmount:r,productInformation:n,sourcePage:u,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isDebitCardInfoFetchStateCompleted:o,isCreditCardInfoFetchStateCompleted:i,isCashbackInfoFetchStateCompleted:D,paymentInitiatedDate:A,retryRepayment:f})=>{const B=ue(),{useDynamicConfig:v}=oe(),{configValue:k}=v(Fe.zeniAccountsConfig),h=sn(k),b=S(z=>gt(z)),{creditAccount:g}=S(z=>$e(z)),l=S(z=>ie(z)),w=Ja(),L=ma(),j=me(),T=X.getSignedInUser(),P=Ue(),[N,p]=c.useState(!1),[d,_]=c.useState(!1),{configValue:F}=v(Fe.zeniCardsConfig),R=F.credit_card_auto_pay_threshold_by_company_id?.[l.companyId]??F.default_credit_card_auto_pay_threshold??xr,M=bt(P?.loggedInUserRoleMap),W=on(P?.loggedInUserRoleMap),y=!!l.companyZeniAccountInfo?.info?.isZeniAccountEnabled,O=S(z=>ua(z,l.companyId)),$=O.companyChargeCardInfo?.primaryFundingAccount,U=O.allFundingAccounts.find(z=>z.id===$?.accountId),Y=S(z=>Me(z,l.companyId)),E=ze(Y.controllers);c.useEffect(()=>{if(b.fetchState!=="Completed"&&b.fetchState!=="In-Progress"&&j(cn()),b.fetchState==="Completed"&&!d){const z=l.companyChargeCardInfo?.info?.primaryFundingAccount?.accountId,Ce=b.transferFromAccounts.find(x=>x.id===z);let ae;if(u==="cardPaymentHistory"&&f){const x=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:x??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:U?.accType==="depositAccount",creditCardPaymentSourceAccountName:U?.label,creditCardPaymentSourceAccountType:U?.accType,creditCardPaymentSourceLastFourDigits:U?.accountLast4,creditCardPaymentSourceBalance:U?.accountBalance?.available?.amount??0};if(c.useEffect(()=>{O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&j(Oa(l.companyId,!0))},[O.fetchState]),c.useEffect(()=>{b.updateStatus==="Completed"&&I!=null&&D&&i&&o&&J.trackCardsPayEarlyPayNowClick(E,n,I,b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:A?.add(3,"day").format(Da.visual.MMMDCommaYYYYformat),paymentInitiatedDate:A?.format(Da.visual.MMMDCommaYYYYformat)},q,m,C)},[b.updateStatus,I,D,i,o,A]),c.useEffect(()=>{b.fetchState==="Completed"&&I!=null&&D&&i&&o&&!N&&e&&d&&I!=null&&(J.trackCardsPayEarlyFormView(E,n,I,a,l.companyChargeCardInfo?.info?.isAutoPayEnabled??!1,g.balance.amount,q,m,C),p(!0))},[b,D,i,o,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:Zr.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&&J.trackCardsPayEarlyFormClick(E,n,I,"Pay Now",b.chargeCardRepaymentDetailLocalData.isAutoRepayment,{paymentAmount:b.chargeCardRepaymentDetailLocalData.amount.amount,paymentAccountName:b.chargeCardRepaymentDetailLocalData.transferFrom?.label,paymentAccountType:b.chargeCardRepaymentDetailLocalData.transferFrom?.accType,paymentAccountLastFourDigits:b.chargeCardRepaymentDetailLocalData.transferFrom?.accountLast4,paymentCompleteEta:void 0,paymentInitiatedDate:void 0},q,m,C),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:R,paymentSourceInformation:q,creditAccountInformation:m,debitAccountInformation:C,cashbackInformation:I,isCashbackInfoFetchStateCompleted:D,isCreditCardInfoFetchStateCompleted:i,isDebitCardInfoFetchStateCompleted:o,paymentInitiatedDate:A,maxInsuredAmount:h.maxInsuredAmount})})})})},Wr=_e(Or)`
15
15
  display: flex;
16
16
  min-height: 100%;
17
17
  flex-direction: column;
18
- `,qt="charge-card-transaction-update",Na=Xa.getLocalizedStrings().dateFormat,qr=ge(function(e,t){const{includeCreditAccountInfo:a,cardId:r,signedInUserToken:n,isChargeCardFeatureEnabled:u}=t,m=Q.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(Za(a,!0)),e(st(a,null,null,!0)))},onReloadTransactions:()=>{e(aa(a,C,v))},onFetchChargeCardTransactionList:(h,b)=>{e(st(a,h,b))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{m!=null&&e(va(h,"ChargeCardHolder",a))},onResendOtp:h=>{m!=null&&e(Fa(h,"ChargeCardHolder",a))},onVerifyOtp:(h,b)=>{m!=null&&e(Ta(h,b,"ChargeCardHolder",a))},onVerifyOtpSuccess:h=>{h!=null&&Q.saveZeniOtpTokenForCardHolder(h,a)},onColorCodeChange:h=>{e(En(a,h))},onLockChargeCard:(h,b)=>{e(Pt(h,a,b))},onUnlockChargeCard:h=>{e(wt(h,a))},onCloseChargeCard:h=>{e(_t(a,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Dt([a]))},updateChargeCardName:(h,b)=>{e(kt(h,a,b))},updateChargeCardTransactionAttachments:(h,b)=>{b!=null&&e(An({transactionId:h,data:b}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,b,g,l)=>{e(In({chargeCardId:b,transactionId:h,fetchState:g,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,b,g)=>{e(Sn({chargeCardId:b,transactionId:h,shouldShowTick:g}))},onChargeCardRevokeInviteClick:()=>{e(Et(a))},updateChargeCardTransactionIsViewReceiptClicked:(h,b,g)=>{e(yn({chargeCardId:b,transactionId:h,isViewReceiptClicked:g}))},onChargeCardTransactionRowClick:(h,b)=>{const g=be(u.state?.pathnameStackToGoBack,u.pathname);n(`../../transaction/${h}/${b}`,{state:{pathnameStackToGoBack:g}})},onBackClick:()=>{const h=ve(u.state?.pathnameStackToGoBack),b=Ue(k);n(b,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(bn())},onUpdateDebitCardPinAttempt:h=>{e(At(a,h)),h==="success"&&e(ca({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,b)=>{h?e(ca({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):b!=null&&e(ca({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b.message}]}))},updateSpendLimit(h,b,g,l){e(It(h,b,g.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&D!=null&&J.trackCardsPayEarlyClick(o,i,D,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:A?.accType==="depositAccount",creditCardPaymentSourceAccountName:A?.label,creditCardPaymentSourceAccountType:A?.accType,creditCardPaymentSourceLastFourDigits:A?.accountLast4,creditCardPaymentSourceBalance:A?.accountBalance?.available?.amount??0},f,B),I(h)}}})(gr(br));function Jr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=Q.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(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=w(Z.isDebitCardFeatureEnabled),T=Ae(j,i),P=Ee({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:T}),{isFeatureEnabled:N}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Z.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 O=S(V=>ua(V,i.companyId)),{creditAccount:$,creditAccountRepayment:R}=S(V=>$e(V)),Y=Q.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)),x=E.chargeCard,pe=Re(),G=Be(pe?.loggedInUserRoleMap),ce=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_virtual_debit_card",we=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_physical_credit_card",re=x?.type.code==="business_virtual_debit_card"||x?.type.code==="business_virtual_credit_card",ne=x?.type.code==="business_virtual_debit_card",de=pa(U,W,G,$,R),X=$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=>x?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,x?.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=>x?.cardHolderUser?.userId!=null?Sa(V.userRoleState,x?.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,Oe=S(V=>Ye(V,!1,P,L).revokeCardInvite),na=Qa(Oe.saveStatus.fetchState);if(c.useEffect(()=>{if(na==="In-Progress"&&Oe.saveStatus.fetchState==="Completed"){const V=Ue(i.tenantEmailDomain);e(V)}},[na,Oe.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})),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&t(Oa(i.companyId,!0))},[ae.fetchState,t,G,A,E.transactionStatistics.fetchState,O.fetchState]),c.useEffect(()=>{if(!(E.fetchState!=="Completed"||U&&$.fetchState!=="Completed"||x==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=x.type.code.includes("physical"),he=V?x.cardActivationAttemptHistory[0]?.timestamp:x.createTime;J.trackCardsCardDetailView(We,je,{cardId:r,cardName:x.cardName,cardType:x.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Qe(x.limit.amount),cardLastFourDigits:x.accountLast4,cardStatus:x.status.code,cardAssignedDate:x.createTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:x.providerCardCreateTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:x.creditLimitFrequency.name,cardSpentAmount:Qe(x.balance.amount),cardAvailableLimit:Qe(x.available.amount),cardUtilizationPercent:x.limit.amount>0?Math.round((x.limit.amount-x.available.amount)/x.limit.amount*100):0,cardUtilizationAmount:Qe(x.limit.amount-x.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(x.cardCreatedByUser,!1),cardIssuedByEmail:x.cardCreatedByUser?.email,cardIssuedByUserId:x.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(x.cardHolderUser,!1),cardholderEmail:x.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:x.cardHolderUser?.userId,cardholderDepartment:ta?.className},de,X)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,$.fetchState,G]),o==null)throw Error("Can't access card detail page without signing in...");const Je=i.companyId??Q.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Je!=null?[`private-${Je}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&x!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:Ne,frequency:Xe,cardColor:H}=Va(x),De=x.cardHolderUserId===o.userId;J.trackCardsDetailPageViewed(r,V,he,Te,Ne,Xe,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,x,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:Xe,limit:H,frequency:De}=Va(x),Ve=x.cardHolderUserId===o.userId;J.trackCardsDetailPageClicked(r,Te,Ne,Xe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:Xe,limit:H,frequency:De}=Va(x),Ve=x.cardHolderUserId===o.userId;J.trackCardsVerifyPopUpClick(r,Te,Ne,Xe,H,De,V,Ve,he)}},Ua=$.balance.amount+$.hold.amount,ga=i.companyChargeCardInfo?.info?.primaryFundingAccount,ba=O.allFundingAccounts.find(V=>V.id===ga?.accountId);return r==null||E.fetchState==="Error"?s.jsx(Ra,{}):E.fetchState==="In-Progress"||E.fetchState==="Not-Started"||Oe.saveStatus.fetchState==="In-Progress"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(fr,{}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:J,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:je,creditAccountInformation:de,debitAccountInformation:X,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:X,cashbackInformation:Ke,classListFetchState:A,primaryFundingAccountDetails:ba,currentTenant:i,cardProviderId:E.chargeCard?.cardProviderID,cardId:r,creditAccount:$,creditAccountRepayment:R,includeCreditAccountInfo:y,signedInUserToken:Y,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce,isCardsCommentingEnabled:p})]})}const Va=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,u=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:u,limit:n}},Xr=_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=X.getSignedInUser(),C=e.tenantState.currentTenantId,I={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:C??""},o=$a(e,r,a,u),i=fn(e,r),D=gn(e);return{chargeCardDetailView:o,chargeCardsRecurringExpensesState:i,vgsVaultId: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(Za(a,!0)),e(st(a,null,null,!0)))},onReloadTransactions:()=>{e(aa(a,C,v))},onFetchChargeCardTransactionList:(h,b)=>{e(st(a,h,b))},onUpdateScrollYOffset:h=>{},onGetOtp:h=>{m!=null&&e(va(h,"ChargeCardHolder",a))},onResendOtp:h=>{m!=null&&e(Fa(h,"ChargeCardHolder",a))},onVerifyOtp:(h,b)=>{m!=null&&e(Ta(h,b,"ChargeCardHolder",a))},onVerifyOtpSuccess:h=>{h!=null&&X.saveZeniOtpTokenForCardHolder(h,a)},onColorCodeChange:h=>{e(En(a,h))},onLockChargeCard:(h,b)=>{e(Pt(h,a,b))},onUnlockChargeCard:h=>{e(wt(h,a))},onCloseChargeCard:h=>{e(_t(a,h))},onFetchChargeCardsRecurringExpenses:()=>{e(Dt([a]))},updateChargeCardName:(h,b)=>{e(kt(h,a,b))},updateChargeCardTransactionAttachments:(h,b)=>{b!=null&&e(An({transactionId:h,data:b}))},updateChargeCardTransactionUploadReceiptsFetchStatus:(h,b,g,l)=>{e(In({chargeCardId:b,transactionId:h,fetchState:g,error:l}))},updateChargeCardTransactionReceiptsShowTick:(h,b,g)=>{e(Sn({chargeCardId:b,transactionId:h,shouldShowTick:g}))},onChargeCardRevokeInviteClick:()=>{e(Et(a))},updateChargeCardTransactionIsViewReceiptClicked:(h,b,g)=>{e(yn({chargeCardId:b,transactionId:h,isViewReceiptClicked:g}))},onChargeCardTransactionRowClick:(h,b)=>{const g=be(u.state?.pathnameStackToGoBack,u.pathname);n(`../../transaction/${h}/${b}`,{state:{pathnameStackToGoBack:g}})},onBackClick:()=>{const h=ve(u.state?.pathnameStackToGoBack),b=Re(k);n(b,{state:{pathnameStackToGoBack:h.newStack,message:"comingFromCardDetail"}})},removeSnackbar:()=>{e(bn())},onUpdateDebitCardPinAttempt:h=>{e(At(a,h)),h==="success"&&e(ca({messageSection:"update_debit_card_pin_attempt",messageText:"success",type:"success",showStatusIcon:!0}))},onUploadReceiptComplete:(h,b)=>{h?e(ca({messageSection:"charge_card_receipt_upload",messageText:"success",type:"success",showStatusIcon:!0})):b!=null&&e(ca({messageSection:"charge_card_receipt_upload",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:b.message}]}))},updateSpendLimit(h,b,g,l){e(It(h,b,g.code,l))},shouldOpenCreditCardPaymentDrawer(h){h&&D!=null&&J.trackCardsPayEarlyClick(o,i,D,"Card Detail","Text Button","Pay Now",{isZeniCheckingEnabled:r.company?.companyZeniAccountInfo.isZeniAccountEnabled??!1,isZeniCheckingPaymentSource:A?.accType==="depositAccount",creditCardPaymentSourceAccountName:A?.label,creditCardPaymentSourceAccountType:A?.accType,creditCardPaymentSourceLastFourDigits:A?.accountLast4,creditCardPaymentSourceBalance:A?.accountBalance?.available?.amount??0},f,B),I(h)}}})(gr(br));function Jr(){const e=ue(),t=me(),a=ye(),{cardId:r}=la(),[n,u]=c.useState(!1),[m,C]=c.useState(!1),{useDynamicConfig:I}=oe(),o=X.getSignedInUser(),i=S(V=>ie(V)),D=S(V=>_a(V).firstViewAfterActivation),A=S(V=>V.classListState.fetchState),{configValue:f}=I(Fe.documentAiReceiptMaxSizeLimitBytesConfig),{configValue:B}=I(Fe.zeniCardsConfig),v=B.enable_card_controls_for_company_ids,k=B.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(v)&&v.includes(i.companyId),[h,b]=c.useState(!1),[g,l]=c.useState(!1),{useFeatureGate:w}=oe(),{isFeatureEnabled:L}=w(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:j}=w(Z.isDebitCardFeatureEnabled),T=Ae(j,i),P=Ee({isDebitCardFeatureEnabled:j,isBankingOnlyTenant:T}),{isFeatureEnabled:N}=w(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:p}=w(Z.isCardsCommentingEnabled),d=Ie(i),_=Se(i),F=i.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,R=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")&&R&&W;if(r==null)throw Error("Empty card id is not valid...");const O=S(V=>ua(V,i.companyId)),{creditAccount:$,creditAccountRepayment:U}=S(V=>$e(V)),Y=X.getZeniOtpTokenForCardHolder(r),E=S(V=>$a(V,r,y,R)),{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)),x=E.chargeCard,pe=Ue(),G=Be(pe?.loggedInUserRoleMap),ce=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_virtual_debit_card",we=x?.type.code==="business_physical_debit_card"||x?.type.code==="business_physical_credit_card",re=x?.type.code==="business_virtual_debit_card"||x?.type.code==="business_virtual_credit_card",ne=x?.type.code==="business_virtual_debit_card",de=pa(R,W,G,$,U),Q=$t(ce,E),Ke=at(G,ae),je=Le(R,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=>x?.cardCreatedByUser?.userId!=null?Sa(V.userRoleState,x?.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=>x?.cardHolderUser?.userId!=null?Sa(V.userRoleState,x?.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,Oe=S(V=>Ye(V,!1,P,L).revokeCardInvite),na=Xa(Oe.saveStatus.fetchState);if(c.useEffect(()=>{if(na==="In-Progress"&&Oe.saveStatus.fetchState==="Completed"){const V=Re(i.tenantEmailDomain);e(V)}},[na,Oe.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,R,!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})),O.fetchState!=="Completed"&&O.fetchState!=="In-Progress"&&t(Oa(i.companyId,!0))},[ae.fetchState,t,G,A,E.transactionStatistics.fetchState,O.fetchState]),c.useEffect(()=>{if(!(E.fetchState!=="Completed"||R&&$.fetchState!=="Completed"||x==null||E.transactionStatistics.fetchState!=="Completed"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed")){const V=x.type.code.includes("physical"),he=V?x.cardActivationAttemptHistory[0]?.timestamp:x.createTime;J.trackCardsCardDetailView(We,je,{cardId:r,cardName:x.cardName,cardType:x.type.code.includes("credit")?"credit":"debit",cardCategory:V?"physical":"virtual",cardLimit:Xe(x.limit.amount),cardLastFourDigits:x.accountLast4,cardStatus:x.status.code,cardAssignedDate:x.createTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardIssuedDate:x.providerCardCreateTime?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardActivatedDate:he?.format(Na.analytics.MMMDashDDDashYYYYFormat),cardLimitFrequency:x.creditLimitFrequency.name,cardSpentAmount:Xe(x.balance.amount),cardAvailableLimit:Xe(x.available.amount),cardUtilizationPercent:x.limit.amount>0?Math.round((x.limit.amount-x.available.amount)/x.limit.amount*100):0,cardUtilizationAmount:Xe(x.limit.amount-x.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(x.cardCreatedByUser,!1),cardIssuedByEmail:x.cardCreatedByUser?.email,cardIssuedByUserId:x.cardCreatedByUser?.userId,cardIssuedByRole:qe?.userRoles,cardIssuedByDepartment:fa?.className},{cardholderName:Ma(x.cardHolderUser,!1),cardholderEmail:x.cardHolderUser?.email,cardholderRole:se?.userRoles,cardholderUserId:x.cardHolderUser?.userId,cardholderDepartment:ta?.className},de,Q)}},[E.fetchState,E.depositAccountLimitFetchState.fetchState,E.transactionStatistics.fetchState,$.fetchState,G]),o==null)throw Error("Can't access card detail page without signing in...");const Je=i.companyId??X.getSignedInUserTenant(i.tenantEmailDomain)?.companyId,ra={events:Je!=null?[`private-${Je}.${qt}`]:[],eventCallback:(V,he,Te)=>{Te.onEventReceived(V)}},sa=()=>{if(r!=null&&x!=null){const{ownerName:V,cardName:he,utilisation:Te,limit:Ne,frequency:Qe,cardColor:H}=Va(x),De=x.cardHolderUserId===o.userId;J.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,x,D);e(he)}}},[E.fetchState]);const oa=(V,he)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(x),Ve=x.cardHolderUserId===o.userId;J.trackCardsDetailPageClicked(r,Te,Ne,Qe,H,De,V,Ve,he)}},ia=(V,he)=>{if(r!=null&&x!=null){const{ownerName:Te,cardName:Ne,utilisation:Qe,limit:H,frequency:De}=Va(x),Ve=x.cardHolderUserId===o.userId;J.trackCardsVerifyPopUpClick(r,Te,Ne,Qe,H,De,V,Ve,he)}},Ra=$.balance.amount+$.hold.amount,ga=i.companyChargeCardInfo?.info?.primaryFundingAccount,ba=O.allFundingAccounts.find(V=>V.id===ga?.accountId);return r==null||E.fetchState==="Error"?s.jsx(Ua,{}):E.fetchState==="In-Progress"||E.fetchState==="Not-Started"||Oe.saveStatus.fetchState==="In-Progress"||ce&&G&&E.depositAccountLimitFetchState.fetchState!=="Completed"?s.jsx(fr,{}):s.jsxs(s.Fragment,{children:[s.jsx(Ba,{showConfetti:D}),E.fetchState==="Completed"?s.jsx(et,{analytics:J,onLoad:sa}):null,m===!0?s.jsx(nt,{closeDrawerHandler:()=>C(!1),isPaymentDrawerOpen:m,pageName:"Card Detail",sourcePage:"cardDetailPage",productInformation:je,creditAccountInformation:de,debitAccountInformation:Q,cashbackInformation:Ke,creditAccountSpentAmount:Ra,isDebitCardInfoFetchStateCompleted:!ce||!G||E.depositAccountLimitFetchState.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!R||$.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!G||ae.fetchState==="Completed",paymentInitiatedDate:U.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:R,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:U,includeCreditAccountInfo:y,signedInUserToken:Y,appleWalletLink:"shoebox://",googleWalletLink:"https://www.android.com/payapp/",documentAiReceiptMaxSizeLimit:f.documentAiReceiptMaxSizeLimitBytes!=null?f.documentAiReceiptMaxSizeLimitBytes:9437184,isAiCfoAccessEnabled:z,onAskAiCfoClick:Ce,isCardsCommentingEnabled:p})]})}const Va=e=>{const t=`${e.cardHolderUser?.firstName.toLowerCase()} ${e.cardHolderUser?.lastName.toLowerCase()}`,a=e.cardName,r=(e.limit.amount??0)-(e.available.amount??0),n=e.limit.amount,u=e.creditLimitFrequency.name;return{ownerName:t,cardName:a,utilisation:r,cardColor:e.cardColorCode??"",frequency:u,limit:n}},Qr=_e.div`
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
- `,Qr=ge(function(e,t){const a=Ye(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:kn(e),bulkActionView:Dn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:u,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:C,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:A,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:B,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:L,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:N}=m;return{onChargeCardRowClick:(p,d)=>{const _=Yt(N,p);let F;_!=null&&((M=>{const W=M.limit.amount-M.available.amount,y=`${M.cardHolderUser?.firstName.toLowerCase()} ${M.cardHolderUser?.lastName.toLowerCase()}`,O=M.cardName,$=M.department?.className??"",R=M.limit.amount,Y=M.creditLimitFrequency.name;J.trackCardsListRowClicked(y,O,$,W,R,Y,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&J.trackCardsCardListRowClick(v,g,"Card Row Item","row_clicked",d+1,{cardOwner:Ma(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Qe(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Qe(_.limit.amount)},l,w,L)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Zt(P):fe(P,p,u,_);const U=be(n.state?.pathnameStackToGoBack,n.pathname);a(F,{state:{pathnameStackToGoBack:U}})},onFetchChargeCardsRecurringExpenses:p=>{e(Dt(p))},onFetchDepositAccountLimit:p=>{e(St({depositAccountId:p}))},onChargeCardResendInviteClick:p=>{e(xn(p))},onChargeCardRevokeInviteClick:p=>{e(Et(p))},onLockChargeCardList:(p,d)=>{e(On(p,d))},onUnlockChargeCardList:p=>{e(vn(p))},onCloseChargeCardList:(p,d)=>{e(Fn(p,d))},onRevokeChargeCardList:p=>{e(Tn(p))},updateChargeCardListSpendLimit(p,d,_){e(Pn(p,d,_.code))},onLockChargeCard:(p,d)=>{e(Pt(T,p,d))},onUnlockChargeCard:p=>{e(wt(T,p))},onCloseChargeCard:(p,d)=>{e(_t(p,d))},onUpdateSpendLimit(p,d,_,F){e(It(p,d,_.code,F))},updateChargeCardName:(p,d)=>{e(kt(T,p,d))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&J.trackCardsSettingsClick(v,g,l,w,L);const p=Lr(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&J.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,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&&J.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&&J.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,L),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&J.trackCardsStatementsClick(v,g,l,w,L),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&J.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&&J.trackCardsPayEarlyClick(v,g,l,"Card List",p,d,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},w,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(Q.getPayNowInfoTooltip()??!1),o=H=>{Q.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=Q.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(Z.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:U}=P(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Z.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),O=Se(f),$=Ie(f),R=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Y=ke({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:R}),E=Gt({isCardsOnlyTenant:O,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),x=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=Qa(ne.updateStatus),X=S(H=>Ye(H,j,y&&T,Y&&re)),Ke=X.cards.filter(H=>H.type.code.includes("debit")).map(H=>H.connectedAccountId),je=[...new Set(Ke)],Pe=S(H=>Ge(H)),ee=S(H=>xa(H,je)),We=S(H=>ua(H,f.companyId)),qe=We.companyChargeCardInfo?.primaryFundingAccount,fa=We.allFundingAccounts.find(H=>H.id===qe?.accountId),se=X.fetchState,ta=X.creditAccount;Wt({isDataReady:se==="Completed"});const{creditAccountRepayment:le}=S(H=>$e(H)),Oe=S(H=>_a(H).firstViewAfterActivation),{areTenantIdsInSync:na}=Ht(),Je=at(z,Pe),ra=pa(Y,re,z,ta,le),sa=tt(y,T,z,ee,X.debitCardSummary),oa=Le(Y,y,T,re),ia=X.creditAccount.balance.amount+X.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(Q.getPayNowInfoTooltip()==null||ia<pe*X.creditAccount.limit.amount/100)&&o(!0)},[se,pe,ia,X.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,Y&&re,!1)))},[B,j,a,na]),c.useEffect(()=>{Oe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[Oe,i]),c.useEffect(()=>{se==="Completed"&&L&&X.cards.length===1&&(X.cards[0].status.code==="inactive"&&X.cards[0].type.code==="business_physical_credit_card"?n(`./${X.cards[0].id}/activate`):X.cards[0].status.code!=="request_on_hold"&&(r.state?.message==="comingFromCardDetail"?n("../../"):n(`./${X.cards[0].id}`)))},[se,L,r.state,n,X.cards]),c.useEffect(()=>{if(se==="Completed"&&L){const H=X.cards.length,De=X.cards.filter(Ve=>Ve.cardHolderUserId===A?.userId).filter(Ve=>Ve.status.code==="request_on_hold");De.length>0&&H===De.length&&n("./onboard")}},[se,X.cards,L,n,A?.userId]),c.useEffect(()=>{se!=="Completed"||Y&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||J.trackCardsCardListView(ae,oa,Je,ra,sa)},[se,ta,le.fetchState,ee.fetchState,z]),A==null)throw Error("Can't access charge card list page without signing in...");const Ua=S(H=>Ft(H.userState,H.userRoleState,H.userListViewState,"cardAdmin")),ga=Ka(K?.loggedInUserRoleMap),ba=H=>{h(H)},V=X.creditAccount.limit,he=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:Y,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),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:J,onLoad:()=>{J.trackPageLoaded(Mt.Event.cardsListPage),(Y&&!re||y&&!T)&&J.trackCardsPromoView(ae,{isCreditCardOffered:Y,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Y&&!re?"Credit Card":"","Card List")}}),s.jsx(Ba,{showConfetti:Oe})]}):null,u===!0?s.jsx(nt,{closeDrawerHandler:he,isPaymentDrawerOpen:u,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:ia,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Y||le.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!z||Pe.fetchState==="Completed",paymentInitiatedDate:le.initiatedRepaymentDate}):null,s.jsxs(Xr,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:ba}),s.jsx(Qr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Y,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:E,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:C,creditCardPayNowThreshold:pe,signedInUser:A,chargeCardListState:X,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:x,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||Ne?s.jsx(ya,{to:"../promo"}):s.jsx(Ze,{fetchState:se})}const es=e=>`/${e}/cards/new`,as=e=>`/${e}/cards/payment`,ts=e=>`/${e}/cards/payment-history`,ns=ge(function(e){const t=Q.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(Ot(!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(Q.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const u=S(K=>ie(K)),m=S(K=>vt(K)),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Z.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),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=>Ye(K,v,l&&k,T&&P)),_=c.useMemo(()=>{const K=d.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(K.map(z=>z.connectedAccountId))]},[d.cards]),F=S(K=>Ge(K)),U=S(K=>xa(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]),O=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,Y=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{B(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),B(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{C||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(Ot()))},[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:O,cashbackInformation:W,isDebitCardInfoFetchStateCompleted:!(l&&k&&p)||U.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!T||M.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!p||F.fetchState==="Completed",paymentInitiatedDate:M.initiatedRepaymentDate,retryRepayment:Y}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
25
+ `,Xr=ge(function(e,t){const a=Ye(e,t.includeCreditAccountDebitSummaryAndCashbackInfo,t.isDebitCardFeatureEnabled&&t.isDebitCardSetupEnabled,t.isChargeCardFeatureEnabled&&t.isChargeCardSetupEnabled);return{chargeCardListView:a,rowActionView:kn(e),bulkActionView:Dn(e),companyLegalName:t.currentTenant.companyName,admins:t.admins,searchText:a.searchText,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigateAndClearBulkSelection:a,currentTenant:r,location:n,signedInUser:u,chargeCardListState:m,includeCreditAccountDebitSummaryAndCashbackInfo:C,isChargeCardFeatureEnabled:I,isCreditCardProductVisibleForExpressInterest:o,isChargeCardSetupEnabled:i,isDebitCardFeatureEnabled:D,isDebitCardSetupEnabled:A,isDebitCardTOSAccepted:f,isChargeCardTOSAccepted:B,controllerEmails:v,depositAccountListWithDebitCardIssued:k,primaryFundingAccountDetails:h,chargeCardSetUpViewFetchState:b,productInformation:g,cashbackInformation:l,creditAccountInformation:w,debitAccountInformation:L,updatePayNowInfoTooltip:j,isUserHasCardsAdminLevelAccess:T}=t,{tenantEmailDomain:P}=r,{cards:N}=m;return{onChargeCardRowClick:(p,d)=>{const _=Yt(N,p);let F;_!=null&&((M=>{const W=M.limit.amount-M.available.amount,y=`${M.cardHolderUser?.firstName.toLowerCase()} ${M.cardHolderUser?.lastName.toLowerCase()}`,O=M.cardName,$=M.department?.className??"",U=M.limit.amount,Y=M.creditLimitFrequency.name;J.trackCardsListRowClicked(y,O,$,W,U,Y,u.userId===M.cardHolderUserId)})(_),He(D,A,k)&&J.trackCardsCardListRowClick(v,g,"Card Row Item","row_clicked",d+1,{cardOwner:Ma(_.cardHolderUser,!1),cardName:_.cardName,cardType:_.type.code.includes("credit")?"credit":"debit",cardStatus:_.status.code,cardUtilizationAmount:Xe(_.limit.amount-_.available.amount),cardUtilizationPercent:_.limit.amount>0?Math.round((_.limit.amount-_.available.amount)/_.limit.amount*100):0,cardLimit:Xe(_.limit.amount)},l,w,L)),F=_?.status.code==="request_on_hold"&&u.userId===_.cardHolderUserId?Zt(P):fe(P,p,u,_);const R=be(n.state?.pathnameStackToGoBack,n.pathname);a(F,{state:{pathnameStackToGoBack:R}})},onFetchChargeCardsRecurringExpenses:p=>{e(Dt(p))},onFetchDepositAccountLimit:p=>{e(St({depositAccountId:p}))},onChargeCardResendInviteClick:p=>{e(xn(p))},onChargeCardRevokeInviteClick:p=>{e(Et(p))},onLockChargeCardList:(p,d)=>{e(On(p,d))},onUnlockChargeCardList:p=>{e(vn(p))},onCloseChargeCardList:(p,d)=>{e(Fn(p,d))},onRevokeChargeCardList:p=>{e(Tn(p))},updateChargeCardListSpendLimit(p,d,_){e(Pn(p,d,_.code))},onLockChargeCard:(p,d)=>{e(Pt(T,p,d))},onUnlockChargeCard:p=>{e(wt(T,p))},onCloseChargeCard:(p,d)=>{e(_t(p,d))},onUpdateSpendLimit(p,d,_,F){e(It(p,d,_.code,F))},updateChargeCardName:(p,d)=>{e(kt(T,p,d))},onClickSetupIcon:()=>{J.trackCardsListPageClicked("settings"),He(D,A,k)&&l!=null&&J.trackCardsSettingsClick(v,g,l,w,L);const p=Lr(P),d=be(n.state?.pathnameStackToGoBack,n.pathname);a(p,{state:{pathnameStackToGoBack:d}})},onIssueCardClick:()=>{J.trackCardsListPageClicked("new card"),He(D,A,k)&&l!=null&&J.trackCardsNewCardClick(v,g,l,"New Button","card_creation_initiated","Card List",w,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&&J.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&&J.trackCardsCashbackOverviewClick(v,g,l,"Cashback Overview","cashback_details_viewed",w,L),a("./cashback")},onClickStatementsIcon:()=>{He(D,A,k)&&l!=null&&J.trackCardsStatementsClick(v,g,l,w,L),a("./statements")},onCreateNowClick:p=>{He(D,A,k)&&l!=null&&J.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&&J.trackCardsPayEarlyClick(v,g,l,"Card List",p,d,{isZeniCheckingEnabled:r.company.companyZeniAccountInfo.isZeniAccountEnabled,isZeniCheckingPaymentSource:h?.accType==="depositAccount",creditCardPaymentSourceAccountName:h?.label,creditCardPaymentSourceAccountType:h?.accType,creditCardPaymentSourceLastFourDigits:h?.accountLast4,creditCardPaymentSourceBalance:h?.accountBalance?.available?.amount??0},w,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(X.getPayNowInfoTooltip()??!1),o=H=>{X.savePayNowInfoTooltip(H),I(H)},[i,D]=c.useState(!1),A=X.getSignedInUser(),f=S(H=>ie(H)),[B,v]=c.useState(!1),[k,h]=c.useState(!1),{isAiCfoOpen:b,setIsAiCfoOpen:g}=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(Z.isCashbackFeatureEnabled),{isFeatureEnabled:d}=P(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:_}=P(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:F}=P(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:R}=P(Z.isChargeCardPaymentHistoryFeatureEnabled),{isFeatureEnabled:M}=P(Z.isCardsCommentingEnabled),W=Ae(_,f),y=Ee({isDebitCardFeatureEnabled:_,isBankingOnlyTenant:W}),O=Se(f),$=Ie(f),U=f.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,Y=ke({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$,isDebitCardProductVisible:y,chargeCardsCreditAccountLimit:U}),E=Gt({isCardsOnlyTenant:O,isChargeCardFeatureEnabled:d,isBookKeepingTenant:$}),{configValue:q}=N(Fe.zeniCardsConfig),K=Ue(),z=Be(K?.loggedInUserRoleMap),Ce=S(H=>Me(H,f.companyId)),ae=ze(Ce.controllers),x=q.charge_card_cashback_rate_per_transaction!=null?q.charge_card_cashback_rate_per_transaction:.0175,pe=q.credit_card_pay_now_threshold_by_company_id?.[f.companyId]??q.default_credit_card_pay_now_threshold??Br,G=q.is_card_controls_enabled_for_all_tenants===!0||Array.isArray(q.enable_card_controls_for_company_ids)&&q.enable_card_controls_for_company_ids.includes(f.companyId),ce=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,we=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,re=!!f.companyChargeCardInfo?.info?.isChargeCardEnabled,ne=S(H=>gt(H)),de=Xa(ne.updateStatus),Q=S(H=>Ye(H,j,y&&T,Y&&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=>xa(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)),Oe=S(H=>_a(H).firstViewAfterActivation),{areTenantIdsInSync:na}=Ht(),Je=at(z,Pe),ra=pa(Y,re,z,ta,le),sa=tt(y,T,z,ee,Q.debitCardSummary),oa=Le(Y,y,T,re),ia=Q.creditAccount.balance.amount+Q.creditAccount.hold.amount;if(c.useEffect(()=>{se==="Completed"&&(X.getPayNowInfoTooltip()==null||ia<pe*Q.creditAccount.limit.amount/100)&&o(!0)},[se,pe,ia,Q.creditAccount.limit.amount]),c.useEffect(()=>{if(e!=null&&e===!0&&le.initiatedRepayments.amount===0&&le.fetchState==="Completed"||de==="In-Progress"&&ne.updateStatus==="Completed")o(!1),m(!0);else if(le.initiatedRepayments.amount>0&&le.fetchState==="Completed"){m(!1),document.body.style.overflow="auto";const H=Re(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,Y&&re,!1)))},[B,j,a,na]),c.useEffect(()=>{Oe&&i===!1&&(D(!0),setTimeout(()=>{a(Aa())},5e3))},[Oe,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"||Y&&le.fetchState!=="Completed"||y&&T&&z&&ee.fetchState!=="Completed"||J.trackCardsCardListView(ae,oa,Je,ra,sa)},[se,ta,le.fetchState,ee.fetchState,z]),A==null)throw Error("Can't access charge card list page without signing in...");const Ra=S(H=>Ft(H.userState,H.userRoleState,H.userListViewState,"cardAdmin")),ga=Ka(K?.loggedInUserRoleMap),ba=H=>{h(H)},V=Q.creditAccount.limit,he=()=>{m(!1),n("..")},Te=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:Y,isTOSAccepted:ce,isSetupEnabled:re,isUserHasCardsAdminLevelAccess:z,isUserHasCardsAccess:ga}),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:J,onLoad:()=>{J.trackPageLoaded(Mt.Event.cardsListPage),(Y&&!re||y&&!T)&&J.trackCardsPromoView(ae,{isCreditCardOffered:Y,isDebitCardOffered:y,isDebitCardEnabled:T,isCreditCardEnabled:re},"Banner",y&&!T?"Debit Card":Y&&!re?"Credit Card":"","Card List")}}),s.jsx(Ba,{showConfetti:Oe})]}):null,u===!0?s.jsx(nt,{closeDrawerHandler:he,isPaymentDrawerOpen:u,pageName:"Card List",sourcePage:"cardListPage",creditAccountSpentAmount:ia,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isDebitCardInfoFetchStateCompleted:!(y&&T&&z)||ee.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!Y||le.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!z||Pe.fetchState==="Completed",paymentInitiatedDate:le.initiatedRepaymentDate}):null,s.jsxs(Qr,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:ba}),s.jsx(Xr,{isCashbackFeatureEnabled:p,isChargeCardFeatureEnabled:Y,isDebitCardFeatureEnabled:y,isCreditCardProductVisibleForExpressInterest:E,updatePayNowInfoTooltip:o,showPayNowInfoTooltip:C,creditCardPayNowThreshold:pe,signedInUser:A,chargeCardListState:Q,location:r,admins:Ra.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:R,cashbackRate:x,controllerEmails:ae,chargeCardCashbackDetailState:Pe,depositAccountListWithDebitCardIssued:ee,isChargeCardTOSAccepted:ce,isDebitCardTOSAccepted:we,primaryFundingAccountDetails:fa,chargeCardSetUpViewFetchState:We.fetchState,productInformation:oa,creditAccountInformation:ra,debitAccountInformation:sa,cashbackInformation:Je,isAiCfoAccessEnabled:l,onAskAiCfoClick:w,isCardsCommentingEnabled:M})]})]}):(ce||we)&&z===!0?s.jsx(ya,{to:"../setup"}):Te||Ne?s.jsx(ya,{to:"../promo"}):s.jsx(Ze,{fetchState:se})}const es=e=>`/${e}/cards/new`,as=e=>`/${e}/cards/payment`,ts=e=>`/${e}/cards/payment-history`,ns=ge(function(e){const t=X.getSignedInUser(),a=ie(e),r=e.tenantState.currentTenantId,n=vt(e),u={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:r??""},m=a?.companyName??"",C=e.chargeCardPaymentHistoryState.downloadUIState.downloadState;return{fetchState:n.fetchState,filters:n.filters,isZeniTenant:Bn(a),repaymentList:n.repaymentHistory,searchText:n.searchText,repaymentHistoryUsers:n.repaymentHistoryUsers,sortConfig:{sortKey:n.uiState.sortKey,sortOrder:n.uiState.sortOrder},downloadParams:{authParams:u,companyName:m,spendManagementEndPoint:`${za}/spendManagement`,isShowDeletedBillsEnabled:!1,isShowDeletedReimbursementEnabled:!1},downloadState:C}},function(e,t){const{location:a,navigate:r}=t;return{onBackClick:()=>{const n=ve(a.state?.pathnameStackToGoBack),u=n.poppedPathname??"..";r(u,{state:{pathnameStackToGoBack:n.newStack}})},onColumnSortConfigChanged:(n,u)=>{e({type:"chargeCardPaymentHistory/updatePaymentHistoryUIState",payload:{uiState:{sortKey:n,sortOrder:u}}})},onFiltersChange:n=>{e(Un({filters:n}))},onReloadPayments:()=>{e(Ot(!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(X.getSignedInUser()==null)throw Error("Can't access payment history page without signing in...");const u=S(K=>ie(K)),m=S(K=>vt(K)),[C,I]=c.useState(!1),[o,i]=c.useState(!1),[D,A]=c.useState(!1),[f,B]=c.useState(null),v=!u.userRole.includes("charge_card_user"),k=!!u.companyDebitCardInfo?.info?.isDebitCardEnabled,{isFeatureEnabled:h}=n(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:b}=n(Z.isDebitCardFeatureEnabled),g=Ae(b,u),l=Ee({isDebitCardFeatureEnabled:b,isBankingOnlyTenant:g}),w=Se(u),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=Ue(),p=Be(N?.loggedInUserRoleMap),d=S(K=>Ye(K,v,l&&k,T&&P)),_=c.useMemo(()=>{const K=d.cards.filter(z=>z.type.code.includes("debit"));return[...new Set(K.map(z=>z.connectedAccountId))]},[d.cards]),F=S(K=>Ge(K)),R=S(K=>xa(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]),O=c.useMemo(()=>tt(l,k,p,R,d.debitCardSummary),[l,k,p,R,d.debitCardSummary]),$=c.useMemo(()=>Le(T,l,k,P),[T,l,k,P]),U=d.creditAccount.balance.amount+d.creditAccount.hold.amount,Y=c.useMemo(()=>f!=null?m.repaymentHistory.find(K=>K.cardRepaymentId===f):void 0,[f,m.repaymentHistory]),E=c.useCallback(K=>{B(K),a(Ea(v,l&&k,T&&P,!1)),A(!0)},[a,v,l,k,T,P]),q=c.useCallback(()=>{A(!1),B(null),document.body.style.overflow="auto"},[]);return c.useEffect(()=>{C||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(I(!0),a(Ot()))},[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:U,productInformation:$,creditAccountInformation:y,debitAccountInformation:O,cashbackInformation:W,isDebitCardInfoFetchStateCompleted:!(l&&k&&p)||R.fetchState==="Completed",isCreditCardInfoFetchStateCompleted:!T||M.fetchState==="Completed",isCashbackInfoFetchStateCompleted:!p||F.fetchState==="Completed",paymentInitiatedDate:M.initiatedRepaymentDate,retryRepayment:Y}):null,s.jsx(ns,{location:t,navigate:e,accountInfoByAccountId:m.accountInfoByAccountId,onRetryPaymentClick:E})]})}const lt=_e.div`
26
26
  display: flex;
27
27
  height: 100vh;
28
28
  width: 100%;
@@ -31,7 +31,7 @@ import{j as s}from"./liveblocks-BeS4QmMp.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=Xa.getLocalizedStrings().months;function ss(){const e=ue(),t=me(),a=ye(),{creditAccount:r,creditAccountRepayment:n}=S(y=>$e(y)),u=`${Vt.cardMicroServiceBaseUrl}/1.0/credit-accounts/${r.id}`,[m,C]=c.useState(!1),[I,o]=c.useState(!1),i=S(y=>Un(y)),{useFeatureGate:D}=oe(),A=S(y=>ie(y)),{isFeatureEnabled:f}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=D(Z.isDebitCardFeatureEnabled),v=Ae(B,A),k=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:v}),h=Se(A),b=Ie(A),g=A.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=ke({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:f,isBookKeepingTenant:b,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:g}),w=!!A.companyDebitCardInfo?.info?.isDebitCardEnabled,L=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,j=S(y=>Me(y,A.companyId)),T=ze(j.controllers),P=S(y=>xt(y)),N=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(N)],d=S(y=>xa(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(Ya())},[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="",O="";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}`,O=`${ut[parseInt(ae)-1]} ${Ce}`}const $=Le(l,k,w,L),R=pa(l,L,!0,r,n),Y=tt(k,w,!0,d,_);J.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:O},R,Y)}},[i.fetchState,r.fetchState,n.fetchState,d.fetchState,P.fetchState,_.fetchState]);const F=()=>{const y=ve(a.state?.pathnameStackToGoBack),O=y.poppedPathname??"..";e(O,{state:{pathnameStackToGoBack:y.newStack}})},U=S(y=>Ge(y)),M=Q.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=Q.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),Y=R.poppedPathname??Ue(L);r(Y,{state:{pathnameStackToGoBack:R.newStack}})}},[w.fetchState,w.cards,A]);const p=S(R=>_a(R)),d=Qa(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:U}=F(Z.isChargeCardFeatureEnabled),M=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!g.userRole.includes("charge_card_user")&&U&&M,y=S(R=>_!=null?Rt(R.chargeCardState,_):null),O=()=>{_!=null&&(a(aa(_,W,!0)),a(da()),f(!0))};c.useEffect(()=>{if(A&&_!=null&&y!=null&&y.status.code!=="request_on_hold"){const R=fe(g.tenantEmailDomain,_,b,y),Y=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(R,{state:{pathnameStackToGoBack:Y},replace:!0})}},[A,y?.status.code]),c.useEffect(()=>{d==="In-Progress"&&p.updateStatus.fetchState==="Completed"&&setTimeout(O,3e3)},[d,p.updateStatus.fetchState]);const $=R=>{h(R)};if(!A&&T!=="Completed"||j!=="Completed"||w.cards.length===0)return s.jsx(Ze,{fetchState:"In-Progress"});if(P==null)throw Error("Can't access my userId.");return s.jsxs(ls,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:$}),s.jsx(cs,{chargeCardListView:w,cardUserOnboardingView:p,navigate:r,currentTenant:g,myUserId:P,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?s.jsx(ds,{windowSize:t,children:e}):null]})},cs=ge(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:u}=t,{tenantEmailDomain:m}=u;return{updateCardUserOnboardingLocalData:C=>{e(ot({localData:C}))},onGetOtp:C=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:C};e(ot({localData:I}))}e(va(C,"CardUserOnboarding"))},onResendOtp:C=>{e(Fa(C,"CardUserOnboarding"))},onVerifyOtp:(C,I)=>{e(Ta(C,I,"CardUserOnboarding"))},onVerifyOtpSuccess:C=>{e(Gn()),C!=null&&Q.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=>Rn(y)),{useFeatureGate:D}=oe(),A=S(y=>ie(y)),{isFeatureEnabled:f}=D(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:B}=D(Z.isDebitCardFeatureEnabled),v=Ae(B,A),k=Ee({isDebitCardFeatureEnabled:B,isBankingOnlyTenant:v}),h=Se(A),b=Ie(A),g=A.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,l=ke({isCardsOnlyTenant:h,isChargeCardFeatureEnabled:f,isBookKeepingTenant:b,isDebitCardProductVisible:k,chargeCardsCreditAccountLimit:g}),w=!!A.companyDebitCardInfo?.info?.isDebitCardEnabled,L=!!A.companyChargeCardInfo?.info?.isChargeCardEnabled,j=S(y=>Me(y,A.companyId)),T=ze(j.controllers),P=S(y=>xt(y)),N=P.cards.filter(y=>y.type.code.includes("debit")).map(y=>y.connectedAccountId),p=[...new Set(N)],d=S(y=>xa(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(Ya())},[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="",O="";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}`,O=`${ut[parseInt(ae)-1]} ${Ce}`}const $=Le(l,k,w,L),U=pa(l,L,!0,r,n),Y=tt(k,w,!0,d,_);J.trackCardsCreditCardStatementsView(T,$,{numberOfStatements:i.statements.length,oldestStatementMonthYear:y,latestStatementMonthYear:O},U,Y)}},[i.fetchState,r.fetchState,n.fetchState,d.fetchState,P.fetchState,_.fetchState]);const F=()=>{const y=ve(a.state?.pathnameStackToGoBack),O=y.poppedPathname??"..";e(O,{state:{pathnameStackToGoBack:y.newStack}})},R=S(y=>Ge(y)),M=X.getSignedInUser(),W={userId:M?.userId??"",sessionId:M?.zeniSessionId??"",tenantId:A.tenantId??""};if(M==null)throw Error("Can't access address page without signing in...");if(i.fetchState!=="Completed")return s.jsx(lt,{children:s.jsx(Ir,{onBackClick:F})});{const y=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:R,creditAccount:r,creditAccountRepayment:n,depositAccountListWithDebitCardIssued:d,debitCardSummary:_,downloadEndPoint:u})})}}const os={containerWidth:new Ca(100,58)},is=({appContent:e})=>{const t=ma(),a=me(),r=ue(),n=ye(),{useDynamicConfig:u}=oe(),[m,C]=c.useState(!1),[I,o]=c.useState(!1),[i,D]=c.useState(!1),[A,f]=c.useState(!1),[B,v]=c.useState(!1),[k,h]=c.useState(!1),b=X.getSignedInUser();if(b==null)throw Error("Can't access onboarding card page without signing in...");const g=S(U=>ie(U)),{configValue:l}=u(Fe.zeniCardsConfig),w=S(U=>Hn(U)),{tenantEmailDomain:L}=g,j=S(U=>U.settingsViewState.profile.fetchState),T=S(U=>U.chargeCardListState.fetchState),P=S(U=>U.settingsViewState.profile.userId),N=S(U=>U.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 U=ve(n.state?.pathnameStackToGoBack),Y=U.poppedPathname??Re(L);r(Y,{state:{pathnameStackToGoBack:U.newStack}})}},[w.fetchState,w.cards,A]);const p=S(U=>_a(U)),d=Xa(p.updateStatus.fetchState),_=p.currentDisplayedCardId,{useFeatureGate:F}=oe(),{isFeatureEnabled:R}=F(Z.isChargeCardFeatureEnabled),M=!!g.companyChargeCardInfo?.info?.isChargeCardEnabled,W=!g.userRole.includes("charge_card_user")&&R&&M,y=S(U=>_!=null?Ut(U.chargeCardState,_):null),O=()=>{_!=null&&(a(aa(_,W,!0)),a(da()),f(!0))};c.useEffect(()=>{if(A&&_!=null&&y!=null&&y.status.code!=="request_on_hold"){const U=fe(g.tenantEmailDomain,_,b,y),Y=be(n.state?.pathnameStackToGoBack,n.pathname);a($n()),y?.type.code==="business_virtual_credit_card"&&a(Pa()),r(U,{state:{pathnameStackToGoBack:Y},replace:!0})}},[A,y?.status.code]),c.useEffect(()=>{d==="In-Progress"&&p.updateStatus.fetchState==="Completed"&&setTimeout(O,3e3)},[d,p.updateStatus.fetchState]);const $=U=>{h(U)};if(!A&&T!=="Completed"||j!=="Completed"||w.cards.length===0)return s.jsx(Ze,{fetchState:"In-Progress"});if(P==null)throw Error("Can't access my userId.");return s.jsxs(ls,{children:[s.jsx(ha,{isAppContentDrawerOpen:k,handleDrawerToggle:$}),s.jsx(cs,{chargeCardListView:w,cardUserOnboardingView:p,navigate:r,currentTenant:g,myUserId:P,location:n,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{$(!0)}}),e!=null?s.jsx(ds,{windowSize:t,children:e}):null]})},cs=ge(function(e,{currentTenant:t,cardUserOnboardingView:a,chargeCardListView:r,myUserId:n}){const u=Ye(e,!1,!1,!1);let m=!1;return u.fetchState==="Completed"&&u.cards.length<=1&&(m=!0),{cards:r.cards,showMenuIcon:m,companyLegalName:t.companyName,twoFAView:a.twoFAView,cardUserOnboardingLocalData:a.cardUserOnboardingLocalData??{userId:n},isDOBDisabled:a.isDOBPresent,onboardingProgressStatus:a.onboardingProgressStatus}},function(e,t){const{navigate:a,cardUserOnboardingView:r,location:n,currentTenant:u}=t,{tenantEmailDomain:m}=u;return{updateCardUserOnboardingLocalData:C=>{e(ot({localData:C}))},onGetOtp:C=>{if(r.cardUserOnboardingLocalData!=null){const I={...r.cardUserOnboardingLocalData,phone:C};e(ot({localData:I}))}e(va(C,"CardUserOnboarding"))},onResendOtp:C=>{e(Fa(C,"CardUserOnboarding"))},onVerifyOtp:(C,I)=>{e(Ta(C,I,"CardUserOnboarding"))},onVerifyOtpSuccess:C=>{e(Gn()),C!=null&&X.saveZeniOtpToken(C)},setCurrentDisplayedCardId:C=>{e(Lt({cardId:C}))},onBackClick:()=>{const C=ve(n.state?.pathnameStackToGoBack),I=C.poppedPathname??Re(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-BeS4QmMp.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=Q.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const h=S(O=>ie(O));if(n==null)throw Error("Empty card id is not valid...");const{configValue:b}=m(Fe.zeniCardsConfig),g=S(O=>Yn(O,n)),{isFeatureEnabled:l}=C(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Z.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(O=>O.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 O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);r(O,{state:{pathnameStackToGoBack:$}})}else if(A&&g.isRefreshingViewInBackground===!1&&d?.isPinSet===!0){a(Zn({chargeCardId:n}));const O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(O,{state:{pathnameStackToGoBack:$}})}}},[g.fetchState,d?.type.code,A,g.isRefreshingViewInBackground]);const U=Q.getZeniOtpTokenForCardHolder(n),M=S(O=>ht(O.userState,k.userId)),W=()=>{d?.isPinSet!==!0&&a(Za(n,!0))};c.useEffect(()=>{g.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(W,3e3),f(!0))},[g.updateDebitCardPinAttemptFetchState.fetchState]);const y=O=>{v(O)};if(_!=="Completed"||d==null)return s.jsx(Ze,{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=Ye(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&&Q.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),[B,v]=c.useState(!1),k=X.getSignedInUser();if(k==null)throw Error("Can't access onboarding card page without signing in...");const h=S(O=>ie(O));if(n==null)throw Error("Empty card id is not valid...");const{configValue:b}=m(Fe.zeniCardsConfig),g=S(O=>Yn(O,n)),{isFeatureEnabled:l}=C(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:w}=C(Z.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(O=>O.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 O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);r(O,{state:{pathnameStackToGoBack:$}})}else if(A&&g.isRefreshingViewInBackground===!1&&d?.isPinSet===!0){a(Zn({chargeCardId:n}));const O=fe(h.tenantEmailDomain,n,k,d,!0),$=be(u.state?.pathnameStackToGoBack,u.pathname);a(Pa()),r(O,{state:{pathnameStackToGoBack:$}})}}},[g.fetchState,d?.type.code,A,g.isRefreshingViewInBackground]);const R=X.getZeniOtpTokenForCardHolder(n),M=S(O=>ht(O.userState,k.userId)),W=()=>{d?.isPinSet!==!0&&a(Za(n,!0))};c.useEffect(()=>{g.updateDebitCardPinAttemptFetchState.fetchState==="Completed"&&(setTimeout(W,3e3),f(!0))},[g.updateDebitCardPinAttemptFetchState.fetchState]);const y=O=>{v(O)};if(_!=="Completed"||d==null)return s.jsx(Ze,{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:R,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=Ye(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&&X.saveZeniOtpTokenForCardHolder(o,r)},onSetPinSuccess:()=>{e(Kn({chargeCardId:r}))},onBackClick:()=>{const o=ve(n.state?.pathnameStackToGoBack),i=o.poppedPathname==null||o.poppedPathname.includes("activate")===!0?Re(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-BeS4QmMp.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(Jn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Xn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(qn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Ja(),n=ma(),u=()=>{t()},m=S(C=>Wn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,C))?.newAddressId;return s.jsx(zt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(C,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&u(),children:s.jsx(gs,{googleAPIKey: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=Q.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),B=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:k}),[b,g]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{b||(g(!0),a(Qn(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,O)=>{_(y),U(O)};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?Zt(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(Rt(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`));const m=Rr(u);e(Jn({addressType:`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`,addressToCreate:m})),e(Qn(`${n==="creditCard"?"credit":"debit"}_custom_shipping_${r}_address`))},onDismissClick:()=>{t.onDismissClick(),a!=null&&e(qn({addressId:a,cardLineId:r,cardType:n==="creditCard"?"business_physical_credit_card":"business_physical_debit_card"}))}}})(Dr),bs=({lineId:e,closeDrawerHandler:t,chargeCardTypeOption:a})=>{const r=Ja(),n=ma(),u=()=>{t()},m=S(C=>Wn(`${a==="creditCard"?"credit":"debit"}_custom_shipping_${e}_address`,C))?.newAddressId;return s.jsx(zt,{anchor:"right",open:e.length>0,PaperProps:{style:{minWidth:fs.overlayWidth.valuePercentage(n),boxShadow:"none",zIndex:8}},slotProps:{backdrop:{style:{opacity:.75,backgroundColor:r.colors.black,cursor:"pointer"}}},onClose:(C,I)=>(I==="backdropClick"||I==="escapeKeyDown")&&u(),children:s.jsx(gs,{googleAPIKey: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(Rt(`${r==="creditCard"?"credit":"debit"}_custom_shipping_${a}_address`))},openAddAddressDrawerHandler:t.openAddAddressDrawerHandler}})(Pr);function Ss(){const e=X.getSignedInUser(),t=ue(),a=me(),r=_r(),[n]=mt(),u=n.get("cardType"),{useFeatureGate:m}=oe(),{isFeatureEnabled:C}=m(Z.isIssuePhysicalCardEnabled),{isFeatureEnabled:I}=m(Z.isIssuePhysicalDebitCardEnabled),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isChargeCardFeatureEnabled),D=S(y=>ie(y)),A=Ae(o,D),f=Ee({isDebitCardFeatureEnabled:o,isBankingOnlyTenant:A}),B=Se(D),v=Ie(D),k=D.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,h=ke({isCardsOnlyTenant:B,isChargeCardFeatureEnabled:i,isBookKeepingTenant:v,isDebitCardProductVisible:f,chargeCardsCreditAccountLimit:k}),[b,g]=c.useState(!1);if(e==null)throw Error("Can't access issue card page without signing in...");c.useEffect(()=>{b||(g(!0),a(Xn(f&&w,h&&l,!1)))},[b,g,a]);const l=!!D.companyChargeCardInfo?.info?.isChargeCardEnabled,w=!!D.companyDebitCardInfo?.info?.isDebitCardEnabled,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?Ut(y.chargeCardState,N):void 0),[d,_]=c.useState(null),[F,R]=c.useState(null),M=()=>{_(null)},W=(y,O)=>{_(y),R(O)};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?Zt(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(Ua,{}):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-BeS4QmMp.js";import{j as ue,l as la,h as me,g as
68
68
  overflow: auto;
69
69
  align-items: center;
70
70
  background-color: ${e=>e.theme.colors.grey4};
71
- `,As=ge(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:u,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:C}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=Yt(I,o),D=fe(C,o,u,i),A=be(n.state?.pathnameStackToGoBack,n.pathname);a(D,{state:{pathnameStackToGoBack:A}})},onColumnSortConfigChanged:(o,i)=>{e(Ha({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(da())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Ha({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=ue(),t=me(),a=ye(),r=Ja(),[n,u]=c.useState(!1),m=S(F=>tr(F)),C=S(F=>ie(F)),I=S(F=>Me(F,C.companyId)),o=ze(I.controllers),{useFeatureGate:i}=oe(),{isFeatureEnabled:D}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Z.isDebitCardFeatureEnabled),f=Ae(A,C),B=Ee({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:f}),v=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,k=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Re(),b=Se(C),g=Ie(C),l=C.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,w=ke({isCardsOnlyTenant:b,isChargeCardFeatureEnabled:D,isBookKeepingTenant:g,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:l}),L=Be(h?.loggedInUserRoleMap),j=S(F=>Ge(F)),{creditAccount:T,creditAccountRepayment:P}=S(F=>$e(F)),N=S(F=>xt(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(N)],d=S(F=>xa(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 _=Q.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(Ya()),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(Ze,{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&&J.trackCardsPromoPageClicked("enable cards"),n)switch(J.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(xe(r,!0,"charge_cards",i,!1));break;case"debit":e(xe(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?xe(r,!0,"debit_cards",i,!0):xe(r,!0,"charge_cards__debit_cards",i,!1))}else switch(J.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(xe(r,!1,"charge_cards",i,!1));break;case"debit":e(xe(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?xe(r,!1,"debit_cards",i,!0):xe(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let B=f.poppedPathname;B==null&&(B=u||m?"..":"../.."),a(B,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(sr(r))}}})(Fr),Ds=()=>{const e=ue(),{tenantEmailDomain:t}=la(),[a]=mt(),r=a.get("cardPromoType"),n=me(),{useDynamicConfig:u,useFeatureGate:m}=oe(),[C,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Z.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),B=S(ee=>Me(ee,f.companyId)),v=ze(B.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=Q.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=Q.getSignedInUser(),M=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,W=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,y=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,O=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,$=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,R=ee=>{I(ee)},Y=S(ee=>ee.chargeCardSetupViewState.fetchState);if(U==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Re(),q=Be(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,x]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Y!=="Not-Started"||b==null||(x(!0),n(Oa(b,!0)))},[ae,Y,b,n]);const ce=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:d,isTOSAccepted:W,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),we=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:N,isTOSAccepted:$,isSetupEnabled:O,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,X=c.useRef(null);c.useEffect(()=>{de==="In-Progress"?X.current=ne:de!=="Error"&&de!=="Not-Started"||(X.current=null)},[de,ne]);const Ke=de!=="In-Progress"&&de!=="Completed"||X.current==null?ne:X.current;c.useEffect(()=>{ne==="credit"&&(y||d===!1&&O)||ne==="debit"&&O||ne==="debit_and_credit"&&O&&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,O,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,O,y);return(ce||we)&&Y==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!N&&!O||!!d&&!!N&&!O&&!y){const ee=_s({isDebitCardSetupEnabled:O,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:N});J.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(Ba,{showConfetti:z}),s.jsx(ha,{isAppContentDrawerOpen:C,handleDrawerToggle:R}),s.jsx(ks,{signedInUser:U,location:h,showEnableCardButton:F,isCompanyBusinessVerificationAndPaymentSetUpDone:F,isChargeCardSetupEnabled:y,isDebitCardSetupEnabled:O,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(Ze,{fetchState:"Not-Started"})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Js(){const e=ye(),t=S(Y=>ie(Y)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),C=Ae(n,t),I=Ee({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:C}),o=vr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,A=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,B=Re(),v=Be(B?.loggedInUserRoleMap),k=Ka(B?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Z.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),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(Z.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}),O=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=O||$;return s.jsxs(Jt,{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(Jr,{})}),s.jsx(te,{path:"*",element:s.jsx(Ra,{})})]}):(i||D)&&v?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../setup"})}):R?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../promo",state:e.state})}):s.jsx(te,{path:"*",element:null})]})}export{Js as default};
71
+ `,As=ge(function(e,t){const{myPendingActivationChargeCardListState:a}=t;return{myPendingActivationChargeCardListView:a,uiState:a.uiState,signedInUser:t.signedInUser}},function(e,t){const{navigate:a,currentTenant:r,location:n,signedInUser:u,myPendingActivationChargeCardListState:m}=t,{tenantEmailDomain:C}=r,{cards:I}=m;return{onChargeCardRowClick:o=>{const i=Yt(I,o),D=fe(C,o,u,i),A=be(n.state?.pathnameStackToGoBack,n.pathname);a(D,{state:{pathnameStackToGoBack:A}})},onColumnSortConfigChanged:(o,i)=>{e(Ha({uiState:{sortKey:o,sortOrder:i}}))},onReloadCards:()=>{e(da())},onBackClick:()=>{const o=r.userRole.includes("charge_card_user");e(Ha({uiState:{sortKey:o?"cardName":"owner",sortOrder:"ascending"}})),a("../")}}})(Tr);function Es(){const e=ue(),t=me(),a=ye(),r=Ja(),[n,u]=c.useState(!1),m=S(F=>tr(F)),C=S(F=>ie(F)),I=S(F=>Me(F,C.companyId)),o=ze(I.controllers),{useFeatureGate:i}=oe(),{isFeatureEnabled:D}=i(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:A}=i(Z.isDebitCardFeatureEnabled),f=Ae(A,C),B=Ee({isDebitCardFeatureEnabled:A,isBankingOnlyTenant:f}),v=!!C.companyDebitCardInfo?.info?.isDebitCardEnabled,k=!!C.companyChargeCardInfo?.info?.isChargeCardEnabled,h=Ue(),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=>xt(F)).cards.filter(F=>F.type.code.includes("debit")).map(F=>F.connectedAccountId),p=[...new Set(N)],d=S(F=>xa(F,p));c.useEffect(()=>{n||m.fetchState==="Completed"||m.fetchState==="In-Progress"||(u(!0),t(da()),t(wa()))},[n,t,m.fetchState]),c.useEffect(()=>{if(m.fetchState==="Completed"&&m.cards.length===1&&_!=null){const F=fe(C.tenantEmailDomain,m.cards[0].id,_,m.cards[0]);e(F,{state:{message:a.state?.message}})}},[m.fetchState,m.cards]);const _=X.getSignedInUser();if(c.useEffect(()=>{T.fetchState!=="Completed"&&T.fetchState!=="In-Progress"&&w&&k&&L&&t(Ga()),P.fetchState!=="Completed"&&P.fetchState!=="In-Progress"&&L&&t(Ya()),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(Ze,{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&&J.trackCardsPromoPageClicked("enable cards"),n)switch(J.trackCardsEnableCardsClick(D,o,"Cards Promo"),f){case"credit":e(xe(r,!0,"charge_cards",i,!1));break;case"debit":e(xe(r,!0,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?xe(r,!0,"debit_cards",i,!0):xe(r,!0,"charge_cards__debit_cards",i,!1))}else switch(J.trackCardsSetupCardsClick(D,o,"Cards Promo"),f){case"credit":e(xe(r,!1,"charge_cards",i,!1));break;case"debit":e(xe(r,!1,"debit_cards",i,!1));break;case"debit_and_credit":e(A===0?xe(r,!1,"debit_cards",i,!0):xe(r,!1,"charge_cards__debit_cards",i,!1))}},onBackClick:()=>{const f=ve(I.state?.pathnameStackToGoBack);let B=f.poppedPathname;B==null&&(B=u||m?"..":"../.."),a(B,{state:{pathnameStackToGoBack:f.newStack}})},onLetsGoClick:()=>{a("./onboard")},onSetupChargeCardSuccess:()=>{n?(e(Pa()),a("../",{relative:"path"})):a("../setup",{relative:"path"})},onExpressInterestClick:()=>{e(sr(r))}}})(Fr),Ds=()=>{const e=ue(),{tenantEmailDomain:t}=la(),[a]=mt(),r=a.get("cardPromoType"),n=me(),{useDynamicConfig:u,useFeatureGate:m}=oe(),[C,I]=c.useState(!1),{isFeatureEnabled:o}=m(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:i}=m(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:D}=m(Z.isChargeCardFeatureEnabled),{configValue:A}=u(Fe.zeniCardsConfig),f=S(ee=>ie(ee)),B=S(ee=>Me(ee,f.companyId)),v=ze(B.controllers),k=A.charge_card_cashback_rate_per_transaction!=null?A.charge_card_cashback_rate_per_transaction:.0175,h=ye(),b=X.getSignedInUserTenant(t)?.companyId??f.companyId,g=S(ee=>ua(ee,b)),l=g.primaryFundingAccount,w=f.companyBillPayInfo?.info,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??"")),R=X.getSignedInUser(),M=!!f.companyZeniAccountInfo?.info?.isZeniAccountEnabled,W=!!f.companyChargeCardInfo?.info?.isChargeCardTOSAccepted,y=!!f.company?.companyChargeCardInfo.isChargeCardEnabled,O=!!f.company?.companyDebitCardInfo.isDebitCardEnabled,$=!!f.companyDebitCardInfo?.info?.isDebitCardTOSAccepted,U=ee=>{I(ee)},Y=S(ee=>ee.chargeCardSetupViewState.fetchState);if(R==null)throw Error("Can't access Charge Card promo page without signing in...");const E=Ue(),q=Be(E?.loggedInUserRoleMap),K=Ka(E?.loggedInUserRoleMap),[z,Ce]=c.useState(!1),[ae,x]=c.useState(!1),[pe,G]=c.useState(!1);c.useEffect(()=>{z===!1&&h.state?.message==="activation"&&Ce(!0)},[h.state]),c.useEffect(()=>{ae||Y!=="Not-Started"||b==null||(x(!0),n(Oa(b,!0)))},[ae,Y,b,n]);const ce=f.companyChargeCardInfo?.info!=null&&ea({cardInfo:f.companyChargeCardInfo.info,isProductVisible:d,isTOSAccepted:W,isSetupEnabled:y,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),we=f.companyDebitCardInfo?.info!=null&&ea({cardInfo:f.companyDebitCardInfo.info,isProductVisible:N,isTOSAccepted:$,isSetupEnabled:O,isUserHasCardsAdminLevelAccess:q,isUserHasCardsAccess:K}),re=N&&we&&d&&P>=0&&ce?"debit_and_credit":N&&we?"debit":"credit",ne=Ur(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&&O)||ne==="debit"&&O||ne==="debit_and_credit"&&O&&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,O,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,O,y);return(ce||we)&&Y==="Completed"?s.jsxs(s.Fragment,{children:[s.jsx(et,{analytics:J,onLoad:()=>{if(J.trackPageLoaded(Mt.Event.cardsPromoPage),!!d&&!y||!!N&&!O||!!d&&!!N&&!O&&!y){const ee=_s({isDebitCardSetupEnabled:O,isChargeCardSetupEnabled:y,isCreditCardProductVisibleForExpressInterest:d,isDebitCardProductVisible:N});J.trackCardsPromoView(v,Pe,"Page",ee,"Promo Page")}}}),s.jsx(Ba,{showConfetti:z}),s.jsx(ha,{isAppContentDrawerOpen:C,handleDrawerToggle:U}),s.jsx(ks,{signedInUser:R,location:h,showEnableCardButton:F,isCompanyBusinessVerificationAndPaymentSetUpDone:F,isChargeCardSetupEnabled:y,isDebitCardSetupEnabled:O,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:()=>{U(!0)}})]}):s.jsx(Ze,{fetchState:"Not-Started"})},_s=({isDebitCardSetupEnabled:e,isChargeCardSetupEnabled:t,isCreditCardProductVisibleForExpressInterest:a,isDebitCardProductVisible:r})=>a&&r&&!e&&!t?"Credit & Debit Card":a&&!t?"Credit Card":r&&!e?"Debit Card":"";function Js(){const e=ye(),t=S(Y=>ie(Y)),{useFeatureGate:a}=oe(),{isFeatureEnabled:r}=a(Z.isChargeCardFeatureEnabled),{isFeatureEnabled:n}=a(Z.isDebitCardFeatureEnabled),{isFeatureEnabled:u}=a(Z.isEarlyPayFeatureEnabled),{isFeatureEnabled:m}=a(Z.isChargeCardPaymentHistoryFeatureEnabled),C=Ae(n,t),I=Ee({isDebitCardFeatureEnabled:n,isBankingOnlyTenant:C}),o=vr(t,r,n),i=!!t.company?.companyChargeCardInfo.isChargeCardTOSAccepted,D=!!t.company?.companyDebitCardInfo.isDebitCardTOSAccepted,A=!!t.company?.companyChargeCardInfo.isChargeCardEnabled,f=!!t.company?.companyDebitCardInfo.isDebitCardEnabled,B=Ue(),v=Be(B?.loggedInUserRoleMap),k=Ka(B?.loggedInUserRoleMap),{isFeatureEnabled:h}=a(Z.isCashbackFeatureEnabled),b=t.userRole.includes("charge_card_user"),g=!b,l=!b&&A,w=t?.userRole!=null&&or(t?.userRole),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(Z.isDepositAccountsFeatureEnabled),N=P&&!w&&bt(B?.loggedInUserRoleMap),p=A&&!w,d=f&&!w,_=o&&!w&&Be(B?.loggedInUserRoleMap),F=lr(B?.loggedInUserRoleMap),R=Se(t),M=Ie(t),W=t.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,y=ke({isCardsOnlyTenant:R,isChargeCardFeatureEnabled:r,isBookKeepingTenant:M,isDebitCardProductVisible:I,chargeCardsCreditAccountLimit:W}),O=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}),U=O||$;return s.jsxs(Jt,{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(Jr,{})}),s.jsx(te,{path:"*",element:s.jsx(Ua,{})})]}):(i||D)&&v?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../setup"})}):U?s.jsx(te,{path:"*",element:s.jsx(ya,{to:"../promo",state:e.state})}):s.jsx(te,{path:"*",element:null})]})}export{Js as default};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-tcXs1fes.js";import{a as g}from"./sentry-DNuKG-9f.js";import{j as v,h as x,u as k,l as T,g as O,k as E}from"./core-DkPdadc6.js";import{z as C,b1 as F,x as P,d as L,f as V,ab as N,b2 as j,ap as A,aq as U,r as B}from"./index-CpD5ML2i.js";import{eN as b,fB as _,rw as M,fw as R,c0 as z,Lv as G,bn as Y,pE as q,ps as H,j_ as Z,lu as S,Lw as $,bC as J,ct as D,lC as K,lF as Q}from"./zeni-epic-state-CSoWjbAn.js";import"./mui-DbdGpDJj.js";import{c as W}from"./routePaths-D7wc65Bl.js";import{M as X}from"./MobileAppDrawer-n8t03yaO.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]="397492ea-3c39-4d31-8e8c-6c6f2cea09a9",n._sentryDebugIdIdentifier="sentry-dbid-397492ea-3c39-4d31-8e8c-6c6f2cea09a9")}catch{}})();const ee=E(function(n){const t=R(n),i=C.getSignedInUser(),l=b(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(Q())},onAddressClick:e=>{const a=W(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(K({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,w={companyInfo:{...a,website:u!=""&&u!=null?D(u):void 0,meetingLink:y!=""&&y!=null?D(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map(I=>I.length===2?I:U(I))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?J(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map(I=>parseInt(I)),fileId:r.fileIds[0]}};n(S({companyDetails:w}))},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($(e))},onCompanyOfficerUpdated:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:e.userId}]}))},updateFilesEntity:e=>{n(Z({files:e}))},onDeleteFile:e=>{n(H(e))},onEditFileName:(e,a)=>{n(q(e,a.split(".")[0]))}}})(j);function de(){const n=v(),t=x(),i=k(),{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=>b(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(_(d)))},[c,a,d,t]),g.useEffect(()=>{o==="Not-Started"&&t(M())},[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,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(X,{isAppContentDrawerOpen:f,handleDrawerToggle:u}):null,m.jsx(ee,{companyId:d,navigate:n,location:i,isLoading:y,currentTenant:r,isSettings:N(i),onClickMenuIcon:()=>{u(!0)}})]})}export{de as C};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-BeS4QmMp.js";import{a}from"./sentry-BlmJH5WH.js";import{h as D,u as v,g as m,N as w}from"./core-DcM32IW_.js";import{Ig as O,eN as A,fi as _,ml as U,fK as E,fh as j,eO as L,In as F}from"./zeni-epic-state-ChnjRetZ.js";import{u as $,z as u,L as g,D as k,o as H}from"./index-DSBNuTzQ.js";import{n as z}from"./mui--qrGbwFJ.js";import{t as R}from"./getLocaleForTenant-h7G676lL.js";import{g as P,Q as G}from"./QBOConnectionScreen-BhcOl23Z.js";import"./recharts-DoWl4vaN.js";import"./analytics-ByrfXPqG.js";import"./plaid-BZ0BFqP0.js";import"./dnd-36WXho_9.js";import"./stripe-DMRn4zHo.js";import"./lottie-Bdncx-qB.js";import"./lexical-CYAYrhLa.js";import"./pdf-6nmWWkz8.js";import"./utils-RmRP6xA4.js";import"./empty-GSTAUqhH.js";import"./pdf-lib-rQgtUIvp.js";import"./index-Dq0r4E9j.js";import"./url-BG92tf7R.js";import"./index-CjaQ8-D2.js";import"./decodeURIComponentSafe-mAxyJdJ8.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]="f8f6cb81-5e78-403d-a489-46afc299ebc0",t._sentryDebugIdIdentifier="sentry-dbid-f8f6cb81-5e78-403d-a489-46afc299ebc0")}catch{}})();const K=z.div`
1
+ import{j as C}from"./liveblocks-tcXs1fes.js";import{a}from"./sentry-DNuKG-9f.js";import{h as D,u as v,g as m,N as w}from"./core-DkPdadc6.js";import{Ig as O,eN as A,fi as _,ml as U,fK as E,fh as j,eO as L,In as F}from"./zeni-epic-state-CSoWjbAn.js";import{u as $,z as u,L as g,D as k,o as H}from"./index-CpD5ML2i.js";import{n as z}from"./mui-DbdGpDJj.js";import{t as R}from"./getLocaleForTenant-FjCgXmXO.js";import{g as P,Q as G}from"./QBOConnectionScreen-DyznN-F2.js";import"./recharts-D0a4NFa9.js";import"./analytics-CcGmsyc8.js";import"./plaid-UeHpA8su.js";import"./dnd-D-YvLFfj.js";import"./stripe-DMRn4zHo.js";import"./lottie-CwApzZxI.js";import"./lexical-Sc7rk4Y7.js";import"./pdf-DG2fyOfp.js";import"./utils-BmJyX3cx.js";import"./empty-C7PzWdR6.js";import"./pdf-lib-fmjHY_Su.js";import"./index-BVoPsTXN.js";import"./url-Bxb4Dr7g.js";import"./index-ufE2I9Jb.js";import"./decodeURIComponentSafe-h3wJzOm1.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]="f8f6cb81-5e78-403d-a489-46afc299ebc0",t._sentryDebugIdIdentifier="sentry-dbid-f8f6cb81-5e78-403d-a489-46afc299ebc0")}catch{}})();const K=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-tcXs1fes.js";import{z as n}from"./index-CpD5ML2i.js";import{g as p}from"./QBOConnectionScreen-DyznN-F2.js";import"./sentry-DNuKG-9f.js";import{u as a,N as i}from"./core-DkPdadc6.js";import"./zeni-epic-state-CSoWjbAn.js";import"./recharts-D0a4NFa9.js";import"./mui-DbdGpDJj.js";import"./analytics-CcGmsyc8.js";import"./plaid-UeHpA8su.js";import"./dnd-D-YvLFfj.js";import"./stripe-DMRn4zHo.js";import"./lottie-CwApzZxI.js";import"./lexical-Sc7rk4Y7.js";import"./pdf-DG2fyOfp.js";import"./utils-BmJyX3cx.js";import"./empty-C7PzWdR6.js";import"./pdf-lib-fmjHY_Su.js";import"./index-BVoPsTXN.js";import"./url-Bxb4Dr7g.js";import"./index-ufE2I9Jb.js";import"./decodeURIComponentSafe-h3wJzOm1.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};