@zeniai/web-app-ui 5.0.95-qa → 5.0.97-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/assets/AddressRoutes-CGWqKw2A.js +1 -0
  2. package/dist/assets/AddressScreen-DgW0r12j.js +9 -0
  3. package/dist/assets/AiCfoScreen-mpMOsrgh.js +22 -0
  4. package/dist/assets/{BillPayApprovalRoutes-DLpMtIRS.js → BillPayApprovalRoutes-CuO1OyTh.js} +1 -1
  5. package/dist/assets/{BillPayRoutes-B5l3Tw20.js → BillPayRoutes-CVK-SvP3.js} +17 -17
  6. package/dist/assets/BusinessVerificationPageScreen-BYdF1bHH.js +9 -0
  7. package/dist/assets/ChargeCardRoutes-BnLL7Oh9.js +71 -0
  8. package/dist/assets/CompanyPassportScreen-CurP8P_r.js +1 -0
  9. package/dist/assets/ConnectionAuthScreen-XYG9quUc.js +11 -0
  10. package/dist/assets/CustomerOnboardingAuthScreen-DkpxqvRp.js +1 -0
  11. package/dist/assets/CustomerOnboardingRoutes-XzuPwC7t.js +23 -0
  12. package/dist/assets/DashboardRoutes-aXE6eRUn.js +20 -0
  13. package/dist/assets/{DefaultTenantHome-DPWdITeE.js → DefaultTenantHome-D8TLMGvX.js} +1 -1
  14. package/dist/assets/DomesticWireDetailScreen-BaXgsKL_.js +18 -0
  15. package/dist/assets/DrawerScreen-Cl15MV8E.js +1 -0
  16. package/dist/assets/EntityDetailRoutes-DzGzpMa5.js +1 -0
  17. package/dist/assets/ExpenseAutomationRoutes-BcjfN0Ju.js +25 -0
  18. package/dist/assets/FeaturePreviewScreen-D6uCQjjF.js +1 -0
  19. package/dist/assets/HubSpotOAuthCallbackScreen-B2Lq1erT.js +1 -0
  20. package/dist/assets/MagicLinkRoutes-Krl3LdoK.js +72 -0
  21. package/dist/assets/MagicLinkSignInScreen-AmlbZLoQ.js +12 -0
  22. package/dist/assets/MobileAppDrawer-CIFLBMnG.js +1 -0
  23. package/dist/assets/NotFoundScreen-6s-CV-uJ.js +1 -0
  24. package/dist/assets/NotificationRoutes-sNkUDoB9.js +1 -0
  25. package/dist/assets/OAuthConsentScreen-DnssIj9h.js +1 -0
  26. package/dist/assets/PandLWithForecastRoutes-e4NHYCVg.js +1 -0
  27. package/dist/assets/PeopleRoutes-D22bF149.js +22 -0
  28. package/dist/assets/PerformanceRoutes-CeJDOkS_.js +1 -0
  29. package/dist/assets/{Preview-DVbW5PS-.js → Preview-CnNge2qE.js} +1 -1
  30. package/dist/assets/{QBOConnectionScreen-DckktUOs.js → QBOConnectionScreen-4k7XqHlG.js} +1 -1
  31. package/dist/assets/ReferralListScreen-CKP-RqZB.js +5 -0
  32. package/dist/assets/ReimbursementApprovalRoutes-CWQE-ocg.js +1 -0
  33. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BK03a97e.js → ReimbursementApprovalRuleDetailScreen-Dgpqad5D.js} +1 -1
  34. package/dist/assets/{ReimbursementRoutes-BOTzgYhv.js → ReimbursementRoutes-Cd4dr8g5.js} +6 -6
  35. package/dist/assets/ReportsRoutes-C1JCi0DK.js +1 -0
  36. package/dist/assets/RewardsRoutes-C04DC-zn.js +1 -0
  37. package/dist/assets/ScreenRoutes-BdDWctgF.js +2 -0
  38. package/dist/assets/{SettingsRoutes-DOALXrsx.js → SettingsRoutes-ClBKtlV1.js} +8 -8
  39. package/dist/assets/{SetupPagesScreen-BYhmd0-N.js → SetupPagesScreen-ISYmAXSw.js} +5 -5
  40. package/dist/assets/SignInScreen-DbrQdSIc.js +1 -0
  41. package/dist/assets/SignOutScreen-tN2xKweR.js +9 -0
  42. package/dist/assets/TaskListScreen-CcxsLxWY.js +9 -0
  43. package/dist/assets/TaskRoutes-BlNcUUfL.js +9 -0
  44. package/dist/assets/TransactionDetailRoutes-Bptrg1f9.js +1 -0
  45. package/dist/assets/TransactionDetailScreen-DxF4bkB2.js +5 -0
  46. package/dist/assets/TransactionListRoutes-HDLI794m.js +1 -0
  47. package/dist/assets/TreasuryRoutes-VXqomRCb.js +37 -0
  48. package/dist/assets/{VendorsRoutes-D8t3eTpL.js → VendorsRoutes-Q2QOh8Cr.js} +21 -21
  49. package/dist/assets/WiseConfirmationScreen-DrnQduD4.js +12 -0
  50. package/dist/assets/{ZeniAccountRoutes-BhbbjK45.js → ZeniAccountRoutes-B0GIox14.js} +12 -12
  51. package/dist/assets/ZeniAccountStatementScreen-DAHwiVMm.js +9 -0
  52. package/dist/assets/{accountMappingHelper-DdryjbCH.js → accountMappingHelper-Bvkx36I4.js} +1 -1
  53. package/dist/assets/{analytics-B35UERag.js → analytics-CAylLTML.js} +1 -1
  54. package/dist/assets/{analyticsHelper-Cnf9wNpk.js → analyticsHelper-CnKhOE0J.js} +1 -1
  55. package/dist/assets/{core-B20PugrR.js → core-DPuoDz-C.js} +2 -2
  56. package/dist/assets/{decodeURIComponentSafe-HZX6LUOb.js → decodeURIComponentSafe-CoP-62fa.js} +1 -1
  57. package/dist/assets/{dnd-CTNaOehy.js → dnd-DoKiSnu1.js} +1 -1
  58. package/dist/assets/{empty-DqPV1QMu.js → empty-CqLohdTd.js} +1 -1
  59. package/dist/assets/{empty-DbjE3Pml.js → empty-Dya-tSOZ.js} +1 -1
  60. package/dist/assets/{emptyVideoElement-D5A8Alvf.js → emptyVideoElement-DN0XgSVD.js} +1 -1
  61. package/dist/assets/epic-nb_4clnc.js +2 -0
  62. package/dist/assets/getLocaleForTenant-Cv1qkYRT.js +1 -0
  63. package/dist/assets/{index-Dh7l3Ca4.js → index-8sAtTwXX.js} +1 -1
  64. package/dist/assets/{index-BJUGjRvu.js → index-BJ1_hb4m.js} +1 -1
  65. package/dist/assets/{index-Dx-tgz0s.js → index-CIJ8oTsb.js} +1 -1
  66. package/dist/assets/{index-DwJt1swd.js → index-CiNh7iF3.js} +1 -1
  67. package/dist/assets/{index-DDN5QRfh.js → index-D00upk1h.js} +2 -2
  68. package/dist/assets/{index-DODLcfP6.js → index-DFMBbjjX.js} +1 -1
  69. package/dist/assets/{index-CtCI_jgi.js → index-DPfZNvSx.js} +15801 -15966
  70. package/dist/assets/{index-qbNk-Sh2.js → index-D_RleLEr.js} +1 -1
  71. package/dist/assets/{lexical-BDpP_OMn.js → lexical-By4mk6_c.js} +1 -1
  72. package/dist/assets/{liveblocks-BSDLCmF2.js → liveblocks-oJncKqAM.js} +1 -1
  73. package/dist/assets/{lottie-DG71PfmK.js → lottie-DF3afs57.js} +1 -1
  74. package/dist/assets/{mui-BBkBdMVO.js → mui-CvBhrbbU.js} +1 -1
  75. package/dist/assets/{pathToGoBack-BJj5tqvK.js → pathToGoBack-BsOMzCPN.js} +1 -1
  76. package/dist/assets/{pdf-Cp8DoYAG.js → pdf-ZStfwNCw.js} +3 -3
  77. package/dist/assets/{pdf-lib-BqwRJQ00.js → pdf-lib-Cz_8yjsc.js} +1 -1
  78. package/dist/assets/{plaid-DHvUog4a.js → plaid-B5RWvsAl.js} +1 -1
  79. package/dist/assets/{pusher-DsZLo3j0.js → pusher-CBx-MkLq.js} +1 -1
  80. package/dist/assets/{react-DpONCvOo.js → react-B9yLfzkL.js} +1 -1
  81. package/dist/assets/{react-BPL_4xi4.js → react-BYV_Q7yH.js} +1 -1
  82. package/dist/assets/{react-BUTkVbbW.js → react-CDIoRxEm.js} +1 -1
  83. package/dist/assets/{react-zGcoIiO8.js → react-CX37p-_t.js} +1 -1
  84. package/dist/assets/{react-D4RyndA4.js → react-Cru1b7DY.js} +1 -1
  85. package/dist/assets/{react-Uu6ZW5p-.js → react-DWAXaztH.js} +1 -1
  86. package/dist/assets/{recharts-BzjcN9SN.js → recharts-8icy_MRK.js} +2 -2
  87. package/dist/assets/routePaths-C0C2W8XC.js +1 -0
  88. package/dist/assets/{sentry-67DqaLi1.js → sentry-Wbq0JKts.js} +1 -1
  89. package/dist/assets/{url-DgheZiFv.js → url-ByM-m_3z.js} +1 -1
  90. package/dist/assets/{url-D5ovKX_j.js → url-DJu6Grkr.js} +1 -1
  91. package/dist/assets/useAskAiCfoHostNavButtonProps-Dp2Xhyb6.js +1 -0
  92. package/dist/assets/{useDeviceId-CZrGGxHD.js → useDeviceId-B67Wr9jV.js} +1 -1
  93. package/dist/assets/useFetchSuggestedQuestionsWhenReady-eIU3TXlQ.js +1 -0
  94. package/dist/assets/{useInitialThreadRequest-CHUXHA4e.js → useInitialThreadRequest-OlVGnbEH.js} +1 -1
  95. package/dist/assets/{utils-C7uJ9upL.js → utils-BQwNg4C5.js} +1 -1
  96. package/dist/assets/withTransactionSidePanel-D14NyE9e.js +21 -0
  97. package/dist/assets/zeni-epic-state-DxdjrTbG.js +13 -0
  98. package/dist/index.html +1 -1
  99. package/package.json +4 -5
  100. package/dist/assets/AddressRoutes-CjTHTSuI.js +0 -1
  101. package/dist/assets/AddressScreen-CqBa6_-n.js +0 -9
  102. package/dist/assets/AiCfoScreen-BXUvjbhu.js +0 -22
  103. package/dist/assets/BusinessVerificationPageScreen-CSKO8lFK.js +0 -9
  104. package/dist/assets/ChargeCardRoutes-jWkInVo_.js +0 -71
  105. package/dist/assets/CompanyPassportScreen-CKvp1ssr.js +0 -1
  106. package/dist/assets/ConnectionAuthScreen-B4RQUYL_.js +0 -11
  107. package/dist/assets/CustomerOnboardingAuthScreen-BGqU9gPw.js +0 -1
  108. package/dist/assets/CustomerOnboardingRoutes-Dr5zRy1K.js +0 -23
  109. package/dist/assets/DashboardRoutes-pJhHX-2b.js +0 -20
  110. package/dist/assets/DomesticWireDetailScreen-SKLAPI0e.js +0 -18
  111. package/dist/assets/DrawerScreen-D5UV8-Be.js +0 -1
  112. package/dist/assets/EntityDetailRoutes-gOpFte8h.js +0 -1
  113. package/dist/assets/ExpenseAutomationRoutes-ARewAzCQ.js +0 -25
  114. package/dist/assets/FeaturePreviewScreen-CWGIZoD1.js +0 -1
  115. package/dist/assets/HubSpotOAuthCallbackScreen-DZdAM3r7.js +0 -1
  116. package/dist/assets/MagicLinkRoutes-GUUoK2nF.js +0 -72
  117. package/dist/assets/MagicLinkSignInScreen-Im4VESmI.js +0 -12
  118. package/dist/assets/MobileAppDrawer-DjZLcHYq.js +0 -1
  119. package/dist/assets/NotFoundScreen-GGUH6kfI.js +0 -1
  120. package/dist/assets/NotificationRoutes-BoplnVa2.js +0 -1
  121. package/dist/assets/OAuthConsentScreen-DxwRtYz2.js +0 -1
  122. package/dist/assets/PandLWithForecastRoutes-D8O3Fecf.js +0 -1
  123. package/dist/assets/PeopleRoutes-DreG0KS5.js +0 -22
  124. package/dist/assets/PerformanceRoutes-BWWDxy3D.js +0 -1
  125. package/dist/assets/ReferralListScreen-deq5DiBs.js +0 -5
  126. package/dist/assets/ReimbursementApprovalRoutes-XhXfCwat.js +0 -1
  127. package/dist/assets/ReportsRoutes-d5fJ62NK.js +0 -1
  128. package/dist/assets/RewardsRoutes-C4s9WH-A.js +0 -1
  129. package/dist/assets/ScreenRoutes-D5644a5x.js +0 -2
  130. package/dist/assets/SignInScreen-CLFmIoF3.js +0 -1
  131. package/dist/assets/SignOutScreen-GZOa1gnF.js +0 -9
  132. package/dist/assets/TaskListScreen-DXLUHaMY.js +0 -9
  133. package/dist/assets/TaskRoutes-CBpVhxjZ.js +0 -9
  134. package/dist/assets/TransactionDetailRoutes-BM0mSWXo.js +0 -1
  135. package/dist/assets/TransactionDetailScreen-Mjv-0Vsi.js +0 -5
  136. package/dist/assets/TransactionListRoutes-DX4_qMdv.js +0 -1
  137. package/dist/assets/TreasuryRoutes-33SOS81s.js +0 -37
  138. package/dist/assets/WiseConfirmationScreen-C9nK-3Oh.js +0 -12
  139. package/dist/assets/ZeniAccountStatementScreen-BSfOyBC_.js +0 -9
  140. package/dist/assets/epic-C05Fn23e.js +0 -2
  141. package/dist/assets/getLocaleForTenant-DX4sTRBy.js +0 -1
  142. package/dist/assets/routePaths-Bd-gFJIO.js +0 -1
  143. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CjjIkZeq.js +0 -1
  144. package/dist/assets/useAskAiCfoHostNavButtonProps-CMgniebB.js +0 -1
  145. package/dist/assets/withTransactionSidePanel-KXh--JtC.js +0 -21
  146. package/dist/assets/zeni-epic-state-B3AwsZqW.js +0 -13
@@ -1,20 +0,0 @@
1
- import{j as d}from"./liveblocks-BSDLCmF2.js";import{i as K,j as _,g as H,u as z,h as W,n as te,k as oa,o as gt,p as F}from"./core-B20PugrR.js";import{eP as U,KE as Xe,bE as sa,bq as xe,LR as In,i3 as Tn,LS as Nt,LT as xn,i6 as bt,LU as Qe,LV as Dn,ib as wn,LW as $t,LX as Fn,ig as Ct,LY as He,LZ as On,cl as St,L_ as Pn,L$ as Mn,KY as Rn,j9 as Bn,M0 as jn,bn as Ge,M1 as ra,Ks as ce,bc as ia,jn as ca,m$ as la,j6 as da,Ku as le,Kt as ee,eO as ua,eU as Ln,fq as kt,M2 as Un,M3 as Gn,M4 as ma,M5 as Re,uh as Ye,ui as Ve,uF as De,uz as de,um as Ne,M6 as Yn,M7 as Vn,M8 as Nn,M9 as pa,Ma as Be,Mb as $n,dE as Je,qM as ha,Mc as zn,Md as Kn,Me as qn,Mf as yt,JR as At,jD as we,uN as vt,qU as Zn,Mg as Qn,uj as zt,qP as Ie,qL as fa,Mh as ge,Mi as Hn,Mj as Et,JQ as It,sT as ga,Mk as Wn,Ml as Xn,Mm as Jn,Mn as Tt,t4 as eo,Mo as to,ul as Kt,sS as ba,Mp as be,Mq as ao,bt as Ca,uR as ka,Mr as no,Ms as oo,Mt as so,Mu as xt,uM as ro,Mv as io,uk as qt,uQ as _a,Mw as Ce,Mx as co,My as lo,Mz as Sa,js as ya,mY as Aa,jx as va,mW as Ea,mV as Ia,mU as Ta,sf as uo,fg as mo,cN as po,cO as ho,mR as fo,fc as go,n6 as bo,DV as Zt,MA as Co,MB as ko,MC as _o,MD as So,b5 as et,f4 as yo,gO as Ao,fG as vo,n0 as Eo,i$ as Io,mZ as To,mX as xo,e_ as Do,eY as wo}from"./zeni-epic-state-B3AwsZqW.js";import{z as j,a2 as ae,s as D,d as x,O as q,aU as Fo,_ as $e,N as ze,aV as xa,f as N,aW as Oo,k as _e,aX as Da,w as Se,I as R,m as Po,aY as Mo,aZ as Ro,W as wa,p as Fa,a as Oa,Z as Bo,a_ as jo,U as Lo,aN as Pa,$ as se,a$ as Ma,b0 as Ra,a1 as Ba,b1 as Uo,b2 as Go,aq as Yo,r as Vo,Y as No,b3 as $o,b4 as zo,b5 as Ko,b6 as ke}from"./index-CtCI_jgi.js";import{n as Dt}from"./mui-BBkBdMVO.js";import{a as b}from"./sentry-67DqaLi1.js";import{w as ja}from"./withTransactionSidePanel-KXh--JtC.js";import{c as La,t as Fe,f as ue,a as wt,v as qo}from"./routePaths-Bd-gFJIO.js";import{u as ne}from"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import Ue from"./NotFoundScreen-GGUH6kfI.js";import{u as Ft}from"./useInitialThreadRequest-CHUXHA4e.js";import{t as Ua}from"./analyticsHelper-Cnf9wNpk.js";import{C as Zo}from"./CompanyPassportScreen-CKvp1ssr.js";import{u as Qo}from"./useAiCfoDashboardSuggestedQuestionsChips-CjjIkZeq.js";import{F as Ho}from"./FeaturePreviewScreen-CWGIZoD1.js";import{R as Wo}from"./ReferralListScreen-deq5DiBs.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";import"./TransactionDetailScreen-Mjv-0Vsi.js";import"./decodeURIComponentSafe-HZX6LUOb.js";import"./MobileAppDrawer-DjZLcHYq.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]="955bc4d5-6a30-4c03-a92d-3dc788074429",e._sentryDebugIdIdentifier="sentry-dbid-955bc4d5-6a30-4c03-a92d-3dc788074429")}catch{}})();const Xo=ja(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=j.getSignedInUser(),i=_(y=>y.tenantState.currentTenantId),c=_(y=>U(y)),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo(()=>({authParams:u,companyName:C,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),h=b.useMemo(()=>r!=null?sa(r):xe(),[r]),p=z(),f=W(),A=_(y=>In(y,h,o)),E=b.useCallback(()=>{o!=null&&A.fetchState!=="In-Progress"&&A.fetchState!=="Completed"&&p(Tn(o,h))},[h]),S=b.useCallback(()=>{f("../../",{relative:"path"})},[]),I=b.useCallback((y,M)=>{p(Nt({sortKey:y,sortOrder:M}))},[]),T=b.useCallback(y=>{p(Nt({downloadState:y}))},[]),L=b.useCallback(y=>{if(e)e(y.transactionId,y.transactionType);else if(m!=null){const M=La({id:y.transactionId,type:y.transactionType},m);f(M);const X=D(g.state?.pathnameStackToGoBack,g.pathname);f(M,{state:{pathnameStackToGoBack:X}})}},[m,e]),k=b.useCallback(()=>{A.vendor!=null&&x.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),A.vendor.id,A.vendor.name)},[A.vendor,h]);return b.useEffect(()=>{E()},[]),b.useEffect(()=>{A.fetchState==="Completed"&&k()},[k,A.fetchState]),d.jsx(Fo,{apAgingDetail:A,downloadParams:l,reportDate:h,analytics:x,onTransactionClick:L,onReload:E,onBackClick:S,onColumnSortConfigChanged:I,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),Jo=()=>{const e=z(),a=W(),t=_(I=>xn(I)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AP Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=j.getSignedInUser(),s=_(I=>I.tenantState.currentTenantId),i=_(I=>U(I)),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo(()=>({authParams:m,companyName:c,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),C=t.apAgingUIState.selectedDate??xe(),u=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(C))},[]);b.useEffect(()=>{u()},[]);const l=b.useCallback(()=>{a("../",{relative:"path"})},[]),h=b.useCallback(I=>{e(Qe({searchString:I}))},[]),p=b.useCallback((I,T)=>{e(Qe({sortKey:T,sortOrder:I}))},[]),f=b.useCallback(I=>{a(`./${I}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[C]),A=b.useCallback(I=>{e(Qe({downloadState:I}))},[]),E=b.useCallback((I,T)=>{},[]),S=b.useCallback((I,T)=>{e(Qe({selectedDate:I,agingDateSelectionType:T})),e(bt(I))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:x,onLoad:I=>I.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(xa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:x,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:A,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},es=ja(function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=j.getSignedInUser(),i=_(k=>U(k)),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo(()=>({authParams:C,companyName:g,downloadEndPoint:`${ae}/agingDetailedReport`,timezone:Xe()}),[]),l=b.useMemo(()=>r!=null?sa(r):xe(),[r]),h=z(),p=W(),f=_(k=>Dn(k,l,o)),A=b.useCallback(()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(wn(o,l))},[l]),E=b.useCallback(()=>{p("../../",{relative:"path"})},[]),S=b.useCallback((k,y)=>{h($t({sortKey:k,sortOrder:y}))},[]),I=b.useCallback(k=>{h($t({downloadState:k}))},[]),T=b.useCallback(k=>{if(e)e(k.transactionId,k.transactionType);else if(c!=null){const y=La({id:k.transactionId,type:k.transactionType},c);p(y);const M=D(m.state?.pathnameStackToGoBack,m.pathname);p(y,{state:{pathnameStackToGoBack:M}})}},[c,e]),L=b.useCallback(()=>{f.customer!=null&&x.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)},[f.customer,l]);return b.useEffect(()=>{A()},[]),b.useEffect(()=>{f.fetchState==="Completed"&&L()},[f.fetchState,L]),d.jsx(Oo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:x,onTransactionClick:T,onReload:A,onBackClick:E,onColumnSortConfigChanged:S,updateDownloadStateHandler:I,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})}),ts=()=>{const e=z(),a=W(),t=_(S=>Fn(S)),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ne({mobileExploreReferrer:"AR Aging"});$e({isDataReady:t.fetchState==="Completed"});const r=j.getSignedInUser(),s=_(S=>U(S)),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo(()=>({authParams:c,companyName:i,downloadEndPoint:`${ae}/agingReport`,timezone:Xe()}),[]),g=t.arAgingUIState.selectedDate??xe(),C=b.useCallback(()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(g))},[]);b.useEffect(()=>{C()},[]);const u=b.useCallback(()=>{a("../",{relative:"path"})},[]),l=b.useCallback(S=>{e(He({searchString:S}))},[]),h=b.useCallback((S,I)=>{e(He({sortKey:I,sortOrder:S}))},[]),p=b.useCallback(S=>{a(`./${S}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)},[g]),f=b.useCallback(S=>{e(He({downloadState:S}))},[]),A=b.useCallback((S,I)=>{e(He({selectedDate:S,agingDateSelectionType:I})),e(Ct(S))},[]),E=b.useCallback((S,I)=>{e(On({nodeId:S,isCollapsed:I}))},[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(ze,{analytics:x,onLoad:S=>S.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(xa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:x,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:A,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Ya(e,a){const t=Rn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Fe(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(Bn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?x.trackZeniAccountsCashBalancePromoClicked("Move Money"):(x.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 x.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const as=te(function(e){const a=Pn(e).accountsInOrder.map((n,o)=>Ga(n,o)),t=Mn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:x}},Ya)(Da),ns=te(function(e){const a=jn(e).accountsInOrder.map((o,r)=>Ga(o,r)),t=j.getSignedInUser(),n=Ge(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:x}},Ya)(Da);function os(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1),r=St(n?.loggedInUserRoleMap);return _(s=>s.cashBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(as,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ss(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=St(n?.loggedInUserRoleMap),r=_(s=>U(s).company?.companyInfo.firstMonthOfFY??1);return _(s=>s.cardBalanceState.fetchState)==="Error"?d.jsx(Ue,{}):d.jsx(ns,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const rs=Dt.div`
2
- display: flex;
3
- flex: 1 1 auto;
4
- min-height: 100%;
5
- flex-direction: column;
6
- background-color: ${e=>e.theme.colors.grey4};
7
- `,is=Dt.div`
8
- display: flex;
9
- flex: 1 1 auto;
10
- flex-direction: column;
11
- align-items: center;
12
- background-color: ${e=>e.theme.colors.grey4};
13
- `;function cs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=W(),i=z(),c=H(),{tenantEmailDomain:m}=K(),g=Po();return d.jsxs(rs,{children:[d.jsx(Mo,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:g.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:C=>{C.trim().length>=2?i(le({searchString:C,searchOrigin:"navbar"})):C.trim().length===0&&i(ee("navbar"))},onAutoCompleteEntity:C=>{n!=null&&x?.trackSearch(N.Event.search,ls(a),C.type,C.name,n);const u=ue(C,m),l=D(c.state?.pathnameStackToGoBack,c.pathname);s(u,{state:{pathnameStackToGoBack:l}})}}},rightSideComponent:d.jsx(Ro,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(is,{children:a==="cash_balance"?d.jsx(os,{}):d.jsx(ss,{})})]})}function Qt(){const e=H(),a=z(),{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(R.isDepositAccountsFeatureEnabled),o=_(p=>p.cashBalanceState.fetchState),r=_(p=>p.cardBalanceState.fetchState),s=j.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=ra((p=>{const f=ia(p,"/").split("/");return f[f.length-1]})(e.pathname));let c="Not-Started",m="";const g=q.getLocalizedStrings();switch(i){case"cash_balance":c=o,m=g.reportTitleById.cash_balance;break;case"card_balance":c=r,m=g.reportTitleById.card_balance;break;default:console.error(`${i} is not supported!`)}const{isAiCfoAccessEnabled:C,onAskAiCfoClick:u}=ne({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});$e({isDataReady:c==="Completed"});const l=_(p=>p.entityAutoCompleteState.autoCompleteText.navbar),h=_(p=>ce(p,"navbar"));return b.useEffect(()=>{c==="Not-Started"&&function(p,f,A){switch(f){case"card_balance":p(da());break;case"cash_balance":p(ca()),A===!0&&p(la());break;default:throw new Error(`balance report type ${f} is not yet supported`)}}(a,i,n)},[s,a,c]),d.jsxs(d.Fragment,{children:[c==="Completed"?d.jsx(ze,{analytics:x,onLoad:p=>((f,A)=>{switch(A){case"card_balance":f.trackPageLoaded(N.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(N.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${A}!`)}})(p,i)}):null,d.jsx(cs,{title:m,reportId:i,autoCompleteText:l,entityAutoCompleteView:h,isAiCfoAccessEnabled:C,onAskAiCfoClick:u})]})}const ls=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},ds=[];function Ke(e){const{mobileExploreReferrer:a}=e,t=z(),n=W(),o=H(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=wa(),c=Fa(),m=Ba(c),g=oa(),C=_(O=>O.tenantState.fetchState==="Completed"||O.tenantState.activeTenantFetchState.fetchState==="Completed"?U(O):void 0),u=C?.masterTOSInfo?.isMasterTOSAccepted??!1,l=_(O=>ua(O)),h=l.uiState?.currentChatSessionId,p=l.allSessionsWithOrderedQuestionAnswers??ds,f=j.getSignedInUser()?.userId,A=Oa(),E=Bo()&&A&&r!=null,S=jo(),I=Lo(!0),T=_(O=>S!=null?Ln(O,S):void 0),{useDynamicConfig:L}=Se(),{configValue:k}=L(Pa.aiCfoMessageDynamicConfig),y=b.useMemo(()=>Array.isArray(k.default_message_list)?k.default_message_list:[],[k.default_message_list]),M=b.useMemo(()=>y.slice(0,2),[y]),X=S!=null&&T!=null&&T.fetchState!=="Completed"&&T.fetchState!=="Error"&&(I||T.fetchState==="In-Progress"),Oe=b.useMemo(()=>{if(S==null||T?.fetchState==="Error")return M;if(X)return[];const O=(T?.suggestedQuestions??[]).map(pe=>pe.trim()).filter(pe=>pe.length>0).slice(0,2);return O.length===0?M:O},[M,X,S,T?.fetchState,T?.suggestedQuestions]),Pe=b.useCallback((O,pe)=>{if(f==null||O.trim()==="")return;if(!u)return void se({location:o,navigate:n,mergeState:{referrer:a}});const Me=Ma(g.getState());if(m){const Ze=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ze,referrer:a,aiCfoInitialQuestion:O,aiCfoShouldSubmit:!Me}})}else{if(Me)return t(kt(O)),void s(!0);i(O),s(!0),Ra(t,O,"insights_section",h,p,f,pe,void 0)}},[p,h,t,u,m,o,a,n,s,i,g,r,f]),me=b.useCallback(()=>{if(u)if(m){const O=D(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:O,referrer:a}})}else s(!0);else se({location:o,navigate:n,mergeState:{referrer:a}})},[u,m,o,a,n,s,r]);return b.useMemo(()=>{if(E)return{isSuggestedQuestionsLoading:X,onAskSomethingElseClick:me,onSuggestedQuestionClick:Pe,suggestedQuestions:Oe}},[E,X,me,Pe,Oe])}const qe=Uo,us=te(function(e){const a=Un(e),t=Gn(e),n=ma(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=j.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${ae}/statement`,authParams:C},analytics:x,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e(Yn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ne(t,n)),e(Re({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(De("month")),e(de(a.firstMonthOfFY,t)),e(Re({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ye(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ve(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout(()=>e(Re({resetLeftScroll:!0})),50)},onElementCollapseStateChanged:(t,n)=>{e(Re({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Re({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(qe),ms=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ne({mobileExploreReferrer:"DashboardCashInCashOut"}),s=Ke({mobileExploreReferrer:"DashboardCashInCashOut"}),i=_(c=>ma(c)).mode==="compare_mode";return d.jsx(us,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},ps=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},hs=te(function(e){const a=Vn(e),t=Nn(e),n=pa(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_position,i=j.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${ae}/statement`,authParams:C},analytics:x,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}},function(e,a){return{updateDownloadStateHandler:t=>{e($n(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(Be({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ne(t,n)),e(Be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ye(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ve(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)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=ps(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Fe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Be({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}})(qe),fs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ne({mobileExploreReferrer:"DashboardCashPosition"}),s=Ke({mobileExploreReferrer:"DashboardCashPosition"}),i=_(c=>pa(c)).mode==="compare_mode";return d.jsx(hs,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},$=(e,a,t,n)=>{e===!1?a!=null&&n("../../",{relative:"path"}):a!=t&&(a!=null&&a.length>0?n(`../${t}`,{replace:!0}):n(`./forecast/${t}`,{replace:!0}))};function dt(){return d.jsxs(gt,{children:[d.jsx(F,{path:"/",element:d.jsx(re,{})}),d.jsx(F,{path:"/:forecastId",element:d.jsx(re,{})}),d.jsx(F,{path:"/:forecastId/*",element:d.jsx(Ue,{})})]})}const gs=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},bs=te(function(e){const a=ha(e),t=zn(e),n=Kn(e),o=qn(e),r=yt(e),{scrollPosition:s,...i}=r,c=t.reportTitle,m=j.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=At(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${ae}/statement`,authParams:l},analytics:x,isZeniUser:Ge(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(Hn(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ne(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ye(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ve(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(ge({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=gs(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?wt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Fe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ge({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t==="forecast_mode"?(e(zt({viewMode:"account_group"})),e(fa(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ge({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Burn Rate"),e(zt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(Qn({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(Zn())},onResyncReports:()=>{e(vt("net_burn_or_income_by_classes"))}}})(qe),Cs=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ne({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),c=Ke({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=_(k=>yt(k)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(k=>Et(k.forecastState,u??"")),h=_(k=>ha(k)),p=_(k=>It(k)),f=_(k=>we(k)),A=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const k=l?.forecastPeriod,y=E!=null&&k.endDate.isAfter(E?.endDate)===!0?E:k;a(de(e.firstMonthOfFY,{startDate:y.endDate.startOf(C),endDate:y?.endDate}))}},[u]);const S=_e(),{useFeatureGate:I}=Se(),{isFeatureEnabled:T}=I(R.isReportsCommentingEnabled),L=Ft(T?S?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(bs,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:A,navigate:o,analytics:x,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:L,isReportsCommentingEnabled:T})},ks=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},_s=te(function(e){const a=ga(e),t=Wn(e),n=Xn(e),o=Jn(e),r=Tt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.operating_expenses,m=j.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=At(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${ae}/statement`,authParams:l},analytics:x,isZeniUser:Ge(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(ao(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ne(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ye(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ve(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(be({resetLeftScroll:!0})),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=ks(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?wt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Fe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t=="forecast_mode"?(e(Kt({viewMode:"account_group"})),e(ba(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Kt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(to({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(eo())},onResyncReports:()=>{e(vt("operating_expenses_by_classes"))}}})(qe),Ss=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ne({mobileExploreReferrer:"DashboardOpEx"}),c=Ke({mobileExploreReferrer:"DashboardOpEx"}),m=_(y=>Tt(y)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(y=>Et(y.forecastState,u??"")),h=_(y=>ga(y)),p=_(y=>It(y)),f=_(y=>we(y)),A=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const y=l?.forecastPeriod,M=E!=null&&y.endDate.isAfter(E?.endDate)===!0?E:y;a(de(e.firstMonthOfFY,{startDate:M.endDate.startOf(C),endDate:M?.endDate}))}},[u]);const S=_e(),I=S?.loggedInUserRole!=null&&Ca(S?.loggedInUserRole)!==!0,{useFeatureGate:T}=Se(),{isFeatureEnabled:L}=T(R.isReportsCommentingEnabled),k=Ft(L?S?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(_s,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:A,navigate:o,forecastIdFromUrlPath:r,analytics:x,hasTransactionAccess:I,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:k,isReportsCommentingEnabled:L})},ys=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},As=te(function(e){const a=ka(e),t=no(e),n=oo(e),o=so(e),r=xt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.revenue,m=j.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=At(C);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,reportLabels:{reportTitle:c},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,uiState:i,scrollPosition:s,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${ae}/statement`,authParams:l},analytics:x,isZeniUser:Ge(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:we(e)}},function(e,a){return{updateDownloadStateHandler:t=>{e(co(t))},onTimeframeSelectionChanged:t=>{e(De(t)),setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ne(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Ye(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ve(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&$(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout(()=>e(Ce({resetLeftScroll:!0})),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=ys(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?wt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):Fe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Ce({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t==="forecast_mode"?(e(qt({viewMode:"account_group"})),e(_a(!1,n?.id)),n!=null&&$(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):$(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(qt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(io({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(ro())},onResyncReports:()=>{e(vt("revenue_by_classes"))}}})(qe),vs=e=>{const a=z(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ne({mobileExploreReferrer:"DashboardRevenue"}),c=Ke({mobileExploreReferrer:"DashboardRevenue"}),m=_(k=>xt(k)),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_(k=>Et(k.forecastState,u??"")),h=_(k=>ka(k)),p=h.dataAvailable,f=m.mode==="compare_mode",A=_(k=>we(k)),E=_(k=>It(k));b.useEffect(()=>{if(u!=null&&g===!0&&($(g,r,u,o),l!=null)){const k=l?.forecastPeriod,y=p!=null&&k.endDate.isAfter(p?.endDate)===!0?p:k;a(de(e.firstMonthOfFY,{startDate:y.endDate.startOf(C),endDate:y?.endDate}))}},[u]);const S=_e(),{useFeatureGate:I}=Se(),{isFeatureEnabled:T}=I(R.isReportsCommentingEnabled),L=Ft(T?S?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(As,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:A,isCompareModeOn:f,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:x,reportsResyncFetchState:E.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:L,isReportsCommentingEnabled:T})},Es=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}},Is=te(function(e){const a=lo(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ce(e,"navbar");return{report:a,analytics:x,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}},function(e,a){return{onTimeframeSelectionChanged:t=>{x.trackTimeframeSwitch(Ua(t),"Top Expenses"),e(Sa(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Es(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=Fe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ee("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}})(Go),Ts=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return d.jsx(Is,{tenantEmailDomain:a,location:t,navigate:n})},xs=Dt.div`
14
- display: flex;
15
- flex: 1 1 auto;
16
- min-height: 100%;
17
- flex-direction: column;
18
- background-color: ${e=>e.theme.colors.grey5};
19
- align-items: center;
20
- `,Te=3,Ot=1;function Ds({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=W(),r=H(),{tenantEmailDomain:s}=K();let i;$e({isDataReady:!0});const c={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(Ss,{...c});break;case"revenue":i=d.jsx(vs,{...c});break;case"net_burn_or_income":i=d.jsx(Cs,{...c});break;case"cash_position":i=d.jsx(fs,{...c});break;case"top_expenses":i=d.jsx(Ts,{...c});break;case"cash_in_cash_out":i=d.jsx(ms,{...c});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(xs,{children:i}):null}function re(){const e=H(),a=z(),{forecastId:t}=K();let n="Not-Started";const o=_(l=>Tt(l).fetchState),r=_(l=>xt(l).fetchState),s=_(l=>yt(l).fetchState),i=_(l=>l.cashPositionState.fetchState),c=_(l=>l.topExState.fetchState),m=_(l=>l.cashInCashOutState.fetchState);if(j.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const g=_(l=>U(l)),C=g?.company?.companyInfo?.firstMonthOfFY??1,u=ra((l=>{const h=ia(l,"/").split("/");return t!=null?h[h.length-3]:h[h.length-1]})(e.pathname));switch(u){case"operating_expenses":n=o;break;case"revenue":n=r;break;case"net_burn_or_income":n=s;break;case"cash_position":n=i;break;case"top_expenses":n=c;break;case"cash_in_cash_out":n=m;break;default:console.error(`${u} is not supported!`)}return b.useEffect(()=>{n==="Not-Started"&&function(l,h,p,f){switch(h){case"operating_expenses":l(Ta(!0)),f!=null&&(l(Ie(p,!0,Te,{id:f,index:0})),l(ba(!1,f)));break;case"revenue":l(Ia(!0)),f!=null&&(l(Ie(p,!0,Te,{id:f,index:0})),l(_a(!1,f)));break;case"net_burn_or_income":l(Ea(!0)),f!=null&&(l(Ie(p,!0,Te,{id:f,index:0})),l(fa(!1,f)));break;case"cash_position":l(va(!0));break;case"top_expenses":l(Aa());break;case"cash_in_cash_out":l(ya());break;default:throw new Error(`report type ${h} is not yet supported`)}}(a,u,C,t)},[t]),d.jsxs(d.Fragment,{children:[n==="Completed"?d.jsx(ze,{analytics:x,onLoad:l=>((h,p)=>{const f=e.state?.referrer;switch(p){case"operating_expenses":h.trackPageLoaded(N.Event.operatingExpenses,f);break;case"revenue":h.trackPageLoaded(N.Event.revenues,f);break;case"net_burn_or_income":h.trackPageLoaded(N.Event.burnRate,f);break;case"cash_position":h.trackPageLoaded(N.Event.cashPosition,f);break;case"top_expenses":h.trackPageLoaded(N.Event.topExpenses,f);break;case"cash_in_cash_out":h.trackPageLoaded(N.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${p}!`)}})(l,u)}):null,d.jsx(Ds,{firstMonthOfFY:C,fetchState:n,reportId:u,forecastId:t})]})}var ut=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function mt(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),function(){t(window.event)})}function Va(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 Na(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 Pt={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,"-":ut?173:189,"=":ut?61:187,";":ut?59:186,"'":222,"[":219,"]":221,"\\":220},ie={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},_t={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},P={},We=1;We<20;We++)Pt["f".concat(We)]=111+We;var w=[],Ht=!1,$a="all",Wt=[],tt=function(e){return Pt[e.toLowerCase()]||ie[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function Xt(e){$a=e||"all"}function Le(){return $a||"all"}var pt=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;Na(a).forEach(function(s){var i=s.split(r),c=i.length,m=i[c-1],g=m==="*"?"*":tt(m);if(P[g]){t||(t=Le());var C=c>1?Va(ie,i):[];P[g]=P[g].filter(function(u){return!((!n||u.method===n)&&u.scope===t&&function(l,h){for(var p=l.length>=h.length?l:h,f=l.length>=h.length?h:l,A=!0,E=0;E<p.length;E++)f.indexOf(p[E])===-1&&(A=!1);return A}(u.mods,C))})}})};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 ea(e,a){var t=P["*"],n=e.keyCode||e.which||e.charCode;if(G.filter.call(this,e)){if(n!==93&&n!==224||(n=91),w.indexOf(n)===-1&&n!==229&&w.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(h){var p=_t[h];e[h]&&w.indexOf(p)===-1?w.push(p):!e[h]&&w.indexOf(p)>-1?w.splice(w.indexOf(p),1):h==="metaKey"&&e[h]&&w.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(w=w.slice(w.indexOf(p))))}),n in B){for(var o in B[n]=!0,ie)ie[o]===n&&(G[o]=!0);if(!t)return}for(var r in B)Object.prototype.hasOwnProperty.call(B,r)&&(B[r]=e[_t[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(w.indexOf(17)===-1&&w.push(17),w.indexOf(18)===-1&&w.push(18),B[17]=!0,B[18]=!0);var s=Le();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 P){for(var c=0;c<P[n].length;c++)if((e.type==="keydown"&&P[n][c].keydown||e.type==="keyup"&&P[n][c].keyup)&&P[n][c].key){for(var m=P[n][c],g=m.splitKey,C=m.key.split(g),u=[],l=0;l<C.length;l++)u.push(tt(C[l]));u.sort().join("")===w.sort().join("")&&Jt(e,m,s,a)}}}}function G(e,a,t){w=[];var n=Na(e),o=[],r="all",s=document,i=0,c=!1,m=!0,g="+",C=!1;for(t===void 0&&typeof a=="function"&&(t=a),Object.prototype.toString.call(a)==="[object Object]"&&(a.scope&&(r=a.scope),a.element&&(s=a.element),a.keyup&&(c=a.keyup),a.keydown!==void 0&&(m=a.keydown),a.capture!==void 0&&(C=a.capture),typeof a.splitKey=="string"&&(g=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(g)).length>1&&(o=Va(ie,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in P||(P[e]=[]),P[e].push({keyup:c,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:g,element:s});s!==void 0&&!function(u){return Wt.indexOf(u)>-1}(s)&&window&&(Wt.push(s),mt(s,"keydown",function(u){ea(u,s)},C),Ht||(Ht=!0,mt(window,"focus",function(){w=[]},C)),mt(s,"keyup",function(u){ea(u,s),function(l){var h=l.keyCode||l.which||l.charCode,p=w.indexOf(h);if(p>=0&&w.splice(p,1),l.key&&l.key.toLowerCase()==="meta"&&w.splice(0,w.length),h!==93&&h!==224||(h=91),h in B)for(var f in B[h]=!1,ie)ie[f]===h&&(G[f]=!1)}(u)},C))}var ht={setScope:Xt,getScope:Le,deleteScope:function(e,a){var t,n;for(var o in e||(e=Le()),P)if(Object.prototype.hasOwnProperty.call(P,o))for(t=P[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Le()===e&&Xt(a||"all")},getPressedKeyCodes:function(){return w.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=tt(e)),w.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(P).forEach(function(t){var n=P[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(P).forEach(function(s){return delete P[s]});else if(Array.isArray(e))e.forEach(function(s){s.key&&pt(s)});else if(typeof e=="object")e.key&&pt(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=""),pt({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Pt,modifier:ie,modifierMap:_t};for(var ft in ht)Object.prototype.hasOwnProperty.call(ht,ft)&&(G[ft]=ht[ft]);if(typeof window<"u"){var ws=window.hotkeys;G.noConflict=function(e){return e&&window.hotkeys===G&&(window.hotkeys=ws),G},window.hotkeys=G}G.filter=function(){return!0};var ta=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Fs(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,c=o.keydown,m=o.filterPreventDefault,g=m===void 0||m,C=o.enabled,u=C===void 0||C,l=o.enableOnContentEditable,h=l!==void 0&&l,p=b.useRef(null),f=b.useCallback(function(A,E){var S,I;return s&&!s(A)?!g:!!(ta(A,["INPUT","TEXTAREA","SELECT"])&&!ta(A,r)||(S=A.target)!=null&&S.isContentEditable&&!h)||!!(p.current===null||document.activeElement===p.current||(I=p.current)!=null&&I.contains(document.activeElement))&&(a(A,E),!0)},n?[p,r,s].concat(n):[p,r,s]);return b.useEffect(function(){if(u)return i&&c!==!0&&(t.keydown=!1),G(e,t||{},f),function(){return G.unbind(e,f)};G.unbind(e,f)},[f,e,u]),p}G.isPressed;const Os=[],aa="dashboard_card",J="ai_cfo_dashboard_card";function na(e,a){return a?e.some(t=>String(t)===J)?e.slice():[J,...e]:e.filter(t=>String(t)!==J)}const Ps=["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"],Ms=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e.status!=null?{balanceAmount:e.balance?.available,lastUpdatedTime:e.status.lastRefreshSuccessTime,changePercent:e.balance?.change?.percent,changeComparedToDate:e.balance?.change?.since}:void 0}),je=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),Rs=(e,a,t,n)=>je(void 0,e,ke,a,t),Bs=(e,a,t,n,o)=>({card:{dimension:et(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1,spansFullDashboardWidth:!1},data:{funds:n,hasUserSeenVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),js=e=>{const a=et(ke);return a.height=ke.height+10,{card:{dimension:a,cardType:J,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ls=te(function(e,a){const t=Ys(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:c,hasUserSeenTreasuryVideo:m,treasuryFetchState:g}=a;let C=n.map((u,l)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return Rs(t,u,l);if(u==="zeni_promo_card")return je({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,l);if(u==="treasury_promo_card")return Bs(g,u,l,c,m);if(u==="information_card")return je(void 0,"Completed",ke,u,l);if(u===J)return js(l);{const h=o.find(p=>p?.reportId===u);return h?function(p,f,A,E){const S=p.reportId;switch(S){case"card_balance":case"cash_balance":return[Ms(p,f,A,S,E)];case"expense_automation_card":case"operating_expenses":case"revenue":case"top_expenses":case"cash_position":case"cash_in_cash_out":case"insights_dashboard":case"company_details":case"task_card":case"bill_pay_card":case"reimbursement_card":case"net_burn_or_income":case"accounts_payable_aging":case"accounts_receivable_aging":case"zeni_accounts_promo_card":case"rewards_card":return[je(p,f,A,S,E)];case"net_burn_or_income_story_card":return[je(p,f,A,"net_burn_or_income_story_card",E)];default:return console.error(`card type ${S} not yet supported!`),[]}}(h,h.fetchState,ke,l):[]}}).flat();return a.isSummaryCardsFiltered===!0&&(C=C.filter(u=>Ps.includes(u.card.cardType)==0).filter(u=>{const l=u.data?.availableNumberOfPeriods;return l!=null?l>0:u.card.cardType!="top_expenses"||u.data==null||function(h){if(h==null||h.length===0)return!0;let p=!0;for(const f of h)if(f.balance.available.amount!==0){p=!1;break}return p}(u.data.topExpenses.accountsOrdered)===!1})),{cardDataArray:C,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ce(e,"navbar")},analytics:x,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}},function(e,a){const t=a.tenantId,n=j.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)x.trackDashboardCardClicked("cards promo",2),x.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&&x.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(x.trackMonthEndCloseClicked(a.selectedPeriod.month,a.selectedPeriod.year,"Dashboard"),a.navigate("../../month_end_close_checks/review",{state:{referrer:"Dashboard"}})):a.navigate(`${r}`,{state:{referrer:s}})},onReloadData:(o,r)=>{const s=[];a.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),a.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),a.isZeniAccountEnabled===!1&&s.push("zeni_accounts_promo_card"),a.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),function(i,c,m,g){if(c!==J)switch(c){case"card_balance":i(da());break;case"cash_balance":i(ca());break;case"operating_expenses":i(Ta(!0));break;case"revenue":i(Ia(!0));break;case"net_burn_or_income":i(Ea(!0));break;case"net_burn_or_income_story_card":i(xo(!0));break;case"cash_position":i(va(!0));break;case"top_expenses":i(Aa());break;case"cash_in_cash_out":i(ya());break;case"insights_dashboard":i(To());break;case"bill_pay_card":i(Io());break;case"reimbursement_card":i(Eo());break;case"company_details":i(vo(m));break;case"task_card":i(Ao());break;case"accounts_payable_aging":g.includes("accounts_payable_aging")===!1&&i(bt(xe()));break;case"accounts_receivable_aging":i(Ct(xe()));break;case"zeni_accounts_promo_card":g.includes("zeni_accounts_promo_card")===!1&&i(la());break;case"rewards_card":g.includes("rewards_card")===!1&&i(yo(!0));break;default:throw new Error(`report type ${c} is not yet supported`)}}(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{x.trackTimeframeSwitch(Ua(r),Gs(o),"Dashboard"),function(s,i,c){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(De(c));break;case"top_expenses":s(Sa(c));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}}(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(So(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){j.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"&&(x.trackUpdateBurnRateCalculatorSettings(r,s,ko(s)),e(_o(t,r,s)))},onVideoPlay:()=>{e(Zt())},onVideoClose:()=>{e(Zt()),e(Co())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(le({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(ee("navbar"))},onCancelAutoComplete:()=>{e(ee("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ue(o,a.tenantEmailDomain):qo(o.zeniId,o.qboId,a.tenantEmailDomain);const s=D(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}})(Ko);function Us(){const e=oa(),a=Fa(),t=Ba(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=wa(),s=W(),i=z(),c=H(),m=j.getSignedInUser(),{useFeatureGate:g,useDynamicConfig:C}=Se(),u=Ge(m),[l,h]=b.useState(!1),[p,f]=b.useState(!1),A=Oa(),{tenantEmailDomain:E}=K(),{isAiCfoAccessEnabled:S,onAskAiCfoClick:I}=ne({mobileExploreReferrer:"Dashboard"}),T=_(v=>v.tenantState.fetchState==="Completed"||v.tenantState.activeTenantFetchState.fetchState==="Completed"?U(v):void 0),L=T??j.getSignedInUserTenant(E),k=T?.masterTOSInfo?.isMasterTOSAccepted??!1,y=L.tenantId,M=L.companyId;b.useEffect(()=>{l===!1&&c.state?.message==="activation"&&(i(uo(M)),h(!0))},[c.state,l,M,i]),b.useEffect(()=>{A&&!p&&c.state?.message==="open_ai_cfo_drawer"&&(f(!0),k?(o(!0),s({pathname:c.pathname,search:c.search,hash:c.hash},{replace:!0,state:{...c.state,message:void 0}})):se({location:c,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))},[c,p,A,k,o,s]);const{isFeatureEnabled:X}=g(R.isApAgingFeatureEnabled),{isFeatureEnabled:Oe}=g(R.isExpenseAutomationEnabled),{isFeatureEnabled:Pe}=g(R.isExpenseAutomationEnabledV2),me=Pe||Oe&&u,{isFeatureEnabled:O}=g(R.isTreasuryEnabled),pe=Yo(me),{isFeatureEnabled:Me}=g(R.isArAgingFeatureEnabled),{isFeatureEnabled:Ze}=g(R.isDepositAccountsFeatureEnabled),{isFeatureEnabled:Mt}=g(R.isReferralFeatureEnabled),{isFeatureEnabled:za}=g(R.isChargeCardFeatureEnabled),{isFeatureEnabled:Ka}=g(R.isAiCfoFileUploadEnabled),{isFeatureEnabled:qa}=g(R.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Za}=g(R.isDashboardSidebarNewYearAnimationEnabled),{configValue:Rt}=C(Pa.zeniCardsConfig),Qa=Rt.charge_card_cashback_rate_per_transaction==null?.0175:Rt.charge_card_cashback_rate_per_transaction;if(c.state?.message==="activation"){const v=Vo(c.state?.pathnameStackToGoBack);s(c.pathname,{state:{...c.state,message:void 0,pathnameStackToGoBack:v.newStack}})}const[Bt,Ha]=b.useState(!1),[at,Wa]=b.useState(!1);Fs("command+p, Control+p",v=>{Wa(!at),v.preventDefault()},{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const jt=T?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const he=_(v=>U(v)?.excludedResources),Xa=_(v=>v.expenseAutomationViewState.selectedPeriodByTenantId),Ja=!!T?.companyReimbursementInfo?.info?.isReimbursementEnabled,en=!!T?.companyBillPayInfo?.info?.isBillPayEnabled,tn=_(v=>v.treasurySetupViewState.treasuryFundsDetails).fetchStatus.fetchState,an=T?.company!=null&&mo(T.company),nt=O&&an,ot=_e(),nn=St(ot?.loggedInUserRoleMap),Y=[],Lt=he?.resources?.find(v=>v.resource==="/reports/top_expenses")==null,on=he?.resources?.find(v=>v.resource==="/reports/task_card")==null,st=T?.userRole!=null&&Ca(T?.userRole),sn=he?.resources?.find(v=>v.resource==="/bills")==null&&!st,rn=he?.resources?.find(v=>v.resource==="/reimbursements")==null,cn=po(ot?.loggedInUserRoleMap),ln=ho(ot?.loggedInUserRoleMap),dn=T?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,un=T?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,mn=_(v=>v.treasurySetupViewState.treasuryFundsDetails).fundsDetails;Lt===!1&&Y.push("top_expenses"),on===!1&&Y.push("task_card"),sn===!1&&Y.push("bill_pay_card","bill_pay_promo_card"),X===!1&&Y.push("accounts_payable_aging"),Me===!1&&Y.push("accounts_receivable_aging"),(me===!1||st)&&Y.push("expense_automation_card"),rn===!1&&Y.push("reimbursement_card","reimbursement_promo_card"),Ze===!1&&Y.push("zeni_accounts_promo_card"),Mt===!1&&Y.push("rewards_card"),nt===!1&&Y.push("treasury_promo_card");const{areTenantIdsInSync:Ut}=No();b.useLayoutEffect(()=>{Bt&&pe===me||jt!==!0||!Ut||he?.fetchState!=="Completed"&&he?.fetchState!=="Error"||(Ha(!0),i(fo(m.userId,M,y,!0,!1,Y)))},[Bt,m,y,i,Lt,jt,he?.fetchState,Ut]);const pn=_(v=>v.reportUIOptionsState.forecastOnDashboard.isForecastModeOn),hn=_(v=>v.revenueState.uiState.selectedForecast?.id),fn=_(v=>v.cardBalanceState.fetchState),oe=_(v=>go(v,Y,m,Pe,Oe,nt)),gn=oe.fetchState,bn=b.useMemo(()=>na(oe.cardsOrdered,S),[oe.cardsOrdered,S]),Cn=b.useMemo(()=>na(oe.cardsForDashboardUI,S),[oe.cardsForDashboardUI,S]);$e({isDataReady:!0});const{isSuggestedQuestionsLoading:kn,suggestedPromptQuestions:_n}=Qo(),Gt=T?.isTreasuryVideoViewed===!0||oe.isTreasuryVideoClosed===!0,Yt=_(v=>ua(v)),ye=Yt.uiState?.currentChatSessionId,rt=Yt.allSessionsWithOrderedQuestionAnswers??Os,{currentSessionQuestionAnswers:Sn}=$o(rt,ye),Vt=Sn.length===0,yn=b.useCallback((v,Z,fe)=>{const Ae=m?.userId;if(Ae==null)return;const V=v.trim();if(V.length===0&&Z.length===0)return;if(!k)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});const Q=Ma(e.getState()),ve=()=>{const Ee=D(c.state?.pathnameStackToGoBack,c.pathname);s(`/${E}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ee,referrer:"Dashboard",aiCfoInitialQuestion:V,aiCfoShouldSubmit:!Q&&V.length>0,aiCfoInitialSubmissionSource:aa,...typeof fe=="number"?{aiCfoSuggestionIndex:fe}:{}}})};return t?Z.length>0?void o(!0):void ve():Z.length>0?Q?(i(kt(V)),void o(!0)):(r(V.length>0?V:null),o(!0),void(V.length>0&&Ra(i,V,aa,ye,rt,Ae,fe,Z.length>0?Z:void 0))):(Q&&i(kt(V)),void ve())},[rt,ye,i,k,t,c,s,r,o,m?.userId,e,E]),An=b.useCallback(()=>{k?o(!0):se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[k,c,s,o]),vn=b.useCallback(()=>{if(!k)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});if(E==null)return;const v=D(c.state?.pathnameStackToGoBack,c.pathname);s(`/${E}/ai-cfo/explore`,{state:{pathnameStackToGoBack:v,referrer:"Dashboard"}})},[k,c,s,E]),En=b.useCallback(()=>{if(k)if(t){if(E==null||T==null)return;const v=ye==null||Vt?`/${E}/ai-cfo/explore`:`/${E}/ai-cfo/${ye}`,Z=c.state?.pathnameStackToGoBack??[],fe=D(Z,c.pathname);s(v,{state:{...c.state,pathnameStackToGoBack:fe,[zo]:!0}})}else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})},[k,t,c,s,E,T,ye,Vt]);return d.jsxs(d.Fragment,{children:[gn==="Completed"?d.jsx(ze,{analytics:x,onLoad:v=>{v.trackPageLoaded(N.Event.dashboard),nt&&!Gt&&v.trackTreasuryPromoView("Dashboard Promo Video")}}):null,d.jsx(Ls,{maxColumns:n?2:void 0,isAiCfoAccessEnabled:S,onAskAiCfoClick:I,onAiCfoDashboardOpenPanel:An,onAiCfoDashboardOpenScopePage:En,isAiCfoFileUploadEnabled:Ka===!0&&t===!1,onAiCfoDashboardPromptSubmit:yn,onAiCfoDashboardExpandToFullPage:vn,aiCfoDashboardSuggestedPromptQuestions:_n,aiCfoDashboardSuggestedPromptQuestionsLoading:kn,onDragAndDropCard:(v,Z)=>{if(v===J||Z===J)return;const fe=function(Q,ve,Ee){const it=Ee.indexOf(Q),ct=Ee.indexOf(ve);if(it===-1||ct===-1||it===ct)return Ee;const lt=[...Ee];return lt.splice(it,1),lt.splice(ct,0,Q),lt}(v,Z,bn),Ae=fe.filter(Q=>Q!==J),V=oe.cardsOrdered;(Ae.length!==V.length||Ae.some((Q,ve)=>Q!==V[ve]))&&i(bo(Ae))},dashboardReport:oe,passedCardsOrdered:Cn,tenantId:y,companyId:M,tenantEmailDomain:E,location:c,navigate:s,isApAgingFeatureEnabled:X,isArAgingFeatureEnabled:Me,isBillPayEnabled:en,isReimbursementEnabled:Ja,isSummaryCardsFiltered:at,isForecastOn:pn,selectedForecastOnDashboard:hn,isVisitingFirstTime:l,isZeniAccountEnabled:Ze,isRewardsFeatureEnabled:Mt,hasZeniAccountsAdminAccess:nn,isExpenseAutomationEnabledForUser:me&&st===!1,selectedPeriod:Xa[y],isChargeCardFeatureEnabled:za,isUserHasCardsAccess:cn,isUserHasTreasuryAccess:ln,cardsCreditLimit:dn,cashbackRate:Qa,isInterestedInChargeCard:un,cardBalanceFetchState:fn,christmasAnimationEnabled:qa,newYearAnimationEnabled:Za,treasuryFundDetails:mn,hasUserSeenTreasuryVideo:Gt,treasuryFetchState:tn})]})}const Gs=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"},Ys=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map(a=>a.fetchState).reduce((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t);function gr(){const e=_e(),a=e?.excludedResources?.find(m=>m.resource==="/reports/top_expenses")==null,{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(R.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(R.isArAgingFeatureEnabled),r=_(m=>U(m)),{isFeatureEnabled:s}=t(R.isDebitCardFeatureEnabled),i=Do(s,r),c=wo(r);return i===!0||c===!0?d.jsx(gt,{children:d.jsx(F,{path:"/*",element:d.jsx(Ho,{})})}):d.jsxs(gt,{children:[d.jsx(F,{path:"/",element:d.jsx(Us,{})}),d.jsx(F,{path:"cash_balance/*",element:d.jsx(Qt,{})}),d.jsx(F,{path:"card_balance/*",element:d.jsx(Qt,{})}),d.jsx(F,{path:"operating_expenses/*",element:d.jsx(re,{})}),d.jsx(F,{path:"operating_expenses/forecast/*",element:d.jsx(dt,{})}),d.jsx(F,{path:"revenue/forecast/*",element:d.jsx(dt,{})}),d.jsx(F,{path:"revenue/*",element:d.jsx(re,{})}),d.jsx(F,{path:"net_burn_or_income/forecast/*",element:d.jsx(dt,{})}),d.jsx(F,{path:"net_burn_or_income/*",element:d.jsx(re,{})}),n===!0&&d.jsxs(d.Fragment,{children:[d.jsx(F,{path:"accounts_payable_aging/*",element:d.jsx(Jo,{})}),d.jsx(F,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(Xo,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(F,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(es,{})}),d.jsx(F,{path:"accounts_receivable_aging/*",element:d.jsx(ts,{})})]}),d.jsx(F,{path:"cash_position/*",element:d.jsx(re,{})}),d.jsx(F,{path:"top_expenses/*",element:a===!0?d.jsx(re,{}):d.jsx(Ue,{})}),d.jsx(F,{path:"cash_in_cash_out/*",element:d.jsx(re,{})}),d.jsx(F,{path:"company_details",element:d.jsx(Zo,{})}),d.jsx(F,{path:"referrals/*",element:d.jsx(Wo,{})}),d.jsx(F,{path:"*",element:d.jsx(Ue,{})})]})}export{gr as default};
@@ -1,18 +0,0 @@
1
- import{j as l}from"./liveblocks-BSDLCmF2.js";import{h as y,g as C,j as h,n as A,i as V}from"./core-B20PugrR.js";import{Nl as k,Ns as q,fE as K,fD as M,fC as W,iA as J,Kt as L,q3 as Q,eP as B,MT as D,iy as T,Nm as v,Nv as F,iw as G,iT as N}from"./zeni-epic-state-B3AwsZqW.js";import{bu as X,p as j,w as R,z as U,m as O,r as p,I as S,x as Z,bv as Y,o as z,bw as ee,s as te}from"./index-CtCI_jgi.js";import{n as H}from"./mui-BBkBdMVO.js";import"./sentry-67DqaLi1.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]="5bdd7558-6a8a-48bd-880c-0fbd31e86632",e._sentryDebugIdIdentifier="sentry-dbid-5bdd7558-6a8a-48bd-880c-0fbd31e86632")}catch{}})();const ne=A(null,function(e,t){return{onSaveVendor:n=>{e(J(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(L("common")),n!=null&&e(Q(n))},onGetOtp:n=>{e(W(n,"BillPayVendor"))},onResendOtp:n=>{e(M(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(K(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(q(n,a,o))}}})(X);function _({vendorId:e,billId:t,isExpressPayPage:n}){const a=y(),o=C(),s=h(r=>k(r,e));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=H.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `,oe=A(function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{navigate:n,location:a,vendorId:o}=t;return{onFetchBankName:s=>{e(N(s))},onSaveHandler:s=>{e(G(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),r=s.poppedPathname??P();n(r,{state:{pathnameStackToGoBack:s.newStack}})})(),e(v())},onACHDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(F({data:r}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),r=s.poppedPathname??P(0);t.navigate(r,{state:{pathnameStackToGoBack:s.newStack}})}e(v())}}})(Y);function fe({vendorIdParam:e,accountContext:t}){const n=y(),a=C(),o=j(),{vendorId:s,billId:r}=V(),c=e??s,{useFeatureGate:d}=R(),i=U.getSignedInUser(),b=h(u=>B(u)),g=O(),I=p(a.state?.pathnameStackToGoBack),f=t??(I.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,c)),{isFeatureEnabled:x}=d(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:w}=d(S.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(_,{vendorId:c,billId:r}),l.jsx(oe,{location:a,navigate:n,billId:r,vendorId:c,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:x,isZeniAccountsFeatureEnabled:w})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},me=(e,t,n)=>{let a=`/${e}/bill/${encodeURIComponent(t)}`;return n=="draft"&&(a+="/edit"),a},he=e=>`/${e}/bills`,ke=(e,t)=>{let n=`/${e}/bill`;return n=t!=null?n.concat(`/${t}/edit`):n.concat("/new"),n},E=(e,t,n,a)=>{let o=`/${e}/bill`;return o+=n!=null?`/${n}/edit/vendor`:"/new/vendor",o+=a!=null?`/${a}/edit/${t}`:`/create/${t}`,o};function ve(e,t,n){return E(e,"ach",t,n)}function Se(e,t,n){return E(e,"domestic",t,n)}function ge(e,t,n){return E(e,"international",t,n)}const se=(e,t,n)=>{let a=`/${e}/bill/`;return a=n!=null?a.concat(`${encodeURIComponent(n)}/${t}/`):a.concat(`new/${t}/`),a},de=H.div`
10
- display: flex;
11
- height: 100vh;
12
- width: 100%;
13
- flex: 1 1 auto;
14
- flex-direction: column;
15
- align-items: center;
16
- background-color: ${e=>e.theme.colors.grey4};
17
- box-shadow: ${e=>`0px 2px ${z.sp1} ${e.theme.colors.dropShadowNormal}`};
18
- `,re=A(function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}},function(e,t){const{billId:n,navigate:a,location:o,vendorId:s,currentTenant:r}=t,{tenantEmailDomain:c}=r;return{onFetchBankName:d=>{e(N(d))},onSaveHandler:d=>{e(G(t.bankAccountContext,d,"us-domestic",s))},onWireDetailsUpdated:d=>{const{bankAccountSection:i}=d;e(F({data:i}))},onCancel:()=>{(()=>{const d=p(o.state?.pathnameStackToGoBack),i=d.poppedPathname??$();a(i,{state:{pathnameStackToGoBack:d.newStack}})})(),e(v())},onAddressClick:d=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const i=se(c,d,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const d=p(t.location.state?.pathnameStackToGoBack),i=d.poppedPathname??$(0);t.navigate(i,{state:{pathnameStackToGoBack:d.newStack}})}e(v())}}})(ee);function Ie({vendorIdParam:e,accountContext:t}){const n=y(),a=C(),o=j(),{vendorId:s,billId:r}=V(),c=e??s,d=U.getSignedInUser(),{useFeatureGate:i}=R(),b=O(),g=h(u=>B(u)),I=p(a.state?.pathnameStackToGoBack),f=t??(I.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h(u=>k(u,c)),{isFeatureEnabled:x}=i(S.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:w}=i(S.isDepositAccountsFeatureEnabled);if(d==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${z.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(de,{windowSize:o,children:[l.jsx(_,{vendorId:c,billId:r}),l.jsx(re,{location:a,navigate:n,billId:r,vendorId:c,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:x,isZeniAccountsFeatureEnabled:w})]})}const $=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{fe as A,Ie as D,_ as V,me as a,se as b,ke as c,Se as d,he as g,ge as i,ve as v};
@@ -1 +0,0 @@
1
- import{j as i}from"./liveblocks-BSDLCmF2.js";import{p as l,y as f,m as c}from"./index-CtCI_jgi.js";import{D as p}from"./mui-BBkBdMVO.js";import"./sentry-67DqaLi1.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]="445c2df8-e5b6-4835-9e4f-a5dee1dd8d73",e._sentryDebugIdIdentifier="sentry-dbid-445c2df8-e5b6-4835-9e4f-a5dee1dd8d73")}catch{}})();const u={drawerLeftMargin:new f(0,0,240)};function m(e){const{isOpen:r,drawerLeftMargin:o,children:d,onClose:t}=e,n=l(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),a=c();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:a.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:d})}export{m as D};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BSDLCmF2.js";import{a as d}from"./sentry-67DqaLi1.js";import{h as B,u as G,g as F,i as K,j as c,N as q,n as L,o as N,p as _}from"./core-B20PugrR.js";import{LA as z,eP as O,KZ as R,kD as H,Hz as k,LF as M,Ks as W,jD as Y,HA as S,L2 as $,L3 as V,Ku as Z,Kt as J}from"./zeni-epic-state-B3AwsZqW.js";import{aR as Q,d as U,r as X,s as tt}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import{d as b}from"./decodeURIComponentSafe-HZX6LUOb.js";import{w as et}from"./withTransactionSidePanel-KXh--JtC.js";import{f as at,c as nt}from"./routePaths-Bd-gFJIO.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";import"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import"./TransactionDetailScreen-Mjv-0Vsi.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]="74f19250-9481-4b0c-9237-2448255abc2b",a._sentryDebugIdIdentifier="sentry-dbid-74f19250-9481-4b0c-9237-2448255abc2b")}catch{}})();const ot=L(function(a,t){const e=t.entity,o=M(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:W(a,"common")},trendWithTransactionsReport:o,analytics:U,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)}`,l=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:l}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(Z({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a($()),a(V()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=X(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(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}})(Q),it=et(function({entityType:a,...t}){const e=B(),o=G(),l=F(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:j,entityNameEncoded:x}=K(),r=b(j??""),p=b(x??""),u=rt(r,p),v=[r,p].filter(n=>n!=null),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=c(n=>z(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter")),w=c(n=>O(n).company?.companyInfo.firstMonthOfFY??1),f=c(n=>R(n.trendWithTransactionsState,i,"EntityDetail"));d.useEffect(()=>{m===!1&&u===!0&&(T(!0),o(H(i)))},[m,u,i]);const P=c(n=>n.trendState.fetchState),E=f?.selectedPeriod?.timePeriod??g,A=function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y}(f?.selectedPeriod?.timePeriod,g);return d.useEffect(()=>{m===!0&&h===!1&&P==="Completed"&&(D(!0),E!=null&&o(k(i,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:E})))},[m,h,P]),u?s.jsx(ot,{firstMonthOfFY:w,tenantEmailDomain:C,location:l,navigate:e,entity:i,defaultTransactionTimePeriod:A,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(q,{to:I(v.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 jt({entityType:a}){return s.jsx(N,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{jt as EntityDetailRoutes,jt as default};
@@ -1,25 +0,0 @@
1
- import{j as C}from"./liveblocks-BSDLCmF2.js";import Rn from"./NotFoundScreen-GGUH6kfI.js";import{a,b as Pt}from"./sentry-67DqaLi1.js";import{n as Fe,S as Dn}from"./mui-BBkBdMVO.js";import{u as re,h as wt,g as Ge,j as U,n as Un,i as rt,o as Fn,p as Le}from"./core-B20PugrR.js";import{eP as Re,PX as Bn,n1 as ke,fj as _n,qG as Vn,nj as xt,nE as Rt,PY as Dt,nO as On,PZ as Ut,nc as jn,qc as Mn,f3 as Ie,P_ as De,sM as Ft,BZ as Bt,P$ as _t,Q0 as Ln,pT as qe,LB as dt,LD as zn,jG as Qn,LE as $n,jN as Gn,cV as qn,tR as Ye,np as Vt,nT as Ue,Q1 as Yn,Ku as ut,Kt as Pe,Q2 as mt,k2 as Jn,Q3 as Nn,Q4 as Kn,Q5 as Hn,Q6 as Zn,nw as Wn,nh as de,nW as we,Q7 as Xn,Q8 as ea,Q9 as ta,o1 as na,jR as aa,jI as oa,Qa as sa,jQ as ht,LL as ca,Qb as ia,Qc as la,pP as ra,ps as da,nU as fe,pr as ze,Qd as ua,Qe as ma,ll as ha,bq as pa,lg as pt,l2 as ga,Qf as Ca,gQ as gt,fU as Sa,ld as Ia,vK as fa,Qg as ka,os as Ea,on as va,or as ya,oc as ba,Qh as Aa,f6 as Ot,nH as Ta,ns as Pa,fk as Ct,nY as wa,Qi as xa,nV as jt,Qj as Ra,Qk as Da,Ql as Ua,Qm as Fa,Qn as St,p$ as Ba,pi as _a,Ks as Va,jP as Oa,Qo as ja,Gv as Ma,jO as La,jD as za,f5 as Qa,oT as Mt,pa as $a,nS as It,nX as Ga,bE as qa,la as Ya,l7 as Ja,Qp as Na,ob as ft,p8 as kt,p6 as Ka,oY as Ha,oD as Za,p9 as Wa,Qq as Xa,Qr as eo,oH as to,Qs as no,ox as ao,oG as oo,oE as so,pd as co}from"./zeni-epic-state-B3AwsZqW.js";import{w as Lt,I as le,d as L,s as H,Y as zt,_ as Qt,cD as io,z as Be,cE as lo,at as xe,cF as ro,aT as Et,x as $t,cG as uo,aq as Qe,O as mo,cH as ho,a2 as po,cI as go,W as Co,cJ as So,cK as Io,F as fo,k as ko,aN as Eo,b7 as vo,y as yo,cL as bo}from"./index-CtCI_jgi.js";import{u as Gt}from"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import{c as vt,C as Ao}from"./TransactionDetailScreen-Mjv-0Vsi.js";import{w as To}from"./withTransactionSidePanel-KXh--JtC.js";import{h as Po,v as wo}from"./routePaths-Bd-gFJIO.js";import{g as $e}from"./accountMappingHelper-DdryjbCH.js";import{D as xo}from"./DrawerScreen-D5UV8-Be.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";import"./decodeURIComponentSafe-HZX6LUOb.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]="e6b31b48-a5cd-44a6-8c96-ab3b06a4a128",t._sentryDebugIdIdentifier="sentry-dbid-e6b31b48-a5cd-44a6-8c96-ab3b06a4a128")}catch{}})();const Ro=()=>{const t=re(),i=wt(),A=Ge(),f=U(d=>Re(d)),{useFeatureGate:E}=Lt(),{isFeatureEnabled:g}=E(le.isRealtimeInsightsFeatureEnabled),u=U(d=>d.expenseAutomationViewState.selectedPeriodByTenantId),o=U(d=>Bn(d,f.tenantId)),{isAiCfoAccessEnabled:v,onAskAiCfoClick:S}=Gt({mobileExploreReferrer:"Month-End Close Overview"}),m=a.useCallback((d,R,N=!1)=>{t(ke({tenantId:R,period:{month:d.month,year:d.year},refreshViewInBackground:N}))},[]),y=a.useCallback(d=>{const R=A.state?.referrer;o.monthEndCloseChecks?.auditSummary!=null&&L.trackMonthCloseAuditPage(d.month,d.year,o.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",o.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,R??null),t(_n(f.tenantId,d))},[f.tenantId,o.monthEndCloseChecks?.auditSummary,o.monthEndCloseChecks?.reportEmailSentDate]),r=u[f.tenantId],B=a.useCallback(()=>{const d=A.state?.referrer;o.monthEndCloseChecks?.auditSummary!=null&&L.trackMonthCloseAuditPage(r.month,r.year,o.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",o.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,d??null),m(r,f.tenantId,!0)},[m,r,f.tenantId,o.monthEndCloseChecks?.auditSummary,o.monthEndCloseChecks?.reportEmailSentDate]),h=H(A.state?.pathnameStackToGoBack,A.pathname),T=a.useCallback(()=>{if(o.monthEndCloseChecks!=null&&r!=null){const d=o.monthEndCloseChecks.monthEndCloseCheckList.find(R=>R.progress<100);if(d!=null)return void i(`./${d.id}/${r.month}-${r.year}`,{state:{pathnameStackToGoBack:h,message:"comingFromOverview"}});i(`./month_end_insights/${r.month}-${r.year}`,{state:{pathnameStackToGoBack:h,message:"comingFromOverview"}})}},[o.monthEndCloseChecks,r]),{areTenantIdsInSync:I}=zt();return Qt({isDataReady:o.fetchState==="Completed"}),a.useEffect(()=>{r!=null&&o.fetchState!=="In-Progress"&&o.fetchState!=="Completed"&&I&&m(r,f.tenantId)},[m,r,o.fetchState,f.tenantId,I]),a.useEffect(()=>{r!=null&&o.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&o.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&I&&t(Vn(r))},[r,o.monthClosePerformanceTrendFetchStatus.fetchState,I]),a.useEffect(()=>{const d=setInterval(()=>{o.fetchState!=="In-Progress"&&o.fetchState==="Completed"&&B()},3e5);return()=>clearInterval(d)},[o.fetchState]),a.useEffect(()=>{if(o.fetchState==="Completed"&&o.monthEndCloseChecks?.auditSummary!=null){const d=A.state?.referrer;L.trackMonthCloseAuditPage(o.selectedPeriod.month,o.selectedPeriod.year,o.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",o.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,d??null)}},[o.fetchState,o.selectedPeriod,o.monthEndCloseChecks?.auditSummary,o.monthEndCloseChecks?.reportEmailSentDate]),C.jsx(Do,{children:C.jsx(io,{monthEndCloseChecksView:o,isRealtimeInsightsFeatureEnabled:g,onMonthEndCheckClick:d=>{i(`./${d}/${r.month}-${r.year}`,{state:{pathnameStackToGoBack:h,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:y,handleReviewButtonClick:T,onBackClick:()=>{i("../../dashboard")},onReload:B,isAiCfoAccessEnabled:v,onAskAiCfoClick:S})})},Do=Fe.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- background-color: ${t=>t.theme.colors.grey4};
8
- `,Uo=Pt.memo(({reconciliation:t,selectedDrawerAccountId:i,onClose:A,onFetchLinkTokenClick:f,onEstablishConnectionClick:E})=>{const g=re(),u=Be.getSignedInUser(),o=U(e=>Re(e)),v=t.excludedAccountIDs,S=a.useMemo(()=>({userId:u?.userId??"",sessionId:u?.zeniSessionId??"",tenantId:o?.tenantId??""}),[u?.userId,u?.zeniSessionId,o?.tenantId]),{accountReconciliationsByAccountID:m,monthYearPeriod:y,statementUploadChosen:r}=t,B=m[i],h=B?.accountReconEntity.statementMetaData?.statementUploadId,T=(e,n)=>{g(Mn(e,n.split(".")[0]))},I=e=>{h!=null&&g(jn({accountId:i,selectedPeriod:y,fileId:e,statementUploadId:h}))},d=()=>{g(Dt({statementUploadChosen:!1}))},R=e=>{g(On({accountId:i,selectedPeriod:y,payload:e}))},N=e=>{g(Ut({accountId:i,selectedPeriod:y,localData:{accountSource:e}}))},te=a.useCallback(()=>{g(xt({accountId:i}))},[g,i]),j=a.useCallback(()=>{g(Rt({accountId:i}))},[g,i]),_=v.includes(i)?t.excludedAccountReconciliationByAccountID[i]:void 0;return B!=null?C.jsx(yt,{children:C.jsx(bt,{children:C.jsx(lo,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:B,monthYearPeriod:y,onDismissClick:A,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:f,onEstablishConnectionClick:E,onEditFileName:T,onDeleteFile:I,onSelectSourceType:N,filesEndPoint:xe.fileMicroServiceBaseUrl,authParams:S,openFilePicker:r,onStatementUploadSuccess:R,onUploadWindowOpenedOnce:d,onExcludeFromReconciliation:te})})}):_!=null?C.jsx(yt,{children:C.jsx(bt,{children:C.jsx(ro,{excludedAccountReconciliation:_,includeAccountFetch:t.includeAccountFetchState,onIncludeIntoReconciliation:j})})}):null}),yt=Fe.div`
9
- display: flex;
10
- flex-direction: column;
11
- height: 100%;
12
- `,bt=Fe.div`
13
- flex: 1;
14
- min-height: 0;
15
- display: flex;
16
- flex-direction: column;
17
- box-sizing: border-box;
18
- min-width: 0;
19
- overflow-x: hidden;
20
- overflow-y: auto;
21
- `;function Fo({companyId:t,closeCustomerRequestDrawer:i,addCustomerRequest:A,resetCustomerRequest:f}){const E=Be.getSignedInUser();if(E==null)throw Error("Can't access Customer Request page without signing in...");const g=U(u=>Ln(u,t,E));return a.useEffect(()=>{f()},[]),C.jsx(C.Fragment,{children:g.fetchState==="In-Progress"||g.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?C.jsx($t,{fetchState:"In-Progress"}):C.jsx(uo,{onCloseClick:i,addCustomerRequest:A,snippets:g.companyMonthEndReportTemplatesData,bulletPoints:g.zeniRequestsData??[]})})}const Bo=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:_o,comma:At,space:Vo}},dateFormat:qt}=mo.getLocalizedStrings(),Tt=co,Oo=Un(function(t,i){const{uncategorizedAccounts:A,vendorSearchAutoCompleteData:f,monthEndInsightsCustomerRequestData:E,monthEndInsightsPreviewMode:g,companyId:u,isMissingReceiptsBulkUploadEnabled:o,isTransactionActivityEnabled:v}=i,S=Be.getSignedInUser(),m=t.tenantState.currentTenantId,y={userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:m??""},r=Ie(t),{selectedTransactionCategorizationTab:B}=r;return{expenseAutomationViewSelector:r,bulkUploadSelector:o===!0?r.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:f,authParams:y,receiptUploadEndpoint:`${xe.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${po}/transaction_attachments`,bulkUploadEndpoint:o===!0?`${xe.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:B,monthEndInsightsCustomerRequestData:E,monthEndInsightsPreviewMode:g,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:S,uncategorizedAccounts:A,companyId:u,isTransactionActivityEnabled:v}},function(t,i){const{themeState:A,isAccountingClassesEnabled:f,isCOTEnabled:E,isUncategorizedExpenseCategoryEnabled:g,isMissingReceiptsBulkUploadEnabled:u,location:o,vendorSearchAutoCompleteData:v,expenseAutomationViewSelector:S,currentTenant:m,uncategorizedAccounts:y,navigate:r,onClickCustomerRequest:B,handleEditClick:h,setActivityLogTransactionId:T}=i,{selectedPeriod:I,currentSelectedView:d,reconciliation:{selectedAccountId:R}}=S,{accountSettingsView:N}=S.jeSchedules,te=Vt(I),j=Ue(te.start),_=Ue(te.end);return{onZeniLogoClick:()=>{A.toggle()},onUploadReceiptAttachment:e=>{L.trackMissingReceiptAttached(I.month,I.year),t(_a(e))},onUploadTransactionReceipt:(e,n,s,l,k,p)=>{t(St(e,n,{fetchState:"In-Progress"}));const b=()=>t(St(e,n,{fetchState:"Error"}));go(`${xe.accountMicroServiceBaseUrl}/1.0/transactions/${n}/attachments`,p,n,s,l,k).then(P=>{P!=null?t(Ba(e,P)):b()}).catch(b)},onMissingReceiptsRowClick:(e,n)=>{if(i.openTransactionPanel)return void i.openTransactionPanel(e,n);const s=H(o.state?.pathnameStackToGoBack,o.pathname);r(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,n)=>{t(Fa(e,n)),m!=null&&t(ke({tenantId:m.tenantId,period:n,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,n,s,l)=>{t(Ua(e,{fetchState:n,error:s})),s!=null&&t(gt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:l!=null?Vo+_o+l+At:At}]}))},onUpdateJESchedulesUIState:e=>{t(Da(e))},onUpdateMissingReceiptsUIState:e=>{t(Ra(e))},onFetchMissingReceiptsList:()=>{_!=null&&j!=null&&t(jt({start:j,end:_},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...u===!0?{onBulkUploadFiles:e=>{t(so(e))},onBulkUploadProgress:e=>{t(oo(e))},onBulkUploadSuccess:e=>{t(ao({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(no(e))},onConfirmBulkUploadMatch:(e,n,s,l,k)=>{t(to(e,n,s,l,k))},onBulkUploadConfirmMatchAcknowledged:()=>{t(eo())},onSetBulkUploadResultsTab:e=>{t(Xa(e))},onSetBulkUploadCompletedSubTab:e=>{t(Wa(e))},onSetBulkUploadSortConfig:(e,n)=>{t(kt({sortKey:e,sortOrder:n}))},onClearBulkUpload:()=>{t(Za())},onSearchTransactionsForManualMatch:(e,n)=>{t(Tt(e,n??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=S.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(Tt(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,n)=>{t(Ha(e,n))},onFetchBulkUploadBatches:e=>{t(Mt(e))},onFetchMoreBatchDetails:()=>{t(Ka())},onResetBulkUploadSort:()=>{t(kt({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(xa())},onSearchTextChanged:e=>{const n=S.currentSelectedView,s=S.selectedTransactionCategorizationTab;n==="transaction_categorization"&&(t(ze({selectedTab:s,uiState:{searchString:e}})),_!=null&&j!=null&&t(fe(s,{start:j,end:_},!0,!1,e,void 0,!0)))},onRefresh:()=>{i.trackExpenseAutomationTabAnalytics(!0),t(wa(g))},onClose:()=>{d==="reconciliation"&&R!=null&&t(Ct({selectedAccountId:void 0})),r("../")},onBack:()=>{d==="reconciliation"&&R!=null&&t(Ct({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(Pa(e))},onSaveReconciliationReview:e=>{t(Ta(e))},onUpdateStep:e=>{const{selectedPeriod:n}=S,s=H(o.state?.pathnameStackToGoBack,o.pathname);r(`../${e}/${n.month}-${n.year}`,{state:{pathnameStackToGoBack:s,referrer:S.currentSelectedView}}),t(Ot(e))},handleLogOutClick:()=>{const e=H(o.state?.pathnameStackToGoBack,o.pathname);r("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:n}=e,{prepaidExpensesAccount:s,fixedAssetsAccount:l,accruedExpensesAccount:k}=n,p=$e(N.prepaidExpensesAccountList,s.selectedOptions),b=$e(N.fixedAssetsAccountList,l.selectedOptions),P=$e(N.accruedExpensesAccountList,k.selectedOptions),V={selectedPrepaidExpensesAccountIds:p.map(w=>w.accountId),selectedFixedAssetsAccountIds:b.map(w=>w.accountId),selectedAccruedExpensesAccountIds:P.map(w=>w.accountId)};t(Aa({data:V}))},onSaveJeAccountSettingsClick:()=>{t(ba())},onJESchedulesFormDataChange(e,n){const{jeScheduleID:s,accumulatedDepreciationCategory:l,scheduleClass:k,scheduleExpenseCategory:p,vendor:b}=n,{allAccountList:P,allClassList:V,allDepreciationAccountList:w}=S.jeSchedules,Q=v.entityAutoCompleteView.vendor.length>0?v.entityAutoCompleteView.vendor.find($=>$.id===b?.selectedOption):void 0,ne={id:Q?.zeniId??b?.selectedOption??"",name:Q?.name??b?.defaultOptions.find($=>$.value===b?.selectedOption)?.label??"",logo:Q?.logo},ae=p?.selectedOption!=null?P.find($=>$.qboId===p.selectedOption):void 0,Ee=k?.selectedOption!=null?V.find($=>$.classId===k.selectedOption):void 0,oe=l?.selectedOption!=null?w.find($=>$.qboId===l.selectedOption):void 0;t(ya({scheduledJournalEntryID:e,localData:{jeScheduleID:s,scheduledJournalEntryID:e,updatedCategoryId:ae?.accountId,updatedClassId:Ee?.classId,updatedAccumulatedDepreciationCategoryID:oe?.accountId,updatedVendor:{id:ne.id,name:ne.name}}}))},ignoreRecommendedJeSchedule(e,n){t(va(e,n))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,n)=>{e.trim().length>=2?t(ut({searchString:e,entityType:n,searchOrigin:"common"})):e.trim().length===0&&t(Pe("common"))},onCancelAutoComplete:()=>{t(Pe("common"))}},onPostJESchedule(e,n){t(Ea({scheduledJournalEntryID:e,jeScheduleTransactionKey:n}))},clearJeScheduleLocalData(){t(ka())},handleJeScheduleClick:(e,n,s)=>{t(fa({selectedJEScheduleKey:n}));const l=H(o.state?.pathnameStackToGoBack,o.pathname);r(`../../vendors/schedules/${s}/details/${e}`,{state:{pathnameStackToGoBack:l,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{m!=null&&t(Ia(e,m.companyId,m.tenantId))},onClickCustomerRequest:B,setActivityLogTransactionId:T,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Sa())},onOpenFileAttachmentSnackBar:()=>{t(gt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Ca(e))},onUpdateFileAttachment:e=>{t(ga({files:e}))},previewMonthEndReport:(e,n,s,l)=>{m!=null&&t(pt(e,m.companyId,n,!0,s,l,m.tenantId))},saveMonthEndReport:(e,n,s,l)=>{m!=null&&t(pt(e,m.companyId,n,!1,s,l,m.tenantId))},onEditMonthEndInsightsClick:h,sendMonthEndReport:e=>{const n=o.state?.referrer,{selectedPeriod:s,auditSummary:l}=S;m!=null&&l?.auditScorePercentage!=null&&(t(ha(m.companyId,e,m.tenantId)),L.trackInsightsEmailPage(s.month,s.year,!1,"draft",l.auditScorePercentage,pa().format(qt.analytics.MMMDDCommaYYYYformat),n??null))},onTransactionCategorizationRowClick:(e,n)=>{if(i.openTransactionPanel)return void i.openTransactionPanel(e,n);const s=H(o.state?.pathnameStackToGoBack,o.pathname);r(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",origin:"transaction_categorization"}})},setLocalDataForCategoryAndClass:(e,n,s,l,k,p,b,P,V,w,Q,ne,ae)=>{t(ma(e,n,s,l,y,k,p,b,P,V,w,Q,ne,ae))},onCancelAutoComplete:()=>{t(Pe("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(mt({scrollPosition:e}))},onUpdateTab:e=>{i.closeSidePanel?.(),_!=null&&j!=null&&(t(fe(e,{start:j,end:_},!1,!1)),t(ua(e)))},onUpdateTransactionCategorizationUIState:(e,n)=>{t(ze({selectedTab:e,uiState:n})),_!=null&&j!=null&&t(fe(e,{start:j,end:_},!1,!1,n.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,n)=>{t(ze({selectedTab:e,uiState:n}))},onFetchTransactionCategorizationList:(e,n,s,l,k,p,b)=>{_!=null&&j!=null&&t(fe(e,{start:j,end:_},!0,s,n,l,k,p,b))},resetTransactionCategorizationLocalData:(e,n,s,l,k,p,b,P)=>{t(da(e,n,s,l,P??null,k,p,!1,b))},updateSelectedVendorForTransaction:(e,n,s,l,k)=>{t(ht({selectedTab:e,transactionId:n,lineId:s,selectedTransaction:l,uncategorizedAccounts:y,updatedVendor:k,isAccountingClassesEnabled:f}))},onSaveUpdateTransactionCategorization:(e,n,s)=>{const l=o.state?.referrer;e==="autoCategorized"?L.trackTransactionsAutoCategorisedPage(I.month,I.year,S.transactionView.totalCountByTab.autoCategorized,n.length,!1,l??null):L.trackTransactionsReviewPage(I.month,I.year,S.transactionView.totalCountByTab.review,n.length,!1,l??null),t(ra(e,n,s,g))},onUpdateSelectedCheckboxTransactionIds:(e,n)=>{t(la({selectedTab:e,transactionIds:n}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,n,s,l,k,p,b)=>{const{transactionId:P,transaction:V,lineIds:w}=n;p!=null&&t(ca({transactionId:P,customerUpdates:p})),t(ia({selectedTab:l,transactionId:P.id,lineId:w[0],selectedTransaction:V,uncategorizedAccounts:y,updatedCustomer:p,selectedEntity:k,isAccountingClassesEnabled:f,isUncategorizedExpenseCategoryEnabled:b})),k!=null&&t(Ye(k,e,n,s,!0,E,b))},onFetchRecommendationsForEntityCategorization:(e,n,s,l,k,p,b)=>{const{transactionId:P,transaction:V,lineIds:w}=n;p!=null&&(t(aa({transactionId:P,vendorUpdates:{name:p.name,id:p.id?p.id:void 0}})),t(oa({vendorId:p.id?p.id:void 0,localData:{vendorName:p.name,vendorId:p.id?p.id:void 0}}))),p?.id?(t(ht({selectedTab:l,transactionId:P.id,lineId:w[0],selectedTransaction:V,uncategorizedAccounts:y,updatedVendor:p,selectedEntity:k,isAccountingClassesEnabled:f,isUncategorizedExpenseCategoryEnabled:b})),k!=null&&t(Ye(k,e,n,s,!0,E,b))):t(sa({selectedTab:l,transactionId:P.id,lineId:w[0]}))},fetchFluxViewOnScroll:(e,n)=>{t(we(e,!0,!1,n,!1,!0))},onFetchFluxViewList:()=>{t(we(I,!0,!1,null,!1,!1))},markAsReview:(e,n,s,l)=>{L.trackFluxAnalysisReviewed(s.month,s.year,l??!1,e),t(na(n,e,s,l??!1))},onUpdateFluxAnalysisUIState:e=>{t(ta(e))},updateOperatingExpensesIdsForReview:e=>{t(ea({operatingExpenseIds:e,selectedPeriod:I}))},redirectToVendorDetailPage:e=>{if(i.tenantEmailDomain!=null){const n=wo(e.id,e.qboId,i.tenantEmailDomain),s=H(i.location.state?.pathnameStackToGoBack,i.location.pathname);i.navigate(n,{state:{pathnameStackToGoBack:s,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(Xn({sectionId:e,selectedPeriod:I}))},onFetchReimbursementView:(e,n,s)=>{t(we(e,!0,!1,n,!0,s))},onReviewClicked:e=>{t(de(I,e))},setOpenDrawerClicked:e=>{t(De({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,n)=>{t(Ft("expense_automation_reconcile",e,n))},onEstablishConnectionClick:(e,n)=>{const s=m?.companyId;s!=null&&(t(Bt(e,s,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",n)),t(_t({accountId:n,connectionInProgress:!0})))},onAddStatementClick:e=>{t(De({selectedDrawerAccountId:e})),t(Ut({accountId:e,selectedPeriod:I,localData:{accountSource:"bank_statement"}})),t(Dt({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(de(I,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(Wn({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,n)=>{t(Zn({sortKey:e,sortOrder:n}))},onReconReviewTabColumnSortConfigChanged:(e,n)=>{t(Hn({sortKey:e,sortOrder:n}))},onReconTabUpdate:e=>{i.closeSidePanel?.(),t(Kn({selectedTab:e}))},updateReconReviewTabLocalData:(e,n,s)=>{const l=e.vendor?.id;s&&l!=null&&t(Jn(l)),t(Nn({data:e,transactionId:n}))},onReconMatchedTransactionClick:e=>{if(i.openTransactionPanel)return void i.openTransactionPanel(e,qe("bill"));const n=H(o.state?.pathnameStackToGoBack,o.pathname);r(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{r(-1)},onReconListPageScroll:e=>{t(mt({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ut({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Pe("common"))},onReconNodeCollapseToggled:(e,n)=>{t(Yn({nodeId:e,collapsed:n}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(xt({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Rt({accountId:e}))}}},(t,i,A)=>{const{isMissingReceiptsBulkUploadEnabled:f,...E}=A;return function(g,u,o){return{...g,...u,...o,onUploadTransactionReceipt:(v,S,m,y,r)=>{u.onUploadTransactionReceipt(v,S,m,y,r,g.authParams)}}}(t,i,E)})(ho),jo=To(function(t){const i=t.displayName??t.name??"Component",A=Pt.memo(t),f=E=>{const g=re(),u=function(){const T=re(),I=U(d=>Ie(d).reconciliation.selectedDrawerAccountId);return{isOpen:I!=null,selectedAccountId:I,openPanel:a.useCallback(d=>{T(De({selectedDrawerAccountId:d}))},[T]),closePanel:a.useCallback(()=>{T(De({selectedDrawerAccountId:void 0}))},[T])}}(),o=U(T=>Ie(T).reconciliation),v=U(T=>Re(T)),S=a.useCallback((T,I)=>{g(Ft("expense_automation_reconcile",T,I))},[g]),m=a.useCallback((T,I)=>{const d=v?.companyId;d!=null&&(g(Bt(T,d,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",I)),g(_t({accountId:I,connectionInProgress:!0})))},[g,v?.companyId]),y=a.useMemo(()=>{if(u.isOpen&&u.selectedAccountId!=null)return C.jsx(Uo,{reconciliation:o,selectedDrawerAccountId:u.selectedAccountId,onClose:u.closePanel,onFetchLinkTokenClick:S,onEstablishConnectionClick:m})},[u.isOpen,u.selectedAccountId,u.closePanel,o,S,m]),r=a.useMemo(()=>({reconPanelContent:y,reconSidePanelIsOpen:u.isOpen,closeReconSidePanel:u.closePanel}),[y,u.isOpen,u.closePanel]),B=a.useContext(Et),h=a.useMemo(()=>u.isOpen?{closePanel:u.closePanel,selectedItemId:u.selectedAccountId}:B,[u.isOpen,u.closePanel,u.selectedAccountId,B]);return C.jsx(Et.Provider,{value:h,children:C.jsx(A,{...E,...r})})};return f.displayName=`withReconSidePanel(${i})`,f}(({closeSidePanel:t,openTransactionPanel:i,panelContent:A,sidePanelIsFullView:f,sidePanelIsOpen:E,reconPanelContent:g,reconSidePanelIsOpen:u,closeReconSidePanel:o})=>{const{isAiCfoOpen:v,setIsAiCfoOpen:S}=Co(),m=So(),{isOpen:y}=Io(),r=wt(),B=Ge(),h=re(),{isAiCfoAccessEnabled:T,onAskAiCfoClick:I}=Gt({mobileExploreReferrer:"Transaction categorization"}),d=a.useCallback(()=>{E===!0&&f!==!0&&t?.()},[t,E,f]),{areTenantIdsInSync:R}=zt(),N=(()=>{const c=U(G=>Ie(G)),M=Ge(),{currentSelectedViewFetchState:J,currentSelectedView:O,selectedPeriod:F}=c,Se=Qe(O),X=Qe(J.fetchState),be=a.useCallback(G=>{const K=M.state?.referrer;O==="transaction_categorization"&&(c.selectedTransactionCategorizationTab==="review"?L.trackTransactionsReviewPage(F.month,F.year,c.transactionView.totalCountByTab.review,0,G,K??null):L.trackTransactionsAutoCategorisedPage(F.month,F.year,c.transactionView.totalCountByTab.autoCategorized,0,G,K??null)),O==="missing_receipts"&&L.trackMissingReceiptsPage(F.month,F.year,G,c.missingReceipts.transactions.length,K??null),O==="je_schedules"&&L.trackMonthCloseScheduleListPage(F.month,F.year,G,c.jeSchedules.draftSchedules.length,c.jeSchedules.resolveSchedules.length,K??null),O==="flux_analysis"&&L.trackFluxAnalysisPage(F.month,F.year,G,Bo(c.fluxAnalysis),K??null),O==="month_end_insights"&&c.auditSummary?.auditScorePercentage!=null&&L.trackInsightsEmailPage(F.month,F.year,G,"draft",c.auditSummary.auditScorePercentage,null,K??null)},[F,c]);return a.useEffect(()=>{X===J.fetchState&&O===Se||J.fetchState!=="Completed"||be(!1)},[O,J.fetchState,Se]),be})(),te=fo(),[j,_]=a.useState(!1),e=U(c=>dt(c)),n=U(c=>Re(c)),[s,l]=a.useState(!1),[k,p]=a.useState(!1),[b,P]=a.useState([]),[V,w]=a.useState(void 0),Q=a.useCallback(c=>{c!=null&&(v&&S(!1),m(),d()),w(c)},[d,v,m,S]),ne=a.useCallback(()=>{m(),w(void 0),d(),I()},[d,I,m]),ae=a.useRef(v);a.useEffect(()=>{v===!0&&ae.current===!1&&(m(),w(void 0),d()),ae.current=v},[d,v,m]);const Ee=a.useRef(y);a.useEffect(()=>{y===!0&&Ee.current===!1&&(v&&S(!1),w(void 0),E===!0&&f!==!0&&t?.()),Ee.current=y},[t,y,v,S,f,E]);const oe=E===!0&&f!==!0,$=a.useRef(oe);a.useEffect(()=>{oe&&!$.current&&(v&&S(!1),m(),w(void 0)),$.current=oe},[v,oe,m,S]);const[Je,Yt]=a.useState(!1),Ne=a.useRef(!1),{selectedTab:Ke}=rt(),{tenantEmailDomain:Jt}=rt(),[_e,He]=a.useState(B.state?.message==="comingFromTransactionDetail"),Ze=B.state?.message==="comingFromOverview",Nt=ko(),Ve=Be.getSignedInUser(),{useDynamicConfig:Kt,useFeatureGate:ue}=Lt(),{configValue:Ht}=Kt(Eo.enableUncategorizedExpenseCategory),Z=Ht?.uncategorized_expense_category_enabled===!0,{isFeatureEnabled:We}=ue(le.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:me}=ue(le.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:Xe}=ue(le.isTransactionActivityEnabled),{isFeatureEnabled:Zt}=ue(le.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:Wt}=ue(le.isProjectsTransactionsEnabled),Xt=a.useCallback(c=>{const M=qe(c.view==="reconciliation"?"bill":"expense");i?.(c.entityId,M)},[i]),en=U(c=>Va(c,"common")),z=U(c=>Ie(c)),{monthEndCloseChecksView:Y,currentSelectedView:x,selectedPeriod:D,selectedTransactionCategorizationTab:se,currentSelectedViewBackgroundRefreshFetchState:tn,currentSelectedViewFetchState:W,jeSchedules:Oe,reconciliation:nn}=z;a.useEffect(()=>{x==="transaction_categorization"&&E!==!0||Q(void 0)},[x,Q,E]);const ve=a.useRef(null);a.useEffect(()=>{ve.current!==null?ve.current!==se&&(ve.current=se,x==="transaction_categorization"&&Q(void 0)):ve.current=se},[x,se,Q]);const an=U(c=>V==null?void 0:Oa(c.transactionState,V)),ce=an?.qboId,on=U(c=>ce==null?void 0:ja(c,ce));a.useEffect(()=>{ce!=null&&h(Ma(ce))},[h,ce]);const{selectedAccountId:he}=nn,et=Qe(Oe.accountSettingsView.saveState.fetchState),sn=U(c=>La(c.accountState,c.accountListState,"accountList")),cn=U(c=>za(c)),pe=Ke!=null?Qa(Ke):x,ln=U(c=>c.entityAutoCompleteState.autoCompleteText.common);if(Qt({isDataReady:W.fetchState==="Completed"}),Ve==null)throw Error("Can't access expense automation screen without signing in...");const tt=Vt(D),ge=Ue(tt.start),Ce=Ue(tt.end);if(ge==null||Ce==null)throw Error(`Invalid start - ${ge} and end - ${Ce} period from given ${D}`);const rn=a.useCallback(()=>{l(!1)},[]),dn=a.useCallback(()=>{p(!0)},[]),un=a.useCallback(c=>{P(c),p(!1)},[]),mn=a.useCallback(()=>{P([])},[]),ye=z.missingReceipts.bulkUpload.phase,nt=z.missingReceipts.bulkUpload.currentBatchId;a.useEffect(()=>{me===!0&&x==="missing_receipts"&&ye==="matching"&&nt!=null&&h(Mt({cacheOverride:!0}))},[me,x,ye,nt,h]);const at=Ve?.userId,hn=D.month,pn=D.year,ot=n?.tenantId;a.useEffect(()=>{x==="missing_receipts"&&me!==!1&&ye==="idle"&&at!=null&&ot!=null&&h($a())},[x,me,ye,at,ot,hn,pn,h]),a.useEffect(()=>{e.newVendorState?.vendorDetailLocalData?.vendorName!=null?_(!0):_(!1)},[e.newVendorState?.vendorDetailLocalData?.vendorName]),a.useEffect(()=>{pe!=null&&x!==pe&&h(Ot(pe))},[pe]),a.useEffect(()=>{Je!==!1||W.fetchState!=="Completed"&&W.fetchState!=="Error"||!R||(Yt(!0),h(It(!1,!1,Z)))},[Je,W,R,Z]),a.useEffect(()=>{!Ze&&R&&(h(It(!1,!1,Z)),h(de(D,he,!1,!1)))},[D.month,D.year,R,Z]);const st=a.useCallback((c=!1,M=!1)=>{const J={start:ge,end:Ce};switch(x){case"transaction_categorization":h(fe(se,J,c,!_e,void 0,void 0,M,void 0,Z)),He(!1);break;case"flux_analysis":h(we(D,c,M,null));break;case"month_end_insights":if(M===!1){const O=new Date(D.year,D.month,0),F=qa(O.toDateString()).format(qt.analytics.YYYYDashMMDashDDFormat);h(Ya(!0,n.companyId,n.tenantId,F)),h(Ja(n.companyId,n.tenantId))}break;case"je_schedules":h(Ga(J,M));break;case"missing_receipts":h(jt(J,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,M));break;default:h(de(D,he,c,M))}},[x,ge,Ce,n.companyId,n.tenantId,se,D,he,_e,He,Z]);a.useEffect(()=>{x===pe&&W.fetchState==="Not-Started"&&R&&st(!0)},[W,ge,Ce,n.companyId,n.tenantId,R]),a.useEffect(()=>{Ze||_e||Ne.current||tn.fetchState==="In-Progress"||W.fetchState!=="Completed"||(Ne.current=!0,st(!0,!0))},[]),a.useEffect(()=>{Y.fetchState!=="In-Progress"&&Y.fetchState!=="Completed"&&h(ke({tenantId:n.tenantId,period:D,refreshViewInBackground:!1}))},[Y.fetchState,n.tenantId]),a.useEffect(()=>{z.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?l(!0):l(!1)},[z.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),a.useEffect(()=>{z.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&R&&(h(ke({tenantId:n.tenantId,period:D,refreshViewInBackground:!0})),h(Na({companyId:n.companyId})),r("../"))},[z.monthEndInsights?.sendMonthEndReportStatus?.fetchState,n.tenantId,D,n.companyId,R]),a.useEffect(()=>{const c=setInterval(()=>{Y.fetchState!=="In-Progress"&&Y.fetchState==="Completed"&&h(ke({tenantId:n.tenantId,period:D,refreshViewInBackground:!0}))},3e5);return()=>clearInterval(c)},[Y.fetchState,n.tenantId,D,h]),a.useEffect(()=>{const c=setInterval(()=>{x==="reconciliation"&&he==null&&z.reconciliation.fetchStatus.fetchState==="Completed"&&z.reconciliation.refreshStatus.fetchState!=="In-Progress"&&h(de(D,void 0,!0,!0))},3e5);return()=>clearInterval(c)},[x,h,z.reconciliation.fetchStatus.fetchState,z.reconciliation.refreshStatus.fetchState,de,he,D]);const gn=vt();a.useEffect(()=>{const c=(Y.monthEndCloseChecks?.monthEndCloseCheckList.find(M=>M.id==="month_end_insights")?.isDisabled??!1)&&!We;x!=="month_end_insights"||!c&&Y.monthEndCloseChecks?.reportEmailSentDate==null||r("../")},[x,Y.monthEndCloseChecks]);const Cn=u===!0?g:A,Sn=u===!0||E===!0,In=u===!0?o:t;a.useEffect(()=>{et==="In-Progress"&&Oe.accountSettingsView.saveState.fetchState==="Completed"&&h(ft())},[et,Oe.accountSettingsView.saveState.fetchState,ft]);const{transactionId:ct,onSaveVendor:fn,onSaveSuccess:kn,onCancel:En,vendorViewDetails:vn}=(({expenseAutomationViewSelector:c,closeDrawerHandler:M,currentSelectedView:J})=>{const O=re();let F,Se,X;const be=vt(),G=c.transactionView;let K=()=>{};const{transactions:yn,selectedTransactionId:ie,selectedTransactionLineId:Ae,transactionLocalData:bn}=G;if(J==="transaction_categorization"){const je=bn.find(ee=>ee.transactionId===ie),q=yn.find(ee=>ee.id===ie),it=Ae!=null?je?.transactionReviewLocalData?.lineItemById[Ae]:void 0,lt=it?.account;Se=it?.class?.classId,F=["Uncategorized Income","Uncategorized Expense"].includes(lt?.accountName??"")?void 0:lt?.accountId;const Tn=Po(ie,q?.typeOfTransaction);q!=null&&Tn&&(X={id:ie,type:qe(q.typeOfTransaction)}),K=()=>{if(ie!=null&&Ae!=null&&q!=null){const ee=G.transactionLocalData.find(Te=>Te.transactionId===ie)?.transactionReviewLocalData;if(ee!=null&&q.lines!=null&&q.lines.length>0){const Te=ee.lineItemById[Ae];let Me=ee.selectedEntity;if(qn(q)||(Me=Te.selectedEntityLine),Me!=null){const Pn=Me,wn={transactionId:{id:q.id,type:q.type},transaction:q,lineIds:q.lines.map(xn=>xn.id)??[]};O(Ye(Pn,Te.amount.amount,wn,!1,!0,be))}}}}}const An=U(je=>dt(je,void 0,F,Se));return{transactionId:X,onSaveVendor:()=>{O(Gn(X,void 0,!1,!0))},onSaveSuccess:K,onCancel:()=>{X!=null&&O(zn({transactionId:X})),O(Qn()),O($n()),M()},vendorViewDetails:An}})({expenseAutomationViewSelector:z,closeDrawerHandler:()=>{_(!1)},currentSelectedView:x});return Nt?.loggedInUserRoleMap==null?Y.fetchState==="Error"?C.jsx(vo,{onGoHome:()=>r("../",{replace:!0}),onReload:()=>window.location.reload()}):C.jsx($t,{fetchState:"In-Progress"}):C.jsxs(C.Fragment,{children:[C.jsx(xo,{isOpen:k,drawerLeftMargin:new yo(0,0,300,650),onClose:()=>{p(!1)},children:C.jsx(Mo,{onClick:c=>c.stopPropagation(),children:C.jsx(Fo,{companyId:n.companyId,closeCustomerRequestDrawer:()=>p(!1),addCustomerRequest:un,resetCustomerRequest:mn})})}),ct!=null&&j&&C.jsx(Ao,{isOpen:j,transactionId:ct,onSaveVendor:fn,onSaveSuccess:kn,onCancel:En,vendorViewDetails:vn}),C.jsx(Oo,{navigate:r,location:B,themeState:te,vendorSearchAutoCompleteData:{autoCompleteText:ln,entityAutoCompleteView:en},expenseAutomationViewSelector:z,isMissingReceiptsBulkUploadEnabled:me,monthEndInsightsPreviewMode:s,monthEndInsightsCustomerRequestData:b,isRealtimeInsightsFeatureEnabled:We,isUncategorizedExpenseCategoryEnabled:Z,isAccountingClassesEnabled:cn,isProjectsTransactionsEnabled:Wt,isCOTEnabled:gn,currentTenant:n,companyId:n.companyId,signedInUser:Ve,isTransactionActivityEnabled:Xe,activityLogTransactionId:x==="transaction_categorization"?V:void 0,activityLogPanel:x==="transaction_categorization"&&Xe===!0&&V!=null?C.jsx(bo,{activityLogView:on,qboId:ce,onClose:()=>Q(void 0),selectedTransactionId:V},String(V)):null,uncategorizedAccounts:sn,onClickCustomerRequest:dn,handleEditClick:rn,tenantEmailDomain:Jt,trackExpenseAutomationTabAnalytics:N,setActivityLogTransactionId:Q,closeSidePanel:In,openTransactionPanel:i,sidePanelIsOpen:Sn,sidePanelIsFullView:u!==!0&&f,panelContent:Cn,isAiCfoAccessEnabled:T,onAskAiCfoClick:ne,isExpenseAutomationCommentingEnabled:Zt,onExpenseAutomationCommentingThreadClick:Xt,sidePanelListPercent:u===!0?66:void 0})]})})),Mo=Fe(Dn)`
22
- display: flex;
23
- min-height: 100%;
24
- flex-direction: column;
25
- `;function rs(){return C.jsxs(Fn,{children:[C.jsx(Le,{path:"*",element:C.jsx(Ro,{})}),C.jsx(Le,{path:"/:selectedTab/:selectedPeriod/*",element:C.jsx(jo,{})}),C.jsx(Le,{path:"*",element:C.jsx(Rn,{})})]})}export{rs as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BSDLCmF2.js";import{a as r}from"./sentry-67DqaLi1.js";import{a3 as l,a4 as p,a5 as d,r as f}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import m from"./NotFoundScreen-GGUH6kfI.js";import{h as u,g as b}from"./core-B20PugrR.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]="5300824e-7c2e-424f-a4a9-b633eae03cb4",e._sentryDebugIdIdentifier="sentry-dbid-5300824e-7c2e-424f-a4a9-b633eae03cb4")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback(()=>{window.open("https://www.zeni.ai/demo/request","_blank")},[]),i=r.useCallback(()=>{(()=>{const n=f(a.state?.pathnameStackToGoBack),c=n.poppedPathname??k();e(c,{state:{pathnameStackToGoBack:n.newStack}})})()},[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:d(o),onDemoClick:t,onGoBack:i}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -1 +0,0 @@
1
- import{a as r}from"./sentry-67DqaLi1.js";import{u as l,h as f,g as m}from"./core-B20PugrR.js";import{gx as p,JH as g,JI as _}from"./zeni-epic-state-B3AwsZqW.js";import{u as b,L as h,z as y}from"./index-CtCI_jgi.js";import"./liveblocks-BSDLCmF2.js";import"./recharts-BzjcN9SN.js";import"./mui-BBkBdMVO.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1c64556d-d610-4366-a7b5-7e46a63af10c",e._sentryDebugIdIdentifier="sentry-dbid-1c64556d-d610-4366-a7b5-7e46a63af10c")}catch{}})();function C(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:u}=b(),s=r.useRef(!1);return r.useLayoutEffect(()=>{i(h.CONNECTION_AUTH)},[i]),r.useEffect(()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const d=y.getActiveTenantForUser();n(d?.tenantEmailDomain!=null?`/${d.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})},[]),null}export{C as default};
@@ -1,72 +0,0 @@
1
- import{j as t}from"./liveblocks-BSDLCmF2.js";import{i as S,n as x,h as C,g as y,u as ee,s as te,j as L,N as ae,o as ne,p}from"./core-B20PugrR.js";import{JA as k,JB as v,JC as T,zA as A,zm as G,JD as D,JE as oe,JF as ie,zq as se,eW as $,zx as le,zu as re}from"./zeni-epic-state-B3AwsZqW.js";import{p as g,o as r,q as de,d as j,i as J,H as ce,r as me,B as pe,s as M,w as ue,I as he,E as xe,F as ge,m as fe,v as we,x as be,N as Se,T as ye,S as ke,X as ve,y as je,A as $e}from"./index-CtCI_jgi.js";import{n as m}from"./mui-BBkBdMVO.js";import f from"./NotFoundScreen-GGUH6kfI.js";import{a as I}from"./sentry-67DqaLi1.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.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]="300f233d-bd2b-4c7e-9482-9196aa9e727c",e._sentryDebugIdIdentifier="sentry-dbid-300f233d-bd2b-4c7e-9482-9196aa9e727c")}catch{}})();const Ie=m.div`
2
- display: flex;
3
- height: 100%;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
- `,Ce=x(function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}},function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(G(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(A(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}})(de);function F(){const e=g(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const Ae=m.div`
11
- display: flex;
12
- height: 100vh;
13
- width: 100%;
14
- flex: 1 1 auto;
15
- flex-direction: column;
16
- align-items: center;
17
- background-color: ${e=>e.theme.colors.grey4};
18
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,De=x(function(e,a){const{isSubPage:n}=a;return{addressToEdit:D(e),googleAPIKey:J.googleMapsAPIKey,isSubPage:n}},function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Be();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=Pe(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}})(ce);function ze({isSubPage:e}){const a=C(),n=y(),o=g();return t.jsx(t.Fragment,{children:t.jsx(Ae,{windowSize:o,children:t.jsx(De,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:J.googleMapsAPIKey})})})}const Be=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},Pe=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ne=m.div`
20
- display: flex;
21
- height: 100%;
22
- width: 100%;
23
- flex: 1 1 auto;
24
- flex-direction: column;
25
- align-items: center;
26
- background-color: ${e=>e.theme.colors.grey4};
27
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ee=x(function(e){const a=k(e),n=v(e),o=D(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}},function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(A(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}})(pe);function Le(){const e=C(),a=y(),n=g(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Ee,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
- display: flex;
30
- height: 100%;
31
- width: 100%;
32
- flex: 1 1 auto;
33
- flex-direction: column;
34
- align-items: center;
35
- background-color: ${e=>e.theme.colors.grey4};
36
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Te=x(function(e){const a=k(e),n=v(e),o=D(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}},function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(A(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}})(xe);function Ge(){const e=C(),a=y(),n=g(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Je={containerWidth:new je(100,58)},Me=m(ke)`
38
- width: ${r.sp4};
39
- height: ${r.sp4};
40
- margin-bottom: ${r.sp3};
41
- margin-top: ${r.sp3};
42
- margin-left: ${r.sp8};
43
- cursor: pointer;
44
- position: absolute;
45
- color: ${e=>e.theme.colors.brandColorJade};
46
- `,He=m.div`
47
- display: flex;
48
- height: 100vh;
49
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
- width: 100vw;
51
- overflow-y: scroll;
52
- background-color: ${e=>e.theme.colors.grey4};
53
- `,Ve=m.div`
54
- display: flex;
55
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
- flex-direction: column;
57
- width: ${e=>`${Je.containerWidth.value(e.windowSize)}%`};
58
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
- padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
61
- `,We=m.div`
62
- display: flex;
63
- flex-direction: column;
64
- align-items: center;
65
- justify-content: center;
66
- padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
67
- height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
- overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
- width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
- background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
- margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,_e=x(function(e,a){return{file:a.file,type:a.type}})(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),H=n.pathname.includes("address"),w=g(),V=ge(),z=fe(),b=we(),W=()=>{V.toggle()},_=L(u=>k(u)),K=L(u=>v(u)),{authParams:U,fetchState:c,billAttachment:q,billFetchState:B,companyName:X,currencySymbol:O,amount:Q}=_,{tenantId:P,userId:N,sessionId:E}=U,{fetchState:R,internationalBankAccountCreateStatus:Y}=K;return I.useEffect(()=>{$()},[]),I.useEffect(()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))},[b,c,i,o,d,a]),I.useEffect(()=>{b&&c==="Completed"&&($(N,E,P),l!=null&&a(re(l)))},[c,b,N,E,P,l,a]),c==="Error"?t.jsx(f,{}):R==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:z.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${z.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&B==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",X,l??"",Ke(n.pathname),O,Q))(u)}),t.jsxs(He,{windowSize:w,children:[w!=="small"?t.jsx(Me,{onClick:W}):null,t.jsx(We,{windowSize:w,isAddressPage:H,children:B==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(Ve,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ue(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(Ue,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(ze,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Le,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ge,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -1,12 +0,0 @@
1
- import{j as u}from"./liveblocks-BSDLCmF2.js";import{a as g}from"./sentry-67DqaLi1.js";import{u as U,g as w,h as _,s as J,j as l,N as T}from"./core-B20PugrR.js";import{z as r,m as P,O as M,e as V,d as A,f as N,j as W,T as R,h as $}from"./index-CtCI_jgi.js";import{eP as q,Jl as B,Jv as G,Jm as H,eW as K,fn as Q,Jr as X,fL as Y,cT as Z,Jw as ee,Jx as te}from"./zeni-epic-state-B3AwsZqW.js";import{n as ne}from"./mui-BBkBdMVO.js";import{u as se}from"./useDeviceId-CZrGGxHD.js";import{f as ae}from"./analyticsHelper-Cnf9wNpk.js";import{t as ie}from"./getLocaleForTenant-DX4sTRBy.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="724808a0-9489-494a-9525-88bcd35e5214",t._sentryDebugIdIdentifier="sentry-dbid-724808a0-9489-494a-9525-88bcd35e5214")}catch{}})();const x=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function xe(){const t=U(),a=w(),f=_(),[y]=J(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:z,magicLinkEmail:c,verifyDeviceFetchState:C,resendVerifyDeviceOTPFetchState:D}=l(e=>e.tenantState),S=l(e=>e.tenantState.fetchState),b=l(e=>e.tenantState.activeTenantFetchState.fetchState),h=l(e=>e.tenantState.signInState),I=l(e=>e.tenantState.magicLinkSignInFetchState.fetchState),s=l(e=>e.tenantState.loggedInUser),o=l(e=>q(e)),k=l(e=>B(e)),E=r.getSignedInUser(),v=P().mode;g.useEffect(()=>{s?.zeniSessionId==null&&n!=null&&x(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(G(n,i,m)))},[n,p,t,i,m,s?.zeniSessionId]),g.useEffect(()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(k.tenantsInOrder),s.zeniSessionId),K(s.userId,s.zeniSessionId,o.tenantId),t(Q(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),M.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Y().then(()=>{const e=$();e!=null&&V(e)}),setTimeout(()=>{A.trackLogin(N.Event.loginSuccess,"email",Z(o.productSettings))},2e3))},[h,S,b,s,o,k,v,a.state,t]);const j=g.useCallback(()=>{f("/signin/auth")},[f]),O=g.useCallback(()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))},[i,d,t,c]),F=g.useCallback(e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))},[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(W,{phoneNumber:z,verifyOtpFetchState:C.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:O,onVerifyOtp:F,onCancelVerifyDevice:j});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return u.jsx(T,{to:e,state:{...a.state,origin:""}})}if(!x(n,p)||m==null||I==="Error"){const e=a.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(T,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(R,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- right: 0;
6
- bottom: 0;
7
- display: flex;
8
- align-items: center;
9
- justify-content: center;
10
- z-index: 9999;
11
- background-color: ${t=>t.theme.colors.background};
12
- `;export{xe as default};
@@ -1 +0,0 @@
1
- import{j as U}from"./liveblocks-BSDLCmF2.js";import{a as c}from"./sentry-67DqaLi1.js";import{u as pe,j as s,i as We,g as qe,h as Ke,l as M}from"./core-B20PugrR.js";import{eP as he,e$ as Qe,f0 as Se,eT as Xe,bn as ea,eO as aa,f1 as ta,f2 as na,f4 as sa,f7 as oa,fg as ia,f8 as g,fa as ra,fb as ue,fe as da,fc as la,fd as ca,ff as ua,cJ as fa,fi as ma,cO as ba,bt as pa,eS as ha,fn as Sa,fo as ga,fm as Ea}from"./zeni-epic-state-B3AwsZqW.js";import{a7 as ka,a8 as Ca,F as ya,w as Ia,z as k,v as Ta,u as wa,I as r,a9 as Aa,aa as Fa,k as _a,a as Da,ab as va,a3 as $a,ac as Ba,ad as Ga,ae as fe,af as me,L as Pa,ag as Ma,ah as be,d as R,$ as Ra,s as A,ai as N,aj as Na}from"./index-CtCI_jgi.js";import{D as Ua}from"./mui-BBkBdMVO.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]="73237f0c-2085-4fde-aaf7-8715c54bf51c",f._sentryDebugIdIdentifier="sentry-dbid-73237f0c-2085-4fde-aaf7-8715c54bf51c")}catch{}})();const Va=ka(({isAppContentDrawerOpen:f,handleDrawerToggle:d})=>{const{tenantEmailDomain:t}=We(),a=qe(),C=ya(),o=Ke(),V=Xe(),m=pe(),{useFeatureGate:i}=Ia(),O=k.getSignedInUser(),F=ea(O),n=s(e=>he(e)),ge=n.masterTOSInfo?.isMasterTOSAccepted??!1,x=s(e=>aa(e)),j=x.uiState.currentChatSessionId,y=Ta(),{setLoading:Ee}=wa(),[_,L]=c.useState(void 0),D=M("/:tenantEmailDomain/dashboard")!==null,z=M("/:tenantEmailDomain/reports")!==null,I=M("/:tenantEmailDomain/onboarding/*")!==null,{isFeatureEnabled:Y}=i(r.isDepositAccountsFeatureEnabled),{isFeatureEnabled:ke}=i(r.isChargeCardFeatureEnabled),{isFeatureEnabled:H}=i(r.isDebitCardFeatureEnabled),Ce=Aa(n,ke,H),{isFeatureEnabled:ye}=i(r.isSettingsFeatureEnabled),Z=s(e=>ta(e)),{isFeatureEnabled:T}=i(r.isReferralFeatureEnabled),v=s(e=>na(e));c.useEffect(()=>{y&&T&&!I&&v.fetchState==="Not-Started"&&m(sa(!0))},[y,T,v.fetchState,I]);const h=k.getSignedInUser(),$=s(e=>e.tenantState),Ie=s(e=>$.fetchState==="Completed"?oa(e):[]),E=s(e=>e.expenseAutomationViewState.selectedPeriodByTenantId),{isFeatureEnabled:Te}=i(r.isApAgingFeatureEnabled),{isFeatureEnabled:we}=i(r.isArAgingFeatureEnabled),{isFeatureEnabled:J}=i(r.isExpenseAutomationEnabled),{isFeatureEnabled:W}=i(r.isExpenseAutomationEnabledV2),q=W||J&&F,{isFeatureEnabled:Ae}=i(r.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:Fe}=i(r.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:_e}=i(r.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:De}=i(r.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:ve}=i(r.isTreasuryEnabled),{isFeatureEnabled:$e}=i(r.isTaskManagerCustomerUserAccessEnabled),Be=F||!F&&$e,Ge=n.company!=null&&ia(n.company),w=ve&&Ge,Pe=s(e=>g(e).totalUnreadCount),Me=s(e=>g(e).reducedFetchCountState),K=s(e=>g(e).notificationDetailsByTab.tasks.uiState.unreadCount),Q=s(e=>g(e).notificationDetailsByTab.comments.uiState.unreadCount),Re=s(e=>g(e).notificationDetailsByTab.tasks.fetchCountState),B=s(e=>g(e).notificationDetailsByTab.comments.fetchCountState),{inboxNotifications:X,isLoading:ee,isFetchingMore:ae,hasFetchedAll:te,fetchMore:Ne}=Fa();c.useEffect(()=>{const e=setTimeout(()=>Ne?.(),0);return()=>clearTimeout(e)}),c.useEffect(()=>{if(ee===!1&&ae===!1&&te===!0)if(n?.companyId!=null&&X!=null){const e=`dashboard_${n.companyId}`;L(X.filter(u=>u.roomId===e&&u.readAt==null).length)}else L(0)},[ee,ae,te]),c.useEffect(()=>{y&&!I&&Re.fetchState==="Not-Started"&&V.tenantId!=null&&m(ra("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(()=>{_!=null&&B.fetchState==="In-Progress"&&(m(ue({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),m(Se({unreadCount:_},"comments")))},[_,B.fetchState]);const Ue={fetchStatus:Me,count:Pe},ne=t!=null?k.getSignedInUserTenant(t):null,se=s(e=>ne?.tenantId!=null?da(e,ne.tenantId):void 0),S=[];Te===!1&&S.push("accounts_payable_aging"),we===!1&&S.push("accounts_receivable_aging"),Y===!1&&S.push("zeni_accounts_promo_card"),T===!1&&S.push("rewards_card"),q===!1&&S.push("expense_automation_card");const Ve=_a(),oe=s(e=>la(e,S,h,W,J,w).fetchState),ie=s(e=>ca(e).fetchState),Oe=D&&(oe==="Completed"||oe==="Error")||z&&(ie==="Completed"||ie==="Error")||!D&&!z?void 0:"disabled",xe=c.useMemo(()=>ua(n.userRole),[n.userRole]),je=fa(xe),Le=n?.rewardsLastViewedTime==null,ze=h?.userEmail!=null&&Z.fetchState==="Completed"&&ma(Z.notificationSettings,h.userEmail,H,n),re=Da(),Ye=re&&va(a),de=ba(Ve?.loggedInUserRoleMap),le=n.companyTreasuryInfo?.info?.isTreasuryTOSAccepted,G=c.useCallback(()=>w&&de&&!k.getTreasuryPopupSeen(t??"")&&le===!1&&$a(a.pathname)!=="treasury",[w,de,le,a.pathname,t]),[He,ce]=c.useState(G);c.useEffect(()=>{ce(G())},[G]);const Ze=s(e=>e.treasurySetupViewState.treasuryFundsDetails).fundsDetails,Je=Ba(Ze);return U.jsx(Ua,{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(Ga,{signedInUser:O,currentTenantId:$.currentTenantId??"",tenants:$.fetchState==="Completed"?Ie:se!=null?[se]:[],currentTenant:n,isTenantDropdownDisabled:Oe,isSettings:me(a),isSettingsFeatureEnabled:ye,isVendorsTabVisible:je,isZeniAccountEnabled:Y,isChargeCardEnabled:Ce,isTreasuryEnabled:w,treasuryYieldPercentage:Je,isTreasuryPopupVisible:He,isNotificationsTabVisible:ze,notificationCountDetails:Ue,isExpenseAutomationEnabledForUser:q&&pa(n.userRole)===!1,selectedMenu:fe(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:Le,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:re,onNotificationIconClick:()=>{d(!1);let e=K===0&&Q>0?"notifications/comments":"notifications/tasks";me(a)&&(e=K===0&&Q>0?"../../notifications/comments":"../../notifications/tasks");const u=A(a.state?.pathnameStackToGoBack,a.pathname);o(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{d(!1);const e=A(a.state?.pathnameStackToGoBack,a.pathname);o("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(d(!1),t==null)return;if(e.type==="ai_cfo"){if(R.trackAICFOChatScreenStateChanged("viewed","left_menu",j??null,null),!ge)return void Ra({location:a,navigate:o,mergeState:{referrer:"Sidebar"}});const p=A(a.state?.pathnameStackToGoBack,a.pathname);return void o(`/${t}/ai-cfo/explore`,{state:{pathnameStackToGoBack:p,referrer:"Sidebar"}})}const u=A(a.state?.pathnameStackToGoBack,a.pathname),l=e.type,b=N(l)&&l!=="command_center";if(N(e.type)&&E[n.tenantId]!=null&&R.trackMonthEndCloseClicked(E[n.tenantId].month,E[n.tenantId].year,"Sidebar"),b&&E[n.tenantId]!=null){const p=E[n.tenantId];return void o(`/${t}/month_end_close_checks/review/${e.type}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const P=Na(e.type);be(e.type)?(j!=null&&m(Ea()),o(`/${t}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):o(`/${t}/${P}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{d(!1),o(`/${t}/settings/my_profile`)},handleReferralsClick:()=>{d(!1),o(`/${t}/rewards`)},handleBackClick:()=>{o(`/${t}/dashboard`)},handleTenantSelect:e=>{Ee(Pa.TENANT_SWITCHING),d(!1);const u=e.tenantEmailDomain,l=fe(a);let b=`/${encodeURIComponent(u)}/`;const P=N(l);l==="home"?b+="dashboard":l==="users_and_roles"?b+="people":Ma(l)?b+="settings/my_profile":be(l)?b+=`ai-cfo/${l}`:b+=l==="task_checklist"?"tasks":P?"month_end_close_checks/review":encodeURIComponent(l),o(b,{replace:!0}),h!=null&&(m(Sa(e.tenantId)),m(ga(h.userId,e.tenantId,h.zeniSessionId)));const p=e;R.trackCompanySwitch(p.companyId,p.companyName,p.userRole)},handlePopupClose:()=>{k.saveTreasuryPopupSeen(t??"",!0),ce(!1)},onZeniLogoClick:()=>{C.toggle()},isAiCfo:Ye,aiCfoView:x,isOnDashboard:D,updateCurrentChatSessionId:e=>{m(ha({sessionId:e,agentId:"controller"})),o(`/${t}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:Ae,isTaskManagerAccessEnabled:Be,thanksGivingAnimationEnabled:Fe,christmasAnimationEnabled:_e,newYearAnimationEnabled:De})})}),Ha=f=>{const d=pe(),t=s(C=>he(C)),a={events:t.userRoleId!=null?[`private-encrypted-${t.userRoleId}.dashboard-user-notification`]:[],eventCallback:(C,o)=>{Ca(o)&&Qe(o.mode)==="dashboard"&&d(Se({unreadCount:o.data.unread},"tasks"))}};return U.jsx(Va,{...f,...a})};export{Ha as M};
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BSDLCmF2.js";import{h as r,n}from"./core-B20PugrR.js";import{Q as i}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import"./sentry-67DqaLi1.js";import"./zeni-epic-state-B3AwsZqW.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.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]="e552295f-ad8f-4911-819f-e7382b348622",o._sentryDebugIdIdentifier="sentry-dbid-e552295f-ad8f-4911-819f-e7382b348622")}catch{}})();const f=n(null,function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}})(i);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
@@ -1 +0,0 @@
1
- import{l as ct,a as mt,m as dt,j as E}from"./liveblocks-BSDLCmF2.js";import lt from"./NotFoundScreen-GGUH6kfI.js";import{a as k}from"./sentry-67DqaLi1.js";import{h as ft,g as ut,i as ht,u as pt,j as S,n as kt,o as gt,p as J}from"./core-B20PugrR.js";import{cr as St,f1 as Y,eP as H,ff as bt,f8 as b,PS as O,fb as d,f0 as y,q_ as M,wl as It,PT as Ct,e$ as Tt,fi as yt,r3 as _t,PU as $,bq as F,gQ as x,r7 as K,PV as At,cC as Et,cw as Nt}from"./zeni-epic-state-B3AwsZqW.js";import{Y as wt,z as Bt,w as xt,I as Pt,_ as Rt,cA as Ut,s as N,a7 as Dt,cB as vt,a8 as Gt,r as $t}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import{u as Ft}from"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.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]="963c1e6c-1b11-431d-8251-b8d8505880d6",t._sentryDebugIdIdentifier="sentry-dbid-963c1e6c-1b11-431d-8251-b8d8505880d6")}catch{}})();const Mt=(t,l)=>new Promise((n,u)=>{const g=t.map(i=>new Promise(s=>{l(i),s()}));Promise.all(g).then(()=>{setTimeout(()=>{n()},2e3)}).catch(i=>{u(i)})}),jt=kt(function(t,l){const n=Y(t),{signedInUser:u,isDebitCardFeatureEnabled:g}=l,i=b(t),s=H(t),{currentTab:h}=i;return{notificationView:i,isNotificationSettingsVisible:u.userEmail!=null&&yt(n.notificationSettings,u.userEmail,g,s),isDisabled:i.notificationDetailsByTab[h].fetchState==="In-Progress"?"disabled":void 0}},function(t,l){const{location:n,tenantEmailDomain:u,loggedInUserRoleMap:g,externalNotificationsUnreadCount:i,allUnreadCommentsNotificationIds:s,navigate:h,markInboxNotificationAsRead:w,fetchMoreCommentsNotifications:P}=l;return{onNotificationClick:(a,o,m,c)=>{if(c==="task_deleted"){const r=`/${u}/tasks`,I=N(n.state?.pathnameStackToGoBack,n.pathname);h(r,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}else{const r=`/${u}/tasks/${o}`,I=N(n.state?.pathnameStackToGoBack,n.pathname);h(r,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}m==="unread"&&t(K("task_manager","read",[a],!1))},onCommentNotificationClick:(a,o,m)=>{const c=o.toString().split(`/${u}/`);if(c[1]!=null){m==="unread"&&(w(a),t($([a],F())));let r=`/${u}/${c[1]}`;const I=N(n.state?.pathnameStackToGoBack,n.pathname);c[1].startsWith("reimbursement")&&!Et(g)&&(r="not-found"),c[1].startsWith("bill")&&!Nt(g)&&(r="not-found"),h(r,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,o)=>{t(y(a,o))},onUpdateNotificationTabState:(a,o)=>{t(d(a,o))},onUpdateNotificationViewCurrentTabAndSubTab:(a,o)=>{t(O(a,o));const m=`../${a}`,c=N(n.state?.pathnameStackToGoBack,n.pathname);h(m,{state:{pathnameStackToGoBack:c}})},onUpdateNotificationViewSubTab:a=>{t(At(a))},onFetchMoreNotifications:(a,o)=>{if(a==="tasks"){const m=[];o==="all"?m.push("read","unread"):o!=="mentions"&&m.push(o),t(M("task_manager","dashboard",m))}else P?.()},onUpdateNotificationStatus:(a,o,m,c)=>{a==="tasks"?t(K("task_manager",m,c)):(t(d({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(c.map(r=>{m==="read"&&(w(r),t($([r],F())))})).then(()=>{t(d({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:i-c.length>0?i-c.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))},r=>{t(d({markAsReadState:{fetchState:"Error",error:r}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))}).catch(r=>{t(d({markAsReadState:{fetchState:"Error",error:r}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))}))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(d({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Mt(s,w).then(()=>{t($(s,F())),t(d({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}).catch(o=>{t(d({markAsAllReadState:{fetchState:"Error",error:o}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))}))},onBackClick:()=>{const a=$t(n.state?.pathnameStackToGoBack),o=a.poppedPathname??"../../dashboard";h(o,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=N(n.state?.pathnameStackToGoBack,n.pathname);h("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}})(Dt(vt)),Vt=()=>{const t=ft(),l=ut(),{tenantEmailDomain:n,selectedTab:u}=ht(),{areTenantIdsInSync:g}=wt(),i=St(u??""),s=pt(),h=Bt.getSignedInUser(),[w,P]=k.useState(!1),a=S(e=>Y(e)),o=S(e=>H(e)),{useFeatureGate:m}=xt(),{isFeatureEnabled:c}=m(Pt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:r,onAskAiCfoClick:I}=Ft({mobileExploreReferrer:"Notifications"});Rt({isDataReady:!0});const X=bt(o.userRole);if(o==null||n==null||o.companyId==null)throw Error("Can't access notifications page without current tenant...");if(h==null)throw Error("Can't access notifications page without signed in...");const j=S(e=>b(e).notificationDetailsByTab.tasks.fetchState),V=S(e=>b(e).currentTab),R=S(e=>b(e).currentSubTab),Z=S(e=>b(e).notificationDetailsByTab.comments.fetchCountState),U=S(e=>b(e).notificationDetailsByTab.comments.fetchState),tt=S(e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount),et=S(e=>b(e).allExternalNotifications).filter(e=>e.inboxNotification.readAt==null).map(e=>e.inboxNotification.id),at=Ut().allUsers,{inboxNotifications:B,isLoading:_,hasFetchedAll:C,isFetchingMore:D,fetchMore:ot}=ct(),{threads:q,isLoading:W,fetchMore:z,isFetchingMore:L,hasFetchedAll:Q}=mt({query:{metadata:{companyId:o.companyId,application:"dashboard"}}});k.useEffect(()=>{if(V!==i&&i!=null&&s(O(i)),i==null){const e=`../${V}`,p=N(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}},[i]),k.useEffect(()=>{Z.fetchState==="Not-Started"&&s(d({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))},[]),k.useEffect(()=>{if(_===!1&&C===!0&&o?.companyId!=null&&B!=null){const e=`dashboard_${o.companyId}`,p=B.filter(T=>T.roomId===e&&T.readAt==null).length;s(d({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),s(y({unreadCount:p},"comments"))}},[_,C]),k.useEffect(()=>{j!=="In-Progress"&&g&&s(M("task_manager","dashboard",["read","unread"]))},[g]),k.useEffect(()=>{const e=setTimeout(()=>ot?.(),0);return()=>clearTimeout(e)});const v=_||D===!0||C!==!0||_||D===!0||C!==!0;k.useEffect(()=>{v&&U!=="In-Progress"?s(d({fetchState:"In-Progress",error:void 0},"comments")):v||U!=="In-Progress"||s(d({fetchState:"Completed",error:void 0},"comments"))},[v,U]),k.useEffect(()=>{s(y({hasMore:C!==!0},"comments"))},[C]),k.useEffect(()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&w===!1&&(P(!0),s(It()))},[a.fetchState]),k.useEffect(()=>{if(_===!1&&W===!1&&B!=null&&q!=null){const e=`dashboard_${o.companyId}`,p=B.filter(f=>f.roomId===e).filter(f=>f.kind==="thread"),T=p.filter(f=>f.readAt==null),A=p.map(f=>f.id),it=p.map(f=>{const G=q.find(rt=>rt.id===f.threadId);return G!=null?{inboxNotification:{...f,threadId:G.id},thread:G}:(L||Q===!0||z==null||z(),null)}).filter(f=>f!=null);s(d({allNotificationsIds:A},"comments")),s(y({totalCount:A.length,unreadCount:T.length},"comments")),s(Ct(it))}},[_,D,L,C,Q,W,B?.length]);const st={events:o.userRoleId!=null?[`private-encrypted-${o.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(Gt(p)){const T=Tt(p.mode);if(T==="dashboard"&&s(y({unreadCount:p.data.unread},"tasks")),j!=="In-Progress"){const A=[];R==="all"?A.push("read","unread"):R!=="mentions"&&A.push(R),s(M("task_manager",T,A,!0))}}}},nt=dt();return E.jsx(jt,{tenantEmailDomain:n,loggedInUserRoleMap:X,signedInUser:h,externalNotificationsUnreadCount:tt,location:l,navigate:t,isDebitCardFeatureEnabled:c,users:at,markInboxNotificationAsRead:nt,allUnreadCommentsNotificationIds:et,isAiCfoAccessEnabled:r,onAskAiCfoClick:I,...st})};function ne(){return E.jsxs(gt,{children:[E.jsx(J,{path:"/:selectedTab",element:E.jsx(Vt,{})}),E.jsx(J,{path:"*",element:E.jsx(lt,{})})]})}export{ne as default};
@@ -1 +0,0 @@
1
- import{j as m}from"./liveblocks-BSDLCmF2.js";import{a as r}from"./sentry-67DqaLi1.js";import{u as A,g as P,j as o,N as j}from"./core-B20PugrR.js";import{JK as C,eP as J,f7 as M,JL as x,JM as z,JN as D,JO as L,mT as N,IG as R}from"./zeni-epic-state-B3AwsZqW.js";import{z as h,G as I}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="7f5bbf47-5f96-4d42-af15-bb4aa28376bf",n._sentryDebugIdIdentifier="sentry-dbid-7f5bbf47-5f96-4d42-af15-bb4aa28376bf")}catch{}})();function ee(){const n=A(),a=P(),{params:t,error:i}=r.useMemo(()=>C(a.search),[a.search]),b=r.useMemo(()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application",[a.search,t]),f=h.isSignedIn(),s=h.getSignedInUser(),p=o(e=>J(e)),l=o(e=>M(e)),d=o(e=>e.tenantState.fetchState),w=o(x),y=o(z),u=o(D),[v,S]=r.useState(null),[E,_]=r.useState(null);r.useEffect(()=>{document.querySelector("#app-shell-loader")?.remove()},[]),r.useEffect(()=>()=>{n(L())},[n,a.search]),r.useEffect(()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)},[i]);const g=r.useRef(!1);r.useEffect(()=>{f&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(N(s.userId,s.zeniSessionId??void 0))))},[f,s,d,n]),r.useEffect(()=>{u!=null&&u!==""&&(window.location.href=u)},[u]);const U=r.useMemo(()=>{if(p?.tenantId!=null)return p.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some(T=>T.tenantId===e)?e:l.length===1?l[0].tenantId:null},[p?.tenantId,l]),c=v??U;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):f?m.jsx(I,{variant:"signed_in",clientName:b,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:S,approveError:E??y,isApproving:w==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(R(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{_("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(j,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
@@ -1 +0,0 @@
1
- import{j as n}from"./liveblocks-BSDLCmF2.js";import{h as V,u as z,g as Z,i as H,j as d,n as J,o as Q,p as I}from"./core-B20PugrR.js";import{eP as U,qO as O,qm as X,Kg as v,qh as T,bt as ee,bn as ae,bT as te,qi as se,Kh as oe,K2 as C,dE as re,ui as ne,Ki as ce,uF as ie,e_ as le,eY as de}from"./zeni-epic-state-B3AwsZqW.js";import{z as me,Y as fe,_ as pe,k as ue,w as q,I as w,N as he,d as M,ao as ge,s as Fe}from"./index-CtCI_jgi.js";import"./mui-BBkBdMVO.js";import be from"./NotFoundScreen-GGUH6kfI.js";import{F as Ie}from"./FeaturePreviewScreen-CWGIZoD1.js";import{a as g}from"./sentry-67DqaLi1.js";import{u as Ce}from"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import{u as Te}from"./useInitialThreadRequest-CHUXHA4e.js";import{t as Se}from"./routePaths-Bd-gFJIO.js";import{M as ye}from"./MobileAppDrawer-DjZLcHYq.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="45b14526-c464-4c97-9de3-bca93c8b5c7a",s._sentryDebugIdIdentifier="sentry-dbid-45b14526-c464-4c97-9de3-bca93c8b5c7a")}catch{}})();const S=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},ke=J(function(s){const e=oe(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach(r=>{a[r]=o[r]===!1}),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:M}},function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(v(a,o)),e.isPandLReportFetched(a)||s(T(a)),S(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(ie(a))},onForecastVsActualsCompareToggle:a=>{s(ce(a)),s(C({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ne(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=re(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const m=Se(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),u=Fe(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(m,{state:{pathnameStackToGoBack:u,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(C({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(C({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}})(ge);function R(){const s=V(),e=z(),a=Z(),{forecastId:o,tenantEmailDomain:r}=H(),[c,p]=g.useState(!1),[m,u]=g.useState(!1),h=me.getSignedInUser(),y=d(t=>U(t)),$=y.company?.companyInfo.firstMonthOfFY??1,i=d(t=>O(t.forecastState,t.forecastListState)),l=d(t=>t.forecastListState.fetchState==="Completed"),k=d(t=>t.profitAndLossState),A=d(t=>t.reportUIOptionsState.selectedForecast),x=t=>k.pandLByForecastID[t]!=null&&se(t,k).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:F}=fe();pe({isDataReady:l});const{isAiCfoAccessEnabled:_,onAskAiCfoClick:N}=Ce({mobileExploreReferrer:"Forecast"});g.useEffect(()=>{if(!c&&F)p(!0),l||e(X());else if(l&&!m){u(!0);const t=((f,L,P)=>L!=null?f.forecasts.findIndex(b=>b.id===L):P!=null?f.forecasts.findIndex(b=>b.id===P):f.forecasts.length>0?0:-1)(i,o,A?.id);t===-1&&o!=null?s("page-not-found",{replace:!0}):t!==-1&&t!=A?.index?(e(v(i.forecasts[t].id,t)),S(o,i.forecasts[t].id,s,a.search)):o==null&&t!==-1&&S(void 0,i.forecasts[t].id,s,a.search),t!==-1&&!x(i.forecasts[t].id)&&F&&e(T(i.forecasts[t].id))}},[c,p,e,l,i,m,u,O,T,F]);const D=ue(),B=D?.loggedInUserRole!=null&&ee(D.loggedInUserRole),{useFeatureGate:W}=q(),{isFeatureEnabled:E}=W(w.isReportsCommentingEnabled),Y=Te(E?y?.companyId:void 0,{clearParams:l&&m}),[G,K]=g.useState(!1),j=t=>{K(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(he,{analytics:M,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(ye,{isAppContentDrawerOpen:G,handleDrawerToggle:j}),n.jsx(ke,{firstMonthOfFY:$,tenantEmailDomain:r,forecastIdFromUrlPath:o,navigate:s,location:a,isPandLReportFetched:x,meetingUrl:te(`https://meetings.hubspot.com/svitlana-grankovska?firstname=${h?.firstName}&lastname=${h?.lastName}&email=${h?.userEmail}`),hasTransactionAccess:B,isAiCfoAccessEnabled:_,onAskAiCfoClick:N,isReportsCommentingEnabled:E,isZeniUser:ae(h),initialOpenThreadRequest:Y,onClickMenuIcon:()=>{j(!0)}})]})}function Ke(){const s=d(c=>U(c)),{useFeatureGate:e}=q(),{isFeatureEnabled:a}=e(w.isDebitCardFeatureEnabled),o=le(a,s),r=de(s);return o===!0||r===!0?n.jsx(Ie,{}):n.jsxs(Q,{children:[n.jsx(I,{path:"/",element:n.jsx(R,{})}),n.jsx(I,{path:"/:forecastId",element:n.jsx(R,{})}),n.jsx(I,{path:"/:forecastId/*",element:n.jsx(be,{})})]})}export{Ke as PandLWithForecastRoutes,Ke as default};
@@ -1,22 +0,0 @@
1
- import{j as s}from"./liveblocks-BSDLCmF2.js";import{Kb as te,eP as Q,jD as G,e_ as J,eY as ne,HD as q,JR as oe,to as Ee,Kc as N,tc as ke,tx as Ie,tr as ie,tg as re,tv as Pe,ts as je,Kd as le,v4 as ve,Ke as Le,fB as Te,Kf as K,tl as de,tj as ce,tA as Fe,c2 as Ae}from"./zeni-epic-state-B3AwsZqW.js";import{p as pe,w as X,I as E,z as H,a9 as ue,C as me,ak as ge,al as Re,y as he,o as R,D as fe,O as Ce,am as Oe,Y as Ve,_ as Ue,N as Be,d as ye,f as Ze,s as $e,an as Ke,k as _e}from"./index-CtCI_jgi.js";import{D as be,n as M,S as we}from"./mui-BBkBdMVO.js";import ae from"./NotFoundScreen-GGUH6kfI.js";import{a as r}from"./sentry-67DqaLi1.js";import{u as ee,i as ze,j as m,h as Ge,g as He,n as Me,o as se,p as $}from"./core-B20PugrR.js";import{u as We}from"./useAskAiCfoHostNavButtonProps-CMgniebB.js";import{M as Ye}from"./MobileAppDrawer-DjZLcHYq.js";import"./recharts-BzjcN9SN.js";import"./analytics-B35UERag.js";import"./plaid-DHvUog4a.js";import"./dnd-CTNaOehy.js";import"./stripe-DMRn4zHo.js";import"./lottie-DG71PfmK.js";import"./lexical-BDpP_OMn.js";import"./pdf-Cp8DoYAG.js";import"./utils-C7uJ9upL.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]="8395224a-5198-405d-a84d-279955a3dc4c",a._sentryDebugIdIdentifier="sentry-dbid-8395224a-5198-405d-a84d-279955a3dc4c")}catch{}})();const Ne={overlayWidth:new he(100,100,48)},_=Ce.getLocalizedStrings().peoplePage.invitePage,Qe=({companyId:a,managersListView:t,companyPassportView:l,classListView:n,mode:g,isEditPeopleDrawerOpen:o,closeDrawerHandler:b})=>{const h=pe(),p=ee(),[O,V]=r.useState(!1),[I,w]=r.useState(!1),{userId:S}=ze(),d=m(e=>te(e)),u=m(e=>Q(e)),D=m(e=>G(e)),{useFeatureGate:f}=X(),{isFeatureEnabled:k}=f(E.isDebitCardFeatureEnabled),P=J(k,u),L=ne(u),T=q(u),U=oe(u),B=!!u.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,x=!P&&D&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||l.fetchState!=="Completed"||a==null;if(H.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const C=()=>{p(N()),b()},F=()=>{O===!0?w(!0):C()},Z=l.companyView?.controllers?.map(e=>e.user),{isFeatureEnabled:c}=f(E.isDepositAccountsFeatureEnabled),{isFeatureEnabled:j}=f(E.isChargeCardFeatureEnabled),v=ue(u,j,k),{isFeatureEnabled:A}=f(E.isTreasuryEnabled),y={peopleDetails:d,classList:n.classes,managersList:t.users,controllersList:Z,mode:g,isZeniTenant:T,isAccountingClassesEnabled:D,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:c===!1,isChargeCardDisabled:v===!1,isTreasuryDisabled:A===!1,isLiteRoleDisabled:U===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:L,onResetClick:C,onDeleteUser:e=>{p(re(e.userId,e.userRole.userRoleId))},onPeopleLocalDataUpdated:e=>{p(ie({peopleLocalData:e})),V(!0)},onSaveClick:()=>{p(g==="zeni_only"?ke(a):Ie(T))},onCloseClick:F,isLoading:x||d.person==null},i={onOkClick:()=>{w(!1),C()},onCancelClick:()=>{w(!1)}};return r.useEffect(()=>{x===!1&&S!=null&&p(Ee(S))},[x,S]),r.useEffect(()=>{d.updatePersonState.fetchState==="Completed"&&C()},[d.updatePersonState.fetchState]),s.jsx(be,{anchor:"right",open:o,PaperProps:{style:{width:Ne.overlayWidth.valuePercentage(h),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:me.overlayDark,cursor:"pointer"}}},onClose:F,children:s.jsxs(Je,{onClick:e=>e.stopPropagation(),children:[I===!0?s.jsx(ge,{titleComponent:s.jsx(Se,{children:_.discardTitle}),descriptionComponent:s.jsx(De,{children:_.discardDescription}),primaryButtonText:_.discard,secondaryButtonText:_.no,action:i,isEditPopup:!0}):null,s.jsx(Re,{...y})]})})},Je=M(we)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,Se=M(fe.H6Regular)`
6
- margin-top: ${R.sp7};
7
- padding-left: ${R.sp8};
8
- padding-right: ${R.sp8};
9
- color: ${a=>a.theme.colors.primary};
10
- word-break: break-word;
11
- `,De=M(fe.LargeRegularSp)`
12
- color: ${a=>a.theme.colors.hero};
13
- padding-left: ${R.sp8};
14
- padding-right: ${R.sp8};
15
- margin-bottom: 30px;
16
- margin-top: ${R.sp4};
17
- white-space: pre-line;
18
- `,qe={overlayWidth:new he(100,100,48)},z=Ce.getLocalizedStrings().peoplePage.invitePage,Xe=({companyId:a,managersListView:t,companyPassportView:l,classListView:n,mode:g,isInvitePeopleDrawerOpen:o,closeDrawerHandler:b})=>{const h=pe(),p=ee(),[O,V]=r.useState(!1),[I,w]=r.useState(!1),S=m(i=>te(i)),d=m(i=>Q(i)),u=m(i=>G(i)),{useFeatureGate:D}=X(),{isFeatureEnabled:f}=D(E.isDebitCardFeatureEnabled),k=J(f,d),P=ne(d),L=q(d),T=oe(d),U=!!d.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,B=!k&&u&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||l.fetchState!=="Completed"||a==null;if(H.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const x=()=>{b(),p(N())},C=()=>{O===!0?w(!0):x()},F={onOkClick:()=>{w(!1),x()},onCancelClick:()=>{w(!1)}},Z=l.companyView?.controllers.map(i=>i.user),{isFeatureEnabled:c}=D(E.isDepositAccountsFeatureEnabled),{isFeatureEnabled:j}=D(E.isChargeCardFeatureEnabled),v=ue(d,j,f),{isFeatureEnabled:A}=D(E.isTreasuryEnabled),y={classList:n.classes,managersList:t.users,controllersList:Z,mode:g,isZeniTenant:L,onPeopleLocalDataUpdated:i=>{p(ie({peopleLocalData:i})),V(!0)},onResetClick:x,onSaveClick:()=>{p(g==="zeni_only"?Pe(a):je())},onCloseClick:C,peopleDetails:S,isAccountingClassesEnabled:u,isReimbursementDisabled:U===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:c===!1,isChargeCardDisabled:v===!1,isTreasuryDisabled:A===!1,isBankingOnlyTenant:k,isCardsOnlyTenant:P,isLoading:B};return r.useEffect(()=>{S.invitePersonState.fetchState==="Completed"&&(b(),p(N()))},[S.invitePersonState.fetchState]),s.jsx(be,{anchor:"right",open:o,PaperProps:{style:{width:qe.overlayWidth.valuePercentage(h),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:me.overlayDark,cursor:"pointer"}}},onClose:C,children:s.jsxs(ea,{onClick:i=>i.stopPropagation(),children:[I===!0?s.jsx(ge,{titleComponent:s.jsx(Se,{children:z.discardTitle}),descriptionComponent:s.jsx(De,{children:z.discardDescription}),primaryButtonText:z.discard,secondaryButtonText:z.no,action:F}):null,s.jsx(Oe,{...y})]})})},ea=M(we)`
19
- display: flex;
20
- min-height: 100%;
21
- flex-direction: column;
22
- `,aa=Me(function(a,t){const l=le(a),n=H.getSignedInUser();return{data:l,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(a),analytics:ye}},function(a,t){const{navigate:l,companyId:n,shouldFetchClasses:g}=t;return{personAction:{onPersonDelete:(o,b)=>{a(re(o,b))},onResendInvite:o=>{a(Fe(o))},onReloadPeople:()=>{a(de()),a(ce(n,g))},onBackClick:()=>{l("../../")},onModeChange:o=>{a(K({mode:o,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:o=>{a(K({searchText:o}))}}}})(Ke);function Y({isInvitePeopleDrawerOpen:a,isEditPeopleDrawerOpen:t}){const l=Ge(),n=ee(),g=He(),{areTenantIdsInSync:o}=Ve(),b=H.getSignedInUser(),h=m(e=>Q(e)),{useFeatureGate:p}=X(),{isFeatureEnabled:O}=p(E.isDebitCardFeatureEnabled),V=m(e=>G(e)),I=!J(O,h)&&V,w=q(h),S=h?.tenantId,{tenantEmailDomain:d}=h,[u,D]=r.useState(!1),[f,k]=r.useState(!1),[P,L]=r.useState(!1),[T,U]=r.useState("off"),[B,x]=r.useState(!1),C=e=>{x(e)},{isAiCfoAccessEnabled:F,onAskAiCfoClick:Z}=We({mobileExploreReferrer:"People"}),c=m(e=>le(e));Ue({isDataReady:c.fetchState==="Completed"});const j=m(e=>ve(e.classState,e.classListState)),v=m(e=>Le(e.userState,e.userRoleState,e.userListViewState,"manager")),A=m(e=>Te(e)),y=h?.companyId;r.useEffect(()=>{u&&T===c.uiState.mode||!o||(n(K({searchText:"",sortKey:"name",sortOrder:"ascending"})),U(c.uiState.mode),D(!0),n(de()))},[u,b,S,n,c.uiState.mode,o]),r.useEffect(()=>{y!=null&&o&&n(ce(y,I))},[y,I,o]),r.useEffect(()=>{k(a!=null&&a===!0),L(t!=null&&t===!0&&t)},[a,t]),r.useEffect(()=>{n(K({searchText:"",sortKey:"name",sortOrder:"ascending"}))},[]);const i=()=>{k(!1),L(!1),l("../")};return s.jsxs(s.Fragment,{children:[c.fetchState==="Completed"?s.jsx(Be,{analytics:ye,onLoad:e=>e.trackPageLoaded(Ze.Event.members)}):null,f===!0?s.jsx(Xe,{closeDrawerHandler:i,isInvitePeopleDrawerOpen:f,managersListView:v,companyPassportView:A,classListView:j,companyId:y,mode:c.uiState.mode}):null,P===!0?s.jsx(Qe,{closeDrawerHandler:i,isEditPeopleDrawerOpen:P,managersListView:v,companyPassportView:A,classListView:j,companyId:y,mode:c.uiState.mode}):null,s.jsx(Ye,{isAppContentDrawerOpen:B,handleDrawerToggle:C}),s.jsx(aa,{navigate:l,signedInUser:b,isZeni:h.isZeni,isZeniTenant:w,peopleUIState:c.uiState,companyId:y,shouldFetchClasses:I,classList:j,managersView:v,peopleView:c,onInvitePeopleClick:()=>{l("./new")},onColumnSortConfigChanged:(e,W)=>{n(K({sortKey:e,sortOrder:W}))},onRowClick:e=>{const W=`/${d}/people/${encodeURIComponent(e)}/edit`,xe=$e(g.state?.pathnameStackToGoBack,g.pathname);l(W,{state:{pathnameStackToGoBack:xe}})},onClickMenuIcon:()=>{C(!0)},isAiCfoAccessEnabled:F,onAskAiCfoClick:Z})]})}function wa(){const a=_e();return Ae(a?.loggedInUserRole??[])?s.jsxs(se,{children:[s.jsx($,{path:"/",element:s.jsx(Y,{})}),s.jsx($,{path:"new",element:s.jsx(Y,{isInvitePeopleDrawerOpen:!0})}),s.jsx($,{path:":userId/edit",element:s.jsx(Y,{isEditPeopleDrawerOpen:!0})}),s.jsx($,{path:"*",element:s.jsx(ae,{})})]}):s.jsx(se,{children:s.jsx($,{path:"*",element:s.jsx(ae,{})})})}export{wa as default};