@zeniai/web-app-ui 5.1.62-qa → 5.1.63-qa

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 (133) hide show
  1. package/dist/assets/AddressRoutes-DgZlzwKj.js +1 -0
  2. package/dist/assets/{AddressScreen-CxOVTdB3.js → AddressScreen-DZz6iLRi.js} +2 -2
  3. package/dist/assets/{AiCfoScreen-Ufyr17L2.js → AiCfoScreen-BJy_pYhd.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-COMjZNBM.js → BillPayApprovalRoutes-DJjLicyn.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-ycYrxG7k.js → BillPayRoutes-DAczZIUA.js} +17 -17
  6. package/dist/assets/{BusinessVerificationPageScreen-BSOfMkHj.js → BusinessVerificationPageScreen-CbhS3pML.js} +2 -2
  7. package/dist/assets/CardsAiCfoScreen-D3HVbkzL.js +14 -0
  8. package/dist/assets/ChargeCardRoutes-lmFHLgNx.js +71 -0
  9. package/dist/assets/CompanyPassportScreen-BUt2L6sz.js +1 -0
  10. package/dist/assets/ConnectionAuthScreen-BT3IRUL8.js +11 -0
  11. package/dist/assets/CustomerOnboardingAuthScreen-BAn5X2Wb.js +1 -0
  12. package/dist/assets/{CustomerOnboardingRoutes-C39jSTCn.js → CustomerOnboardingRoutes-Dzhhfcds.js} +6 -6
  13. package/dist/assets/{DashboardRoutes-dFcQ-Udv.js → DashboardRoutes-CDKfXwLt.js} +3 -3
  14. package/dist/assets/{DefaultTenantHome-CiIQC--y.js → DefaultTenantHome-CXh59aBD.js} +1 -1
  15. package/dist/assets/{DomesticWireDetailScreen-Cv3GFhdJ.js → DomesticWireDetailScreen-iXO5zWUm.js} +4 -4
  16. package/dist/assets/DrawerScreen-B_vR9_qC.js +1 -0
  17. package/dist/assets/EntityDetailRoutes-BcZQKkh1.js +1 -0
  18. package/dist/assets/{ExpenseAutomationRoutes-iUGrHrmT.js → ExpenseAutomationRoutes-CWOOkRUe.js} +4 -4
  19. package/dist/assets/{FeaturePreviewScreen-CdQFs282.js → FeaturePreviewScreen-BQvRhW1f.js} +1 -1
  20. package/dist/assets/HubSpotOAuthCallbackScreen-DeESKpku.js +1 -0
  21. package/dist/assets/MagicLinkRoutes-6x7Us6_Q.js +72 -0
  22. package/dist/assets/MagicLinkSignInScreen-BsUi7-40.js +12 -0
  23. package/dist/assets/MobileAppDrawer-CHF9nCsW.js +1 -0
  24. package/dist/assets/NotFoundScreen-D0AQGcoe.js +1 -0
  25. package/dist/assets/{NotificationRoutes-DRjXwQc4.js → NotificationRoutes-BPu1VkFm.js} +1 -1
  26. package/dist/assets/OAuthConsentScreen-DkCTDJwq.js +1 -0
  27. package/dist/assets/PandLWithForecastRoutes-BEFahy-o.js +1 -0
  28. package/dist/assets/PeopleRoutes-sN-axVAc.js +22 -0
  29. package/dist/assets/PerformanceRoutes-DXXEZbBB.js +1 -0
  30. package/dist/assets/{Preview-lrK4F27Y.js → Preview-C7zW6Q7F.js} +1 -1
  31. package/dist/assets/{QBOConnectionScreen-MiEEvzBf.js → QBOConnectionScreen-_B3wLRiT.js} +1 -1
  32. package/dist/assets/{ReferralListScreen-BqOgHlgl.js → ReferralListScreen-CzPMgGBj.js} +2 -2
  33. package/dist/assets/ReimbursementApprovalRoutes-DCrHBh1u.js +1 -0
  34. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DSLe2MhL.js → ReimbursementApprovalRuleDetailScreen-SmUpbSJe.js} +1 -1
  35. package/dist/assets/{ReimbursementRoutes--RsJPCEP.js → ReimbursementRoutes-xFL2a98D.js} +7 -7
  36. package/dist/assets/{ReportsRoutes-uT5eAJf1.js → ReportsRoutes-BCmFjTfI.js} +1 -1
  37. package/dist/assets/RewardsRoutes-OtuIPjdr.js +1 -0
  38. package/dist/assets/ScreenRoutes-CEUjM6GK.js +2 -0
  39. package/dist/assets/{SettingsRoutes-DqieIzNx.js → SettingsRoutes-BtEyetWY.js} +7 -7
  40. package/dist/assets/{SetupPagesScreen-Pz567UQO.js → SetupPagesScreen-CCip2k58.js} +5 -5
  41. package/dist/assets/SignInScreen-jXShH9LP.js +1 -0
  42. package/dist/assets/SignOutScreen-CnWA4YZp.js +9 -0
  43. package/dist/assets/{TaskListScreen-Chd2rxBe.js → TaskListScreen-qq0yWrR-.js} +2 -2
  44. package/dist/assets/TaskRoutes-B3fEaAUN.js +9 -0
  45. package/dist/assets/{TransactionDetailRoutes-Dko7BvP2.js → TransactionDetailRoutes-DWDGqu2s.js} +1 -1
  46. package/dist/assets/{TransactionDetailScreen-B7KMTXiT.js → TransactionDetailScreen-DW8t3EC2.js} +2 -2
  47. package/dist/assets/{TransactionListRoutes-MalhqO-o.js → TransactionListRoutes-DHSwzqfn.js} +1 -1
  48. package/dist/assets/{TreasuryRoutes-BJIzvR2Q.js → TreasuryRoutes-Cxtbe06-.js} +6 -6
  49. package/dist/assets/{VendorsRoutes-45nX3W2c.js → VendorsRoutes-MlvyyMTe.js} +27 -27
  50. package/dist/assets/WiseConfirmationScreen-D-axhjl6.js +12 -0
  51. package/dist/assets/{ZeniAccountRoutes-DWsFxkzK.js → ZeniAccountRoutes-BG6yVxGl.js} +10 -10
  52. package/dist/assets/{ZeniAccountStatementScreen-BqtUjZCP.js → ZeniAccountStatementScreen-D1CXmWJM.js} +2 -2
  53. package/dist/assets/{accountMappingHelper-CSvCSQoY.js → accountMappingHelper-BPzhOzDQ.js} +1 -1
  54. package/dist/assets/{analytics-DCrhd8oB.js → analytics-Bqx0zRxd.js} +1 -1
  55. package/dist/assets/{analyticsHelper-MomIUc09.js → analyticsHelper-bAQTI-GF.js} +1 -1
  56. package/dist/assets/{core-DmAftQ4g.js → core-Bv1T7LZC.js} +1 -1
  57. package/dist/assets/{decodeURIComponentSafe-C70tsXnj.js → decodeURIComponentSafe-CgJ-EbJc.js} +1 -1
  58. package/dist/assets/{dnd-3F1D24DQ.js → dnd-CrtLd1r-.js} +1 -1
  59. package/dist/assets/{empty-CDCfsLV4.js → empty-BGU_c4p_.js} +1 -1
  60. package/dist/assets/{empty-B3YzB_Zh.js → empty-DZLujeFc.js} +1 -1
  61. package/dist/assets/{emptyVideoElement-CFNhZ55F.js → emptyVideoElement-D0DWhAqS.js} +1 -1
  62. package/dist/assets/epic-C0x_kZHk.js +2 -0
  63. package/dist/assets/getLocaleForTenant-DrFh6zlq.js +1 -0
  64. package/dist/assets/{index-EyTFjAAZ.js → index-B-VkC3pW.js} +1 -1
  65. package/dist/assets/{index-DPrh5XVZ.js → index-BcMhlMw0.js} +1 -1
  66. package/dist/assets/{index-BJ17Ijlb.js → index-Bf0yAk1h.js} +2 -2
  67. package/dist/assets/{index-B2dyNLwa.js → index-BfDh5m3J.js} +1 -1
  68. package/dist/assets/{index-DniSRtks.js → index-Bgxmla6x.js} +1 -1
  69. package/dist/assets/{index-BpGaPboJ.js → index-C7MHnpYf.js} +1 -1
  70. package/dist/assets/{index-BsmcHa9A.js → index-CVpYlrKc.js} +10178 -10150
  71. package/dist/assets/{index-BTn1WqO7.js → index-Dvxx9UaB.js} +1 -1
  72. package/dist/assets/{lexical-PVlNGkpS.js → lexical-DtmspfR6.js} +1 -1
  73. package/dist/assets/{liveblocks-evjZPqs_.js → liveblocks-DC3GaKoW.js} +1 -1
  74. package/dist/assets/{lottie-CmTLY-9t.js → lottie-BAdftm7g.js} +1 -1
  75. package/dist/assets/{mui-PcDpEhsm.js → mui-VYhJrGDQ.js} +1 -1
  76. package/dist/assets/{pathToGoBack-Dt8AwbCr.js → pathToGoBack-BPhnwklb.js} +1 -1
  77. package/dist/assets/{pdf-CbXlPYUs.js → pdf-DyfSqkK5.js} +4 -4
  78. package/dist/assets/{pdf-lib-CU5FhbnZ.js → pdf-lib-CPh8no6v.js} +1 -1
  79. package/dist/assets/{plaid-DSnXUEUK.js → plaid-BlhDSPsk.js} +1 -1
  80. package/dist/assets/{pusher-Cwyg5VVV.js → pusher-DGAKVhUw.js} +1 -1
  81. package/dist/assets/{react-CJ1HWQ69.js → react-B1_zGwIA.js} +1 -1
  82. package/dist/assets/{react-EoTfQhVb.js → react-BJZHoUnV.js} +1 -1
  83. package/dist/assets/{react-ymB_cbpE.js → react-D4kHPPtw.js} +1 -1
  84. package/dist/assets/{react-CY1ZQ6op.js → react-D_wg-5Ag.js} +1 -1
  85. package/dist/assets/{react-Cf5hLxOq.js → react-EkeFt_9c.js} +1 -1
  86. package/dist/assets/{react-CDqmK3AW.js → react-mFsTSWE1.js} +1 -1
  87. package/dist/assets/{recharts-CgEqsrFw.js → recharts-D979ncoh.js} +1 -1
  88. package/dist/assets/routePaths-DdjVf9j1.js +1 -0
  89. package/dist/assets/{sentry-CCZGmBkl.js → sentry-CuaXjR5n.js} +1 -1
  90. package/dist/assets/{url-BKaTO14S.js → url-73U0aVt0.js} +1 -1
  91. package/dist/assets/{url-9kg5cual.js → url-DXrWvdUh.js} +1 -1
  92. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Ber5T8-o.js → useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js} +1 -1
  93. package/dist/assets/useAskAiCfoHostNavButtonProps-w5iOFbal.js +1 -0
  94. package/dist/assets/useCashManagementBanner-Drz7Ezu4.js +1 -0
  95. package/dist/assets/{useChargeCardPusherEvents-RkbvNufi.js → useChargeCardPusherEvents-FFGUOH8U.js} +1 -1
  96. package/dist/assets/{useDeviceId-DGJPBja9.js → useDeviceId-BVyTAih4.js} +1 -1
  97. package/dist/assets/useEmailConnectResultRefresh-DsiaZGrG.js +1 -0
  98. package/dist/assets/{useInitialThreadRequest-Dr9FuJUY.js → useInitialThreadRequest-B3tsIQAR.js} +1 -1
  99. package/dist/assets/{utils--mWNe9J7.js → utils-DPYDOv00.js} +1 -1
  100. package/dist/assets/{withTransactionSidePanel-C15NQsNY.js → withTransactionSidePanel-Dy09Dwri.js} +2 -2
  101. package/dist/assets/{zeni-epic-state-vtQ66nN6.js → zeni-epic-state-DuQa9FMz.js} +3 -3
  102. package/dist/index.html +1 -1
  103. package/package.json +2 -2
  104. package/dist/assets/AddressRoutes-CZL5IIDj.js +0 -1
  105. package/dist/assets/CardsAiCfoScreen-BofarOgC.js +0 -14
  106. package/dist/assets/ChargeCardRoutes-iiwF-L1o.js +0 -71
  107. package/dist/assets/CompanyPassportScreen-N6HtNLO2.js +0 -1
  108. package/dist/assets/ConnectionAuthScreen-GiDrTcJ9.js +0 -11
  109. package/dist/assets/CustomerOnboardingAuthScreen-CIo2QvBW.js +0 -1
  110. package/dist/assets/DrawerScreen-Dz_Ifi-A.js +0 -1
  111. package/dist/assets/EntityDetailRoutes-CGqc-n2O.js +0 -1
  112. package/dist/assets/HubSpotOAuthCallbackScreen-Crp8q0ZQ.js +0 -1
  113. package/dist/assets/MagicLinkRoutes-BPzX2NJX.js +0 -72
  114. package/dist/assets/MagicLinkSignInScreen-BoA-7inn.js +0 -12
  115. package/dist/assets/MobileAppDrawer-cGG4tefr.js +0 -1
  116. package/dist/assets/NotFoundScreen-DmxmtGfC.js +0 -1
  117. package/dist/assets/OAuthConsentScreen-HR6-AToH.js +0 -1
  118. package/dist/assets/PandLWithForecastRoutes-COEiLMeU.js +0 -1
  119. package/dist/assets/PeopleRoutes-CQ7KgSTF.js +0 -22
  120. package/dist/assets/PerformanceRoutes-CUptxU2M.js +0 -1
  121. package/dist/assets/ReimbursementApprovalRoutes-CuEZag2r.js +0 -1
  122. package/dist/assets/RewardsRoutes-DNPQGfAV.js +0 -1
  123. package/dist/assets/ScreenRoutes-BEMAKpuY.js +0 -2
  124. package/dist/assets/SignInScreen-DPJ9eMik.js +0 -1
  125. package/dist/assets/SignOutScreen-BmbWt3Pd.js +0 -9
  126. package/dist/assets/TaskRoutes-DXfXoaYF.js +0 -9
  127. package/dist/assets/WiseConfirmationScreen-CWe-skzP.js +0 -12
  128. package/dist/assets/epic-Bmb0p0Me.js +0 -2
  129. package/dist/assets/getLocaleForTenant-DBZLLRpQ.js +0 -1
  130. package/dist/assets/routePaths-ieN8hn7m.js +0 -1
  131. package/dist/assets/useAskAiCfoHostNavButtonProps-5Ek-t3F9.js +0 -1
  132. package/dist/assets/useCashManagementBanner-B0ma2Yzx.js +0 -1
  133. package/dist/assets/useEmailConnectResultRefresh-CiHOFzmr.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-evjZPqs_.js";import{i as K,j as _,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-DmAftQ4g.js";import{eW as U,Nh as We,bE as ca,bo as xe,Ov as On,iZ as Pn,Ow as Zt,Ox as Fn,j0 as kt,Oy as qe,Oz as Rn,j5 as Bn,OA as qt,OB as jn,j9 as _t,OC as Qe,OD as Mn,co as At,OE as Ln,OF as Un,NB as Gn,k1 as Vn,OG as Yn,bn as Xe,OH as la,N5 as ce,bc as da,kf as ua,of as ma,j_ as pa,N7 as le,N6 as J,eV as ha,fp as Nn,g1 as St,OI as $n,OJ as zn,OK as fa,OL as Fe,vN as Le,vO as Ue,w9 as De,w3 as de,vS as Ge,OM as Kn,ON as Zn,OO as qn,OP as ga,OQ as Re,OR as Qn,dJ as Je,s8 as ba,OS as Hn,OT as Wn,OU as Xn,OV as vt,Mn as It,kv as we,wh as Et,sg as Jn,OW as eo,vP as Qt,sb as Ee,s7 as Ca,OX as ge,OY as to,OZ as Tt,Mm as xt,ug as ka,O_ as ao,O$ as no,P0 as oo,P1 as Dt,ut as so,P2 as ro,vR as Ht,uf as _a,P3 as be,P4 as io,bs as Sa,wl as ya,P5 as co,P6 as lo,P7 as uo,P8 as wt,wg as mo,P9 as po,vQ as Wt,wk as Aa,Pa as Ce,Pb as ho,Pc as fo,Pd as va,kk as Ia,oc as Ea,kp as Ta,oa as xa,o9 as Da,o8 as wa,tE as go,fT as bo,cR as Co,cS as ko,o5 as _o,fP as So,om as yo,Gz as ut,Gr as Ao,Gv as vo,Pe as Io,Pf as Eo,Pg as To,b5 as et,fH as xo,hH as Do,gh as wo,og as Oo,jT as Po,od as Fo,ob as Ro,fB as Bo,fz as jo}from"./zeni-epic-state-vtQ66nN6.js";import{z as M,a2 as te,q as D,c as T,O as Z,aY as Mo,_ as Ve,x as Ye,aZ as Oa,e as N,a_ as Lo,I as _e,a$ as Pa,W as Se,U as B,m as Uo,b0 as Go,b1 as Vo,V as Fa,Z as Ra,a as Ba,Y as Yo,b2 as No,Q as $o,aQ as ja,$ as se,b3 as Ma,b4 as La,a1 as Ua,b5 as zo,b6 as Ko,n as Zo,ar as qo,p as Qo,X as Ho,b7 as Wo,b8 as Xo,b9 as Jo,ba as es,bb as ke}from"./index-BsmcHa9A.js";import{n as Ot}from"./mui-PcDpEhsm.js";import{a as b}from"./sentry-CCZGmBkl.js";import{w as Ga}from"./withTransactionSidePanel-C15NQsNY.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-ieN8hn7m.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-5Ek-t3F9.js";import Me from"./NotFoundScreen-DmxmtGfC.js";import{u as Ft}from"./useInitialThreadRequest-Dr9FuJUY.js";import{t as Ya}from"./analyticsHelper-MomIUc09.js";import{C as as}from"./CompanyPassportScreen-N6HtNLO2.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-Ber5T8-o.js";import{F as os}from"./FeaturePreviewScreen-CdQFs282.js";import{R as ss}from"./ReferralListScreen-BqOgHlgl.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.js";import"./TransactionDetailScreen-B7KMTXiT.js";import"./decodeURIComponentSafe-C70tsXnj.js";import"./MobileAppDrawer-cGG4tefr.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]="44e813f5-1b95-499b-bd53-e1085e304644",e._sentryDebugIdIdentifier="sentry-dbid-44e813f5-1b95-499b-bd53-e1085e304644")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(I=>I.tenantState.currentTenantId),c=_(I=>U(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):xe(),[r]),p=z(),f=W(),S=_(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),A=b.useCallback(()=>{f("../../",{relative:"path"})},[]),k=b.useCallback((I,L)=>{p(Zt({sortKey:I,sortOrder:L}))},[]),x=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),w=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Va({id:I.transactionId,type:I.transactionType},m);f(L);const ne=D(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:w,onReload:E,onBackClick:A,onColumnSortConfigChanged:k,updateDownloadStateHandler:x,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=_(k=>Fn(k)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(k=>k.tenantState.currentTenantId),i=_(k=>U(k)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(k=>{e(qe({searchString:k}))},[]),p=b.useCallback((k,x)=>{e(qe({sortKey:x,sortOrder:k}))},[]),f=b.useCallback(k=>{a(`./${k}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(k=>{e(qe({downloadState:k}))},[]),E=b.useCallback((k,x)=>{},[]),A=b.useCallback((k,x)=>{e(qe({selectedDate:k,agingDateSelectionType:x})),e(kt(k))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_(y=>U(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):xe(),[r]),h=z(),p=W(),f=_(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),A=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),k=b.useCallback(y=>{h(qt({downloadState:y}))},[]),x=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const L=D(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}},[c,e]),w=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&w()},[f.fetchState,w]),d.jsx(Lo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:x,onReload:S,onBackClick:E,onColumnSortConfigChanged:A,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=_(A=>jn(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_(A=>U(A)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(A=>{e(Qe({searchString:A}))},[]),h=b.useCallback((A,k)=>{e(Qe({sortKey:k,sortOrder:A}))},[]),p=b.useCallback(A=>{a(`./${A}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(A=>{e(Qe({downloadState:A}))},[]),S=b.useCallback((A,k)=>{e(Qe({selectedDate:A,agingDateSelectionType:k})),e(_t(A))},[]),E=b.useCallback((A,k)=>{e(Mn({nodeId:A,isCollapsed:k}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:A=>A.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Ln(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Un(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=At(n?.loggedInUserRoleMap);return _(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=At(n?.loggedInUserRoleMap),r=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return _(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
1
+ import{j as d}from"./liveblocks-DC3GaKoW.js";import{i as K,j as k,g as H,u as z,h as W,n as ee,k as ia,o as Ct,p as P}from"./core-Bv1T7LZC.js";import{eW as L,Ni as We,bE as ca,bo as we,Ow as On,i$ as Pn,Ox as Zt,Oy as Fn,j2 as _t,Oz as qe,OA as Rn,j7 as Bn,OB as qt,OC as jn,jb as kt,OD as Qe,OE as Mn,co as vt,OF as Un,OG as Ln,NC as Gn,k3 as Vn,OH as Yn,bn as Je,OI as la,N6 as ce,bc as da,kh as ua,oh as ma,k0 as pa,N8 as le,N7 as X,eV as ha,fr as Nn,g3 as St,OJ as $n,OK as zn,OL as fa,OM as Fe,vP as Ue,vQ as Le,wb as xe,w5 as de,vU as Ge,ON as Kn,OO as Zn,OP as qn,OQ as ga,OR as Re,OS as Qn,dJ as Xe,sa as ba,OT as Hn,OU as Wn,OV as Jn,OW as At,Mo as It,kx as De,wj as Et,si as Xn,OX as eo,vR as Qt,sd as Ee,s9 as Ca,OY as ge,OZ as to,O_ as Tt,Mn as wt,ui as _a,O$ as ao,P0 as no,P1 as oo,P2 as xt,uv as so,P3 as ro,vT as Ht,uh as ka,P4 as be,P5 as io,bs as Sa,wn as ya,P6 as co,P7 as lo,P8 as uo,P9 as Dt,wi as mo,Pa as po,vS as Wt,wm as va,Pb as Ce,Pc as ho,Pd as fo,Pe as Aa,km as Ia,oe as Ea,kr as Ta,oc as wa,ob as xa,oa as Da,tG as go,fV as bo,cR as Co,cS as _o,o7 as ko,fR as So,oo as yo,GA as ut,Gs as vo,Gw as Ao,Pf as Io,Pg as Eo,Ph as To,b5 as et,fJ as wo,hJ as xo,gj as Do,oi as Oo,jV as Po,of as Fo,od as Ro,fD as Bo,fB as jo}from"./zeni-epic-state-DuQa9FMz.js";import{z as M,a2 as te,n as x,d as T,a as Z,aY as Mo,X as Ve,w as Ye,aZ as Oa,f as N,a_ as Uo,I as ke,a$ as Pa,W as Se,U as B,m as Lo,b0 as Go,b1 as Vo,O as Fa,Z as Ra,c as Ba,V as Yo,b2 as No,K as $o,aQ as ja,Y as se,b3 as Ma,b4 as Ua,a1 as La,b5 as zo,b6 as Ko,s as Zo,ar as qo,p as Qo,T as Ho,b7 as Wo,b8 as Jo,b9 as Xo,ba as es,bb as _e}from"./index-CVpYlrKc.js";import{n as Ot}from"./mui-VYhJrGDQ.js";import{a as b}from"./sentry-CuaXjR5n.js";import{w as Ga}from"./withTransactionSidePanel-Dy09Dwri.js";import{c as Va,t as Oe,f as ue,a as Pt,v as ts}from"./routePaths-DdjVf9j1.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import Me from"./NotFoundScreen-D0AQGcoe.js";import{u as Ft}from"./useInitialThreadRequest-B3tsIQAR.js";import{t as Ya}from"./analyticsHelper-bAQTI-GF.js";import{C as as}from"./CompanyPassportScreen-BUt2L6sz.js";import{u as ns}from"./useAiCfoDashboardSuggestedQuestionsChips-CA141hZU.js";import{F as os}from"./FeaturePreviewScreen-BQvRhW1f.js";import{R as ss}from"./ReferralListScreen-CzPMgGBj.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./TransactionDetailScreen-DW8t3EC2.js";import"./decodeURIComponentSafe-CgJ-EbJc.js";import"./MobileAppDrawer-CHF9nCsW.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]="a61b2f5c-51cb-4886-9be1-84acec237c69",e._sentryDebugIdIdentifier="sentry-dbid-a61b2f5c-51cb-4886-9be1-84acec237c69")}catch{}})();const rs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(I=>I.tenantState.currentTenantId),c=k(I=>L(I)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),h=b.useMemo(()=>r!=null?ca(r):we(),[r]),p=z(),f=W(),S=k(I=>On(I,h,o)),E=b.useCallback(()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(Pn(o,h))},[h]),v=b.useCallback(()=>{f("../../",{relative:"path"})},[]),_=b.useCallback((I,U)=>{p(Zt({sortKey:I,sortOrder:U}))},[]),w=b.useCallback(I=>{p(Zt({downloadState:I}))},[]),D=b.useCallback(I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const U=Va({id:I.transactionId,type:I.transactionType},m);f(U);const ne=x(g.state?.pathnameStackToGoBack,g.pathname);f(U,{state:{pathnameStackToGoBack:ne}})}},[m,e]),y=b.useCallback(()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)},[S.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{S.fetchState==="Completed"&&y()},[y,S.fetchState]),d.jsx(Mo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:w,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),is=()=>{const e=z(),a=W(),t=k(_=>Fn(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(_=>_.tenantState.currentTenantId),i=k(_=>L(_)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),C=t.apAgingUIState.selectedDate??we(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(_t(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(_=>{e(qe({searchString:_}))},[]),p=b.useCallback((_,w)=>{e(qe({sortKey:w,sortOrder:_}))},[]),f=b.useCallback(_=>{a(`./${_}/${C.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),S=b.useCallback(_=>{e(qe({downloadState:_}))},[]),E=b.useCallback((_,w)=>{},[]),v=b.useCallback((_,w)=>{e(qe({selectedDate:_,agingDateSelectionType:w})),e(_t(_))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Oa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ga(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=k(y=>L(y)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()}),[]),l=b.useMemo(()=>r!=null?ca(r):we(),[r]),h=z(),p=W(),f=k(y=>Rn(y,l,o)),S=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(Bn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),v=b.useCallback((y,I)=>{h(qt({sortKey:y,sortOrder:I}))},[]),_=b.useCallback(y=>{h(qt({downloadState:y}))},[]),w=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Va({id:y.transactionId,type:y.transactionType},c);p(I);const U=x(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:U}})}},[c,e]),D=b.useCallback(()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{S()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&D()},[f.fetchState,D]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:w,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ls=()=>{const e=z(),a=W(),t=k(v=>jn(v)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=k(v=>L(v)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()}),[]),g=t.arAgingUIState.selectedDate??we(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(v=>{e(Qe({searchString:v}))},[]),h=b.useCallback((v,_)=>{e(Qe({sortKey:_,sortOrder:v}))},[]),p=b.useCallback(v=>{a(`./${v}/${g.format(Z.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(v=>{e(Qe({downloadState:v}))},[]),S=b.useCallback((v,_)=>{e(Qe({selectedDate:v,agingDateSelectionType:_})),e(kt(v))},[]),E=b.useCallback((v,_)=>{e(Mn({nodeId:v,isCollapsed:_}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Oa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function $a(e,a){const t=Gn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Oe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Vn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee(function(e){const a=Un(e).accountsInOrder.map((n,o)=>Na(n,o)),t=Ln(e);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}},$a)(Pa),us=ee(function(e){const a=Yn(e).accountsInOrder.map((o,r)=>Na(o,r)),t=M.getSignedInUser(),n=Je(t);return{sectionTitle:Z.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}},$a)(Pa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1),r=vt(n?.loggedInUserRoleMap);return k(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=ke(),o=vt(n?.loggedInUserRoleMap),r=k(s=>L(s).company?.companyInfo.firstMonthOfFY??1);return k(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Me,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Ot.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -10,11 +10,11 @@ import{j as d}from"./liveblocks-evjZPqs_.js";import{i as K,j as _,g as H,u as z,
10
10
  flex-direction: column;
11
11
  align-items: center;
12
12
  background-color: ${e=>e.theme.colors.grey4};
13
- `;function gs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=W(),i=z(),c=H(),{tenantEmailDomain:m}=K(),g=Uo();return d.jsxs(hs,{children:[d.jsx(Go,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:g.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:C=>{C.trim().length>=2?i(le({searchString:C,searchOrigin:"navbar"})):C.trim().length===0&&i(J("navbar"))},onAutoCompleteEntity:C=>{n!=null&&T?.trackSearch(N.Event.search,bs(a),C.type,C.name,n);const u=ue(C,m),l=D(c.state?.pathnameStackToGoBack,c.pathname);s(u,{state:{pathnameStackToGoBack:l}})}}},rightSideComponent:d.jsx(Vo,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(fs,{children:a==="cash_balance"?d.jsx(ms,{}):d.jsx(ps,{})})]})}function Xt(){const e=H(),a=z(),{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isDepositAccountsFeatureEnabled),o=_(p=>p.cashBalanceState.fetchState),r=_(p=>p.cardBalanceState.fetchState),s=M.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=la((p=>{const f=da(p,"/").split("/");return f[f.length-1]})(e.pathname));let c="Not-Started",m="";const g=Z.getLocalizedStrings();switch(i){case"cash_balance":c=o,m=g.reportTitleById.cash_balance;break;case"card_balance":c=r,m=g.reportTitleById.card_balance;break;default:console.error(`${i} is not supported!`)}const{isAiCfoAccessEnabled:C,onAskAiCfoClick:u}=ae({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});Ve({isDataReady:c==="Completed"});const l=_(p=>p.entityAutoCompleteState.autoCompleteText.navbar),h=_(p=>ce(p,"navbar"));return b.useEffect(()=>{c==="Not-Started"&&function(p,f,S){switch(f){case"card_balance":p(pa());break;case"cash_balance":p(ua()),S===!0&&p(ma());break;default:throw new Error(`balance report type ${f} is not yet supported`)}}(a,i,n)},[s,a,c]),d.jsxs(d.Fragment,{children:[c==="Completed"?d.jsx(Ye,{analytics:T,onLoad:p=>((f,S)=>{switch(S){case"card_balance":f.trackPageLoaded(N.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(N.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${S}!`)}})(p,i)}):null,d.jsx(gs,{title:m,reportId:i,autoCompleteText:l,entityAutoCompleteView:h,isAiCfoAccessEnabled:C,onAskAiCfoClick:u})]})}const bs=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Cs=[];function Ne(e){const{mobileExploreReferrer:a}=e,t=z(),n=W(),o=H(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=Fa(),c=Ra(),m=Ua(c),g=ia(),C=_(F=>F.tenantState.fetchState==="Completed"||F.tenantState.activeTenantFetchState.fetchState==="Completed"?U(F):void 0),u=C?.masterTOSInfo?.isMasterTOSAccepted??!1,l=_(F=>ha(F)),h=l.uiState?.currentChatSessionId,p=l.allSessionsWithOrderedQuestionAnswers??Cs,f=M.getSignedInUser()?.userId,S=Ba(),E=Yo()&&S&&r!=null,A=No(),k=$o(!0),x=_(F=>A!=null?Nn(F,A):void 0),{useDynamicConfig:w}=Se(),{configValue:y}=w(ja.aiCfoMessageDynamicConfig),I=b.useMemo(()=>Array.isArray(y.default_message_list)?y.default_message_list:[],[y.default_message_list]),L=b.useMemo(()=>I.slice(0,2),[I]),ne=A!=null&&x!=null&&x.fetchState!=="Completed"&&x.fetchState!=="Error"&&(k||x.fetchState==="In-Progress"),ze=b.useMemo(()=>{if(A==null||x?.fetchState==="Error")return L;if(ne)return[];const F=(x?.suggestedQuestions??[]).map(oe=>oe.trim()).filter(oe=>oe.length>0).slice(0,2);return F.length===0?L:F},[L,ne,A,x?.fetchState,x?.suggestedQuestions]),me=b.useCallback((F,oe)=>{if(f==null||F.trim()==="")return;if(!u)return void se({location:o,navigate:n,mergeState:{referrer:a}});const Pe=Ma(g.getState());if(m){const Ze=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ze,referrer:a,aiCfoInitialQuestion:F,aiCfoShouldSubmit:!Pe}})}else{if(Pe)return t(St(F)),void s(!0);i(F),s(!0),La(t,F,"insights_section",h,p,f,oe,void 0)}},[p,h,t,u,m,o,a,n,s,i,g,r,f]),Ke=b.useCallback(()=>{if(u)if(m){const F=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:F,referrer:a}})}else s(!0);else se({location:o,navigate:n,mergeState:{referrer:a}})},[u,m,o,a,n,s,r]);return b.useMemo(()=>{if(E)return{isSuggestedQuestionsLoading:ne,onAskSomethingElseClick:Ke,onSuggestedQuestionClick:me,suggestedQuestions:ze}},[E,ne,Ke,me,ze])}const $e=zo,ks=ee(function(e){const a=$n(e),t=zn(e),n=fa(e),{scrollPosition:o,...r}=n,s=Z.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e(Kn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Fe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(De("month")),e(de(a.firstMonthOfFY,t)),e(Fe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Le(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Fe({resetLeftScroll:!0})),50)},onElementCollapseStateChanged:(t,n)=>{e(Fe({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Fe({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})($e),_s=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashInCashOut"}),s=Ne({mobileExploreReferrer:"DashboardCashInCashOut"}),i=_(c=>fa(c)).mode==="compare_mode";return d.jsx(ks,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Ss=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},ys=ee(function(e){const a=Zn(e),t=qn(e),n=ga(e),{scrollPosition:o,...r}=n,s=Z.getLocalizedStrings().reportTitleById.cash_position,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e(Qn(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(Re({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Re({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Re({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Le(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Re({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ss(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Re({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}})($e),As=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashPosition"}),s=Ne({mobileExploreReferrer:"DashboardCashPosition"}),i=_(c=>ga(c)).mode==="compare_mode";return d.jsx(ys,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},$=(e,a,t,n)=>{e===!1?a!=null&&n("../../",{relative:"path"}):a!=t&&(a!=null&&a.length>0?n(`../${t}`,{replace:!0}):n(`./forecast/${t}`,{replace:!0}))};function mt(){return d.jsxs(Ct,{children:[d.jsx(P,{path:"/",element:d.jsx(re,{})}),d.jsx(P,{path:"/:forecastId",element:d.jsx(re,{})}),d.jsx(P,{path:"/:forecastId/*",element:d.jsx(Me,{})})]})}const vs=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Is=ee(function(e){const a=ba(e),t=Hn(e),n=Wn(e),o=Xn(e),r=vt(e),{scrollPosition:s,...i}=r,c=t.reportTitle,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(to(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Le(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=vs(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ge({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t==="forecast_mode"?(e(Qt({viewMode:"account_group"})),e(Ca(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ge({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Burn Rate"),e(Qt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(eo({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(Jn())},onResyncReports:()=>{e(Et("net_burn_or_income_by_classes"))}}})($e),Es=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),c=Ne({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=_(y=>vt(y)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(y=>Tt(y.forecastState,u??"")),h=_(y=>ba(y)),p=_(y=>xt(y)),f=_(y=>we(y)),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=E!=null&&y.endDate.isAfter(E?.endDate)===!0?E:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}},[u]);const A=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:x}=k(B.isReportsCommentingEnabled),w=Ft(x?A?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Is,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,analytics:T,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:w,isReportsCommentingEnabled:x})},Ts=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},xs=ee(function(e){const a=ka(e),t=ao(e),n=no(e),o=oo(e),r=Dt(e),{scrollPosition:s,...i}=r,c=Z.getLocalizedStrings().reportTitleById.operating_expenses,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(io(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Le(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=Ts(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t=="forecast_mode"?(e(Ht({viewMode:"account_group"})),e(_a(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Ht({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(ro({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(so())},onResyncReports:()=>{e(Et("operating_expenses_by_classes"))}}})($e),Ds=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardOpEx"}),c=Ne({mobileExploreReferrer:"DashboardOpEx"}),m=_(I=>Dt(I)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(I=>Tt(I.forecastState,u??"")),h=_(I=>ka(I)),p=_(I=>xt(I)),f=_(I=>we(I)),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const I=l?.forecastPeriod,L=E!=null&&I.endDate.isAfter(E?.endDate)===!0?E:I;a(de(e.firstMonthOfFY,{startDate:L.endDate.startOf(C),endDate:L?.endDate}))}},[u]);const A=_e(),k=A?.loggedInUserRole!=null&&Sa(A?.loggedInUserRole)!==!0,{useFeatureGate:x}=Se(),{isFeatureEnabled:w}=x(B.isReportsCommentingEnabled),y=Ft(w?A?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(xs,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,forecastIdFromUrlPath:r,analytics:T,hasTransactionAccess:k,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:y,isReportsCommentingEnabled:w})},ws=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Os=ee(function(e){const a=ya(e),t=co(e),n=lo(e),o=uo(e),r=wt(e),{scrollPosition:s,...i}=r,c=Z.getLocalizedStrings().reportTitleById.revenue,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(ho(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Le(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=ws(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Ce({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t==="forecast_mode"?(e(Wt({viewMode:"account_group"})),e(Aa(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Wt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(po({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(mo())},onResyncReports:()=>{e(Et("revenue_by_classes"))}}})($e),Ps=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardRevenue"}),c=Ne({mobileExploreReferrer:"DashboardRevenue"}),m=_(y=>wt(y)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(y=>Tt(y.forecastState,u??"")),h=_(y=>ya(y)),p=h.dataAvailable,f=m.mode==="compare_mode",S=_(y=>we(y)),E=_(y=>xt(y));b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=p!=null&&y.endDate.isAfter(p?.endDate)===!0?p:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}},[u]);const A=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:x}=k(B.isReportsCommentingEnabled),w=Ft(x?A?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Os,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:S,isCompareModeOn:f,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:T,reportsResyncFetchState:E.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:w,isReportsCommentingEnabled:x})},Fs=e=>{let a,t;if(e.endDate!=null)switch(e.timePeriod){case"this_month_to_date":case"last_month":case"this_week_to_date":case"last_week":a="month",t={startDate:e.endDate.startOf("month"),endDate:e.endDate};break;case"last_3_months":case"last_6_months":case"last_12_months":case"this_year_to_date":case"last_year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;default:console.error(`this timeperiod ${e.timePeriod} is not supported!`)}return{timeframe:a,timePeriod:t}},Rs=ee(function(e){const a=fo(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ce(e,"navbar");return{report:a,analytics:T,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}},function(e,a){return{onTimeframeSelectionChanged:t=>{T.trackTimeframeSwitch(Ya(t),"Top Expenses"),e(va(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Fs(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(Ko),Bs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return d.jsx(Rs,{tenantEmailDomain:a,location:t,navigate:n})},js=Ot.div`
13
+ `;function gs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=W(),i=z(),c=H(),{tenantEmailDomain:m}=K(),g=Lo();return d.jsxs(hs,{children:[d.jsx(Go,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:g.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:C=>{C.trim().length>=2?i(le({searchString:C,searchOrigin:"navbar"})):C.trim().length===0&&i(X("navbar"))},onAutoCompleteEntity:C=>{n!=null&&T?.trackSearch(N.Event.search,bs(a),C.type,C.name,n);const u=ue(C,m),l=x(c.state?.pathnameStackToGoBack,c.pathname);s(u,{state:{pathnameStackToGoBack:l}})}}},rightSideComponent:d.jsx(Vo,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(fs,{children:a==="cash_balance"?d.jsx(ms,{}):d.jsx(ps,{})})]})}function Jt(){const e=H(),a=z(),{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isDepositAccountsFeatureEnabled),o=k(p=>p.cashBalanceState.fetchState),r=k(p=>p.cardBalanceState.fetchState),s=M.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=la((p=>{const f=da(p,"/").split("/");return f[f.length-1]})(e.pathname));let c="Not-Started",m="";const g=Z.getLocalizedStrings();switch(i){case"cash_balance":c=o,m=g.reportTitleById.cash_balance;break;case"card_balance":c=r,m=g.reportTitleById.card_balance;break;default:console.error(`${i} is not supported!`)}const{isAiCfoAccessEnabled:C,onAskAiCfoClick:u}=ae({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});Ve({isDataReady:c==="Completed"});const l=k(p=>p.entityAutoCompleteState.autoCompleteText.navbar),h=k(p=>ce(p,"navbar"));return b.useEffect(()=>{c==="Not-Started"&&function(p,f,S){switch(f){case"card_balance":p(pa());break;case"cash_balance":p(ua()),S===!0&&p(ma());break;default:throw new Error(`balance report type ${f} is not yet supported`)}}(a,i,n)},[s,a,c]),d.jsxs(d.Fragment,{children:[c==="Completed"?d.jsx(Ye,{analytics:T,onLoad:p=>((f,S)=>{switch(S){case"card_balance":f.trackPageLoaded(N.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(N.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${S}!`)}})(p,i)}):null,d.jsx(gs,{title:m,reportId:i,autoCompleteText:l,entityAutoCompleteView:h,isAiCfoAccessEnabled:C,onAskAiCfoClick:u})]})}const bs=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Cs=[];function Ne(e){const{mobileExploreReferrer:a}=e,t=z(),n=W(),o=H(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=Fa(),c=Ra(),m=La(c),g=ia(),C=k(F=>F.tenantState.fetchState==="Completed"||F.tenantState.activeTenantFetchState.fetchState==="Completed"?L(F):void 0),u=C?.masterTOSInfo?.isMasterTOSAccepted??!1,l=k(F=>ha(F)),h=l.uiState?.currentChatSessionId,p=l.allSessionsWithOrderedQuestionAnswers??Cs,f=M.getSignedInUser()?.userId,S=Ba(),E=Yo()&&S&&r!=null,v=No(),_=$o(!0),w=k(F=>v!=null?Nn(F,v):void 0),{useDynamicConfig:D}=Se(),{configValue:y}=D(ja.aiCfoMessageDynamicConfig),I=b.useMemo(()=>Array.isArray(y.default_message_list)?y.default_message_list:[],[y.default_message_list]),U=b.useMemo(()=>I.slice(0,2),[I]),ne=v!=null&&w!=null&&w.fetchState!=="Completed"&&w.fetchState!=="Error"&&(_||w.fetchState==="In-Progress"),ze=b.useMemo(()=>{if(v==null||w?.fetchState==="Error")return U;if(ne)return[];const F=(w?.suggestedQuestions??[]).map(oe=>oe.trim()).filter(oe=>oe.length>0).slice(0,2);return F.length===0?U:F},[U,ne,v,w?.fetchState,w?.suggestedQuestions]),me=b.useCallback((F,oe)=>{if(f==null||F.trim()==="")return;if(!u)return void se({location:o,navigate:n,mergeState:{referrer:a}});const Pe=Ma(g.getState());if(m){const Ze=x(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ze,referrer:a,aiCfoInitialQuestion:F,aiCfoShouldSubmit:!Pe}})}else{if(Pe)return t(St(F)),void s(!0);i(F),s(!0),Ua(t,F,"insights_section",h,p,f,oe,void 0)}},[p,h,t,u,m,o,a,n,s,i,g,r,f]),Ke=b.useCallback(()=>{if(u)if(m){const F=x(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:F,referrer:a}})}else s(!0);else se({location:o,navigate:n,mergeState:{referrer:a}})},[u,m,o,a,n,s,r]);return b.useMemo(()=>{if(E)return{isSuggestedQuestionsLoading:ne,onAskSomethingElseClick:Ke,onSuggestedQuestionClick:me,suggestedQuestions:ze}},[E,ne,Ke,me,ze])}const $e=zo,_s=ee(function(e){const a=$n(e),t=zn(e),n=fa(e),{scrollPosition:o,...r}=n,s=Z.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=L(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e(Kn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Fe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(xe("month")),e(de(a.firstMonthOfFY,t)),e(Fe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ue(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Fe({resetLeftScroll:!0})),50)},onElementCollapseStateChanged:(t,n)=>{e(Fe({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Fe({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})($e),ks=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashInCashOut"}),s=Ne({mobileExploreReferrer:"DashboardCashInCashOut"}),i=k(c=>fa(c)).mode==="compare_mode";return d.jsx(_s,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Ss=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Xe(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},ys=ee(function(e){const a=Zn(e),t=qn(e),n=ga(e),{scrollPosition:o,...r}=n,s=Z.getLocalizedStrings().reportTitleById.cash_position,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=L(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e(Qn(t))},onTimeframeSelectionChanged:t=>{e(xe(t)),setTimeout(()=>e(Re({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Re({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Re({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ue(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Re({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ss(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Re({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}})($e),vs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashPosition"}),s=Ne({mobileExploreReferrer:"DashboardCashPosition"}),i=k(c=>ga(c)).mode==="compare_mode";return d.jsx(ys,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},$=(e,a,t,n)=>{e===!1?a!=null&&n("../../",{relative:"path"}):a!=t&&(a!=null&&a.length>0?n(`../${t}`,{replace:!0}):n(`./forecast/${t}`,{replace:!0}))};function mt(){return d.jsxs(Ct,{children:[d.jsx(P,{path:"/",element:d.jsx(re,{})}),d.jsx(P,{path:"/:forecastId",element:d.jsx(re,{})}),d.jsx(P,{path:"/:forecastId/*",element:d.jsx(Me,{})})]})}const As=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Xe(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Is=ee(function(e){const a=ba(e),t=Hn(e),n=Wn(e),o=Jn(e),r=At(e),{scrollPosition:s,...i}=r,c=t.reportTitle,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=L(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Je(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(to(t))},onTimeframeSelectionChanged:t=>{e(xe(t)),setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ue(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=As(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ge({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t==="forecast_mode"?(e(Qt({viewMode:"account_group"})),e(Ca(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ge({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Burn Rate"),e(Qt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(eo({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(Xn())},onResyncReports:()=>{e(Et("net_burn_or_income_by_classes"))}}})($e),Es=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),c=Ne({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=k(y=>At(y)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=k(y=>Tt(y.forecastState,u??"")),h=k(y=>ba(y)),p=k(y=>wt(y)),f=k(y=>De(y)),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=E!=null&&y.endDate.isAfter(E?.endDate)===!0?E:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}},[u]);const v=ke(),{useFeatureGate:_}=Se(),{isFeatureEnabled:w}=_(B.isReportsCommentingEnabled),D=Ft(w?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Is,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,analytics:T,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:D,isReportsCommentingEnabled:w})},Ts=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Xe(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},ws=ee(function(e){const a=_a(e),t=ao(e),n=no(e),o=oo(e),r=xt(e),{scrollPosition:s,...i}=r,c=Z.getLocalizedStrings().reportTitleById.operating_expenses,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=L(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Je(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(io(t))},onTimeframeSelectionChanged:t=>{e(xe(t)),setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ue(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=Ts(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t=="forecast_mode"?(e(Ht({viewMode:"account_group"})),e(ka(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Ht({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(ro({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(so())},onResyncReports:()=>{e(Et("operating_expenses_by_classes"))}}})($e),xs=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardOpEx"}),c=Ne({mobileExploreReferrer:"DashboardOpEx"}),m=k(I=>xt(I)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=k(I=>Tt(I.forecastState,u??"")),h=k(I=>_a(I)),p=k(I=>wt(I)),f=k(I=>De(I)),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const I=l?.forecastPeriod,U=E!=null&&I.endDate.isAfter(E?.endDate)===!0?E:I;a(de(e.firstMonthOfFY,{startDate:U.endDate.startOf(C),endDate:U?.endDate}))}},[u]);const v=ke(),_=v?.loggedInUserRole!=null&&Sa(v?.loggedInUserRole)!==!0,{useFeatureGate:w}=Se(),{isFeatureEnabled:D}=w(B.isReportsCommentingEnabled),y=Ft(D?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(ws,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,forecastIdFromUrlPath:r,analytics:T,hasTransactionAccess:_,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:y,isReportsCommentingEnabled:D})},Ds=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Xe(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Os=ee(function(e){const a=ya(e),t=co(e),n=lo(e),o=uo(e),r=Dt(e),{scrollPosition:s,...i}=r,c=Z.getLocalizedStrings().reportTitleById.revenue,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=L(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=It(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Je(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(ho(t))},onTimeframeSelectionChanged:t=>{e(xe(t)),setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ge(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ue(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ds(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Pt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Ce({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Rt,n)),t==="forecast_mode"?(e(Wt({viewMode:"account_group"})),e(va(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Wt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(po({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(mo())},onResyncReports:()=>{e(Et("revenue_by_classes"))}}})($e),Ps=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardRevenue"}),c=Ne({mobileExploreReferrer:"DashboardRevenue"}),m=k(y=>Dt(y)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=k(y=>Tt(y.forecastState,u??"")),h=k(y=>ya(y)),p=h.dataAvailable,f=m.mode==="compare_mode",S=k(y=>De(y)),E=k(y=>wt(y));b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=p!=null&&y.endDate.isAfter(p?.endDate)===!0?p:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}},[u]);const v=ke(),{useFeatureGate:_}=Se(),{isFeatureEnabled:w}=_(B.isReportsCommentingEnabled),D=Ft(w?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Os,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:S,isCompareModeOn:f,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:T,reportsResyncFetchState:E.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:D,isReportsCommentingEnabled:w})},Fs=e=>{let a,t;if(e.endDate!=null)switch(e.timePeriod){case"this_month_to_date":case"last_month":case"this_week_to_date":case"last_week":a="month",t={startDate:e.endDate.startOf("month"),endDate:e.endDate};break;case"last_3_months":case"last_6_months":case"last_12_months":case"this_year_to_date":case"last_year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;default:console.error(`this timeperiod ${e.timePeriod} is not supported!`)}return{timeframe:a,timePeriod:t}},Rs=ee(function(e){const a=fo(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ce(e,"navbar");return{report:a,analytics:T,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}},function(e,a){return{onTimeframeSelectionChanged:t=>{T.trackTimeframeSwitch(Ya(t),"Top Expenses"),e(Aa(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Fs(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Oe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(X("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(Ko),Bs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return d.jsx(Rs,{tenantEmailDomain:a,location:t,navigate:n})},js=Ot.div`
14
14
  display: flex;
15
15
  flex: 1 1 auto;
16
16
  min-height: 100%;
17
17
  flex-direction: column;
18
18
  background-color: ${e=>e.theme.colors.grey5};
19
19
  align-items: center;
20
- `,Te=3,Rt=1;function Ms({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=W(),r=H(),{tenantEmailDomain:s}=K();let i;Ve({isDataReady:!0});const c={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(Ds,{...c});break;case"revenue":i=d.jsx(Ps,{...c});break;case"net_burn_or_income":i=d.jsx(Es,{...c});break;case"cash_position":i=d.jsx(As,{...c});break;case"top_expenses":i=d.jsx(Bs,{...c});break;case"cash_in_cash_out":i=d.jsx(_s,{...c});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(js,{children:i}):null}function re(){const e=H(),a=z(),{forecastId:t}=K();let n="Not-Started";const o=_(l=>Dt(l).fetchState),r=_(l=>wt(l).fetchState),s=_(l=>vt(l).fetchState),i=_(l=>l.cashPositionState.fetchState),c=_(l=>l.topExState.fetchState),m=_(l=>l.cashInCashOutState.fetchState);if(M.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const g=_(l=>U(l)),C=g?.company?.companyInfo?.firstMonthOfFY??1,u=la((l=>{const h=da(l,"/").split("/");return t!=null?h[h.length-3]:h[h.length-1]})(e.pathname));switch(u){case"operating_expenses":n=o;break;case"revenue":n=r;break;case"net_burn_or_income":n=s;break;case"cash_position":n=i;break;case"top_expenses":n=c;break;case"cash_in_cash_out":n=m;break;default:console.error(`${u} is not supported!`)}return b.useEffect(()=>{n==="Not-Started"&&function(l,h,p,f){switch(h){case"operating_expenses":l(wa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(_a(!1,f)));break;case"revenue":l(Da(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(Aa(!1,f)));break;case"net_burn_or_income":l(xa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(Ca(!1,f)));break;case"cash_position":l(Ta(!0));break;case"top_expenses":l(Ea());break;case"cash_in_cash_out":l(Ia());break;default:throw new Error(`report type ${h} is not yet supported`)}}(a,u,C,t)},[t]),d.jsxs(d.Fragment,{children:[n==="Completed"?d.jsx(Ye,{analytics:T,onLoad:l=>((h,p)=>{const f=e.state?.referrer;switch(p){case"operating_expenses":h.trackPageLoaded(N.Event.operatingExpenses,f);break;case"revenue":h.trackPageLoaded(N.Event.revenues,f);break;case"net_burn_or_income":h.trackPageLoaded(N.Event.burnRate,f);break;case"cash_position":h.trackPageLoaded(N.Event.cashPosition,f);break;case"top_expenses":h.trackPageLoaded(N.Event.topExpenses,f);break;case"cash_in_cash_out":h.trackPageLoaded(N.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${p}!`)}})(l,u)}):null,d.jsx(Ms,{firstMonthOfFY:C,fetchState:n,reportId:u,forecastId:t})]})}var pt=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function ht(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),function(){t(window.event)})}function za(e,a){for(var t=a.slice(0,a.length-1),n=0;n<t.length;n++)t[n]=e[t[n].toLowerCase()];return t}function Ka(e){typeof e!="string"&&(e="");for(var a=(e=e.replace(/\s/g,"")).split(","),t=a.lastIndexOf("");t>=0;)a[t-1]+=",",a.splice(t,1),t=a.lastIndexOf("");return a}for(var Bt={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":pt?173:189,"=":pt?61:187,";":pt?59:186,"'":222,"[":219,"]":221,"\\":220},ie={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},yt={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},j={16:!1,18:!1,17:!1,91:!1},R={},He=1;He<20;He++)Bt["f".concat(He)]=111+He;var O=[],Jt=!1,Za="all",ea=[],tt=function(e){return Bt[e.toLowerCase()]||ie[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function ta(e){Za=e||"all"}function je(){return Za||"all"}var ft=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;Ka(a).forEach(function(s){var i=s.split(r),c=i.length,m=i[c-1],g=m==="*"?"*":tt(m);if(R[g]){t||(t=je());var C=c>1?za(ie,i):[];R[g]=R[g].filter(function(u){return!((!n||u.method===n)&&u.scope===t&&function(l,h){for(var p=l.length>=h.length?l:h,f=l.length>=h.length?h:l,S=!0,E=0;E<p.length;E++)f.indexOf(p[E])===-1&&(S=!1);return S}(u.mods,C))})}})};function aa(e,a,t,n){var o;if(a.element===n&&(a.scope===t||a.scope==="all")){for(var r in o=a.mods.length>0,j)Object.prototype.hasOwnProperty.call(j,r)&&(!j[r]&&a.mods.indexOf(+r)>-1||j[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||j[16]||j[18]||j[17]||j[91])&&!o&&a.shortcut!=="*"||a.method(e,a)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function na(e,a){var t=R["*"],n=e.keyCode||e.which||e.charCode;if(G.filter.call(this,e)){if(n!==93&&n!==224||(n=91),O.indexOf(n)===-1&&n!==229&&O.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(h){var p=yt[h];e[h]&&O.indexOf(p)===-1?O.push(p):!e[h]&&O.indexOf(p)>-1?O.splice(O.indexOf(p),1):h==="metaKey"&&e[h]&&O.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(O=O.slice(O.indexOf(p))))}),n in j){for(var o in j[n]=!0,ie)ie[o]===n&&(G[o]=!0);if(!t)return}for(var r in j)Object.prototype.hasOwnProperty.call(j,r)&&(j[r]=e[yt[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(O.indexOf(17)===-1&&O.push(17),O.indexOf(18)===-1&&O.push(18),j[17]=!0,j[18]=!0);var s=je();if(t)for(var i=0;i<t.length;i++)t[i].scope===s&&(e.type==="keydown"&&t[i].keydown||e.type==="keyup"&&t[i].keyup)&&aa(e,t[i],s,a);if(n in R){for(var c=0;c<R[n].length;c++)if((e.type==="keydown"&&R[n][c].keydown||e.type==="keyup"&&R[n][c].keyup)&&R[n][c].key){for(var m=R[n][c],g=m.splitKey,C=m.key.split(g),u=[],l=0;l<C.length;l++)u.push(tt(C[l]));u.sort().join("")===O.sort().join("")&&aa(e,m,s,a)}}}}function G(e,a,t){O=[];var n=Ka(e),o=[],r="all",s=document,i=0,c=!1,m=!0,g="+",C=!1;for(t===void 0&&typeof a=="function"&&(t=a),Object.prototype.toString.call(a)==="[object Object]"&&(a.scope&&(r=a.scope),a.element&&(s=a.element),a.keyup&&(c=a.keyup),a.keydown!==void 0&&(m=a.keydown),a.capture!==void 0&&(C=a.capture),typeof a.splitKey=="string"&&(g=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(g)).length>1&&(o=za(ie,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in R||(R[e]=[]),R[e].push({keyup:c,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:g,element:s});s!==void 0&&!function(u){return ea.indexOf(u)>-1}(s)&&window&&(ea.push(s),ht(s,"keydown",function(u){na(u,s)},C),Jt||(Jt=!0,ht(window,"focus",function(){O=[]},C)),ht(s,"keyup",function(u){na(u,s),function(l){var h=l.keyCode||l.which||l.charCode,p=O.indexOf(h);if(p>=0&&O.splice(p,1),l.key&&l.key.toLowerCase()==="meta"&&O.splice(0,O.length),h!==93&&h!==224||(h=91),h in j)for(var f in j[h]=!1,ie)ie[f]===h&&(G[f]=!1)}(u)},C))}var gt={setScope:ta,getScope:je,deleteScope:function(e,a){var t,n;for(var o in e||(e=je()),R)if(Object.prototype.hasOwnProperty.call(R,o))for(t=R[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;je()===e&&ta(a||"all")},getPressedKeyCodes:function(){return O.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=tt(e)),O.indexOf(e)!==-1},filter:function(e){var a=e.target||e.srcElement,t=a.tagName,n=!0;return!a.isContentEditable&&(t!=="INPUT"&&t!=="TEXTAREA"&&t!=="SELECT"||a.readOnly)||(n=!1),n},trigger:function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(R).forEach(function(t){var n=R[t].find(function(o){return o.scope===a&&o.shortcut===e});n&&n.method&&n.method()})},unbind:function(e){if(e===void 0)Object.keys(R).forEach(function(s){return delete R[s]});else if(Array.isArray(e))e.forEach(function(s){s.key&&ft(s)});else if(typeof e=="object")e.key&&ft(e);else if(typeof e=="string"){for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];var o=t[0],r=t[1];typeof o=="function"&&(r=o,o=""),ft({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Bt,modifier:ie,modifierMap:yt};for(var bt in gt)Object.prototype.hasOwnProperty.call(gt,bt)&&(G[bt]=gt[bt]);if(typeof window<"u"){var Ls=window.hotkeys;G.noConflict=function(e){return e&&window.hotkeys===G&&(window.hotkeys=Ls),G},window.hotkeys=G}G.filter=function(){return!0};var oa=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Us(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,c=o.keydown,m=o.filterPreventDefault,g=m===void 0||m,C=o.enabled,u=C===void 0||C,l=o.enableOnContentEditable,h=l!==void 0&&l,p=b.useRef(null),f=b.useCallback(function(S,E){var A,k;return s&&!s(S)?!g:!!(oa(S,["INPUT","TEXTAREA","SELECT"])&&!oa(S,r)||(A=S.target)!=null&&A.isContentEditable&&!h)||!!(p.current===null||document.activeElement===p.current||(k=p.current)!=null&&k.contains(document.activeElement))&&(a(S,E),!0)},n?[p,r,s].concat(n):[p,r,s]);return b.useEffect(function(){if(u)return i&&c!==!0&&(t.keydown=!1),G(e,t||{},f),function(){return G.unbind(e,f)};G.unbind(e,f)},[f,e,u]),p}G.isPressed;const Gs=[],sa="dashboard_card",X="ai_cfo_dashboard_card";function ra(e,a){return a?e.some(t=>String(t)===X)?e.slice():[X,...e]:e.filter(t=>String(t)!==X)}const Vs=["net_burn_or_income_story_card","cash_balance","task_card","card_balance","zeni_promo_card","insights_dashboard","information_card","company_details","bill_pay_promo_card","bill_pay_card","reimbursement_card","reimbursement_promo_card","zeni_accounts_promo_card","rewards_card","treasury_promo_card"],Ys=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e.status!=null?{balanceAmount:e.balance?.available,lastUpdatedTime:e.status.lastRefreshSuccessTime,changePercent:e.balance?.change?.percent,changeComparedToDate:e.balance?.change?.since}:void 0}),Be=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),Ns=(e,a,t,n)=>Be(void 0,e,ke,a,t),$s=(e,a,t,n,o)=>({card:{dimension:et(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1,spansFullDashboardWidth:!1},data:{funds:n,shouldShowTreasuryPromoIntroVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),zs=e=>{const a=et(ke);return a.height=ke.height+10,{card:{dimension:a,cardType:X,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ks=ee(function(e,a){const t=Qs(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:c,shouldShowTreasuryPromoIntroVideo:m,treasuryFetchState:g}=a;let C=n.map((u,l)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return Ns(t,u,l);if(u==="zeni_promo_card")return Be({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,l);if(u==="treasury_promo_card")return $s(g,u,l,c,m);if(u==="information_card")return Be(void 0,"Completed",ke,u,l);if(u===X)return zs(l);{const h=o.find(p=>p?.reportId===u);return h?function(p,f,S,E){const A=p.reportId;switch(A){case"card_balance":case"cash_balance":return[Ys(p,f,S,A,E)];case"expense_automation_card":case"operating_expenses":case"revenue":case"top_expenses":case"cash_position":case"cash_in_cash_out":case"insights_dashboard":case"company_details":case"task_card":case"bill_pay_card":case"reimbursement_card":case"net_burn_or_income":case"accounts_payable_aging":case"accounts_receivable_aging":case"zeni_accounts_promo_card":case"rewards_card":return[Be(p,f,S,A,E)];case"net_burn_or_income_story_card":return[Be(p,f,S,"net_burn_or_income_story_card",E)];default:return console.error(`card type ${A} not yet supported!`),[]}}(h,h.fetchState,ke,l):[]}}).flat();return a.isSummaryCardsFiltered===!0&&(C=C.filter(u=>Vs.includes(u.card.cardType)==0).filter(u=>{const l=u.data?.availableNumberOfPeriods;return l!=null?l>0:u.card.cardType!="top_expenses"||u.data==null||function(h){if(h==null||h.length===0)return!0;let p=!0;for(const f of h)if(f.balance.available.amount!==0){p=!1;break}return p}(u.data.topExpenses.accountsOrdered)===!1})),{cardDataArray:C,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ce(e,"navbar")},analytics:T,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}},function(e,a){const t=a.tenantId,n=M.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)T.trackDashboardCardClicked("cards promo",2),T.trackZeniCardsPromoCardClicked(a.isChargeCardFeatureEnabled,i,2,`${n?.firstName??""} ${n?.lastName??""}`,a.isChargeCardFeatureEnabled?a.cardsCreditLimit:void 0),i==="Learn More"?window.open("https://www.zeni.ai/product/business-credit-card","_blank"):a.navigate("../cards/promo",{relative:"path"});else if(a.isForecastOn)switch(r){case"net_burn_or_income":case"operating_expenses":case"revenue":a.navigate(`${r}/forecast/${a.selectedForecastOnDashboard}`,{state:{referrer:s}});break;default:a.navigate(`${r}`,{state:{referrer:s}})}else r==="rewards_card"?(n!=null&&T.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(T.trackMonthEndCloseClicked(a.selectedPeriod.month,a.selectedPeriod.year,"Dashboard"),a.navigate("../../month_end_close_checks/review",{state:{referrer:"Dashboard"}})):a.navigate(`${r}`,{state:{referrer:s}})},onReloadData:(o,r)=>{const s=[];a.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),a.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),a.isZeniAccountEnabled===!1&&s.push("zeni_accounts_promo_card"),a.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),function(i,c,m,g){if(c!==X)switch(c){case"card_balance":i(pa());break;case"cash_balance":i(ua());break;case"operating_expenses":i(wa(!0));break;case"revenue":i(Da(!0));break;case"net_burn_or_income":i(xa(!0));break;case"net_burn_or_income_story_card":i(Ro(!0));break;case"cash_position":i(Ta(!0));break;case"top_expenses":i(Ea());break;case"cash_in_cash_out":i(Ia());break;case"insights_dashboard":i(Fo());break;case"bill_pay_card":i(Po());break;case"reimbursement_card":i(Oo());break;case"company_details":i(wo(m));break;case"task_card":i(Do());break;case"accounts_payable_aging":g.includes("accounts_payable_aging")===!1&&i(kt(xe()));break;case"accounts_receivable_aging":i(_t(xe()));break;case"zeni_accounts_promo_card":g.includes("zeni_accounts_promo_card")===!1&&i(ma());break;case"rewards_card":g.includes("rewards_card")===!1&&i(xo(!0));break;default:throw new Error(`report type ${c} is not yet supported`)}}(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{T.trackTimeframeSwitch(Ya(r),qs(o),"Dashboard"),function(s,i,c){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(De(c));break;case"top_expenses":s(va(c));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}}(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(To(o))},onCategoryClick:(o,r,s)=>{o==="bill-pay"?a.navigate("../bills",{state:{tab:r,subTab:s},relative:"path"}):o==="reimbursement"?a.navigate("../reimbursements",{state:{tab:r,subTab:s},relative:"path"}):o==="uncategorized-account-mapping"?a.navigate("../settings/accounting",{relative:"path"}):o==="show-all-tasks"?a.navigate("../tasks",{relative:"path"}):a.navigate(`../../transactions/${o}`)},onCardBtnClick:(o,r)=>{if(o==="bill_pay_promo_card"){const s="../bills",i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else if(o==="reimbursement_promo_card"){const s="../reimbursements",i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else if(o==="zeni_accounts_promo_card")if(a.hasZeniAccountsAdminAccess){let s="../checking/promo";r!=null&&(s=`../checking/${r}`);const i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/business-checking-accounts","_blank");else if(o==="treasury_promo_card")if(a.isUserHasTreasuryAccess){M.saveTreasuryPopupSeen(a.tenantEmailDomain,!0);const s="../treasury",i=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/treasury","_blank")},onSaveClick:(o,r,s)=>{o==="net_burn_or_income_story_card"&&(T.trackUpdateBurnRateCalculatorSettings(r,s,Io(s)),e(Eo(t,r,s)))},onVideoPlay:()=>{e(ut())},onRemindMeLaterClick:()=>{e(vo())},onDontShowAgainClick:()=>{e(ut())},onIntroOutsideClick:()=>{a.isTreasuryPromoIntroClosedByOutsideClick===!0&&a.isTreasuryPromoVideoPlayed!==!0?e(ut()):e(Ao())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(le({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(J("navbar"))},onCancelAutoComplete:()=>{e(J("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ue(o,a.tenantEmailDomain):ts(o.zeniId,o.qboId,a.tenantEmailDomain);const s=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}})(es);function Zs(){const e=ia(),a=Ra(),t=Ua(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=Fa(),s=W(),i=z(),c=H(),m=M.getSignedInUser(),{useFeatureGate:g,useDynamicConfig:C}=Se(),[u,l]=b.useState(!1),[h,p]=b.useState(!1),f=Ba(),{tenantEmailDomain:S}=K(),{isAiCfoAccessEnabled:E,onAskAiCfoClick:A}=ae({mobileExploreReferrer:"Dashboard"}),k=_(v=>v.tenantState.fetchState==="Completed"||v.tenantState.activeTenantFetchState.fetchState==="Completed"?U(v):void 0),x=k??M.getSignedInUserTenant(S),w=k?.masterTOSInfo?.isMasterTOSAccepted??!1,y=x.tenantId,I=x.companyId;b.useEffect(()=>{u===!1&&c.state?.message==="activation"&&(i(go(I)),l(!0))},[c.state,u,I,i]),b.useEffect(()=>{f&&!h&&c.state?.message==="open_ai_cfo_drawer"&&(p(!0),w?(o(!0),s({pathname:c.pathname,search:c.search,hash:c.hash},{replace:!0,state:{...c.state,message:void 0}})):se({location:c,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))},[c,h,f,w,o,s]);const{isFeatureEnabled:L}=g(B.isApAgingFeatureEnabled),{isFeatureEnabled:ne}=g(B.isExpenseAutomationEnabled),{isFeatureEnabled:ze}=g(B.isExpenseAutomationEnabledV2),me=Zo(),{isFeatureEnabled:Ke}=g(B.isTreasuryEnabled),F=qo(me),{isFeatureEnabled:oe}=g(B.isArAgingFeatureEnabled),{isFeatureEnabled:Pe}=g(B.isDepositAccountsFeatureEnabled),{isFeatureEnabled:Ze}=g(B.isReferralFeatureEnabled),{isFeatureEnabled:qa}=g(B.isChargeCardFeatureEnabled),{isFeatureEnabled:Qa}=g(B.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ha}=g(B.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Wa}=g(B.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Xa}=g(B.aiAuditScorePercentage),{configValue:jt}=C(ja.zeniCardsConfig),Ja=jt.charge_card_cashback_rate_per_transaction==null?.0175:jt.charge_card_cashback_rate_per_transaction;if(c.state?.message==="activation"){const v=Qo(c.state?.pathnameStackToGoBack);s(c.pathname,{state:{...c.state,message:void 0,pathnameStackToGoBack:v.newStack}})}const[Mt,en]=b.useState(!1),[at,tn]=b.useState(!1);Us("command+p, Control+p",v=>{tn(!at),v.preventDefault()},{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const Lt=k?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const pe=_(v=>U(v)?.excludedResources),an=_(v=>v.expenseAutomationViewState.selectedPeriodByTenantId),nn=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,on=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,sn=_(v=>v.treasurySetupViewState.treasuryFundsDetails).fetchStatus.fetchState,rn=k?.company!=null&&bo(k.company),nt=Ke&&rn,ot=_e(),cn=At(ot?.loggedInUserRoleMap),V=[],Ut=pe?.resources?.find(v=>v.resource==="/reports/top_expenses")==null,ln=pe?.resources?.find(v=>v.resource==="/reports/task_card")==null,st=k?.userRole!=null&&Sa(k?.userRole),dn=pe?.resources?.find(v=>v.resource==="/bills")==null&&!st,un=pe?.resources?.find(v=>v.resource==="/reimbursements")==null,mn=Co(ot?.loggedInUserRoleMap),pn=ko(ot?.loggedInUserRoleMap),hn=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,fn=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,gn=_(v=>v.treasurySetupViewState.treasuryFundsDetails).fundsDetails;Ut===!1&&V.push("top_expenses"),ln===!1&&V.push("task_card"),dn===!1&&V.push("bill_pay_card","bill_pay_promo_card"),L===!1&&V.push("accounts_payable_aging"),oe===!1&&V.push("accounts_receivable_aging"),(me===!1||st)&&V.push("expense_automation_card"),un===!1&&V.push("reimbursement_card","reimbursement_promo_card"),Pe===!1&&V.push("zeni_accounts_promo_card"),Ze===!1&&V.push("rewards_card"),nt===!1&&V.push("treasury_promo_card");const{areTenantIdsInSync:Gt}=Ho();b.useLayoutEffect(()=>{Mt&&F===me||Lt!==!0||!Gt||pe?.fetchState!=="Completed"&&pe?.fetchState!=="Error"||(en(!0),i(_o(m.userId,I,y,!0,!1,V)))},[Mt,m,y,i,Ut,Lt,pe?.fetchState,Gt]);const bn=_(v=>v.reportUIOptionsState.forecastOnDashboard.isForecastModeOn),Cn=_(v=>v.revenueState.uiState.selectedForecast?.id),kn=_(v=>v.cardBalanceState.fetchState),he=_(v=>So(v,V,m,ze,ne,nt)),_n=he.fetchState,Sn=b.useMemo(()=>ra(he.cardsOrdered,E),[he.cardsOrdered,E]),yn=b.useMemo(()=>ra(he.cardsForDashboardUI,E),[he.cardsForDashboardUI,E]);Ve({isDataReady:!0});const{isSuggestedQuestionsLoading:An,suggestedPromptQuestions:vn}=ns(),rt=k?.isTreasuryPromoVideoPlayed===!0,Vt=k?.isTreasuryPromoVideoRemindMeLaterClicked===!0,Yt=k?.loginCounterForTreasuryPromoVideo??0,In=k?.isTreasuryPromoIntroClosedByOutsideClick===!0,Nt=_(v=>v.dashboardState.isTreasuryVideoClosed),$t=b.useMemo(()=>Wo({isTreasuryPromoVideoRemindMeLaterClicked:Vt,isTreasuryPromoVideoPlayed:rt,loginCounterForTreasuryPromoVideo:Yt,isTreasuryVideoClosed:Nt}),[Vt,rt,Yt,Nt]),zt=_(v=>ha(v)),ye=zt.uiState?.currentChatSessionId,it=zt.allSessionsWithOrderedQuestionAnswers??Gs,{currentSessionQuestionAnswers:En}=Xo(it,ye),Kt=En.length===0,Tn=b.useCallback((v,q,fe)=>{const Ae=m?.userId;if(Ae==null)return;const Y=v.trim();if(Y.length===0&&q.length===0)return;if(!w)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});const Q=Ma(e.getState()),ve=()=>{const Ie=D(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ie,referrer:"Dashboard",aiCfoInitialQuestion:Y,aiCfoShouldSubmit:!Q&&Y.length>0,aiCfoInitialSubmissionSource:sa,...typeof fe=="number"?{aiCfoSuggestionIndex:fe}:{}}})};return t?q.length>0?void o(!0):void ve():q.length>0?Q?(i(St(Y)),void o(!0)):(r(Y.length>0?Y:null),o(!0),void(Y.length>0&&La(i,Y,sa,ye,it,Ae,fe,q.length>0?q:void 0))):(Q&&i(St(Y)),void ve())},[it,ye,i,w,t,c,s,r,o,m?.userId,e,S]),xn=b.useCallback(()=>{w?o(!0):se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[w,c,s,o]),Dn=b.useCallback(()=>{if(!w)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});if(S==null)return;const v=D(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{pathnameStackToGoBack:v,referrer:"Dashboard"}})},[w,c,s,S]),wn=b.useCallback(()=>{if(w)if(t){if(S==null||k==null)return;const v=ye==null||Kt?`/${S}/ai-cfo/explore`:`/${S}/ai-cfo/${ye}`,q=c.state?.pathnameStackToGoBack??[],fe=D(q,c.pathname);s(v,{state:{...c.state,pathnameStackToGoBack:fe,[Jo]:!0}})}else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[w,t,c,s,S,k,ye,Kt]);return d.jsxs(d.Fragment,{children:[_n==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>{v.trackPageLoaded(N.Event.dashboard),nt&&$t===!0&&v.trackTreasuryPromoView("Dashboard Promo Video")}}):null,d.jsx(Ks,{maxColumns:n?2:void 0,isAiCfoAccessEnabled:E,onAskAiCfoClick:A,onAiCfoDashboardOpenPanel:xn,onAiCfoDashboardOpenScopePage:wn,isAiCfoFileUploadEnabled:Qa===!0&&t===!1,onAiCfoDashboardPromptSubmit:Tn,onAiCfoDashboardExpandToFullPage:Dn,aiCfoDashboardSuggestedPromptQuestions:vn,aiCfoDashboardSuggestedPromptQuestionsLoading:An,onDragAndDropCard:(v,q)=>{if(v===X||q===X)return;const fe=function(Q,ve,Ie){const ct=Ie.indexOf(Q),lt=Ie.indexOf(ve);if(ct===-1||lt===-1||ct===lt)return Ie;const dt=[...Ie];return dt.splice(ct,1),dt.splice(lt,0,Q),dt}(v,q,Sn),Ae=fe.filter(Q=>Q!==X),Y=he.cardsOrdered;(Ae.length!==Y.length||Ae.some((Q,ve)=>Q!==Y[ve]))&&i(yo(Ae))},dashboardReport:he,passedCardsOrdered:yn,tenantId:y,companyId:I,tenantEmailDomain:S,location:c,navigate:s,isApAgingFeatureEnabled:L,isArAgingFeatureEnabled:oe,isBillPayEnabled:on,isReimbursementEnabled:nn,isSummaryCardsFiltered:at,isForecastOn:bn,selectedForecastOnDashboard:Cn,isVisitingFirstTime:u,isZeniAccountEnabled:Pe,isRewardsFeatureEnabled:Ze,hasZeniAccountsAdminAccess:cn,isExpenseAutomationEnabledForUser:me&&st===!1,selectedPeriod:an[y],isChargeCardFeatureEnabled:qa,isUserHasCardsAccess:mn,isUserHasTreasuryAccess:pn,cardsCreditLimit:hn,cashbackRate:Ja,isInterestedInChargeCard:fn,cardBalanceFetchState:kn,christmasAnimationEnabled:Ha,newYearAnimationEnabled:Wa,treasuryFundDetails:gn,shouldShowTreasuryPromoIntroVideo:$t,isTreasuryPromoVideoPlayed:rt,isTreasuryPromoIntroClosedByOutsideClick:In,treasuryFetchState:sn,aiAuditScorePercentageEnabled:Xa})]})}const qs=e=>{switch(e){case"operating_expenses":return"Operating Expenses";case"revenue":return"Revenues";case"top_expenses":return"Top Expenses";case"net_burn_or_income":return"Burn Rate";case"cash_in_cash_out":return"Cash In, Cash Out";case"cash_position":return"Cash Position"}return"Dashboard"},Qs=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map(a=>a.fetchState).reduce((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t);function vr(){const e=_e(),a=e?.excludedResources?.find(m=>m.resource==="/reports/top_expenses")==null,{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(B.isArAgingFeatureEnabled),r=_(m=>U(m)),{isFeatureEnabled:s}=t(B.isDebitCardFeatureEnabled),i=Bo(s,r),c=jo(r);return i===!0||c===!0?d.jsx(Ct,{children:d.jsx(P,{path:"/*",element:d.jsx(os,{})})}):d.jsxs(Ct,{children:[d.jsx(P,{path:"/",element:d.jsx(Zs,{})}),d.jsx(P,{path:"cash_balance/*",element:d.jsx(Xt,{})}),d.jsx(P,{path:"card_balance/*",element:d.jsx(Xt,{})}),d.jsx(P,{path:"operating_expenses/*",element:d.jsx(re,{})}),d.jsx(P,{path:"operating_expenses/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"revenue/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"revenue/*",element:d.jsx(re,{})}),d.jsx(P,{path:"net_burn_or_income/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"net_burn_or_income/*",element:d.jsx(re,{})}),n===!0&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_payable_aging/*",element:d.jsx(is,{})}),d.jsx(P,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(rs,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(cs,{})}),d.jsx(P,{path:"accounts_receivable_aging/*",element:d.jsx(ls,{})})]}),d.jsx(P,{path:"cash_position/*",element:d.jsx(re,{})}),d.jsx(P,{path:"top_expenses/*",element:a===!0?d.jsx(re,{}):d.jsx(Me,{})}),d.jsx(P,{path:"cash_in_cash_out/*",element:d.jsx(re,{})}),d.jsx(P,{path:"company_details",element:d.jsx(as,{})}),d.jsx(P,{path:"referrals/*",element:d.jsx(ss,{})}),d.jsx(P,{path:"*",element:d.jsx(Me,{})})]})}export{vr as default};
20
+ `,Te=3,Rt=1;function Ms({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=W(),r=H(),{tenantEmailDomain:s}=K();let i;Ve({isDataReady:!0});const c={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(xs,{...c});break;case"revenue":i=d.jsx(Ps,{...c});break;case"net_burn_or_income":i=d.jsx(Es,{...c});break;case"cash_position":i=d.jsx(vs,{...c});break;case"top_expenses":i=d.jsx(Bs,{...c});break;case"cash_in_cash_out":i=d.jsx(ks,{...c});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(js,{children:i}):null}function re(){const e=H(),a=z(),{forecastId:t}=K();let n="Not-Started";const o=k(l=>xt(l).fetchState),r=k(l=>Dt(l).fetchState),s=k(l=>At(l).fetchState),i=k(l=>l.cashPositionState.fetchState),c=k(l=>l.topExState.fetchState),m=k(l=>l.cashInCashOutState.fetchState);if(M.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const g=k(l=>L(l)),C=g?.company?.companyInfo?.firstMonthOfFY??1,u=la((l=>{const h=da(l,"/").split("/");return t!=null?h[h.length-3]:h[h.length-1]})(e.pathname));switch(u){case"operating_expenses":n=o;break;case"revenue":n=r;break;case"net_burn_or_income":n=s;break;case"cash_position":n=i;break;case"top_expenses":n=c;break;case"cash_in_cash_out":n=m;break;default:console.error(`${u} is not supported!`)}return b.useEffect(()=>{n==="Not-Started"&&function(l,h,p,f){switch(h){case"operating_expenses":l(Da(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(ka(!1,f)));break;case"revenue":l(xa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(va(!1,f)));break;case"net_burn_or_income":l(wa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(Ca(!1,f)));break;case"cash_position":l(Ta(!0));break;case"top_expenses":l(Ea());break;case"cash_in_cash_out":l(Ia());break;default:throw new Error(`report type ${h} is not yet supported`)}}(a,u,C,t)},[t]),d.jsxs(d.Fragment,{children:[n==="Completed"?d.jsx(Ye,{analytics:T,onLoad:l=>((h,p)=>{const f=e.state?.referrer;switch(p){case"operating_expenses":h.trackPageLoaded(N.Event.operatingExpenses,f);break;case"revenue":h.trackPageLoaded(N.Event.revenues,f);break;case"net_burn_or_income":h.trackPageLoaded(N.Event.burnRate,f);break;case"cash_position":h.trackPageLoaded(N.Event.cashPosition,f);break;case"top_expenses":h.trackPageLoaded(N.Event.topExpenses,f);break;case"cash_in_cash_out":h.trackPageLoaded(N.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${p}!`)}})(l,u)}):null,d.jsx(Ms,{firstMonthOfFY:C,fetchState:n,reportId:u,forecastId:t})]})}var pt=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function ht(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),function(){t(window.event)})}function za(e,a){for(var t=a.slice(0,a.length-1),n=0;n<t.length;n++)t[n]=e[t[n].toLowerCase()];return t}function Ka(e){typeof e!="string"&&(e="");for(var a=(e=e.replace(/\s/g,"")).split(","),t=a.lastIndexOf("");t>=0;)a[t-1]+=",",a.splice(t,1),t=a.lastIndexOf("");return a}for(var Bt={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":pt?173:189,"=":pt?61:187,";":pt?59:186,"'":222,"[":219,"]":221,"\\":220},ie={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},yt={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},j={16:!1,18:!1,17:!1,91:!1},R={},He=1;He<20;He++)Bt["f".concat(He)]=111+He;var O=[],Xt=!1,Za="all",ea=[],tt=function(e){return Bt[e.toLowerCase()]||ie[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function ta(e){Za=e||"all"}function je(){return Za||"all"}var ft=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;Ka(a).forEach(function(s){var i=s.split(r),c=i.length,m=i[c-1],g=m==="*"?"*":tt(m);if(R[g]){t||(t=je());var C=c>1?za(ie,i):[];R[g]=R[g].filter(function(u){return!((!n||u.method===n)&&u.scope===t&&function(l,h){for(var p=l.length>=h.length?l:h,f=l.length>=h.length?h:l,S=!0,E=0;E<p.length;E++)f.indexOf(p[E])===-1&&(S=!1);return S}(u.mods,C))})}})};function aa(e,a,t,n){var o;if(a.element===n&&(a.scope===t||a.scope==="all")){for(var r in o=a.mods.length>0,j)Object.prototype.hasOwnProperty.call(j,r)&&(!j[r]&&a.mods.indexOf(+r)>-1||j[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||j[16]||j[18]||j[17]||j[91])&&!o&&a.shortcut!=="*"||a.method(e,a)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function na(e,a){var t=R["*"],n=e.keyCode||e.which||e.charCode;if(G.filter.call(this,e)){if(n!==93&&n!==224||(n=91),O.indexOf(n)===-1&&n!==229&&O.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(h){var p=yt[h];e[h]&&O.indexOf(p)===-1?O.push(p):!e[h]&&O.indexOf(p)>-1?O.splice(O.indexOf(p),1):h==="metaKey"&&e[h]&&O.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(O=O.slice(O.indexOf(p))))}),n in j){for(var o in j[n]=!0,ie)ie[o]===n&&(G[o]=!0);if(!t)return}for(var r in j)Object.prototype.hasOwnProperty.call(j,r)&&(j[r]=e[yt[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(O.indexOf(17)===-1&&O.push(17),O.indexOf(18)===-1&&O.push(18),j[17]=!0,j[18]=!0);var s=je();if(t)for(var i=0;i<t.length;i++)t[i].scope===s&&(e.type==="keydown"&&t[i].keydown||e.type==="keyup"&&t[i].keyup)&&aa(e,t[i],s,a);if(n in R){for(var c=0;c<R[n].length;c++)if((e.type==="keydown"&&R[n][c].keydown||e.type==="keyup"&&R[n][c].keyup)&&R[n][c].key){for(var m=R[n][c],g=m.splitKey,C=m.key.split(g),u=[],l=0;l<C.length;l++)u.push(tt(C[l]));u.sort().join("")===O.sort().join("")&&aa(e,m,s,a)}}}}function G(e,a,t){O=[];var n=Ka(e),o=[],r="all",s=document,i=0,c=!1,m=!0,g="+",C=!1;for(t===void 0&&typeof a=="function"&&(t=a),Object.prototype.toString.call(a)==="[object Object]"&&(a.scope&&(r=a.scope),a.element&&(s=a.element),a.keyup&&(c=a.keyup),a.keydown!==void 0&&(m=a.keydown),a.capture!==void 0&&(C=a.capture),typeof a.splitKey=="string"&&(g=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(g)).length>1&&(o=za(ie,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in R||(R[e]=[]),R[e].push({keyup:c,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:g,element:s});s!==void 0&&!function(u){return ea.indexOf(u)>-1}(s)&&window&&(ea.push(s),ht(s,"keydown",function(u){na(u,s)},C),Xt||(Xt=!0,ht(window,"focus",function(){O=[]},C)),ht(s,"keyup",function(u){na(u,s),function(l){var h=l.keyCode||l.which||l.charCode,p=O.indexOf(h);if(p>=0&&O.splice(p,1),l.key&&l.key.toLowerCase()==="meta"&&O.splice(0,O.length),h!==93&&h!==224||(h=91),h in j)for(var f in j[h]=!1,ie)ie[f]===h&&(G[f]=!1)}(u)},C))}var gt={setScope:ta,getScope:je,deleteScope:function(e,a){var t,n;for(var o in e||(e=je()),R)if(Object.prototype.hasOwnProperty.call(R,o))for(t=R[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;je()===e&&ta(a||"all")},getPressedKeyCodes:function(){return O.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=tt(e)),O.indexOf(e)!==-1},filter:function(e){var a=e.target||e.srcElement,t=a.tagName,n=!0;return!a.isContentEditable&&(t!=="INPUT"&&t!=="TEXTAREA"&&t!=="SELECT"||a.readOnly)||(n=!1),n},trigger:function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(R).forEach(function(t){var n=R[t].find(function(o){return o.scope===a&&o.shortcut===e});n&&n.method&&n.method()})},unbind:function(e){if(e===void 0)Object.keys(R).forEach(function(s){return delete R[s]});else if(Array.isArray(e))e.forEach(function(s){s.key&&ft(s)});else if(typeof e=="object")e.key&&ft(e);else if(typeof e=="string"){for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];var o=t[0],r=t[1];typeof o=="function"&&(r=o,o=""),ft({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Bt,modifier:ie,modifierMap:yt};for(var bt in gt)Object.prototype.hasOwnProperty.call(gt,bt)&&(G[bt]=gt[bt]);if(typeof window<"u"){var Us=window.hotkeys;G.noConflict=function(e){return e&&window.hotkeys===G&&(window.hotkeys=Us),G},window.hotkeys=G}G.filter=function(){return!0};var oa=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Ls(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,c=o.keydown,m=o.filterPreventDefault,g=m===void 0||m,C=o.enabled,u=C===void 0||C,l=o.enableOnContentEditable,h=l!==void 0&&l,p=b.useRef(null),f=b.useCallback(function(S,E){var v,_;return s&&!s(S)?!g:!!(oa(S,["INPUT","TEXTAREA","SELECT"])&&!oa(S,r)||(v=S.target)!=null&&v.isContentEditable&&!h)||!!(p.current===null||document.activeElement===p.current||(_=p.current)!=null&&_.contains(document.activeElement))&&(a(S,E),!0)},n?[p,r,s].concat(n):[p,r,s]);return b.useEffect(function(){if(u)return i&&c!==!0&&(t.keydown=!1),G(e,t||{},f),function(){return G.unbind(e,f)};G.unbind(e,f)},[f,e,u]),p}G.isPressed;const Gs=[],sa="dashboard_card",J="ai_cfo_dashboard_card";function ra(e,a){return a?e.some(t=>String(t)===J)?e.slice():[J,...e]:e.filter(t=>String(t)!==J)}const Vs=["net_burn_or_income_story_card","cash_balance","task_card","card_balance","zeni_promo_card","insights_dashboard","information_card","company_details","bill_pay_promo_card","bill_pay_card","reimbursement_card","reimbursement_promo_card","zeni_accounts_promo_card","rewards_card","treasury_promo_card"],Ys=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e.status!=null?{balanceAmount:e.balance?.available,lastUpdatedTime:e.status.lastRefreshSuccessTime,changePercent:e.balance?.change?.percent,changeComparedToDate:e.balance?.change?.since}:void 0}),Be=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),Ns=(e,a,t,n)=>Be(void 0,e,_e,a,t),$s=(e,a,t,n,o)=>({card:{dimension:et(_e),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1,spansFullDashboardWidth:!1},data:{funds:n,shouldShowTreasuryPromoIntroVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),zs=e=>{const a=et(_e);return a.height=_e.height+10,{card:{dimension:a,cardType:J,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ks=ee(function(e,a){const t=Qs(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:c,shouldShowTreasuryPromoIntroVideo:m,treasuryFetchState:g}=a;let C=n.map((u,l)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return Ns(t,u,l);if(u==="zeni_promo_card")return Be({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,_e,u,l);if(u==="treasury_promo_card")return $s(g,u,l,c,m);if(u==="information_card")return Be(void 0,"Completed",_e,u,l);if(u===J)return zs(l);{const h=o.find(p=>p?.reportId===u);return h?function(p,f,S,E){const v=p.reportId;switch(v){case"card_balance":case"cash_balance":return[Ys(p,f,S,v,E)];case"expense_automation_card":case"operating_expenses":case"revenue":case"top_expenses":case"cash_position":case"cash_in_cash_out":case"insights_dashboard":case"company_details":case"task_card":case"bill_pay_card":case"reimbursement_card":case"net_burn_or_income":case"accounts_payable_aging":case"accounts_receivable_aging":case"zeni_accounts_promo_card":case"rewards_card":return[Be(p,f,S,v,E)];case"net_burn_or_income_story_card":return[Be(p,f,S,"net_burn_or_income_story_card",E)];default:return console.error(`card type ${v} not yet supported!`),[]}}(h,h.fetchState,_e,l):[]}}).flat();return a.isSummaryCardsFiltered===!0&&(C=C.filter(u=>Vs.includes(u.card.cardType)==0).filter(u=>{const l=u.data?.availableNumberOfPeriods;return l!=null?l>0:u.card.cardType!="top_expenses"||u.data==null||function(h){if(h==null||h.length===0)return!0;let p=!0;for(const f of h)if(f.balance.available.amount!==0){p=!1;break}return p}(u.data.topExpenses.accountsOrdered)===!1})),{cardDataArray:C,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ce(e,"navbar")},analytics:T,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}},function(e,a){const t=a.tenantId,n=M.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)T.trackDashboardCardClicked("cards promo",2),T.trackZeniCardsPromoCardClicked(a.isChargeCardFeatureEnabled,i,2,`${n?.firstName??""} ${n?.lastName??""}`,a.isChargeCardFeatureEnabled?a.cardsCreditLimit:void 0),i==="Learn More"?window.open("https://www.zeni.ai/product/business-credit-card","_blank"):a.navigate("../cards/promo",{relative:"path"});else if(a.isForecastOn)switch(r){case"net_burn_or_income":case"operating_expenses":case"revenue":a.navigate(`${r}/forecast/${a.selectedForecastOnDashboard}`,{state:{referrer:s}});break;default:a.navigate(`${r}`,{state:{referrer:s}})}else r==="rewards_card"?(n!=null&&T.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(T.trackMonthEndCloseClicked(a.selectedPeriod.month,a.selectedPeriod.year,"Dashboard"),a.navigate("../../month_end_close_checks/review",{state:{referrer:"Dashboard"}})):a.navigate(`${r}`,{state:{referrer:s}})},onReloadData:(o,r)=>{const s=[];a.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),a.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),a.isZeniAccountEnabled===!1&&s.push("zeni_accounts_promo_card"),a.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),function(i,c,m,g){if(c!==J)switch(c){case"card_balance":i(pa());break;case"cash_balance":i(ua());break;case"operating_expenses":i(Da(!0));break;case"revenue":i(xa(!0));break;case"net_burn_or_income":i(wa(!0));break;case"net_burn_or_income_story_card":i(Ro(!0));break;case"cash_position":i(Ta(!0));break;case"top_expenses":i(Ea());break;case"cash_in_cash_out":i(Ia());break;case"insights_dashboard":i(Fo());break;case"bill_pay_card":i(Po());break;case"reimbursement_card":i(Oo());break;case"company_details":i(Do(m));break;case"task_card":i(xo());break;case"accounts_payable_aging":g.includes("accounts_payable_aging")===!1&&i(_t(we()));break;case"accounts_receivable_aging":i(kt(we()));break;case"zeni_accounts_promo_card":g.includes("zeni_accounts_promo_card")===!1&&i(ma());break;case"rewards_card":g.includes("rewards_card")===!1&&i(wo(!0));break;default:throw new Error(`report type ${c} is not yet supported`)}}(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{T.trackTimeframeSwitch(Ya(r),qs(o),"Dashboard"),function(s,i,c){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(xe(c));break;case"top_expenses":s(Aa(c));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}}(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(To(o))},onCategoryClick:(o,r,s)=>{o==="bill-pay"?a.navigate("../bills",{state:{tab:r,subTab:s},relative:"path"}):o==="reimbursement"?a.navigate("../reimbursements",{state:{tab:r,subTab:s},relative:"path"}):o==="uncategorized-account-mapping"?a.navigate("../settings/accounting",{relative:"path"}):o==="show-all-tasks"?a.navigate("../tasks",{relative:"path"}):a.navigate(`../../transactions/${o}`)},onCardBtnClick:(o,r)=>{if(o==="bill_pay_promo_card"){const s="../bills",i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else if(o==="reimbursement_promo_card"){const s="../reimbursements",i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else if(o==="zeni_accounts_promo_card")if(a.hasZeniAccountsAdminAccess){let s="../checking/promo";r!=null&&(s=`../checking/${r}`);const i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/business-checking-accounts","_blank");else if(o==="treasury_promo_card")if(a.isUserHasTreasuryAccess){M.saveTreasuryPopupSeen(a.tenantEmailDomain,!0);const s="../treasury",i=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/treasury","_blank")},onSaveClick:(o,r,s)=>{o==="net_burn_or_income_story_card"&&(T.trackUpdateBurnRateCalculatorSettings(r,s,Io(s)),e(Eo(t,r,s)))},onVideoPlay:()=>{e(ut())},onRemindMeLaterClick:()=>{e(Ao())},onDontShowAgainClick:()=>{e(ut())},onIntroOutsideClick:()=>{a.isTreasuryPromoIntroClosedByOutsideClick===!0&&a.isTreasuryPromoVideoPlayed!==!0?e(ut()):e(vo())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(le({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(X("navbar"))},onCancelAutoComplete:()=>{e(X("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ue(o,a.tenantEmailDomain):ts(o.zeniId,o.qboId,a.tenantEmailDomain);const s=x(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}})(es);function Zs(){const e=ia(),a=Ra(),t=La(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=Fa(),s=W(),i=z(),c=H(),m=M.getSignedInUser(),{useFeatureGate:g,useDynamicConfig:C}=Se(),[u,l]=b.useState(!1),[h,p]=b.useState(!1),f=Ba(),{tenantEmailDomain:S}=K(),{isAiCfoAccessEnabled:E,onAskAiCfoClick:v}=ae({mobileExploreReferrer:"Dashboard"}),_=k(A=>A.tenantState.fetchState==="Completed"||A.tenantState.activeTenantFetchState.fetchState==="Completed"?L(A):void 0),w=_??M.getSignedInUserTenant(S),D=_?.masterTOSInfo?.isMasterTOSAccepted??!1,y=w.tenantId,I=w.companyId;b.useEffect(()=>{u===!1&&c.state?.message==="activation"&&(i(go(I)),l(!0))},[c.state,u,I,i]),b.useEffect(()=>{f&&!h&&c.state?.message==="open_ai_cfo_drawer"&&(p(!0),D?(o(!0),s({pathname:c.pathname,search:c.search,hash:c.hash},{replace:!0,state:{...c.state,message:void 0}})):se({location:c,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))},[c,h,f,D,o,s]);const{isFeatureEnabled:U}=g(B.isApAgingFeatureEnabled),{isFeatureEnabled:ne}=g(B.isExpenseAutomationEnabled),{isFeatureEnabled:ze}=g(B.isExpenseAutomationEnabledV2),me=Zo(),{isFeatureEnabled:Ke}=g(B.isTreasuryEnabled),F=qo(me),{isFeatureEnabled:oe}=g(B.isArAgingFeatureEnabled),{isFeatureEnabled:Pe}=g(B.isDepositAccountsFeatureEnabled),{isFeatureEnabled:Ze}=g(B.isReferralFeatureEnabled),{isFeatureEnabled:qa}=g(B.isChargeCardFeatureEnabled),{isFeatureEnabled:Qa}=g(B.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ha}=g(B.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Wa}=g(B.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Ja}=g(B.aiAuditScorePercentage),{configValue:jt}=C(ja.zeniCardsConfig),Xa=jt.charge_card_cashback_rate_per_transaction==null?.0175:jt.charge_card_cashback_rate_per_transaction;if(c.state?.message==="activation"){const A=Qo(c.state?.pathnameStackToGoBack);s(c.pathname,{state:{...c.state,message:void 0,pathnameStackToGoBack:A.newStack}})}const[Mt,en]=b.useState(!1),[at,tn]=b.useState(!1);Ls("command+p, Control+p",A=>{tn(!at),A.preventDefault()},{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const Ut=_?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const pe=k(A=>L(A)?.excludedResources),an=k(A=>A.expenseAutomationViewState.selectedPeriodByTenantId),nn=!!_?.companyReimbursementInfo?.info?.isReimbursementEnabled,on=!!_?.companyBillPayInfo?.info?.isBillPayEnabled,sn=k(A=>A.treasurySetupViewState.treasuryFundsDetails).fetchStatus.fetchState,rn=_?.company!=null&&bo(_.company),nt=Ke&&rn,ot=ke(),cn=vt(ot?.loggedInUserRoleMap),V=[],Lt=pe?.resources?.find(A=>A.resource==="/reports/top_expenses")==null,ln=pe?.resources?.find(A=>A.resource==="/reports/task_card")==null,st=_?.userRole!=null&&Sa(_?.userRole),dn=pe?.resources?.find(A=>A.resource==="/bills")==null&&!st,un=pe?.resources?.find(A=>A.resource==="/reimbursements")==null,mn=Co(ot?.loggedInUserRoleMap),pn=_o(ot?.loggedInUserRoleMap),hn=_?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,fn=_?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,gn=k(A=>A.treasurySetupViewState.treasuryFundsDetails).fundsDetails;Lt===!1&&V.push("top_expenses"),ln===!1&&V.push("task_card"),dn===!1&&V.push("bill_pay_card","bill_pay_promo_card"),U===!1&&V.push("accounts_payable_aging"),oe===!1&&V.push("accounts_receivable_aging"),(me===!1||st)&&V.push("expense_automation_card"),un===!1&&V.push("reimbursement_card","reimbursement_promo_card"),Pe===!1&&V.push("zeni_accounts_promo_card"),Ze===!1&&V.push("rewards_card"),nt===!1&&V.push("treasury_promo_card");const{areTenantIdsInSync:Gt}=Ho();b.useLayoutEffect(()=>{Mt&&F===me||Ut!==!0||!Gt||pe?.fetchState!=="Completed"&&pe?.fetchState!=="Error"||(en(!0),i(ko(m.userId,I,y,!0,!1,V)))},[Mt,m,y,i,Lt,Ut,pe?.fetchState,Gt]);const bn=k(A=>A.reportUIOptionsState.forecastOnDashboard.isForecastModeOn),Cn=k(A=>A.revenueState.uiState.selectedForecast?.id),_n=k(A=>A.cardBalanceState.fetchState),he=k(A=>So(A,V,m,ze,ne,nt)),kn=he.fetchState,Sn=b.useMemo(()=>ra(he.cardsOrdered,E),[he.cardsOrdered,E]),yn=b.useMemo(()=>ra(he.cardsForDashboardUI,E),[he.cardsForDashboardUI,E]);Ve({isDataReady:!0});const{isSuggestedQuestionsLoading:vn,suggestedPromptQuestions:An}=ns(),rt=_?.isTreasuryPromoVideoPlayed===!0,Vt=_?.isTreasuryPromoVideoRemindMeLaterClicked===!0,Yt=_?.loginCounterForTreasuryPromoVideo??0,In=_?.isTreasuryPromoIntroClosedByOutsideClick===!0,Nt=k(A=>A.dashboardState.isTreasuryVideoClosed),$t=b.useMemo(()=>Wo({isTreasuryPromoVideoRemindMeLaterClicked:Vt,isTreasuryPromoVideoPlayed:rt,loginCounterForTreasuryPromoVideo:Yt,isTreasuryVideoClosed:Nt}),[Vt,rt,Yt,Nt]),zt=k(A=>ha(A)),ye=zt.uiState?.currentChatSessionId,it=zt.allSessionsWithOrderedQuestionAnswers??Gs,{currentSessionQuestionAnswers:En}=Jo(it,ye),Kt=En.length===0,Tn=b.useCallback((A,q,fe)=>{const ve=m?.userId;if(ve==null)return;const Y=A.trim();if(Y.length===0&&q.length===0)return;if(!D)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});const Q=Ma(e.getState()),Ae=()=>{const Ie=x(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ie,referrer:"Dashboard",aiCfoInitialQuestion:Y,aiCfoShouldSubmit:!Q&&Y.length>0,aiCfoInitialSubmissionSource:sa,...typeof fe=="number"?{aiCfoSuggestionIndex:fe}:{}}})};return t?q.length>0?void o(!0):void Ae():q.length>0?Q?(i(St(Y)),void o(!0)):(r(Y.length>0?Y:null),o(!0),void(Y.length>0&&Ua(i,Y,sa,ye,it,ve,fe,q.length>0?q:void 0))):(Q&&i(St(Y)),void Ae())},[it,ye,i,D,t,c,s,r,o,m?.userId,e,S]),wn=b.useCallback(()=>{D?o(!0):se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[D,c,s,o]),xn=b.useCallback(()=>{if(!D)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});if(S==null)return;const A=x(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{pathnameStackToGoBack:A,referrer:"Dashboard"}})},[D,c,s,S]),Dn=b.useCallback(()=>{if(D)if(t){if(S==null||_==null)return;const A=ye==null||Kt?`/${S}/ai-cfo/explore`:`/${S}/ai-cfo/${ye}`,q=c.state?.pathnameStackToGoBack??[],fe=x(q,c.pathname);s(A,{state:{...c.state,pathnameStackToGoBack:fe,[Xo]:!0}})}else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[D,t,c,s,S,_,ye,Kt]);return d.jsxs(d.Fragment,{children:[kn==="Completed"?d.jsx(Ye,{analytics:T,onLoad:A=>{A.trackPageLoaded(N.Event.dashboard),nt&&$t===!0&&A.trackTreasuryPromoView("Dashboard Promo Video")}}):null,d.jsx(Ks,{maxColumns:n?2:void 0,isAiCfoAccessEnabled:E,onAskAiCfoClick:v,onAiCfoDashboardOpenPanel:wn,onAiCfoDashboardOpenScopePage:Dn,isAiCfoFileUploadEnabled:Qa===!0&&t===!1,onAiCfoDashboardPromptSubmit:Tn,onAiCfoDashboardExpandToFullPage:xn,aiCfoDashboardSuggestedPromptQuestions:An,aiCfoDashboardSuggestedPromptQuestionsLoading:vn,onDragAndDropCard:(A,q)=>{if(A===J||q===J)return;const fe=function(Q,Ae,Ie){const ct=Ie.indexOf(Q),lt=Ie.indexOf(Ae);if(ct===-1||lt===-1||ct===lt)return Ie;const dt=[...Ie];return dt.splice(ct,1),dt.splice(lt,0,Q),dt}(A,q,Sn),ve=fe.filter(Q=>Q!==J),Y=he.cardsOrdered;(ve.length!==Y.length||ve.some((Q,Ae)=>Q!==Y[Ae]))&&i(yo(ve))},dashboardReport:he,passedCardsOrdered:yn,tenantId:y,companyId:I,tenantEmailDomain:S,location:c,navigate:s,isApAgingFeatureEnabled:U,isArAgingFeatureEnabled:oe,isBillPayEnabled:on,isReimbursementEnabled:nn,isSummaryCardsFiltered:at,isForecastOn:bn,selectedForecastOnDashboard:Cn,isVisitingFirstTime:u,isZeniAccountEnabled:Pe,isRewardsFeatureEnabled:Ze,hasZeniAccountsAdminAccess:cn,isExpenseAutomationEnabledForUser:me&&st===!1,selectedPeriod:an[y],isChargeCardFeatureEnabled:qa,isUserHasCardsAccess:mn,isUserHasTreasuryAccess:pn,cardsCreditLimit:hn,cashbackRate:Xa,isInterestedInChargeCard:fn,cardBalanceFetchState:_n,christmasAnimationEnabled:Ha,newYearAnimationEnabled:Wa,treasuryFundDetails:gn,shouldShowTreasuryPromoIntroVideo:$t,isTreasuryPromoVideoPlayed:rt,isTreasuryPromoIntroClosedByOutsideClick:In,treasuryFetchState:sn,aiAuditScorePercentageEnabled:Ja})]})}const qs=e=>{switch(e){case"operating_expenses":return"Operating Expenses";case"revenue":return"Revenues";case"top_expenses":return"Top Expenses";case"net_burn_or_income":return"Burn Rate";case"cash_in_cash_out":return"Cash In, Cash Out";case"cash_position":return"Cash Position"}return"Dashboard"},Qs=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map(a=>a.fetchState).reduce((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t);function Ar(){const e=ke(),a=e?.excludedResources?.find(m=>m.resource==="/reports/top_expenses")==null,{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(B.isArAgingFeatureEnabled),r=k(m=>L(m)),{isFeatureEnabled:s}=t(B.isDebitCardFeatureEnabled),i=Bo(s,r),c=jo(r);return i===!0||c===!0?d.jsx(Ct,{children:d.jsx(P,{path:"/*",element:d.jsx(os,{})})}):d.jsxs(Ct,{children:[d.jsx(P,{path:"/",element:d.jsx(Zs,{})}),d.jsx(P,{path:"cash_balance/*",element:d.jsx(Jt,{})}),d.jsx(P,{path:"card_balance/*",element:d.jsx(Jt,{})}),d.jsx(P,{path:"operating_expenses/*",element:d.jsx(re,{})}),d.jsx(P,{path:"operating_expenses/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"revenue/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"revenue/*",element:d.jsx(re,{})}),d.jsx(P,{path:"net_burn_or_income/forecast/*",element:d.jsx(mt,{})}),d.jsx(P,{path:"net_burn_or_income/*",element:d.jsx(re,{})}),n===!0&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_payable_aging/*",element:d.jsx(is,{})}),d.jsx(P,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(rs,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(cs,{})}),d.jsx(P,{path:"accounts_receivable_aging/*",element:d.jsx(ls,{})})]}),d.jsx(P,{path:"cash_position/*",element:d.jsx(re,{})}),d.jsx(P,{path:"top_expenses/*",element:a===!0?d.jsx(re,{}):d.jsx(Me,{})}),d.jsx(P,{path:"cash_in_cash_out/*",element:d.jsx(re,{})}),d.jsx(P,{path:"company_details",element:d.jsx(as,{})}),d.jsx(P,{path:"referrals/*",element:d.jsx(ss,{})}),d.jsx(P,{path:"*",element:d.jsx(Me,{})})]})}export{Ar as default};
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-evjZPqs_.js";import{a as u}from"./sentry-CCZGmBkl.js";import{u as y,j as b,n as w,g as A,N as L}from"./core-DmAftQ4g.js";import{LR as N,eW as _,f$ as R,LS as U,o7 as k,LT as z}from"./zeni-epic-state-vtQ66nN6.js";import{u as O,z as f,L as T,t as I,O as $,b as j}from"./index-BsmcHa9A.js";import"./mui-PcDpEhsm.js";import{t as P}from"./getLocaleForTenant-DBZLLRpQ.js";import"./recharts-CgEqsrFw.js";import"./analytics-DCrhd8oB.js";import"./plaid-DSnXUEUK.js";import"./dnd-3F1D24DQ.js";import"./stripe-DMRn4zHo.js";import"./lottie-CmTLY-9t.js";import"./lexical-PVlNGkpS.js";import"./pdf-CbXlPYUs.js";import"./utils--mWNe9J7.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]="3b50d821-589c-4a01-b747-dcaf08ff4190",t._sentryDebugIdIdentifier="sentry-dbid-3b50d821-589c-4a01-b747-dcaf08ff4190")}catch{}})();const Q=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 C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="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=j(c,p);return v.jsx(L,{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}=O(),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(T.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(T.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(k(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||($.updateAppLocaleID(P(c)),o())},[n,a,c]),v.jsx(Q,{})}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"],G={"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 G[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-DC3GaKoW.js";import{a as u}from"./sentry-CuaXjR5n.js";import{u as y,j as b,n as w,g as A,N as L}from"./core-Bv1T7LZC.js";import{LS as U,eW as _,g1 as N,LT as k,o9 as R,LU as z}from"./zeni-epic-state-DuQa9FMz.js";import{u as j,z as f,L as T,t as I,a as O,b as $}from"./index-CVpYlrKc.js";import"./mui-VYhJrGDQ.js";import{t as P}from"./getLocaleForTenant-DrFh6zlq.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.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]="fa0f7f80-fc77-4f3a-98f7-d72007dc37e2",t._sentryDebugIdIdentifier="sentry-dbid-fa0f7f80-fc77-4f3a-98f7-d72007dc37e2")}catch{}})();const Q=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 C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="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(L,{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=>U(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(T.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(T.TENANT_FETCHING),t(N(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"&&!k(i))&&t(R(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(Q,{})}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"],G={"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 G[s]}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-evjZPqs_.js";import{h as w,g as C,j as h,n as A,i as B}from"./core-DmAftQ4g.js";import{P_ as k,Q5 as W,gf as q,ge as Q,gd as L,js as J,N6 as K,rr as M,eW as V,Pw as D,jq as T,P$ as S,Q8 as j,jo as F,jL as G}from"./zeni-epic-state-vtQ66nN6.js";import{bz as X,Z as N,W as R,z as U,m as Z,p,U as v,B as _,bA as Y,o as z,bB as ee,q as te}from"./index-BsmcHa9A.js";import{n as O}from"./mui-PcDpEhsm.js";import"./sentry-CCZGmBkl.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]="be9600b2-28b7-4949-8a4a-60c9aacc5feb",e._sentryDebugIdIdentifier="sentry-dbid-be9600b2-28b7-4949-8a4a-60c9aacc5feb")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(J(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(K("common")),n!=null&&e(M(n))},onGetOtp:n=>{e(L(n,"BillPayVendor"))},onResendOtp:n=>{e(Q(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(q(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(W(n,a,o))}}})(X);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h(r=>k(r,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=O.div`
1
+ import{j as l}from"./liveblocks-DC3GaKoW.js";import{h as w,g as C,j as h,n as A,i as B}from"./core-Bv1T7LZC.js";import{P$ as k,Q6 as W,gh as _,gg as q,gf as J,ju as K,N7 as L,rt as M,eW as V,Px as D,js as T,Q0 as S,Q9 as j,jq as F,jN as G}from"./zeni-epic-state-DuQa9FMz.js";import{bz as X,Z as N,W as R,z as U,m as Z,p,U as v,B as z,bA as Y,o as O,bB as ee,n as te}from"./index-CVpYlrKc.js";import{n as H}from"./mui-VYhJrGDQ.js";import"./sentry-CuaXjR5n.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]="e174b935-e2aa-4cc0-afaf-bd2e1ca31032",e._sentryDebugIdIdentifier="sentry-dbid-e174b935-e2aa-4cc0-afaf-bd2e1ca31032")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(K(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(L("common")),n!=null&&e(M(n))},onGetOtp:n=>{e(J(n,"BillPayVendor"))},onResendOtp:n=>{e(q(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(_(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(W(n,a,o))}}})(X);function Q({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h(r=>k(r,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=H.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -6,7 +6,7 @@ import{j as l}from"./liveblocks-evjZPqs_.js";import{h as w,g as C,j as h,n as A,
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,oe=A(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(G(s))},onSaveHandler:s=>{e(F(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),r=s.poppedPathname??P();n(r,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(j({data:r}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),r=s.poppedPathname??P(0);t.navigate(r,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}})(Y);function me({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:r}=B(),d=e??s,{useFeatureGate:c}=R(),i=U.getSignedInUser(),b=h(u=>V(u)),g=Z(),x=p(a.state?.pathnameStackToGoBack),m=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),f=h(u=>k(u,d)),{isFeatureEnabled:I}=c(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=c(v.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return m==="billDetail"&&f.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(_,{fetchState:f.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:r}),l.jsx(oe,{location:a,navigate:n,billId:r,vendorId:d,currentTenant:b,bankAccountContext:m,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},fe=(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},E=(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 E(e,"ach",t,n)}function ve(e,t,n){return E(e,"domestic",t,n)}function ge(e,t,n){return E(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=O.div`
9
+ `,oe=A(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(G(s))},onSaveHandler:s=>{e(F(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),r=s.poppedPathname??$();n(r,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(j({data:r}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),r=s.poppedPathname??$(0);t.navigate(r,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}})(Y);function fe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:r}=B(),d=e??s,{useFeatureGate:c}=R(),i=U.getSignedInUser(),b=h(u=>V(u)),g=Z(),x=p(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,d)),{isFeatureEnabled:I}=c(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=c(v.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(Q,{vendorId:d,billId:r}),l.jsx(oe,{location:a,navigate:n,billId:r,vendorId:d,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(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},E=(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 E(e,"ach",t,n)}function ve(e,t,n){return E(e,"domestic",t,n)}function ge(e,t,n){return E(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=H.div`
10
10
  display: flex;
11
11
  height: 100vh;
12
12
  width: 100%;
@@ -14,5 +14,5 @@ import{j as l}from"./liveblocks-evjZPqs_.js";import{h as w,g as C,j as h,n as A,
14
14
  flex-direction: column;
15
15
  align-items: center;
16
16
  background-color: ${e=>e.theme.colors.grey4};
17
- box-shadow: ${e=>`0px 2px ${z.sp1} ${e.theme.colors.dropShadowNormal}`};
18
- `,re=A(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:r}=t,{tenantEmailDomain:d}=r;return{onFetchBankName:c=>{e(G(c))},onSaveHandler:c=>{e(F(t.bankAccountContext,c,"us-domestic",s))},onWireDetailsUpdated:c=>{const{bankAccountSection:i}=c;e(j({data:i}))},onCancel:()=>{(()=>{const c=p(o.state?.pathnameStackToGoBack),i=c.poppedPathname??$();a(i,{state:{pathnameStackToGoBack:c.newStack}})})(),e(S())},onAddressClick:c=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const i=se(d,c,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const c=p(t.location.state?.pathnameStackToGoBack),i=c.poppedPathname??$(0);t.navigate(i,{state:{pathnameStackToGoBack:c.newStack}})}e(S())}}})(ee);function xe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:r}=B(),d=e??s,c=U.getSignedInUser(),{useFeatureGate:i}=R(),b=Z(),g=h(u=>V(u)),x=p(a.state?.pathnameStackToGoBack),m=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),f=h(u=>k(u,d)),{isFeatureEnabled:I}=i(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=i(v.isDepositAccountsFeatureEnabled);if(c==null)throw Error("Can't access address page without signing in...");return m==="billDetail"&&f.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(_,{fetchState:f.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${z.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(ce,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:r}),l.jsx(re,{location:a,navigate:n,billId:r,vendorId:d,currentTenant:g,bankAccountContext:m,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{me as A,xe as D,H as V,fe as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
17
+ box-shadow: ${e=>`0px 2px ${O.sp1} ${e.theme.colors.dropShadowNormal}`};
18
+ `,re=A(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:r}=t,{tenantEmailDomain:d}=r;return{onFetchBankName:c=>{e(G(c))},onSaveHandler:c=>{e(F(t.bankAccountContext,c,"us-domestic",s))},onWireDetailsUpdated:c=>{const{bankAccountSection:i}=c;e(j({data:i}))},onCancel:()=>{(()=>{const c=p(o.state?.pathnameStackToGoBack),i=c.poppedPathname??P();a(i,{state:{pathnameStackToGoBack:c.newStack}})})(),e(S())},onAddressClick:c=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const i=se(d,c,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const c=p(t.location.state?.pathnameStackToGoBack),i=c.poppedPathname??P(0);t.navigate(i,{state:{pathnameStackToGoBack:c.newStack}})}e(S())}}})(ee);function xe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:r}=B(),d=e??s,c=U.getSignedInUser(),{useFeatureGate:i}=R(),b=Z(),g=h(u=>V(u)),x=p(a.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,d)),{isFeatureEnabled:I}=i(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=i(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(z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${O.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(ce,{windowSize:o,children:[l.jsx(Q,{vendorId:d,billId:r}),l.jsx(re,{location:a,navigate:n,billId:r,vendorId:d,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{fe as A,xe as D,Q as V,me as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
@@ -0,0 +1 @@
1
+ import{j as i}from"./liveblocks-DC3GaKoW.js";import{Z as c,x as l,m as f}from"./index-CVpYlrKc.js";import{D as p}from"./mui-VYhJrGDQ.js";import"./sentry-CuaXjR5n.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]="e1cd43f2-2e8d-4673-b383-cb53da5e56fc",e._sentryDebugIdIdentifier="sentry-dbid-e1cd43f2-2e8d-4673-b383-cb53da5e56fc")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function m(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:s}=e,n=c(),d=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),a=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${d})`}},slotProps:{backdrop:{style:{backgroundColor:a.colors.black,opacity:.8,cursor:"pointer"}}},onClose:s,children:t})}export{m as D};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-DC3GaKoW.js";import{a as d}from"./sentry-CuaXjR5n.js";import{h as A,u as B,g as G,i as O,j as c,N as q,n as F,o as W,p as _}from"./core-Bv1T7LZC.js";import{Of as z,eW as K,ND as M,lx as R,K8 as I,Ok as V,N6 as Y,kx as $,K9 as S,NI as J,NJ as H,N8 as L,N7 as Q}from"./zeni-epic-state-DuQa9FMz.js";import{aV as U,d as X,p as Z,n as tt}from"./index-CVpYlrKc.js";import"./mui-VYhJrGDQ.js";import{d as k}from"./decodeURIComponentSafe-CgJ-EbJc.js";import{w as et}from"./withTransactionSidePanel-Dy09Dwri.js";import{f as nt,c as at}from"./routePaths-DdjVf9j1.js";import"./recharts-D979ncoh.js";import"./analytics-Bqx0zRxd.js";import"./plaid-BlhDSPsk.js";import"./dnd-CrtLd1r-.js";import"./stripe-DMRn4zHo.js";import"./lottie-BAdftm7g.js";import"./lexical-DtmspfR6.js";import"./pdf-DyfSqkK5.js";import"./utils-DPYDOv00.js";import"./useAskAiCfoHostNavButtonProps-w5iOFbal.js";import"./TransactionDetailScreen-DW8t3EC2.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]="70ecc5e8-4f8b-4e30-9620-4ceff24fcbd3",n._sentryDebugIdIdentifier="sentry-dbid-70ecc5e8-4f8b-4e30-9620-4ceff24fcbd3")}catch{}})();const ot=F(function(n,t){const e=t.entity,o=V(n,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:Y(n,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:$(n)}},function(n,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${at(e,t.tenantEmailDomain)}`,l=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:l}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?n(L({searchString:e,searchOrigin:"common"})):e.trim().length===0&&n(Q("common"))},onAutoCompleteEntity:e=>{const o=nt(e,t.tenantEmailDomain);n(J()),n(H()),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&&n(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};n(I(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),n(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}})(U),it=et(function({entityType:n,...t}){const e=A(),o=B(),l=G(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:w}=O(),r=k(x??""),f=k(w??""),p=rt(r,f),N=[r,f].filter(a=>a!=null),i={name:f,id:r,type:n,zeniId:r,qboId:r},g=c(a=>z(a.customerIncomeState,a.vendorExpenseState,a.trendState,i,"quarter")),j=c(a=>K(a).company?.companyInfo.firstMonthOfFY??1),u=c(a=>M(a.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&p===!0&&(T(!0),o(R(i)))},[m,p,i]);const E=c(a=>a.trendState.fetchState),P=u?.selectedPeriod?.timePeriod??g,v=function(a,y){return a!=null&&y!=null?{startDate:a.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]),p?s.jsx(ot,{firstMonthOfFY:j,tenantEmailDomain:C,location:l,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(q,{to:b(N.length)})}),rt=(n,t)=>t!=null&&t.length>0&&n!=null&&n.length>0,b=(n=2)=>{let t="../";for(let e=0;e<n;e++)t=`${t}../`;return t};function xt({entityType:n}){return s.jsx(W,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:n})})})}export{xt as EntityDetailRoutes,xt as default};