@zeniai/web-app-ui 5.2.18-dev → 5.2.19-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.
- package/dist/assets/AddressRoutes-C8sZ1LMI.js +1 -0
- package/dist/assets/AddressScreen-BIXlTd0k.js +9 -0
- package/dist/assets/AiCfoScreen-BBbfhHPd.js +22 -0
- package/dist/assets/{BillPayApprovalRoutes-DNBT8bBe.js → BillPayApprovalRoutes-Cckj8faG.js} +1 -1
- package/dist/assets/{BillPayRoutes-Ee1gMZDl.js → BillPayRoutes-DoYzm1s_.js} +12 -12
- package/dist/assets/{BusinessVerificationPageScreen-BrCTRscW.js → BusinessVerificationPageScreen-DtwUBmOs.js} +2 -2
- package/dist/assets/CardsAiCfoScreen-DC_ARWEe.js +14 -0
- package/dist/assets/{ChargeCardRoutes-BnvieJVH.js → ChargeCardRoutes-DrlvPNEr.js} +10 -10
- package/dist/assets/CompanyPassportScreen-DSK81yql.js +1 -0
- package/dist/assets/ConnectionAuthScreen-Dt0zrkJk.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-BLWOt3oi.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-BRWto4FV.js +30 -0
- package/dist/assets/{DashboardRoutes-DzdPS_ou.js → DashboardRoutes-DMxcTWza.js} +4 -4
- package/dist/assets/{DefaultTenantHome-D1Wy6Wl5.js → DefaultTenantHome-BL6j-dU2.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-CIqjtvpv.js +18 -0
- package/dist/assets/DrawerScreen-CF6jlYli.js +1 -0
- package/dist/assets/EntityDetailRoutes-DsK2unnT.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-Bh2GJ5eR.js +25 -0
- package/dist/assets/FeaturePreviewScreen-CqdV6Bc4.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-CkSSYOv5.js +1 -0
- package/dist/assets/MagicLinkRoutes-CUITVdVT.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-Ck9fKk0s.js +12 -0
- package/dist/assets/MobileAppDrawer-N86gBmzN.js +1 -0
- package/dist/assets/NotFoundScreen-B9IlcCjB.js +1 -0
- package/dist/assets/{NotificationRoutes-BuE5Ia0t.js → NotificationRoutes-cS6QWWsP.js} +1 -1
- package/dist/assets/OAuthConsentScreen-8YU26znY.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-UkbQdYTq.js +1 -0
- package/dist/assets/PeopleRoutes-CsD4yHB-.js +22 -0
- package/dist/assets/PerformanceRoutes-NXKZM9JF.js +1 -0
- package/dist/assets/{Preview-C3t9OASa.js → Preview-Bjww8VIJ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BcAa0XdH.js → QBOConnectionScreen-Cwzdj4Q-.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-DpbViwiq.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DOYdcnj3.js → ReimbursementApprovalRuleDetailScreen-CpG3boOY.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-CVrOZVi7.js → ReimbursementRoutes-DiGdaZcS.js} +8 -8
- package/dist/assets/{ReportsRoutes-BSaDsWab.js → ReportsRoutes-BCP7KWMp.js} +1 -1
- package/dist/assets/RewardsRoutes-CpIo0I4i.js +1 -0
- package/dist/assets/ScreenRoutes-CSTyxtbM.js +2 -0
- package/dist/assets/SettingsRoutes-DvRgqkat.js +57 -0
- package/dist/assets/{SetupPagesScreen-usZWca-_.js → SetupPagesScreen-DFYeQ_eK.js} +5 -5
- package/dist/assets/SignInScreen-ZyXdRrhQ.js +1 -0
- package/dist/assets/SignOutScreen-CjCZ3Zak.js +9 -0
- package/dist/assets/TaskListScreen-DgEblwsB.js +9 -0
- package/dist/assets/TaskRoutes-Cg1seHyv.js +9 -0
- package/dist/assets/{TransactionDetailRoutes-BiA_QHF1.js → TransactionDetailRoutes-BBskyEa9.js} +1 -1
- package/dist/assets/TransactionDetailScreen-lkVHlxIe.js +5 -0
- package/dist/assets/{TransactionListRoutes-DIJytNYy.js → TransactionListRoutes-V5JqSayP.js} +1 -1
- package/dist/assets/TreasuryRoutes-MHYDsvJq.js +37 -0
- package/dist/assets/{VendorsRoutes-C0IKd0L4.js → VendorsRoutes-BJ_iX5jb.js} +15 -15
- package/dist/assets/WiseConfirmationScreen-Dk_ohJaH.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-DyxLcHZW.js → ZeniAccountRoutes-DnQ5jPxp.js} +10 -10
- package/dist/assets/ZeniAccountStatementScreen-mgHi-fEV.js +9 -0
- package/dist/assets/{accountMappingHelper-B-kf-Qnc.js → accountMappingHelper-DkNOxib8.js} +1 -1
- package/dist/assets/{analytics-DtYJ-EGT.js → analytics-dRdyiJhV.js} +1 -1
- package/dist/assets/{analyticsHelper-CTlcOyiL.js → analyticsHelper-BlJN3smJ.js} +1 -1
- package/dist/assets/{core-DnZcjy6X.js → core-6UWneHYU.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CjxujRw-.js → decodeURIComponentSafe-IgzW2Epz.js} +1 -1
- package/dist/assets/{dnd-eoV-_JYH.js → dnd-DPJDixDO.js} +1 -1
- package/dist/assets/{empty-DkIaLxCd.js → empty-Ct6G3q3O.js} +1 -1
- package/dist/assets/{empty-Dq2hLrCm.js → empty-UUw51dpq.js} +1 -1
- package/dist/assets/{emptyVideoElement-BFB9pddL.js → emptyVideoElement-DWcmeFmU.js} +1 -1
- package/dist/assets/epic-BrLkseVN.js +2 -0
- package/dist/assets/getLocaleForTenant-bb4clfVv.js +1 -0
- package/dist/assets/{index-nBWRmUT4.js → index-A9TSx6IP.js} +15820 -16753
- package/dist/assets/{index-C8_nlYo6.js → index-CaSGnkOr.js} +2 -2
- package/dist/assets/{index-DUKU6sVX.js → index-CiAPO6YA.js} +1 -1
- package/dist/assets/index-Czu7h9lW.css +1 -0
- package/dist/assets/{index-Wtyhkk6J.js → index-D2jN0Wir.js} +1 -1
- package/dist/assets/{index-Dmm4l94W.js → index-Ns5QLo2D.js} +1 -1
- package/dist/assets/{index-D_CZgugN.js → index-T0jg9Q8I.js} +1 -1
- package/dist/assets/{index-nn6YvIGD.js → index-sP-MfLTE.js} +1 -1
- package/dist/assets/{index-CiCTnO2S.js → index-xNLACcug.js} +1 -1
- package/dist/assets/{lexical-CSqytB8g.js → lexical-BSu0Xk1T.js} +1 -1
- package/dist/assets/liveblocks-CO5jpspP.js +54 -0
- package/dist/assets/{lottie-Dz5luYQG.js → lottie-BHZsp7n9.js} +1 -1
- package/dist/assets/{mui-sr6zger7.js → mui-CZj-zMWV.js} +1 -1
- package/dist/assets/{pathToGoBack-DpO-gBzq.js → pathToGoBack-B6i9h4RV.js} +1 -1
- package/dist/assets/{pdf-BNSeVvBm.js → pdf-B15NABJW.js} +3 -3
- package/dist/assets/{pdf-lib-DwpnbCVp.js → pdf-lib-CT0ukUSx.js} +1 -1
- package/dist/assets/{plaid-QvRDxgoN.js → plaid-CQGSnVgh.js} +1 -1
- package/dist/assets/{pusher-senIjtt-.js → pusher-Cgk0flcG.js} +1 -1
- package/dist/assets/{react-CuKQRzYG.js → react-B4uDycL4.js} +1 -1
- package/dist/assets/{react-OAPKV4uC.js → react-BL-Db5kO.js} +1 -1
- package/dist/assets/{react-CBRcLxW-.js → react-C-hKaTCY.js} +1 -1
- package/dist/assets/{react-ClmbMdlp.js → react-DIU8hszS.js} +1 -1
- package/dist/assets/{react-CiyNePZ5.js → react-GfGdDMpS.js} +1 -1
- package/dist/assets/{react-BGDkRw8Y.js → react-KFT2mdy8.js} +1 -1
- package/dist/assets/{recharts-Bim6mdwu.js → recharts-DNj0j956.js} +1 -1
- package/dist/assets/routePaths-CsP6Ffie.js +1 -0
- package/dist/assets/{sentry-DFI2OQU2.js → sentry-DT80za28.js} +1 -1
- package/dist/assets/{url-p6YiHaLn.js → url-DEpm4gKV.js} +1 -1
- package/dist/assets/{url-4e0ZWhZq.js → url-DvP2uQIr.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-Bcrl6X1X.js → useAiCfoDashboardSuggestedQuestionsChips-DBOgNEAN.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CpfOq769.js +1 -0
- package/dist/assets/useCashManagementBanner-Z61qrdOB.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-uhG5ouo_.js → useChargeCardPusherEvents-Div87iyA.js} +1 -1
- package/dist/assets/{useDeviceId-DasP_-mC.js → useDeviceId-BU2za7GL.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-DZSBVmEz.js → useEmailConnectResultRefresh-D7AP3TT4.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-Ch4ouOBD.js → useInitialThreadRequest-Dt_bRaHc.js} +1 -1
- package/dist/assets/{utils-cHxIh7E8.js → utils-CLt4eceg.js} +1 -1
- package/dist/assets/withTransactionSidePanel-DKi_i4iZ.js +21 -0
- package/dist/assets/{zeni-epic-state-m4zoW3ek.js → zeni-epic-state-CO3_FacC.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +6 -9
- package/dist/assets/AddressRoutes-OroYq1dZ.js +0 -1
- package/dist/assets/AddressScreen-ApC_R0Wp.js +0 -9
- package/dist/assets/AiCfoScreen-ceOXZKkH.js +0 -22
- package/dist/assets/CardsAiCfoScreen-C_N9OShc.js +0 -14
- package/dist/assets/CompanyPassportScreen-RJZfjyND.js +0 -1
- package/dist/assets/ConnectionAuthScreen-BeUh42uJ.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-BxM3YPtm.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-CHFrWBuQ.js +0 -30
- package/dist/assets/DomesticWireDetailScreen-BkAznvqR.js +0 -18
- package/dist/assets/DrawerScreen-DbGHqqp3.js +0 -1
- package/dist/assets/EntityDetailRoutes-BZZT4beI.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-DRT8zgD0.js +0 -25
- package/dist/assets/FeaturePreviewScreen-BuOhC0VV.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-But5JTd3.js +0 -1
- package/dist/assets/MagicLinkRoutes-BXYryYOa.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-Djwwkjab.js +0 -12
- package/dist/assets/MobileAppDrawer-KiFiOGbB.js +0 -1
- package/dist/assets/NotFoundScreen-CdBZ6E4V.js +0 -1
- package/dist/assets/OAuthConsentScreen-BHoiJyyq.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-CYJYOUC0.js +0 -1
- package/dist/assets/PeopleRoutes-DQ4ywy5y.js +0 -22
- package/dist/assets/PerformanceRoutes-DlI-5IYy.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-vvvoQ_Sf.js +0 -1
- package/dist/assets/RewardsRoutes-DsYtBmZx.js +0 -1
- package/dist/assets/ScreenRoutes-_KkX47BV.js +0 -2
- package/dist/assets/SettingsRoutes-DqjN1ABZ.js +0 -57
- package/dist/assets/SignInScreen-BDE1HpBU.js +0 -1
- package/dist/assets/SignOutScreen-xueiP_tN.js +0 -9
- package/dist/assets/TaskListScreen-DduFWf5s.js +0 -9
- package/dist/assets/TaskRoutes-C6C-H9ff.js +0 -9
- package/dist/assets/TransactionDetailScreen-D0qCr6b1.js +0 -5
- package/dist/assets/TreasuryRoutes-BxXAoPv6.js +0 -37
- package/dist/assets/WiseConfirmationScreen-BSv238Gl.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-Dyx3X86U.js +0 -9
- package/dist/assets/epic-Blr6eiMV.js +0 -2
- package/dist/assets/getLocaleForTenant-CtnTFS0P.js +0 -1
- package/dist/assets/index-Cx4f0JbF.css +0 -1
- package/dist/assets/liveblocks-DKL6viSK.js +0 -54
- package/dist/assets/routePaths-D0N7YUlE.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BqNcSAwL.js +0 -1
- package/dist/assets/useCashManagementBanner-rPbgM7YP.js +0 -1
- package/dist/assets/withTransactionSidePanel-CWy10IlG.js +0 -21
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{j as C}from"./liveblocks-CO5jpspP.js";import{a}from"./sentry-DT80za28.js";import{u as D,g as v,j as m,N as w}from"./core-6UWneHYU.js";import{Md as O,eZ as A,g3 as _,oi as j,gz as E,g2 as U,fC as L,Mk as k}from"./zeni-epic-state-CO3_FacC.js";import{u as F,z as p,L as g,O as $,o as z}from"./index-A9TSx6IP.js";import{n as H}from"./mui-CZj-zMWV.js";import{t as R}from"./getLocaleForTenant-bb4clfVv.js";import{g as M,Q as P}from"./QBOConnectionScreen-Cwzdj4Q-.js";import"./recharts-DNj0j956.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";import"./empty-Ct6G3q3O.js";import"./pdf-lib-CT0ukUSx.js";import"./index-Ns5QLo2D.js";import"./url-DEpm4gKV.js";import"./index-CiAPO6YA.js";import"./decodeURIComponentSafe-IgzW2Epz.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},d=new t.Error().stack;d&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[d]="9e95b26a-613c-4925-bb44-276fb8272b83",t._sentryDebugIdIdentifier="sentry-dbid-9e95b26a-613c-4925-bb44-276fb8272b83")}catch{}})();const G=H.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex: 1 1 auto;
|
|
4
|
+
flex-direction: row;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100vh;
|
|
9
|
+
background-color: ${t=>t.theme.colors.background};
|
|
10
|
+
box-shadow: ${t=>`0px 2px ${z.sp1} ${t.theme.colors.dropShadowNormal}`};
|
|
11
|
+
`;function ce(){const t=D(),d=v(),{setLoading:i,clearAllLoading:h}=F(),c=a.useRef(!1),f=a.useRef(!1),{code:x,realmId:T,state:y}=M(d.search),N=x!==""&&T!==""&&y!=="",I=m((l=>O(l))),e=m((l=>A(l))),n=m((l=>l.tenantState.fetchState)),r=m((l=>l.tenantState.activeTenantFetchState.fetchState)),o=p.getSignedInUser(),u=p.getActiveTenantForUser()?.tenantId,s=e?.externalConnections?.fetchState,b=e?.externalConnections?.saveConnectionState,S=e.externalConnections?.accounting[0]?.isValid;return a.useLayoutEffect((()=>{i(g.CONNECTION_AUTH)}),[i]),a.useEffect((()=>{c.current||o==null||u==null||(c.current=!0,n==="Completed"||r!=="Not-Started"&&r!=="Error"||(i(g.TENANT_FETCHING),t(_(o.userId,u))))}),[c,n,i]),a.useEffect((()=>{e.tenantId==null&&!f.current&&o!=null&&(f.current=!0,!(u==null||u!=null&&(r==="Completed"||r==="Error"))||n!=="Not-Started"&&n!=="Error"||t(j(o.userId)))}),[f,n,r]),a.useEffect((()=>{o==null||e?.tenantId==null||e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||b!=="Error"||(i(g.CONNECTION_AUTH),t(E(o.userId,e.tenantId)))}),[b]),a.useEffect((()=>{n!=="Completed"&&r!=="Completed"||o==null||e?.tenantId==null||(t(U(e.tenantId)),p.saveActiveTenantDomainForUser(e.tenantEmailDomain),L(o?.userId,o?.zeniSessionId,e.tenantId),$.updateAppLocaleID(R(k(e))),e.externalConnections!=null||n!=="Completed"&&r!=="Completed"||s==="In-Progress"||o==null||e==null||t(E(o.userId,e.tenantId)))}),[n,r,s]),a.useEffect((()=>{I.tenantsCoreDetailsInOrder.length>0&&n==="Completed"&&p.saveSignedInUserTenants(I.tenantsCoreDetailsInOrder)}),[I.tenantsCoreDetailsInOrder.length,n]),a.useEffect((()=>{n!=="Completed"&&n!=="Error"||r!=="Completed"&&r!=="Error"||s!=="Completed"&&s!=="Error"||h()}),[n,r,s]),e==null||n!=="Completed"&&r!=="Completed"||s!=="Completed"?null:N||S!==!0?C.jsx(G,{children:C.jsx(P,{})}):C.jsx(w,{to:"/",replace:!0})}export{ce as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as i}from"./liveblocks-CO5jpspP.js";import{z as n}from"./index-A9TSx6IP.js";import{g as d}from"./QBOConnectionScreen-Cwzdj4Q-.js";import"./sentry-DT80za28.js";import{g as p,N as s}from"./core-6UWneHYU.js";import"./zeni-epic-state-CO3_FacC.js";import"./recharts-DNj0j956.js";import"./mui-CZj-zMWV.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";import"./empty-Ct6G3q3O.js";import"./pdf-lib-CT0ukUSx.js";import"./index-Ns5QLo2D.js";import"./url-DEpm4gKV.js";import"./index-CiAPO6YA.js";import"./decodeURIComponentSafe-IgzW2Epz.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new t.Error().stack;o&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[o]="817363c8-7f1d-4590-b58b-cef70b99ca15",t._sentryDebugIdIdentifier="sentry-dbid-817363c8-7f1d-4590-b58b-cef70b99ca15")}catch{}})();const U=()=>{const t=p(),{code:o,realmId:r,state:e}=d(t.search),m=n.getSignedInUser()?.userId??"";if(f(o,r,e,m)===!0){const a=`../../${e}/onboarding?code=${o}&realmId=${r}&state=auth_flow`;return i.jsx(s,{to:a})}return i.jsx(s,{to:"../../"})},f=(t,o,r,e)=>t!=""&&o!=""&&r!=""&&e!=null&&e!="";export{U as default,f as hasValidParams};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import{j as a}from"./liveblocks-CO5jpspP.js";import{t as ht,A as Ne}from"./AddressScreen-BIXlTd0k.js";import St from"./NotFoundScreen-B9IlcCjB.js";import{a as d}from"./sentry-DT80za28.js";import{h as be,g as ke,u as ae,i as Ie,j as I,N as B,l as Ct,n as tt,o as bt,p as H}from"./core-6UWneHYU.js";import{eZ as X,fG as Oe,fE as _e,bs as kt,fU as It,bS as Ot,og as _t,tF as vt,tI as Tt,Nc as xt,Nd as wt,ki as he,kl as nt,MJ as Et,bZ as At,c7 as ue,u7 as ve,tU as Pt,Ne as de,u8 as at,KC as Dt,lm as ot,Nf as jt,Ng as Ft,rD as Bt,hx as Ut,MB as me,hu as Nt,MC as Vt,yk as Rt,rH as Lt,hm as Gt,hp as Ve,Nh as st,Ni as $t,En as Mt,Nj as Kt,Er as Qt,tL as zt,Nk as qt,Nl as Ht,kg as Zt,kj as Wt,uk as Jt,tW as it,u6 as Xt,bE as Re,cA as Yt,uj as Le,rW as en,rK as tn,le as nn,gl as an,gk as on,gj as sn,Nm as rn,tO as cn,ul as dn,uo as un,ur as ln,ux as pn,cZ as mn}from"./zeni-epic-state-CO3_FacC.js";import{z as L,A as Te,d as Z,c as gn,r as Q,C as oe,f as U,aq as fn,K as yn,v as rt,e as ct,ar as Ge,k as Se,h as Ce,as as hn,o as $e,at as Me,au as Sn,av as Ke,aw as Cn,ax as bn}from"./index-A9TSx6IP.js";import{n as xe}from"./mui-CZj-zMWV.js";import{g as kn,h as In,q as se}from"./QBOConnectionScreen-Cwzdj4Q-.js";import{u as On,a as _n}from"./useEmailConnectResultRefresh-D7AP3TT4.js";import{u as vn}from"./useChargeCardPusherEvents-Div87iyA.js";import"./recharts-DNj0j956.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";import"./empty-Ct6G3q3O.js";import"./pdf-lib-CT0ukUSx.js";import"./index-Ns5QLo2D.js";import"./url-DEpm4gKV.js";import"./index-CiAPO6YA.js";import"./decodeURIComponentSafe-IgzW2Epz.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new e.Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="d0d24812-deb2-4704-a542-3fbf1e17d891",e._sentryDebugIdIdentifier="sentry-dbid-d0d24812-deb2-4704-a542-3fbf1e17d891")}catch{}})();const Qe=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Tn=()=>{const e=be(),u=ke(),i=ae(),[o,l]=d.useState(!1),[c,y]=d.useState(!1),{tenantEmailDomain:S}=Ie(),t=L.getSignedInUser(),{useFeatureGate:n}=Te(),{isFeatureEnabled:s}=n(Z.isApAgingFeatureEnabled),{isFeatureEnabled:C}=n(Z.isArAgingFeatureEnabled),{isFeatureEnabled:O}=n(Z.isReferralFeatureEnabled),{isFeatureEnabled:k}=n(Z.isExpenseAutomationEnabledV2),{isFeatureEnabled:x}=n(Z.isDebitCardFeatureEnabled),r=gn(),g=I((h=>X(h))),p=I((h=>h.onboardingCustomerViewState.fetchState)),_=g.excludedResources,T=g.companyId??L.getSignedInUserTenant(S)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const w=Oe(x,g),D=_e(g),m=[],G=_?.resources?.find((h=>h.resource==="/reports/top_expenses"))==null,j=_?.resources?.find((h=>h.resource==="/reports/task_card"))==null,$=g?.userRole!=null&&kt(g?.userRole),M=_?.resources?.find((h=>h.resource==="/bills"))==null&&!$,A=_?.resources?.find((h=>h.resource==="/reimbursements"))==null;G===!1&&m.push("top_expenses"),j===!1&&m.push("task_card"),M===!1&&m.push("bill_pay_card","bill_pay_promo_card"),A===!1&&m.push("reimbursement_card","reimbursement_promo_card"),m.push("zeni_accounts_promo_card","treasury_promo_card"),O===!1&&m.push("rewards_card");const F=I((h=>{const v=[];s===!1&&v.push("accounts_payable_aging"),C===!1&&v.push("accounts_receivable_aging"),v.push("zeni_accounts_promo_card","treasury_promo_card"),O===!1&&v.push("rewards_card"),r===!1&&v.push("expense_automation_card");const W=It(h,v,t,k,r);return Ot(W.reportsInOrder.map((P=>({fetchState:P.fetchState,error:P.error})))).fetchState}));d.useEffect((()=>{p!=="Completed"||o||w||D||(l(!0),i(_t(t.userId,T,g.tenantId,!0,!1,m)))}),[o,p,w,D,t,g.tenantId,i]);const z=d.useRef(!1),K=d.useCallback((()=>{const h={pathnameStackToGoBack:Q(u.state?.pathnameStackToGoBack,u.pathname),message:"activation"};e(w?"../../checking":D?"../../cards":"../../dashboard",{state:h})}),[e,u,w,D]),N=d.useCallback((()=>{z.current||(z.current=!0,K())}),[K]);if(d.useEffect((()=>{const h=setTimeout((()=>y(!0)),3e3);return()=>clearTimeout(h)}),[]),d.useEffect((()=>{const h=setTimeout(N,6e3);return()=>clearTimeout(h)}),[N]),d.useEffect((()=>{w||D||!c||F!=="Completed"&&F!=="Error"||N()}),[c,F,w,D,N]),p!=="Completed")return a.jsx(B,{to:"../"});const V=g.company?.companyOnboardingInfo?.onboardingInfo,q={timeSinceQuoteSign:V?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:V?.onboardingToQuoteSignMinutes??0,isKybDone:Qe(V?.businessVerified?.status),isKycDone:Qe(V?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:V?.accountingConnectionCreationMode??""};return a.jsxs(a.Fragment,{children:[a.jsx(oe,{analytics:U,onLoad:h=>h.trackOnboardingDashboardActivation(q)}),a.jsx(fn,{show:!0,onComplete:N})]})},ge=["reading_books","finance_graph","reconciliation","cfo_foundation"],fe=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],ze=(e,u)=>{const i=new Map(e.map((o=>[o.key,o])));return u.map((o=>{return l=i.get(o)?.status,l==="starting"||l==="building"?l:"idle";var l}))},qe=(e,u)=>{if(e.length===0)return!1;const i=new Map(e.map((o=>[o.key,o])));return u.every((o=>i.get(o)?.status==="ready"))},He=xe.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
5
|
+
`,Ze=xe.div`
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
flex: 1;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
${e=>e.skipLegacyDrawerOffset?`
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding-left: ${$e.sp0};
|
|
15
|
+
`:`
|
|
16
|
+
min-width: calc(100% - ${Me}px);
|
|
17
|
+
padding-left: ${Me}px;
|
|
18
|
+
`}
|
|
19
|
+
|
|
20
|
+
${e=>e.theme.breakpoints.down("md")} {
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding-left: ${$e.sp0};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
26
|
+
`,We=tt((function(e,u){const{companyId:i,isAdmin:o,currentTenant:l,isOnAddressPage:c}=u,y=L.getSignedInUser(),S=l.tenantId,t={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:S??""},n=X(e),s=ve(e,i),C=st(e),O=ue(l?.userRole??[])&&s.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",k=$t(e.userRoleConfigState);return{onboardingCustomerView:s,analytics:U,isRefreshingViewInBackground:!1,isDisabled:O,companyTitles:k.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Sn.fileMicroServiceBaseUrl,authParams:t},signedInUser:L.getSignedInUser(),currentTenant:n,isAdmin:o,isOnAddressPage:c,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true",cardPaymentView:C,isCardPaymentPopupOpen:!1,stripeKey:Se.stripeKey}}),(function(e,u){const{companyId:i,currentTenant:o,themeState:l,navigate:c,location:y}=u,{tenantEmailDomain:S}=o;return{onFetchLinkTokenClick:(t,n)=>{e(pn(t,n))},onEstablishConnectionClick:(t,n)=>{e(ln(t,n))},onUpdatePaymentAccountStatus:(t,n,s)=>{e(un(t,n,s))},onUpdatePaymentAccountLoginStatus:(t,n)=>{e(dn(!1,t,n))},onEstablishConnectionSuccess:()=>{e(cn(i,!0,!1))},handleOnConnectClick:()=>{U.trackOnboardingConnectQBO(),se.handleClick()},updateQBOPopupState:t=>{e(de({isQBOPopupOpen:t}))},onCompanyOfficerUpdated:t=>{const n=t.map((s=>{const{officerType:C,userId:O,name:k,email:x,ssn:r,nationalityCountryCode:g,dob:p,phone:_,syncToken:T,selectDocument:w,role:D,ownership:m,isSelectedForVerification:G,userVerificationStatus:j,fileIds:$,isPhoneVerified:M}=s;let A;return w.selectDocumentType==="driverLicense"?A="driving_license":w.selectDocumentType==="passport"?A="passport":w.selectDocumentType==="stateId"?A="id_document":w.selectDocumentType==="ssnCard"&&(A="social_security_card"),{officerType:C,userId:O,firstName:k.firstName,lastName:k.lastName,email:x,ssn:r,nationalityCountryCode:g?.selectedOption!=null?Ke(g.selectedOption):void 0,phone:_,birthday:p!=null?Re(p?.toString()):p,syncToken:T,titleAtCompany:D.selectedOption,ownershipInCompany:m,documentTypeSelectedForVerification:A,isSelectedForVerification:G,userVerificationStatus:j,fileIds:$,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:M}}));e(Le({officers:n}))},onGetOtp:(t,n)=>{e(sn(t,"CustomerOnboarding")),n!=null&&e(rn({officerType:n,phone:t}))},onResendOtp:t=>{e(on(t,"CustomerOnboarding"))},onVerifyOtp:(t,n)=>{e(an(t,n,"CustomerOnboarding"))},updateFilesEntity:t=>{e(nn({files:t}))},onDeleteFile:t=>{e(tn(t))},onEditFileName:(t,n)=>{e(en(t,n.split(".")[0]))},onCompanyDetailsChanged:t=>{const{companyDescription:n,companyIndustry:s,companyIndustryType:C,companyLegalName:O,companyTaxId:k,companyWebsite:x,companyPhone:r,primaryContactEmail:g,primaryContactName:p,primaryContactUserId:_,primaryContactSyncToken:T,syncToken:w,fileIds:D,typeOfIncorporation:m,stateOfIncorporation:G,incDate:j,companySourceOfFunds:$,companySourceOfFundsDescription:M,companySubIndustry:A,countriesOfOperations:F,purposeOfAccount:z,purposeOfAccountDescription:K,regulatedStatus:N,regulatedStatusDescription:V,transactionVolume:q,transactionVolumeDescription:h,usNexus:v,usNexusTypes:W}=t,P={companyId:i,companyDescription:n,companyIndustry:s.selectedOption,companyIndustryType:C?.selectedOption??"",companyLegalName:O,taxIdOrEIN:k,website:x!=""&&x!=null?Yt(x):void 0,phone:r,syncToken:w,fileIds:D,incDate:j!=null?Re(j?.toString()):j,typeOfIncorporation:m?.selectedOption??"",stateOfIncorporation:G?.selectedOption??"",companySourceOfFunds:$?.selectedOption??"",companySourceOfFundsDescription:M,companySubIndustry:A?.selectedOption??"",countriesOfOperations:F?.selectedOptions.map((Y=>Y.length===2?Y:Ke(Y)))??[],purposeOfAccount:z?.selectedOption??"",purposeOfAccountDescription:K,regulatedStatus:N??"",regulatedStatusDescription:V,transactionVolume:q?.selectedOption??"",transactionVolumeDescription:h,usNexus:v,usNexusTypes:W?.selectedOptions??[]},le={userId:_,firstName:p.firstName,lastName:p.lastName,email:g,syncToken:T};e(Le({companyDetails:P,primaryContactDetails:le}))},onAddressClick:(t,n)=>{const s=Xe(S,t,n),C=Q(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onRegisteredAddressClick:(t,n)=>{const s=Xe(S,t,n),C=Q(y.state?.pathnameStackToGoBack,y.pathname);c(s,{state:{pathnameStackToGoBack:C}})},onUpdateCustomerView:(t,n,s)=>{e(Xt(i,!1,n,s,t))},onAddressEditHandler:t=>{if(t!=null){const n=ht(t);e(ot({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const t=Q(y.state?.pathnameStackToGoBack,y.pathname);e(it(i,!1,!1)),c("./activation",{state:{pathnameStackToGoBack:t}})},onUpdateStep:t=>{e(at({step:t}))},onUpdateSubStep:t=>{e(Jt({subStep:t}))},onZeniLogoClick:()=>{l.toggle()},handleLogOutClick:()=>{const t=Q(y.state?.pathnameStackToGoBack,y.pathname);c("/signout",{replace:!0,state:{pathnameStackToGoBack:t,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{c(`/${S}/rewards`)},handleCreateCardSetupIntent:t=>{e(nt(t))},handleConfirmCardSetupIntent:t=>{e(Wt(t))},updateCardPaymentModalState:t=>{e(de({isCardPaymentPopupOpen:t}))},handleAddCardPaymentSource:(t,n,s)=>{e(Zt(t,n,s))},handleFetchPaymentSources:()=>{e(he())},resetCardPaymentViewState:()=>{e(Ht())},handleResetCardPaymentErrorStatuses:()=>{e(qt())},redirectToProductSuitePage:()=>{const t=Q(y.state?.pathnameStackToGoBack,y.pathname);c(`/${S}/onboarding/thankyou`,{state:{pathnameStackToGoBack:t,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(U.trackOnboardingAiFinanceTeamAcknowledged(),e(zt(i)))},onIdentityDocumentUploadedForAutofill:t=>{if(i==null)return;const n=Kt(t.documentType);n!=null&&e(Qt({target:"onboarding",companyId:i,officerType:t.officerType,fileId:t.fileId,documentType:n}))},onCompanyDocumentUploadedForAutofill:t=>{i!=null&&e(Mt({target:"onboarding",companyId:i,fileId:t.fileId,documentType:t.documentType}))}}}))(hn),ce=({taxCFOCustomer:e=!1,isOnAddressPage:u=!1,appContent:i})=>{const o=be(),l=ke(),c=ae(),y=yn(),S=rt(),[t,n]=d.useState(!1),[s,C]=d.useState(!1),[O,k]=d.useState(!1),{tenantEmailDomain:x}=Ie(),r=ct(),{useFeatureGate:g}=Te(),{isFeatureEnabled:p}=g(Z.isDebitCardFeatureEnabled),_=Ct("/:tenantEmailDomain/onboarding")!==null&&l.search?.includes("code"),T=I((f=>f.onboardingCustomerViewState.fetchState)),w=I((f=>f.onboardingCustomerViewState.currentStep)),D=I((f=>f.onboardingCustomerViewState.uiState)),m=I((f=>X(f))),G=I((f=>f.userRoleConfigState.fetchState)),j=I((f=>f.cardPaymentViewState)),$=Ge(j.addCardPaymentSourceStatus.fetchState),M=j.addCardPaymentSourceStatus.fetchState,{code:A,realmId:F,state:z}=kn(l.search),K=m.externalConnections?.accounting[0],N=K?.connectionType,V=K?.connectionName,q=K?.connectionId??"",h=L.getSignedInUser()?.userId??"";d.useEffect((()=>{s||(C(!0),c(he()))}),[s,c]),d.useEffect((()=>{O||(nt(["card"]),k(!0))}),[O]),d.useEffect((()=>{$==="In-Progress"&&M==="Completed"&&c(he())}),[$,M]),d.useEffect((()=>{In(A,F,z,q,h)===!0&&m.externalConnections?.saveConnectionState!=="In-Progress"&&T==="Completed"&&(c(Et(m.tenantId,{connection_type:N??"accounting",connection_name:V??"quickbooks_online",authorization_code:A,realm_id:F,connection_id:q,user_id:h},At(window.location.origin+"/onboarding/auth"))),U.trackOnboardingSaveQBOConnection(F,q),o(l.pathname))}),[A,F,z,l.pathname,T]),d.useEffect((()=>{se.isInitiated===!1&&T==="Completed"&&se.init("/onboarding/auth",m.tenantEmailDomain)}),[T]);const v=m.companyId??L.getSignedInUserTenant(x)?.companyId,W=ue(m?.userRole??[]),P=I((f=>ve(f,v)));d.useEffect((()=>{t||T!=="Not-Started"||v==null||(n(!0),c(Pt(v,!0,!_)))}),[t,T,v]),d.useEffect((()=>{m.externalConnections?.saveConnectionState!=="Completed"&&m.externalConnections?.saveConnectionState!=="Error"||!D.isQBOPopupOpen||w!=="connect_ledger"||c(de({isQBOPopupOpen:!1}))}),[m.externalConnections?.saveConnectionState]),d.useEffect((()=>{T==="Completed"&&_&&(c(at({step:"connect_ledger"})),c(de({isQBOPopupOpen:!0})))}),[_,T]),d.useEffect((()=>{G==="Not-Started"&&c(Dt(!0))}),[G,c]);const le=Ge(P.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{P.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&P.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&le==null&&c(ot({addressType:"company_registered_address",addressToCreate:P.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[P.companyDetailsLocalData?.addressStatus?.addressToCreate,P.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Y=P.isInterimEmailSent,we=L.getSignedInUser();if(we==null)throw Error("Can't access onboarding flow without signing in...");const dt=Oe(p,m),ut=_e(m),Ee=m.company?.companyOnboardingInfo.isOnboardingCompleted,Ae=f=>f.trackPageLoaded(Ce.Event.onboardingPage),Pe=m.productSettings.isOtherProductsEnabled,lt=m.productSettings.isTreasuryEnabled,De=xn({tenantEmailDomain:x??"",signedInUserEmail:we.userEmail??"",companyId:v}),je=(({companyId:f})=>{const R=ae(),ie=I((E=>E.onboardingCustomerViewState?.aiAgentsActivation)),ee=I((E=>X(E).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),pe=d.useCallback((()=>{R(vt())}),[R]);d.useEffect((()=>{pe()}),[pe]);const Fe=d.useCallback((()=>{f==null||f===""||ee||R(Tt(f))}),[f,ee,R]),pt=d.useMemo((()=>{if(f==null||f==="")return[];const E=`private-encrypted-${f}`;return[`${E}.ledger-ingestion.counts-updated`,`${E}.ai-agents-activation.phase-changed`]}),[f]),mt=d.useCallback(((E,te)=>{if(te==null||typeof te!="object")return;const b=te;if(E!=="ledger-ingestion.counts-updated"){if(E==="ai-agents-activation.phase-changed"){const re=typeof b.phase_key=="string"?b.phase_key:typeof b.key=="string"?b.key:"",J=typeof b.status=="string"?b.status:"idle";if(re==="")return;R(wt({key:re,status:J==="starting"||J==="building"||J==="ready"?J:"idle",startedAt:typeof b.started_at=="string"?b.started_at:void 0,completedAt:typeof b.completed_at=="string"?b.completed_at:void 0}))}}else R(xt({customerCount:typeof b.customer_count=="number"?b.customer_count:void 0,glAccountCount:typeof b.gl_account_count=="number"?b.gl_account_count:void 0,targetTransactionCount:typeof b.target_transaction_count=="number"?b.target_transaction_count:void 0,transactionCount:typeof b.transaction_count=="number"?b.transaction_count:void 0,vendorCount:typeof b.vendor_count=="number"?b.vendor_count:void 0}))}),[R]);return vn({events:pt,onEvent:mt,onSubscribed:pe}),d.useMemo((()=>{const E=ie?.phases??[],te=ze(E,ge),b=ze(E,fe),re=qe(E,ge),J=qe(E,fe),Be=E.some((yt=>yt.status!=="idle")),ne=!ee&&!Be,Ue=ee&&!Be,gt=Ue?ge.map((()=>"building")):te,ft=Ue?fe.map((()=>"building")):b;return{ledgerRowStatuses:ne?void 0:gt,backgroundRowStatuses:ne?void 0:ft,showLedgerReadyInLabel:ne?void 0:re,showBackgroundReadyInLabel:ne?void 0:J,forceContinueEnabled:!ne||void 0,counts:ie?.counts,onContinueClicked:Fe}}),[ie?.phases,ie?.counts,ee,Fe])})({companyId:v});if(Ee===!0){if(!Pe)return lt?a.jsx(B,{to:"../../treasury"}):dt?a.jsx(B,{to:"../../checking"}):ut?a.jsx(B,{to:"../../cards"}):a.jsx(B,{to:"../../dashboard"});const f=P.updateStatus.fetchState==="In-Progress";if(Pe&&!f)return e?a.jsxs(He,{children:[a.jsx(oe,{analytics:U,onLoad:R=>Ae(R)}),a.jsx(We,{navigate:o,location:l,companyId:v,currentTenant:m,isAdmin:W,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(Ze,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):a.jsx(B,{to:"../../onboarding/thankyou"})}else if(Ee===!1&&r?.loggedInUserRoleMap!=null)return Y===!0?a.jsx(B,{to:"../../onboarding/thankyou"}):a.jsxs(He,{children:[a.jsx(oe,{analytics:U,onLoad:f=>Ae(f)}),a.jsx(We,{navigate:o,location:l,companyId:v,currentTenant:m,isAdmin:W,isOnAddressPage:u,themeState:S,googleAPIKey:Se.googleMapsAPIKey,integrationsSectionProps:De,aiAgentsActivationProps:je}),i!=null?a.jsx(Ze,{windowSize:y,skipLegacyDrawerOffset:u&&m.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ye="external_integrations",xn=({tenantEmailDomain:e,signedInUserEmail:u,companyId:i})=>{const o=ae(),{pendingAutoFocusTabId:l}=On(),{plaidAccounts:c,onAddPlaidAccount:y}=_n({companyId:i}),S=I((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),t=I((r=>X(r))),n=I((r=>r.tenantState.fetchState)),s=I((r=>jt(r,i))),C=I((r=>Ft(r,ye))),O=d.useMemo((()=>new Set(C.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[C]),k=t.tenantId,x=ue(t.userRole??[]);return d.useEffect((()=>{o(Bt(ye))}),[o]),d.useMemo((()=>({isAdmin:x,integrationsView:s,isLoading:n==="In-Progress",notifyMeRegisteredSlugs:O,autoFocusTabId:l??void 0,saveChargeBeeState:s.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:s.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:s.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:s.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:s.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(s.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,g])=>[r,g?.message]))),deleteConnectionState:s.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:s.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{o(Ve(k,"gmail",Je()))},onConnectOutlook:()=>{o(Ve(k,"outlook",Je()))},onConnectHubSpot:(r,g)=>{const p=s.externalConnections?.revenue?.find((T=>T.connectionName==="hubspot"))?.connectionId;if(p==null)return;const _=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:g,connection_id:p,redirect_uri:_,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(_)}`},onDisconnect:(r,g)=>{o(Gt(k,r,me(g)))},onNotifyMe:r=>{U.trackIntegrationsNotifyMeClicked("Onboarding",r),o(Lt(ye,r,u))},onReconnectQBO:()=>{se.init("/onboarding/auth",e),se.handleClick()},onRefreshClick:()=>{s.integrations.refreshQBO.fetchState!=="In-Progress"&&o(Rt())},onSaveChargeBeeCredentials:(r,g)=>{const p=s.externalConnections?.revenue?.find((_=>_.connectionName==="chargebee"))?.connectionId;p!=null&&o(Nt(k,p,me("revenue"),Vt("chargebee"),{api_key:r,site:g}))},onSaveConnectorCredentials:r=>{o(Ut(k,me("payments"),r))},plaidAccounts:c,onAddPlaidAccount:y,plaidConnectionDetails:S})),[x,s,n,O,l,k,u,e,o,c,y,S])};function Je(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function Xe(e,u,i){let o=`/${e}/onboarding/address`;return o=i!=null?o.concat(`/edit/${u}/${encodeURIComponent(i)}`):o.concat(`/new/${u}`),o}const Ye=xe.div`
|
|
27
|
+
display: flex;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
background-color: ${e=>e.theme.colors.grey4};
|
|
30
|
+
`,et=tt((function(e,u){const{companyId:i,currentTenant:o}=u,l=ve(e,i),c=st(e);return{hasVerifiedBankAccount:(l.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(c.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:ue(o?.userRole??[])&&l.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:L.getSignedInUser(),currentTenant:o,meetingUrl:"https://meetings.hubspot.com/niharn/zeni-onboarding-overview?embed=true"}}),(function(e,u){const{currentTenant:i,themeState:o,navigate:l,location:c}=u,{tenantEmailDomain:y}=i;return{onZeniLogoClick:()=>{o.toggle()},handleLogOutClick:()=>{const S=Q(c.state?.pathnameStackToGoBack,c.pathname);l("/signout",{replace:!0,state:{pathnameStackToGoBack:S,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{l(`/${y}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const S=Q(c.state?.pathnameStackToGoBack,c.pathname);l(`/${y}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:S,message:"UpdatePaymentAddressDetail"}})}}}))(bn),wn=()=>{const e=be(),u=ae(),i=ke(),o=rt(),{useFeatureGate:l}=Te(),{isFeatureEnabled:c}=l(Z.isDebitCardFeatureEnabled),{tenantEmailDomain:y}=Ie(),S=ct(),[t,n]=d.useState(!1);d.useEffect((()=>{t===!1&&i.state?.message==="OnboardingThankyou"&&n(!0)}),[i.state]);const s=I((p=>X(p))),C=s.productSettings.isOtherProductsEnabled;d.useEffect((()=>{u(it(O,!1,!C))}),[]);const O=s.companyId??L.getSignedInUserTenant(y)?.companyId;if(S.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const k=Oe(c,s),x=_e(s),r=I((p=>p.onboardingCustomerViewState.updateStatus.fetchState)),g=s.company?.companyOnboardingInfo.isOnboardingCompleted;if(g!==!0||C)return r==="Completed"&&g===!0&&C&&S?.loggedInUserRoleMap!=null?a.jsxs(Ye,{children:[a.jsx(oe,{analytics:U,onLoad:p=>{p.trackPageLoaded(Ce.Event.onboardingLandingPage,"Onboarding",mn(s.productSettings))}}),a.jsx(et,{navigate:e,showUpdatePaymentDetailButton:C,location:i,companyId:O,currentTenant:s,themeState:o,isVisitingFirstTime:t})]}):r==="Completed"&&g===!1&&S?.loggedInUserRoleMap!=null?a.jsxs(Ye,{children:[a.jsx(oe,{analytics:U,onLoad:p=>{p.trackPageLoaded(Ce.Event.onboardingInterimPage)}}),a.jsx(et,{navigate:e,showUpdatePaymentDetailButton:C,location:i,companyId:O,currentTenant:s,themeState:o,isVisitingFirstTime:t})]}):a.jsx(Cn,{});{const p={pathnameStackToGoBack:i.state?.pathnameStackToGoBack,message:"activation"};return k?a.jsx(B,{to:"../../checking",state:p,replace:!0}):x?a.jsx(B,{to:"../../cards",state:p,replace:!0}):a.jsx(B,{to:"../../dashboard",state:p,replace:!0})}};function ta(){return a.jsxs(bt,{children:[a.jsx(H,{path:"/",element:a.jsx(ce,{})}),a.jsx(H,{path:"/billing/edit",element:a.jsx(ce,{taxCFOCustomer:!0})}),a.jsx(H,{path:"/thankyou",element:a.jsx(wn,{})}),a.jsx(H,{path:"/activation",element:a.jsx(Tn,{})}),a.jsx(H,{path:"/address/edit/:addressType/:addressId",element:a.jsx(ce,{isOnAddressPage:!0,appContent:a.jsx(Ne,{})})}),a.jsx(H,{path:"/address/new/:addressType",element:a.jsx(ce,{isOnAddressPage:!0,appContent:a.jsx(Ne,{})})}),a.jsx(H,{path:"*",element:a.jsx(St,{})})]})}export{ta as default};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{j as d}from"./liveblocks-DKL6viSK.js";import{i as K,j as _,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as F,N as xn}from"./core-DnZcjy6X.js";import{e$ as U,NS as We,bE as ia,bo as Te,P7 as Fn,jd as On,P8 as Kt,P9 as Rn,jg as Ct,Pa as Ze,Pb as Bn,jl as jn,Pc as qt,Pd as Mn,jp as kt,Pe as Qe,Pf as Ln,cr as yt,Pg as Un,Ph as Gn,Oa as Vn,kh as Yn,Pi as Nn,bn as Xe,Pj as ca,NG as ce,bc as la,kv as da,ov as ua,ke as ma,NI as le,NH as J,e_ as pa,fw as $n,g7 as _t,Pk as zn,Pl as Kn,Pm as ha,Pn as Fe,wf as Me,wg as Le,wD as we,wx as de,wk as Ue,Po as qn,Pp as Zn,Pq as Qn,Pr as fa,Ps as Oe,Pt as Hn,dL as Je,sz as ga,Pu as Wn,Pv as Xn,Pw as Jn,Px as vt,MY as At,kL as De,wL as It,sH as eo,Py as to,wh as Zt,sC as Ee,sy as ba,Pz as ge,PA as ao,PB as Et,MX as Pt,uG as Ca,PC as no,PD as oo,PE as so,PF as Tt,uW as ro,PG as io,wj as Qt,uF as ka,PH as be,PI as co,bs as _a,wP as Sa,PJ as lo,PK as uo,PL as mo,PM as wt,wK as po,PN as ho,wi as Ht,wO as ya,PO as Ce,PP as fo,PQ as go,PR as va,kA as Aa,os as Ia,kF as Ea,oq as Pa,op as Ta,oo as wa,u2 as bo,PS as Co,cV as ko,cW as _o,ol as So,fW as yo,oC as vo,H0 as dt,GU as Ao,GY as Io,PT as Eo,PU as Po,PV as To,b5 as et,fO as wo,hS as Do,gp as xo,ow as Fo,k7 as Oo,ot as Ro,or as Bo,fI as jo,fG as Mo}from"./zeni-epic-state-m4zoW3ek.js";import{z as M,a4 as te,r as w,e as P,a as q,a_ as Lo,a0 as Ge,F as Ve,a$ as Da,g as Y,b0 as Uo,D as _e,b1 as xa,w as Se,i as B,E as Go,b2 as Vo,b3 as Yo,Y as Fa,J as Oa,c as Ra,$ as No,b4 as $o,W as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,_ as Zo,ar as Qo,q as Ho,Z as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-nBWRmUT4.js";import{n as Dt}from"./mui-sr6zger7.js";import{a as b}from"./sentry-DFI2OQU2.js";import{w as Ua}from"./withTransactionSidePanel-CWy10IlG.js";import{c as Ga,t as xe,f as ue,a as xt,v as as}from"./routePaths-D0N7YUlE.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-BqNcSAwL.js";import je from"./NotFoundScreen-CdBZ6E4V.js";import{u as Ft}from"./useInitialThreadRequest-Ch4ouOBD.js";import{t as Va}from"./analyticsHelper-CTlcOyiL.js";import{C as ns}from"./CompanyPassportScreen-RJZfjyND.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-Bcrl6X1X.js";import{F as ss}from"./FeaturePreviewScreen-BuOhC0VV.js";import"./recharts-Bim6mdwu.js";import"./analytics-DtYJ-EGT.js";import"./plaid-QvRDxgoN.js";import"./dnd-eoV-_JYH.js";import"./stripe-cKAAJElX.js";import"./lottie-Dz5luYQG.js";import"./lexical-CSqytB8g.js";import"./pdf-BNSeVvBm.js";import"./utils-cHxIh7E8.js";import"./TransactionDetailScreen-D0qCr6b1.js";import"./decodeURIComponentSafe-CjxujRw-.js";import"./MobileAppDrawer-KiFiOGbB.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]="cc790118-5874-4a96-98fe-6eec75664e11",e._sentryDebugIdIdentifier="sentry-dbid-cc790118-5874-4a96-98fe-6eec75664e11")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((I=>I.tenantState.currentTenantId)),c=_((I=>U(I))),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo((()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()})),[]),h=b.useMemo((()=>r!=null?ia(r):Te()),[r]),p=$(),f=W(),S=_((I=>Fn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),k=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),T=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),D=b.useCallback((I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=w(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}}),[m,e]),y=b.useCallback((()=>{S.vendor!=null&&P.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)}),[S.vendor,h]);return b.useEffect((()=>{E()}),[]),b.useEffect((()=>{S.fetchState==="Completed"&&y()}),[y,S.fetchState]),d.jsx(Lo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:P,onTransactionClick:D,onReload:E,onBackClick:v,onColumnSortConfigChanged:k,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=_((k=>Rn(k))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((k=>k.tenantState.currentTenantId)),i=_((k=>U(k))),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo((()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),C=t.apAgingUIState.selectedDate??Te(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((k=>{e(Ze({searchString:k}))}),[]),p=b.useCallback(((k,T)=>{e(Ze({sortKey:T,sortOrder:k}))}),[]),f=b.useCallback((k=>{a(`./${k}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((k=>{e(Ze({downloadState:k}))}),[]),E=b.useCallback(((k,T)=>{}),[]),v=b.useCallback(((k,T)=>{e(Ze({selectedDate:k,agingDateSelectionType:T})),e(Ct(k))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:P,onLoad:k=>k.trackPageLoaded(Y.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:P,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((y=>U(y))),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo((()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()})),[]),l=b.useMemo((()=>r!=null?ia(r):Te()),[r]),h=$(),p=W(),f=_((y=>Bn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),k=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),T=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=w(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}}),[c,e]),D=b.useCallback((()=>{f.customer!=null&&P.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)}),[f.customer,l]);return b.useEffect((()=>{S()}),[]),b.useEffect((()=>{f.fetchState==="Completed"&&D()}),[f.fetchState,D]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:P,onTransactionClick:T,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=_((v=>Mn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((v=>U(v))),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),g=t.arAgingUIState.selectedDate??Te(),C=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))}),[]);b.useEffect((()=>{C()}),[]);const u=b.useCallback((()=>{a("../",{relative:"path"})}),[]),l=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),h=b.useCallback(((v,k)=>{e(Qe({sortKey:k,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,k)=>{e(Qe({selectedDate:v,agingDateSelectionType:k})),e(kt(v))}),[]),E=b.useCallback(((v,k)=>{e(Ln({nodeId:v,isCollapsed:k}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:P,onLoad:v=>v.trackPageLoaded(Y.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:P,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=xe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Yn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?P.trackZeniAccountsCashBalancePromoClicked("Move Money"):(P.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else P.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee((function(e){const a=Un(e).accountsInOrder.map(((n,o)=>Ya(n,o))),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:P}}),Na)(xa),us=ee((function(e){const a=Nn(e).accountsInOrder.map(((o,r)=>Ya(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:P}}),Na)(xa);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return _((s=>s.cashBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=yt(n?.loggedInUserRoleMap),r=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return _((s=>s.cardBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=Dt.div`
|
|
1
|
+
import{j as d}from"./liveblocks-CO5jpspP.js";import{i as K,j as _,g as H,u as $,h as W,n as ee,k as ra,o as bt,p as F,N as Dn}from"./core-6UWneHYU.js";import{eZ as U,NF as We,bE as ia,bo as Pe,OT as Fn,j8 as On,OU as Kt,OV as Rn,jb as Ct,OW as Ze,OX as Bn,jg as jn,OY as qt,OZ as Mn,jk as kt,O_ as Qe,O$ as Ln,cq as yt,P0 as Un,P1 as Gn,NZ as Vn,kc as Nn,P2 as Yn,bn as Xe,P3 as ca,Nt as ce,bc as la,kq as da,oq as ua,k9 as ma,Nv as le,Nu as J,eY as pa,fu as $n,g5 as _t,P4 as zn,P5 as Kn,P6 as ha,P7 as Fe,wa as Me,wb as Le,wy as we,ws as de,wf as Ue,P8 as qn,P9 as Zn,Pa as Qn,Pb as fa,Pc as Oe,Pd as Hn,dI as Je,su as ga,Pe as Wn,Pf as Xn,Pg as Jn,Ph as vt,ML as At,kG as xe,wG as It,sC as eo,Pi as to,wc as Zt,sx as Ee,st as ba,Pj as ge,Pk as ao,Pl as Et,MK as Tt,uB as Ca,Pm as no,Pn as oo,Po as so,Pp as Pt,uR as ro,Pq as io,we as Qt,uA as ka,Pr as be,Ps as co,bs as _a,wK as Sa,Pt as lo,Pu as uo,Pv as mo,Pw as wt,wF as po,Px as ho,wd as Ht,wJ as ya,Py as Ce,Pz as fo,PA as go,PB as va,kv as Aa,on as Ia,kA as Ea,ol as Ta,ok as Pa,oj as wa,tZ as bo,PC as Co,cU as ko,cV as _o,og as So,fU as yo,ox as vo,GX as dt,GP as Ao,GT as Io,PD as Eo,PE as To,PF as Po,b5 as et,fM as wo,hQ as xo,gn as Do,or as Fo,k2 as Oo,oo as Ro,om as Bo,fG as jo,fE as Mo}from"./zeni-epic-state-CO3_FacC.js";import{z as M,a4 as te,r as w,f as T,O as q,a_ as Lo,a0 as Ge,C as Ve,a$ as xa,h as N,b0 as Uo,e as _e,b1 as Da,A as Se,d as B,y as Go,b2 as Vo,b3 as No,Z as Fa,K as Oa,a as Ra,$ as Yo,b4 as $o,X as zo,aS as Ba,a1 as se,b5 as ja,b6 as Ma,a3 as La,b7 as Ko,b8 as qo,c as Zo,ar as Qo,p as Ho,_ as Wo,b9 as Xo,ba as Jo,bb as es,bc as ts,bd as ke}from"./index-A9TSx6IP.js";import{n as xt}from"./mui-CZj-zMWV.js";import{a as b}from"./sentry-DT80za28.js";import{w as Ua}from"./withTransactionSidePanel-DKi_i4iZ.js";import{c as Ga,t as De,f as ue,a as Dt,v as as}from"./routePaths-CsP6Ffie.js";import{u as ae}from"./useAskAiCfoHostNavButtonProps-CpfOq769.js";import je from"./NotFoundScreen-B9IlcCjB.js";import{u as Ft}from"./useInitialThreadRequest-Dt_bRaHc.js";import{t as Va}from"./analyticsHelper-BlJN3smJ.js";import{C as ns}from"./CompanyPassportScreen-DSK81yql.js";import{u as os}from"./useAiCfoDashboardSuggestedQuestionsChips-DBOgNEAN.js";import{F as ss}from"./FeaturePreviewScreen-CqdV6Bc4.js";import"./recharts-DNj0j956.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";import"./TransactionDetailScreen-lkVHlxIe.js";import"./decodeURIComponentSafe-IgzW2Epz.js";import"./MobileAppDrawer-N86gBmzN.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]="4993d682-a7b8-483c-bf2e-9a670287a638",e._sentryDebugIdIdentifier="sentry-dbid-4993d682-a7b8-483c-bf2e-9a670287a638")}catch{}})();const rs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((I=>I.tenantState.currentTenantId)),c=_((I=>U(I))),{tenantEmailDomain:m}=K(),g=H(),C=c?.companyName??"",u={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},l=b.useMemo((()=>({authParams:u,companyName:C,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()})),[]),h=b.useMemo((()=>r!=null?ia(r):Pe()),[r]),p=$(),f=W(),S=_((I=>Fn(I,h,o))),E=b.useCallback((()=>{o!=null&&S.fetchState!=="In-Progress"&&S.fetchState!=="Completed"&&p(On(o,h))}),[h]),v=b.useCallback((()=>{f("../../",{relative:"path"})}),[]),k=b.useCallback(((I,L)=>{p(Kt({sortKey:I,sortOrder:L}))}),[]),P=b.useCallback((I=>{p(Kt({downloadState:I}))}),[]),x=b.useCallback((I=>{if(e)e(I.transactionId,I.transactionType);else if(m!=null){const L=Ga({id:I.transactionId,type:I.transactionType},m);f(L);const ne=w(g.state?.pathnameStackToGoBack,g.pathname);f(L,{state:{pathnameStackToGoBack:ne}})}}),[m,e]),y=b.useCallback((()=>{S.vendor!=null&&T.trackApAgingDetail("AP Aging",h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),S.vendor.id,S.vendor.name)}),[S.vendor,h]);return b.useEffect((()=>{E()}),[]),b.useEffect((()=>{S.fetchState==="Completed"&&y()}),[y,S.fetchState]),d.jsx(Lo,{apAgingDetail:S,downloadParams:l,reportDate:h,analytics:T,onTransactionClick:x,onReload:E,onBackClick:v,onColumnSortConfigChanged:k,updateDownloadStateHandler:P,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),is=()=>{const e=$(),a=W(),t=_((k=>Rn(k))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AP Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((k=>k.tenantState.currentTenantId)),i=_((k=>U(k))),c=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},g=b.useMemo((()=>({authParams:m,companyName:c,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),C=t.apAgingUIState.selectedDate??Pe(),u=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(Ct(C))}),[]);b.useEffect((()=>{u()}),[]);const l=b.useCallback((()=>{a("../",{relative:"path"})}),[]),h=b.useCallback((k=>{e(Ze({searchString:k}))}),[]),p=b.useCallback(((k,P)=>{e(Ze({sortKey:P,sortOrder:k}))}),[]),f=b.useCallback((k=>{a(`./${k}/${C.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[C]),S=b.useCallback((k=>{e(Ze({downloadState:k}))}),[]),E=b.useCallback(((k,P)=>{}),[]),v=b.useCallback(((k,P)=>{e(Ze({selectedDate:k,agingDateSelectionType:P})),e(Ct(k))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(xa,{uiState:t.apAgingUIState,report:t,downloadParams:g,analytics:T,onReloadReport:u,onBackClick:l,onSearchTextChange:h,onSortOrderChange:p,onEntityNameClick:f,updateDownloadStateHandler:S,onSelectedDateChanged:v,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},cs=Ua((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=M.getSignedInUser(),i=_((y=>U(y))),{tenantEmailDomain:c}=K(),m=H(),g=i.companyName,C={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},u=b.useMemo((()=>({authParams:C,companyName:g,downloadEndPoint:`${te}/agingDetailedReport`,timezone:We()})),[]),l=b.useMemo((()=>r!=null?ia(r):Pe()),[r]),h=$(),p=W(),f=_((y=>Bn(y,l,o))),S=b.useCallback((()=>{o!=null&&f.fetchState!=="In-Progress"&&f.fetchState!=="Completed"&&h(jn(o,l))}),[l]),E=b.useCallback((()=>{p("../../",{relative:"path"})}),[]),v=b.useCallback(((y,I)=>{h(qt({sortKey:y,sortOrder:I}))}),[]),k=b.useCallback((y=>{h(qt({downloadState:y}))}),[]),P=b.useCallback((y=>{if(e)e(y.transactionId,y.transactionType);else if(c!=null){const I=Ga({id:y.transactionId,type:y.transactionType},c);p(I);const L=w(m.state?.pathnameStackToGoBack,m.pathname);p(I,{state:{pathnameStackToGoBack:L}})}}),[c,e]),x=b.useCallback((()=>{f.customer!=null&&T.trackArAgingDetail("AR Aging",l.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),f.customer.id,f.customer.name)}),[f.customer,l]);return b.useEffect((()=>{S()}),[]),b.useEffect((()=>{f.fetchState==="Completed"&&x()}),[f.fetchState,x]),d.jsx(Uo,{arAgingDetail:f,downloadParams:u,reportDate:l,analytics:T,onTransactionClick:P,onReload:S,onBackClick:E,onColumnSortConfigChanged:v,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=W(),t=_((v=>Mn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=ae({mobileExploreReferrer:"AR Aging"});Ge({isDataReady:t.fetchState==="Completed"});const r=M.getSignedInUser(),s=_((v=>U(v))),i=s.companyName,c={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:c,companyName:i,downloadEndPoint:`${te}/agingReport`,timezone:We()})),[]),g=t.arAgingUIState.selectedDate??Pe(),C=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(kt(g))}),[]);b.useEffect((()=>{C()}),[]);const u=b.useCallback((()=>{a("../",{relative:"path"})}),[]),l=b.useCallback((v=>{e(Qe({searchString:v}))}),[]),h=b.useCallback(((v,k)=>{e(Qe({sortKey:k,sortOrder:v}))}),[]),p=b.useCallback((v=>{a(`./${v}/${g.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[g]),f=b.useCallback((v=>{e(Qe({downloadState:v}))}),[]),S=b.useCallback(((v,k)=>{e(Qe({selectedDate:v,agingDateSelectionType:k})),e(kt(v))}),[]),E=b.useCallback(((v,k)=>{e(Ln({nodeId:v,isCollapsed:k}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ve,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(xa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:C,onBackClick:u,onSearchTextChange:l,onSortOrderChange:h,onEntityNameClick:p,updateDownloadStateHandler:f,onSelectedDateChanged:S,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Na=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Ya(e,a){const t=Vn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=De(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Nn(n,o))},onPromoCardBtnClick:n=>{if(a.isZeniAccountsAdmin){let o=`../../checking/${n}`;n?T.trackZeniAccountsCashBalancePromoClicked("Move Money"):(T.trackZeniAccountsCashBalancePromoClicked("Sign Up for Free"),o="../../checking/promo");const r=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(o,{state:{pathnameStackToGoBack:r}})}else T.trackZeniAccountsCashBalancePromoClicked("Learn More"),window.open("https://www.zeni.ai/product/business-checking-accounts","_blank")}}}const ds=ee((function(e){const a=Un(e).accountsInOrder.map(((n,o)=>Na(n,o))),t=Gn(e);return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,zeniAccountsPromoCardReport:t,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Ya)(Da),us=ee((function(e){const a=Yn(e).accountsInOrder.map(((o,r)=>Na(o,r))),t=M.getSignedInUser(),n=Xe(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Ya)(Da);function ms(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1)),r=yt(n?.loggedInUserRoleMap);return _((s=>s.cashBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(ds,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,isZeniAccountsAdmin:r,firstMonthOfFY:o})}function ps(){const e=W(),a=H(),{tenantEmailDomain:t}=K(),n=_e(),o=yt(n?.loggedInUserRoleMap),r=_((s=>U(s).company?.companyInfo.firstMonthOfFY??1));return _((s=>s.cardBalanceState.fetchState))==="Error"?d.jsx(je,{}):d.jsx(us,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,isZeniAccountsAdmin:o,firstMonthOfFY:r})}const hs=xt.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex: 1 1 auto;
|
|
4
4
|
min-height: 100%;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
background-color: ${e=>e.theme.colors.grey4};
|
|
7
|
-
`,fs=
|
|
7
|
+
`,fs=xt.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
flex: 1 1 auto;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
align-items: center;
|
|
12
12
|
background-color: ${e=>e.theme.colors.grey4};
|
|
13
|
-
`;function gs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=W(),i=$(),c=H(),{tenantEmailDomain:m}=K(),g=Go();return d.jsxs(hs,{children:[d.jsx(Vo,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:g.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:C=>{C.trim().length>=2?i(le({searchString:C,searchOrigin:"navbar"})):C.trim().length===0&&i(J("navbar"))},onAutoCompleteEntity:C=>{n!=null&&P?.trackSearch(Y.Event.search,bs(a),C.type,C.name,n);const u=ue(C,m),l=w(c.state?.pathnameStackToGoBack,c.pathname);s(u,{state:{pathnameStackToGoBack:l}})}}},rightSideComponent:d.jsx(Yo,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(fs,{children:a==="cash_balance"?d.jsx(ms,{}):d.jsx(ps,{})})]})}function Wt(){const e=H(),a=$(),{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isDepositAccountsFeatureEnabled),o=_((p=>p.cashBalanceState.fetchState)),r=_((p=>p.cardBalanceState.fetchState)),s=M.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=ca((p=>{const f=la(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}=ae({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});Ge({isDataReady:c==="Completed"});const l=_((p=>p.entityAutoCompleteState.autoCompleteText.navbar)),h=_((p=>ce(p,"navbar")));return b.useEffect((()=>{c==="Not-Started"&&(function(p,f,S){switch(f){case"card_balance":p(ma());break;case"cash_balance":p(da()),S===!0&&p(ua());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(Ve,{analytics:P,onLoad:p=>((f,S)=>{switch(S){case"card_balance":f.trackPageLoaded(Y.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(Y.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${S}!`)}})(p,i)}):null,d.jsx(gs,{title:m,reportId:i,autoCompleteText:l,entityAutoCompleteView:h,isAiCfoAccessEnabled:C,onAskAiCfoClick:u})]})}const bs=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Cs=[];function Ye(e){const{mobileExploreReferrer:a}=e,t=$(),n=W(),o=H(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=Fa(),c=Oa(),m=La(c),g=ra(),C=_((O=>O.tenantState.fetchState==="Completed"||O.tenantState.activeTenantFetchState.fetchState==="Completed"?U(O):void 0)),u=C?.masterTOSInfo?.isMasterTOSAccepted??!1,l=_((O=>pa(O))),h=l.uiState?.currentChatSessionId,p=l.allSessionsWithOrderedQuestionAnswers??Cs,f=M.getSignedInUser()?.userId,S=Ra(),E=No()&&S&&r!=null,v=$o(),k=zo(!0),T=_((O=>v!=null?$n(O,v):void 0)),{useDynamicConfig:D}=Se(),{configValue:y}=D(Ba.aiCfoMessageDynamicConfig),I=b.useMemo((()=>Array.isArray(y.default_message_list)?y.default_message_list:[]),[y.default_message_list]),L=b.useMemo((()=>I.slice(0,2)),[I]),ne=v!=null&&T!=null&&T.fetchState!=="Completed"&&T.fetchState!=="Error"&&(k||T.fetchState==="In-Progress"),$e=b.useMemo((()=>{if(v==null||T?.fetchState==="Error")return L;if(ne)return[];const O=(T?.suggestedQuestions??[]).map((oe=>oe.trim())).filter((oe=>oe.length>0)).slice(0,2);return O.length===0?L:O}),[L,ne,v,T?.fetchState,T?.suggestedQuestions]),me=b.useCallback(((O,oe)=>{if(f==null||O.trim()==="")return;if(!u)return void se({location:o,navigate:n,mergeState:{referrer:a}});const Ke=ja(g.getState());if(m){const qe=w(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:qe,referrer:a,aiCfoInitialQuestion:O,aiCfoShouldSubmit:!Ke}})}else{if(Ke)return t(_t(O)),void s(!0);i(O),s(!0),Ma(t,O,"insights_section",h,p,f,oe,void 0)}}),[p,h,t,u,m,o,a,n,s,i,g,r,f]),ze=b.useCallback((()=>{if(u)if(m){const O=w(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:ne,onAskSomethingElseClick:ze,onSuggestedQuestionClick:me,suggestedQuestions:$e}}),[E,ne,ze,me,$e])}const Ne=Ko,ks=ee((function(e){const a=zn(e),t=Kn(e),n=ha(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:P,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(qn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Fe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(we("month")),e(de(a.firstMonthOfFY,t)),e(Fe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Fe({resetLeftScroll:!0}))),50)},onElementCollapseStateChanged:(t,n)=>{e(Fe({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Fe({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}}))(Ne),_s=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashInCashOut"}),s=Ye({mobileExploreReferrer:"DashboardCashInCashOut"}),i=_((c=>ha(c))).mode==="compare_mode";return d.jsx(ks,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Ss=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},ys=ee((function(e){const a=Zn(e),t=Qn(e),n=fa(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_position,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:P,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(Hn(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(Oe({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Oe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Oe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Oe({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ss(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=xe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Oe({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}}))(Ne),vs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashPosition"}),s=Ye({mobileExploreReferrer:"DashboardCashPosition"}),i=_((c=>fa(c))).mode==="compare_mode";return d.jsx(ys,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},N=(e,a,t,n)=>{e===!1?a!=null&&n("../../",{relative:"path"}):a!=t&&(a!=null&&a.length>0?n(`../${t}`,{replace:!0}):n(`./forecast/${t}`,{replace:!0}))};function ut(){return d.jsxs(bt,{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(je,{})})]})}const As=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Is=ee((function(e){const a=ga(e),t=Wn(e),n=Xn(e),o=Jn(e),r=vt(e),{scrollPosition:s,...i}=r,c=t.reportTitle,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:P,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(ao(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=As(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):xe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ge({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Pe:Ot,n)),t==="forecast_mode"?(e(Zt({viewMode:"account_group"})),e(ba(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!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(to({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(eo())},onResyncReports:()=>{e(It("net_burn_or_income_by_classes"))}}}))(Ne),Es=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),c=Ye({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=_((y=>vt(y))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((y=>Et(y.forecastState,u??""))),h=_((y=>ga(y))),p=_((y=>Pt(y))),f=_((y=>De(y))),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect((()=>{if(u!=null&&g===!0&&(N(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=E!=null&&y.endDate.isAfter(E?.endDate)===!0?E:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}}),[u]);const v=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:T}=k(B.isReportsCommentingEnabled),D=Ft(T?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Is,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,analytics:P,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:D,isReportsCommentingEnabled:T})},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}},Ts=ee((function(e){const a=Ca(e),t=no(e),n=oo(e),o=so(e),r=Tt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.operating_expenses,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:P,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(co(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(be({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!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}=Ps(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):xe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Pe:Ot,n)),t=="forecast_mode"?(e(Qt({viewMode:"account_group"})),e(ka(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Qt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(io({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(ro())},onResyncReports:()=>{e(It("operating_expenses_by_classes"))}}}))(Ne),ws=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardOpEx"}),c=Ye({mobileExploreReferrer:"DashboardOpEx"}),m=_((I=>Tt(I))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((I=>Et(I.forecastState,u??""))),h=_((I=>Ca(I))),p=_((I=>Pt(I))),f=_((I=>De(I))),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect((()=>{if(u!=null&&g===!0&&(N(g,r,u,o),l!=null)){const I=l?.forecastPeriod,L=E!=null&&I.endDate.isAfter(E?.endDate)===!0?E:I;a(de(e.firstMonthOfFY,{startDate:L.endDate.startOf(C),endDate:L?.endDate}))}}),[u]);const v=_e(),k=v?.loggedInUserRole!=null&&_a(v?.loggedInUserRole)!==!0,{useFeatureGate:T}=Se(),{isFeatureEnabled:D}=T(B.isReportsCommentingEnabled),y=Ft(D?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Ts,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,forecastIdFromUrlPath:r,analytics:P,hasTransactionAccess:k,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:y,isReportsCommentingEnabled:D})},Ds=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},xs=ee((function(e){const a=Sa(e),t=lo(e),n=uo(e),o=mo(e),r=wt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.revenue,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:P,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:De(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(fo(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&N(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ds(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):xe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Ce({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Pe:Ot,n)),t==="forecast_mode"?(e(Ht({viewMode:"account_group"})),e(ya(!1,n?.id)),n!=null&&N(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):N(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Ht({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(ho({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(po())},onResyncReports:()=>{e(It("revenue_by_classes"))}}}))(Ne),Fs=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardRevenue"}),c=Ye({mobileExploreReferrer:"DashboardRevenue"}),m=_((y=>wt(y))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((y=>Et(y.forecastState,u??""))),h=_((y=>Sa(y))),p=h.dataAvailable,f=m.mode==="compare_mode",S=_((y=>De(y))),E=_((y=>Pt(y)));b.useEffect((()=>{if(u!=null&&g===!0&&(N(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=p!=null&&y.endDate.isAfter(p?.endDate)===!0?p:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}}),[u]);const v=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:T}=k(B.isReportsCommentingEnabled),D=Ft(T?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(xs,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:S,isCompareModeOn:f,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:P,reportsResyncFetchState:E.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:D,isReportsCommentingEnabled:T})},Os=e=>{let a,t;if(e.endDate!=null)switch(e.timePeriod){case"this_month_to_date":case"last_month":case"this_week_to_date":case"last_week":a="month",t={startDate:e.endDate.startOf("month"),endDate:e.endDate};break;case"last_3_months":case"last_6_months":case"last_12_months":case"this_year_to_date":case"last_year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;default:console.error(`this timeperiod ${e.timePeriod} is not supported!`)}return{timeframe:a,timePeriod:t}},Rs=ee((function(e){const a=go(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ce(e,"navbar");return{report:a,analytics:P,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}}),(function(e,a){return{onTimeframeSelectionChanged:t=>{P.trackTimeframeSwitch(Va(t),"Top Expenses"),e(va(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Os(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=xe(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}}))(qo),Bs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return d.jsx(Rs,{tenantEmailDomain:a,location:t,navigate:n})},js=Dt.div`
|
|
13
|
+
`;function gs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=W(),i=$(),c=H(),{tenantEmailDomain:m}=K(),g=Go();return d.jsxs(hs,{children:[d.jsx(Vo,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:g.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:C=>{C.trim().length>=2?i(le({searchString:C,searchOrigin:"navbar"})):C.trim().length===0&&i(J("navbar"))},onAutoCompleteEntity:C=>{n!=null&&T?.trackSearch(N.Event.search,bs(a),C.type,C.name,n);const u=ue(C,m),l=w(c.state?.pathnameStackToGoBack,c.pathname);s(u,{state:{pathnameStackToGoBack:l}})}}},rightSideComponent:d.jsx(No,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(fs,{children:a==="cash_balance"?d.jsx(ms,{}):d.jsx(ps,{})})]})}function Wt(){const e=H(),a=$(),{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isDepositAccountsFeatureEnabled),o=_((p=>p.cashBalanceState.fetchState)),r=_((p=>p.cardBalanceState.fetchState)),s=M.getSignedInUser();if(s==null)throw Error("Can't access dashboard detail without signing in...");const i=ca((p=>{const f=la(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}=ae({mobileExploreReferrer:i==="card_balance"?"Card Balance":"Cash Balance"});Ge({isDataReady:c==="Completed"});const l=_((p=>p.entityAutoCompleteState.autoCompleteText.navbar)),h=_((p=>ce(p,"navbar")));return b.useEffect((()=>{c==="Not-Started"&&(function(p,f,S){switch(f){case"card_balance":p(ma());break;case"cash_balance":p(da()),S===!0&&p(ua());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(Ve,{analytics:T,onLoad:p=>((f,S)=>{switch(S){case"card_balance":f.trackPageLoaded(N.Event.cardBalance);break;case"cash_balance":f.trackPageLoaded(N.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${S}!`)}})(p,i)}):null,d.jsx(gs,{title:m,reportId:i,autoCompleteText:l,entityAutoCompleteView:h,isAiCfoAccessEnabled:C,onAskAiCfoClick:u})]})}const bs=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},Cs=[];function Ne(e){const{mobileExploreReferrer:a}=e,t=$(),n=W(),o=H(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=Fa(),c=Oa(),m=La(c),g=ra(),C=_((O=>O.tenantState.fetchState==="Completed"||O.tenantState.activeTenantFetchState.fetchState==="Completed"?U(O):void 0)),u=C?.masterTOSInfo?.isMasterTOSAccepted??!1,l=_((O=>pa(O))),h=l.uiState?.currentChatSessionId,p=l.allSessionsWithOrderedQuestionAnswers??Cs,f=M.getSignedInUser()?.userId,S=Ra(),E=Yo()&&S&&r!=null,v=$o(),k=zo(!0),P=_((O=>v!=null?$n(O,v):void 0)),{useDynamicConfig:x}=Se(),{configValue:y}=x(Ba.aiCfoMessageDynamicConfig),I=b.useMemo((()=>Array.isArray(y.default_message_list)?y.default_message_list:[]),[y.default_message_list]),L=b.useMemo((()=>I.slice(0,2)),[I]),ne=v!=null&&P!=null&&P.fetchState!=="Completed"&&P.fetchState!=="Error"&&(k||P.fetchState==="In-Progress"),$e=b.useMemo((()=>{if(v==null||P?.fetchState==="Error")return L;if(ne)return[];const O=(P?.suggestedQuestions??[]).map((oe=>oe.trim())).filter((oe=>oe.length>0)).slice(0,2);return O.length===0?L:O}),[L,ne,v,P?.fetchState,P?.suggestedQuestions]),me=b.useCallback(((O,oe)=>{if(f==null||O.trim()==="")return;if(!u)return void se({location:o,navigate:n,mergeState:{referrer:a}});const Ke=ja(g.getState());if(m){const qe=w(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:qe,referrer:a,aiCfoInitialQuestion:O,aiCfoShouldSubmit:!Ke}})}else{if(Ke)return t(_t(O)),void s(!0);i(O),s(!0),Ma(t,O,"insights_section",h,p,f,oe,void 0)}}),[p,h,t,u,m,o,a,n,s,i,g,r,f]),ze=b.useCallback((()=>{if(u)if(m){const O=w(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:ne,onAskSomethingElseClick:ze,onSuggestedQuestionClick:me,suggestedQuestions:$e}}),[E,ne,ze,me,$e])}const Ye=Ko,ks=ee((function(e){const a=zn(e),t=Kn(e),n=ha(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(qn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Fe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(we("month")),e(de(a.firstMonthOfFY,t)),e(Fe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Fe({resetLeftScroll:!0}))),50)},onElementCollapseStateChanged:(t,n)=>{e(Fe({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Fe({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}}))(Ye),_s=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashInCashOut"}),s=Ne({mobileExploreReferrer:"DashboardCashInCashOut"}),i=_((c=>ha(c))).mode==="compare_mode";return d.jsx(ks,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Ss=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},ys=ee((function(e){const a=Zn(e),t=Qn(e),n=fa(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_position,i=M.getSignedInUser(),c=e.tenantState.currentTenantId,m=U(e),g=m?.companyName??"",C={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:c??""},u=e.entityAutoCompleteState.autoCompleteText.navbar,l=ce(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:g,statementEndPoint:`${te}/statement`,authParams:C},analytics:T,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:l}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(Hn(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(Oe({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Oe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Oe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Oe({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Ss(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=De(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Oe({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}}))(Ye),vs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r}=ae({mobileExploreReferrer:"DashboardCashPosition"}),s=Ne({mobileExploreReferrer:"DashboardCashPosition"}),i=_((c=>fa(c))).mode==="compare_mode";return d.jsx(ys,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:i,navigate:n,insightsSectionAiCfoInfo:s,isAiCfoAccessEnabled:o,onAskAiCfoClick:r})},Y=(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 ut(){return d.jsxs(bt,{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(je,{})})]})}const As=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Is=ee((function(e){const a=ga(e),t=Wn(e),n=Xn(e),o=Jn(e),r=vt(e),{scrollPosition:s,...i}=r,c=t.reportTitle,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:xe(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(ao(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&Y(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=As(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Dt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):De(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(ge({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t==="forecast_mode"?(e(Zt({viewMode:"account_group"})),e(ba(!1,n?.id)),n!=null&&Y(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):Y(!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(to({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(eo())},onResyncReports:()=>{e(It("net_burn_or_income_by_classes"))}}}))(Ye),Es=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),c=Ne({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=_((y=>vt(y))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((y=>Et(y.forecastState,u??""))),h=_((y=>ga(y))),p=_((y=>Tt(y))),f=_((y=>xe(y))),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect((()=>{if(u!=null&&g===!0&&(Y(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=E!=null&&y.endDate.isAfter(E?.endDate)===!0?E:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}}),[u]);const v=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:P}=k(B.isReportsCommentingEnabled),x=Ft(P?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Is,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,analytics:T,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:x,isReportsCommentingEnabled:P})},Ts=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=Je(e);break;case"year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;case"free_range":console.error("free_range timeframe is not supported!")}return{timeframe:a,timePeriod:t}},Ps=ee((function(e){const a=Ca(e),t=no(e),n=oo(e),o=so(e),r=Pt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.operating_expenses,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:xe(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(co(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(be({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&Y(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(be({resetLeftScroll:!0}))),50)},onAccountBalanceClick:a.hasTransactionAccess!==!0?void 0:(t,n)=>{const{timePeriod:o,timeframe:r}=Ts(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Dt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):De(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(be({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t=="forecast_mode"?(e(Qt({viewMode:"account_group"})),e(ka(!1,n?.id)),n!=null&&Y(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):Y(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Operating Expenses"),e(Qt({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(io({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(ro())},onResyncReports:()=>{e(It("operating_expenses_by_classes"))}}}))(Ye),ws=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardOpEx"}),c=Ne({mobileExploreReferrer:"DashboardOpEx"}),m=_((I=>Pt(I))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((I=>Et(I.forecastState,u??""))),h=_((I=>Ca(I))),p=_((I=>Tt(I))),f=_((I=>xe(I))),S=m.mode==="compare_mode",E=h.dataAvailable;b.useEffect((()=>{if(u!=null&&g===!0&&(Y(g,r,u,o),l!=null)){const I=l?.forecastPeriod,L=E!=null&&I.endDate.isAfter(E?.endDate)===!0?E:I;a(de(e.firstMonthOfFY,{startDate:L.endDate.startOf(C),endDate:L?.endDate}))}}),[u]);const v=_e(),k=v?.loggedInUserRole!=null&&_a(v?.loggedInUserRole)!==!0,{useFeatureGate:P}=Se(),{isFeatureEnabled:x}=P(B.isReportsCommentingEnabled),y=Ft(x?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Ps,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:f,isCompareModeOn:S,navigate:o,forecastIdFromUrlPath:r,analytics:T,hasTransactionAccess:k,reportsResyncFetchState:p.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:y,isReportsCommentingEnabled:x})},xs=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}},Ds=ee((function(e){const a=Sa(e),t=lo(e),n=uo(e),o=mo(e),r=wt(e),{scrollPosition:s,...i}=r,c=q.getLocalizedStrings().reportTitleById.revenue,m=M.getSignedInUser(),g=e.tenantState.currentTenantId,C=U(e),u=C?.companyName??"",l={userId:m?.userId??"",sessionId:m?.zeniSessionId??"",tenantId:g??""},h=e.entityAutoCompleteState.autoCompleteText.navbar,p=ce(e,"navbar"),f=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:`${te}/statement`,authParams:l},analytics:T,isZeniUser:Xe(m),autoCompleteData:{autoCompleteText:h,entityAutoCompleteView:p},isZeniCOAUsed:f,isAccountingClassesEnabled:xe(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(fo(t))},onTimeframeSelectionChanged:t=>{e(we(t)),setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Ue(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(de(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Me(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Le(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&Y(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=xs(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.classesViewParentId!=null&&t.classesViewParentId.parentClassId!=null?Dt(a.tenantEmailDomain,t.accountId,t.accountType,t.classesViewParentId.parentClassId?.[0],s,r,o):De(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Ce({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ee(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?Te:Ot,n)),t==="forecast_mode"?(e(Ht({viewMode:"account_group"})),e(ya(!1,n?.id)),n!=null&&Y(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):Y(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":"Accounts","Revenues"),e(Ht({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(ho({classesToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(po())},onResyncReports:()=>{e(It("revenue_by_classes"))}}}))(Ye),Fs=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,{isAiCfoAccessEnabled:s,onAskAiCfoClick:i}=ae({mobileExploreReferrer:"DashboardRevenue"}),c=Ne({mobileExploreReferrer:"DashboardRevenue"}),m=_((y=>wt(y))),g=m.isForecastModeOn,C=m.timeframe,u=m.selectedForecast?.id,l=_((y=>Et(y.forecastState,u??""))),h=_((y=>Sa(y))),p=h.dataAvailable,f=m.mode==="compare_mode",S=_((y=>xe(y))),E=_((y=>Tt(y)));b.useEffect((()=>{if(u!=null&&g===!0&&(Y(g,r,u,o),l!=null)){const y=l?.forecastPeriod,I=p!=null&&y.endDate.isAfter(p?.endDate)===!0?p:y;a(de(e.firstMonthOfFY,{startDate:I.endDate.startOf(C),endDate:I?.endDate}))}}),[u]);const v=_e(),{useFeatureGate:k}=Se(),{isFeatureEnabled:P}=k(B.isReportsCommentingEnabled),x=Ft(P?v?.currentTenant?.companyId:void 0,{clearParams:h.fetchState==="Completed"});return d.jsx(Ds,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:S,isCompareModeOn:f,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:T,reportsResyncFetchState:E.reportsResyncFetchState,insightsSectionAiCfoInfo:c,isAiCfoAccessEnabled:s,onAskAiCfoClick:i,initialOpenThreadRequest:x,isReportsCommentingEnabled:P})},Os=e=>{let a,t;if(e.endDate!=null)switch(e.timePeriod){case"this_month_to_date":case"last_month":case"this_week_to_date":case"last_week":a="month",t={startDate:e.endDate.startOf("month"),endDate:e.endDate};break;case"last_3_months":case"last_6_months":case"last_12_months":case"this_year_to_date":case"last_year":a="quarter",t={startDate:e.endDate.startOf("quarter"),endDate:e.endDate};break;default:console.error(`this timeperiod ${e.timePeriod} is not supported!`)}return{timeframe:a,timePeriod:t}},Rs=ee((function(e){const a=go(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=ce(e,"navbar");return{report:a,analytics:T,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}}),(function(e,a){return{onTimeframeSelectionChanged:t=>{T.trackTimeframeSwitch(Va(t),"Top Expenses"),e(va(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Os(n),s=t.accountName===""?t.accountDescription:t.accountName;if(o!=null&&r!=null){const i=De(a.tenantEmailDomain,t.accountId,t.accountType,s,r,o),c=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:c,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(le({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(J("navbar"))},onAutoCompleteEntity:t=>{const n=ue(t,a.tenantEmailDomain),o=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}}))(qo),Bs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e;return d.jsx(Rs,{tenantEmailDomain:a,location:t,navigate:n})},js=xt.div`
|
|
14
14
|
display: flex;
|
|
15
15
|
flex: 1 1 auto;
|
|
16
16
|
min-height: 100%;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
background-color: ${e=>e.theme.colors.grey5};
|
|
19
19
|
align-items: center;
|
|
20
|
-
`,Pe=3,Ot=1;function Ms({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=W(),r=H(),{tenantEmailDomain:s}=K();let i;Ge({isDataReady:!0});const c={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(ws,{...c});break;case"revenue":i=d.jsx(Fs,{...c});break;case"net_burn_or_income":i=d.jsx(Es,{...c});break;case"cash_position":i=d.jsx(vs,{...c});break;case"top_expenses":i=d.jsx(Bs,{...c});break;case"cash_in_cash_out":i=d.jsx(_s,{...c});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(js,{children:i}):null}function re(){const e=H(),a=$(),{forecastId:t}=K();let n="Not-Started";const o=_((l=>Tt(l).fetchState)),r=_((l=>wt(l).fetchState)),s=_((l=>vt(l).fetchState)),i=_((l=>l.cashPositionState.fetchState)),c=_((l=>l.topExState.fetchState)),m=_((l=>l.cashInCashOutState.fetchState));if(M.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const g=_((l=>U(l))),C=g?.company?.companyInfo?.firstMonthOfFY??1,u=ca((l=>{const h=la(l,"/").split("/");return t!=null?h[h.length-3]:h[h.length-1]})(e.pathname));switch(u){case"operating_expenses":n=o;break;case"revenue":n=r;break;case"net_burn_or_income":n=s;break;case"cash_position":n=i;break;case"top_expenses":n=c;break;case"cash_in_cash_out":n=m;break;default:console.error(`${u} is not supported!`)}return b.useEffect((()=>{n==="Not-Started"&&(function(l,h,p,f){switch(h){case"operating_expenses":l(wa(!0)),f!=null&&(l(Ee(p,!0,Pe,{id:f,index:0})),l(ka(!1,f)));break;case"revenue":l(Ta(!0)),f!=null&&(l(Ee(p,!0,Pe,{id:f,index:0})),l(ya(!1,f)));break;case"net_burn_or_income":l(Pa(!0)),f!=null&&(l(Ee(p,!0,Pe,{id:f,index:0})),l(ba(!1,f)));break;case"cash_position":l(Ea(!0));break;case"top_expenses":l(Ia());break;case"cash_in_cash_out":l(Aa());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(Ve,{analytics:P,onLoad:l=>((h,p)=>{const f=e.state?.referrer;switch(p){case"operating_expenses":h.trackPageLoaded(Y.Event.operatingExpenses,f);break;case"revenue":h.trackPageLoaded(Y.Event.revenues,f);break;case"net_burn_or_income":h.trackPageLoaded(Y.Event.burnRate,f);break;case"cash_position":h.trackPageLoaded(Y.Event.cashPosition,f);break;case"top_expenses":h.trackPageLoaded(Y.Event.topExpenses,f);break;case"cash_in_cash_out":h.trackPageLoaded(Y.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${p}!`)}})(l,u)}):null,d.jsx(Ms,{firstMonthOfFY:C,fetchState:n,reportId:u,forecastId:t})]})}var mt=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function pt(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),(function(){t(window.event)}))}function $a(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 za(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 Rt={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,"-":mt?173:189,"=":mt?61:187,";":mt?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},St={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},j={16:!1,18:!1,17:!1,91:!1},R={},He=1;He<20;He++)Rt["f".concat(He)]=111+He;var x=[],Xt=!1,Ka="all",Jt=[],tt=function(e){return Rt[e.toLowerCase()]||ie[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function ea(e){Ka=e||"all"}function Be(){return Ka||"all"}var ht=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;za(a).forEach((function(s){var i=s.split(r),c=i.length,m=i[c-1],g=m==="*"?"*":tt(m);if(R[g]){t||(t=Be());var C=c>1?$a(ie,i):[];R[g]=R[g].filter((function(u){return!((!n||u.method===n)&&u.scope===t&&(function(l,h){for(var p=l.length>=h.length?l:h,f=l.length>=h.length?h:l,S=!0,E=0;E<p.length;E++)f.indexOf(p[E])===-1&&(S=!1);return S})(u.mods,C))}))}}))};function ta(e,a,t,n){var o;if(a.element===n&&(a.scope===t||a.scope==="all")){for(var r in o=a.mods.length>0,j)Object.prototype.hasOwnProperty.call(j,r)&&(!j[r]&&a.mods.indexOf(+r)>-1||j[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||j[16]||j[18]||j[17]||j[91])&&!o&&a.shortcut!=="*"||a.method(e,a)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function aa(e,a){var t=R["*"],n=e.keyCode||e.which||e.charCode;if(G.filter.call(this,e)){if(n!==93&&n!==224||(n=91),x.indexOf(n)===-1&&n!==229&&x.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(h){var p=St[h];e[h]&&x.indexOf(p)===-1?x.push(p):!e[h]&&x.indexOf(p)>-1?x.splice(x.indexOf(p),1):h==="metaKey"&&e[h]&&x.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(x=x.slice(x.indexOf(p))))})),n in j){for(var o in j[n]=!0,ie)ie[o]===n&&(G[o]=!0);if(!t)return}for(var r in j)Object.prototype.hasOwnProperty.call(j,r)&&(j[r]=e[St[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(x.indexOf(17)===-1&&x.push(17),x.indexOf(18)===-1&&x.push(18),j[17]=!0,j[18]=!0);var s=Be();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)&&ta(e,t[i],s,a);if(n in R){for(var c=0;c<R[n].length;c++)if((e.type==="keydown"&&R[n][c].keydown||e.type==="keyup"&&R[n][c].keyup)&&R[n][c].key){for(var m=R[n][c],g=m.splitKey,C=m.key.split(g),u=[],l=0;l<C.length;l++)u.push(tt(C[l]));u.sort().join("")===x.sort().join("")&&ta(e,m,s,a)}}}}function G(e,a,t){x=[];var n=za(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=$a(ie,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in R||(R[e]=[]),R[e].push({keyup:c,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:g,element:s});s!==void 0&&!(function(u){return Jt.indexOf(u)>-1})(s)&&window&&(Jt.push(s),pt(s,"keydown",(function(u){aa(u,s)}),C),Xt||(Xt=!0,pt(window,"focus",(function(){x=[]}),C)),pt(s,"keyup",(function(u){aa(u,s),(function(l){var h=l.keyCode||l.which||l.charCode,p=x.indexOf(h);if(p>=0&&x.splice(p,1),l.key&&l.key.toLowerCase()==="meta"&&x.splice(0,x.length),h!==93&&h!==224||(h=91),h in j)for(var f in j[h]=!1,ie)ie[f]===h&&(G[f]=!1)})(u)}),C))}var ft={setScope:ea,getScope:Be,deleteScope:function(e,a){var t,n;for(var o in e||(e=Be()),R)if(Object.prototype.hasOwnProperty.call(R,o))for(t=R[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Be()===e&&ea(a||"all")},getPressedKeyCodes:function(){return x.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=tt(e)),x.indexOf(e)!==-1},filter:function(e){var a=e.target||e.srcElement,t=a.tagName,n=!0;return!a.isContentEditable&&(t!=="INPUT"&&t!=="TEXTAREA"&&t!=="SELECT"||a.readOnly)||(n=!1),n},trigger:function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(R).forEach((function(t){var n=R[t].find((function(o){return o.scope===a&&o.shortcut===e}));n&&n.method&&n.method()}))},unbind:function(e){if(e===void 0)Object.keys(R).forEach((function(s){return delete R[s]}));else if(Array.isArray(e))e.forEach((function(s){s.key&&ht(s)}));else if(typeof e=="object")e.key&&ht(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=""),ht({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Rt,modifier:ie,modifierMap:St};for(var gt in ft)Object.prototype.hasOwnProperty.call(ft,gt)&&(G[gt]=ft[gt]);if(typeof window<"u"){var Ls=window.hotkeys;G.noConflict=function(e){return e&&window.hotkeys===G&&(window.hotkeys=Ls),G},window.hotkeys=G}G.filter=function(){return!0};var na=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Us(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,c=o.keydown,m=o.filterPreventDefault,g=m===void 0||m,C=o.enabled,u=C===void 0||C,l=o.enableOnContentEditable,h=l!==void 0&&l,p=b.useRef(null),f=b.useCallback((function(S,E){var v,k;return s&&!s(S)?!g:!!(na(S,["INPUT","TEXTAREA","SELECT"])&&!na(S,r)||(v=S.target)!=null&&v.isContentEditable&&!h)||!!(p.current===null||document.activeElement===p.current||(k=p.current)!=null&&k.contains(document.activeElement))&&(a(S,E),!0)}),n?[p,r,s].concat(n):[p,r,s]);return b.useEffect((function(){if(u)return i&&c!==!0&&(t.keydown=!1),G(e,t||{},f),function(){return G.unbind(e,f)};G.unbind(e,f)}),[f,e,u]),p}G.isPressed;const Gs=[],oa="dashboard_card",X="ai_cfo_dashboard_card";function sa(e,a){return a?e.some((t=>String(t)===X))?e.slice():[X,...e]:e.filter((t=>String(t)!==X))}const Vs=["net_burn_or_income_story_card","cash_balance","task_card","card_balance","zeni_promo_card","insights_dashboard","information_card","company_details","bill_pay_promo_card","bill_pay_card","reimbursement_card","reimbursement_promo_card","zeni_accounts_promo_card","rewards_card","treasury_promo_card"],Ys=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e.status!=null?{balanceAmount:e.balance?.available,lastUpdatedTime:e.status.lastRefreshSuccessTime,changePercent:e.balance?.change?.percent,changeComparedToDate:e.balance?.change?.since}:void 0}),Re=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),Ns=(e,a,t,n)=>Re(void 0,e,ke,a,t),$s=(e,a,t,n,o)=>({card:{dimension:et(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1,spansFullDashboardWidth:!1},data:{funds:n,shouldShowTreasuryPromoIntroVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),zs=e=>{const a=et(ke);return a.height=ke.height+10,{card:{dimension:a,cardType:X,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ks=ee((function(e,a){const t=Qs(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:c,shouldShowTreasuryPromoIntroVideo:m,treasuryFetchState:g}=a;let C=n.map(((u,l)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return Ns(t,u,l);if(u==="zeni_promo_card")return Re({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,l);if(u==="treasury_promo_card")return $s(g,u,l,c,m);if(u==="information_card")return Re(void 0,"Completed",ke,u,l);if(u===X)return zs(l);{const h=o.find((p=>p?.reportId===u));return h?(function(p,f,S,E){const v=p.reportId;switch(v){case"card_balance":case"cash_balance":return[Ys(p,f,S,v,E)];case"expense_automation_card":case"operating_expenses":case"revenue":case"top_expenses":case"cash_position":case"cash_in_cash_out":case"insights_dashboard":case"company_details":case"task_card":case"bill_pay_card":case"reimbursement_card":case"net_burn_or_income":case"accounts_payable_aging":case"accounts_receivable_aging":case"zeni_accounts_promo_card":case"rewards_card":return[Re(p,f,S,v,E)];case"net_burn_or_income_story_card":return[Re(p,f,S,"net_burn_or_income_story_card",E)];default:return console.error(`card type ${v} not yet supported!`),[]}})(h,h.fetchState,ke,l):[]}})).flat();return a.isSummaryCardsFiltered===!0&&(C=C.filter((u=>Vs.includes(u.card.cardType)==0)).filter((u=>{const l=u.data?.availableNumberOfPeriods;return l!=null?l>0:u.card.cardType!="top_expenses"||u.data==null||(function(h){if(h==null||h.length===0)return!0;let p=!0;for(const f of h)if(f.balance.available.amount!==0){p=!1;break}return p})(u.data.topExpenses.accountsOrdered)===!1}))),{cardDataArray:C,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ce(e,"navbar")},analytics:P,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}}),(function(e,a){const t=a.tenantId,n=M.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)P.trackDashboardCardClicked("cards promo",2),P.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&&P.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(P.trackMonthEndCloseClicked(a.selectedPeriod.month,a.selectedPeriod.year,"Dashboard"),a.navigate("../../month_end_close_checks/review",{state:{referrer:"Dashboard"}})):a.navigate(`${r}`,{state:{referrer:s}})},onReloadData:(o,r)=>{const s=[];a.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),a.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),a.isZeniAccountEnabled===!1&&s.push("zeni_accounts_promo_card"),a.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),(function(i,c,m,g){if(c!==X)switch(c){case"card_balance":i(ma());break;case"cash_balance":i(da());break;case"operating_expenses":i(wa(!0));break;case"revenue":i(Ta(!0));break;case"net_burn_or_income":i(Pa(!0));break;case"net_burn_or_income_story_card":i(Bo(!0));break;case"cash_position":i(Ea(!0));break;case"top_expenses":i(Ia());break;case"cash_in_cash_out":i(Aa());break;case"insights_dashboard":i(Ro());break;case"bill_pay_card":i(Oo());break;case"reimbursement_card":i(Fo());break;case"company_details":i(xo(m));break;case"task_card":i(Do());break;case"accounts_payable_aging":g.includes("accounts_payable_aging")===!1&&i(Ct(Te()));break;case"accounts_receivable_aging":i(kt(Te()));break;case"zeni_accounts_promo_card":g.includes("zeni_accounts_promo_card")===!1&&i(ua());break;case"rewards_card":g.includes("rewards_card")===!1&&i(wo(!0));break;default:throw new Error(`report type ${c} is not yet supported`)}})(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{P.trackTimeframeSwitch(Va(r),Zs(o),"Dashboard"),(function(s,i,c){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(we(c));break;case"top_expenses":s(va(c));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}})(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(To(o))},onCategoryClick:(o,r,s)=>{o==="bill-pay"?a.navigate("../bills",{state:{tab:r,subTab:s},relative:"path"}):o==="reimbursement"?a.navigate("../reimbursements",{state:{tab:r,subTab:s},relative:"path"}):o==="uncategorized-account-mapping"?a.navigate("../settings/accounting",{relative:"path"}):o==="show-all-tasks"?a.navigate("../tasks",{relative:"path"}):a.navigate(`../../transactions/${o}`)},onCardBtnClick:(o,r)=>{if(o==="bill_pay_promo_card"){const s="../bills",i=w(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=w(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=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/business-checking-accounts","_blank");else if(o==="treasury_promo_card")if(a.isUserHasTreasuryAccess){M.saveTreasuryPopupSeen(a.tenantEmailDomain,!0);const s="../treasury",i=w(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"&&(P.trackUpdateBurnRateCalculatorSettings(r,s,Eo(s)),e(Po(t,r,s)))},onVideoPlay:()=>{e(dt())},onRemindMeLaterClick:()=>{e(Io())},onDontShowAgainClick:()=>{e(dt())},onIntroOutsideClick:()=>{a.isTreasuryPromoIntroClosedByOutsideClick===!0&&a.isTreasuryPromoVideoPlayed!==!0?e(dt()):e(Ao())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(le({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(J("navbar"))},onCancelAutoComplete:()=>{e(J("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ue(o,a.tenantEmailDomain):as(o.zeniId,o.qboId,a.tenantEmailDomain);const s=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}}))(ts);function qs(){const e=ra(),a=Oa(),t=La(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=Fa(),s=W(),i=$(),c=H(),m=M.getSignedInUser(),{useFeatureGate:g,useDynamicConfig:C}=Se(),[u,l]=b.useState(!1),[h,p]=b.useState(!1),f=Ra(),{tenantEmailDomain:S}=K(),{isAiCfoAccessEnabled:E,onAskAiCfoClick:v}=ae({mobileExploreReferrer:"Dashboard"}),k=_((A=>A.tenantState.fetchState==="Completed"||A.tenantState.activeTenantFetchState.fetchState==="Completed"?U(A):void 0)),T=k??M.getSignedInUserTenant(S),D=k?.masterTOSInfo?.isMasterTOSAccepted??!1,y=T.tenantId,I=T.companyId;b.useEffect((()=>{u===!1&&c.state?.message==="activation"&&(i(bo(I)),l(!0))}),[c.state,u,I,i]),b.useEffect((()=>{f&&!h&&c.state?.message==="open_ai_cfo_drawer"&&(p(!0),D?(o(!0),s({pathname:c.pathname,search:c.search,hash:c.hash},{replace:!0,state:{...c.state,message:void 0}})):se({location:c,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))}),[c,h,f,D,o,s]);const{isFeatureEnabled:L}=g(B.isApAgingFeatureEnabled),{isFeatureEnabled:ne}=g(B.isExpenseAutomationEnabled),{isFeatureEnabled:$e}=g(B.isExpenseAutomationEnabledV2),me=Zo(),{isFeatureEnabled:ze}=g(B.isTreasuryEnabled),O=Qo(me),{isFeatureEnabled:oe}=g(B.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=g(B.isDepositAccountsFeatureEnabled),{isFeatureEnabled:qe}=g(B.isReferralFeatureEnabled),{isFeatureEnabled:qa}=g(B.isChargeCardFeatureEnabled),{isFeatureEnabled:Za}=g(B.isAiCfoFileUploadEnabled),{isFeatureEnabled:Qa}=g(B.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Ha}=g(B.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Wa}=g(B.aiAuditScorePercentage),{configValue:Bt}=C(Ba.zeniCardsConfig),Xa=Bt.charge_card_cashback_rate_per_transaction==null?.0175:Bt.charge_card_cashback_rate_per_transaction;if(c.state?.message==="activation"){const A=Ho(c.state?.pathnameStackToGoBack);s(c.pathname,{state:{...c.state,message:void 0,pathnameStackToGoBack:A.newStack}})}const[jt,Ja]=b.useState(!1),[at,en]=b.useState(!1);Us("command+p, Control+p",(A=>{en(!at),A.preventDefault()}),{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const Mt=k?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const pe=_((A=>U(A)?.excludedResources)),tn=_((A=>A.expenseAutomationViewState.selectedPeriodByTenantId)),an=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,nn=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,on=_((A=>A.treasurySetupViewState.treasuryFundsDetails)).fetchStatus.fetchState,sn=k?.company!=null&&Co(k.company),rn=ze&&sn,nt=_e(),cn=yt(nt?.loggedInUserRoleMap),z=[],Lt=pe?.resources?.find((A=>A.resource==="/reports/top_expenses"))==null,ln=pe?.resources?.find((A=>A.resource==="/reports/task_card"))==null,ot=k?.userRole!=null&&_a(k?.userRole),dn=pe?.resources?.find((A=>A.resource==="/bills"))==null&&!ot,un=pe?.resources?.find((A=>A.resource==="/reimbursements"))==null,mn=ko(nt?.loggedInUserRoleMap),pn=_o(nt?.loggedInUserRoleMap),hn=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,fn=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,gn=_((A=>A.treasurySetupViewState.treasuryFundsDetails)).fundsDetails;Lt===!1&&z.push("top_expenses"),ln===!1&&z.push("task_card"),dn===!1&&z.push("bill_pay_card","bill_pay_promo_card"),L===!1&&z.push("accounts_payable_aging"),oe===!1&&z.push("accounts_receivable_aging"),(me===!1||ot)&&z.push("expense_automation_card"),un===!1&&z.push("reimbursement_card","reimbursement_promo_card"),z.push("zeni_accounts_promo_card","treasury_promo_card"),qe===!1&&z.push("rewards_card");const{areTenantIdsInSync:Ut}=Wo();b.useLayoutEffect((()=>{jt&&O===me||Mt!==!0||!Ut||pe?.fetchState!=="Completed"&&pe?.fetchState!=="Error"||(Ja(!0),i(So(m.userId,I,y,!0,!1,z)))}),[jt,m,y,i,Lt,Mt,pe?.fetchState,Ut]);const bn=_((A=>A.reportUIOptionsState.forecastOnDashboard.isForecastModeOn)),Cn=_((A=>A.revenueState.uiState.selectedForecast?.id)),kn=_((A=>A.cardBalanceState.fetchState)),he=_((A=>yo(A,z,m,$e,ne))),_n=he.fetchState,Sn=b.useMemo((()=>sa(he.cardsOrdered,E)),[he.cardsOrdered,E]),yn=b.useMemo((()=>sa(he.cardsForDashboardUI,E)),[he.cardsForDashboardUI,E]);Ge({isDataReady:!0});const{isSuggestedQuestionsLoading:vn,suggestedPromptQuestions:An}=os(),st=k?.isTreasuryPromoVideoPlayed===!0,Gt=k?.isTreasuryPromoVideoRemindMeLaterClicked===!0,Vt=k?.loginCounterForTreasuryPromoVideo??0,In=k?.isTreasuryPromoIntroClosedByOutsideClick===!0,Yt=_((A=>A.dashboardState.isTreasuryVideoClosed)),Nt=b.useMemo((()=>Xo({isTreasuryPromoVideoRemindMeLaterClicked:Gt,isTreasuryPromoVideoPlayed:st,loginCounterForTreasuryPromoVideo:Vt,isTreasuryVideoClosed:Yt})),[Gt,st,Vt,Yt]),$t=_((A=>pa(A))),ye=$t.uiState?.currentChatSessionId,rt=$t.allSessionsWithOrderedQuestionAnswers??Gs,{currentSessionQuestionAnswers:En}=Jo(rt,ye),zt=En.length===0,Pn=b.useCallback(((A,Z,fe)=>{const ve=m?.userId;if(ve==null)return;const V=A.trim();if(V.length===0&&Z.length===0)return;if(!D)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});const Q=ja(e.getState()),Ae=()=>{const Ie=w(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ie,referrer:"Dashboard",aiCfoInitialQuestion:V,aiCfoShouldSubmit:!Q&&V.length>0,aiCfoInitialSubmissionSource:oa,...typeof fe=="number"?{aiCfoSuggestionIndex:fe}:{}}})};return t?Z.length>0?void o(!0):void Ae():Z.length>0?Q?(i(_t(V)),void o(!0)):(r(V.length>0?V:null),o(!0),void(V.length>0&&Ma(i,V,oa,ye,rt,ve,fe,Z.length>0?Z:void 0))):(Q&&i(_t(V)),void Ae())}),[rt,ye,i,D,t,c,s,r,o,m?.userId,e,S]),Tn=b.useCallback((()=>{D?o(!0):se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})}),[D,c,s,o]),wn=b.useCallback((()=>{if(!D)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});if(S==null)return;const A=w(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{pathnameStackToGoBack:A,referrer:"Dashboard"}})}),[D,c,s,S]),Dn=b.useCallback((()=>{if(D)if(t){if(S==null||k==null)return;const A=ye==null||zt?`/${S}/ai-cfo/explore`:`/${S}/ai-cfo/${ye}`,Z=c.state?.pathnameStackToGoBack??[],fe=w(Z,c.pathname);s(A,{state:{...c.state,pathnameStackToGoBack:fe,[es]:!0}})}else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})}),[D,t,c,s,S,k,ye,zt]);return d.jsxs(d.Fragment,{children:[_n==="Completed"?d.jsx(Ve,{analytics:P,onLoad:A=>{A.trackPageLoaded(Y.Event.dashboard),rn&&Nt===!0&&A.trackTreasuryPromoView("Dashboard Promo Video")}}):null,d.jsx(Ks,{maxColumns:n?2:void 0,isAiCfoAccessEnabled:E,onAskAiCfoClick:v,onAiCfoDashboardOpenPanel:Tn,onAiCfoDashboardOpenScopePage:Dn,isAiCfoFileUploadEnabled:Za===!0&&t===!1,onAiCfoDashboardPromptSubmit:Pn,onAiCfoDashboardExpandToFullPage:wn,aiCfoDashboardSuggestedPromptQuestions:An,aiCfoDashboardSuggestedPromptQuestionsLoading:vn,onDragAndDropCard:(A,Z)=>{if(A===X||Z===X)return;const fe=(function(Q,Ae,Ie){const it=Ie.indexOf(Q),ct=Ie.indexOf(Ae);if(it===-1||ct===-1||it===ct)return Ie;const lt=[...Ie];return lt.splice(it,1),lt.splice(ct,0,Q),lt})(A,Z,Sn),ve=fe.filter((Q=>Q!==X)),V=he.cardsOrdered;(ve.length!==V.length||ve.some(((Q,Ae)=>Q!==V[Ae])))&&i(vo(ve))},dashboardReport:he,passedCardsOrdered:yn,tenantId:y,companyId:I,tenantEmailDomain:S,location:c,navigate:s,isApAgingFeatureEnabled:L,isArAgingFeatureEnabled:oe,isBillPayEnabled:nn,isReimbursementEnabled:an,isSummaryCardsFiltered:at,isForecastOn:bn,selectedForecastOnDashboard:Cn,isVisitingFirstTime:u,isZeniAccountEnabled:Ke,isRewardsFeatureEnabled:qe,hasZeniAccountsAdminAccess:cn,isExpenseAutomationEnabledForUser:me&&ot===!1,selectedPeriod:tn[y],isChargeCardFeatureEnabled:qa,isUserHasCardsAccess:mn,isUserHasTreasuryAccess:pn,cardsCreditLimit:hn,cashbackRate:Xa,isInterestedInChargeCard:fn,cardBalanceFetchState:kn,christmasAnimationEnabled:Qa,newYearAnimationEnabled:Ha,treasuryFundDetails:gn,shouldShowTreasuryPromoIntroVideo:Nt,isTreasuryPromoVideoPlayed:st,isTreasuryPromoIntroClosedByOutsideClick:In,treasuryFetchState:on,aiAuditScorePercentageEnabled:Wa})]})}const Zs=e=>{switch(e){case"operating_expenses":return"Operating Expenses";case"revenue":return"Revenues";case"top_expenses":return"Top Expenses";case"net_burn_or_income":return"Burn Rate";case"cash_in_cash_out":return"Cash In, Cash Out";case"cash_position":return"Cash Position"}return"Dashboard"},Qs=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map((a=>a.fetchState)).reduce(((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t));function vr(){const e=_e(),a=e?.excludedResources?.find((m=>m.resource==="/reports/top_expenses"))==null,{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(B.isArAgingFeatureEnabled),r=_((m=>U(m))),{isFeatureEnabled:s}=t(B.isDebitCardFeatureEnabled),i=jo(s,r),c=Mo(r);return i===!0||c===!0?d.jsx(bt,{children:d.jsx(F,{path:"/*",element:d.jsx(ss,{})})}):d.jsxs(bt,{children:[d.jsx(F,{path:"/",element:d.jsx(qs,{})}),d.jsx(F,{path:"cash_balance/*",element:d.jsx(Wt,{})}),d.jsx(F,{path:"card_balance/*",element:d.jsx(Wt,{})}),d.jsx(F,{path:"operating_expenses/*",element:d.jsx(re,{})}),d.jsx(F,{path:"operating_expenses/forecast/*",element:d.jsx(ut,{})}),d.jsx(F,{path:"revenue/forecast/*",element:d.jsx(ut,{})}),d.jsx(F,{path:"revenue/*",element:d.jsx(re,{})}),d.jsx(F,{path:"net_burn_or_income/forecast/*",element:d.jsx(ut,{})}),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(is,{})}),d.jsx(F,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(rs,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(F,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(cs,{})}),d.jsx(F,{path:"accounts_receivable_aging/*",element:d.jsx(ls,{})})]}),d.jsx(F,{path:"cash_position/*",element:d.jsx(re,{})}),d.jsx(F,{path:"top_expenses/*",element:a===!0?d.jsx(re,{}):d.jsx(je,{})}),d.jsx(F,{path:"cash_in_cash_out/*",element:d.jsx(re,{})}),d.jsx(F,{path:"company_details",element:d.jsx(ns,{})}),d.jsx(F,{path:"referrals/*",element:d.jsx(xn,{to:"../../rewards/refer",replace:!0})}),d.jsx(F,{path:"*",element:d.jsx(je,{})})]})}export{vr as default};
|
|
20
|
+
`,Te=3,Ot=1;function Ms({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=W(),r=H(),{tenantEmailDomain:s}=K();let i;Ge({isDataReady:!0});const c={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(ws,{...c});break;case"revenue":i=d.jsx(Fs,{...c});break;case"net_burn_or_income":i=d.jsx(Es,{...c});break;case"cash_position":i=d.jsx(vs,{...c});break;case"top_expenses":i=d.jsx(Bs,{...c});break;case"cash_in_cash_out":i=d.jsx(_s,{...c});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(js,{children:i}):null}function re(){const e=H(),a=$(),{forecastId:t}=K();let n="Not-Started";const o=_((l=>Pt(l).fetchState)),r=_((l=>wt(l).fetchState)),s=_((l=>vt(l).fetchState)),i=_((l=>l.cashPositionState.fetchState)),c=_((l=>l.topExState.fetchState)),m=_((l=>l.cashInCashOutState.fetchState));if(M.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const g=_((l=>U(l))),C=g?.company?.companyInfo?.firstMonthOfFY??1,u=ca((l=>{const h=la(l,"/").split("/");return t!=null?h[h.length-3]:h[h.length-1]})(e.pathname));switch(u){case"operating_expenses":n=o;break;case"revenue":n=r;break;case"net_burn_or_income":n=s;break;case"cash_position":n=i;break;case"top_expenses":n=c;break;case"cash_in_cash_out":n=m;break;default:console.error(`${u} is not supported!`)}return b.useEffect((()=>{n==="Not-Started"&&(function(l,h,p,f){switch(h){case"operating_expenses":l(wa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(ka(!1,f)));break;case"revenue":l(Pa(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(ya(!1,f)));break;case"net_burn_or_income":l(Ta(!0)),f!=null&&(l(Ee(p,!0,Te,{id:f,index:0})),l(ba(!1,f)));break;case"cash_position":l(Ea(!0));break;case"top_expenses":l(Ia());break;case"cash_in_cash_out":l(Aa());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(Ve,{analytics:T,onLoad:l=>((h,p)=>{const f=e.state?.referrer;switch(p){case"operating_expenses":h.trackPageLoaded(N.Event.operatingExpenses,f);break;case"revenue":h.trackPageLoaded(N.Event.revenues,f);break;case"net_burn_or_income":h.trackPageLoaded(N.Event.burnRate,f);break;case"cash_position":h.trackPageLoaded(N.Event.cashPosition,f);break;case"top_expenses":h.trackPageLoaded(N.Event.topExpenses,f);break;case"cash_in_cash_out":h.trackPageLoaded(N.Event.cashInCashOut,f);break;default:console.error(`Analytics: Not tracking Page Loaded for ${p}!`)}})(l,u)}):null,d.jsx(Ms,{firstMonthOfFY:C,fetchState:n,reportId:u,forecastId:t})]})}var mt=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function pt(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),(function(){t(window.event)}))}function $a(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 za(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 Rt={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,"-":mt?173:189,"=":mt?61:187,";":mt?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},St={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},j={16:!1,18:!1,17:!1,91:!1},R={},He=1;He<20;He++)Rt["f".concat(He)]=111+He;var D=[],Xt=!1,Ka="all",Jt=[],tt=function(e){return Rt[e.toLowerCase()]||ie[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function ea(e){Ka=e||"all"}function Be(){return Ka||"all"}var ht=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;za(a).forEach((function(s){var i=s.split(r),c=i.length,m=i[c-1],g=m==="*"?"*":tt(m);if(R[g]){t||(t=Be());var C=c>1?$a(ie,i):[];R[g]=R[g].filter((function(u){return!((!n||u.method===n)&&u.scope===t&&(function(l,h){for(var p=l.length>=h.length?l:h,f=l.length>=h.length?h:l,S=!0,E=0;E<p.length;E++)f.indexOf(p[E])===-1&&(S=!1);return S})(u.mods,C))}))}}))};function ta(e,a,t,n){var o;if(a.element===n&&(a.scope===t||a.scope==="all")){for(var r in o=a.mods.length>0,j)Object.prototype.hasOwnProperty.call(j,r)&&(!j[r]&&a.mods.indexOf(+r)>-1||j[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||j[16]||j[18]||j[17]||j[91])&&!o&&a.shortcut!=="*"||a.method(e,a)===!1&&(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0))}}function aa(e,a){var t=R["*"],n=e.keyCode||e.which||e.charCode;if(G.filter.call(this,e)){if(n!==93&&n!==224||(n=91),D.indexOf(n)===-1&&n!==229&&D.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach((function(h){var p=St[h];e[h]&&D.indexOf(p)===-1?D.push(p):!e[h]&&D.indexOf(p)>-1?D.splice(D.indexOf(p),1):h==="metaKey"&&e[h]&&D.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(D=D.slice(D.indexOf(p))))})),n in j){for(var o in j[n]=!0,ie)ie[o]===n&&(G[o]=!0);if(!t)return}for(var r in j)Object.prototype.hasOwnProperty.call(j,r)&&(j[r]=e[St[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(D.indexOf(17)===-1&&D.push(17),D.indexOf(18)===-1&&D.push(18),j[17]=!0,j[18]=!0);var s=Be();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)&&ta(e,t[i],s,a);if(n in R){for(var c=0;c<R[n].length;c++)if((e.type==="keydown"&&R[n][c].keydown||e.type==="keyup"&&R[n][c].keyup)&&R[n][c].key){for(var m=R[n][c],g=m.splitKey,C=m.key.split(g),u=[],l=0;l<C.length;l++)u.push(tt(C[l]));u.sort().join("")===D.sort().join("")&&ta(e,m,s,a)}}}}function G(e,a,t){D=[];var n=za(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=$a(ie,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in R||(R[e]=[]),R[e].push({keyup:c,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:g,element:s});s!==void 0&&!(function(u){return Jt.indexOf(u)>-1})(s)&&window&&(Jt.push(s),pt(s,"keydown",(function(u){aa(u,s)}),C),Xt||(Xt=!0,pt(window,"focus",(function(){D=[]}),C)),pt(s,"keyup",(function(u){aa(u,s),(function(l){var h=l.keyCode||l.which||l.charCode,p=D.indexOf(h);if(p>=0&&D.splice(p,1),l.key&&l.key.toLowerCase()==="meta"&&D.splice(0,D.length),h!==93&&h!==224||(h=91),h in j)for(var f in j[h]=!1,ie)ie[f]===h&&(G[f]=!1)})(u)}),C))}var ft={setScope:ea,getScope:Be,deleteScope:function(e,a){var t,n;for(var o in e||(e=Be()),R)if(Object.prototype.hasOwnProperty.call(R,o))for(t=R[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Be()===e&&ea(a||"all")},getPressedKeyCodes:function(){return D.slice(0)},isPressed:function(e){return typeof e=="string"&&(e=tt(e)),D.indexOf(e)!==-1},filter:function(e){var a=e.target||e.srcElement,t=a.tagName,n=!0;return!a.isContentEditable&&(t!=="INPUT"&&t!=="TEXTAREA"&&t!=="SELECT"||a.readOnly)||(n=!1),n},trigger:function(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(R).forEach((function(t){var n=R[t].find((function(o){return o.scope===a&&o.shortcut===e}));n&&n.method&&n.method()}))},unbind:function(e){if(e===void 0)Object.keys(R).forEach((function(s){return delete R[s]}));else if(Array.isArray(e))e.forEach((function(s){s.key&&ht(s)}));else if(typeof e=="object")e.key&&ht(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=""),ht({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Rt,modifier:ie,modifierMap:St};for(var gt in ft)Object.prototype.hasOwnProperty.call(ft,gt)&&(G[gt]=ft[gt]);if(typeof window<"u"){var Ls=window.hotkeys;G.noConflict=function(e){return e&&window.hotkeys===G&&(window.hotkeys=Ls),G},window.hotkeys=G}G.filter=function(){return!0};var na=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Us(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,c=o.keydown,m=o.filterPreventDefault,g=m===void 0||m,C=o.enabled,u=C===void 0||C,l=o.enableOnContentEditable,h=l!==void 0&&l,p=b.useRef(null),f=b.useCallback((function(S,E){var v,k;return s&&!s(S)?!g:!!(na(S,["INPUT","TEXTAREA","SELECT"])&&!na(S,r)||(v=S.target)!=null&&v.isContentEditable&&!h)||!!(p.current===null||document.activeElement===p.current||(k=p.current)!=null&&k.contains(document.activeElement))&&(a(S,E),!0)}),n?[p,r,s].concat(n):[p,r,s]);return b.useEffect((function(){if(u)return i&&c!==!0&&(t.keydown=!1),G(e,t||{},f),function(){return G.unbind(e,f)};G.unbind(e,f)}),[f,e,u]),p}G.isPressed;const Gs=[],oa="dashboard_card",X="ai_cfo_dashboard_card";function sa(e,a){return a?e.some((t=>String(t)===X))?e.slice():[X,...e]:e.filter((t=>String(t)!==X))}const Vs=["net_burn_or_income_story_card","cash_balance","task_card","card_balance","zeni_promo_card","insights_dashboard","information_card","company_details","bill_pay_promo_card","bill_pay_card","reimbursement_card","reimbursement_promo_card","zeni_accounts_promo_card","rewards_card","treasury_promo_card"],Ns=(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}),Re=(e,a,t,n,o)=>({card:{dimension:et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),Ys=(e,a,t,n)=>Re(void 0,e,ke,a,t),$s=(e,a,t,n,o)=>({card:{dimension:et(ke),cardType:a,cardIndex:t,fetchState:e,disableAnimations:!1,spansFullDashboardWidth:!1},data:{funds:n,shouldShowTreasuryPromoIntroVideo:o,videoUrl:"https://www.youtube.com/watch?v=sqvJWKCMZgk"}}),zs=e=>{const a=et(ke);return a.height=ke.height+10,{card:{dimension:a,cardType:X,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ks=ee((function(e,a){const t=Qs(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i,treasuryFundDetails:c,shouldShowTreasuryPromoIntroVideo:m,treasuryFetchState:g}=a;let C=n.map(((u,l)=>{if(u==="reimbursement_promo_card"||u==="bill_pay_promo_card")return Ys(t,u,l);if(u==="zeni_promo_card")return Re({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ke,u,l);if(u==="treasury_promo_card")return $s(g,u,l,c,m);if(u==="information_card")return Re(void 0,"Completed",ke,u,l);if(u===X)return zs(l);{const h=o.find((p=>p?.reportId===u));return h?(function(p,f,S,E){const v=p.reportId;switch(v){case"card_balance":case"cash_balance":return[Ns(p,f,S,v,E)];case"expense_automation_card":case"operating_expenses":case"revenue":case"top_expenses":case"cash_position":case"cash_in_cash_out":case"insights_dashboard":case"company_details":case"task_card":case"bill_pay_card":case"reimbursement_card":case"net_burn_or_income":case"accounts_payable_aging":case"accounts_receivable_aging":case"zeni_accounts_promo_card":case"rewards_card":return[Re(p,f,S,v,E)];case"net_burn_or_income_story_card":return[Re(p,f,S,"net_burn_or_income_story_card",E)];default:return console.error(`card type ${v} not yet supported!`),[]}})(h,h.fetchState,ke,l):[]}})).flat();return a.isSummaryCardsFiltered===!0&&(C=C.filter((u=>Vs.includes(u.card.cardType)==0)).filter((u=>{const l=u.data?.availableNumberOfPeriods;return l!=null?l>0:u.card.cardType!="top_expenses"||u.data==null||(function(h){if(h==null||h.length===0)return!0;let p=!0;for(const f of h)if(f.balance.available.amount!==0){p=!1;break}return p})(u.data.topExpenses.accountsOrdered)===!1}))),{cardDataArray:C,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:ce(e,"navbar")},analytics:T,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}}),(function(e,a){const t=a.tenantId,n=M.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)T.trackDashboardCardClicked("cards promo",2),T.trackZeniCardsPromoCardClicked(a.isChargeCardFeatureEnabled,i,2,`${n?.firstName??""} ${n?.lastName??""}`,a.isChargeCardFeatureEnabled?a.cardsCreditLimit:void 0),i==="Learn More"?window.open("https://www.zeni.ai/product/business-credit-card","_blank"):a.navigate("../cards/promo",{relative:"path"});else if(a.isForecastOn)switch(r){case"net_burn_or_income":case"operating_expenses":case"revenue":a.navigate(`${r}/forecast/${a.selectedForecastOnDashboard}`,{state:{referrer:s}});break;default:a.navigate(`${r}`,{state:{referrer:s}})}else r==="rewards_card"?(n!=null&&T.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(T.trackMonthEndCloseClicked(a.selectedPeriod.month,a.selectedPeriod.year,"Dashboard"),a.navigate("../../month_end_close_checks/review",{state:{referrer:"Dashboard"}})):a.navigate(`${r}`,{state:{referrer:s}})},onReloadData:(o,r)=>{const s=[];a.isApAgingFeatureEnabled===!1&&s.push("accounts_payable_aging"),a.isArAgingFeatureEnabled===!1&&s.push("accounts_receivable_aging"),a.isZeniAccountEnabled===!1&&s.push("zeni_accounts_promo_card"),a.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),(function(i,c,m,g){if(c!==X)switch(c){case"card_balance":i(ma());break;case"cash_balance":i(da());break;case"operating_expenses":i(wa(!0));break;case"revenue":i(Pa(!0));break;case"net_burn_or_income":i(Ta(!0));break;case"net_burn_or_income_story_card":i(Bo(!0));break;case"cash_position":i(Ea(!0));break;case"top_expenses":i(Ia());break;case"cash_in_cash_out":i(Aa());break;case"insights_dashboard":i(Ro());break;case"bill_pay_card":i(Oo());break;case"reimbursement_card":i(Fo());break;case"company_details":i(Do(m));break;case"task_card":i(xo());break;case"accounts_payable_aging":g.includes("accounts_payable_aging")===!1&&i(Ct(Pe()));break;case"accounts_receivable_aging":i(kt(Pe()));break;case"zeni_accounts_promo_card":g.includes("zeni_accounts_promo_card")===!1&&i(ua());break;case"rewards_card":g.includes("rewards_card")===!1&&i(wo(!0));break;default:throw new Error(`report type ${c} is not yet supported`)}})(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{T.trackTimeframeSwitch(Va(r),Zs(o),"Dashboard"),(function(s,i,c){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(we(c));break;case"top_expenses":s(va(c));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}})(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(Po(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=w(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=w(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=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/business-checking-accounts","_blank");else if(o==="treasury_promo_card")if(a.isUserHasTreasuryAccess){M.saveTreasuryPopupSeen(a.tenantEmailDomain,!0);const s="../treasury",i=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i},relative:"path"})}else window.open("https://www.zeni.ai/product/treasury","_blank")},onSaveClick:(o,r,s)=>{o==="net_burn_or_income_story_card"&&(T.trackUpdateBurnRateCalculatorSettings(r,s,Eo(s)),e(To(t,r,s)))},onVideoPlay:()=>{e(dt())},onRemindMeLaterClick:()=>{e(Io())},onDontShowAgainClick:()=>{e(dt())},onIntroOutsideClick:()=>{a.isTreasuryPromoIntroClosedByOutsideClick===!0&&a.isTreasuryPromoVideoPlayed!==!0?e(dt()):e(Ao())}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(le({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(J("navbar"))},onCancelAutoComplete:()=>{e(J("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?ue(o,a.tenantEmailDomain):as(o.zeniId,o.qboId,a.tenantEmailDomain);const s=w(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}}))(ts);function qs(){const e=ra(),a=Oa(),t=La(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=Fa(),s=W(),i=$(),c=H(),m=M.getSignedInUser(),{useFeatureGate:g,useDynamicConfig:C}=Se(),[u,l]=b.useState(!1),[h,p]=b.useState(!1),f=Ra(),{tenantEmailDomain:S}=K(),{isAiCfoAccessEnabled:E,onAskAiCfoClick:v}=ae({mobileExploreReferrer:"Dashboard"}),k=_((A=>A.tenantState.fetchState==="Completed"||A.tenantState.activeTenantFetchState.fetchState==="Completed"?U(A):void 0)),P=k??M.getSignedInUserTenant(S),x=k?.masterTOSInfo?.isMasterTOSAccepted??!1,y=P.tenantId,I=P.companyId;b.useEffect((()=>{u===!1&&c.state?.message==="activation"&&(i(bo(I)),l(!0))}),[c.state,u,I,i]),b.useEffect((()=>{f&&!h&&c.state?.message==="open_ai_cfo_drawer"&&(p(!0),x?(o(!0),s({pathname:c.pathname,search:c.search,hash:c.hash},{replace:!0,state:{...c.state,message:void 0}})):se({location:c,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))}),[c,h,f,x,o,s]);const{isFeatureEnabled:L}=g(B.isApAgingFeatureEnabled),{isFeatureEnabled:ne}=g(B.isExpenseAutomationEnabled),{isFeatureEnabled:$e}=g(B.isExpenseAutomationEnabledV2),me=Zo(),{isFeatureEnabled:ze}=g(B.isTreasuryEnabled),O=Qo(me),{isFeatureEnabled:oe}=g(B.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=g(B.isDepositAccountsFeatureEnabled),{isFeatureEnabled:qe}=g(B.isReferralFeatureEnabled),{isFeatureEnabled:qa}=g(B.isChargeCardFeatureEnabled),{isFeatureEnabled:Za}=g(B.isAiCfoFileUploadEnabled),{isFeatureEnabled:Qa}=g(B.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Ha}=g(B.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Wa}=g(B.aiAuditScorePercentage),{configValue:Bt}=C(Ba.zeniCardsConfig),Xa=Bt.charge_card_cashback_rate_per_transaction==null?.0175:Bt.charge_card_cashback_rate_per_transaction;if(c.state?.message==="activation"){const A=Ho(c.state?.pathnameStackToGoBack);s(c.pathname,{state:{...c.state,message:void 0,pathnameStackToGoBack:A.newStack}})}const[jt,Ja]=b.useState(!1),[at,en]=b.useState(!1);Us("command+p, Control+p",(A=>{en(!at),A.preventDefault()}),{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const Mt=k?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const pe=_((A=>U(A)?.excludedResources)),tn=_((A=>A.expenseAutomationViewState.selectedPeriodByTenantId)),an=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,nn=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,on=_((A=>A.treasurySetupViewState.treasuryFundsDetails)).fetchStatus.fetchState,sn=k?.company!=null&&Co(k.company),rn=ze&&sn,nt=_e(),cn=yt(nt?.loggedInUserRoleMap),z=[],Lt=pe?.resources?.find((A=>A.resource==="/reports/top_expenses"))==null,ln=pe?.resources?.find((A=>A.resource==="/reports/task_card"))==null,ot=k?.userRole!=null&&_a(k?.userRole),dn=pe?.resources?.find((A=>A.resource==="/bills"))==null&&!ot,un=pe?.resources?.find((A=>A.resource==="/reimbursements"))==null,mn=ko(nt?.loggedInUserRoleMap),pn=_o(nt?.loggedInUserRoleMap),hn=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,fn=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1,gn=_((A=>A.treasurySetupViewState.treasuryFundsDetails)).fundsDetails;Lt===!1&&z.push("top_expenses"),ln===!1&&z.push("task_card"),dn===!1&&z.push("bill_pay_card","bill_pay_promo_card"),L===!1&&z.push("accounts_payable_aging"),oe===!1&&z.push("accounts_receivable_aging"),(me===!1||ot)&&z.push("expense_automation_card"),un===!1&&z.push("reimbursement_card","reimbursement_promo_card"),z.push("zeni_accounts_promo_card","treasury_promo_card"),qe===!1&&z.push("rewards_card");const{areTenantIdsInSync:Ut}=Wo();b.useLayoutEffect((()=>{jt&&O===me||Mt!==!0||!Ut||pe?.fetchState!=="Completed"&&pe?.fetchState!=="Error"||(Ja(!0),i(So(m.userId,I,y,!0,!1,z)))}),[jt,m,y,i,Lt,Mt,pe?.fetchState,Ut]);const bn=_((A=>A.reportUIOptionsState.forecastOnDashboard.isForecastModeOn)),Cn=_((A=>A.revenueState.uiState.selectedForecast?.id)),kn=_((A=>A.cardBalanceState.fetchState)),he=_((A=>yo(A,z,m,$e,ne))),_n=he.fetchState,Sn=b.useMemo((()=>sa(he.cardsOrdered,E)),[he.cardsOrdered,E]),yn=b.useMemo((()=>sa(he.cardsForDashboardUI,E)),[he.cardsForDashboardUI,E]);Ge({isDataReady:!0});const{isSuggestedQuestionsLoading:vn,suggestedPromptQuestions:An}=os(),st=k?.isTreasuryPromoVideoPlayed===!0,Gt=k?.isTreasuryPromoVideoRemindMeLaterClicked===!0,Vt=k?.loginCounterForTreasuryPromoVideo??0,In=k?.isTreasuryPromoIntroClosedByOutsideClick===!0,Nt=_((A=>A.dashboardState.isTreasuryVideoClosed)),Yt=b.useMemo((()=>Xo({isTreasuryPromoVideoRemindMeLaterClicked:Gt,isTreasuryPromoVideoPlayed:st,loginCounterForTreasuryPromoVideo:Vt,isTreasuryVideoClosed:Nt})),[Gt,st,Vt,Nt]),$t=_((A=>pa(A))),ye=$t.uiState?.currentChatSessionId,rt=$t.allSessionsWithOrderedQuestionAnswers??Gs,{currentSessionQuestionAnswers:En}=Jo(rt,ye),zt=En.length===0,Tn=b.useCallback(((A,Z,fe)=>{const ve=m?.userId;if(ve==null)return;const V=A.trim();if(V.length===0&&Z.length===0)return;if(!x)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});const Q=ja(e.getState()),Ae=()=>{const Ie=w(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ie,referrer:"Dashboard",aiCfoInitialQuestion:V,aiCfoShouldSubmit:!Q&&V.length>0,aiCfoInitialSubmissionSource:oa,...typeof fe=="number"?{aiCfoSuggestionIndex:fe}:{}}})};return t?Z.length>0?void o(!0):void Ae():Z.length>0?Q?(i(_t(V)),void o(!0)):(r(V.length>0?V:null),o(!0),void(V.length>0&&Ma(i,V,oa,ye,rt,ve,fe,Z.length>0?Z:void 0))):(Q&&i(_t(V)),void Ae())}),[rt,ye,i,x,t,c,s,r,o,m?.userId,e,S]),Pn=b.useCallback((()=>{x?o(!0):se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})}),[x,c,s,o]),wn=b.useCallback((()=>{if(!x)return void se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});if(S==null)return;const A=w(c.state?.pathnameStackToGoBack,c.pathname);s(`/${S}/ai-cfo/explore`,{state:{pathnameStackToGoBack:A,referrer:"Dashboard"}})}),[x,c,s,S]),xn=b.useCallback((()=>{if(x)if(t){if(S==null||k==null)return;const A=ye==null||zt?`/${S}/ai-cfo/explore`:`/${S}/ai-cfo/${ye}`,Z=c.state?.pathnameStackToGoBack??[],fe=w(Z,c.pathname);s(A,{state:{...c.state,pathnameStackToGoBack:fe,[es]:!0}})}else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}});else se({location:c,navigate:s,mergeState:{referrer:"Dashboard"}})}),[x,t,c,s,S,k,ye,zt]);return d.jsxs(d.Fragment,{children:[_n==="Completed"?d.jsx(Ve,{analytics:T,onLoad:A=>{A.trackPageLoaded(N.Event.dashboard),rn&&Yt===!0&&A.trackTreasuryPromoView("Dashboard Promo Video")}}):null,d.jsx(Ks,{maxColumns:n?2:void 0,isAiCfoAccessEnabled:E,onAskAiCfoClick:v,onAiCfoDashboardOpenPanel:Pn,onAiCfoDashboardOpenScopePage:xn,isAiCfoFileUploadEnabled:Za===!0&&t===!1,onAiCfoDashboardPromptSubmit:Tn,onAiCfoDashboardExpandToFullPage:wn,aiCfoDashboardSuggestedPromptQuestions:An,aiCfoDashboardSuggestedPromptQuestionsLoading:vn,onDragAndDropCard:(A,Z)=>{if(A===X||Z===X)return;const fe=(function(Q,Ae,Ie){const it=Ie.indexOf(Q),ct=Ie.indexOf(Ae);if(it===-1||ct===-1||it===ct)return Ie;const lt=[...Ie];return lt.splice(it,1),lt.splice(ct,0,Q),lt})(A,Z,Sn),ve=fe.filter((Q=>Q!==X)),V=he.cardsOrdered;(ve.length!==V.length||ve.some(((Q,Ae)=>Q!==V[Ae])))&&i(vo(ve))},dashboardReport:he,passedCardsOrdered:yn,tenantId:y,companyId:I,tenantEmailDomain:S,location:c,navigate:s,isApAgingFeatureEnabled:L,isArAgingFeatureEnabled:oe,isBillPayEnabled:nn,isReimbursementEnabled:an,isSummaryCardsFiltered:at,isForecastOn:bn,selectedForecastOnDashboard:Cn,isVisitingFirstTime:u,isZeniAccountEnabled:Ke,isRewardsFeatureEnabled:qe,hasZeniAccountsAdminAccess:cn,isExpenseAutomationEnabledForUser:me&&ot===!1,selectedPeriod:tn[y],isChargeCardFeatureEnabled:qa,isUserHasCardsAccess:mn,isUserHasTreasuryAccess:pn,cardsCreditLimit:hn,cashbackRate:Xa,isInterestedInChargeCard:fn,cardBalanceFetchState:kn,christmasAnimationEnabled:Qa,newYearAnimationEnabled:Ha,treasuryFundDetails:gn,shouldShowTreasuryPromoIntroVideo:Yt,isTreasuryPromoVideoPlayed:st,isTreasuryPromoIntroClosedByOutsideClick:In,treasuryFetchState:on,aiAuditScorePercentageEnabled:Wa})]})}const Zs=e=>{switch(e){case"operating_expenses":return"Operating Expenses";case"revenue":return"Revenues";case"top_expenses":return"Top Expenses";case"net_burn_or_income":return"Burn Rate";case"cash_in_cash_out":return"Cash In, Cash Out";case"cash_position":return"Cash Position"}return"Dashboard"},Qs=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map((a=>a.fetchState)).reduce(((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t));function vr(){const e=_e(),a=e?.excludedResources?.find((m=>m.resource==="/reports/top_expenses"))==null,{useFeatureGate:t}=Se(),{isFeatureEnabled:n}=t(B.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(B.isArAgingFeatureEnabled),r=_((m=>U(m))),{isFeatureEnabled:s}=t(B.isDebitCardFeatureEnabled),i=jo(s,r),c=Mo(r);return i===!0||c===!0?d.jsx(bt,{children:d.jsx(F,{path:"/*",element:d.jsx(ss,{})})}):d.jsxs(bt,{children:[d.jsx(F,{path:"/",element:d.jsx(qs,{})}),d.jsx(F,{path:"cash_balance/*",element:d.jsx(Wt,{})}),d.jsx(F,{path:"card_balance/*",element:d.jsx(Wt,{})}),d.jsx(F,{path:"operating_expenses/*",element:d.jsx(re,{})}),d.jsx(F,{path:"operating_expenses/forecast/*",element:d.jsx(ut,{})}),d.jsx(F,{path:"revenue/forecast/*",element:d.jsx(ut,{})}),d.jsx(F,{path:"revenue/*",element:d.jsx(re,{})}),d.jsx(F,{path:"net_burn_or_income/forecast/*",element:d.jsx(ut,{})}),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(is,{})}),d.jsx(F,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(rs,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(F,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(cs,{})}),d.jsx(F,{path:"accounts_receivable_aging/*",element:d.jsx(ls,{})})]}),d.jsx(F,{path:"cash_position/*",element:d.jsx(re,{})}),d.jsx(F,{path:"top_expenses/*",element:a===!0?d.jsx(re,{}):d.jsx(je,{})}),d.jsx(F,{path:"cash_in_cash_out/*",element:d.jsx(re,{})}),d.jsx(F,{path:"company_details",element:d.jsx(ns,{})}),d.jsx(F,{path:"referrals/*",element:d.jsx(Dn,{to:"../../rewards/refer",replace:!0})}),d.jsx(F,{path:"*",element:d.jsx(je,{})})]})}export{vr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as v}from"./liveblocks-
|
|
1
|
+
import{j as v}from"./liveblocks-CO5jpspP.js";import{a as u}from"./sentry-DT80za28.js";import{u as y,j as b,n as w,g as A,N}from"./core-6UWneHYU.js";import{Md as U,eZ as _,g3 as k,Me as L,oi as R,Mf as z}from"./zeni-epic-state-CO3_FacC.js";import{u as O,z as f,L as T,t as I,O as j,b as $}from"./index-A9TSx6IP.js";import"./mui-CZj-zMWV.js";import{t as P}from"./getLocaleForTenant-bb4clfVv.js";import"./recharts-DNj0j956.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="392dbe06-a716-44af-9e31-11501bb5b62d",t._sentryDebugIdIdentifier="sentry-dbid-392dbe06-a716-44af-9e31-11501bb5b62d")}catch{}})();const M=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(N,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=O(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(k(d.userId,e))))}),[n,a,d,t]),u.useEffect((()=>{const e=f.getSignedInUser(),g=f.getActiveTenantForUser()?.tenantId,S=g==null||a==="Completed"||a==="Error";r.current===!1&&e!=null&&S&&I.shouldFetchAllTenants()&&(r.current=!0,I.markAllTenantsFetchStarted(),(n==="Not-Started"||n==="Error"&&!L(i))&&t(R(e.userId)))}),[n,a,i,d,t]),u.useEffect((()=>{f.isSignedIn()&&n==="Completed"&&m.tenantsCoreDetailsInOrder.length>0&&(f.saveSignedInUserTenants(m.tenantsCoreDetailsInOrder),o())}),[m.tenantsCoreDetailsInOrder,n]),u.useEffect((()=>{!f.isSignedIn()||n!=="Completed"&&a!=="Completed"||c==null||(j.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(M,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{j as l}from"./liveblocks-CO5jpspP.js";import{h as w,g as C,j as h,n as A,i as $}from"./core-6UWneHYU.js";import{Qk as k,Qr as _,gl as W,gk as K,gj as q,jD as J,Nu as L,rN as M,eZ as D,PS as V,jB as T,Ql as S,Qu as j,jz as F,jW as G}from"./zeni-epic-state-CO3_FacC.js";import{bz as X,K as N,A as R,z as U,y as z,p,d as v,B as Z,bA as Y,o as O,bB as ee,r as te}from"./index-A9TSx6IP.js";import{n as Q}from"./mui-CZj-zMWV.js";import"./sentry-DT80za28.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]="f3995963-2004-4347-b2d7-85caa3b65958",e._sentryDebugIdIdentifier="sentry-dbid-f3995963-2004-4347-b2d7-85caa3b65958")}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(M(n))},onGetOtp:n=>{e(q(n,"BillPayVendor"))},onResendOtp:n=>{e(K(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(W(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}}))(X);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h((i=>k(i,e)));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=Q.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=V(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,a);return{billId:a,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{navigate:n,location:a,vendorId:o}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{e(F(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(a.state?.pathnameStackToGoBack),i=s.poppedPathname??E();n(i,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:i}=s;e(j({data:i}))},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),i=s.poppedPathname??E(0);t.navigate(i,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}}))(Y);function me({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:i}=$(),d=e??s,{useFeatureGate:r}=R(),c=U.getSignedInUser(),b=h((u=>D(u))),g=z(),x=p(a.state?.pathnameStackToGoBack),m=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),f=h((u=>k(u,d))),{isFeatureEnabled:I}=r(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(v.isDepositAccountsFeatureEnabled);if(c==null)throw Error("Can't access address page without signing in...");return m==="billDetail"&&f.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:f.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ae,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:i}),l.jsx(oe,{location:a,navigate:n,billId:i,vendorId:d,currentTenant:b,bankAccountContext:m,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const E=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},fe=(e,t,n)=>{let a=`/${e}/bill/${encodeURIComponent(t)}`;return n=="draft"&&(a+="/edit"),a},he=e=>`/${e}/bills`,ke=(e,t)=>{let n=`/${e}/bill`;return n=t!=null?n.concat(`/${t}/edit`):n.concat("/new"),n},B=(e,t,n,a)=>{let o=`/${e}/bill`;return o+=n!=null?`/${n}/edit/vendor`:"/new/vendor",o+=a!=null?`/${a}/edit/${t}`:`/create/${t}`,o};function Se(e,t,n){return B(e,"ach",t,n)}function ve(e,t,n){return B(e,"domestic",t,n)}function ge(e,t,n){return B(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},re=Q.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 ${O.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
18
|
+
`,ie=A((function(e,t){const{vendorId:n,billId:a}=t,o=k(e,n),s=V(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:i}=t,{tenantEmailDomain:d}=i;return{onFetchBankName:r=>{e(G(r))},onSaveHandler:r=>{e(F(t.bankAccountContext,r,"us-domestic",s))},onWireDetailsUpdated:r=>{const{bankAccountSection:c}=r;e(j({data:c}))},onCancel:()=>{(()=>{const r=p(o.state?.pathnameStackToGoBack),c=r.poppedPathname??P();a(c,{state:{pathnameStackToGoBack:r.newStack}})})(),e(S())},onAddressClick:r=>{if(t.bankAccountContext==="express-pay")a("./add-address");else{const c=se(d,r,n),b=te(o.state?.pathnameStackToGoBack,o.pathname);a(c,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(T({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const r=p(t.location.state?.pathnameStackToGoBack),c=r.poppedPathname??P(0);t.navigate(c,{state:{pathnameStackToGoBack:r.newStack}})}e(S())}}}))(ee);function xe({vendorIdParam:e,accountContext:t}){const n=w(),a=C(),o=N(),{vendorId:s,billId:i}=$(),d=e??s,r=U.getSignedInUser(),{useFeatureGate:c}=R(),b=z(),g=h((u=>D(u))),x=p(a.state?.pathnameStackToGoBack),m=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),f=h((u=>k(u,d))),{isFeatureEnabled:I}=c(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=c(v.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return m==="billDetail"&&f.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:f.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${O.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(re,{windowSize:o,children:[l.jsx(H,{vendorId:d,billId:i}),l.jsx(ie,{location:a,navigate:n,billId:i,vendorId:d,currentTenant:g,bankAccountContext:m,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t};export{me as A,xe as D,H as V,fe as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as d}from"./liveblocks-CO5jpspP.js";import{K as b,F as l,y as f}from"./index-A9TSx6IP.js";import{D as c}from"./mui-CZj-zMWV.js";import"./sentry-DT80za28.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]="89fbbb96-b48a-4b8e-a23e-0117ebf93880",e._sentryDebugIdIdentifier="sentry-dbid-89fbbb96-b48a-4b8e-a23e-0117ebf93880")}catch{}})();const p={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:a}=e,n=b(),s=o?.valuePx(n)??p.drawerLeftMargin.valuePx(n),i=f();return d.jsx(c,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:a,children:t})}export{h as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-CO5jpspP.js";import{a as c}from"./sentry-DT80za28.js";import{h as N,u as O,g as A,i as B,j as d,N as q,n as F,o as _,p as z}from"./core-6UWneHYU.js";import{OC as H,eZ as K,N_ as M,lG as R,Kv as I,OH as W,Nt as Y,kG as $,Kw as S,O3 as V,O4 as X,Nv as Z,Nu as J}from"./zeni-epic-state-CO3_FacC.js";import{aX as L,f as Q,p as U,r as tt}from"./index-A9TSx6IP.js";import"./mui-CZj-zMWV.js";import{d as k}from"./decodeURIComponentSafe-IgzW2Epz.js";import{w as et}from"./withTransactionSidePanel-DKi_i4iZ.js";import{f as at,c as nt}from"./routePaths-CsP6Ffie.js";import"./recharts-DNj0j956.js";import"./analytics-dRdyiJhV.js";import"./plaid-CQGSnVgh.js";import"./dnd-DPJDixDO.js";import"./stripe-cKAAJElX.js";import"./lottie-BHZsp7n9.js";import"./lexical-BSu0Xk1T.js";import"./pdf-B15NABJW.js";import"./utils-CLt4eceg.js";import"./useAskAiCfoHostNavButtonProps-CpfOq769.js";import"./TransactionDetailScreen-lkVHlxIe.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]="73f378c2-e1b0-4cc0-a56c-7e99ac27e25a",a._sentryDebugIdIdentifier="sentry-dbid-73f378c2-e1b0-4cc0-a56c-7e99ac27e25a")}catch{}})();const ot=F((function(a,t){const e=t.entity,o=W(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:Y(a,"common")},trendWithTransactionsReport:o,analytics:Q,isAccountingClassesEnabled:$(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(V()),a(X()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=U(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??C();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(I(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(L),it=et((function({entityType:a,...t}){const e=N(),o=O(),l=A(),[m,T]=c.useState(!1),[h,D]=c.useState(!1),{tenantEmailDomain:b,entityIdEncoded:v,entityNameEncoded:w}=B(),r=k(v??""),p=k(w??""),u=rt(r,p),G=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=d((n=>H(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),j=d((n=>K(n).company?.companyInfo.firstMonthOfFY??1)),f=d((n=>M(n.trendWithTransactionsState,i,"EntityDetail")));c.useEffect((()=>{m===!1&&u===!0&&(T(!0),o(R(i)))}),[m,u,i]);const E=d((n=>n.trendState.fetchState)),P=f?.selectedPeriod?.timePeriod??g,x=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(f?.selectedPeriod?.timePeriod,g);return c.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(D(!0),P!=null&&o(I(i,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),u?s.jsx(ot,{firstMonthOfFY:j,tenantEmailDomain:b,location:l,navigate:e,entity:i,defaultTransactionTimePeriod:x,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(q,{to:C(G.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,C=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function vt({entityType:a}){return s.jsx(_,{children:s.jsx(z,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{vt as EntityDetailRoutes,vt as default};
|