@zeniai/web-app-ui 5.3.40-qa → 5.3.41-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 (128) hide show
  1. package/dist/assets/{AccountMappingScreen-BBc4_4t5.js → AccountMappingScreen-BCgETeoP.js} +2 -2
  2. package/dist/assets/AddressRoutes-DC3JM7a7.js +1 -0
  3. package/dist/assets/{AddressScreen-ueBXhh2E.js → AddressScreen-zTtPIjPs.js} +2 -2
  4. package/dist/assets/{AiCfoScreen-CSA0NZQ_.js → AiCfoScreen-CEkPZFk2.js} +1 -1
  5. package/dist/assets/{AppDrawer-BtmKncXK.js → AppDrawer-De73GA72.js} +1 -1
  6. package/dist/assets/{BillPayApprovalRoutes-DIMv5HVt.js → BillPayApprovalRoutes-BTEGJSVP.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-CWQjup6l.js → BillPayRoutes-D0Zcg2S5.js} +18 -18
  8. package/dist/assets/{BusinessVerificationPageScreen-gxvPC9Nc.js → BusinessVerificationPageScreen-DXdSHPE6.js} +2 -2
  9. package/dist/assets/{CardsAiCfoScreen-X_JzwNdn.js → CardsAiCfoScreen-DwHXFelb.js} +1 -1
  10. package/dist/assets/{ChargeCardRoutes-Bh1W2yGQ.js → ChargeCardRoutes-D7doeHf8.js} +1 -1
  11. package/dist/assets/CompanyPassportScreen-DEbgj-ZU.js +1 -0
  12. package/dist/assets/ConnectionAuthScreen-Bf4vqlR2.js +11 -0
  13. package/dist/assets/CustomerOnboardingAuthScreen-BxvU90OD.js +1 -0
  14. package/dist/assets/{CustomerOnboardingRoutes-DTHzcTqs.js → CustomerOnboardingRoutes-Coi-ieaU.js} +2 -2
  15. package/dist/assets/{DashboardRoutes-CxJPxihE.js → DashboardRoutes-kEzQGszS.js} +1 -1
  16. package/dist/assets/{DefaultTenantHome-DyfCOvBU.js → DefaultTenantHome-_85KjJUE.js} +1 -1
  17. package/dist/assets/DomesticWireDetailScreen-Ci1M06dc.js +18 -0
  18. package/dist/assets/{DrawerScreen-BT9F-F5I.js → DrawerScreen-DzidbbNY.js} +1 -1
  19. package/dist/assets/EntityDetailRoutes---pzooN0.js +1 -0
  20. package/dist/assets/ExpenseAutomationRoutes-Hq-aTHMY.js +38 -0
  21. package/dist/assets/FeaturePreviewScreen-BsptTDQw.js +1 -0
  22. package/dist/assets/{HubSpotOAuthCallbackScreen-C1emp8KW.js → HubSpotOAuthCallbackScreen-CxLQj57b.js} +1 -1
  23. package/dist/assets/{InboxNotificationsProvider-BU6hQETc.js → InboxNotificationsProvider-D007v5X6.js} +1 -1
  24. package/dist/assets/{InvoicingRoutes-BVupJlN7.js → InvoicingRoutes-4pD2cLam.js} +1 -1
  25. package/dist/assets/{MagicLinkRoutes-ujyytXrV.js → MagicLinkRoutes-lsTO85h_.js} +7 -7
  26. package/dist/assets/MagicLinkSignInScreen-CELeUyfh.js +12 -0
  27. package/dist/assets/{MobileAppDrawer-DH0tVOfv.js → MobileAppDrawer-BPpLxyPF.js} +1 -1
  28. package/dist/assets/NotFoundScreen-Bii3lrih.js +1 -0
  29. package/dist/assets/{NotificationRoutes-CnZ8t_aV.js → NotificationRoutes-DIujlAht.js} +1 -1
  30. package/dist/assets/{OAuthConsentScreen-CXv-sRc6.js → OAuthConsentScreen-BPXn-hZj.js} +1 -1
  31. package/dist/assets/{PandLWithForecastRoutes-D_qmzE70.js → PandLWithForecastRoutes-Blj7LUYo.js} +1 -1
  32. package/dist/assets/{PaymentLinkScreen-CRIOI45V.js → PaymentLinkScreen-BuvjTvnx.js} +8 -8
  33. package/dist/assets/PeopleRoutes-DP4ITyk4.js +22 -0
  34. package/dist/assets/PerformanceRoutes-DbTlyJ7g.js +1 -0
  35. package/dist/assets/{Preview-Cbn9H8uJ.js → Preview-DA8U2xpZ.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-3h-qdoms.js → QBOConnectionScreen-DTJHrTBk.js} +23 -23
  37. package/dist/assets/{ReimbursementApprovalRoutes-Bt3jod66.js → ReimbursementApprovalRoutes-L2HInkgU.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-Bc4MC7ZP.js → ReimbursementApprovalRuleDetailScreen-B_399PgL.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-DGCHkbRG.js → ReimbursementRoutes-CxctCJTH.js} +6 -6
  40. package/dist/assets/{ReportsRoutes-C7NbqVqm.js → ReportsRoutes-t4V__ucH.js} +1 -1
  41. package/dist/assets/RewardsRoutes-2jmm5cDs.js +1 -0
  42. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BJF3mh7B.js +33 -0
  43. package/dist/assets/ScreenRoutes-CLWbi-Mu.js +2 -0
  44. package/dist/assets/{SettingsRoutes-CapPSjQN.js → SettingsRoutes-B80l8XL-.js} +6 -6
  45. package/dist/assets/{SetupPagesScreen-D0wYkNmR.js → SetupPagesScreen-B69hot1T.js} +5 -5
  46. package/dist/assets/SignInScreen-D9tkVCb4.js +1 -0
  47. package/dist/assets/SignOutScreen-XsQVTTei.js +9 -0
  48. package/dist/assets/{TaskListScreen-CsxsJBj1.js → TaskListScreen-CqKYMM38.js} +2 -2
  49. package/dist/assets/{TaskRoutes-DjWmgiZP.js → TaskRoutes-ByH3im-3.js} +2 -2
  50. package/dist/assets/TransactionDetailRoutes-DAAv4zNm.js +1 -0
  51. package/dist/assets/{TransactionDetailScreen-p3o65tsz.js → TransactionDetailScreen-DL95NJxK.js} +2 -2
  52. package/dist/assets/{TransactionListRoutes-BNdbZ30T.js → TransactionListRoutes-CAMdM58-.js} +1 -1
  53. package/dist/assets/{TreasuryRoutes-DR87vhnp.js → TreasuryRoutes-BBcktIxt.js} +4 -4
  54. package/dist/assets/{VendorsRoutes-CropWmWa.js → VendorsRoutes-be9h9k3f.js} +10 -10
  55. package/dist/assets/{WiseConfirmationScreen-Of1qjtDz.js → WiseConfirmationScreen-B04nGYSU.js} +1 -1
  56. package/dist/assets/{ZeniAccountRoutes-BROaca6I.js → ZeniAccountRoutes-CdVwCUVp.js} +9 -9
  57. package/dist/assets/{ZeniAccountStatementScreen-CBSpTdBS.js → ZeniAccountStatementScreen-CF3L4na6.js} +1 -1
  58. package/dist/assets/{accountMappingHelper-DeDocU0d.js → accountMappingHelper-qlU24D2s.js} +1 -1
  59. package/dist/assets/{analytics-N153TuwK.js → analytics-BvodL4nJ.js} +1 -1
  60. package/dist/assets/{analyticsHelper-BSm7IqEZ.js → analyticsHelper-X6BcuRxb.js} +1 -1
  61. package/dist/assets/{core-1xnf2RtE.js → core-gUqdW_kq.js} +1 -1
  62. package/dist/assets/{decodeURIComponentSafe-DcD-XNVX.js → decodeURIComponentSafe-Cst3Y24b.js} +1 -1
  63. package/dist/assets/{dnd-DsH8jkrb.js → dnd-YSyN45zY.js} +1 -1
  64. package/dist/assets/{empty-Cvto7Qa_.js → empty-BAVoovBk.js} +1 -1
  65. package/dist/assets/{empty-GMcl-a5k.js → empty-CkcqWk4Z.js} +1 -1
  66. package/dist/assets/{emptyVideoElement-3SZu1zsn.js → emptyVideoElement-DMVtoCOe.js} +1 -1
  67. package/dist/assets/{epic-FXcGvl3F.js → epic-DHyjKhvW.js} +1 -1
  68. package/dist/assets/{expenseAutomationHelper-CNRtAWpH.js → expenseAutomationHelper-DDRCXr7k.js} +1 -1
  69. package/dist/assets/{getLocaleForTenant-Ct5cBG_c.js → getLocaleForTenant-DQPwSKjF.js} +1 -1
  70. package/dist/assets/{index-Bdznf1tI.js → index-1WLkQfLs.js} +1 -1
  71. package/dist/assets/{index-CAK36XTm.js → index-6dqseRo4.js} +1 -1
  72. package/dist/assets/{index-Ctq16f6K.js → index-70FTEc4H.js} +1 -1
  73. package/dist/assets/{index-B9A0BRu3.js → index-BhZ9H0Qw.js} +1 -1
  74. package/dist/assets/{index-DXVI9ztu.js → index-BhyEYQTn.js} +15908 -15944
  75. package/dist/assets/{index-BuVXkUYw.js → index-BzFSQsxk.js} +2 -2
  76. package/dist/assets/{index-C_EhkY0q.js → index-ChcsxO47.js} +1 -1
  77. package/dist/assets/{index-Dc3AC-iD.js → index-DhQKJDfi.js} +1 -1
  78. package/dist/assets/{lexical-d2so_3As.js → lexical-Euc6kCJG.js} +1 -1
  79. package/dist/assets/{liveblocks-C_WAhyd7.js → liveblocks-B3m51ZRo.js} +1 -1
  80. package/dist/assets/{lottie-NIzYzhlS.js → lottie-DLBd_qLT.js} +1 -1
  81. package/dist/assets/{mui-BAsIRnB1.js → mui-DCW4m3lZ.js} +1 -1
  82. package/dist/assets/{pathToGoBack-BmzgWhs1.js → pathToGoBack-Ds-XNEX3.js} +1 -1
  83. package/dist/assets/{pdf-BKNPlqtE.js → pdf-BDXl9G7N.js} +4 -4
  84. package/dist/assets/{pdf-lib-RqzDns79.js → pdf-lib-Bku26ZcE.js} +1 -1
  85. package/dist/assets/{plaid-dW1_MCaE.js → plaid-BrXe9xNf.js} +1 -1
  86. package/dist/assets/{pusher-BVnEdZ0V.js → pusher-BzxZmWnS.js} +1 -1
  87. package/dist/assets/{react-xy8FhgjK.js → react-C43HbBFY.js} +1 -1
  88. package/dist/assets/{react-BFlpt3K4.js → react-Cp8yT8Rr.js} +1 -1
  89. package/dist/assets/{react-Dq2pDn48.js → react-Db0eqcPH.js} +1 -1
  90. package/dist/assets/{react-gANl8FSl.js → react-DtuhKjd8.js} +1 -1
  91. package/dist/assets/{react-ClcLrViu.js → react-FxzlmTOI.js} +1 -1
  92. package/dist/assets/{react-hvFnEVKT.js → react-pusavzWL.js} +1 -1
  93. package/dist/assets/{recharts-C2rsrRI6.js → recharts-HpXoq1DR.js} +1 -1
  94. package/dist/assets/{routePaths-3iKgurJn.js → routePaths-DAdB7ufZ.js} +1 -1
  95. package/dist/assets/{sentry-lC29HHPj.js → sentry-DI7gLUjw.js} +1 -1
  96. package/dist/assets/{url-B8rnjauu.js → url-BVmez_R2.js} +1 -1
  97. package/dist/assets/{url-LYbpMOZt.js → url-qyBRakHR.js} +1 -1
  98. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DtwiUC9S.js → useAiCfoDashboardSuggestedQuestionsChips-FMXCfhJm.js} +1 -1
  99. package/dist/assets/useAskAiCfoHostNavButtonProps-BVUNtLFK.js +1 -0
  100. package/dist/assets/{useChargeCardPusherEvents-BQSY-ppK.js → useChargeCardPusherEvents-ldgEvsXz.js} +1 -1
  101. package/dist/assets/{useDeviceId-BX84j5B2.js → useDeviceId-kl-tdydV.js} +1 -1
  102. package/dist/assets/{useEmailConnectResultRefresh-BzSlD1q5.js → useEmailConnectResultRefresh-BDGN0_Dv.js} +1 -1
  103. package/dist/assets/{useInitialThreadRequest-BFDb_b7F.js → useInitialThreadRequest-DTQjUnhP.js} +1 -1
  104. package/dist/assets/{useTaskManagerAccess-B7YJLgDK.js → useTaskManagerAccess-U48bmWaI.js} +1 -1
  105. package/dist/assets/{utils-BBaMea9r.js → utils-8Dv5nUFZ.js} +1 -1
  106. package/dist/assets/{withTransactionSidePanel-CkEUNYr4.js → withTransactionSidePanel-0Fy2VPJ-.js} +2 -2
  107. package/dist/assets/{zeni-epic-state-BVNUxmav.js → zeni-epic-state-C-d25VTi.js} +3 -3
  108. package/dist/index.html +1 -1
  109. package/package.json +2 -2
  110. package/dist/assets/AddressRoutes-DUeinmsu.js +0 -1
  111. package/dist/assets/CompanyPassportScreen-XQqdGh6R.js +0 -1
  112. package/dist/assets/ConnectionAuthScreen-BKS6qkfS.js +0 -11
  113. package/dist/assets/CustomerOnboardingAuthScreen-_W8JsjC9.js +0 -1
  114. package/dist/assets/DomesticWireDetailScreen-Cpm9Bc_C.js +0 -18
  115. package/dist/assets/EntityDetailRoutes-GrYbpLDE.js +0 -1
  116. package/dist/assets/ExpenseAutomationRoutes-BAcJRoU4.js +0 -38
  117. package/dist/assets/FeaturePreviewScreen-CWY6I3fG.js +0 -1
  118. package/dist/assets/MagicLinkSignInScreen-yhSK6wYK.js +0 -12
  119. package/dist/assets/NotFoundScreen-BF2gJW91.js +0 -1
  120. package/dist/assets/PeopleRoutes-BBOCzTBv.js +0 -22
  121. package/dist/assets/PerformanceRoutes-C5sk5hTF.js +0 -1
  122. package/dist/assets/RewardsRoutes-CnXmBpce.js +0 -1
  123. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CplHlAVo.js +0 -25
  124. package/dist/assets/ScreenRoutes-DW0KFZF8.js +0 -2
  125. package/dist/assets/SignInScreen-ByJdILpU.js +0 -1
  126. package/dist/assets/SignOutScreen-BAACKxOn.js +0 -9
  127. package/dist/assets/TransactionDetailRoutes-B97JNzan.js +0 -1
  128. package/dist/assets/useAskAiCfoHostNavButtonProps-C4hcJx1x.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as o}from"./liveblocks-C_WAhyd7.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-1xnf2RtE.js";import{fR as Pt,$9 as is,g1 as wt,bt as ve,$a as ds,$b as ls,fG as fn,$c as Pn,fP as wn,$d as Tn,$e as vn,$f as Fn,$g as xn,fQ as Bn,g0 as Ln,$h as Rn,$i as us,fW as ms,fV as Cs,$j as ps,Jm as On,g3 as ia,$k as hs,$l as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$m as Ss,fZ as ys,IU as Is,IT as ks,IX as Es,IZ as As,g9 as Ds,fD as $n,$n as _s,$o as Ps,ge as Mn,$p as ws,gf as yt,J3 as Ts,J0 as vs,fE as fe,$q as qa,dX as Fe,dh as xe,dY as Be,gZ as da,cB as la,$r as ua,$s as Tt,Ch as Ga,m6 as Ka,$t as za,JC as ka,g4 as qe,JE as vt,lY as Nn,$u as ma,Jq as _a,$v as Fs,$w as xs,Jt as Ja,$x as Bs,Yk as Qa,f$ as Vn,Jz as ba,ip as Ls,$y as Hn,fS as Ca,br as Rs,$z as Os,gF as Xa,gE as et,K6 as Us,gD as at,$A as Gn,cu as Kn,d9 as js,Yj as wa,KH as zn,$B as gn,Kh as Pa,$C as Yn,KI as $s,YJ as Ms,KJ as Ns,LO as Vs,Bx as Hs,LI as Gs,$D as Ks,JD as oa,$E as zs,$F as Ys,$G as Ws,$H as Zs,$I as qs,$J as Ft,$K as Js,JT as Wn,JM as Qs,$L as Xs,g$ as eo,$M as Zn,K0 as qn,K4 as Jn,g_ as ao,$N as to,Kt as Qn,$O as no,$P as ro,$Q as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$R as rr,$S as co,gb as io,gc as lo,gd as uo,$T as tt,g5 as sr,db as xt,$U as mo,$V as Co,$W as po,$X as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$Y as or,KG as Ha,Rx as ko,$Z as Eo,$_ as Ao,$$ as Do,a00 as cr,a01 as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,a02 as To,a03 as vo,Jn as Fo,a04 as dr,f_ as lr,a05 as xo,Jp as Bo,Jo as bn,a06 as Lo,a07 as Ro,a08 as Oo,UE as Uo,a09 as Bt,a0a as jo,Fo as ur,mG as $o,id as Mo,L6 as No,a0b as mr,fM as Vo,fN as Ho,a0c as Go,dM as Ko,g2 as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,Tw as Qo}from"./zeni-epic-state-BVNUxmav.js";import{V as Le,df as Cr,a4 as we,dg as pr,dh as hr,di as Xo,G as ea,as as Lt,dj as ec,dk as ac,a as fr,d as gr,ar as br,p as ke,M as le,y as W,l as ya,dl as Sr,dm as tc,dn as nc,z as te,a7 as Ta,d4 as nt,dp as rc,dq as sc,dr as oc,a1 as va,bi as Qe,bE as Rt,ds as cc,ab as Fa,W as rt,E as Ot,h as ae,w as st,dt as ic,bQ as Sa,du as kt,dv as dc,a8 as Ut,dw as lc,ae as yr,av as Et,dx as uc,aq as Ir,$ as kr,R as Er,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,dE as bc,I as Ya,dF as Sc,dG as yc,m as ht,X as Ic,dH as kc,dI as Ec,dJ as Ac,ai as Dc,dK as _c,dL as Pc,g as wc}from"./index-DXVI9ztu.js";import{n as Ne,D as Ar,S as Tc}from"./mui-BAsIRnB1.js";import{a as r}from"./sentry-lC29HHPj.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-C4hcJx1x.js";import{M as Ee}from"./MobileAppDrawer-DH0tVOfv.js";import{d as jt}from"./recharts-C2rsrRI6.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-D0wYkNmR.js";import{u as Tr}from"./useInitialThreadRequest-BFDb_b7F.js";import ot from"./NotFoundScreen-BF2gJW91.js";import{u as Nt}from"./useChargeCardPusherEvents-BQSY-ppK.js";import{n as yn}from"./utils-BBaMea9r.js";import{t as Lc}from"./AddressScreen-ueBXhh2E.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./InboxNotificationsProvider-BU6hQETc.js";import"./useTaskManagerAccess-B7YJLgDK.js";import"./BusinessVerificationPageScreen-gxvPC9Nc.js";import"./routePaths-3iKgurJn.js";import"./analyticsHelper-BSm7IqEZ.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="57ee5dae-f39a-45e3-a123-8e76f213cab7",e._sentryDebugIdIdentifier="sentry-dbid-57ee5dae-f39a-45e3-a123-8e76f213cab7")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
1
+ import{j as o}from"./liveblocks-B3m51ZRo.js";import{u as me,j as d,h as de,g as he,i as Me,N as Je,s as _t,l as Pe,t as _n,n as cs,o as ne}from"./core-gUqdW_kq.js";import{fR as Pt,$9 as is,g1 as wt,bt as ve,$a as ds,$b as ls,fG as fn,$c as Pn,fP as wn,$d as Tn,$e as vn,$f as Fn,$g as xn,fQ as Bn,g0 as Ln,$h as Rn,$i as us,fW as ms,fV as Cs,$j as ps,Jm as On,g3 as ia,$k as hs,$l as fs,fI as gs,fH as bs,gg as ze,fY as Un,fX as jn,$m as Ss,fZ as ys,IU as Is,IT as ks,IX as Es,IZ as As,g9 as Ds,fD as $n,$n as _s,$o as Ps,ge as Mn,$p as ws,gf as yt,J3 as Ts,J0 as vs,fE as fe,$q as qa,dX as Fe,dh as xe,dY as Be,gZ as da,cB as la,$r as ua,$s as Tt,Ch as Ga,m6 as Ka,$t as za,JC as ka,g4 as qe,JE as vt,lY as Nn,$u as ma,Jq as _a,$v as Fs,$w as xs,Jt as Ja,$x as Bs,Yk as Qa,f$ as Vn,Jz as ba,ip as Ls,$y as Hn,fS as Ca,br as Rs,$z as Os,gF as Xa,gE as et,K6 as Us,gD as at,$A as Gn,cu as Kn,d9 as js,Yj as wa,KH as zn,$B as gn,Kh as Pa,$C as Yn,KI as $s,YJ as Ms,KJ as Ns,LO as Vs,Bx as Hs,LI as Gs,$D as Ks,JD as oa,$E as zs,$F as Ys,$G as Ws,$H as Zs,$I as qs,$J as Ft,$K as Js,JT as Wn,JM as Qs,$L as Xs,g$ as eo,$M as Zn,K0 as qn,K4 as Jn,g_ as ao,$N as to,Kt as Qn,$O as no,$P as ro,$Q as so,K2 as Xn,JP as er,Jw as ar,JY as tr,JW as nr,J_ as oo,$R as rr,$S as co,gb as io,gc as lo,gd as uo,$T as tt,g5 as sr,db as xt,$U as mo,$V as Co,$W as po,$X as ho,Kc as It,KA as fo,Kw as go,K8 as bo,Ky as So,Ko as yo,Kq as Io,$Y as or,KG as Ha,Rx as ko,$Z as Eo,$_ as Ao,$$ as Do,a00 as cr,a01 as _o,L1 as Po,Kg as ir,Kb as $e,Kf as wo,a02 as To,a03 as vo,Jn as Fo,a04 as dr,f_ as lr,a05 as xo,Jp as Bo,Jo as bn,a06 as Lo,a07 as Ro,a08 as Oo,UE as Uo,a09 as Bt,a0a as jo,Fo as ur,mG as $o,id as Mo,L6 as No,a0b as mr,fM as Vo,fN as Ho,a0c as Go,dM as Ko,g2 as zo,KY as Yo,KS as Ze,bq as Wo,bJ as Zo,cG as qo,bK as Jo,Tw as Qo}from"./zeni-epic-state-C-d25VTi.js";import{Q as Le,df as Cr,a4 as we,dg as pr,dh as hr,di as Xo,G as ea,as as Lt,dj as ec,dk as ac,a as fr,e as gr,ar as br,p as ke,M as le,y as W,j as ya,dl as Sr,dm as tc,dn as nc,z as te,a7 as Ta,d4 as nt,dp as rc,dq as sc,dr as oc,a1 as va,bi as Qe,bE as Rt,ds as cc,ab as Fa,X as rt,E as Ot,k as ae,w as st,dt as ic,bQ as Sa,du as kt,dv as dc,a8 as Ut,dw as lc,ae as yr,av as Et,dx as uc,aq as Ir,P as kr,U as Er,dy as mc,dz as Cc,dA as pc,dB as hc,dC as fc,dD as gc,dE as bc,J as Ya,dF as Sc,dG as yc,m as ht,c as Ic,dH as kc,dI as Ec,dJ as Ac,ai as Dc,dK as _c,dL as Pc,g as wc}from"./index-BhyEYQTn.js";import{n as Ne,D as Ar,S as Tc}from"./mui-DCW4m3lZ.js";import{a as r}from"./sentry-DI7gLUjw.js";import{u as xa}from"./useAskAiCfoHostNavButtonProps-BVUNtLFK.js";import{M as Ee}from"./MobileAppDrawer-BPpLxyPF.js";import{d as jt}from"./recharts-HpXoq1DR.js";import{g as _e,a as Ba,b as Dr,c as Re,d as Oe,e as Xe,f as aa,h as ta,A as vc,i as $t,P as Fc,j as Mt,s as Ia,k as _r,l as ca,m as Pr,n as xc,o as wr,p as Bc,S as Sn}from"./SetupPagesScreen-B69hot1T.js";import{u as Tr}from"./useInitialThreadRequest-DTQjUnhP.js";import ot from"./NotFoundScreen-Bii3lrih.js";import{u as Nt}from"./useChargeCardPusherEvents-ldgEvsXz.js";import{n as yn}from"./utils-8Dv5nUFZ.js";import{t as Lc}from"./AddressScreen-zTtPIjPs.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./InboxNotificationsProvider-D007v5X6.js";import"./useTaskManagerAccess-U48bmWaI.js";import"./BusinessVerificationPageScreen-DXdSHPE6.js";import"./routePaths-DAdB7ufZ.js";import"./analyticsHelper-X6BcuRxb.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="aa1ab88e-517b-40ee-bb28-dfdefc3d8222",e._sentryDebugIdIdentifier="sentry-dbid-aa1ab88e-517b-40ee-bb28-dfdefc3d8222")}catch{}})();const Rc=e=>{const a=e.cardHolderUser,n=`${a.firstName??""} ${a.lastName??""}`.trim()||a.email||a.userId;return{userId:a.userId,displayName:n,roleLabel:e.cardHolderRoles?.titleAtCompany}},vr=e=>({id:e.id,isChecked:!1,cardName:e.cardName,last4:e.accountLast4,limitAmount:e.limit?.amount??0,limitCadence:e.creditLimitFrequency?.code,owner:Rc(e),utilizationAmount:(e.limit?.amount??0)-(e.available?.amount??0)});function Fr(){const e=me(),a=d((t=>Pt(t.cardPolicyState))),n=d((t=>is(t.cardPolicyState)));r.useEffect((()=>{n!==""||a==="Completed"&&n===""||a==="In-Progress"||e(wt())}),[e,a,n])}const{spendManagement:{chargeCard:{cardPolicyPage:In}}}=ea.getLocalizedStrings(),Oc=e=>Un(e,!1),Uc=e=>jn(e.name,!1);function jc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((O=>{h(O)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{isAiCfoAccessEnabled:m,onAskAiCfoClick:F}=xa({mobileExploreReferrer:"Card Policy"});r.useEffect((()=>()=>{t(ds()),t(ls()),t(fn())}),[t]);const w=d((O=>Pn(O.cardPolicyState))),p=d((O=>wn(O.cardPolicyState))),v=d((O=>Tn(O.cardPolicyState))),L=d((O=>vn(O.cardPolicyState))),S=d((O=>Fn(O.cardPolicyState))),l=d((O=>xn(O.cardPolicyState))),C=d((O=>Bn(O.cardPolicyState))),B=d((O=>Pt(O.cardPolicyState))),k=d((O=>O.chargeCardConfigState.receiptRequiredAboveAmount.amount)),_=d((O=>O.chargeCardConfigState.fetchState));r.useEffect((()=>{w!=="Completed"&&w!=="In-Progress"&&t(Ln())}),[t,w]),Fr();const D=d((O=>Rn(O.createCardPolicyState))),$=d((O=>us(O.createCardPolicyState))),E=d((O=>ms(O.cardPolicyState))),y=d((O=>Cs(O.cardPolicyState))),R=d((O=>ps(O.createCardPolicyState))),i=d((O=>On(O)));r.useEffect((()=>{i.fetchState==="Not-Started"&&t(ia(!1,!1,!1))}),[i.fetchState,t]);const f=r.useMemo((()=>p.map(Oc)),[p]),j=r.useMemo((()=>C.map(Uc)),[C]),G=r.useMemo((()=>i.cards.filter((O=>!Cr(O.status.code))).map(vr)),[i.cards]),U=w==="Completed"&&i.fetchState==="Completed"&&_==="Completed";r.useEffect((()=>{U&&R==null&&t(hs({cardsMasterList:G,defaultRequireReceiptAmount:k,suggestedAllowMerchants:v,suggestedBlockMerchants:L,suggestedAllowCategories:S,suggestedBlockCategories:l}))}),[_,t,U,R,G,k,v,L,S,l]);const x=r.useMemo((()=>jt((O=>{t(wt(O))}),250)),[t]);r.useEffect((()=>()=>{x.cancel()}),[x]);const z=r.useCallback((O=>{x(O)}),[x]),V=D.fetchState,T=n!=null?`/${n}/cards/policy`:"..",P=r.useCallback((()=>{const O=we(a.state?.pathnameStackToGoBack),q=O.poppedPathname??T;e(q,{state:{pathnameStackToGoBack:O.newStack}})}),[a.state,e,T]),K=r.useCallback((()=>{e(T)}),[e,T]),Z=r.useCallback((O=>{t(fs(O))}),[t]),I=r.useCallback((O=>{const q=pr(O);t(gs({templates:[q]}))}),[t]),M=r.useCallback((O=>{O.length!==0&&t(bs(O))}),[t]),N=r.useCallback((()=>{t(fn())}),[t]),Q=r.useRef(V);r.useEffect((()=>{const O=Q.current;Q.current=V,V==="Completed"&&O!=="Completed"&&$!=null&&(t(ze({messageSection:"card_policy_created",messageText:"success",type:"success"})),e(T))}),[t,V,$,e,T]);const c=V==="Error"?D.error?.message??In.createPolicyGenericErrorMessage:void 0;return g&&n!=null?R==null?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(hr,{showUploadDocumentSection:!0,navBarTitle:In.createPageTitle,onBackClick:P,onClickMenuIcon:u,isAiCfoAccessEnabled:m,onAskAiCfoClick:F})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(Xo,{formDraft:R,vendorSearchOptions:j,categorySearchOptions:f,isVendorSearchLoading:B==="In-Progress",onVendorSearchTextChange:z,submitState:V,submitErrorMessage:c,documentUploadState:E,uploadedFileName:y,isAiCfoAccessEnabled:m,onAskAiCfoClick:F,onBackClick:P,onCancelClick:K,onClickMenuIcon:u,onFormChange:Z,onSubmit:I,onUploadDocument:M,onRemoveDocument:N})]}):o.jsx(Je,{to:"..",replace:!0})}const{spendManagement:{chargeCard:{cardPolicyPage:$c}}}=ea.getLocalizedStrings(),Mc=e=>Un(e,!1),Nc=e=>jn(e.name,!1);function Vc(){const e=de(),a=he(),{tenantEmailDomain:n,templateId:t}=Me(),s=me(),g=Le(),b=ve(g?.loggedInUserRoleMap),[h,A]=r.useState(!1),u=r.useCallback((c=>{A(c)}),[]),m=r.useCallback((()=>{u(!0)}),[u]),{isAiCfoAccessEnabled:F,onAskAiCfoClick:w}=xa({mobileExploreReferrer:"Card Policy"}),p=d((c=>Ss(c))),v=d((c=>Pn(c.cardPolicyState))),L=d((c=>wn(c.cardPolicyState))),S=d((c=>Tn(c.cardPolicyState))),l=d((c=>vn(c.cardPolicyState))),C=d((c=>Fn(c.cardPolicyState))),B=d((c=>xn(c.cardPolicyState))),k=d((c=>Bn(c.cardPolicyState))),_=d((c=>Pt(c.cardPolicyState))),D=d((c=>On(c))),$=d((c=>t!=null?ys(c.cardPolicyState,t):void 0)),E=r.useMemo((()=>p.templateId===t&&p.formDraft!=null?p.formDraft:$!=null?Is($):void 0),[p.templateId,p.formDraft,$,t]);r.useEffect((()=>{if(t==null)return;const c=p.detailFetchState.fetchState;p.templateId===t&&(c==="Completed"||c==="In-Progress")||$!=null||s(ks(t))}),[s,t,p.templateId,p.detailFetchState.fetchState,$]),r.useEffect((()=>{v!=="Completed"&&v!=="In-Progress"&&s(Ln())}),[s,v]),Fr();const y=d((c=>c.chargeCardConfigState.receiptRequiredAboveAmount.amount));r.useEffect((()=>{D.fetchState==="Not-Started"&&s(ia(!1,!1,!1))}),[D.fetchState,s]);const R=r.useMemo((()=>L.map(Mc)),[L]),i=r.useMemo((()=>k.map(Nc)),[k]),f=r.useMemo((()=>D.cards.filter((c=>!Cr(c.status.code))).map(vr)),[D.cards]);Lt({isDataReady:E!=null});const j=r.useMemo((()=>{if(E!=null)return ec({draft:E,cardRows:f,categorySearchOptions:R,vendorSearchOptions:i,defaultRequireReceiptAmount:y,suggestedAllowMerchants:S,suggestedBlockMerchants:l,suggestedAllowCategories:C,suggestedBlockCategories:B})}),[E,f,R,i,y,S,l,C,B]),[G,U]=r.useState(void 0),x=r.useRef(!1);r.useEffect((()=>{x.current||G!=null||j==null||(x.current=!0,U(j))}),[G,j]);const z=r.useCallback((c=>{U(c)}),[]),V=r.useMemo((()=>jt((c=>{s(wt(c))}),250)),[s]);r.useEffect((()=>()=>{V.cancel()}),[V]);const T=r.useCallback((c=>{V(c)}),[V]),P=p.updateFetchState.fetchState,K=n!=null?`/${n}/cards/policy`:"..",Z=r.useCallback((()=>{const c=we(a.state?.pathnameStackToGoBack),O=c.poppedPathname??K;e(O,{state:{pathnameStackToGoBack:c.newStack}})}),[a.state,e,K]),I=r.useCallback((()=>{e(K)}),[e,K]),M=r.useCallback((c=>{if(t==null)return;const O=pr(c);s(Es(O)),s(As(t))}),[s,t]),N=r.useRef(P);r.useEffect((()=>{const c=N.current;N.current=P,P==="Completed"&&c!=="Completed"&&(s(ze({messageSection:"card_policy_updated",messageText:"success",type:"success"})),e(K))}),[s,P,e,K]);const Q=P==="Error"?p.updateFetchState.error?.message??$c.updatePolicyGenericErrorMessage:void 0;return!b||n==null||t==null?o.jsx(Je,{to:"..",replace:!0}):G!=null&&v==="Completed"&&D.fetchState==="Completed"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(ac,{templateName:p.template?.name??"",formDraft:G,vendorSearchOptions:i,categorySearchOptions:R,isVendorSearchLoading:_==="In-Progress",onVendorSearchTextChange:T,submitState:P,submitErrorMessage:Q,isAiCfoAccessEnabled:F,onAskAiCfoClick:w,onBackClick:Z,onCancelClick:I,onClickMenuIcon:m,onFormChange:z,onSubmit:M})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:h,handleDrawerToggle:u}),o.jsx(hr,{showUploadDocumentSection:!1,navBarTitle:p.template?.name,onBackClick:Z,onClickMenuIcon:m,isAiCfoAccessEnabled:F,onAskAiCfoClick:w})]})}function xr(e,a,n){return a?e.filter((t=>t!=null&&t.trim().length>0)).slice(0,n):[]}function Br(e){return d((a=>e==null||e===""?{chips:ft,isResolved:!1}:(function(n){const t=n?.fetchState,s=t==="Completed"||t==="Error";return{chips:t==="Completed"?n?.suggestedQuestions??ft:ft,isResolved:s}})(Ds(a,e))),_t)}const ft=[],{spendManagement:{chargeCard:{cardPolicyAiCfoHero:{headline:Hc,subheadline:Gc,pageTitle:Kc}}}}=ea.getLocalizedStrings(),zc=e=>{const a=e.cardsCount>0?e.cardsCount:e.appliedCards.length,n=e.allowedEntity.merchantNames.length+e.blockedEntity.merchantNames.length,t=e.allowedEntity.categoryCodes.length+e.blockedEntity.categoryCodes.length;return{templateId:e.templateId,name:e.name,description:e.description,mode:e.mode==="flexible"?"flexible":"strict",createdAtFormatted:e.createdAt.format("ll"),cardsCount:a,vendorRestrictionsCount:n,categoryRestrictionsCount:t}};function Yc(){const e=de(),a=he(),{tenantEmailDomain:n}=Me(),t=me(),s=Le(),g=ve(s?.loggedInUserRoleMap),[b,h]=r.useState(!1),A=r.useCallback((T=>{h(T)}),[]),u=r.useCallback((()=>{A(!0)}),[A]),{useFeatureGate:m}=le(),{isFeatureEnabled:F}=m(W.isAiCfoFileUploadEnabled),{isFeatureEnabled:w}=m(W.isCardPolicyEnabled),{isAiCfoAccessEnabled:p,onAskAiCfoClick:v}=xa({mobileExploreReferrer:"Card Policy"}),L=d((T=>_s(T))),S=d((T=>Rn(T.createCardPolicyState))),l=d((T=>Ps(T.createCardPolicyState))),C=d((T=>l==null?[]:Mn(T.aiCfoState,l).filter((P=>P.kind==="creating_policy"))),_t),B=S.fetchState==="In-Progress"?Math.max(C.length,1):0,k=d((T=>ws(T.createCardPolicyState))),_=ya(S.fetchState);r.useEffect((()=>{if(_==="In-Progress"&&S.fetchState==="Completed"&&l!=null)C.forEach((T=>{t(yt({chatSessionId:l,id:T.id,entityIds:k,kind:"created_policy"}))}));else if(_==="In-Progress"&&S.fetchState==="Error"&&l!=null){C.forEach((P=>{t(yt({chatSessionId:l,id:P.id,kind:"errored_policy"}))}));const T=S.error?.message!=null&&S.error.message.length>0?S.error.message:ea.getLocalizedStrings().common.errorMessage.somethingWentWrongPleaseTryAgain;t(ze({messageSection:"card_policy_created",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"_api-error_",variableValue:T}]}))}}),[S.error?.message,S.fetchState,t,l,k,C,_]);const D=L.fetchState.fetchState;r.useEffect((()=>{D!=="Not-Started"&&D!=="Error"||t(Ts())}),[t,D]);const $=L.archiveFetchState.fetchState,E=ya($);r.useEffect((()=>{E==="In-Progress"&&$==="Completed"&&t(ze({messageSection:"card_policy_deleted",messageText:"success",type:"success"}))}),[$,t,E]);const y=r.useMemo((()=>L.templates.map(zc)),[L.templates]);Lt({isDataReady:L.fetchState.fetchState==="Completed"});const R=y.length>0||B>0,i=(function(T){const{hasAnyPolicies:P,isChargeCardAdmin:K,isFileUploadEnabled:Z}=T,I=de(),M=he(),{tenantEmailDomain:N}=Me(),{isAiCfoOpen:Q,setIsAiCfoOpen:c}=fr(),O=gr(),q=br(),se=d((J=>$n(J))).createSessionAndSubmitState.fetchState==="In-Progress",{chips:X,isResolved:Ve}=Br("card_policy"),Ae=r.useMemo((()=>xr(X,Ve,3)),[X,Ve]),[ge,re]=r.useState(""),be=q&&O&&N!=null&&!Q,ue=r.useCallback((J=>{if(N==null)return;const fa=ke(M.state?.pathnameStackToGoBack,M.pathname);I(`/${N}/cards/ask`,{state:{message:"",origin:"",pathnameStackToGoBack:fa,referrer:"card_policy_hero",aiCfoInitialQuestion:J,aiCfoShouldSubmit:J!=null&&J.trim().length>0}})}),[M.pathname,M.state,I,N]),oe=r.useCallback((J=>{J.trim().length!==0&&(re(""),ue(J))}),[ue]),Se=r.useCallback((()=>{const J=ge.trim();J.length!==0&&(re(""),ue(J))}),[ge,ue]),ee=r.useCallback((()=>{}),[]),De=r.useCallback((J=>{re(J)}),[]),Te=r.useCallback((()=>{c(!0)}),[c]),Ce=r.useCallback((()=>{ue(void 0)}),[ue]);return r.useMemo((()=>{if(be&&!P&&K)return{aiAgentName:Kc,headline:Hc,subheadline:Gc,promptChips:Ae,composer:{currentInput:ge,isSubmitting:se,isFileUploadEnabled:Z,onInputChange:De,onSubmit:Se,onStopSubmit:ee},onPromptClick:oe,onOpenSidePanel:Te,onOpenFullView:Ce,dataTestIdPrefix:"card-policy-ai-cfo-hero"}}),[ge,P,be,K,Z,se,De,Ce,Te,oe,ee,Se,Ae])})({hasAnyPolicies:R,isChargeCardAdmin:g,isFileUploadEnabled:F}),f=w&&i!=null?o.jsx(Sr,{...i}):null,j=p&&f==null,G=r.useCallback((()=>{const T=we(a.state?.pathnameStackToGoBack),P=T.poppedPathname??"..";e(P,{state:{pathnameStackToGoBack:T.newStack}})}),[a.state,e]),U=r.useCallback((()=>{n!=null&&e(`/${n}/cards/policy/new`)}),[e,n]),x=r.useCallback((T=>{n!=null&&e(`/${n}/cards/policy/${T}/edit`)}),[e,n]),z=r.useCallback((T=>{t(vs(T))}),[t]),V=L.fetchState.fetchState;return!R&&V!=="Completed"&&V!=="Error"?o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(tc,{onBackClick:G,onNewPolicyClick:U,onClickMenuIcon:u,isAiCfoAccessEnabled:p,onAskAiCfoClick:v})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee,{isAppContentDrawerOpen:b,handleDrawerToggle:A}),o.jsx(nc,{policies:y,archivingTemplateId:L.archiveTargetTemplateId,pendingCreationCount:B,onBackClick:G,onNewPolicyClick:U,onEditPolicyClick:x,onArchivePolicyClick:z,onClickMenuIcon:u,policyAiCfoHero:f,isAiCfoAccessEnabled:j,onAskAiCfoClick:v})]})}function Wc(){const e=de(),{cardId:a}=Me(),n=me(),t=te.getSignedInUser(),s=d((X=>fe(X))),g=Le(),b=ve(g?.loggedInUserRoleMap),{useFeatureGate:h}=le();if(t==null)throw Error("Can't access Add To Wallet Page without signing in...");const[A,u]=r.useState(!1),m=d((X=>qa(X).firstViewAfterActivation));if(a==null)throw Error("Empty card id is not valid...");const F=s.userRole.includes("charge_card_user"),{isFeatureEnabled:w}=h(W.isChargeCardFeatureEnabled),p=!!s.companyChargeCardInfo?.info?.isChargeCardEnabled,{isFeatureEnabled:v}=h(W.isDebitCardFeatureEnabled),L=Fe(s),S=xe(s),l=Be(v,s),C=s.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,B=Re({isDebitCardFeatureEnabled:v,isBankingOnlyTenant:l}),k=Oe({isCardsOnlyTenant:L,isChargeCardFeatureEnabled:w,isBookKeepingTenant:S,isDebitCardProductVisible:B,chargeCardsCreditAccountLimit:C}),_=!!s.companyDebitCardInfo?.info?.isDebitCardEnabled,D=d((X=>da(X,s.companyId))),$=la(D.controllers),{creditAccount:E,creditAccountRepayment:y}=d((X=>ua(X))),R=d((X=>X.classListState.fetchState)),i=!F&&k&&p,f=d((X=>Tt(X,a,i,k))),[j,G]=r.useState(!1),U=f.chargeCard,x=U?.cardCreatedByUser?.userId,z=d((X=>x!=null?Ga(X.userRoleState,x):void 0)),V=z?.accountingClassIDs[0],T=d((X=>V!=null?Ka(X.classState,{classId:V,reportId:"class_list"}):void 0)),P=U?.cardHolderUser?.userId,K=d((X=>P!=null?Ga(X.userRoleState,P):void 0)),Z=K?.accountingClassIDs[0],I=d((X=>Z!=null?Ka(X.classState,{classId:Z,reportId:"class_list"}):void 0)),M=U?.type.code==="business_physical_credit_card"||U?.type.code==="business_physical_debit_card",N=U?.type.code==="business_physical_debit_card";r.useEffect((()=>{m&&A===!1&&M&&(u(!0),setTimeout((()=>{n(za()),N&&n(ze({messageSection:"set_debit_card_pin",messageText:"success",type:"success",showStatusIcon:!0}))}),5e3))}),[m,A,M,N]),r.useEffect((()=>{j||f.fetchState==="Completed"||f.fetchState==="In-Progress"||a==null||(G(!0),n(ka(a,i,!1)))}),[j,f,a,n]),r.useEffect((()=>{if(f.fetchState==="Completed"&&(M===!1||M&&U?.status?.code!=="active"||U?.cardHolderUserId!==t.userId||m===!1&&A===!1||U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card")){const X=_e(s.tenantEmailDomain,a,t,U,m);e(X)}}),[f.fetchState,m,M]),r.useEffect((()=>{E.fetchState!=="Completed"&&E.fetchState!=="In-Progress"&&k&&p&&b&&n(qe()),y.fetchState!=="Completed"&&y.fetchState!=="In-Progress"&&k&&p&&b&&n(vt()),R!=="Completed"&&R!=="In-Progress"&&n(Nn())}),[E.fetchState,y.fetchState,n,k,p,b,R]);const Q=()=>{if(t!=null&&a!=null){n(za());const X=_e(s.tenantEmailDomain,a,t);e(X)}},c=U?.type.code==="business_physical_debit_card"||U?.type.code==="business_virtual_debit_card",O=Xe(k,B,_,p),q=Ba(k,p,b,E,y),se=Dr(c,f);return f.fetchState!=="Completed"?o.jsx(Ta,{fetchState:"In-Progress"}):o.jsxs(o.Fragment,{children:[o.jsx(nt,{showConfetti:m}),o.jsx(rc,{onGotItClick:Q,isDebitCard:U?.type.code==="business_physical_debit_card",controllerEmails:$,isChargeCardFeatureEnabled:k,isDebitCardFeatureEnabled:B,isDebitCardSetupEnabled:_,isChargeCardSetupEnabled:p,productInformation:O,creditAccountInformation:q,debitAccountInformation:se,chargeCardDetailView:f,creditAccount:E,classListFetchState:R,creditAccountRepayment:y,cardIssuedByRoles:z?.userRoles,cardIssuedByDepartmentName:T?.className,cardHolderRoles:K?.userRoles,cardHolderDepartmentName:I?.className})]})}const Lr="charge-card-transaction-update",Rr="charge-card-transaction-created",Or="charge-card-transaction-declined",Ur="charge-card-transaction-updated",jr="charge-card-transaction-receipt-uploaded",pa="charge-card-status-update",Vt="charge-card-spending-updated",ct="credit-account-balance-updated",it="charge-card-created",Ht="charge-card-limit-updated",Gt="charge-card-limit-reset",Kt="charge-card-renamed",Zc="charge-card-department-updated",$r="charge-card-repayment-completed",Mr="charge-card-payment-date-updated",La="charge-card-cashback-redeemed",Ra="charge-card-cashback-earned",ha=(e,a)=>e==null||e===""?[]:a.map((n=>`private-encrypted-${e}.${n}`)),qc=[Ra,La],Jc=Pe((function(e){const a=ma(e);return{insightsData:a.insight,cashbackByPeriod:a.cashbackByPeriod,uiState:a.uiState,cashbackSummary:a.cashbackSummary}}),(function(e){return{onColumnSortConfigChanged:(a,n)=>{e(Fs({uiState:{sortKey:a,sortOrder:n}}))}}}))(oc);function Qc(){const e=de(),a=me(),n=he(),t=te.getSignedInUser(),s=d((v=>fe(v))),{useFeatureGate:g}=le(),{isFeatureEnabled:b}=g(W.isCardsCommentingEnabled),[h,A]=r.useState(!1),u=d((v=>ma(v))),m=Tr(s.companyId,{clearParams:u.fetchState==="Completed"}),F=r.useCallback((()=>{const v=we(n.state?.pathnameStackToGoBack),L=v.poppedPathname??Xc(s.tenantEmailDomain);e(L,{state:{pathnameStackToGoBack:v.newStack}})}),[e,n,s.tenantEmailDomain]),w=aa(s);if(Nt({events:ha(w,qc),onEvent:v=>{switch(v){case Ra:case La:return void a(_a(!0))}},onSubscribed:()=>{a(_a(!0))}}),r.useEffect((()=>{h||u.fetchState==="Completed"||u.fetchState==="In-Progress"||(A(!0),a(_a()))}),[h,u,a]),t==null)throw Error("Can't access cashback detail page without signing in...");const p=u.cashbackSummary?.cashbackEarned?.amount!=null&&u.fetchState!=="Not-Started";return u.fetchState!=="In-Progress"||p?(u.cashbackSummary?.cashbackEarned?.amount??0)===0&&u.fetchState==="Completed"?o.jsx(ot,{}):o.jsx(Jc,{onBackClick:F,isCardsCommentingEnabled:b,initialOpenThreadRequest:m}):o.jsx(sc,{onBackClick:F})}const Xc=e=>`/${e}/cards`,ei={containerWidth:new Fa(100,58)},ai=({appContent:e})=>{const a=va(),n=me(),t=de(),{cardId:s}=Me(),g=he(),{useDynamicConfig:b}=le(),[h,A]=r.useState(!1),[u,m]=r.useState(!1),[F,w]=r.useState(!1),[p,v]=r.useState(!1),L=te.getSignedInUser();if(L==null)throw Error("Can't access onboarding card page without signing in...");const S=d((I=>fe(I)));if(s==null)throw Error("Empty card id is not valid...");const{configValue:l}=b(Qe.zeniCardsConfig),C=l.max_charge_card_activation_attempts_by_card_id,B=d((I=>xs(I,s))),k=B.chargeCard,_=d((I=>I.chargeCardConfigState.fetchState)),{useFeatureGate:D}=le(),{isFeatureEnabled:$}=D(W.isChargeCardFeatureEnabled),{isFeatureEnabled:E}=D(W.isDebitCardFeatureEnabled),y=Be(E,S),R=Re({isDebitCardFeatureEnabled:E,isBankingOnlyTenant:y}),i=!!S.companyChargeCardInfo?.info?.isChargeCardEnabled,f=S.userRole.includes("charge_card_user"),j=Fe(S),G=xe(S),U=S.companyChargeCardInfo?.info?.chargeCardsCreditAccountLimit??0,x=Oe({isCardsOnlyTenant:j,isChargeCardFeatureEnabled:$,isBookKeepingTenant:G,isDebitCardProductVisible:R,chargeCardsCreditAccountLimit:U}),z=!f&&x&&i;r.useEffect((()=>{h===!1&&_!=="In-Progress"&&_!=="Completed"&&(n(Ja()),A(!0)),u===!1&&B.fetchState==="Not-Started"&&(m(!0),n(ka(s,z,x)))}),[u,B.fetchState,h,_]);const V=k?.type.code==="business_physical_credit_card"||k?.type.code==="business_physical_debit_card";r.useEffect((()=>{if(B.fetchState==="Completed"){if(F===!1&&(V===!1||V&&k?.status?.code!=="inactive"||k?.cardHolderUserId!==L.userId)){const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);t(I,{state:{pathnameStackToGoBack:M}})}else if(F&&B.isRefreshingViewInBackground===!1&&k?.status?.code==="active"){n(Bs({chargeCardId:s}));const I=_e(S.tenantEmailDomain,s,L,k,!0),M=ke(g.state?.pathnameStackToGoBack,g.pathname);n(Qa()),t(I,{state:{pathnameStackToGoBack:M}})}}}),[B.fetchState,k?.type.code,F,B.isRefreshingViewInBackground]);const T=te.getZeniOtpTokenForCardHolder(s),P=d((I=>Vn(I.userState,L.userId))),K=()=>{k?.status?.code!=="active"&&n(ba(s,!0))};r.useEffect((()=>{B.updatePhysicalChargeCardAttemptFetchState.fetchState==="Completed"&&k?.cardActivationAttemptHistory.some((I=>I.statusCode==="success"))===!0&&F===!1&&(setTimeout(K,3e3),w(!0))}),[B.updatePhysicalChargeCardAttemptFetchState.fetchState,k?.cardActivationAttemptHistory]);const Z=I=>{v(I)};if(_!=="Completed"||k==null)return o.jsx(Ta,{fetchState:"In-Progress"});if(k.shippingAddressId==null)throw Error("Can't access shippingAddressId.");if(P?.phone==null)throw Error("Can't access user phone number.");return o.jsxs(ri,{children:[o.jsx(Ee,{isAppContentDrawerOpen:p,handleDrawerToggle:Z}),o.jsx(ti,{cardId:s,card:k,shippingAddressId:k.shippingAddressId,phone:P.phone,signedInUser:L,isSandboxEnv:Rt(),chargeCardDetailState:B,signedInUserToken:T,navigate:t,currentTenant:S,location:g,maxChargeCardActivationAttempts:C[s]!=null?C[s]:l.default_max_charge_card_activation_attempts!=null?l.default_max_charge_card_activation_attempts:3,chargeCardCashbackRatePerTransaction:l.charge_card_cashback_rate_per_transaction!=null?l.charge_card_cashback_rate_per_transaction:.0175,onClickMenuIcon:()=>{Z(!0)}}),e!=null?o.jsx(ni,{windowSize:a,children:e}):null]})},ti=Pe((function(e,{chargeCardDetailState:a,shippingAddressId:n,location:t,cardId:s}){const g=Ls(e.addressState,n);if(g==null)throw Error("Can't access shippingAddress.");const b=Hn(e,s),h=a.updateStatus,A=Ca(e,!1,!1,!1);let u=!1;A.fetchState==="Completed"&&A.cards.length<=1&&(u=!0);const m=t.state?.message==="comingFromV2UrlPath";return{showActivatePage:a.chargeCard?.providerCardCreateTime!=null&&a.chargeCard.providerCardCreateTime.add(24,"h").isBefore(Rs())||m,showMenuIcon:u,shippingAddress:g,vgsVaultId:rt.cardVaultId,twoFAView:b,activationWaitStatus:h,isRefreshingViewInBackground:a.isRefreshingViewInBackground}}),(function(e,a){const{navigate:n,cardId:t,location:s,currentTenant:g,chargeCardDetailState:b}=a,h=b.chargeCard?.cardProviderID,{tenantEmailDomain:A}=g;return{onGetOtp:u=>{h!=null&&e(at(u,"ChargeCardHolder",t))},onUpdatePhysicalChargeCardAttempt:u=>{e(Us(t,u))},onResendOtp:u=>{h!=null&&e(et(u,"ChargeCardHolder",t))},onVerifyOtp:(u,m)=>{h!=null&&e(Xa(u,m,"ChargeCardHolder",t))},onVerifyOtpSuccess:u=>{u!=null&&te.saveZeniOtpTokenForCardHolder(u,t)},onCVVActivateSuccess:()=>{e(Os({chargeCardId:t}))},onBackClick:()=>{const u=we(s.state?.pathnameStackToGoBack),m=u.poppedPathname==null||u.poppedPathname.includes("onboard")===!0?ta(A):u.poppedPathname;n(m,{state:{pathnameStackToGoBack:u.newStack}})}}}))(cc),ni=Ne.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: ${e=>`${ei.containerWidth.value(e.windowSize)}%`};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-B3m51ZRo.js";import{a as g}from"./sentry-DI7gLUjw.js";import{h as w,u as k,g as x,i as T,j as O,l as E}from"./core-gUqdW_kq.js";import{z as C,br as F,a8 as P,k as V,U as A,q as N,bs as j,ae as L,aG as U,p as B}from"./index-BhyEYQTn.js";import{fE as D,gH as M,AY as _,gC as G,c8 as R,Xt as z,bn as Y,ul as H,u9 as X,my as q,o7 as S,Xu as Z,bE as $,cE as b,oi as J,os as K}from"./zeni-epic-state-C-d25VTi.js";import"./mui-DCW4m3lZ.js";import{d as Q}from"./routePaths-DAdB7ufZ.js";import{M as W}from"./MobileAppDrawer-BPpLxyPF.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]="115168a6-00e4-4941-a5a3-b72c475a92c7",n._sentryDebugIdIdentifier="sentry-dbid-115168a6-00e4-4941-a5a3-b72c475a92c7")}catch{}})();const ee=E((function(n){const t=G(n),i=C.getSignedInUser(),l=D(n),c=l.tenantId,p={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},f=R(l?.userRole??[])&&t.localData.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",e=z(n.companyConfigState),a=n.countryListState?.byCountryListCode?.nationalityCountryList?.countries??[];return{isCompanyVerified:t.companyView?.company?.company?.companyBillPayInfo?.companyVerificationStatus?.code==="verified",companyPassportView:t,allIndustries:e.companyIndustries??[],allNationalityCountries:a,isDisabled:f,authParams:p,filesEndPoint:`${L.fileMicroServiceBaseUrl}`,isZeniUser:Y(i)}}),(function(n,t){const{companyId:i,currentTenant:l,navigate:c,location:p}=t,{tenantEmailDomain:f}=l;return{onScheduleClick:e=>{let a=e.href;a.includes("http")||(a="https://".concat(a)),window.open(a,"_blank")},onSaveAll:()=>{n(K())},onAddressClick:e=>{const a=Q(f,e),o=B(p.state?.pathnameStackToGoBack,p.pathname);c(a,{state:{pathnameStackToGoBack:o}})},onResetClick:()=>{n(J({companyId:i}))},onBackClick:()=>{c("../")},onCompanyDetailsChanged:e=>{const{companyInfo:a,incInfo:o,taxDetails:r,zeniFinanceTeam:d}=e,{website:u}=a,{meetingLink:y}=d,{incDate:s}=o,{taxesFiledYears:h}=r,v={companyInfo:{...a,website:u!=""&&u!=null?b(u):void 0,meetingLink:y!=""&&y!=null?b(y):void 0,industry:a.industry.selectedOption,companyIndustryType:a.companyIndustryType?.selectedOption??void 0,companySubIndustry:a.companySubIndustry?.selectedOption??void 0,businessModel:a.businessModel.selectedOption??"",companySourceOfFunds:a.companySourceOfFunds?.selectedOption,companySourceOfFundsDescription:a.companySourceOfFundsDescription??void 0,countriesOfOperations:a.countriesOfOperations?.selectedOptions?.map((I=>I.length===2?I:U(I)))??[],transactionVolume:a.transactionVolume?.selectedOption??void 0,transactionVolumeDescription:a.transactionVolumeDescription??void 0,regulatedStatus:a.regulatedStatus??void 0,regulatedStatusDescription:a.regulatedStatusDescription??void 0,usNexus:a.usNexus??void 0,usNexusTypes:a.usNexusTypes?.selectedOptions??[],purposeOfAccount:a.purposeOfAccount?.selectedOption??void 0,purposeOfAccountDescription:a.purposeOfAccountDescription??void 0},incInfo:{typeOfInc:o.typeOfInc.selectedOption??"",stateOfInc:o.stateOfInc.selectedOption??"",incDate:s!=null?$(s?.toString()):s,fileId:o.fileIds[0]},taxDetails:{taxIdOrEIN:r.taxIdOrEIN,sicCode:r.sicCode,naicsCode:r.naicsCode,dunsNumber:r.dunsNumber,taxesFiledYears:h.selectedOptions.map((I=>parseInt(I))),fileId:r.fileIds[0]}};n(S({companyDetails:v}))},onPrimaryContactDetailsUpdated:e=>{n(S({primaryContact:{userId:e.userId,email:e.email.trim(),firstName:e.name.firstName,lastName:e.name.lastName}}))},onNewCompanyOfficerAdded:e=>{n(S({officers:[{officerType:e.officerType,email:e.email.trim(),phone:e.phone,firstName:e.name.firstName,lastName:e.name.lastName,userId:void 0}]}))},onNewCompanyOfficerRemoved:e=>{n(Z(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(q({files:e}))},onDeleteFile:e=>{n(X(e))},onEditFileName:(e,a)=>{n(H(e,a.split(".")[0]))}}}))(j);function de(){const n=w(),t=k(),i=x(),{tenantEmailDomain:l}=T(),[c,p]=g.useState(!1),[f,e]=g.useState(!1),a=O((s=>s.companyViewState.passportView.fetchState)),o=O((s=>s.companyConfigState.fetchState)),r=O((s=>D(s))),d=r.companyId??C.getSignedInUserTenant(l)?.companyId;if(C.getSignedInUser()==null)throw Error("Can't access company details page without signing in...");g.useEffect((()=>{c||a!=="Not-Started"||d==null||(p(!0),t(M(d)))}),[c,a,d,t]),g.useEffect((()=>{o==="Not-Started"&&t(_())}),[o,t]);const u=s=>{e(s)},y=a==="Not-Started"||a==="In-Progress"||o==="Not-Started"||o==="In-Progress";return d!=null&&a==="Error"?m.jsx(F,{onGoHome:()=>n("../",{replace:!0}),onReload:()=>window.location.reload()}):m.jsxs(m.Fragment,{children:[m.jsx(P,{analytics:V,onLoad:s=>s.trackPageLoaded(A.Event.companyPassport,N(i)?"Settings":"Company Passport")}),N(i)?m.jsx(W,{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};
@@ -0,0 +1,11 @@
1
+ import{j as I}from"./liveblocks-B3m51ZRo.js";import{a as o}from"./sentry-DI7gLUjw.js";import{u as F,h as P,g as z,j as C,N as w}from"./core-gUqdW_kq.js";import{T9 as H,fE as q,gk as G,pR as J,gL as A,gj as Q,gh as V,Tz as B,gg as O}from"./zeni-epic-state-C-d25VTi.js";import{u as K,z as E,L as D,G as M,J as W}from"./index-BhyEYQTn.js";import{n as X}from"./mui-DCW4m3lZ.js";import{P as h,a as _}from"./AccountMappingScreen-BCgETeoP.js";import{t as Y}from"./getLocaleForTenant-DQPwSKjF.js";import{g as Z,Q as ee}from"./QBOConnectionScreen-DTJHrTBk.js";import"./recharts-HpXoq1DR.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";import"./MobileAppDrawer-BPpLxyPF.js";import"./InboxNotificationsProvider-D007v5X6.js";import"./useTaskManagerAccess-U48bmWaI.js";import"./accountMappingHelper-qlU24D2s.js";import"./empty-CkcqWk4Z.js";import"./pdf-lib-Bku26ZcE.js";import"./index-70FTEc4H.js";import"./url-qyBRakHR.js";import"./index-DhQKJDfi.js";import"./decodeURIComponentSafe-Cst3Y24b.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]="dd58fabc-8b1f-4d6e-8616-d8ac9a1aff9f",t._sentryDebugIdIdentifier="sentry-dbid-dd58fabc-8b1f-4d6e-8616-d8ac9a1aff9f")}catch{}})();const te=X.div`
2
+ display: flex;
3
+ flex: 1 1 auto;
4
+ flex-direction: row;
5
+ justify-content: center;
6
+ align-items: center;
7
+ width: 100%;
8
+ height: 100vh;
9
+ background-color: ${t=>t.theme.colors.background};
10
+ box-shadow: ${t=>`0px 2px ${W.sp1} ${t.theme.colors.dropShadowNormal}`};
11
+ `;function we(){const t=F(),i=P(),v=z(),{setLoading:c,clearAllLoading:m}=K(),S=o.useRef(!1),b=o.useRef(!1),N=o.useRef(!1),f=o.useRef(!1),{code:L,realmId:U,state:$}=Z(v.search),p=L!==""&&U!==""&&$!=="";p&&(N.current=!0);const j=sessionStorage.getItem(h),u=j===_.pending,R=j===_.ready,x=C((s=>H(s))),e=C((s=>q(s))),n=C((s=>s.tenantState.fetchState)),r=C((s=>s.tenantState.activeTenantFetchState.fetchState)),a=E.getSignedInUser(),g=E.getActiveTenantForUser()?.tenantId,l=e?.externalConnections?.fetchState,d=e?.externalConnections?.saveConnectionState,y=e.externalConnections?.accounting[0]?.isValid;o.useLayoutEffect((()=>{c(D.CONNECTION_AUTH)}),[c]),o.useEffect((()=>{S.current||a==null||g==null||(S.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(c(D.TENANT_FETCHING),t(G(a.userId,g))))}),[S,n,c]),o.useEffect((()=>{e.tenantId==null&&!b.current&&a!=null&&(b.current=!0,!(g==null||g!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(J(a.userId)))}),[b,n,r]),o.useEffect((()=>{a==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||d!=="Error"||(c(D.CONNECTION_AUTH),t(A(a.userId,e.tenantId)))}),[d]),o.useEffect((()=>{n!=="Completed"&&r!=="Completed"||a==null||e?.tenantId==null||(t(Q(e.tenantId)),E.saveActiveTenantDomainForUser(e.tenantEmailDomain),V(a?.userId,a?.zeniSessionId,e.tenantId),M.updateAppLocaleID(Y(B(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||l==="In-Progress"||a==null||e==null||t(A(a.userId,e.tenantId)))}),[n,r,l]),o.useEffect((()=>{x.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&E.saveSignedInUserTenants(x.tenantsCoreDetailsInOrder)}),[x.tenantsCoreDetailsInOrder.length,n]);const T=e==null||n!=="Completed"&&r!=="Completed"||l!=="Completed";if(o.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||l!=="Completed"&&l!=="Error"||m()}),[n,r,l]),o.useEffect((()=>{u&&d==="In-Progress"&&(f.current=!0)}),[u,d]),o.useEffect((()=>{if(!u||T)return;const s=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return f.current&&d==="Completed"?(sessionStorage.setItem(h,_.ready),m(),void i(s,{replace:!0})):f.current&&d==="Error"?(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),void i(s,{replace:!0})):void(p||N.current||f.current||y!==!0||(sessionStorage.removeItem(h),t(O({messageSection:"accounting_projects_qbo_reconnect_failed",messageText:"failed",type:"error"})),m(),i(s,{replace:!0})))}),[u,T,d,p,y,e.tenantEmailDomain,m,t,i]),T)return null;if(p||y!==!0)return I.jsx(te,{children:I.jsx(ee,{})});if(u)return null;const k=e.tenantEmailDomain!=null?`/${e.tenantEmailDomain}/settings/accounting`:"/";return R?I.jsx(w,{to:k,replace:!0}):I.jsx(w,{to:"/",replace:!0})}export{we as default};
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-B3m51ZRo.js";import{z as a}from"./index-BhyEYQTn.js";import{g as n}from"./QBOConnectionScreen-DTJHrTBk.js";import"./sentry-DI7gLUjw.js";import{g as p,N as s}from"./core-gUqdW_kq.js";import"./zeni-epic-state-C-d25VTi.js";import"./recharts-HpXoq1DR.js";import"./mui-DCW4m3lZ.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";import"./empty-CkcqWk4Z.js";import"./pdf-lib-Bku26ZcE.js";import"./index-70FTEc4H.js";import"./url-qyBRakHR.js";import"./index-DhQKJDfi.js";import"./decodeURIComponentSafe-Cst3Y24b.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="c18cd95e-770d-4ff7-92bf-3374948ea538",t._sentryDebugIdIdentifier="sentry-dbid-c18cd95e-770d-4ff7-92bf-3374948ea538")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=n(t.search),d=a.getSignedInUser()?.userId??"";if(f(o,r,e,d)===!0){const m=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:m})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-C_WAhyd7.js";import{t as An,A as $e}from"./AddressScreen-ueBXhh2E.js";import wn from"./NotFoundScreen-BF2gJW91.js";import{a as d,t as Me}from"./sentry-lC29HHPj.js";import{h as _e,g as Te,u as se,i as Ee,j as x,N as Q,q as Pn,l as cn,n as Dn,o as H}from"./core-1xnf2RtE.js";import{fE as Y,dY as xe,dX as Ae,bq as Un,Tq as jn,bR as Bn,pP as Fn,AI as Rn,AL as Vn,UM as Ln,UN as Nn,lt as Oe,lw as dn,U0 as Gn,b$ as $n,c8 as fe,Ba as we,AX as Mn,UO as me,Bb as un,RA as Qn,mG as ln,dh as pn,UP as Kn,UQ as zn,u2 as qn,TQ as Ce,hU as Hn,TP as be,hR as Wn,FA as Xn,u6 as Zn,hJ as Jn,hM as Qe,UR as mn,US as Yn,Ll as et,UT as nt,Lp as tt,AO as at,UU as ot,UV as st,lr as rt,lu as it,Bn as ct,AZ as gn,B9 as dt,bE as Ke,cE as ut,Bm as ze,ul as lt,u9 as pt,my as mt,gF as gt,gE as ft,gD as yt,UW as ht,AR as Ct,Bo as bt,Br as St,Bu as It,BA as kt,di as Ot}from"./zeni-epic-state-BVNUxmav.js";import{z,M as Pe,y as Z,e as vt,p as q,a8 as re,h as g,aE as _t,ai as fn,a1 as Tt,X as yn,V as hn,l as J,W as ge,R as ve,aF as Et,I as qe,s as He,ae as xt,aG as We,aH as At,aI as wt}from"./index-DXVI9ztu.js";import{n as De}from"./mui-BAsIRnB1.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-3h-qdoms.js";import{u as Ut,a as jt}from"./useEmailConnectResultRefresh-BzSlD1q5.js";import{u as Bt}from"./useChargeCardPusherEvents-BQSY-ppK.js";import"./recharts-C2rsrRI6.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.js";import"./empty-GMcl-a5k.js";import"./pdf-lib-RqzDns79.js";import"./index-Ctq16f6K.js";import"./url-LYbpMOZt.js";import"./index-Dc3AC-iD.js";import"./decodeURIComponentSafe-DcD-XNVX.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="2c7ef53d-02f0-4add-8327-fcd575919faf",e._sentryDebugIdIdentifier="sentry-dbid-2c7ef53d-02f0-4add-8327-fcd575919faf")}catch{}})();const Xe=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Ft=()=>{const e=_e(),l=Te(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Ee(),n=z.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:C}=t(Z.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(Z.isArAgingFeatureEnabled),{isFeatureEnabled:w}=t(Z.isReferralFeatureEnabled),{isFeatureEnabled:A}=t(Z.isDebitCardFeatureEnabled),k=vt(),O=x((S=>Y(S))),P=x((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,B=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=xe(A,O),b=Ae(O),D=[],R=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Un(O?.userRole),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,E=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;R===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),T===!1&&D.push("bill_pay_card","bill_pay_promo_card"),E===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&D.push("rewards_card");const f=x((S=>{const F=[];C===!1&&F.push("accounts_payable_aging"),o===!1&&F.push("accounts_receivable_aging"),F.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&F.push("rewards_card"),k===!1&&F.push("expense_automation_card");const W=jn(S,F);return Bn(W.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Fn(n.userId,B,O.tenantId,!0,!1,D)))}),[a,P,m,b,n,O.tenantId,i]);const U=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{U.current||(U.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Xe(L?.businessVerified?.status),isKycDone:Xe(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ze=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Je=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
1
+ import{j as s}from"./liveblocks-B3m51ZRo.js";import{t as An,A as $e}from"./AddressScreen-zTtPIjPs.js";import wn from"./NotFoundScreen-Bii3lrih.js";import{a as d,t as Me}from"./sentry-DI7gLUjw.js";import{h as _e,g as Te,u as se,i as Ee,j as x,N as Q,q as Pn,l as cn,n as Dn,o as H}from"./core-gUqdW_kq.js";import{fE as Y,dY as xe,dX as Ae,bq as Un,Tq as jn,bR as Bn,pP as Fn,AI as Rn,AL as Vn,UM as Ln,UN as Nn,lt as Oe,lw as dn,U0 as Gn,b$ as $n,c8 as fe,Ba as we,AX as Mn,UO as me,Bb as un,RA as Qn,mG as ln,dh as pn,UP as Kn,UQ as zn,u2 as qn,TQ as Ce,hU as Hn,TP as be,hR as Jn,FA as Xn,u6 as Zn,hJ as Wn,hM as Qe,UR as mn,US as Yn,Ll as et,UT as nt,Lp as tt,AO as at,UU as ot,UV as st,lr as rt,lu as it,Bn as ct,AZ as gn,B9 as dt,bE as Ke,cE as ut,Bm as ze,ul as lt,u9 as pt,my as mt,gF as gt,gE as ft,gD as yt,UW as ht,AR as Ct,Bo as bt,Br as St,Bu as It,BA as kt,di as Ot}from"./zeni-epic-state-C-d25VTi.js";import{z,M as Pe,y as Z,s as vt,p as q,a8 as re,k as g,aE as _t,ai as fn,a1 as Tt,c as yn,Q as hn,j as W,X as ge,U as ve,aF as Et,J as qe,x as He,ae as xt,aG as Je,aH as At,aI as wt}from"./index-BhyEYQTn.js";import{n as De}from"./mui-DCW4m3lZ.js";import{g as Pt,h as Dt,q as ie}from"./QBOConnectionScreen-DTJHrTBk.js";import{u as Ut,a as jt}from"./useEmailConnectResultRefresh-BDGN0_Dv.js";import{u as Bt}from"./useChargeCardPusherEvents-ldgEvsXz.js";import"./recharts-HpXoq1DR.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";import"./empty-CkcqWk4Z.js";import"./pdf-lib-Bku26ZcE.js";import"./index-70FTEc4H.js";import"./url-qyBRakHR.js";import"./index-DhQKJDfi.js";import"./decodeURIComponentSafe-Cst3Y24b.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="dce4b7ba-374e-4111-ac0f-df7aa1e094ec",e._sentryDebugIdIdentifier="sentry-dbid-dce4b7ba-374e-4111-ac0f-df7aa1e094ec")}catch{}})();const Xe=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Ft=()=>{const e=_e(),l=Te(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Ee(),n=z.getSignedInUser(),{useFeatureGate:t}=Pe(),{isFeatureEnabled:C}=t(Z.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(Z.isArAgingFeatureEnabled),{isFeatureEnabled:w}=t(Z.isReferralFeatureEnabled),{isFeatureEnabled:A}=t(Z.isDebitCardFeatureEnabled),k=vt(),O=x((S=>Y(S))),P=x((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,B=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(n==null)throw Error("Can't access onboarding flow without signing in...");const m=xe(A,O),b=Ae(O),D=[],R=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Un(O?.userRole),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,E=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;R===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),T===!1&&D.push("bill_pay_card","bill_pay_promo_card"),E===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&D.push("rewards_card");const f=x((S=>{const F=[];C===!1&&F.push("accounts_payable_aging"),o===!1&&F.push("accounts_receivable_aging"),F.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&F.push("rewards_card"),k===!1&&F.push("expense_automation_card");const J=jn(S,F);return Bn(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Fn(n.userId,B,O.tenantId,!0,!1,D)))}),[a,P,m,b,n,O.tenantId,i]);const U=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{U.current||(U.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Xe(L?.businessVerified?.status),isKycDone:Xe(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_t,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],Ze=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},We=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${e=>e.theme.colors.grey4};
@@ -23,7 +23,7 @@ import{j as s}from"./liveblocks-C_WAhyd7.js";import{t as An,A as $e}from"./Addre
23
23
  }
24
24
 
25
25
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
26
- `,nn=cn((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=Y(e),C=we(e,i),o=mn(e),w=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",A=Yn(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:w,companyTitles:A.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:xt.fileMicroServiceBaseUrl,authParams:n},signedInUser:z.getSignedInUser(),currentTenant:t,isAdmin:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,C)=>{e(St(n,t,C))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(Ct(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((C=>{const{officerType:o,userId:w,name:A,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:B,syncToken:m,selectDocument:b,role:D,ownership:R,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,isPhoneVerified:E}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:o,userId:w,firstName:A.firstName,lastName:A.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?We(P.selectedOption):void 0,phone:B,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:R,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:E}}));e(ze({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(ht({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:C,companyIndustryType:o,companyLegalName:w,companyTaxId:A,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:B,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:R,stateOfIncorporation:h,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:E,companySubIndustry:f,countriesOfOperations:U,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:F,usNexus:W,usNexusTypes:$}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:w,taxIdOrEIN:A,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:R?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:E,companySubIndustry:f?.selectedOption??"",countriesOfOperations:U?.selectedOptions.map((V=>V.length===2?V:We(V)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:F,usNexus:W,usNexusTypes:$?.selectedOptions??[]},ce={userId:B,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(n,t,C)=>{e(dt(i,!1,t,C,n))},onAddressEditHandler:n=>{if(n!=null){const t=An(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,C)=>{e(rt(n,t,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(Et),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=fn(),p=_e(),u=Te(),c=se(),v=Tt(),n=yn(),[t,C]=d.useState(!1),[o,w]=d.useState(!1),[A,k]=d.useState(!1),{tenantEmailDomain:O}=Ee(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:B}=_(Z.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=x((y=>y.onboardingCustomerViewState.fetchState)),D=x((y=>y.onboardingCustomerViewState.currentStep)),R=x((y=>y.onboardingCustomerViewState.uiState)),h=x((y=>Y(y))),r=x((y=>y.userRoleConfigState.fetchState)),T=x((y=>y.cardPaymentViewState)),E=J(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:U,realmId:N,state:G}=Pt(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,F=L?.connectionId??"",W=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(w(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{A||(dn(["card"]),k(!0))}),[A]),d.useEffect((()=>{E==="In-Progress"&&f==="Completed"&&c(Oe())}),[E,f]),d.useEffect((()=>{Dt(U,N,G,F,W)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Gn(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:U,realm_id:N,connection_id:F,user_id:W},$n(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:F},g.trackOnboardingSaveQBOConnection(N,F),p(u.pathname))}),[U,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),V=x((y=>we(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=h.externalConnections?.saveConnectionState,Ue=J(ne);d.useEffect((()=>{Ue==="In-Progress"&&(ne==="Completed"||ne==="Error")&&R.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,Ue,R.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const Cn=J(V.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{V.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&V.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Cn==null&&c(ln({addressType:"company_registered_address",addressToCreate:V.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[V.companyDetailsLocalData?.addressStatus?.addressToCreate,V.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=V.isInterimEmailSent,je=z.getSignedInUser();if(je==null)throw Error("Can't access onboarding flow without signing in...");const Sn=xe(B,h),In=Ae(h),Be=h.company?.companyOnboardingInfo.isOnboardingCompleted,Fe=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Re=Rt({tenantEmailDomain:O??"",signedInUserEmail:je.userEmail??"",companyId:M}),Ve=(({companyId:y})=>{const K=se(),de=x((j=>j.onboardingCustomerViewState?.aiAgentsActivation)),te=x((j=>Y(j).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Rn())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Vn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const j=`private-encrypted-${y}`;return[`${j}.ledger-ingestion.counts-updated`,`${j}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((j,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(j!=="ledger-ingestion.counts-updated"){if(j==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",X=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:X==="starting"||X==="building"||X==="ready"?X:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Ln({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Bt({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const j=de?.phases??[],ae=Ze(j,Se),I=Ze(j,Ie),ue=Je(j,Se),X=Je(j,Ie),Ne=j.some((xn=>xn.status!=="idle")),oe=!te&&!Ne,Ge=te&&!Ne,Tn=Ge?Se.map((()=>"building")):ae,En=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:Tn,backgroundRowStatuses:oe?void 0:En,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:X,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});if(Be===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=V.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Fe(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Re,aiAgentsActivationProps:Ve,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Be===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Fe(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Re,aiAgentsActivationProps:Ve,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Rt=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=Ut(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=jt({companyId:i}),n=x((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=x((r=>Y(r))),C=x((r=>r.tenantState.fetchState)),o=x((r=>Kn(r,i))),w=x((r=>zn(r,ke))),A=d.useMemo((()=>new Set(w.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[w]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{a(qn(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,B=J(P);d.useEffect((()=>{B==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,B,_]);const m=o.externalConnections?.saveOAuthConnectionState,b=o.externalConnections?.saveOAuthConnectionError?.message,D=J(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const R=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=J(R);return d.useEffect((()=>{const r=R??{},T=h??{},E=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let U;try{U=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(U,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(U,"Onboarding","payments",E[f]?.message??"")}))}),[R,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:A,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,T])=>[r,T?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,T)=>{const E=o.externalConnections?.revenue?.find((U=>U.connectionName==="hubspot"))?.connectionId;if(E==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:T,connection_id:E,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,T)=>{const E=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((U=>U.connectionId===r))?.connectionName;let f;try{f=E!=null?Ce(E):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),a(Jn(k,r,be(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Xn())},onSaveChargeBeeCredentials:(r,T)=>{const E=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;E!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Wn(k,E,be("revenue"),Ce("chargebee"),{api_key:r,site:T})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(Hn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,o,C,A,p,k,l,e,a,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const on=De.div`
26
+ `,nn=cn((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,n={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},t=Y(e),C=we(e,i),o=mn(e),w=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",A=Yn(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:w,companyTitles:A.companyTitles,connectedAccountProvider:t.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:xt.fileMicroServiceBaseUrl,authParams:n},signedInUser:z.getSignedInUser(),currentTenant:t,isAdmin:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;return{onFetchLinkTokenClick:(n,t)=>{e(kt(n,t))},onEstablishConnectionClick:(n,t)=>{e(It(n,t))},onUpdatePaymentAccountStatus:(n,t,C)=>{e(St(n,t,C))},onUpdatePaymentAccountLoginStatus:(n,t)=>{e(bt(!1,n,t))},onEstablishConnectionSuccess:()=>{e(Ct(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:n=>{e(me({isQBOPopupOpen:n}))},onCompanyOfficerUpdated:n=>{const t=n.map((C=>{const{officerType:o,userId:w,name:A,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:B,syncToken:m,selectDocument:b,role:D,ownership:R,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,isPhoneVerified:E}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:o,userId:w,firstName:A.firstName,lastName:A.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Je(P.selectedOption):void 0,phone:B,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:R,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:T,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:E}}));e(ze({officers:t}))},onGetOtp:(n,t)=>{e(yt(n,"CustomerOnboarding")),t!=null&&e(ht({officerType:t,phone:n}))},onResendOtp:n=>{e(ft(n,"CustomerOnboarding"))},onVerifyOtp:(n,t)=>{g.trackOnboardingPhoneVerified(),e(gt(n,t,"CustomerOnboarding"))},updateFilesEntity:n=>{e(mt({files:n}))},onDeleteFile:n=>{e(pt(n))},onEditFileName:(n,t)=>{e(lt(n,t.split(".")[0]))},onCompanyDetailsChanged:n=>{const{companyDescription:t,companyIndustry:C,companyIndustryType:o,companyLegalName:w,companyTaxId:A,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:B,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:R,stateOfIncorporation:h,incDate:r,companySourceOfFunds:T,companySourceOfFundsDescription:E,companySubIndustry:f,countriesOfOperations:U,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:F,usNexus:J,usNexusTypes:$}=n,M={companyId:i,companyDescription:t,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:w,taxIdOrEIN:A,website:k!=""&&k!=null?ut(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:R?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:T?.selectedOption??"",companySourceOfFundsDescription:E,companySubIndustry:f?.selectedOption??"",countriesOfOperations:U?.selectedOptions.map((V=>V.length===2?V:Je(V)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:F,usNexus:J,usNexusTypes:$?.selectedOptions??[]},ce={userId:B,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(n,t)=>{const C=an(v,n,t),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(n,t,C)=>{e(dt(i,!1,t,C,n))},onAddressEditHandler:n=>{if(n!=null){const t=An(n);e(ln({addressType:"subscription_billing_address",addressToCreate:t}))}},onSkipSetupClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);e(gn(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:n}})},onUpdateStep:n=>{e(un({step:n}))},onUpdateSubStep:n=>{e(ct({subStep:n}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const n=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:n,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:n=>{e(dn(n))},handleConfirmCardSetupIntent:n=>{e(it(n))},updateCardPaymentModalState:n=>{e(me({isCardPaymentPopupOpen:n}))},handleAddCardPaymentSource:(n,t,C)=>{e(rt(n,t,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(st())},handleResetCardPaymentErrorStatuses:()=>{e(ot())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const n=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:n,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(at(i)))},onIdentityDocumentUploadedForAutofill:n=>{if(i==null)return;const t=nt(n.documentType);t!=null&&(g.trackOnboardingDocumentUploaded("kyc",t),e(tt({target:"onboarding",companyId:i,officerType:n.officerType,fileId:n.fileId,documentType:t})))},onCompanyDocumentUploadedForAutofill:n=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",n.documentType),e(et({target:"onboarding",companyId:i,fileId:n.fileId,documentType:n.documentType})))}}}))(Et),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=fn(),p=_e(),u=Te(),c=se(),v=Tt(),n=yn(),[t,C]=d.useState(!1),[o,w]=d.useState(!1),[A,k]=d.useState(!1),{tenantEmailDomain:O}=Ee(),P=hn(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:B}=_(Z.isDebitCardFeatureEnabled),m=Pn("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=x((y=>y.onboardingCustomerViewState.fetchState)),D=x((y=>y.onboardingCustomerViewState.currentStep)),R=x((y=>y.onboardingCustomerViewState.uiState)),h=x((y=>Y(y))),r=x((y=>y.userRoleConfigState.fetchState)),T=x((y=>y.cardPaymentViewState)),E=W(T.addCardPaymentSourceStatus.fetchState),f=T.addCardPaymentSourceStatus.fetchState,{code:U,realmId:N,state:G}=Pt(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,F=L?.connectionId??"",J=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(w(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{A||(dn(["card"]),k(!0))}),[A]),d.useEffect((()=>{E==="In-Progress"&&f==="Completed"&&c(Oe())}),[E,f]),d.useEffect((()=>{Dt(U,N,G,F,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Gn(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:U,realm_id:N,connection_id:F,user_id:J},$n(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:F},g.trackOnboardingSaveQBOConnection(N,F),p(u.pathname))}),[U,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),V=x((y=>we(y,M)));d.useEffect((()=>{t||b!=="Not-Started"||M==null||(C(!0),c(Mn(M,!0,!m)))}),[t,b,M]);const ne=h.externalConnections?.saveConnectionState,Ue=W(ne);d.useEffect((()=>{Ue==="In-Progress"&&(ne==="Completed"||ne==="Error")&&R.isQBOPopupOpen&&D==="connect_ledger"&&(ne==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[ne,Ue,R.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(un({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Qn(!0))}),[r,c]);const Cn=W(V.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{V.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&V.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&Cn==null&&c(ln({addressType:"company_registered_address",addressToCreate:V.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[V.companyDetailsLocalData?.addressStatus?.addressToCreate,V.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const bn=V.isInterimEmailSent,je=z.getSignedInUser();if(je==null)throw Error("Can't access onboarding flow without signing in...");const Sn=xe(B,h),In=Ae(h),Be=h.company?.companyOnboardingInfo.isOnboardingCompleted,Fe=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,kn=ye===!0&&!pn(h),On=h.productSettings.isTreasuryEnabled,Re=Rt({tenantEmailDomain:O??"",signedInUserEmail:je.userEmail??"",companyId:M}),Ve=(({companyId:y})=>{const K=se(),de=x((j=>j.onboardingCustomerViewState?.aiAgentsActivation)),te=x((j=>Y(j).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Rn())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||te||K(Vn(y))}),[y,te,K]),vn=d.useMemo((()=>{if(y==null||y==="")return[];const j=`private-encrypted-${y}`;return[`${j}.ledger-ingestion.counts-updated`,`${j}.ai-agents-activation.phase-changed`]}),[y]),_n=d.useCallback(((j,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(j!=="ledger-ingestion.counts-updated"){if(j==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",X=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Nn({key:ue,status:X==="starting"||X==="building"||X==="ready"?X:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Ln({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Bt({events:vn,onEvent:_n,onSubscribed:he}),d.useMemo((()=>{const j=de?.phases??[],ae=Ze(j,Se),I=Ze(j,Ie),ue=We(j,Se),X=We(j,Ie),Ne=j.some((xn=>xn.status!=="idle")),oe=!te&&!Ne,Ge=te&&!Ne,Tn=Ge?Se.map((()=>"building")):ae,En=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:Tn,backgroundRowStatuses:oe?void 0:En,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:X,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,te,Le])})({companyId:M});if(Be===!0){if(!ye)return On?s.jsx(Q,{to:"../../treasury"}):Sn?s.jsx(Q,{to:"../../checking"}):In?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=V.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Fe(K)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Re,aiAgentsActivationProps:Ve,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Be===!1&&P?.loggedInUserRoleMap!=null)return bn===!0&&kn?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Fe(y)}),s.jsx(nn,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:n,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Re,aiAgentsActivationProps:Ve,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(en,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Rt=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=Ut(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=jt({companyId:i}),n=x((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=x((r=>Y(r))),C=x((r=>r.tenantState.fetchState)),o=x((r=>Kn(r,i))),w=x((r=>zn(r,ke))),A=d.useMemo((()=>new Set(w.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[w]),k=t.tenantId,O=fe(t.userRole??[]);d.useEffect((()=>{a(qn(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,B=W(P);d.useEffect((()=>{B==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,B,_]);const m=o.externalConnections?.saveOAuthConnectionState,b=o.externalConnections?.saveOAuthConnectionError?.message,D=W(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const R=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=W(R);return d.useEffect((()=>{const r=R??{},T=h??{},E=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(T[f]!=="In-Progress")return;let U;try{U=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(U,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(U,"Onboarding","payments",E[f]?.message??"")}))}),[R,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:A,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,T])=>[r,T?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",tn()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",tn()))},onConnectHubSpot:(r,T)=>{const E=o.externalConnections?.revenue?.find((U=>U.connectionName==="hubspot"))?.connectionId;if(E==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:T,connection_id:E,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,T)=>{const E=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((U=>U.connectionId===r))?.connectionName;let f;try{f=E!=null?Ce(E):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",T),a(Wn(k,r,be(T)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zn(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Xn())},onSaveChargeBeeCredentials:(r,T)=>{const E=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;E!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Jn(k,E,be("revenue"),Ce("chargebee"),{api_key:r,site:T})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(Hn(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:n})),[O,o,C,A,p,k,l,e,a,u,c,v,n])};function tn(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function an(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const on=De.div`
27
27
  display: flex;
28
28
  height: 100vh;
29
29
  background-color: ${e=>e.theme.colors.grey4};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-C_WAhyd7.js";import{i as K,j as _,g as Z,u as z,h as J,l as ne,k as oa,n as ft,o as F,N as yn}from"./core-1xnf2RtE.js";import{fE as L,V6 as Ze,bE as sa,br as Ee,Wt as vn,k9 as An,Wu as Yt,Wv as In,kc as gt,Ww as qe,Wx as En,kh as Dn,Wy as Gt,Wz as Tn,kl as bt,WA as Qe,WB as xn,WC as wn,Vq as Pn,ln as On,WD as Fn,bn as Je,WE as ra,W4 as ue,bc as ia,lB as ca,lk as la,W6 as me,W5 as ae,fD as da,g9 as jn,gp as Ct,WF as Rn,WG as Bn,WH as ua,WI as Oe,Dh as Me,Di as Ue,DG as De,DA as pe,Dm as Le,WJ as Mn,b$ as Ve,WK as Un,WL as Ln,WM as ma,WN as Fe,WO as Vn,eb as et,zu as pa,WP as Yn,WQ as ha,WR as Gn,WS as Nn,WT as $n,WU as St,U2 as kt,tA as Te,l_ as xe,DQ as yt,zB as Wn,zI as zn,WV as Xn,WW as Kn,Dj as Nt,WX as qn,zx as Ae,zs as fa,WY as be,WZ as $t,W_ as Qn,W$ as vt,U1 as At,BF as ga,X0 as Hn,X1 as ba,X2 as Zn,X3 as Jn,X4 as eo,X5 as It,BU as to,B$ as ao,X6 as no,X7 as oo,Dl as Wt,X8 as so,BD as Ca,X9 as Ce,Xa as zt,Xb as ro,bq as _a,DV as Sa,Xc as io,Xd as ka,Xe as co,Xf as lo,Xg as uo,Xh as Et,DN as mo,DP as po,Xi as ho,Xj as fo,Dk as Xt,Xk as go,DT as ya,Xl as _e,Xm as Kt,Xn as bo,Xo as Co,Xp as va,lP as Aa,pW as Ia,lU as Ea,pU as Da,pT as Ta,pS as xa,B0 as _o,db as So,pP as ko,Tq as yo,q4 as vo,Xq as Ao,Xr as Io,Xs as Eo,b5 as Dt,p_ as Do,ib as To,gH as xo,pZ as wo,ld as Po,pX as Oo,pV as Fo,dY as jo,dX as Ro}from"./zeni-epic-state-BVNUxmav.js";import{z as V,av as oe,p as j,h as D,G as q,bb as Bo,as as Ye,a8 as Ge,bc as wa,R as $,bd as Mo,be as Pa,E as Uo,bf as Lo,bg as Vo,a as Oa,a1 as Fa,d as ja,ar as Yo,bh as Go,ao as No,M as we,bi as Ra,v as ce,bj as Ba,bk as Ma,au as Ua,bl as $o,ai as Ne,V as $e,y as Y,bm as Wo,e as zo,l as Xo,a4 as Ko,aq as qo,bn as Qo,bo as Ho,bp as Zo,bq as Ie}from"./index-DXVI9ztu.js";import{n as Tt}from"./mui-BAsIRnB1.js";import{a as b}from"./sentry-lC29HHPj.js";import{w as La}from"./withTransactionSidePanel-CkEUNYr4.js";import{c as Va,t as Pe,f as he,b as xt,a as wt,v as Jo}from"./routePaths-3iKgurJn.js";import{u as se}from"./useAskAiCfoHostNavButtonProps-C4hcJx1x.js";import Be from"./NotFoundScreen-BF2gJW91.js";import{u as Pt}from"./useInitialThreadRequest-BFDb_b7F.js";import{t as Ya}from"./analyticsHelper-BSm7IqEZ.js";import{C as es}from"./CompanyPassportScreen-XQqdGh6R.js";import{u as ts}from"./useAiCfoDashboardSuggestedQuestionsChips-DtwiUC9S.js";import{F as as}from"./FeaturePreviewScreen-CWY6I3fG.js";import"./recharts-C2rsrRI6.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.js";import"./TransactionDetailScreen-p3o65tsz.js";import"./decodeURIComponentSafe-DcD-XNVX.js";import"./expenseAutomationHelper-CNRtAWpH.js";import"./MobileAppDrawer-DH0tVOfv.js";import"./InboxNotificationsProvider-BU6hQETc.js";import"./useTaskManagerAccess-B7YJLgDK.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="f6a65bcd-656d-4dbf-b77e-06f0f182d02e",e._sentryDebugIdIdentifier="sentry-dbid-f6a65bcd-656d-4dbf-b77e-06f0f182d02e")}catch{}})();const ns=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=V.getSignedInUser(),i=_((E=>E.tenantState.currentTenantId)),l=_((E=>L(E))),{tenantEmailDomain:m}=K(),p=Z(),h=l?.companyName??"",f={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo((()=>({authParams:f,companyName:h,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:Ze()})),[]),u=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),C=z(),g=J(),k=_((E=>vn(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(An(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),S=b.useCallback(((E,B)=>{C(Yt({sortKey:E,sortOrder:B}))}),[]),T=b.useCallback((E=>{C(Yt({downloadState:E}))}),[]),P=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const B=Va({id:E.transactionId,type:E.transactionType},m);g(B);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(B,{state:{pathnameStackToGoBack:y}})}}),[m,e]),x=b.useCallback((()=>{k.vendor!=null&&D.trackApAgingDetail("AP Aging",u.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&x()}),[x,k.fetchState]),d.jsx(Bo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:D,onTransactionClick:P,onReload:I,onBackClick:v,onColumnSortConfigChanged:S,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),os=()=>{const e=z(),a=J(),t=_((S=>In(S))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AP Aging"});Ye({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=_((S=>S.tenantState.currentTenantId)),i=_((S=>L(S))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),h=t.apAgingUIState.selectedDate??Ee(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((S=>{e(qe({searchString:S}))}),[]),C=b.useCallback(((S,T)=>{e(qe({sortKey:T,sortOrder:S}))}),[]),g=b.useCallback((S=>{a(`./${S}/${h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((S=>{e(qe({downloadState:S}))}),[]),I=b.useCallback(((S,T)=>{}),[]),v=b.useCallback(((S,T)=>{e(qe({selectedDate:S,agingDateSelectionType:T})),e(gt(S))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:D,onLoad:S=>S.trackPageLoaded($.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:D,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ss=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=V.getSignedInUser(),i=_((x=>L(x))),{tenantEmailDomain:l}=K(),m=Z(),p=i.companyName,h={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},f=b.useMemo((()=>({authParams:h,companyName:p,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:Ze()})),[]),c=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),u=z(),C=J(),g=_((x=>En(x,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Dn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((x,E)=>{u(Gt({sortKey:x,sortOrder:E}))}),[]),S=b.useCallback((x=>{u(Gt({downloadState:x}))}),[]),T=b.useCallback((x=>{if(e)e(x.transactionId,x.transactionType);else if(l!=null){const E=Va({id:x.transactionId,type:x.transactionType},l);C(E);const B=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:B}})}}),[l,e]),P=b.useCallback((()=>{g.customer!=null&&D.trackArAgingDetail("AR Aging",c.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&P()}),[g.fetchState,P]),d.jsx(Mo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:D,onTransactionClick:T,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:S,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),rs=()=>{const e=z(),a=J(),t=_((v=>Tn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AR Aging"});Ye({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=_((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),p=t.arAgingUIState.selectedDate??Ee(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),u=b.useCallback(((v,S)=>{e(Qe({sortKey:S,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),k=b.useCallback(((v,S)=>{e(Qe({selectedDate:v,agingDateSelectionType:S})),e(bt(v))}),[]),I=b.useCallback(((v,S)=>{e(xn({nodeId:v,isCollapsed:S}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:D,onLoad:v=>v.trackPageLoaded($.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:D,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Pn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(On(n,o))}}}const is=ne((function(e){const a=wn(e).accountsInOrder.map(((t,n)=>Ga(t,n)));return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:D}}),Na)(Pa),cs=ne((function(e){const a=Fn(e).accountsInOrder.map(((o,r)=>Ga(o,r))),t=V.getSignedInUser(),n=Je(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:D}}),Na)(Pa);function ls(){const e=J(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(is,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function ds(){const e=J(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(cs,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const us=Tt.div`
1
+ import{j as d}from"./liveblocks-B3m51ZRo.js";import{i as K,j as _,g as Z,u as z,h as J,l as ne,k as oa,n as ft,o as F,N as yn}from"./core-gUqdW_kq.js";import{fE as L,V6 as Ze,bE as sa,br as Ee,Wt as vn,k9 as An,Wu as Yt,Wv as In,kc as gt,Ww as qe,Wx as En,kh as Dn,Wy as Gt,Wz as Tn,kl as bt,WA as Qe,WB as xn,WC as wn,Vq as Pn,ln as On,WD as Fn,bn as Je,WE as ra,W4 as ue,bc as ia,lB as ca,lk as la,W6 as me,W5 as ae,fD as da,g9 as jn,gp as Ct,WF as Rn,WG as Bn,WH as ua,WI as Oe,Dh as Me,Di as Ue,DG as De,DA as pe,Dm as Le,WJ as Mn,b$ as Ve,WK as Un,WL as Ln,WM as ma,WN as Fe,WO as Vn,eb as et,zu as pa,WP as Yn,WQ as ha,WR as Gn,WS as Nn,WT as $n,WU as St,U2 as kt,tA as Te,l_ as xe,DQ as yt,zB as Wn,zI as zn,WV as Xn,WW as Kn,Dj as Nt,WX as qn,zx as Ae,zs as fa,WY as be,WZ as $t,W_ as Qn,W$ as vt,U1 as At,BF as ga,X0 as Hn,X1 as ba,X2 as Zn,X3 as Jn,X4 as eo,X5 as It,BU as to,B$ as ao,X6 as no,X7 as oo,Dl as Wt,X8 as so,BD as Ca,X9 as Ce,Xa as zt,Xb as ro,bq as _a,DV as Sa,Xc as io,Xd as ka,Xe as co,Xf as lo,Xg as uo,Xh as Et,DN as mo,DP as po,Xi as ho,Xj as fo,Dk as Xt,Xk as go,DT as ya,Xl as _e,Xm as Kt,Xn as bo,Xo as Co,Xp as va,lP as Aa,pW as Ia,lU as Ea,pU as Da,pT as Ta,pS as xa,B0 as _o,db as So,pP as ko,Tq as yo,q4 as vo,Xq as Ao,Xr as Io,Xs as Eo,b5 as Dt,p_ as Do,ib as To,gH as xo,pZ as wo,ld as Po,pX as Oo,pV as Fo,dY as jo,dX as Ro}from"./zeni-epic-state-C-d25VTi.js";import{z as V,av as oe,p as j,k as D,G as q,bb as Bo,as as Ye,a8 as Ge,bc as wa,U as $,bd as Mo,be as Pa,E as Uo,bf as Lo,bg as Vo,a as Oa,a1 as Fa,e as ja,ar as Yo,bh as Go,ao as No,M as we,bi as Ra,A as ce,bj as Ba,bk as Ma,au as Ua,bl as $o,ai as Ne,Q as $e,y as Y,bm as Wo,s as zo,j as Xo,a4 as Ko,aq as qo,bn as Qo,bo as Ho,bp as Zo,bq as Ie}from"./index-BhyEYQTn.js";import{n as Tt}from"./mui-DCW4m3lZ.js";import{a as b}from"./sentry-DI7gLUjw.js";import{w as La}from"./withTransactionSidePanel-0Fy2VPJ-.js";import{c as Va,t as Pe,f as he,b as xt,a as wt,v as Jo}from"./routePaths-DAdB7ufZ.js";import{u as se}from"./useAskAiCfoHostNavButtonProps-BVUNtLFK.js";import Be from"./NotFoundScreen-Bii3lrih.js";import{u as Pt}from"./useInitialThreadRequest-DTQjUnhP.js";import{t as Ya}from"./analyticsHelper-X6BcuRxb.js";import{C as es}from"./CompanyPassportScreen-DEbgj-ZU.js";import{u as ts}from"./useAiCfoDashboardSuggestedQuestionsChips-FMXCfhJm.js";import{F as as}from"./FeaturePreviewScreen-BsptTDQw.js";import"./recharts-HpXoq1DR.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";import"./TransactionDetailScreen-DL95NJxK.js";import"./decodeURIComponentSafe-Cst3Y24b.js";import"./expenseAutomationHelper-DDRCXr7k.js";import"./MobileAppDrawer-BPpLxyPF.js";import"./InboxNotificationsProvider-D007v5X6.js";import"./useTaskManagerAccess-U48bmWaI.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="3542f3d1-56a5-42ea-9896-a23f6ff53f26",e._sentryDebugIdIdentifier="sentry-dbid-3542f3d1-56a5-42ea-9896-a23f6ff53f26")}catch{}})();const ns=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=V.getSignedInUser(),i=_((E=>E.tenantState.currentTenantId)),l=_((E=>L(E))),{tenantEmailDomain:m}=K(),p=Z(),h=l?.companyName??"",f={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo((()=>({authParams:f,companyName:h,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:Ze()})),[]),u=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),C=z(),g=J(),k=_((E=>vn(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(An(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),S=b.useCallback(((E,B)=>{C(Yt({sortKey:E,sortOrder:B}))}),[]),T=b.useCallback((E=>{C(Yt({downloadState:E}))}),[]),P=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const B=Va({id:E.transactionId,type:E.transactionType},m);g(B);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(B,{state:{pathnameStackToGoBack:y}})}}),[m,e]),x=b.useCallback((()=>{k.vendor!=null&&D.trackApAgingDetail("AP Aging",u.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&x()}),[x,k.fetchState]),d.jsx(Bo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:D,onTransactionClick:P,onReload:I,onBackClick:v,onColumnSortConfigChanged:S,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),os=()=>{const e=z(),a=J(),t=_((S=>In(S))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AP Aging"});Ye({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=_((S=>S.tenantState.currentTenantId)),i=_((S=>L(S))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),h=t.apAgingUIState.selectedDate??Ee(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((S=>{e(qe({searchString:S}))}),[]),C=b.useCallback(((S,T)=>{e(qe({sortKey:T,sortOrder:S}))}),[]),g=b.useCallback((S=>{a(`./${S}/${h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((S=>{e(qe({downloadState:S}))}),[]),I=b.useCallback(((S,T)=>{}),[]),v=b.useCallback(((S,T)=>{e(qe({selectedDate:S,agingDateSelectionType:T})),e(gt(S))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:D,onLoad:S=>S.trackPageLoaded($.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:D,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ss=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=V.getSignedInUser(),i=_((x=>L(x))),{tenantEmailDomain:l}=K(),m=Z(),p=i.companyName,h={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},f=b.useMemo((()=>({authParams:h,companyName:p,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:Ze()})),[]),c=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),u=z(),C=J(),g=_((x=>En(x,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Dn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((x,E)=>{u(Gt({sortKey:x,sortOrder:E}))}),[]),S=b.useCallback((x=>{u(Gt({downloadState:x}))}),[]),T=b.useCallback((x=>{if(e)e(x.transactionId,x.transactionType);else if(l!=null){const E=Va({id:x.transactionId,type:x.transactionType},l);C(E);const B=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:B}})}}),[l,e]),P=b.useCallback((()=>{g.customer!=null&&D.trackArAgingDetail("AR Aging",c.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&P()}),[g.fetchState,P]),d.jsx(Mo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:D,onTransactionClick:T,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:S,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),rs=()=>{const e=z(),a=J(),t=_((v=>Tn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AR Aging"});Ye({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=_((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),p=t.arAgingUIState.selectedDate??Ee(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),u=b.useCallback(((v,S)=>{e(Qe({sortKey:S,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),k=b.useCallback(((v,S)=>{e(Qe({selectedDate:v,agingDateSelectionType:S})),e(bt(v))}),[]),I=b.useCallback(((v,S)=>{e(xn({nodeId:v,isCollapsed:S}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:D,onLoad:v=>v.trackPageLoaded($.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:D,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Pn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(On(n,o))}}}const is=ne((function(e){const a=wn(e).accountsInOrder.map(((t,n)=>Ga(t,n)));return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:D}}),Na)(Pa),cs=ne((function(e){const a=Fn(e).accountsInOrder.map(((o,r)=>Ga(o,r))),t=V.getSignedInUser(),n=Je(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:D}}),Na)(Pa);function ls(){const e=J(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(is,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function ds(){const e=J(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(cs,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const us=Tt.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-C_WAhyd7.js";import{a as u}from"./sentry-lC29HHPj.js";import{u as y,j as b,l as w,g as A,N as k}from"./core-1xnf2RtE.js";import{T9 as N,fE as _,gk as R,Ta as U,pR as L,Tb as z}from"./zeni-epic-state-BVNUxmav.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-DXVI9ztu.js";import"./mui-BAsIRnB1.js";import{t as P}from"./getLocaleForTenant-Ct5cBG_c.js";import"./recharts-C2rsrRI6.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="81bf798b-dae9-402a-82c7-54704078ff8b",t._sentryDebugIdIdentifier="sentry-dbid-81bf798b-dae9-402a-82c7-54704078ff8b")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(k,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>N(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(R(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!U(i))&&t(L(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-B3m51ZRo.js";import{a as u}from"./sentry-DI7gLUjw.js";import{u as y,j as b,l as w,g as A,N as k}from"./core-gUqdW_kq.js";import{T9 as N,fE as _,gk as R,Ta as U,pR as L,Tb as z}from"./zeni-epic-state-C-d25VTi.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-BhyEYQTn.js";import"./mui-DCW4m3lZ.js";import{t as P}from"./getLocaleForTenant-DQPwSKjF.js";import"./recharts-HpXoq1DR.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="81bf798b-dae9-402a-82c7-54704078ff8b",t._sentryDebugIdIdentifier="sentry-dbid-81bf798b-dae9-402a-82c7-54704078ff8b")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(k,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>N(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(R(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!U(i))&&t(L(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
@@ -0,0 +1,18 @@
1
+ import{j as l}from"./liveblocks-B3m51ZRo.js";import{h as w,g as C,j as h,l as E,i as V}from"./core-gUqdW_kq.js";import{Y6 as k,Yd as M,gF as _,gE as W,gD as J,kO as K,W5 as X,uc as q,fE as B,XF as D,kM as F,Y7 as S,Yg as T,kK as G,l5 as j}from"./zeni-epic-state-C-d25VTi.js";import{bM as L,a1 as N,M as R,z as O,E as U,a4 as b,y as v,a7 as Y,bN as Q,J as Z,bO as ee,p as te}from"./index-BhyEYQTn.js";import{n as z}from"./mui-DCW4m3lZ.js";import"./sentry-DI7gLUjw.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]="fcee25e8-099d-47d6-8065-01080177333c",e._sentryDebugIdIdentifier="sentry-dbid-fcee25e8-099d-47d6-8065-01080177333c")}catch{}})();const ne=E(null,(function(e,t){return{onSaveVendor:n=>{e(K(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(X("common")),n!=null&&e(q(n))},onGetOtp:n=>{e(J(n,"BillPayVendor"))},onResendOtp:n=>{e(W(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(_(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(M(n,a,o))}}}))(L);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=z.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ `,oe=E((function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{navigate:n,location:a,vendorId:o}=t;return{onFetchBankName:s=>{e(j(s))},onSaveHandler:s=>{e(G(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=b(a.state?.pathnameStackToGoBack),d=s.poppedPathname??P();n(d,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=b(t.location.state?.pathnameStackToGoBack),d=s.poppedPathname??P(0);t.navigate(d,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}}))(Q);function fe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:d}=V(),i=e??s,{useFeatureGate:c}=R(),r=O.getSignedInUser(),p=h((u=>B(u))),g=U(),x=b(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,i))),{isFeatureEnabled:I}=c(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=c(v.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Y,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(H,{vendorId:i,billId:d}),l.jsx(oe,{location:a,navigate:n,billId:d,vendorId:i,currentTenant:p,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},me=(e,t,n)=>{let a=`/${e}/bill/${encodeURIComponent(t)}`;return n=="draft"&&(a+="/edit"),a},he=e=>`/${e}/bills`,ke=(e,t)=>{let n=`/${e}/bill`;return n=t!=null?n.concat(`/${t}/edit`):n.concat("/new"),n},A=(e,t,n,a)=>{let o=`/${e}/bill`;return o+=n!=null?`/${n}/edit/vendor`:"/new/vendor",o+=a!=null?`/${a}/edit/${t}`:`/create/${t}`,o};function Se(e,t,n){return A(e,"ach",t,n)}function ve(e,t,n){return A(e,"domestic",t,n)}function ge(e,t,n){return A(e,"international",t,n)}const se=(e,t,n)=>{let a=`/${e}/bill/`;return a=n!=null?a.concat(`${encodeURIComponent(n)}/${t}/`):a.concat(`new/${t}/`),a},ce=z.div`
10
+ display: flex;
11
+ height: 100vh;
12
+ width: 100%;
13
+ flex: 1 1 auto;
14
+ flex-direction: column;
15
+ align-items: center;
16
+ background-color: ${e=>e.theme.colors.grey4};
17
+ box-shadow: ${e=>`0px 2px ${Z.sp1} ${e.theme.colors.dropShadowNormal}`};
18
+ `,de=E((function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:n,navigate:a,location:o,vendorId:s,currentTenant:d}=t,{tenantEmailDomain:i}=d;return{onFetchBankName:c=>{e(j(c))},onSaveHandler:c=>{e(G(t.bankAccountContext,c,"us-domestic",s))},onWireDetailsUpdated:c=>{const{bankAccountSection:r}=c;e(T({data:r}))},onCancel:()=>{(()=>{const c=b(o.state?.pathnameStackToGoBack),r=c.poppedPathname??$();a(r,{state:{pathnameStackToGoBack:c.newStack}})})(),e(S())},onAddressClick:c=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const r=se(i,c,n),p=te(o.state?.pathnameStackToGoBack,o.pathname);a(r,{state:{pathnameStackToGoBack:p}})}},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const c=b(t.location.state?.pathnameStackToGoBack),r=c.poppedPathname??$(0);t.navigate(r,{state:{pathnameStackToGoBack:c.newStack}})}e(S())}}}))(ee);function xe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:d}=V(),i=e??s,c=O.getSignedInUser(),{useFeatureGate:r}=R(),p=U(),g=h((u=>B(u))),x=b(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,i))),{isFeatureEnabled:I}=r(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(v.isDepositAccountsFeatureEnabled);if(c==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Y,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:p.colors.grey5,boxShadow:`0px 2px ${Z.sp1} ${p.colors.dropShadowNormal}`}}):l.jsxs(ce,{windowSize:o,children:[l.jsx(H,{vendorId:i,billId:d}),l.jsx(de,{location:a,navigate:n,billId:d,vendorId:i,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{fe as A,xe as D,H as V,me as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
@@ -1 +1 @@
1
- import{j as i}from"./liveblocks-C_WAhyd7.js";import{a1 as c,ab as l,E as f}from"./index-DXVI9ztu.js";import{D as p}from"./mui-BAsIRnB1.js";import"./sentry-lC29HHPj.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2",e._sentryDebugIdIdentifier="sentry-dbid-c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:d}=e,n=c(),s=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),a=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:a.colors.black,opacity:.8,cursor:"pointer"}}},onClose:d,children:t})}export{h as D};
1
+ import{j as i}from"./liveblocks-B3m51ZRo.js";import{a1 as c,ab as l,E as f}from"./index-BhyEYQTn.js";import{D as p}from"./mui-DCW4m3lZ.js";import"./sentry-DI7gLUjw.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2",e._sentryDebugIdIdentifier="sentry-dbid-c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:d}=e,n=c(),s=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),a=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:a.colors.black,opacity:.8,cursor:"pointer"}}},onClose:d,children:t})}export{h as D};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-B3m51ZRo.js";import{a as d}from"./sentry-DI7gLUjw.js";import{h as B,u as G,g as A,i as R,j as l,N as _,l as q,n as F,o as V}from"./core-gUqdW_kq.js";import{W9 as N,fE as O,Vr as M,m_ as Y,Rt as I,We as $,W4 as z,l_ as H,Ru as S,Vw as J,Vx as K,W6 as L,W5 as Q}from"./zeni-epic-state-C-d25VTi.js";import{b8 as U,k as X,a4 as Z,p as tt}from"./index-BhyEYQTn.js";import"./mui-DCW4m3lZ.js";import{d as k}from"./decodeURIComponentSafe-Cst3Y24b.js";import{w as et}from"./withTransactionSidePanel-0Fy2VPJ-.js";import{f as at,c as nt}from"./routePaths-DAdB7ufZ.js";import"./recharts-HpXoq1DR.js";import"./analytics-BvodL4nJ.js";import"./plaid-BrXe9xNf.js";import"./dnd-YSyN45zY.js";import"./stripe-cKAAJElX.js";import"./lottie-DLBd_qLT.js";import"./lexical-Euc6kCJG.js";import"./pdf-BDXl9G7N.js";import"./utils-8Dv5nUFZ.js";import"./useAskAiCfoHostNavButtonProps-BVUNtLFK.js";import"./TransactionDetailScreen-DL95NJxK.js";import"./useInitialThreadRequest-DTQjUnhP.js";import"./expenseAutomationHelper-DDRCXr7k.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="46527319-2e55-4046-bc45-2f41dc619ff4",a._sentryDebugIdIdentifier="sentry-dbid-46527319-2e55-4046-bc45-2f41dc619ff4")}catch{}})();const ot=q((function(a,t){const e=t.entity,o=$(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:H(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(L({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(Q("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(J()),a(K()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??b();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(I(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(U),it=et((function({entityType:a,...t}){const e=B(),o=G(),c=A(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:w}=R(),r=k(x??""),p=k(w??""),f=rt(r,p),j=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>N(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),v=l((n=>O(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>M(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(Y(i)))}),[m,f,i]);const E=l((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??g,W=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,g);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(I(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:v,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:W,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(_,{to:b(j.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,b=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function jt({entityType:a}){return s.jsx(F,{children:s.jsx(V,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{jt as EntityDetailRoutes,jt as default};