@zeniai/web-app-ui 5.0.62-dev → 5.0.62-next

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 (100) hide show
  1. package/dist/assets/AddressRoutes-B4Dpqy4r.js +1 -0
  2. package/dist/assets/{AddressScreen-BeHKG8v1.js → AddressScreen-CWDdv_BQ.js} +1 -1
  3. package/dist/assets/{AiCfoScreen-BJfPMTeD.js → AiCfoScreen-BFV5_86Q.js} +1 -1
  4. package/dist/assets/{BillPayApprovalRoutes-72raP4Au.js → BillPayApprovalRoutes-SeFOxXYh.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-CEWbGQhV.js → BillPayRoutes-BLwBLBp0.js} +1 -1
  6. package/dist/assets/{BusinessVerificationPageScreen-BUCm7Odf.js → BusinessVerificationPageScreen-d-70pMRn.js} +1 -1
  7. package/dist/assets/{ChargeCardRoutes-CGWte3py.js → ChargeCardRoutes-B1k78Fe6.js} +1 -1
  8. package/dist/assets/{CompanyPassportScreen-BmSdom0e.js → CompanyPassportScreen-HqLnmaxr.js} +1 -1
  9. package/dist/assets/{ConnectionAuthScreen-DF0fkXNR.js → ConnectionAuthScreen-B1CtG73r.js} +1 -1
  10. package/dist/assets/CustomerOnboardingAuthScreen-BuDcM1sR.js +1 -0
  11. package/dist/assets/{CustomerOnboardingRoutes-COxgmIX3.js → CustomerOnboardingRoutes-CKkbOhcz.js} +1 -1
  12. package/dist/assets/{DashboardRoutes-B9AUZ_Md.js → DashboardRoutes-Dd31LEFt.js} +3 -3
  13. package/dist/assets/{DefaultTenantHome-Bce_0IOJ.js → DefaultTenantHome-Dm3LpNEP.js} +1 -1
  14. package/dist/assets/{DomesticWireDetailScreen-BVFVWlSA.js → DomesticWireDetailScreen-gt-Ai-WD.js} +1 -1
  15. package/dist/assets/{DrawerScreen-BWViotCB.js → DrawerScreen-Bgl100Ik.js} +1 -1
  16. package/dist/assets/{EntityDetailRoutes-CKRWkL2F.js → EntityDetailRoutes-B_217KfY.js} +1 -1
  17. package/dist/assets/{ExpenseAutomationRoutes-DDrxLrQX.js → ExpenseAutomationRoutes-CJOAACG8.js} +1 -1
  18. package/dist/assets/{FeaturePreviewScreen-Bu3Nmz6L.js → FeaturePreviewScreen-yO9VvlJP.js} +1 -1
  19. package/dist/assets/{MagicLinkRoutes-Cdzcjinn.js → MagicLinkRoutes-D03iNlp4.js} +1 -1
  20. package/dist/assets/{MagicLinkSignInScreen-XzPOaXDf.js → MagicLinkSignInScreen-D3NmIjhy.js} +1 -1
  21. package/dist/assets/{MobileAppDrawer-BuQb2buy.js → MobileAppDrawer-Cbtsb69z.js} +1 -1
  22. package/dist/assets/NotFoundScreen-DYSe2Mdv.js +1 -0
  23. package/dist/assets/{NotificationRoutes-DQOd5pN1.js → NotificationRoutes-rsg9SBLC.js} +1 -1
  24. package/dist/assets/{PandLWithForecastRoutes-Ch0vhwLL.js → PandLWithForecastRoutes-D3EnIWIV.js} +1 -1
  25. package/dist/assets/{PeopleRoutes-DxzAopRH.js → PeopleRoutes-CvlOSML6.js} +1 -1
  26. package/dist/assets/{PerformanceRoutes-BOLxnqNA.js → PerformanceRoutes-QK2BkwMN.js} +1 -1
  27. package/dist/assets/{Preview-C1kzMAT1.js → Preview-De6lAC_h.js} +1 -1
  28. package/dist/assets/{QBOConnectionScreen-DowWnT4I.js → QBOConnectionScreen-CzRSEfnn.js} +1 -1
  29. package/dist/assets/{ReferralListScreen-Dj04SxiV.js → ReferralListScreen-CrZHp_7-.js} +1 -1
  30. package/dist/assets/{ReimbursementApprovalRoutes-Dce13zkV.js → ReimbursementApprovalRoutes-Bo-7jsNx.js} +1 -1
  31. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CErT0hoJ.js → ReimbursementApprovalRuleDetailScreen-CVmD-yQI.js} +1 -1
  32. package/dist/assets/{ReimbursementRoutes-DbOJcy-l.js → ReimbursementRoutes-BWXSBU7P.js} +1 -1
  33. package/dist/assets/{ReportsRoutes-m8OaVZVD.js → ReportsRoutes-CE5LSgvr.js} +1 -1
  34. package/dist/assets/{RewardsRoutes-Bhpz6tDz.js → RewardsRoutes-B2X_FM68.js} +1 -1
  35. package/dist/assets/{ScreenRoutes-D3nR_ZAq.js → ScreenRoutes-ByR6eqn0.js} +2 -2
  36. package/dist/assets/{SettingsRoutes-DXnpxjv_.js → SettingsRoutes-D3zg4e1O.js} +1 -1
  37. package/dist/assets/{SetupPagesScreen-RaBTeZ3X.js → SetupPagesScreen-D764pnzM.js} +1 -1
  38. package/dist/assets/{SignInScreen-BdxXXdlE.js → SignInScreen-BBcsTGFB.js} +1 -1
  39. package/dist/assets/{SignOutScreen-Bpj0-554.js → SignOutScreen-mjRtJ2Sa.js} +1 -1
  40. package/dist/assets/{TaskListScreen-DucJZ5Tc.js → TaskListScreen-EE-mG0FL.js} +1 -1
  41. package/dist/assets/{TaskRoutes-BauTuLET.js → TaskRoutes-OoZrol6E.js} +1 -1
  42. package/dist/assets/TransactionDetailRoutes-kCwOvSNK.js +1 -0
  43. package/dist/assets/{TransactionDetailScreen-DB2dMdqL.js → TransactionDetailScreen-k-8yhupk.js} +1 -1
  44. package/dist/assets/{TransactionListRoutes-SZ1iphEM.js → TransactionListRoutes-B-msRy9Y.js} +1 -1
  45. package/dist/assets/{TreasuryRoutes-CGEviXlY.js → TreasuryRoutes-BAh2GTgw.js} +1 -1
  46. package/dist/assets/{VendorsRoutes-CIeivuDV.js → VendorsRoutes-SFISxxod.js} +1 -1
  47. package/dist/assets/{WiseConfirmationScreen-C2YdpQUX.js → WiseConfirmationScreen-FsSsJS2Q.js} +1 -1
  48. package/dist/assets/{ZeniAccountRoutes-WZ6oPa1B.js → ZeniAccountRoutes-De_r3X7O.js} +1 -1
  49. package/dist/assets/{ZeniAccountStatementScreen-BcTdJcif.js → ZeniAccountStatementScreen-nOgDprhF.js} +1 -1
  50. package/dist/assets/{accountMappingHelper-Bqj2mJfi.js → accountMappingHelper-DA7klO76.js} +1 -1
  51. package/dist/assets/{analytics-B_uP5uGX.js → analytics-DMHo1eqB.js} +1 -1
  52. package/dist/assets/{analyticsHelper-CsFRydiU.js → analyticsHelper-BojuPNuT.js} +1 -1
  53. package/dist/assets/{core-Cgen4kAj.js → core-BRYqCMzm.js} +1 -1
  54. package/dist/assets/{decodeURIComponentSafe-DztnZ-A4.js → decodeURIComponentSafe-VG11krJk.js} +1 -1
  55. package/dist/assets/{dnd-DhFfs1wM.js → dnd-BUhKHo0J.js} +1 -1
  56. package/dist/assets/{empty-CfLsUtpF.js → empty-CdcoSwLG.js} +1 -1
  57. package/dist/assets/{empty-Dt-07Rye.js → empty-CxwxcwS5.js} +1 -1
  58. package/dist/assets/{emptyVideoElement-v9g3UWiq.js → emptyVideoElement-TKzdCeZg.js} +1 -1
  59. package/dist/assets/{epic-lM2FfDOS.js → epic-B922Znlh.js} +1 -1
  60. package/dist/assets/{getLocaleForTenant-Di1C7dV7.js → getLocaleForTenant-kMn_Tpi1.js} +1 -1
  61. package/dist/assets/{index-nofE1fwv.js → index--_tWBs2I.js} +2 -2
  62. package/dist/assets/{index-C_giOD7z.js → index-1E_YGXm0.js} +1 -1
  63. package/dist/assets/{index-Dwqwe5m-.js → index-CzgC_2M7.js} +1 -1
  64. package/dist/assets/{index-Dprn4SY3.js → index-DBzpg9Hn.js} +1 -1
  65. package/dist/assets/{index-CiK_CtQ4.js → index-DJPHh6NG.js} +1 -1
  66. package/dist/assets/{index-BkCX5jRI.js → index-DVwKDUH5.js} +1 -1
  67. package/dist/assets/{index-trlF__w8.js → index-akX3Nhym.js} +7 -7
  68. package/dist/assets/{lexical-DJV7tysr.js → lexical-8E0BhRCX.js} +1 -1
  69. package/dist/assets/{liveblocks-CF908iAG.js → liveblocks-DytGFyho.js} +1 -1
  70. package/dist/assets/{lottie-Ega9gP0x.js → lottie-DUnNV-G9.js} +1 -1
  71. package/dist/assets/{mui-C7dUqSqV.js → mui-dDGLzwM4.js} +1 -1
  72. package/dist/assets/{pathToGoBack-C7m35zDG.js → pathToGoBack-mVeUADM1.js} +1 -1
  73. package/dist/assets/{pdf-CSmOdS_B.js → pdf-DJGD_VAN.js} +3 -3
  74. package/dist/assets/{pdf-lib-D5gPNITG.js → pdf-lib-GOd1bq4e.js} +1 -1
  75. package/dist/assets/{plaid-CChs9PMx.js → plaid-QQ6p_f2h.js} +1 -1
  76. package/dist/assets/{pusher-C5oHaaZM.js → pusher-C73GgrNh.js} +1 -1
  77. package/dist/assets/{react-CVXgK0Ih.js → react-BNtClE3e.js} +1 -1
  78. package/dist/assets/{react-ClL_vZpV.js → react-BTGNUuDB.js} +1 -1
  79. package/dist/assets/{react-CsMGsa1f.js → react-CSoSU7g9.js} +1 -1
  80. package/dist/assets/{react-CU9NYGdL.js → react-KlPNqCgv.js} +1 -1
  81. package/dist/assets/{react-CrvQ92fR.js → react-f4y-bbBx.js} +1 -1
  82. package/dist/assets/{react-DrZcp68n.js → react-udL8tA2v.js} +1 -1
  83. package/dist/assets/{recharts-Dyhe2tpB.js → recharts-C7zYvbyW.js} +1 -1
  84. package/dist/assets/{routePaths-CqnfURaJ.js → routePaths-CXvFM1Km.js} +1 -1
  85. package/dist/assets/{sentry-cfxuOFew.js → sentry-YlBgF13X.js} +1 -1
  86. package/dist/assets/{url-DOBNPG6D.js → url-CoI8Zsek.js} +1 -1
  87. package/dist/assets/{url-B1qVva4A.js → url-NkQdWNq2.js} +1 -1
  88. package/dist/assets/{useAskAiCfoHostNavButtonProps-C2mAQ-5p.js → useAskAiCfoHostNavButtonProps-Drf4spg5.js} +1 -1
  89. package/dist/assets/{useDeviceId-43L8M3To.js → useDeviceId-DEQYTB26.js} +1 -1
  90. package/dist/assets/{useFetchSuggestedQuestionsWhenReady-B5mF_k6O.js → useFetchSuggestedQuestionsWhenReady-vaYDsXnK.js} +1 -1
  91. package/dist/assets/{useInitialThreadRequest-CME_1dn5.js → useInitialThreadRequest-_8uTkuSx.js} +1 -1
  92. package/dist/assets/{utils-DumEze_M.js → utils-B6J0lORC.js} +1 -1
  93. package/dist/assets/{withTransactionSidePanel-Dq1wepy8.js → withTransactionSidePanel-DlSxH_1I.js} +1 -1
  94. package/dist/assets/{zeni-epic-state-DrGehtra.js → zeni-epic-state-B6DxGTeH.js} +3 -3
  95. package/dist/index.html +1 -1
  96. package/package.json +1 -1
  97. package/dist/assets/AddressRoutes-CWbtPs0T.js +0 -1
  98. package/dist/assets/CustomerOnboardingAuthScreen--LKCq1mD.js +0 -1
  99. package/dist/assets/NotFoundScreen-DXPtR234.js +0 -1
  100. package/dist/assets/TransactionDetailRoutes-DkbxIzsT.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-CF908iAG.js";import{l as K,g as S,u as z,h as G,j as q,k as H,s as $a,n as at,o as w}from"./core-Cgen4kAj.js";import{eN as j,Jv as Me,bC as Ut,bq as ue,KI as za,hS as qa,KJ as xt,KK as Za,hV as nt,KL as Re,KM as Ha,h_ as Ja,KN as Tt,KO as Qa,i2 as ot,KP as je,KQ as Xa,cj as rt,KR as Wa,KS as en,JP as tn,iY as an,KT as nn,bn as Ae,KU as Yt,Jj as ee,bc as Vt,ja as Nt,mt as Gt,iV as Kt,Jl as te,Jk as Z,f2 as on,fk as sn,KV as rn,KW as cn,KX as $t,KY as be,tA as ve,tB as Ie,tY as me,tS as ae,tF as Ee,KZ as ln,K_ as dn,K$ as un,L0 as zt,L1 as Ce,L2 as mn,dB as Ue,qc as qt,L3 as pn,L4 as hn,L5 as fn,L6 as it,IH as ct,jq as pe,u4 as lt,qk as gn,L7 as bn,tC as wt,qf as le,qb as Zt,L8 as se,L9 as Cn,La as dt,IF as ut,sc as Ht,Lb as _n,Lc as kn,Ld as Sn,Le as mt,sp as yn,Lf as An,tE as Dt,sb as Jt,Lg as re,Lh as vn,bv as Qt,u8 as Xt,Li as In,Lj as En,Lk as xn,Ll as pt,u3 as Tn,Lm as wn,tD as Ft,u7 as Wt,Ln as ie,Lo as Dn,Lp as Fn,Lq as ea,jf as ta,mq as aa,jk as na,mo as oa,mn as sa,mm as ra,rA as On,fa as Pn,cM as Bn,cN as Rn,mj as jn,f6 as Ln,mA as Mn,Lr as Un,Dc as Yn,Ls as Vn,Lt as Nn,Lu as Gn,b5 as ht,eZ as Kn,gA as $n,fB as zn,mu as qn,iO as Zn,mr as Hn,mp as Jn,eT as Qn,eR as Xn}from"./zeni-epic-state-DrGehtra.js";import{z as R,Q as J,s as D,d as I,D as $,aQ as Wn,A as xe,aR as ia,f as V,aS as eo,j as Te,aT as ca,a as Ye,p as L,h as to,aU as ao,aV as no,K as la,q as oo,c as da,Z as so,aW as ro,aJ as ua,aX as io,aY as co,O as lo,aZ as uo,a_ as mo,am as po,n as ho,M as fo,a$ as go,b0 as ke}from"./index-trlF__w8.js";import{n as ft}from"./mui-C7dUqSqV.js";import{a as b}from"./sentry-cfxuOFew.js";import{w as ma}from"./withTransactionSidePanel-Dq1wepy8.js";import{b as pa,t as he,e as ne,a as gt,v as bo}from"./routePaths-CqnfURaJ.js";import{u as Q}from"./useAskAiCfoHostNavButtonProps-C2mAQ-5p.js";import{c as we,b as Co}from"./useFetchSuggestedQuestionsWhenReady-B5mF_k6O.js";import ye from"./NotFoundScreen-DXPtR234.js";import{t as ha}from"./analyticsHelper-CsFRydiU.js";import{C as _o}from"./CompanyPassportScreen-BmSdom0e.js";import{F as ko}from"./FeaturePreviewScreen-Bu3Nmz6L.js";import{R as So}from"./ReferralListScreen-Dj04SxiV.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.js";import"./TransactionDetailScreen-DB2dMdqL.js";import"./decodeURIComponentSafe-DztnZ-A4.js";import"./MobileAppDrawer-BuQb2buy.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]="269264d2-749b-4732-b058-5e62d0fed9cc",e._sentryDebugIdIdentifier="sentry-dbid-269264d2-749b-4732-b058-5e62d0fed9cc")}catch{}})();const yo=ma(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=R.getSignedInUser(),i=S(x=>x.tenantState.currentTenantId),d=S(x=>j(x)),{tenantEmailDomain:p}=K(),C=z(),g=d?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo(()=>({authParams:u,companyName:g,downloadEndPoint:`${J}/agingDetailedReport`,timezone:Me()}),[]),m=b.useMemo(()=>r!=null?Ut(r):ue(),[r]),h=G(),f=q(),k=S(x=>za(x,m,o)),y=b.useCallback(()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&h(qa(o,m))},[m]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),A=b.useCallback((x,P)=>{h(xt({sortKey:x,sortOrder:P}))},[]),E=b.useCallback(x=>{h(xt({downloadState:x}))},[]),M=b.useCallback(x=>{if(e)e(x.transactionId,x.transactionType);else if(p!=null){const P=pa({id:x.transactionId,type:x.transactionType},p);f(P);const fe=D(C.state?.pathnameStackToGoBack,C.pathname);f(P,{state:{pathnameStackToGoBack:fe}})}},[p,e]),F=b.useCallback(()=>{k.vendor!=null&&I.trackApAgingDetail("AP Aging",m.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)},[k.vendor,m]);return b.useEffect(()=>{y()},[]),b.useEffect(()=>{k.fetchState==="Completed"&&F()},[F,k.fetchState]),l.jsx(Wn,{apAgingDetail:k,downloadParams:c,reportDate:m,analytics:I,onTransactionClick:M,onReload:y,onBackClick:_,onColumnSortConfigChanged:A,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),Ao=()=>{const e=G(),a=q(),t=S(A=>Za(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=Q({mobileExploreReferrer:"AP Aging"});we({isDataReady:t.fetchState==="Completed"});const r=R.getSignedInUser(),s=S(A=>A.tenantState.currentTenantId),i=S(A=>j(A)),d=i?.companyName??"",p={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},C=b.useMemo(()=>({authParams:p,companyName:d,downloadEndPoint:`${J}/agingReport`,timezone:Me()}),[]),g=t.apAgingUIState.selectedDate??ue(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(nt(g))},[]);b.useEffect(()=>{u()},[]);const c=b.useCallback(()=>{a("../",{relative:"path"})},[]),m=b.useCallback(A=>{e(Re({searchString:A}))},[]),h=b.useCallback((A,E)=>{e(Re({sortKey:E,sortOrder:A}))},[]),f=b.useCallback(A=>{a(`./${A}/${g.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),k=b.useCallback(A=>{e(Re({downloadState:A}))},[]),y=b.useCallback((A,E)=>{},[]),_=b.useCallback((A,E)=>{e(Re({selectedDate:A,agingDateSelectionType:E})),e(nt(A))},[]);return l.jsxs(l.Fragment,{children:[t.fetchState==="Completed"?l.jsx(xe,{analytics:I,onLoad:A=>A.trackPageLoaded(V.Event.agingReport,"AP Aging")}):null,l.jsx(ia,{uiState:t.apAgingUIState,report:t,downloadParams:C,analytics:I,onReloadReport:u,onBackClick:c,onSearchTextChange:m,onSortOrderChange:h,onEntityNameClick:f,updateDownloadStateHandler:k,onSelectedDateChanged:_,onNodeCollapseToggled:y,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},vo=ma(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=R.getSignedInUser(),i=S(F=>j(F)),{tenantEmailDomain:d}=K(),p=z(),C=i.companyName,g={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:g,companyName:C,downloadEndPoint:`${J}/agingDetailedReport`,timezone:Me()}),[]),c=b.useMemo(()=>r!=null?Ut(r):ue(),[r]),m=G(),h=q(),f=S(F=>Ha(F,c,o)),k=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&m(Ja(o,c))},[c]),y=b.useCallback(()=>{h("../../",{relative:"path"})},[]),_=b.useCallback((F,x)=>{m(Tt({sortKey:F,sortOrder:x}))},[]),A=b.useCallback(F=>{m(Tt({downloadState:F}))},[]),E=b.useCallback(F=>{if(e)e(F.transactionId,F.transactionType);else if(d!=null){const x=pa({id:F.transactionId,type:F.transactionType},d);h(x);const P=D(p.state?.pathnameStackToGoBack,p.pathname);h(x,{state:{pathnameStackToGoBack:P}})}},[d,e]),M=b.useCallback(()=>{f.customer!=null&&I.trackArAgingDetail("AR Aging",c.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,c]);return b.useEffect(()=>{k()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&M()},[f.fetchState,M]),l.jsx(eo,{arAgingDetail:f,downloadParams:u,reportDate:c,analytics:I,onTransactionClick:E,onReload:k,onBackClick:y,onColumnSortConfigChanged:_,updateDownloadStateHandler:A,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),Io=()=>{const e=G(),a=q(),t=S(_=>Qa(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=Q({mobileExploreReferrer:"AR Aging"});we({isDataReady:t.fetchState==="Completed"});const r=R.getSignedInUser(),s=S(_=>j(_)),i=s.companyName,d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},p=b.useMemo(()=>({authParams:d,companyName:i,downloadEndPoint:`${J}/agingReport`,timezone:Me()}),[]),C=t.arAgingUIState.selectedDate??ue(),g=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(ot(C))},[]);b.useEffect(()=>{g()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),c=b.useCallback(_=>{e(je({searchString:_}))},[]),m=b.useCallback((_,A)=>{e(je({sortKey:A,sortOrder:_}))},[]),h=b.useCallback(_=>{a(`./${_}/${C.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),f=b.useCallback(_=>{e(je({downloadState:_}))},[]),k=b.useCallback((_,A)=>{e(je({selectedDate:_,agingDateSelectionType:A})),e(ot(_))},[]),y=b.useCallback((_,A)=>{e(Xa({nodeId:_,isCollapsed:A}))},[]);return l.jsxs(l.Fragment,{children:[t.fetchState==="Completed"?l.jsx(xe,{analytics:I,onLoad:_=>_.trackPageLoaded(V.Event.agingReport,"AR Aging")}):null,l.jsx(ia,{uiState:t.arAgingUIState,report:t,downloadParams:p,analytics:I,onReloadReport:g,onBackClick:u,onSearchTextChange:c,onSortOrderChange:m,onEntityNameClick:h,updateDownloadStateHandler:f,onSelectedDateChanged:k,onNodeCollapseToggled:y,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},fa=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function ga(e,a){const t=tn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=he(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(an(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?I.trackZeniAccountsCashBalancePromoClicked("Move Money"):(I.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 I.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const Eo=H(function(e){const a=Wa(e).accountsInOrder.map((n,o)=>fa(n,o)),t=en(e);return{sectionTitle:$.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:I}},ga)(ca),xo=H(function(e){const a=nn(e).accountsInOrder.map((o,r)=>fa(o,r)),t=R.getSignedInUser(),n=Ae(t);return{sectionTitle:$.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:I}},ga)(ca);function To(){const e=q(),a=z(),{tenantEmailDomain:t}=K(),n=Te(),o=S(s=>j(s).company?.companyInfo.firstMonthOfFY??1),r=rt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?l.jsx(ye,{}):l.jsx(Eo,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function wo(){const e=q(),a=z(),{tenantEmailDomain:t}=K(),n=Te(),o=rt(n?.loggedInUserRoleMap),r=S(s=>j(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?l.jsx(ye,{}):l.jsx(xo,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const Do=ft.div`
1
+ import{j as l}from"./liveblocks-DytGFyho.js";import{l as K,g as S,u as z,h as G,j as q,k as H,s as za,n as at,o as w}from"./core-BRYqCMzm.js";import{eN as j,Jv as Me,bC as Yt,bq as ue,KI as qa,hS as Za,KJ as xt,KK as Ha,hV as nt,KL as Re,KM as Ja,h_ as Qa,KN as Tt,KO as Xa,i2 as ot,KP as je,KQ as Wa,cj as rt,KR as en,KS as tn,JP as an,iY as nn,KT as on,bn as Ae,KU as Vt,Jj as ee,bc as Nt,ja as Gt,mt as Kt,iV as $t,Jl as te,Jk as Z,f2 as sn,fk as rn,KV as cn,KW as ln,KX as zt,KY as be,tA as ve,tB as Ie,tY as me,tS as ae,tF as Ee,KZ as dn,K_ as un,K$ as mn,L0 as qt,L1 as Ce,L2 as pn,dB as Ue,qc as Zt,L3 as hn,L4 as fn,L5 as gn,L6 as it,IH as ct,jq as pe,u4 as lt,qk as bn,L7 as Cn,tC as wt,qf as le,qb as Ht,L8 as se,L9 as _n,La as dt,IF as ut,sc as Jt,Lb as kn,Lc as Sn,Ld as yn,Le as mt,sp as An,Lf as vn,tE as Dt,sb as Qt,Lg as re,Lh as In,bv as Xt,u8 as Wt,Li as En,Lj as xn,Lk as Tn,Ll as pt,u3 as wn,Lm as Dn,tD as Ft,u7 as ea,Ln as ie,Lo as Fn,Lp as On,Lq as ta,jf as aa,mq as na,jk as oa,mo as sa,mn as ra,mm as ia,rA as Pn,fa as Bn,cM as Rn,cN as jn,mj as Ln,f6 as Mn,mA as Un,Dc as Ot,Lr as Yn,Ls as Vn,Lt as Nn,Lu as Gn,b5 as ht,eZ as Kn,gA as $n,fB as zn,mu as qn,iO as Zn,mr as Hn,mp as Jn,eT as Qn,eR as Xn}from"./zeni-epic-state-B6DxGTeH.js";import{z as R,Q as J,s as D,d as I,D as $,aQ as Wn,A as xe,aR as ca,f as V,aS as eo,j as Te,aT as la,a as Ye,p as L,h as to,aU as ao,aV as no,K as da,q as oo,c as ua,Z as so,aW as ro,aJ as ma,aX as io,aY as co,O as lo,aZ as uo,a_ as mo,am as po,n as ho,M as fo,a$ as go,b0 as ke}from"./index-akX3Nhym.js";import{n as ft}from"./mui-dDGLzwM4.js";import{a as b}from"./sentry-YlBgF13X.js";import{w as pa}from"./withTransactionSidePanel-DlSxH_1I.js";import{b as ha,t as he,e as ne,a as gt,v as bo}from"./routePaths-CXvFM1Km.js";import{u as Q}from"./useAskAiCfoHostNavButtonProps-Drf4spg5.js";import{c as we,b as Co}from"./useFetchSuggestedQuestionsWhenReady-vaYDsXnK.js";import ye from"./NotFoundScreen-DYSe2Mdv.js";import{t as fa}from"./analyticsHelper-BojuPNuT.js";import{C as _o}from"./CompanyPassportScreen-HqLnmaxr.js";import{F as ko}from"./FeaturePreviewScreen-yO9VvlJP.js";import{R as So}from"./ReferralListScreen-CrZHp_7-.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.js";import"./TransactionDetailScreen-k-8yhupk.js";import"./decodeURIComponentSafe-VG11krJk.js";import"./MobileAppDrawer-Cbtsb69z.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]="4b8f5ef0-0f3d-4631-8c12-f6f9db81a841",e._sentryDebugIdIdentifier="sentry-dbid-4b8f5ef0-0f3d-4631-8c12-f6f9db81a841")}catch{}})();const yo=pa(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=R.getSignedInUser(),i=S(x=>x.tenantState.currentTenantId),d=S(x=>j(x)),{tenantEmailDomain:p}=K(),C=z(),g=d?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo(()=>({authParams:u,companyName:g,downloadEndPoint:`${J}/agingDetailedReport`,timezone:Me()}),[]),m=b.useMemo(()=>r!=null?Yt(r):ue(),[r]),h=G(),f=q(),k=S(x=>qa(x,m,o)),y=b.useCallback(()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&h(Za(o,m))},[m]),_=b.useCallback(()=>{f("../../",{relative:"path"})},[]),A=b.useCallback((x,P)=>{h(xt({sortKey:x,sortOrder:P}))},[]),E=b.useCallback(x=>{h(xt({downloadState:x}))},[]),M=b.useCallback(x=>{if(e)e(x.transactionId,x.transactionType);else if(p!=null){const P=ha({id:x.transactionId,type:x.transactionType},p);f(P);const fe=D(C.state?.pathnameStackToGoBack,C.pathname);f(P,{state:{pathnameStackToGoBack:fe}})}},[p,e]),F=b.useCallback(()=>{k.vendor!=null&&I.trackApAgingDetail("AP Aging",m.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)},[k.vendor,m]);return b.useEffect(()=>{y()},[]),b.useEffect(()=>{k.fetchState==="Completed"&&F()},[F,k.fetchState]),l.jsx(Wn,{apAgingDetail:k,downloadParams:c,reportDate:m,analytics:I,onTransactionClick:M,onReload:y,onBackClick:_,onColumnSortConfigChanged:A,updateDownloadStateHandler:E,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),Ao=()=>{const e=G(),a=q(),t=S(A=>Ha(A)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=Q({mobileExploreReferrer:"AP Aging"});we({isDataReady:t.fetchState==="Completed"});const r=R.getSignedInUser(),s=S(A=>A.tenantState.currentTenantId),i=S(A=>j(A)),d=i?.companyName??"",p={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},C=b.useMemo(()=>({authParams:p,companyName:d,downloadEndPoint:`${J}/agingReport`,timezone:Me()}),[]),g=t.apAgingUIState.selectedDate??ue(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(nt(g))},[]);b.useEffect(()=>{u()},[]);const c=b.useCallback(()=>{a("../",{relative:"path"})},[]),m=b.useCallback(A=>{e(Re({searchString:A}))},[]),h=b.useCallback((A,E)=>{e(Re({sortKey:E,sortOrder:A}))},[]),f=b.useCallback(A=>{a(`./${A}/${g.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),k=b.useCallback(A=>{e(Re({downloadState:A}))},[]),y=b.useCallback((A,E)=>{},[]),_=b.useCallback((A,E)=>{e(Re({selectedDate:A,agingDateSelectionType:E})),e(nt(A))},[]);return l.jsxs(l.Fragment,{children:[t.fetchState==="Completed"?l.jsx(xe,{analytics:I,onLoad:A=>A.trackPageLoaded(V.Event.agingReport,"AP Aging")}):null,l.jsx(ca,{uiState:t.apAgingUIState,report:t,downloadParams:C,analytics:I,onReloadReport:u,onBackClick:c,onSearchTextChange:m,onSortOrderChange:h,onEntityNameClick:f,updateDownloadStateHandler:k,onSelectedDateChanged:_,onNodeCollapseToggled:y,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},vo=pa(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=R.getSignedInUser(),i=S(F=>j(F)),{tenantEmailDomain:d}=K(),p=z(),C=i.companyName,g={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:g,companyName:C,downloadEndPoint:`${J}/agingDetailedReport`,timezone:Me()}),[]),c=b.useMemo(()=>r!=null?Yt(r):ue(),[r]),m=G(),h=q(),f=S(F=>Ja(F,c,o)),k=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&m(Qa(o,c))},[c]),y=b.useCallback(()=>{h("../../",{relative:"path"})},[]),_=b.useCallback((F,x)=>{m(Tt({sortKey:F,sortOrder:x}))},[]),A=b.useCallback(F=>{m(Tt({downloadState:F}))},[]),E=b.useCallback(F=>{if(e)e(F.transactionId,F.transactionType);else if(d!=null){const x=ha({id:F.transactionId,type:F.transactionType},d);h(x);const P=D(p.state?.pathnameStackToGoBack,p.pathname);h(x,{state:{pathnameStackToGoBack:P}})}},[d,e]),M=b.useCallback(()=>{f.customer!=null&&I.trackArAgingDetail("AR Aging",c.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,c]);return b.useEffect(()=>{k()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&M()},[f.fetchState,M]),l.jsx(eo,{arAgingDetail:f,downloadParams:u,reportDate:c,analytics:I,onTransactionClick:E,onReload:k,onBackClick:y,onColumnSortConfigChanged:_,updateDownloadStateHandler:A,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),Io=()=>{const e=G(),a=q(),t=S(_=>Xa(_)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=Q({mobileExploreReferrer:"AR Aging"});we({isDataReady:t.fetchState==="Completed"});const r=R.getSignedInUser(),s=S(_=>j(_)),i=s.companyName,d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},p=b.useMemo(()=>({authParams:d,companyName:i,downloadEndPoint:`${J}/agingReport`,timezone:Me()}),[]),C=t.arAgingUIState.selectedDate??ue(),g=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(ot(C))},[]);b.useEffect(()=>{g()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),c=b.useCallback(_=>{e(je({searchString:_}))},[]),m=b.useCallback((_,A)=>{e(je({sortKey:A,sortOrder:_}))},[]),h=b.useCallback(_=>{a(`./${_}/${C.format($.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),f=b.useCallback(_=>{e(je({downloadState:_}))},[]),k=b.useCallback((_,A)=>{e(je({selectedDate:_,agingDateSelectionType:A})),e(ot(_))},[]),y=b.useCallback((_,A)=>{e(Wa({nodeId:_,isCollapsed:A}))},[]);return l.jsxs(l.Fragment,{children:[t.fetchState==="Completed"?l.jsx(xe,{analytics:I,onLoad:_=>_.trackPageLoaded(V.Event.agingReport,"AR Aging")}):null,l.jsx(ca,{uiState:t.arAgingUIState,report:t,downloadParams:p,analytics:I,onReloadReport:g,onBackClick:u,onSearchTextChange:c,onSortOrderChange:m,onEntityNameClick:h,updateDownloadStateHandler:f,onSelectedDateChanged:k,onNodeCollapseToggled:y,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function ba(e,a){const t=an(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=he(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(nn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?I.trackZeniAccountsCashBalancePromoClicked("Move Money"):(I.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 I.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const Eo=H(function(e){const a=en(e).accountsInOrder.map((n,o)=>ga(n,o)),t=tn(e);return{sectionTitle:$.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:I}},ba)(la),xo=H(function(e){const a=on(e).accountsInOrder.map((o,r)=>ga(o,r)),t=R.getSignedInUser(),n=Ae(t);return{sectionTitle:$.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:I}},ba)(la);function To(){const e=q(),a=z(),{tenantEmailDomain:t}=K(),n=Te(),o=S(s=>j(s).company?.companyInfo.firstMonthOfFY??1),r=rt(n?.loggedInUserRoleMap);return S(s=>s.cashBalanceState.fetchState)==="Error"?l.jsx(ye,{}):l.jsx(Eo,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function wo(){const e=q(),a=z(),{tenantEmailDomain:t}=K(),n=Te(),o=rt(n?.loggedInUserRoleMap),r=S(s=>j(s).company?.companyInfo.firstMonthOfFY??1);return S(s=>s.cardBalanceState.fetchState)==="Error"?l.jsx(ye,{}):l.jsx(xo,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const Do=ft.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -10,11 +10,11 @@ import{j as l}from"./liveblocks-CF908iAG.js";import{l as K,g as S,u as z,h as G,
10
10
  flex-direction: column;
11
11
  align-items: center;
12
12
  background-color: ${e=>e.theme.colors.grey4};
13
- `;function Oo({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=q(),i=G(),d=z(),{tenantEmailDomain:p}=K(),C=to();return l.jsxs(Do,{children:[l.jsx(ao,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:C.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:g=>{g.trim().length>=2?i(te({searchString:g,searchOrigin:"navbar"})):g.trim().length===0&&i(Z("navbar"))},onAutoCompleteEntity:g=>{n!=null&&I?.trackSearch(V.Event.search,Po(a),g.type,g.name,n);const u=ne(g,p),c=D(d.state?.pathnameStackToGoBack,d.pathname);s(u,{state:{pathnameStackToGoBack:c}})}}},rightSideComponent:l.jsx(no,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),l.jsx(Fo,{children:a==="cash_balance"?l.jsx(To,{}):l.jsx(wo,{})})]})}function Ot(){const e=z(),a=G(),{useFeatureGate:t}=Ye(),{isFeatureEnabled:n}=t(L.isDepositAccountsFeatureEnabled),o=S(h=>h.cashBalanceState.fetchState),r=S(h=>h.cardBalanceState.fetchState),s=R.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=Yt((h=>{const f=Vt(h,"/").split("/");return f[f.length-1]})(e.pathname));let d="Not-Started",p="";const C=$.getLocalizedStrings();switch(i){case"cash_balance":d=o,p=C.reportTitleById.cash_balance;break;case"card_balance":d=r,p=C.reportTitleById.card_balance;break;default:console.error(`${i} is not supported!`)}const{isAiCfoAccessEnabled:g,onAskAiCfoClick:u}=Q({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});we({isDataReady:d==="Completed"});const c=S(h=>h.entityAutoCompleteState.autoCompleteText.navbar),m=S(h=>ee(h,"navbar"));return b.useEffect(()=>{d==="Not-Started"&&function(h,f,k){switch(f){case"card_balance":h(Kt());break;case"cash_balance":h(Nt()),k===!0&&h(Gt());break;default:throw new Error(`balance report type ${f} is not yet supported`)}}(a,i,n)},[s,a,d]),l.jsxs(l.Fragment,{children:[d==="Completed"?l.jsx(xe,{analytics:I,onLoad:h=>((f,k)=>{switch(k){case"card_balance":f.trackPageLoaded(V.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(V.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${k}!`)}})(h,i)}):null,l.jsx(Oo,{title:p,reportId:i,autoCompleteText:c,entityAutoCompleteView:m,isAiCfoAccessEnabled:g,onAskAiCfoClick:u})]})}const Po=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Bo=[];function De(e){const{mobileExploreReferrer:a}=e,t=G(),n=q(),o=z(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=la(),d=oo(),p=lo(d),C=$a(),g=S(P=>on(P)),u=g.uiState?.currentChatSessionId,c=g.allSessionsWithOrderedQuestionAnswers??Bo,m=R.getSignedInUser()?.userId,h=da(),f=Co()&&h&&r!=null,k=so(),y=ro(k),{useDynamicConfig:_}=Ye(),{configValue:A}=_(ua.aiCfoMessageDynamicConfig),E=b.useMemo(()=>Array.isArray(A.default_message_list)?A.default_message_list:[],[A.default_message_list]),M=b.useMemo(()=>(y!=null&&y.length>0?y:E).slice(0,2),[E,y]),F=b.useCallback((P,fe)=>{if(m==null||P.trim()==="")return;const ge=io(C.getState());if(p){const Oe=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Oe,referrer:a,aiCfoInitialQuestion:P,aiCfoShouldSubmit:!ge}})}else{if(ge)return t(sn(P)),void s(!0);i(P),s(!0),co(t,P,"insights_section",u,c,m,fe,void 0)}},[c,u,t,p,o.pathname,o.state,a,n,s,i,C,r,m]),x=b.useCallback(()=>{if(p){const P=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:P,referrer:a}})}else s(!0)},[p,o.pathname,o.state,a,n,s,r]);return b.useMemo(()=>{if(f)return{onAskSomethingElseClick:x,onSuggestedQuestionClick:F,suggestedQuestions:M}},[f,x,F,M])}const Fe=uo,Ro=H(function(e){const a=rn(e),t=cn(e),n=$t(e),{scrollPosition:o,...r}=n,s=$.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=R.getSignedInUser(),d=e.tenantState.currentTenantId,p=j(e),C=p?.companyName??"",g={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:d??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,c=ee(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:C,statementEndPoint:`${J}/statement`,authParams:g},analytics:I,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:c}}},function(e,a){return{updateDownloadStateHandler:t=>{e(ln(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(me("month")),e(ae(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(Fe),jo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=Q({mobileExploreReferrer:"DashboardCashInCashOut"}),s=De({mobileExploreReferrer:"DashboardCashInCashOut"}),i=S(d=>$t(d)).mode==="compare_mode";return l.jsx(Ro,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Lo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Mo=H(function(e){const a=dn(e),t=un(e),n=zt(e),{scrollPosition:o,...r}=n,s=$.getLocalizedStrings().reportTitleById.cash_position,i=R.getSignedInUser(),d=e.tenantState.currentTenantId,p=j(e),C=p?.companyName??"",g={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:d??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,c=ee(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:C,statementEndPoint:`${J}/statement`,authParams:g},analytics:I,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:c}}},function(e,a){return{updateDownloadStateHandler:t=>{e(mn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Lo(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Ce({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}})(Fe),Uo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=Q({mobileExploreReferrer:"DashboardCashPosition"}),s=De({mobileExploreReferrer:"DashboardCashPosition"}),i=S(d=>zt(d)).mode==="compare_mode";return l.jsx(Mo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},N=(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 Je(){return l.jsxs(at,{children:[l.jsx(w,{path:"/",element:l.jsx(X,{})}),l.jsx(w,{path:"/:forecastId",element:l.jsx(X,{})}),l.jsx(w,{path:"/:forecastId/*",element:l.jsx(ye,{})})]})}const Yo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Vo=H(function(e){const a=qt(e),t=pn(e),n=hn(e),o=fn(e),r=it(e),{scrollPosition:s,...i}=r,d=t.reportTitle,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(Cn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(se({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(se({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(se({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(se({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Yo(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(se({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(se({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t==="forecast_mode"?(e(wt({viewMode:"account_group"})),e(Zt(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(se({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Burn Rate"),e(wt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(bn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(gn())},onResyncReports:()=>{e(lt("net_burn_or_income_by_classes"))}}})(Fe),No=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),d=De({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),p=S(_=>it(_)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(_=>dt(_.forecastState,u??"")),m=S(_=>qt(_)),h=S(_=>ut(_)),f=S(_=>pe(_)),k=p.mode==="compare_mode",y=m.dataAvailable;return b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const _=c?.forecastPeriod,A=y!=null&&_.endDate.isAfter(y?.endDate)===!0?y:_;a(ae(e.firstMonthOfFY,{startDate:A.endDate.startOf(g),endDate:A?.endDate}))}},[u]),l.jsx(Vo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:k,navigate:o,analytics:I,reportsResyncFetchState:h.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},Go=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Ko=H(function(e){const a=Ht(e),t=_n(e),n=kn(e),o=Sn(e),r=mt(e),{scrollPosition:s,...i}=r,d=$.getLocalizedStrings().reportTitleById.operating_expenses,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(vn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(re({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(re({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(re({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(re({resetLeftScroll:!0})),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=Go(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(re({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(re({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t=="forecast_mode"?(e(Dt({viewMode:"account_group"})),e(Jt(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(re({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Dt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(An({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(yn())},onResyncReports:()=>{e(lt("operating_expenses_by_classes"))}}})(Fe),$o=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardOpEx"}),d=De({mobileExploreReferrer:"DashboardOpEx"}),p=S(E=>mt(E)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(E=>dt(E.forecastState,u??"")),m=S(E=>Ht(E)),h=S(E=>ut(E)),f=S(E=>pe(E)),k=p.mode==="compare_mode",y=m.dataAvailable;b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const E=c?.forecastPeriod,M=y!=null&&E.endDate.isAfter(y?.endDate)===!0?y:E;a(ae(e.firstMonthOfFY,{startDate:M.endDate.startOf(g),endDate:M?.endDate}))}},[u]);const _=Te(),A=_?.loggedInUserRole!=null&&Qt(_?.loggedInUserRole)!==!0;return l.jsx(Ko,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:k,navigate:o,forecastIdFromUrlPath:r,analytics:I,hasTransactionAccess:A,reportsResyncFetchState:h.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},zo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},qo=H(function(e){const a=Xt(e),t=In(e),n=En(e),o=xn(e),r=pt(e),{scrollPosition:s,...i}=r,d=$.getLocalizedStrings().reportTitleById.revenue,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(Dn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(ie({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(ie({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(ie({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(ie({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=zo(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(ie({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ie({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t==="forecast_mode"?(e(Ft({viewMode:"account_group"})),e(Wt(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ie({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Ft({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(wn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(Tn())},onResyncReports:()=>{e(lt("revenue_by_classes"))}}})(Fe),Zo=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardRevenue"}),d=De({mobileExploreReferrer:"DashboardRevenue"}),p=S(y=>pt(y)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(y=>dt(y.forecastState,u??"")),m=S(y=>Xt(y)).dataAvailable,h=p.mode==="compare_mode",f=S(y=>pe(y)),k=S(y=>ut(y));return b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const y=c?.forecastPeriod,_=m!=null&&y.endDate.isAfter(m?.endDate)===!0?m:y;a(ae(e.firstMonthOfFY,{startDate:_.endDate.startOf(g),endDate:_?.endDate}))}},[u]),l.jsx(qo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:f,isCompareModeOn:h,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:I,reportsResyncFetchState:k.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},Ho=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}},Jo=H(function(e){const a=Fn(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ee(e,"navbar");return{report:a,analytics:I,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}},function(e,a){return{onTimeframeSelectionChanged:t=>{I.trackTimeframeSwitch(ha(t),"Top Expenses"),e(ea(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ho(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(mo),Qo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return l.jsx(Jo,{tenantEmailDomain:a,location:t,navigate:n})},Xo=ft.div`
13
+ `;function Oo({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=q(),i=G(),d=z(),{tenantEmailDomain:p}=K(),C=to();return l.jsxs(Do,{children:[l.jsx(ao,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:C.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:g=>{g.trim().length>=2?i(te({searchString:g,searchOrigin:"navbar"})):g.trim().length===0&&i(Z("navbar"))},onAutoCompleteEntity:g=>{n!=null&&I?.trackSearch(V.Event.search,Po(a),g.type,g.name,n);const u=ne(g,p),c=D(d.state?.pathnameStackToGoBack,d.pathname);s(u,{state:{pathnameStackToGoBack:c}})}}},rightSideComponent:l.jsx(no,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),l.jsx(Fo,{children:a==="cash_balance"?l.jsx(To,{}):l.jsx(wo,{})})]})}function Pt(){const e=z(),a=G(),{useFeatureGate:t}=Ye(),{isFeatureEnabled:n}=t(L.isDepositAccountsFeatureEnabled),o=S(h=>h.cashBalanceState.fetchState),r=S(h=>h.cardBalanceState.fetchState),s=R.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=Vt((h=>{const f=Nt(h,"/").split("/");return f[f.length-1]})(e.pathname));let d="Not-Started",p="";const C=$.getLocalizedStrings();switch(i){case"cash_balance":d=o,p=C.reportTitleById.cash_balance;break;case"card_balance":d=r,p=C.reportTitleById.card_balance;break;default:console.error(`${i} is not supported!`)}const{isAiCfoAccessEnabled:g,onAskAiCfoClick:u}=Q({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});we({isDataReady:d==="Completed"});const c=S(h=>h.entityAutoCompleteState.autoCompleteText.navbar),m=S(h=>ee(h,"navbar"));return b.useEffect(()=>{d==="Not-Started"&&function(h,f,k){switch(f){case"card_balance":h($t());break;case"cash_balance":h(Gt()),k===!0&&h(Kt());break;default:throw new Error(`balance report type ${f} is not yet supported`)}}(a,i,n)},[s,a,d]),l.jsxs(l.Fragment,{children:[d==="Completed"?l.jsx(xe,{analytics:I,onLoad:h=>((f,k)=>{switch(k){case"card_balance":f.trackPageLoaded(V.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(V.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${k}!`)}})(h,i)}):null,l.jsx(Oo,{title:p,reportId:i,autoCompleteText:c,entityAutoCompleteView:m,isAiCfoAccessEnabled:g,onAskAiCfoClick:u})]})}const Po=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Bo=[];function De(e){const{mobileExploreReferrer:a}=e,t=G(),n=q(),o=z(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=da(),d=oo(),p=lo(d),C=za(),g=S(P=>sn(P)),u=g.uiState?.currentChatSessionId,c=g.allSessionsWithOrderedQuestionAnswers??Bo,m=R.getSignedInUser()?.userId,h=ua(),f=Co()&&h&&r!=null,k=so(),y=ro(k),{useDynamicConfig:_}=Ye(),{configValue:A}=_(ma.aiCfoMessageDynamicConfig),E=b.useMemo(()=>Array.isArray(A.default_message_list)?A.default_message_list:[],[A.default_message_list]),M=b.useMemo(()=>(y!=null&&y.length>0?y:E).slice(0,2),[E,y]),F=b.useCallback((P,fe)=>{if(m==null||P.trim()==="")return;const ge=io(C.getState());if(p){const Oe=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Oe,referrer:a,aiCfoInitialQuestion:P,aiCfoShouldSubmit:!ge}})}else{if(ge)return t(rn(P)),void s(!0);i(P),s(!0),co(t,P,"insights_section",u,c,m,fe,void 0)}},[c,u,t,p,o.pathname,o.state,a,n,s,i,C,r,m]),x=b.useCallback(()=>{if(p){const P=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:P,referrer:a}})}else s(!0)},[p,o.pathname,o.state,a,n,s,r]);return b.useMemo(()=>{if(f)return{onAskSomethingElseClick:x,onSuggestedQuestionClick:F,suggestedQuestions:M}},[f,x,F,M])}const Fe=uo,Ro=H(function(e){const a=cn(e),t=ln(e),n=zt(e),{scrollPosition:o,...r}=n,s=$.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=R.getSignedInUser(),d=e.tenantState.currentTenantId,p=j(e),C=p?.companyName??"",g={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:d??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,c=ee(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:C,statementEndPoint:`${J}/statement`,authParams:g},analytics:I,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:c}}},function(e,a){return{updateDownloadStateHandler:t=>{e(dn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(me("month")),e(ae(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(Fe),jo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=Q({mobileExploreReferrer:"DashboardCashInCashOut"}),s=De({mobileExploreReferrer:"DashboardCashInCashOut"}),i=S(d=>zt(d)).mode==="compare_mode";return l.jsx(Ro,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Lo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Mo=H(function(e){const a=un(e),t=mn(e),n=qt(e),{scrollPosition:o,...r}=n,s=$.getLocalizedStrings().reportTitleById.cash_position,i=R.getSignedInUser(),d=e.tenantState.currentTenantId,p=j(e),C=p?.companyName??"",g={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:d??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,c=ee(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:C,statementEndPoint:`${J}/statement`,authParams:g},analytics:I,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:c}}},function(e,a){return{updateDownloadStateHandler:t=>{e(pn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Lo(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Ce({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}})(Fe),Uo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=Q({mobileExploreReferrer:"DashboardCashPosition"}),s=De({mobileExploreReferrer:"DashboardCashPosition"}),i=S(d=>qt(d)).mode==="compare_mode";return l.jsx(Mo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},N=(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 Je(){return l.jsxs(at,{children:[l.jsx(w,{path:"/",element:l.jsx(X,{})}),l.jsx(w,{path:"/:forecastId",element:l.jsx(X,{})}),l.jsx(w,{path:"/:forecastId/*",element:l.jsx(ye,{})})]})}const Yo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Vo=H(function(e){const a=Zt(e),t=hn(e),n=fn(e),o=gn(e),r=it(e),{scrollPosition:s,...i}=r,d=t.reportTitle,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(_n(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(se({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(se({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(se({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(se({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Yo(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(se({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(se({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t==="forecast_mode"?(e(wt({viewMode:"account_group"})),e(Ht(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(se({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Burn Rate"),e(wt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(Cn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(bn())},onResyncReports:()=>{e(lt("net_burn_or_income_by_classes"))}}})(Fe),No=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),d=De({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),p=S(_=>it(_)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(_=>dt(_.forecastState,u??"")),m=S(_=>Zt(_)),h=S(_=>ut(_)),f=S(_=>pe(_)),k=p.mode==="compare_mode",y=m.dataAvailable;return b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const _=c?.forecastPeriod,A=y!=null&&_.endDate.isAfter(y?.endDate)===!0?y:_;a(ae(e.firstMonthOfFY,{startDate:A.endDate.startOf(g),endDate:A?.endDate}))}},[u]),l.jsx(Vo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:k,navigate:o,analytics:I,reportsResyncFetchState:h.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},Go=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},Ko=H(function(e){const a=Jt(e),t=kn(e),n=Sn(e),o=yn(e),r=mt(e),{scrollPosition:s,...i}=r,d=$.getLocalizedStrings().reportTitleById.operating_expenses,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(In(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(re({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(re({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(re({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(re({resetLeftScroll:!0})),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=Go(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(re({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(re({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t=="forecast_mode"?(e(Dt({viewMode:"account_group"})),e(Qt(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(re({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Dt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(vn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(An())},onResyncReports:()=>{e(lt("operating_expenses_by_classes"))}}})(Fe),$o=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardOpEx"}),d=De({mobileExploreReferrer:"DashboardOpEx"}),p=S(E=>mt(E)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(E=>dt(E.forecastState,u??"")),m=S(E=>Jt(E)),h=S(E=>ut(E)),f=S(E=>pe(E)),k=p.mode==="compare_mode",y=m.dataAvailable;b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const E=c?.forecastPeriod,M=y!=null&&E.endDate.isAfter(y?.endDate)===!0?y:E;a(ae(e.firstMonthOfFY,{startDate:M.endDate.startOf(g),endDate:M?.endDate}))}},[u]);const _=Te(),A=_?.loggedInUserRole!=null&&Xt(_?.loggedInUserRole)!==!0;return l.jsx(Ko,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:k,navigate:o,forecastIdFromUrlPath:r,analytics:I,hasTransactionAccess:A,reportsResyncFetchState:h.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},zo=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Ue(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}},qo=H(function(e){const a=Wt(e),t=En(e),n=xn(e),o=Tn(e),r=pt(e),{scrollPosition:s,...i}=r,d=$.getLocalizedStrings().reportTitleById.revenue,p=R.getSignedInUser(),C=e.tenantState.currentTenantId,g=j(e),u=g?.companyName??"",c={userId:p?.userId??"",sessionId:p?.zeniSessionId??"",tenantId:C??""},m=e.entityAutoCompleteState.autoCompleteText.navbar,h=ee(e,"navbar"),f=ct(g);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:d},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${J}/statement`,authParams:c},analytics:I,isZeniUser:Ae(p),autoCompleteData:{autoCompleteText:m,entityAutoCompleteView:h},isZeniCOAUsed:f,isAccountingClassesEnabled:pe(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(Fn(t))},onTimeframeSelectionChanged:t=>{e(me(t)),setTimeout(()=>e(ie({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ee(t,n)),e(ie({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ae(a.firstMonthOfFY,t)),e(ie({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(ve(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ie(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(ie({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=zo(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?gt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(ie({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ie({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(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(le(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?de:bt,n)),t==="forecast_mode"?(e(Ft({viewMode:"account_group"})),e(ea(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ie({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Ft({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(Dn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(wn())},onResyncReports:()=>{e(lt("revenue_by_classes"))}}})(Fe),Zo=e=>{const a=G(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=Q({mobileExploreReferrer:"DashboardRevenue"}),d=De({mobileExploreReferrer:"DashboardRevenue"}),p=S(y=>pt(y)),C=p.isForecastModeOn,g=p.timeframe,u=p.selectedForecast?.id,c=S(y=>dt(y.forecastState,u??"")),m=S(y=>Wt(y)).dataAvailable,h=p.mode==="compare_mode",f=S(y=>pe(y)),k=S(y=>ut(y));return b.useEffect(()=>{if(u!=null&&C===!0&&(N(C,r,u,o),c!=null)){const y=c?.forecastPeriod,_=m!=null&&y.endDate.isAfter(m?.endDate)===!0?m:y;a(ae(e.firstMonthOfFY,{startDate:_.endDate.startOf(g),endDate:_?.endDate}))}},[u]),l.jsx(qo,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:f,isCompareModeOn:h,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:I,reportsResyncFetchState:k.reportsResyncFetchState,insightsSectionAiCfoInfo:d,isAiCfoAccessEnabled:s,onAskAiCfoClick:i})},Ho=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}},Jo=H(function(e){const a=On(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ee(e,"navbar");return{report:a,analytics:I,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}},function(e,a){return{onTimeframeSelectionChanged:t=>{I.trackTimeframeSwitch(fa(t),"Top Expenses"),e(ta(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ho(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=he(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),d=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:d,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(te({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(Z("navbar"))},onAutoCompleteEntity:t=>{const n=ne(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(mo),Qo=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return l.jsx(Jo,{tenantEmailDomain:a,location:t,navigate:n})},Xo=ft.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
- `,de=3,bt=1;function Wo({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=q(),r=z(),{tenantEmailDomain:s}=K();let i;we({isDataReady:!0});const d={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=l.jsx($o,{...d});break;case"revenue":i=l.jsx(Zo,{...d});break;case"net_burn_or_income":i=l.jsx(No,{...d});break;case"cash_position":i=l.jsx(Uo,{...d});break;case"top_expenses":i=l.jsx(Qo,{...d});break;case"cash_in_cash_out":i=l.jsx(jo,{...d});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?l.jsx(Xo,{children:i}):null}function X(){const e=z(),a=G(),{forecastId:t}=K();let n="Not-Started";const o=S(c=>mt(c).fetchState),r=S(c=>pt(c).fetchState),s=S(c=>it(c).fetchState),i=S(c=>c.cashPositionState.fetchState),d=S(c=>c.topExState.fetchState),p=S(c=>c.cashInCashOutState.fetchState);if(R.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const C=S(c=>j(c)),g=C?.company?.companyInfo?.firstMonthOfFY??1,u=Yt((c=>{const m=Vt(c,"/").split("/");return t!=null?m[m.length-3]:m[m.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=d;break;case"cash_in_cash_out":n=p;break;default:console.error(`${u} is not supported!`)}return b.useEffect(()=>{n==="Not-Started"&&function(c,m,h,f){switch(m){case"operating_expenses":c(ra(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(Jt(!1,f)));break;case"revenue":c(sa(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(Wt(!1,f)));break;case"net_burn_or_income":c(oa(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(Zt(!1,f)));break;case"cash_position":c(na(!0));break;case"top_expenses":c(aa());break;case"cash_in_cash_out":c(ta());break;default:throw new Error(`report type ${m} is not yet supported`)}}(a,u,g,t)},[t]),l.jsxs(l.Fragment,{children:[n==="Completed"?l.jsx(xe,{analytics:I,onLoad:c=>((m,h)=>{const f=e.state?.referrer;switch(h){case"operating_expenses":m.trackPageLoaded(V.Event.operatingExpenses,f);break;case"revenue":m.trackPageLoaded(V.Event.revenues,f);break;case"net_burn_or_income":m.trackPageLoaded(V.Event.burnRate,f);break;case"cash_position":m.trackPageLoaded(V.Event.cashPosition,f);break;case"top_expenses":m.trackPageLoaded(V.Event.topExpenses,f);break;case"cash_in_cash_out":m.trackPageLoaded(V.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${h}!`)}})(c,u)}):null,l.jsx(Wo,{firstMonthOfFY:g,fetchState:n,reportId:u,forecastId:t})]})}var Qe=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Xe(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),function(){t(window.event)})}function ba(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 Ca(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 Ct={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,"-":Qe?173:189,"=":Qe?61:187,";":Qe?59:186,"'":222,"[":219,"]":221,"\\":220},W={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},st={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},B={16:!1,18:!1,17:!1,91:!1},O={},Le=1;Le<20;Le++)Ct["f".concat(Le)]=111+Le;var T=[],Pt=!1,_a="all",Bt=[],Ve=function(e){return Ct[e.toLowerCase()]||W[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function Rt(e){_a=e||"all"}function Se(){return _a||"all"}var We=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;Ca(a).forEach(function(s){var i=s.split(r),d=i.length,p=i[d-1],C=p==="*"?"*":Ve(p);if(O[C]){t||(t=Se());var g=d>1?ba(W,i):[];O[C]=O[C].filter(function(u){return!((!n||u.method===n)&&u.scope===t&&function(c,m){for(var h=c.length>=m.length?c:m,f=c.length>=m.length?m:c,k=!0,y=0;y<h.length;y++)f.indexOf(h[y])===-1&&(k=!1);return k}(u.mods,g))})}})};function jt(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,B)Object.prototype.hasOwnProperty.call(B,r)&&(!B[r]&&a.mods.indexOf(+r)>-1||B[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||B[16]||B[18]||B[17]||B[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 Lt(e,a){var t=O["*"],n=e.keyCode||e.which||e.charCode;if(U.filter.call(this,e)){if(n!==93&&n!==224||(n=91),T.indexOf(n)===-1&&n!==229&&T.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(m){var h=st[m];e[m]&&T.indexOf(h)===-1?T.push(h):!e[m]&&T.indexOf(h)>-1?T.splice(T.indexOf(h),1):m==="metaKey"&&e[m]&&T.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(T=T.slice(T.indexOf(h))))}),n in B){for(var o in B[n]=!0,W)W[o]===n&&(U[o]=!0);if(!t)return}for(var r in B)Object.prototype.hasOwnProperty.call(B,r)&&(B[r]=e[st[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(T.indexOf(17)===-1&&T.push(17),T.indexOf(18)===-1&&T.push(18),B[17]=!0,B[18]=!0);var s=Se();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)&&jt(e,t[i],s,a);if(n in O){for(var d=0;d<O[n].length;d++)if((e.type==="keydown"&&O[n][d].keydown||e.type==="keyup"&&O[n][d].keyup)&&O[n][d].key){for(var p=O[n][d],C=p.splitKey,g=p.key.split(C),u=[],c=0;c<g.length;c++)u.push(Ve(g[c]));u.sort().join("")===T.sort().join("")&&jt(e,p,s,a)}}}}function U(e,a,t){T=[];var n=Ca(e),o=[],r="all",s=document,i=0,d=!1,p=!0,C="+",g=!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&&(d=a.keyup),a.keydown!==void 0&&(p=a.keydown),a.capture!==void 0&&(g=a.capture),typeof a.splitKey=="string"&&(C=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(C)).length>1&&(o=ba(W,e)),(e=(e=e[e.length-1])==="*"?"*":Ve(e))in O||(O[e]=[]),O[e].push({keyup:d,keydown:p,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:C,element:s});s!==void 0&&!function(u){return Bt.indexOf(u)>-1}(s)&&window&&(Bt.push(s),Xe(s,"keydown",function(u){Lt(u,s)},g),Pt||(Pt=!0,Xe(window,"focus",function(){T=[]},g)),Xe(s,"keyup",function(u){Lt(u,s),function(c){var m=c.keyCode||c.which||c.charCode,h=T.indexOf(m);if(h>=0&&T.splice(h,1),c.key&&c.key.toLowerCase()==="meta"&&T.splice(0,T.length),m!==93&&m!==224||(m=91),m in B)for(var f in B[m]=!1,W)W[f]===m&&(U[f]=!1)}(u)},g))}var et={setScope:Rt,getScope:Se,deleteScope:function(e,a){var t,n;for(var o in e||(e=Se()),O)if(Object.prototype.hasOwnProperty.call(O,o))for(t=O[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Se()===e&&Rt(a||"all")},getPressedKeyCodes:function(){return T.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=Ve(e)),T.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(O).forEach(function(t){var n=O[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(O).forEach(function(s){return delete O[s]});else if(Array.isArray(e))e.forEach(function(s){s.key&&We(s)});else if(typeof e=="object")e.key&&We(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=""),We({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Ct,modifier:W,modifierMap:st};for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(U[tt]=et[tt]);if(typeof window<"u"){var es=window.hotkeys;U.noConflict=function(e){return e&&window.hotkeys===U&&(window.hotkeys=es),U},window.hotkeys=U}U.filter=function(){return!0};var Mt=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function ts(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,d=o.keydown,p=o.filterPreventDefault,C=p===void 0||p,g=o.enabled,u=g===void 0||g,c=o.enableOnContentEditable,m=c!==void 0&&c,h=b.useRef(null),f=b.useCallback(function(k,y){var _,A;return s&&!s(k)?!C:!!(Mt(k,["INPUT","TEXTAREA","SELECT"])&&!Mt(k,r)||(_=k.target)!=null&&_.isContentEditable&&!m)||!!(h.current===null||document.activeElement===h.current||(A=h.current)!=null&&A.contains(document.activeElement))&&(a(k,y),!0)},n?[h,r,s].concat(n):[h,r,s]);return b.useEffect(function(){if(u)return i&&d!==!0&&(t.keydown=!1),U(e,t||{},f),function(){return U.unbind(e,f)};U.unbind(e,f)},[f,e,u]),h}U.isPressed;const as=["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"],ns=(e,a,t,n,o)=>({card:{dimension:ht(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!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}),_e=(e,a,t,n,o)=>({card:{dimension:ht(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1},data:e}),os=(e,a,t,n)=>_e(void 0,e,ke,a,t),ss=(e,a,t,n,o)=>({card:{dimension:ht(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1},data:{funds:n,hasUserSeenVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),rs=H(function(e,a){const t=ls(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:d,hasUserSeenTreasuryVideo:p,treasuryFetchState:C}=a;let g=n.map((u,c)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return os(t,u,c);if(u==="zeni_promo_card")return _e({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,c);if(u==="treasury_promo_card")return ss(C,u,c,d,p);if(u==="information_card")return _e(void 0,"Completed",ke,u,c);{const m=o.find(h=>h?.reportId===u);return m?function(h,f,k,y){const _=h.reportId;switch(_){case"card_balance":case"cash_balance":return[ns(h,f,k,_,y)];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[_e(h,f,k,_,y)];case"net_burn_or_income_story_card":return[_e(h,f,k,"net_burn_or_income_story_card",y)];default:return console.error(`card type ${_} not yet supported!`),[]}}(m,m.fetchState,ke,c):[]}}).flat();return a.isSummaryCardsFiltered===!0&&(g=g.filter(u=>as.includes(u.card.cardType)==0).filter(u=>{const c=u.data?.availableNumberOfPeriods;return c!=null?c>0:u.card.cardType!="top_expenses"||u.data==null||function(m){if(m==null||m.length===0)return!0;let h=!0;for(const f of m)if(f.balance.available.amount!==0){h=!1;break}return h}(u.data.topExpenses.accountsOrdered)===!1})),{cardDataArray:g,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ee(e,"navbar")},analytics:I,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}},function(e,a){const t=a.tenantId,n=R.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)I.trackDashboardCardClicked("cards promo",2),I.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&&I.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(I.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,d,p,C){switch(d){case"card_balance":i(Kt());break;case"cash_balance":i(Nt());break;case"operating_expenses":i(ra(!0));break;case"revenue":i(sa(!0));break;case"net_burn_or_income":i(oa(!0));break;case"net_burn_or_income_story_card":i(Jn(!0));break;case"cash_position":i(na(!0));break;case"top_expenses":i(aa());break;case"cash_in_cash_out":i(ta());break;case"insights_dashboard":i(Hn());break;case"bill_pay_card":i(Zn());break;case"reimbursement_card":i(qn());break;case"company_details":i(zn(p));break;case"task_card":i($n());break;case"accounts_payable_aging":C.includes("accounts_payable_aging")===!1&&i(nt(ue()));break;case"accounts_receivable_aging":i(ot(ue()));break;case"zeni_accounts_promo_card":C.includes("zeni_accounts_promo_card")===!1&&i(Gt());break;case"rewards_card":C.includes("rewards_card")===!1&&i(Kn(!0));break;default:throw new Error(`report type ${d} is not yet supported`)}}(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{I.trackTimeframeSwitch(ha(r),cs(o),"Dashboard"),function(s,i,d){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(me(d));break;case"top_expenses":s(ea(d));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}}(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(Gn(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){R.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"&&(I.trackUpdateBurnRateCalculatorSettings(r,s,Vn(s)),e(Nn(t,r,s)))},onVideoPlay:()=>{e(Yn())},onVideoClose:()=>{e(Un())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(te({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(Z("navbar"))},onCancelAutoComplete:()=>{e(Z("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ne(o,a.tenantEmailDomain):bo(o.zeniId,o.qboId,a.tenantEmailDomain);const s=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}})(go);function is(){const{isAiCfoOpen:e,setIsAiCfoOpen:a}=la(),t=q(),n=G(),o=z(),r=R.getSignedInUser(),{useFeatureGate:s,useDynamicConfig:i}=Ye(),d=Ae(r),[p,C]=b.useState(!1),[g,u]=b.useState(!1),c=da(),{tenantEmailDomain:m}=K(),{isAiCfoAccessEnabled:h,onAskAiCfoClick:f}=Q({mobileExploreReferrer:"Dashboard"}),k=S(v=>v.tenantState.fetchState==="Completed"||v.tenantState.activeTenantFetchState.fetchState==="Completed"?j(v):void 0),y=k??R.getSignedInUserTenant(m),_=y.tenantId,A=y.companyId;b.useEffect(()=>{p===!1&&o.state?.message==="activation"&&(n(On(A)),C(!0))},[o.state,p,A,n]),b.useEffect(()=>{c&&!g&&o.state?.message==="open_ai_cfo_drawer"&&(a(!0),u(!0),t(o.pathname,{replace:!0,state:{...o.state,message:void 0}}))},[o.state,g,c,a,t,o.pathname]);const{isFeatureEnabled:E}=s(L.isApAgingFeatureEnabled),{isFeatureEnabled:M}=s(L.isExpenseAutomationEnabled),{isFeatureEnabled:F}=s(L.isExpenseAutomationEnabledV2),x=F||M&&d,{isFeatureEnabled:P}=s(L.isTreasuryEnabled),fe=po(x),{isFeatureEnabled:ge}=s(L.isArAgingFeatureEnabled),{isFeatureEnabled:Oe}=s(L.isDepositAccountsFeatureEnabled),{isFeatureEnabled:_t}=s(L.isReferralFeatureEnabled),{isFeatureEnabled:ka}=s(L.isChargeCardFeatureEnabled),{isFeatureEnabled:Sa}=s(L.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ya}=s(L.isDashboardSidebarNewYearAnimationEnabled),{configValue:kt}=i(ua.zeniCardsConfig),Aa=kt.charge_card_cashback_rate_per_transaction==null?.0175:kt.charge_card_cashback_rate_per_transaction;if(o.state?.message==="activation"){const v=ho(o.state?.pathnameStackToGoBack);t(o.pathname,{state:{...o.state,message:void 0,pathnameStackToGoBack:v.newStack}})}const[St,va]=b.useState(!1),[Ne,Ia]=b.useState(!1);ts("command+p, Control+p",v=>{Ia(!Ne),v.preventDefault()},{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[Ne]);const yt=k?.externalConnections?.accounting[0]?.isValid;if(r==null)throw Error("Can't access dashboard without signing in...");const oe=S(v=>j(v)?.excludedResources),Ea=S(v=>v.expenseAutomationViewState.selectedPeriodByTenantId),xa=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,Ta=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,wa=S(v=>v.treasurySetupViewState.treasuryFundsDetails).fetchStatus.fetchState,Da=k?.company!=null&&Pn(k.company),Ge=P&&Da,Ke=Te(),Fa=rt(Ke?.loggedInUserRoleMap),Y=[],At=oe?.resources?.find(v=>v.resource==="/reports/top_expenses")==null,Oa=oe?.resources?.find(v=>v.resource==="/reports/task_card")==null,$e=k?.userRole!=null&&Qt(k?.userRole),Pa=oe?.resources?.find(v=>v.resource==="/bills")==null&&!$e,Ba=oe?.resources?.find(v=>v.resource==="/reimbursements")==null,Ra=Bn(Ke?.loggedInUserRoleMap),ja=Rn(Ke?.loggedInUserRoleMap),La=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,Ma=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,Ua=S(v=>v.treasurySetupViewState.treasuryFundsDetails).fundsDetails;At===!1&&Y.push("top_expenses"),Oa===!1&&Y.push("task_card"),Pa===!1&&Y.push("bill_pay_card","bill_pay_promo_card"),E===!1&&Y.push("accounts_payable_aging"),ge===!1&&Y.push("accounts_receivable_aging"),(x===!1||$e)&&Y.push("expense_automation_card"),Ba===!1&&Y.push("reimbursement_card","reimbursement_promo_card"),Oe===!1&&Y.push("zeni_accounts_promo_card"),_t===!1&&Y.push("rewards_card"),Ge===!1&&Y.push("treasury_promo_card");const{areTenantIdsInSync:vt}=fo();b.useLayoutEffect(()=>{St&&fe===x||yt!==!0||!vt||oe?.fetchState!=="Completed"&&oe?.fetchState!=="Error"||(va(!0),n(jn(r.userId,A,_,!0,!1,Y)))},[St,r,_,n,At,yt,oe?.fetchState,vt]);const Ya=S(v=>v.reportUIOptionsState.forecastOnDashboard.isForecastModeOn),Va=S(v=>v.revenueState.uiState.selectedForecast?.id),Na=S(v=>v.cardBalanceState.fetchState),ce=S(v=>Ln(v,Y,r,F,M,Ge)),Ga=ce.fetchState;we({isDataReady:!0});const It=k?.isTreasuryVideoViewed===!0||ce.isTreasuryVideoClosed===!0;return l.jsxs(l.Fragment,{children:[Ga==="Completed"?l.jsx(xe,{analytics:I,onLoad:v=>{v.trackPageLoaded(V.Event.dashboard),Ge&&!It&&v.trackTreasuryPromoView("Dashboard Promo Video")}}):null,l.jsx(rs,{maxColumns:e?2:void 0,isAiCfoAccessEnabled:h,onAskAiCfoClick:f,onDragAndDropCard:(v,Ka)=>{const Et=function(Pe,ze,Be){const qe=Be.indexOf(Pe),Ze=Be.indexOf(ze);if(qe===-1||Ze===-1||qe===Ze)return Be;const He=[...Be];return He.splice(qe,1),He.splice(Ze,0,Pe),He}(v,Ka,ce.cardsOrdered);Et.some((Pe,ze)=>Pe!==ce.cardsOrdered[ze])&&n(Mn(Et))},dashboardReport:ce,passedCardsOrdered:ce.cardsForDashboardUI,tenantId:_,companyId:A,tenantEmailDomain:m,location:o,navigate:t,isApAgingFeatureEnabled:E,isArAgingFeatureEnabled:ge,isBillPayEnabled:Ta,isReimbursementEnabled:xa,isSummaryCardsFiltered:Ne,isForecastOn:Ya,selectedForecastOnDashboard:Va,isVisitingFirstTime:p,isZeniAccountEnabled:Oe,isRewardsFeatureEnabled:_t,hasZeniAccountsAdminAccess:Fa,isExpenseAutomationEnabledForUser:x&&$e===!1,selectedPeriod:Ea[_],isChargeCardFeatureEnabled:ka,isUserHasCardsAccess:Ra,isUserHasTreasuryAccess:ja,cardsCreditLimit:La,cashbackRate:Aa,isInterestedInChargeCard:Ma,cardBalanceFetchState:Na,christmasAnimationEnabled:Sa,newYearAnimationEnabled:ya,treasuryFundDetails:Ua,hasUserSeenTreasuryVideo:It,treasuryFetchState:wa})]})}const cs=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"},ls=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map(a=>a.fetchState).reduce((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t);function Ls(){const e=Te(),a=e?.excludedResources?.find(p=>p.resource==="/reports/top_expenses")==null,{useFeatureGate:t}=Ye(),{isFeatureEnabled:n}=t(L.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(L.isArAgingFeatureEnabled),r=S(p=>j(p)),{isFeatureEnabled:s}=t(L.isDebitCardFeatureEnabled),i=Qn(s,r),d=Xn(r);return i===!0||d===!0?l.jsx(at,{children:l.jsx(w,{path:"/*",element:l.jsx(ko,{})})}):l.jsxs(at,{children:[l.jsx(w,{path:"/",element:l.jsx(is,{})}),l.jsx(w,{path:"cash_balance/*",element:l.jsx(Ot,{})}),l.jsx(w,{path:"card_balance/*",element:l.jsx(Ot,{})}),l.jsx(w,{path:"operating_expenses/*",element:l.jsx(X,{})}),l.jsx(w,{path:"operating_expenses/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"revenue/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"revenue/*",element:l.jsx(X,{})}),l.jsx(w,{path:"net_burn_or_income/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"net_burn_or_income/*",element:l.jsx(X,{})}),n===!0&&l.jsxs(l.Fragment,{children:[l.jsx(w,{path:"accounts_payable_aging/*",element:l.jsx(Ao,{})}),l.jsx(w,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:l.jsx(yo,{})})]}),o&&l.jsxs(l.Fragment,{children:[l.jsx(w,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:l.jsx(vo,{})}),l.jsx(w,{path:"accounts_receivable_aging/*",element:l.jsx(Io,{})})]}),l.jsx(w,{path:"cash_position/*",element:l.jsx(X,{})}),l.jsx(w,{path:"top_expenses/*",element:a===!0?l.jsx(X,{}):l.jsx(ye,{})}),l.jsx(w,{path:"cash_in_cash_out/*",element:l.jsx(X,{})}),l.jsx(w,{path:"company_details",element:l.jsx(_o,{})}),l.jsx(w,{path:"referrals/*",element:l.jsx(So,{})}),l.jsx(w,{path:"*",element:l.jsx(ye,{})})]})}export{Ls as default};
20
+ `,de=3,bt=1;function Wo({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=q(),r=z(),{tenantEmailDomain:s}=K();let i;we({isDataReady:!0});const d={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=l.jsx($o,{...d});break;case"revenue":i=l.jsx(Zo,{...d});break;case"net_burn_or_income":i=l.jsx(No,{...d});break;case"cash_position":i=l.jsx(Uo,{...d});break;case"top_expenses":i=l.jsx(Qo,{...d});break;case"cash_in_cash_out":i=l.jsx(jo,{...d});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?l.jsx(Xo,{children:i}):null}function X(){const e=z(),a=G(),{forecastId:t}=K();let n="Not-Started";const o=S(c=>mt(c).fetchState),r=S(c=>pt(c).fetchState),s=S(c=>it(c).fetchState),i=S(c=>c.cashPositionState.fetchState),d=S(c=>c.topExState.fetchState),p=S(c=>c.cashInCashOutState.fetchState);if(R.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const C=S(c=>j(c)),g=C?.company?.companyInfo?.firstMonthOfFY??1,u=Vt((c=>{const m=Nt(c,"/").split("/");return t!=null?m[m.length-3]:m[m.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=d;break;case"cash_in_cash_out":n=p;break;default:console.error(`${u} is not supported!`)}return b.useEffect(()=>{n==="Not-Started"&&function(c,m,h,f){switch(m){case"operating_expenses":c(ia(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(Qt(!1,f)));break;case"revenue":c(ra(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(ea(!1,f)));break;case"net_burn_or_income":c(sa(!0)),f!=null&&(c(le(h,!0,de,{id:f,index:0})),c(Ht(!1,f)));break;case"cash_position":c(oa(!0));break;case"top_expenses":c(na());break;case"cash_in_cash_out":c(aa());break;default:throw new Error(`report type ${m} is not yet supported`)}}(a,u,g,t)},[t]),l.jsxs(l.Fragment,{children:[n==="Completed"?l.jsx(xe,{analytics:I,onLoad:c=>((m,h)=>{const f=e.state?.referrer;switch(h){case"operating_expenses":m.trackPageLoaded(V.Event.operatingExpenses,f);break;case"revenue":m.trackPageLoaded(V.Event.revenues,f);break;case"net_burn_or_income":m.trackPageLoaded(V.Event.burnRate,f);break;case"cash_position":m.trackPageLoaded(V.Event.cashPosition,f);break;case"top_expenses":m.trackPageLoaded(V.Event.topExpenses,f);break;case"cash_in_cash_out":m.trackPageLoaded(V.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${h}!`)}})(c,u)}):null,l.jsx(Wo,{firstMonthOfFY:g,fetchState:n,reportId:u,forecastId:t})]})}var Qe=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function Xe(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),function(){t(window.event)})}function Ca(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 _a(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 Ct={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,"-":Qe?173:189,"=":Qe?61:187,";":Qe?59:186,"'":222,"[":219,"]":221,"\\":220},W={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},st={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},B={16:!1,18:!1,17:!1,91:!1},O={},Le=1;Le<20;Le++)Ct["f".concat(Le)]=111+Le;var T=[],Bt=!1,ka="all",Rt=[],Ve=function(e){return Ct[e.toLowerCase()]||W[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function jt(e){ka=e||"all"}function Se(){return ka||"all"}var We=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;_a(a).forEach(function(s){var i=s.split(r),d=i.length,p=i[d-1],C=p==="*"?"*":Ve(p);if(O[C]){t||(t=Se());var g=d>1?Ca(W,i):[];O[C]=O[C].filter(function(u){return!((!n||u.method===n)&&u.scope===t&&function(c,m){for(var h=c.length>=m.length?c:m,f=c.length>=m.length?m:c,k=!0,y=0;y<h.length;y++)f.indexOf(h[y])===-1&&(k=!1);return k}(u.mods,g))})}})};function Lt(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,B)Object.prototype.hasOwnProperty.call(B,r)&&(!B[r]&&a.mods.indexOf(+r)>-1||B[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||B[16]||B[18]||B[17]||B[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 Mt(e,a){var t=O["*"],n=e.keyCode||e.which||e.charCode;if(U.filter.call(this,e)){if(n!==93&&n!==224||(n=91),T.indexOf(n)===-1&&n!==229&&T.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(m){var h=st[m];e[m]&&T.indexOf(h)===-1?T.push(h):!e[m]&&T.indexOf(h)>-1?T.splice(T.indexOf(h),1):m==="metaKey"&&e[m]&&T.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(T=T.slice(T.indexOf(h))))}),n in B){for(var o in B[n]=!0,W)W[o]===n&&(U[o]=!0);if(!t)return}for(var r in B)Object.prototype.hasOwnProperty.call(B,r)&&(B[r]=e[st[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(T.indexOf(17)===-1&&T.push(17),T.indexOf(18)===-1&&T.push(18),B[17]=!0,B[18]=!0);var s=Se();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)&&Lt(e,t[i],s,a);if(n in O){for(var d=0;d<O[n].length;d++)if((e.type==="keydown"&&O[n][d].keydown||e.type==="keyup"&&O[n][d].keyup)&&O[n][d].key){for(var p=O[n][d],C=p.splitKey,g=p.key.split(C),u=[],c=0;c<g.length;c++)u.push(Ve(g[c]));u.sort().join("")===T.sort().join("")&&Lt(e,p,s,a)}}}}function U(e,a,t){T=[];var n=_a(e),o=[],r="all",s=document,i=0,d=!1,p=!0,C="+",g=!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&&(d=a.keyup),a.keydown!==void 0&&(p=a.keydown),a.capture!==void 0&&(g=a.capture),typeof a.splitKey=="string"&&(C=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(C)).length>1&&(o=Ca(W,e)),(e=(e=e[e.length-1])==="*"?"*":Ve(e))in O||(O[e]=[]),O[e].push({keyup:d,keydown:p,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:C,element:s});s!==void 0&&!function(u){return Rt.indexOf(u)>-1}(s)&&window&&(Rt.push(s),Xe(s,"keydown",function(u){Mt(u,s)},g),Bt||(Bt=!0,Xe(window,"focus",function(){T=[]},g)),Xe(s,"keyup",function(u){Mt(u,s),function(c){var m=c.keyCode||c.which||c.charCode,h=T.indexOf(m);if(h>=0&&T.splice(h,1),c.key&&c.key.toLowerCase()==="meta"&&T.splice(0,T.length),m!==93&&m!==224||(m=91),m in B)for(var f in B[m]=!1,W)W[f]===m&&(U[f]=!1)}(u)},g))}var et={setScope:jt,getScope:Se,deleteScope:function(e,a){var t,n;for(var o in e||(e=Se()),O)if(Object.prototype.hasOwnProperty.call(O,o))for(t=O[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Se()===e&&jt(a||"all")},getPressedKeyCodes:function(){return T.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=Ve(e)),T.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(O).forEach(function(t){var n=O[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(O).forEach(function(s){return delete O[s]});else if(Array.isArray(e))e.forEach(function(s){s.key&&We(s)});else if(typeof e=="object")e.key&&We(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=""),We({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Ct,modifier:W,modifierMap:st};for(var tt in et)Object.prototype.hasOwnProperty.call(et,tt)&&(U[tt]=et[tt]);if(typeof window<"u"){var es=window.hotkeys;U.noConflict=function(e){return e&&window.hotkeys===U&&(window.hotkeys=es),U},window.hotkeys=U}U.filter=function(){return!0};var Ut=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function ts(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,d=o.keydown,p=o.filterPreventDefault,C=p===void 0||p,g=o.enabled,u=g===void 0||g,c=o.enableOnContentEditable,m=c!==void 0&&c,h=b.useRef(null),f=b.useCallback(function(k,y){var _,A;return s&&!s(k)?!C:!!(Ut(k,["INPUT","TEXTAREA","SELECT"])&&!Ut(k,r)||(_=k.target)!=null&&_.isContentEditable&&!m)||!!(h.current===null||document.activeElement===h.current||(A=h.current)!=null&&A.contains(document.activeElement))&&(a(k,y),!0)},n?[h,r,s].concat(n):[h,r,s]);return b.useEffect(function(){if(u)return i&&d!==!0&&(t.keydown=!1),U(e,t||{},f),function(){return U.unbind(e,f)};U.unbind(e,f)},[f,e,u]),h}U.isPressed;const as=["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"],ns=(e,a,t,n,o)=>({card:{dimension:ht(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!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}),_e=(e,a,t,n,o)=>({card:{dimension:ht(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1},data:e}),os=(e,a,t,n)=>_e(void 0,e,ke,a,t),ss=(e,a,t,n,o)=>({card:{dimension:ht(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1},data:{funds:n,hasUserSeenVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),rs=H(function(e,a){const t=ls(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:d,hasUserSeenTreasuryVideo:p,treasuryFetchState:C}=a;let g=n.map((u,c)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return os(t,u,c);if(u==="zeni_promo_card")return _e({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,c);if(u==="treasury_promo_card")return ss(C,u,c,d,p);if(u==="information_card")return _e(void 0,"Completed",ke,u,c);{const m=o.find(h=>h?.reportId===u);return m?function(h,f,k,y){const _=h.reportId;switch(_){case"card_balance":case"cash_balance":return[ns(h,f,k,_,y)];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[_e(h,f,k,_,y)];case"net_burn_or_income_story_card":return[_e(h,f,k,"net_burn_or_income_story_card",y)];default:return console.error(`card type ${_} not yet supported!`),[]}}(m,m.fetchState,ke,c):[]}}).flat();return a.isSummaryCardsFiltered===!0&&(g=g.filter(u=>as.includes(u.card.cardType)==0).filter(u=>{const c=u.data?.availableNumberOfPeriods;return c!=null?c>0:u.card.cardType!="top_expenses"||u.data==null||function(m){if(m==null||m.length===0)return!0;let h=!0;for(const f of m)if(f.balance.available.amount!==0){h=!1;break}return h}(u.data.topExpenses.accountsOrdered)===!1})),{cardDataArray:g,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ee(e,"navbar")},analytics:I,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}},function(e,a){const t=a.tenantId,n=R.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)I.trackDashboardCardClicked("cards promo",2),I.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&&I.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(I.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,d,p,C){switch(d){case"card_balance":i($t());break;case"cash_balance":i(Gt());break;case"operating_expenses":i(ia(!0));break;case"revenue":i(ra(!0));break;case"net_burn_or_income":i(sa(!0));break;case"net_burn_or_income_story_card":i(Jn(!0));break;case"cash_position":i(oa(!0));break;case"top_expenses":i(na());break;case"cash_in_cash_out":i(aa());break;case"insights_dashboard":i(Hn());break;case"bill_pay_card":i(Zn());break;case"reimbursement_card":i(qn());break;case"company_details":i(zn(p));break;case"task_card":i($n());break;case"accounts_payable_aging":C.includes("accounts_payable_aging")===!1&&i(nt(ue()));break;case"accounts_receivable_aging":i(ot(ue()));break;case"zeni_accounts_promo_card":C.includes("zeni_accounts_promo_card")===!1&&i(Kt());break;case"rewards_card":C.includes("rewards_card")===!1&&i(Kn(!0));break;default:throw new Error(`report type ${d} is not yet supported`)}}(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{I.trackTimeframeSwitch(fa(r),cs(o),"Dashboard"),function(s,i,d){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(me(d));break;case"top_expenses":s(ta(d));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}}(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(Gn(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){R.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"&&(I.trackUpdateBurnRateCalculatorSettings(r,s,Vn(s)),e(Nn(t,r,s)))},onVideoPlay:()=>{e(Ot())},onVideoClose:()=>{e(Ot()),e(Yn())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(te({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(Z("navbar"))},onCancelAutoComplete:()=>{e(Z("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ne(o,a.tenantEmailDomain):bo(o.zeniId,o.qboId,a.tenantEmailDomain);const s=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}})(go);function is(){const{isAiCfoOpen:e,setIsAiCfoOpen:a}=da(),t=q(),n=G(),o=z(),r=R.getSignedInUser(),{useFeatureGate:s,useDynamicConfig:i}=Ye(),d=Ae(r),[p,C]=b.useState(!1),[g,u]=b.useState(!1),c=ua(),{tenantEmailDomain:m}=K(),{isAiCfoAccessEnabled:h,onAskAiCfoClick:f}=Q({mobileExploreReferrer:"Dashboard"}),k=S(v=>v.tenantState.fetchState==="Completed"||v.tenantState.activeTenantFetchState.fetchState==="Completed"?j(v):void 0),y=k??R.getSignedInUserTenant(m),_=y.tenantId,A=y.companyId;b.useEffect(()=>{p===!1&&o.state?.message==="activation"&&(n(Pn(A)),C(!0))},[o.state,p,A,n]),b.useEffect(()=>{c&&!g&&o.state?.message==="open_ai_cfo_drawer"&&(a(!0),u(!0),t(o.pathname,{replace:!0,state:{...o.state,message:void 0}}))},[o.state,g,c,a,t,o.pathname]);const{isFeatureEnabled:E}=s(L.isApAgingFeatureEnabled),{isFeatureEnabled:M}=s(L.isExpenseAutomationEnabled),{isFeatureEnabled:F}=s(L.isExpenseAutomationEnabledV2),x=F||M&&d,{isFeatureEnabled:P}=s(L.isTreasuryEnabled),fe=po(x),{isFeatureEnabled:ge}=s(L.isArAgingFeatureEnabled),{isFeatureEnabled:Oe}=s(L.isDepositAccountsFeatureEnabled),{isFeatureEnabled:_t}=s(L.isReferralFeatureEnabled),{isFeatureEnabled:Sa}=s(L.isChargeCardFeatureEnabled),{isFeatureEnabled:ya}=s(L.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Aa}=s(L.isDashboardSidebarNewYearAnimationEnabled),{configValue:kt}=i(ma.zeniCardsConfig),va=kt.charge_card_cashback_rate_per_transaction==null?.0175:kt.charge_card_cashback_rate_per_transaction;if(o.state?.message==="activation"){const v=ho(o.state?.pathnameStackToGoBack);t(o.pathname,{state:{...o.state,message:void 0,pathnameStackToGoBack:v.newStack}})}const[St,Ia]=b.useState(!1),[Ne,Ea]=b.useState(!1);ts("command+p, Control+p",v=>{Ea(!Ne),v.preventDefault()},{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[Ne]);const yt=k?.externalConnections?.accounting[0]?.isValid;if(r==null)throw Error("Can't access dashboard without signing in...");const oe=S(v=>j(v)?.excludedResources),xa=S(v=>v.expenseAutomationViewState.selectedPeriodByTenantId),Ta=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,wa=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,Da=S(v=>v.treasurySetupViewState.treasuryFundsDetails).fetchStatus.fetchState,Fa=k?.company!=null&&Bn(k.company),Ge=P&&Fa,Ke=Te(),Oa=rt(Ke?.loggedInUserRoleMap),Y=[],At=oe?.resources?.find(v=>v.resource==="/reports/top_expenses")==null,Pa=oe?.resources?.find(v=>v.resource==="/reports/task_card")==null,$e=k?.userRole!=null&&Xt(k?.userRole),Ba=oe?.resources?.find(v=>v.resource==="/bills")==null&&!$e,Ra=oe?.resources?.find(v=>v.resource==="/reimbursements")==null,ja=Rn(Ke?.loggedInUserRoleMap),La=jn(Ke?.loggedInUserRoleMap),Ma=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,Ua=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,Ya=S(v=>v.treasurySetupViewState.treasuryFundsDetails).fundsDetails;At===!1&&Y.push("top_expenses"),Pa===!1&&Y.push("task_card"),Ba===!1&&Y.push("bill_pay_card","bill_pay_promo_card"),E===!1&&Y.push("accounts_payable_aging"),ge===!1&&Y.push("accounts_receivable_aging"),(x===!1||$e)&&Y.push("expense_automation_card"),Ra===!1&&Y.push("reimbursement_card","reimbursement_promo_card"),Oe===!1&&Y.push("zeni_accounts_promo_card"),_t===!1&&Y.push("rewards_card"),Ge===!1&&Y.push("treasury_promo_card");const{areTenantIdsInSync:vt}=fo();b.useLayoutEffect(()=>{St&&fe===x||yt!==!0||!vt||oe?.fetchState!=="Completed"&&oe?.fetchState!=="Error"||(Ia(!0),n(Ln(r.userId,A,_,!0,!1,Y)))},[St,r,_,n,At,yt,oe?.fetchState,vt]);const Va=S(v=>v.reportUIOptionsState.forecastOnDashboard.isForecastModeOn),Na=S(v=>v.revenueState.uiState.selectedForecast?.id),Ga=S(v=>v.cardBalanceState.fetchState),ce=S(v=>Mn(v,Y,r,F,M,Ge)),Ka=ce.fetchState;we({isDataReady:!0});const It=k?.isTreasuryVideoViewed===!0||ce.isTreasuryVideoClosed===!0;return l.jsxs(l.Fragment,{children:[Ka==="Completed"?l.jsx(xe,{analytics:I,onLoad:v=>{v.trackPageLoaded(V.Event.dashboard),Ge&&!It&&v.trackTreasuryPromoView("Dashboard Promo Video")}}):null,l.jsx(rs,{maxColumns:e?2:void 0,isAiCfoAccessEnabled:h,onAskAiCfoClick:f,onDragAndDropCard:(v,$a)=>{const Et=function(Pe,ze,Be){const qe=Be.indexOf(Pe),Ze=Be.indexOf(ze);if(qe===-1||Ze===-1||qe===Ze)return Be;const He=[...Be];return He.splice(qe,1),He.splice(Ze,0,Pe),He}(v,$a,ce.cardsOrdered);Et.some((Pe,ze)=>Pe!==ce.cardsOrdered[ze])&&n(Un(Et))},dashboardReport:ce,passedCardsOrdered:ce.cardsForDashboardUI,tenantId:_,companyId:A,tenantEmailDomain:m,location:o,navigate:t,isApAgingFeatureEnabled:E,isArAgingFeatureEnabled:ge,isBillPayEnabled:wa,isReimbursementEnabled:Ta,isSummaryCardsFiltered:Ne,isForecastOn:Va,selectedForecastOnDashboard:Na,isVisitingFirstTime:p,isZeniAccountEnabled:Oe,isRewardsFeatureEnabled:_t,hasZeniAccountsAdminAccess:Oa,isExpenseAutomationEnabledForUser:x&&$e===!1,selectedPeriod:xa[_],isChargeCardFeatureEnabled:Sa,isUserHasCardsAccess:ja,isUserHasTreasuryAccess:La,cardsCreditLimit:Ma,cashbackRate:va,isInterestedInChargeCard:Ua,cardBalanceFetchState:Ga,christmasAnimationEnabled:ya,newYearAnimationEnabled:Aa,treasuryFundDetails:Ya,hasUserSeenTreasuryVideo:It,treasuryFetchState:Da})]})}const cs=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"},ls=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map(a=>a.fetchState).reduce((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t);function Ls(){const e=Te(),a=e?.excludedResources?.find(p=>p.resource==="/reports/top_expenses")==null,{useFeatureGate:t}=Ye(),{isFeatureEnabled:n}=t(L.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(L.isArAgingFeatureEnabled),r=S(p=>j(p)),{isFeatureEnabled:s}=t(L.isDebitCardFeatureEnabled),i=Qn(s,r),d=Xn(r);return i===!0||d===!0?l.jsx(at,{children:l.jsx(w,{path:"/*",element:l.jsx(ko,{})})}):l.jsxs(at,{children:[l.jsx(w,{path:"/",element:l.jsx(is,{})}),l.jsx(w,{path:"cash_balance/*",element:l.jsx(Pt,{})}),l.jsx(w,{path:"card_balance/*",element:l.jsx(Pt,{})}),l.jsx(w,{path:"operating_expenses/*",element:l.jsx(X,{})}),l.jsx(w,{path:"operating_expenses/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"revenue/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"revenue/*",element:l.jsx(X,{})}),l.jsx(w,{path:"net_burn_or_income/forecast/*",element:l.jsx(Je,{})}),l.jsx(w,{path:"net_burn_or_income/*",element:l.jsx(X,{})}),n===!0&&l.jsxs(l.Fragment,{children:[l.jsx(w,{path:"accounts_payable_aging/*",element:l.jsx(Ao,{})}),l.jsx(w,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:l.jsx(yo,{})})]}),o&&l.jsxs(l.Fragment,{children:[l.jsx(w,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:l.jsx(vo,{})}),l.jsx(w,{path:"accounts_receivable_aging/*",element:l.jsx(Io,{})})]}),l.jsx(w,{path:"cash_position/*",element:l.jsx(X,{})}),l.jsx(w,{path:"top_expenses/*",element:a===!0?l.jsx(X,{}):l.jsx(ye,{})}),l.jsx(w,{path:"cash_in_cash_out/*",element:l.jsx(X,{})}),l.jsx(w,{path:"company_details",element:l.jsx(_o,{})}),l.jsx(w,{path:"referrals/*",element:l.jsx(So,{})}),l.jsx(w,{path:"*",element:l.jsx(ye,{})})]})}export{Ls as default};
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-CF908iAG.js";import{a as u}from"./sentry-cfxuOFew.js";import{h as y,g as b,k as w,u as A,N}from"./core-Cgen4kAj.js";import{Ig as k,eN as _,fi as U,Ih as L,ml as R,Ii as z}from"./zeni-epic-state-DrGehtra.js";import{u as O,z as f,L as T,t as S,D as $,b as j}from"./index-trlF__w8.js";import"./mui-C7dUqSqV.js";import{t as P}from"./getLocaleForTenant-Di1C7dV7.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.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]="25aa12d1-2af3-4507-9532-9acbfc7286e2",t._sentryDebugIdIdentifier="sentry-dbid-25aa12d1-2af3-4507-9532-9acbfc7286e2")}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,I=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,I=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(N,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:I}})}});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=>k(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&&S.shouldFetchActiveTenant(e)&&(h.current=!0,S.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(U(d.userId,e))))},[n,a,d,t]),u.useEffect(()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,I=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&I&&S.shouldFetchAllTenants()&&(r.current=!0,S.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(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||($.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-DytGFyho.js";import{a as u}from"./sentry-YlBgF13X.js";import{h as y,g as b,k as w,u as A,N}from"./core-BRYqCMzm.js";import{Ig as k,eN as _,fi as U,Ih as L,ml as R,Ii as z}from"./zeni-epic-state-B6DxGTeH.js";import{u as O,z as f,L as T,t as S,D as $,b as j}from"./index-akX3Nhym.js";import"./mui-dDGLzwM4.js";import{t as P}from"./getLocaleForTenant-kMn_Tpi1.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.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]="25aa12d1-2af3-4507-9532-9acbfc7286e2",t._sentryDebugIdIdentifier="sentry-dbid-25aa12d1-2af3-4507-9532-9acbfc7286e2")}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,I=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,I=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(N,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:I}})}});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=>k(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&&S.shouldFetchActiveTenant(e)&&(h.current=!0,S.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(U(d.userId,e))))},[n,a,d,t]),u.useEffect(()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,I=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&I&&S.shouldFetchAllTenants()&&(r.current=!0,S.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(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||($.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-CF908iAG.js";import{j as w,u as C,g as h,k as A,l as B}from"./core-Cgen4kAj.js";import{Mc as k,Mj as _,fz as q,fy as J,fx as K,im as L,Jk as W,pv as Q,eN as V,LK as D,ik as T,Md as v,Mm as F,ii as G,iG as j}from"./zeni-epic-state-DrGehtra.js";import{bn as X,q as N,a as R,z as U,h as z,n as p,p as S,B as M,bo as Y,o as O,bp as ee,s as te}from"./index-trlF__w8.js";import{n as Z}from"./mui-C7dUqSqV.js";import"./sentry-cfxuOFew.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]="4b4fe287-e835-44a5-b5d4-8eb052fe894a",e._sentryDebugIdIdentifier="sentry-dbid-4b4fe287-e835-44a5-b5d4-8eb052fe894a")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(L(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(W("common")),n!=null&&e(Q(n))},onGetOtp:n=>{e(K(n,"BillPayVendor"))},onResendOtp:n=>{e(J(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(q(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}})(X);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h(i=>k(i,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=Z.div`
1
+ import{j as l}from"./liveblocks-DytGFyho.js";import{j as w,u as C,g as h,k as A,l as B}from"./core-BRYqCMzm.js";import{Mc as k,Mj as _,fz as q,fy as J,fx as K,im as L,Jk as W,pv as Q,eN as V,LK as D,ik as T,Md as v,Mm as F,ii as G,iG as j}from"./zeni-epic-state-B6DxGTeH.js";import{bn as X,q as N,a as R,z as U,h as z,n as p,p as S,B as M,bo as Y,o as O,bp as ee,s as te}from"./index-akX3Nhym.js";import{n as Z}from"./mui-dDGLzwM4.js";import"./sentry-YlBgF13X.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]="4b4fe287-e835-44a5-b5d4-8eb052fe894a",e._sentryDebugIdIdentifier="sentry-dbid-4b4fe287-e835-44a5-b5d4-8eb052fe894a")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(L(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(W("common")),n!=null&&e(Q(n))},onGetOtp:n=>{e(K(n,"BillPayVendor"))},onResendOtp:n=>{e(J(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(q(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}})(X);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h(i=>k(i,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=Z.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as d}from"./liveblocks-CF908iAG.js";import{q as c,F as l,h as f}from"./index-trlF__w8.js";import{D as p}from"./mui-C7dUqSqV.js";import"./sentry-cfxuOFew.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]="c1596a17-76c2-42f3-a2e3-6afe5c51b156",e._sentryDebugIdIdentifier="sentry-dbid-c1596a17-76c2-42f3-a2e3-6afe5c51b156")}catch{}})();const u={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:a,onClose:t}=e,n=c(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),i=f();return d.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:a})}export{h as D};
1
+ import{j as d}from"./liveblocks-DytGFyho.js";import{q as c,F as l,h as f}from"./index-akX3Nhym.js";import{D as p}from"./mui-dDGLzwM4.js";import"./sentry-YlBgF13X.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]="c1596a17-76c2-42f3-a2e3-6afe5c51b156",e._sentryDebugIdIdentifier="sentry-dbid-c1596a17-76c2-42f3-a2e3-6afe5c51b156")}catch{}})();const u={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:a,onClose:t}=e,n=c(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),i=f();return d.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:a})}export{h as D};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-CF908iAG.js";import{a as d}from"./sentry-cfxuOFew.js";import{j as A,h as B,u as J,l as q,g as l,N,k as F,n as W,o as _}from"./core-Cgen4kAj.js";import{Kr as z,eN as O,JQ as K,kq as M,Gz as b,Kw as R,Jj as V,jq as Y,GA as S,JV as $,JW as Q,Jl as H,Jk as L}from"./zeni-epic-state-DrGehtra.js";import{aN as U,d as X,n as Z,s as tt}from"./index-trlF__w8.js";import"./mui-C7dUqSqV.js";import{d as k}from"./decodeURIComponentSafe-DztnZ-A4.js";import{w as et}from"./withTransactionSidePanel-Dq1wepy8.js";import{e as at,b as nt}from"./routePaths-CqnfURaJ.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.js";import"./useAskAiCfoHostNavButtonProps-C2mAQ-5p.js";import"./useFetchSuggestedQuestionsWhenReady-B5mF_k6O.js";import"./TransactionDetailScreen-DB2dMdqL.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="4753b5b3-c3d4-4a8f-a914-49f973fc624b",a._sentryDebugIdIdentifier="sentry-dbid-4753b5b3-c3d4-4a8f-a914-49f973fc624b")}catch{}})();const ot=F(function(a,t){const e=t.entity,o=R(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:V(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:Y(a)}},function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a($()),a(Q()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}})(U),it=et(function({entityType:a,...t}){const e=A(),o=B(),c=J(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:j,entityNameEncoded:w}=q(),r=k(j??""),p=k(w??""),f=rt(r,p),x=[r,p].filter(n=>n!=null),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l(n=>z(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter")),G=l(n=>O(n).company?.companyInfo.firstMonthOfFY??1),u=l(n=>K(n.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&f===!0&&(T(!0),o(M(i)))},[m,f,i]);const E=l(n=>n.trendState.fetchState),P=u?.selectedPeriod?.timePeriod??g,v=function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y}(u?.selectedPeriod?.timePeriod,g);return d.useEffect(()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))},[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:G,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(N,{to:I(x.length)})}),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function wt({entityType:a}){return s.jsx(W,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{wt as EntityDetailRoutes,wt as default};
1
+ import{j as s}from"./liveblocks-DytGFyho.js";import{a as d}from"./sentry-YlBgF13X.js";import{j as A,h as B,u as J,l as q,g as l,N,k as F,n as W,o as _}from"./core-BRYqCMzm.js";import{Kr as z,eN as O,JQ as K,kq as M,Gz as b,Kw as R,Jj as V,jq as Y,GA as S,JV as $,JW as Q,Jl as H,Jk as L}from"./zeni-epic-state-B6DxGTeH.js";import{aN as U,d as X,n as Z,s as tt}from"./index-akX3Nhym.js";import"./mui-dDGLzwM4.js";import{d as k}from"./decodeURIComponentSafe-VG11krJk.js";import{w as et}from"./withTransactionSidePanel-DlSxH_1I.js";import{e as at,b as nt}from"./routePaths-CXvFM1Km.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.js";import"./useAskAiCfoHostNavButtonProps-Drf4spg5.js";import"./useFetchSuggestedQuestionsWhenReady-vaYDsXnK.js";import"./TransactionDetailScreen-k-8yhupk.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="4753b5b3-c3d4-4a8f-a914-49f973fc624b",a._sentryDebugIdIdentifier="sentry-dbid-4753b5b3-c3d4-4a8f-a914-49f973fc624b")}catch{}})();const ot=F(function(a,t){const e=t.entity,o=R(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:V(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:Y(a)}},function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a($()),a(Q()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}})(U),it=et(function({entityType:a,...t}){const e=A(),o=B(),c=J(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:j,entityNameEncoded:w}=q(),r=k(j??""),p=k(w??""),f=rt(r,p),x=[r,p].filter(n=>n!=null),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l(n=>z(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter")),G=l(n=>O(n).company?.companyInfo.firstMonthOfFY??1),u=l(n=>K(n.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&f===!0&&(T(!0),o(M(i)))},[m,f,i]);const E=l(n=>n.trendState.fetchState),P=u?.selectedPeriod?.timePeriod??g,v=function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y}(u?.selectedPeriod?.timePeriod,g);return d.useEffect(()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))},[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:G,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(N,{to:I(x.length)})}),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function wt({entityType:a}){return s.jsx(W,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{wt as EntityDetailRoutes,wt as default};
@@ -1,4 +1,4 @@
1
- import{j as C}from"./liveblocks-CF908iAG.js";import wn from"./NotFoundScreen-DXPtR234.js";import{a as o,b as Tt}from"./sentry-cfxuOFew.js";import{n as De,S as xn}from"./mui-C7dUqSqV.js";import{h as se,j as wt,u as qe,g as F,k as Rn,l as rt,n as Dn,o as je}from"./core-Cgen4kAj.js";import{eN as we,OK as Un,mv as Ce,fd as Fn,q6 as On,mN as xt,n6 as Rt,OL as Dt,ng as Bn,OM as Ut,mG as _n,pE as Vn,eY as he,ON as xe,s5 as Ft,Bg as Ot,OO as Bt,OP as Mn,pj as Ge,Ks as dt,Ku as jn,jt as zn,Kv as Ln,jA as $n,cU as qn,t8 as Je,jq as Gn,mT as _t,nl as Re,OQ as Jn,Jl as ut,Jk as Ae,OR as mt,jR as Nn,OS as Yn,OT as Kn,OU as Wn,OV as Zn,m_ as Hn,mL as ce,no as Pe,OW as Qn,OX as Xn,OY as ea,nv as ta,jE as na,jv as aa,OZ as oa,jD as ht,KC as sa,O_ as ca,O$ as ia,pf as la,oW as ra,nm as pe,oV as ze,P0 as da,P1 as ua,l8 as ma,bq as ha,l3 as pt,kR as pa,P2 as ga,gC as gt,fP as Ca,l0 as Sa,v1 as Ia,P3 as fa,nW as ka,nR as Ea,nV as va,nG as ya,P4 as ba,e$ as Vt,n9 as Aa,mW as Pa,fe as Ct,nq as Ta,P5 as wa,nn as Mt,P6 as xa,P7 as Ra,P8 as Da,P9 as Ua,Pa as St,pr as Fa,oM as Oa,Jj as Ba,jC as _a,Pb as Va,FA as Ma,jB as ja,e_ as za,ol as jt,oE as La,nk as It,np as $a,bC as qa,kZ as Ga,kW as Ja,Pc as Na,nF as ft,oC as kt,oA as Ya,oq as Ka,o5 as Wa,oD as Za,Pd as Ha,Pe as Qa,o9 as Xa,Pf as eo,n$ as to,o8 as no,o6 as ao,oH as oo}from"./zeni-epic-state-DrGehtra.js";import{a as zt,p as ge,d as z,s as H,M as Lt,cu as so,z as Ue,cv as co,ap as Te,cw as io,aP as Et,B as $t,cx as lo,am as Le,D as ro,cy as uo,Q as mo,cz as ho,K as po,cA as go,cB as Co,v as So,j as Io,aJ as fo,b1 as ko,F as Eo,cC as vo}from"./index-trlF__w8.js";import{u as qt}from"./useAskAiCfoHostNavButtonProps-C2mAQ-5p.js";import{c as Gt}from"./useFetchSuggestedQuestionsWhenReady-B5mF_k6O.js";import{c as vt,C as yo}from"./TransactionDetailScreen-DB2dMdqL.js";import{w as bo}from"./withTransactionSidePanel-Dq1wepy8.js";import{h as Ao,v as Po}from"./routePaths-CqnfURaJ.js";import{g as $e}from"./accountMappingHelper-Bqj2mJfi.js";import{D as To}from"./DrawerScreen-BWViotCB.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.js";import"./decodeURIComponentSafe-DztnZ-A4.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="4b795ee8-3e7a-4ba1-9cac-1cb558d7b68e",t._sentryDebugIdIdentifier="sentry-dbid-4b795ee8-3e7a-4ba1-9cac-1cb558d7b68e")}catch{}})();const wo=()=>{const t=se(),l=wt(),P=qe(),f=F(d=>we(d)),{useFeatureGate:b}=zt(),{isFeatureEnabled:S}=b(ge.isRealtimeInsightsFeatureEnabled),s=F(d=>d.expenseAutomationViewState.selectedPeriodByTenantId),i=F(d=>Un(d,f.tenantId)),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=qt({mobileExploreReferrer:"Month-End Close Overview"}),E=o.useCallback((d,w,Z=!1)=>{t(Ce({tenantId:w,period:{month:d.month,year:d.year},refreshViewInBackground:Z}))},[]),v=o.useCallback(d=>{const w=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&z.trackMonthCloseAuditPage(d.month,d.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,w??null),t(Fn(f.tenantId,d))},[f.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),h=s[f.tenantId],O=o.useCallback(()=>{const d=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&z.trackMonthCloseAuditPage(h.month,h.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,d??null),E(h,f.tenantId,!0)},[E,h,f.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),u=H(P.state?.pathnameStackToGoBack,P.pathname),g=o.useCallback(()=>{if(i.monthEndCloseChecks!=null&&h!=null){const d=i.monthEndCloseChecks.monthEndCloseCheckList.find(w=>w.progress<100);if(d!=null)return void l(`./${d.id}/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview"}});l(`./month_end_insights/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview"}})}},[i.monthEndCloseChecks,h]),{areTenantIdsInSync:T}=Lt();return Gt({isDataReady:i.fetchState==="Completed"}),o.useEffect(()=>{h!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&T&&E(h,f.tenantId)},[E,h,i.fetchState,f.tenantId,T]),o.useEffect(()=>{h!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&T&&t(On(h))},[h,i.monthClosePerformanceTrendFetchStatus.fetchState,T]),o.useEffect(()=>{const d=setInterval(()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&O()},3e5);return()=>clearInterval(d)},[i.fetchState]),o.useEffect(()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const d=P.state?.referrer;z.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null)}},[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),C.jsx(xo,{children:C.jsx(so,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:S,onMonthEndCheckClick:d=>{l(`./${d}/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:v,handleReviewButtonClick:g,onBackClick:()=>{l("../../dashboard")},onReload:O,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})})},xo=De.div`
1
+ import{j as C}from"./liveblocks-DytGFyho.js";import wn from"./NotFoundScreen-DYSe2Mdv.js";import{a as o,b as Tt}from"./sentry-YlBgF13X.js";import{n as De,S as xn}from"./mui-dDGLzwM4.js";import{h as se,j as wt,u as qe,g as F,k as Rn,l as rt,n as Dn,o as je}from"./core-BRYqCMzm.js";import{eN as we,OK as Un,mv as Ce,fd as Fn,q6 as On,mN as xt,n6 as Rt,OL as Dt,ng as Bn,OM as Ut,mG as _n,pE as Vn,eY as he,ON as xe,s5 as Ft,Bg as Ot,OO as Bt,OP as Mn,pj as Ge,Ks as dt,Ku as jn,jt as zn,Kv as Ln,jA as $n,cU as qn,t8 as Je,jq as Gn,mT as _t,nl as Re,OQ as Jn,Jl as ut,Jk as Ae,OR as mt,jR as Nn,OS as Yn,OT as Kn,OU as Wn,OV as Zn,m_ as Hn,mL as ce,no as Pe,OW as Qn,OX as Xn,OY as ea,nv as ta,jE as na,jv as aa,OZ as oa,jD as ht,KC as sa,O_ as ca,O$ as ia,pf as la,oW as ra,nm as pe,oV as ze,P0 as da,P1 as ua,l8 as ma,bq as ha,l3 as pt,kR as pa,P2 as ga,gC as gt,fP as Ca,l0 as Sa,v1 as Ia,P3 as fa,nW as ka,nR as Ea,nV as va,nG as ya,P4 as ba,e$ as Vt,n9 as Aa,mW as Pa,fe as Ct,nq as Ta,P5 as wa,nn as Mt,P6 as xa,P7 as Ra,P8 as Da,P9 as Ua,Pa as St,pr as Fa,oM as Oa,Jj as Ba,jC as _a,Pb as Va,FA as Ma,jB as ja,e_ as za,ol as jt,oE as La,nk as It,np as $a,bC as qa,kZ as Ga,kW as Ja,Pc as Na,nF as ft,oC as kt,oA as Ya,oq as Ka,o5 as Wa,oD as Za,Pd as Ha,Pe as Qa,o9 as Xa,Pf as eo,n$ as to,o8 as no,o6 as ao,oH as oo}from"./zeni-epic-state-B6DxGTeH.js";import{a as zt,p as ge,d as z,s as H,M as Lt,cu as so,z as Ue,cv as co,ap as Te,cw as io,aP as Et,B as $t,cx as lo,am as Le,D as ro,cy as uo,Q as mo,cz as ho,K as po,cA as go,cB as Co,v as So,j as Io,aJ as fo,b1 as ko,F as Eo,cC as vo}from"./index-akX3Nhym.js";import{u as qt}from"./useAskAiCfoHostNavButtonProps-Drf4spg5.js";import{c as Gt}from"./useFetchSuggestedQuestionsWhenReady-vaYDsXnK.js";import{c as vt,C as yo}from"./TransactionDetailScreen-k-8yhupk.js";import{w as bo}from"./withTransactionSidePanel-DlSxH_1I.js";import{h as Ao,v as Po}from"./routePaths-CXvFM1Km.js";import{g as $e}from"./accountMappingHelper-DA7klO76.js";import{D as To}from"./DrawerScreen-Bgl100Ik.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.js";import"./decodeURIComponentSafe-VG11krJk.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="4b795ee8-3e7a-4ba1-9cac-1cb558d7b68e",t._sentryDebugIdIdentifier="sentry-dbid-4b795ee8-3e7a-4ba1-9cac-1cb558d7b68e")}catch{}})();const wo=()=>{const t=se(),l=wt(),P=qe(),f=F(d=>we(d)),{useFeatureGate:b}=zt(),{isFeatureEnabled:S}=b(ge.isRealtimeInsightsFeatureEnabled),s=F(d=>d.expenseAutomationViewState.selectedPeriodByTenantId),i=F(d=>Un(d,f.tenantId)),{isAiCfoAccessEnabled:p,onAskAiCfoClick:m}=qt({mobileExploreReferrer:"Month-End Close Overview"}),E=o.useCallback((d,w,Z=!1)=>{t(Ce({tenantId:w,period:{month:d.month,year:d.year},refreshViewInBackground:Z}))},[]),v=o.useCallback(d=>{const w=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&z.trackMonthCloseAuditPage(d.month,d.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,w??null),t(Fn(f.tenantId,d))},[f.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),h=s[f.tenantId],O=o.useCallback(()=>{const d=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&z.trackMonthCloseAuditPage(h.month,h.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,d??null),E(h,f.tenantId,!0)},[E,h,f.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),u=H(P.state?.pathnameStackToGoBack,P.pathname),g=o.useCallback(()=>{if(i.monthEndCloseChecks!=null&&h!=null){const d=i.monthEndCloseChecks.monthEndCloseCheckList.find(w=>w.progress<100);if(d!=null)return void l(`./${d.id}/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview"}});l(`./month_end_insights/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview"}})}},[i.monthEndCloseChecks,h]),{areTenantIdsInSync:T}=Lt();return Gt({isDataReady:i.fetchState==="Completed"}),o.useEffect(()=>{h!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&T&&E(h,f.tenantId)},[E,h,i.fetchState,f.tenantId,T]),o.useEffect(()=>{h!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&T&&t(On(h))},[h,i.monthClosePerformanceTrendFetchStatus.fetchState,T]),o.useEffect(()=>{const d=setInterval(()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&O()},3e5);return()=>clearInterval(d)},[i.fetchState]),o.useEffect(()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const d=P.state?.referrer;z.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null)}},[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),C.jsx(xo,{children:C.jsx(so,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:S,onMonthEndCheckClick:d=>{l(`./${d}/${h.month}-${h.year}`,{state:{pathnameStackToGoBack:u,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:v,handleReviewButtonClick:g,onBackClick:()=>{l("../../dashboard")},onReload:O,isAiCfoAccessEnabled:p,onAskAiCfoClick:m})})},xo=De.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-CF908iAG.js";import{a as r}from"./sentry-cfxuOFew.js";import{X as d,$ as f,Y as l,n as p}from"./index-trlF__w8.js";import"./mui-C7dUqSqV.js";import m from"./NotFoundScreen-DXPtR234.js";import{j as b,u}from"./core-Cgen4kAj.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]="5756ab27-5acf-4dc2-a3b1-97ebf5c204a5",e._sentryDebugIdIdentifier="sentry-dbid-5756ab27-5acf-4dc2-a3b1-97ebf5c204a5")}catch{}})();const D=()=>{const e=b(),a=u(),t=r.useCallback(()=>{window.open("https://www.zeni.ai/demo/request","_blank")},[]),c=r.useCallback(()=>{(()=>{const n=p(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()},[]),o=d(a.pathname);return o!=null?s.jsx(f,{menuItem:l(o),onDemoClick:t,onGoBack:c}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{D as F};
1
+ import{j as s}from"./liveblocks-DytGFyho.js";import{a as r}from"./sentry-YlBgF13X.js";import{X as d,$ as f,Y as l,n as p}from"./index-akX3Nhym.js";import"./mui-dDGLzwM4.js";import m from"./NotFoundScreen-DYSe2Mdv.js";import{j as b,u}from"./core-BRYqCMzm.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]="5756ab27-5acf-4dc2-a3b1-97ebf5c204a5",e._sentryDebugIdIdentifier="sentry-dbid-5756ab27-5acf-4dc2-a3b1-97ebf5c204a5")}catch{}})();const D=()=>{const e=b(),a=u(),t=r.useCallback(()=>{window.open("https://www.zeni.ai/demo/request","_blank")},[]),c=r.useCallback(()=>{(()=>{const n=p(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()},[]),o=d(a.pathname);return o!=null?s.jsx(f,{menuItem:l(o),onDemoClick:t,onGoBack:c}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{D as F};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-CF908iAG.js";import{l as b,k as x,j,u as y,h as Z,q as ee,g as D,N as ae,n as te,o as p}from"./core-Cgen4kAj.js";import{Ix as S,Iy as k,Iz as N,yT as $,yF as L,IA as C,IB as ne,IC as oe,yJ as ie,eO as v,yQ as se,yN as le}from"./zeni-epic-state-DrGehtra.js";import{q as g,o as r,E as re,d as I,k as E,w as de,n as ce,r as me,s as F,a as pe,p as ue,R as he,v as xe,h as ge,B as fe,A as we,I as be,S as ye,C as Se,F as ke,_ as Ie}from"./index-trlF__w8.js";import{n as c}from"./mui-C7dUqSqV.js";import f from"./NotFoundScreen-DXPtR234.js";import{a as P}from"./sentry-cfxuOFew.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.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]="0e29560c-0faf-478e-af78-ed4103ff5734",e._sentryDebugIdIdentifier="sentry-dbid-0e29560c-0faf-478e-af78-ed4103ff5734")}catch{}})();const ve=c.div`
1
+ import{j as a}from"./liveblocks-DytGFyho.js";import{l as b,k as x,j,u as y,h as Z,q as ee,g as D,N as ae,n as te,o as p}from"./core-BRYqCMzm.js";import{Ix as S,Iy as k,Iz as N,yT as $,yF as L,IA as C,IB as ne,IC as oe,yJ as ie,eO as v,yQ as se,yN as le}from"./zeni-epic-state-B6DxGTeH.js";import{q as g,o as r,E as re,d as I,k as E,w as de,n as ce,r as me,s as F,a as pe,p as ue,R as he,v as xe,h as ge,B as fe,A as we,I as be,S as ye,C as Se,F as ke,_ as Ie}from"./index-akX3Nhym.js";import{n as c}from"./mui-dDGLzwM4.js";import f from"./NotFoundScreen-DYSe2Mdv.js";import{a as P}from"./sentry-YlBgF13X.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.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]="0e29560c-0faf-478e-af78-ed4103ff5734",e._sentryDebugIdIdentifier="sentry-dbid-0e29560c-0faf-478e-af78-ed4103ff5734")}catch{}})();const ve=c.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as f}from"./liveblocks-CF908iAG.js";import{a as u}from"./sentry-cfxuOFew.js";import{h as O,u as _,j as w,q as M,g as l,N as T}from"./core-Cgen4kAj.js";import{z as r,h as P,D as V,e as A,d as N,f as q,y as G,I as R,g as W}from"./index-trlF__w8.js";import{eN as $,Ii as B,Is as H,Ij as J,eO as K,fh as Q,Io as X,fG as Y,cS as Z,It as ee,Iu as te}from"./zeni-epic-state-DrGehtra.js";import{n as ne}from"./mui-C7dUqSqV.js";import{u as se}from"./useDeviceId-43L8M3To.js";import{f as ie}from"./analyticsHelper-CsFRydiU.js";import{t as ae}from"./getLocaleForTenant-Di1C7dV7.js";import"./recharts-Dyhe2tpB.js";import"./analytics-B_uP5uGX.js";import"./plaid-CChs9PMx.js";import"./dnd-DhFfs1wM.js";import"./stripe-DMRn4zHo.js";import"./lottie-Ega9gP0x.js";import"./lexical-DJV7tysr.js";import"./pdf-CSmOdS_B.js";import"./utils-DumEze_M.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="15f2540b-4f7a-4f86-93d4-53c20ebf2fe9",t._sentryDebugIdIdentifier="sentry-dbid-15f2540b-4f7a-4f86-93d4-53c20ebf2fe9")}catch{}})();const D=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function De(){const t=O(),i=_(),m=w(),[b]=M(),n=b.get("token"),p=b.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),a=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:C}=l(e=>e.tenantState),I=l(e=>e.tenantState.fetchState),k=l(e=>e.tenantState.activeTenantFetchState.fetchState),S=l(e=>e.tenantState.signInState),h=l(e=>e.tenantState.magicLinkSignInFetchState.fetchState),s=l(e=>e.tenantState.loggedInUser),o=l(e=>$(e)),y=l(e=>B(e)),E=r.getSignedInUser(),v=P().mode;u.useEffect(()=>{s?.zeniSessionId==null&&n!=null&&D(n,p)&&a!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(H(n,a,g)))},[n,p,t,a,g,s?.zeniSessionId]),u.useEffect(()=>{S!=="In-Progress"||I!=="Completed"&&k!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(J(y.tenantsInOrder),s.zeniSessionId),K(s.userId,s.zeniSessionId,o.tenantId),t(Q(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),V.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,y.tenantsInOrder),Y().then(()=>{const e=W();e!=null&&A(e)}),setTimeout(()=>{N.trackLogin(q.Event.loginSuccess,"email",Z(o.productSettings))},2e3))},[S,I,k,s,o,y,v,i.state,t]);const j=u.useCallback(()=>{m("/signin/auth")},[m]),U=u.useCallback(()=>{a!=null&&d!=null&&c!=null&&t(ee(a,c,d))},[a,d,t,c]),F=u.useCallback(e=>{a!=null&&n!=null&&c!=null&&d!=null&&t(te(e,a,c,d))},[a,n,t,c,d]);if(h==="Completed"&&d!=null)return f.jsx(G,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:U,onVerifyOtp:F,onCancelVerifyDevice:j});if(S==="In-Progress"&&I==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=i.state?.origin??"/";return f.jsx(T,{to:e,state:{...i.state,origin:""}})}if(!D(n,p)||g==null||h==="Error"){const e=i.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return f.jsx(T,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return f.jsx(oe,{"data-testid":"smooth-loader",children:f.jsx(R,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
1
+ import{j as f}from"./liveblocks-DytGFyho.js";import{a as u}from"./sentry-YlBgF13X.js";import{h as O,u as _,j as w,q as M,g as l,N as T}from"./core-BRYqCMzm.js";import{z as r,h as P,D as V,e as A,d as N,f as q,y as G,I as R,g as W}from"./index-akX3Nhym.js";import{eN as $,Ii as B,Is as H,Ij as J,eO as K,fh as Q,Io as X,fG as Y,cS as Z,It as ee,Iu as te}from"./zeni-epic-state-B6DxGTeH.js";import{n as ne}from"./mui-dDGLzwM4.js";import{u as se}from"./useDeviceId-DEQYTB26.js";import{f as ie}from"./analyticsHelper-BojuPNuT.js";import{t as ae}from"./getLocaleForTenant-kMn_Tpi1.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="15f2540b-4f7a-4f86-93d4-53c20ebf2fe9",t._sentryDebugIdIdentifier="sentry-dbid-15f2540b-4f7a-4f86-93d4-53c20ebf2fe9")}catch{}})();const D=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function De(){const t=O(),i=_(),m=w(),[b]=M(),n=b.get("token"),p=b.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),a=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:C}=l(e=>e.tenantState),I=l(e=>e.tenantState.fetchState),k=l(e=>e.tenantState.activeTenantFetchState.fetchState),S=l(e=>e.tenantState.signInState),h=l(e=>e.tenantState.magicLinkSignInFetchState.fetchState),s=l(e=>e.tenantState.loggedInUser),o=l(e=>$(e)),y=l(e=>B(e)),E=r.getSignedInUser(),v=P().mode;u.useEffect(()=>{s?.zeniSessionId==null&&n!=null&&D(n,p)&&a!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(H(n,a,g)))},[n,p,t,a,g,s?.zeniSessionId]),u.useEffect(()=>{S!=="In-Progress"||I!=="Completed"&&k!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(J(y.tenantsInOrder),s.zeniSessionId),K(s.userId,s.zeniSessionId,o.tenantId),t(Q(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),V.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,y.tenantsInOrder),Y().then(()=>{const e=W();e!=null&&A(e)}),setTimeout(()=>{N.trackLogin(q.Event.loginSuccess,"email",Z(o.productSettings))},2e3))},[S,I,k,s,o,y,v,i.state,t]);const j=u.useCallback(()=>{m("/signin/auth")},[m]),U=u.useCallback(()=>{a!=null&&d!=null&&c!=null&&t(ee(a,c,d))},[a,d,t,c]),F=u.useCallback(e=>{a!=null&&n!=null&&c!=null&&d!=null&&t(te(e,a,c,d))},[a,n,t,c,d]);if(h==="Completed"&&d!=null)return f.jsx(G,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:U,onVerifyOtp:F,onCancelVerifyDevice:j});if(S==="In-Progress"&&I==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=i.state?.origin??"/";return f.jsx(T,{to:e,state:{...i.state,origin:""}})}if(!D(n,p)||g==null||h==="Error"){const e=i.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return f.jsx(T,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return f.jsx(oe,{"data-testid":"smooth-loader",children:f.jsx(R,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -1 +1 @@
1
- import{j as U}from"./liveblocks-CF908iAG.js";import{a as c}from"./sentry-cfxuOFew.js";import{h as be,g as s,l as qe,u as Je,j as Qe,i as R}from"./core-Cgen4kAj.js";import{eN as he,eU as ea,eV as Se,eP as aa,bn as ta,f2 as na,eW as sa,eX as oa,eZ as ia,f0 as ra,fa as da,f1 as g,f4 as la,f5 as ue,f8 as ca,f6 as ua,f7 as fa,f9 as ma,cH as pa,fc as ba,cN as ha,bv as Sa,eM as ga,fh as Ea,fi as ka,fg as Ca}from"./zeni-epic-state-DrGehtra.js";import{a1 as ya,a2 as Ia,v as Ta,a as wa,z as k,a3 as _a,K as Aa,a4 as Fa,u as Da,p as r,a5 as va,a6 as $a,j as Ba,c as Pa,a7 as Ga,X as Ra,a8 as xa,a9 as Na,aa as fe,ab as me,L as Ua,ac as Va,ad as pe,d as x,s as _,ae as N,af as Ma}from"./index-trlF__w8.js";import{D as Oa}from"./mui-C7dUqSqV.js";(function(){try{var f=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new f.Error().stack;d&&(f._sentryDebugIds=f._sentryDebugIds||{},f._sentryDebugIds[d]="9c3247ab-f607-45ce-863a-51549862a7ce",f._sentryDebugIdIdentifier="sentry-dbid-9c3247ab-f607-45ce-863a-51549862a7ce")}catch{}})();const ja=ya(({isAppContentDrawerOpen:f,handleDrawerToggle:d})=>{const{tenantEmailDomain:a}=qe(),t=Je(),C=Ta(),o=Qe(),V=aa(),m=be(),{useFeatureGate:i}=wa(),M=k.getSignedInUser(),A=ta(M),n=s(e=>he(e)),ge=_a(),Ee=n.masterTOSInfo?.isMasterTOSAccepted??!1,{setIsAiCfoOpen:ke}=Aa(),O=s(e=>na(e)),j=O.uiState.currentChatSessionId,y=Fa(),{setLoading:Ce}=Da(),[F,L]=c.useState(void 0),D=R("/:tenantEmailDomain/dashboard")!==null,z=R("/:tenantEmailDomain/reports")!==null,I=R("/:tenantEmailDomain/onboarding/*")!==null,{isFeatureEnabled:H}=i(r.isDepositAccountsFeatureEnabled),{isFeatureEnabled:ye}=i(r.isChargeCardFeatureEnabled),{isFeatureEnabled:Y}=i(r.isDebitCardFeatureEnabled),Ie=va(n,ye,Y),{isFeatureEnabled:Te}=i(r.isSettingsFeatureEnabled),Z=s(e=>sa(e)),{isFeatureEnabled:T}=i(r.isReferralFeatureEnabled),v=s(e=>oa(e));c.useEffect(()=>{y&&T&&!I&&v.fetchState==="Not-Started"&&m(ia(!0))},[y,T,v.fetchState,I]);const h=k.getSignedInUser(),$=s(e=>e.tenantState),we=s(e=>$.fetchState==="Completed"?ra(e):[]),E=s(e=>e.expenseAutomationViewState.selectedPeriodByTenantId),{isFeatureEnabled:_e}=i(r.isApAgingFeatureEnabled),{isFeatureEnabled:Ae}=i(r.isArAgingFeatureEnabled),{isFeatureEnabled:W}=i(r.isExpenseAutomationEnabled),{isFeatureEnabled:K}=i(r.isExpenseAutomationEnabledV2),X=K||W&&A,{isFeatureEnabled:Fe}=i(r.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:De}=i(r.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ve}=i(r.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:$e}=i(r.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Be}=i(r.isTreasuryEnabled),{isFeatureEnabled:Pe}=i(r.isTaskManagerCustomerUserAccessEnabled),Ge=A||!A&&Pe,Re=n.company!=null&&da(n.company),w=Be&&Re,xe=s(e=>g(e).totalUnreadCount),Ne=s(e=>g(e).reducedFetchCountState),q=s(e=>g(e).notificationDetailsByTab.tasks.uiState.unreadCount),J=s(e=>g(e).notificationDetailsByTab.comments.uiState.unreadCount),Ue=s(e=>g(e).notificationDetailsByTab.tasks.fetchCountState),B=s(e=>g(e).notificationDetailsByTab.comments.fetchCountState),{inboxNotifications:Q,isLoading:ee,isFetchingMore:ae,hasFetchedAll:te,fetchMore:Ve}=$a();c.useEffect(()=>{const e=setTimeout(()=>Ve?.(),0);return()=>clearTimeout(e)}),c.useEffect(()=>{if(ee===!1&&ae===!1&&te===!0)if(n?.companyId!=null&&Q!=null){const e=`dashboard_${n.companyId}`;L(Q.filter(u=>u.roomId===e&&u.readAt==null).length)}else L(0)},[ee,ae,te]),c.useEffect(()=>{y&&!I&&Ue.fetchState==="Not-Started"&&V.tenantId!=null&&m(la("task_manager","dashboard"))},[y,V.tenantId]),c.useEffect(()=>{I||B.fetchState!=="Not-Started"||m(ue({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))},[]),c.useEffect(()=>{F!=null&&B.fetchState==="In-Progress"&&(m(ue({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),m(Se({unreadCount:F},"comments")))},[F,B.fetchState]);const Me={fetchStatus:Ne,count:xe},ne=a!=null?k.getSignedInUserTenant(a):null,se=s(e=>ne?.tenantId!=null?ca(e,ne.tenantId):void 0),S=[];_e===!1&&S.push("accounts_payable_aging"),Ae===!1&&S.push("accounts_receivable_aging"),H===!1&&S.push("zeni_accounts_promo_card"),T===!1&&S.push("rewards_card"),X===!1&&S.push("expense_automation_card");const Oe=Ba(),oe=s(e=>ua(e,S,h,K,W,w).fetchState),ie=s(e=>fa(e).fetchState),je=D&&(oe==="Completed"||oe==="Error")||z&&(ie==="Completed"||ie==="Error")||!D&&!z?void 0:"disabled",Le=c.useMemo(()=>ma(n.userRole),[n.userRole]),ze=pa(Le),He=n?.rewardsLastViewedTime==null,Ye=h?.userEmail!=null&&Z.fetchState==="Completed"&&ba(Z.notificationSettings,h.userEmail,Y,n),re=Pa(),Ze=re&&Ga(t),de=ha(Oe?.loggedInUserRoleMap),le=n.companyTreasuryInfo?.info?.isTreasuryTOSAccepted,P=c.useCallback(()=>w&&de&&!k.getTreasuryPopupSeen(a??"")&&le===!1&&Ra(t.pathname)!=="treasury",[w,de,le,t.pathname,a]),[We,ce]=c.useState(P);c.useEffect(()=>{ce(P())},[P]);const Ke=s(e=>e.treasurySetupViewState.treasuryFundsDetails).fundsDetails,Xe=xa(Ke);return U.jsx(Oa,{container:window.document.body,variant:"temporary",open:f,onClose:()=>d(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:U.jsx(Na,{signedInUser:M,currentTenantId:$.currentTenantId??"",tenants:$.fetchState==="Completed"?we:se!=null?[se]:[],currentTenant:n,isTenantDropdownDisabled:je,isSettings:me(t),isSettingsFeatureEnabled:Te,isVendorsTabVisible:ze,isZeniAccountEnabled:H,isChargeCardEnabled:Ie,isTreasuryEnabled:w,treasuryYieldPercentage:Xe,isTreasuryPopupVisible:We,isNotificationsTabVisible:Ye,notificationCountDetails:Me,isExpenseAutomationEnabledForUser:X&&Sa(n.userRole)===!1,selectedMenu:fe(t),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:He,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:re,onNotificationIconClick:()=>{d(!1);let e=q===0&&J>0?"notifications/comments":"notifications/tasks";me(t)&&(e=q===0&&J>0?"../../notifications/comments":"../../notifications/tasks");const u=_(t.state?.pathnameStackToGoBack,t.pathname);o(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{d(!1);const e=_(t.state?.pathnameStackToGoBack,t.pathname);o("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(d(!1),a==null)return;if(e.type==="ai_cfo"){const p=_(t.state?.pathnameStackToGoBack,t.pathname);return x.trackAICFOChatScreenStateChanged("viewed","left_menu",j??null,null),Ee?void o(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:p,referrer:"Sidebar"}}):void(ge?ke(!0):o(`/${a}/dashboard`,{state:{pathnameStackToGoBack:p,referrer:"Sidebar",message:"open_ai_cfo_drawer"}}))}const u=_(t.state?.pathnameStackToGoBack,t.pathname),l=e.type,b=N(l)&&l!=="command_center";if(N(e.type)&&E[n.tenantId]!=null&&x.trackMonthEndCloseClicked(E[n.tenantId].month,E[n.tenantId].year,"Sidebar"),b&&E[n.tenantId]!=null){const p=E[n.tenantId];return void o(`/${a}/month_end_close_checks/review/${e.type}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const G=Ma(e.type);pe(e.type)?(j!=null&&m(Ca()),o(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):o(`/${a}/${G}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{d(!1),o(`/${a}/settings/my_profile`)},handleReferralsClick:()=>{d(!1),o(`/${a}/rewards`)},handleBackClick:()=>{o(`/${a}/dashboard`)},handleTenantSelect:e=>{Ce(Ua.TENANT_SWITCHING),d(!1);const u=e.tenantEmailDomain,l=fe(t);let b=`/${encodeURIComponent(u)}/`;const G=N(l);l==="home"?b+="dashboard":l==="users_and_roles"?b+="people":Va(l)?b+="settings/my_profile":pe(l)?b+=`ai-cfo/${l}`:b+=l==="task_checklist"?"tasks":G?"month_end_close_checks/review":encodeURIComponent(l),o(b,{replace:!0}),h!=null&&(m(Ea(e.tenantId)),m(ka(h.userId,e.tenantId,h.zeniSessionId)));const p=e;x.trackCompanySwitch(p.companyId,p.companyName,p.userRole)},handlePopupClose:()=>{k.saveTreasuryPopupSeen(a??"",!0),ce(!1)},onZeniLogoClick:()=>{C.toggle()},isAiCfo:Ze,aiCfoView:O,isOnDashboard:D,updateCurrentChatSessionId:e=>{m(ga({sessionId:e,agentId:"controller"})),o(`/${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Fe,isTaskManagerAccessEnabled:Ge,thanksGivingAnimationEnabled:De,christmasAnimationEnabled:ve,newYearAnimationEnabled:$e})})}),Ka=f=>{const d=be(),a=s(C=>he(C)),t={events:a.userRoleId!=null?[`private-${a.userRoleId}.dashboard-user-notification`]:[],eventCallback:(C,o)=>{Ia(o)&&ea(o.mode)==="dashboard"&&d(Se({unreadCount:o.data.unread},"tasks"))}};return U.jsx(ja,{...f,...t})};export{Ka as M};
1
+ import{j as U}from"./liveblocks-DytGFyho.js";import{a as c}from"./sentry-YlBgF13X.js";import{h as be,g as s,l as qe,u as Je,j as Qe,i as R}from"./core-BRYqCMzm.js";import{eN as he,eU as ea,eV as Se,eP as aa,bn as ta,f2 as na,eW as sa,eX as oa,eZ as ia,f0 as ra,fa as da,f1 as g,f4 as la,f5 as ue,f8 as ca,f6 as ua,f7 as fa,f9 as ma,cH as pa,fc as ba,cN as ha,bv as Sa,eM as ga,fh as Ea,fi as ka,fg as Ca}from"./zeni-epic-state-B6DxGTeH.js";import{a1 as ya,a2 as Ia,v as Ta,a as wa,z as k,a3 as _a,K as Aa,a4 as Fa,u as Da,p as r,a5 as va,a6 as $a,j as Ba,c as Pa,a7 as Ga,X as Ra,a8 as xa,a9 as Na,aa as fe,ab as me,L as Ua,ac as Va,ad as pe,d as x,s as _,ae as N,af as Ma}from"./index-akX3Nhym.js";import{D as Oa}from"./mui-dDGLzwM4.js";(function(){try{var f=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new f.Error().stack;d&&(f._sentryDebugIds=f._sentryDebugIds||{},f._sentryDebugIds[d]="9c3247ab-f607-45ce-863a-51549862a7ce",f._sentryDebugIdIdentifier="sentry-dbid-9c3247ab-f607-45ce-863a-51549862a7ce")}catch{}})();const ja=ya(({isAppContentDrawerOpen:f,handleDrawerToggle:d})=>{const{tenantEmailDomain:a}=qe(),t=Je(),C=Ta(),o=Qe(),V=aa(),m=be(),{useFeatureGate:i}=wa(),M=k.getSignedInUser(),A=ta(M),n=s(e=>he(e)),ge=_a(),Ee=n.masterTOSInfo?.isMasterTOSAccepted??!1,{setIsAiCfoOpen:ke}=Aa(),O=s(e=>na(e)),j=O.uiState.currentChatSessionId,y=Fa(),{setLoading:Ce}=Da(),[F,L]=c.useState(void 0),D=R("/:tenantEmailDomain/dashboard")!==null,z=R("/:tenantEmailDomain/reports")!==null,I=R("/:tenantEmailDomain/onboarding/*")!==null,{isFeatureEnabled:H}=i(r.isDepositAccountsFeatureEnabled),{isFeatureEnabled:ye}=i(r.isChargeCardFeatureEnabled),{isFeatureEnabled:Y}=i(r.isDebitCardFeatureEnabled),Ie=va(n,ye,Y),{isFeatureEnabled:Te}=i(r.isSettingsFeatureEnabled),Z=s(e=>sa(e)),{isFeatureEnabled:T}=i(r.isReferralFeatureEnabled),v=s(e=>oa(e));c.useEffect(()=>{y&&T&&!I&&v.fetchState==="Not-Started"&&m(ia(!0))},[y,T,v.fetchState,I]);const h=k.getSignedInUser(),$=s(e=>e.tenantState),we=s(e=>$.fetchState==="Completed"?ra(e):[]),E=s(e=>e.expenseAutomationViewState.selectedPeriodByTenantId),{isFeatureEnabled:_e}=i(r.isApAgingFeatureEnabled),{isFeatureEnabled:Ae}=i(r.isArAgingFeatureEnabled),{isFeatureEnabled:W}=i(r.isExpenseAutomationEnabled),{isFeatureEnabled:K}=i(r.isExpenseAutomationEnabledV2),X=K||W&&A,{isFeatureEnabled:Fe}=i(r.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:De}=i(r.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ve}=i(r.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:$e}=i(r.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Be}=i(r.isTreasuryEnabled),{isFeatureEnabled:Pe}=i(r.isTaskManagerCustomerUserAccessEnabled),Ge=A||!A&&Pe,Re=n.company!=null&&da(n.company),w=Be&&Re,xe=s(e=>g(e).totalUnreadCount),Ne=s(e=>g(e).reducedFetchCountState),q=s(e=>g(e).notificationDetailsByTab.tasks.uiState.unreadCount),J=s(e=>g(e).notificationDetailsByTab.comments.uiState.unreadCount),Ue=s(e=>g(e).notificationDetailsByTab.tasks.fetchCountState),B=s(e=>g(e).notificationDetailsByTab.comments.fetchCountState),{inboxNotifications:Q,isLoading:ee,isFetchingMore:ae,hasFetchedAll:te,fetchMore:Ve}=$a();c.useEffect(()=>{const e=setTimeout(()=>Ve?.(),0);return()=>clearTimeout(e)}),c.useEffect(()=>{if(ee===!1&&ae===!1&&te===!0)if(n?.companyId!=null&&Q!=null){const e=`dashboard_${n.companyId}`;L(Q.filter(u=>u.roomId===e&&u.readAt==null).length)}else L(0)},[ee,ae,te]),c.useEffect(()=>{y&&!I&&Ue.fetchState==="Not-Started"&&V.tenantId!=null&&m(la("task_manager","dashboard"))},[y,V.tenantId]),c.useEffect(()=>{I||B.fetchState!=="Not-Started"||m(ue({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))},[]),c.useEffect(()=>{F!=null&&B.fetchState==="In-Progress"&&(m(ue({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),m(Se({unreadCount:F},"comments")))},[F,B.fetchState]);const Me={fetchStatus:Ne,count:xe},ne=a!=null?k.getSignedInUserTenant(a):null,se=s(e=>ne?.tenantId!=null?ca(e,ne.tenantId):void 0),S=[];_e===!1&&S.push("accounts_payable_aging"),Ae===!1&&S.push("accounts_receivable_aging"),H===!1&&S.push("zeni_accounts_promo_card"),T===!1&&S.push("rewards_card"),X===!1&&S.push("expense_automation_card");const Oe=Ba(),oe=s(e=>ua(e,S,h,K,W,w).fetchState),ie=s(e=>fa(e).fetchState),je=D&&(oe==="Completed"||oe==="Error")||z&&(ie==="Completed"||ie==="Error")||!D&&!z?void 0:"disabled",Le=c.useMemo(()=>ma(n.userRole),[n.userRole]),ze=pa(Le),He=n?.rewardsLastViewedTime==null,Ye=h?.userEmail!=null&&Z.fetchState==="Completed"&&ba(Z.notificationSettings,h.userEmail,Y,n),re=Pa(),Ze=re&&Ga(t),de=ha(Oe?.loggedInUserRoleMap),le=n.companyTreasuryInfo?.info?.isTreasuryTOSAccepted,P=c.useCallback(()=>w&&de&&!k.getTreasuryPopupSeen(a??"")&&le===!1&&Ra(t.pathname)!=="treasury",[w,de,le,t.pathname,a]),[We,ce]=c.useState(P);c.useEffect(()=>{ce(P())},[P]);const Ke=s(e=>e.treasurySetupViewState.treasuryFundsDetails).fundsDetails,Xe=xa(Ke);return U.jsx(Oa,{container:window.document.body,variant:"temporary",open:f,onClose:()=>d(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:U.jsx(Na,{signedInUser:M,currentTenantId:$.currentTenantId??"",tenants:$.fetchState==="Completed"?we:se!=null?[se]:[],currentTenant:n,isTenantDropdownDisabled:je,isSettings:me(t),isSettingsFeatureEnabled:Te,isVendorsTabVisible:ze,isZeniAccountEnabled:H,isChargeCardEnabled:Ie,isTreasuryEnabled:w,treasuryYieldPercentage:Xe,isTreasuryPopupVisible:We,isNotificationsTabVisible:Ye,notificationCountDetails:Me,isExpenseAutomationEnabledForUser:X&&Sa(n.userRole)===!1,selectedMenu:fe(t),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:He,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:re,onNotificationIconClick:()=>{d(!1);let e=q===0&&J>0?"notifications/comments":"notifications/tasks";me(t)&&(e=q===0&&J>0?"../../notifications/comments":"../../notifications/tasks");const u=_(t.state?.pathnameStackToGoBack,t.pathname);o(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{d(!1);const e=_(t.state?.pathnameStackToGoBack,t.pathname);o("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(d(!1),a==null)return;if(e.type==="ai_cfo"){const p=_(t.state?.pathnameStackToGoBack,t.pathname);return x.trackAICFOChatScreenStateChanged("viewed","left_menu",j??null,null),Ee?void o(`/${a}/ai-cfo/explore`,{state:{pathnameStackToGoBack:p,referrer:"Sidebar"}}):void(ge?ke(!0):o(`/${a}/dashboard`,{state:{pathnameStackToGoBack:p,referrer:"Sidebar",message:"open_ai_cfo_drawer"}}))}const u=_(t.state?.pathnameStackToGoBack,t.pathname),l=e.type,b=N(l)&&l!=="command_center";if(N(e.type)&&E[n.tenantId]!=null&&x.trackMonthEndCloseClicked(E[n.tenantId].month,E[n.tenantId].year,"Sidebar"),b&&E[n.tenantId]!=null){const p=E[n.tenantId];return void o(`/${a}/month_end_close_checks/review/${e.type}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const G=Ma(e.type);pe(e.type)?(j!=null&&m(Ca()),o(`/${a}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):o(`/${a}/${G}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{d(!1),o(`/${a}/settings/my_profile`)},handleReferralsClick:()=>{d(!1),o(`/${a}/rewards`)},handleBackClick:()=>{o(`/${a}/dashboard`)},handleTenantSelect:e=>{Ce(Ua.TENANT_SWITCHING),d(!1);const u=e.tenantEmailDomain,l=fe(t);let b=`/${encodeURIComponent(u)}/`;const G=N(l);l==="home"?b+="dashboard":l==="users_and_roles"?b+="people":Va(l)?b+="settings/my_profile":pe(l)?b+=`ai-cfo/${l}`:b+=l==="task_checklist"?"tasks":G?"month_end_close_checks/review":encodeURIComponent(l),o(b,{replace:!0}),h!=null&&(m(Ea(e.tenantId)),m(ka(h.userId,e.tenantId,h.zeniSessionId)));const p=e;x.trackCompanySwitch(p.companyId,p.companyName,p.userRole)},handlePopupClose:()=>{k.saveTreasuryPopupSeen(a??"",!0),ce(!1)},onZeniLogoClick:()=>{C.toggle()},isAiCfo:Ze,aiCfoView:O,isOnDashboard:D,updateCurrentChatSessionId:e=>{m(ga({sessionId:e,agentId:"controller"})),o(`/${a}/ai-cfo/${e}`,{state:{...t.state}})},halloweenAnimationEnabled:Fe,isTaskManagerAccessEnabled:Ge,thanksGivingAnimationEnabled:De,christmasAnimationEnabled:ve,newYearAnimationEnabled:$e})})}),Ka=f=>{const d=be(),a=s(C=>he(C)),t={events:a.userRoleId!=null?[`private-${a.userRoleId}.dashboard-user-notification`]:[],eventCallback:(C,o)=>{Ia(o)&&ea(o.mode)==="dashboard"&&d(Se({unreadCount:o.data.unread},"tasks"))}};return U.jsx(ja,{...f,...t})};export{Ka as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DytGFyho.js";import{j as r,k as i}from"./core-BRYqCMzm.js";import{V as n}from"./index-akX3Nhym.js";import"./mui-dDGLzwM4.js";import"./sentry-YlBgF13X.js";import"./zeni-epic-state-B6DxGTeH.js";import"./recharts-C7zYvbyW.js";import"./analytics-DMHo1eqB.js";import"./plaid-QQ6p_f2h.js";import"./dnd-BUhKHo0J.js";import"./stripe-DMRn4zHo.js";import"./lottie-DUnNV-G9.js";import"./lexical-8E0BhRCX.js";import"./pdf-DJGD_VAN.js";import"./utils-B6J0lORC.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="a6101124-68fb-49b2-8a98-0d630e11e347",o._sentryDebugIdIdentifier="sentry-dbid-a6101124-68fb-49b2-8a98-0d630e11e347")}catch{}})();const a=i(null,function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}})(n);function h(){const o=r();return e.jsx(a,{navigate:o})}export{h as default};