@zeniai/web-app-ui 5.3.61-qa → 5.3.62-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/assets/{AccountMappingScreen-OaD-Ww7N.js → AccountMappingScreen-DwM3_WTC.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-C71W3EXR.js → ActualMatchingMatchDetailScreen---3NQIlW.js} +1 -1
  3. package/dist/assets/AddressRoutes-CRWje5aU.js +1 -0
  4. package/dist/assets/AddressScreen-DwDn6adU.js +9 -0
  5. package/dist/assets/{AiCfoScreen-DO4viMbN.js → AiCfoScreen-CmI1WP3p.js} +1 -1
  6. package/dist/assets/{AppDrawer-BoBT503t.js → AppDrawer-CqAnDatC.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-UWoiHhFS.js → BillPayApprovalRoutes-uF3lLPXa.js} +1 -1
  8. package/dist/assets/BillPayRoutes-CxGXv0Eb.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-DjqyigwM.js → BusinessVerificationPageScreen-CWJBny4J.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-cEaT6Zqk.js → CardsAiCfoScreen-DTmIk225.js} +1 -1
  11. package/dist/assets/ChargeCardRoutes-CBA-C6S5.js +71 -0
  12. package/dist/assets/{CompanyPassportScreen-CHnMtfXr.js → CompanyPassportScreen-C0r5_u0C.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-D97ZGKWy.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-DREpIR3e.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-CkVSR1Hr.js → CustomerOnboardingRoutes-BFK8USjA.js} +3 -3
  16. package/dist/assets/DashboardRoutes-CIiFmVuR.js +20 -0
  17. package/dist/assets/{DefaultTenantHome-BWjmQO2E.js → DefaultTenantHome-BWhhfpNZ.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-Cs9T_IgO.js → DomesticWireDetailScreen-C8g5HYbF.js} +4 -4
  19. package/dist/assets/{DrawerScreen-CO5oDn6f.js → DrawerScreen-jGeXohet.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-QbthrUVk.js → EntityDetailRoutes-DDbPZyaE.js} +1 -1
  21. package/dist/assets/ExpenseAutomationRoutes-BhSlFN1-.js +38 -0
  22. package/dist/assets/{FeaturePreviewScreen-DWBL39rh.js → FeaturePreviewScreen-t-KcIePh.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-DAce4xun.js → HubSpotOAuthCallbackScreen-B9Xsd5UE.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-B4UF_uUg.js → InboxNotificationsProvider-DcarX1j5.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-BQHOoyRc.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-phTux1TG.js → MagicLinkRoutes-CfUJpVA_.js} +4 -4
  27. package/dist/assets/{MagicLinkSignInScreen-D-3VGahG.js → MagicLinkSignInScreen-BR70G8WN.js} +1 -1
  28. package/dist/assets/MobileAppDrawer-DqgtjBKX.js +1 -0
  29. package/dist/assets/NotFoundScreen-C2GrPpNy.js +1 -0
  30. package/dist/assets/{NotificationRoutes-YZJK1G-i.js → NotificationRoutes-C1V1-m3K.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-BgBHYWlo.js → OAuthConsentScreen-UVKKdhYW.js} +1 -1
  32. package/dist/assets/PandLWithForecastRoutes-x9MBz-SJ.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-DCGfHELs.js → PaymentLinkScreen-BtszXnNs.js} +9 -9
  34. package/dist/assets/{PeopleRoutes-BWFloBGz.js → PeopleRoutes-By-929Rc.js} +3 -3
  35. package/dist/assets/PerformanceRoutes-DwUVercL.js +1 -0
  36. package/dist/assets/{Preview-Co3i0Xrb.js → Preview-Dxr01VGI.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-DYxxHcdI.js → QBOConnectionScreen-Chdjbcg8.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-CMbfshMX.js → ReimbursementApprovalRoutes-DVM8rE5F.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CrWl9trk.js → ReimbursementApprovalRuleDetailScreen-Bf1LI70e.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-ByU4nWbt.js +68 -0
  41. package/dist/assets/ReportsRoutes-Be1H67SI.js +1 -0
  42. package/dist/assets/RewardsRoutes-iweGs61q.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-DTNyy-6E.js → ScheduleDetailsPrepaidExpensesScreen-HIrqgD7A.js} +4 -4
  44. package/dist/assets/{ScreenRoutes-DP4Wjips.js → ScreenRoutes-CFuAOQvL.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-CDD6OVir.js → SettingsRoutes-CYdVWZYv.js} +5 -5
  46. package/dist/assets/{SetupPagesScreen-BlUoKvnc.js → SetupPagesScreen-BccJSzRN.js} +5 -5
  47. package/dist/assets/SignInScreen-DM0sUU51.js +1 -0
  48. package/dist/assets/SignOutScreen-Bs1NyDBL.js +9 -0
  49. package/dist/assets/{TaskListScreen-UsJ67eRj.js → TaskListScreen-DQj6h_q_.js} +2 -2
  50. package/dist/assets/{TaskRoutes-CH6htYb8.js → TaskRoutes-DY92MrHK.js} +1 -1
  51. package/dist/assets/TransactionDetailRoutes-BFj2-oES.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-fc6wRDCa.js +5 -0
  53. package/dist/assets/TransactionListRoutes-DoEWtZb8.js +1 -0
  54. package/dist/assets/TreasuryRoutes-BwZlVh2U.js +37 -0
  55. package/dist/assets/{VendorsRoutes-jSHZV8MZ.js → VendorsRoutes-rWAhbgUX.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-Bf_MMExc.js → WiseConfirmationScreen-twAmgAST.js} +1 -1
  57. package/dist/assets/ZeniAccountRoutes-BqSVR2HC.js +57 -0
  58. package/dist/assets/{ZeniAccountStatementScreen-CcOG7C5Z.js → ZeniAccountStatementScreen-xKZWX655.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-Ci74NLEW.js → accountMappingHelper-DpfYWNe6.js} +1 -1
  60. package/dist/assets/{analytics-8lQ_GaR7.js → analytics-CiEh1qKr.js} +1 -1
  61. package/dist/assets/{analyticsHelper-Bi6R9Hrj.js → analyticsHelper-DHPcRAai.js} +1 -1
  62. package/dist/assets/{core-B-8b0iz9.js → core-Caq7Zbsp.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-hAviH84T.js → decodeURIComponentSafe-DmjyT4t5.js} +1 -1
  64. package/dist/assets/{dnd-CtOxA7uX.js → dnd-DwckO6rX.js} +1 -1
  65. package/dist/assets/{empty-CyiOIGJw.js → empty-CviwvzhB.js} +1 -1
  66. package/dist/assets/{empty-ZUR8mjP1.js → empty-Dl3LsHNf.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-Dch9mr3K.js → emptyVideoElement-0ADxBh21.js} +1 -1
  68. package/dist/assets/{epic-C_YIXfJm.js → epic-DqqOk9a9.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-BzOPc0En.js → expenseAutomationHelper-B83Qa5Jl.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-BYXijL7f.js → getLocaleForTenant-YgJPw-1W.js} +1 -1
  71. package/dist/assets/{index-BUsi93tT.js → index-B3LhL1WI.js} +2 -2
  72. package/dist/assets/{index-DeS-5gfC.js → index-BLBexBOn.js} +1 -1
  73. package/dist/assets/{index-CzpjeHcU.js → index-BggnOuo1.js} +1 -1
  74. package/dist/assets/{index-CgYr_9vs.js → index-Bi5Vnzzf.js} +1 -1
  75. package/dist/assets/{index-Ce-G0Vp2.js → index-BsIiLcaT.js} +1 -1
  76. package/dist/assets/{index-Bg2deWZq.js → index-DOXJLxdR.js} +23226 -23221
  77. package/dist/assets/{index-haVo7C6B.js → index-DZj1fENq.js} +1 -1
  78. package/dist/assets/{index-b65XjN06.js → index-De1Gw5gW.js} +1 -1
  79. package/dist/assets/{lexical-BVt4M34U.js → lexical-mmp2B1vq.js} +1 -1
  80. package/dist/assets/{liveblocks-BjcYyeQ6.js → liveblocks-CIxx6Ub6.js} +1 -1
  81. package/dist/assets/{lottie-BdAYiWcR.js → lottie-CrKh4Q_r.js} +1 -1
  82. package/dist/assets/{mui-C33Oegsm.js → mui-DI0hUuFr.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bgu6njoM.js → pathToGoBack-Ch5lrOj1.js} +1 -1
  84. package/dist/assets/{pdf-BkfulyEw.js → pdf-BlhN83fm.js} +3 -3
  85. package/dist/assets/{pdf-lib-D8o-uP9K.js → pdf-lib-WBpN-CHj.js} +1 -1
  86. package/dist/assets/{plaid-Bt28AVCt.js → plaid-CXvI7t9H.js} +1 -1
  87. package/dist/assets/{pusher-BWEmmbE9.js → pusher-BZAjVztW.js} +1 -1
  88. package/dist/assets/{react-BAH__mX9.js → react-BHfk4QRe.js} +1 -1
  89. package/dist/assets/{react-CIEK2Ei-.js → react-BqA23JAy.js} +1 -1
  90. package/dist/assets/{react-Dqb011PB.js → react-BsygV86H.js} +1 -1
  91. package/dist/assets/{react-B7GqIpoL.js → react-XoZ7aD8C.js} +1 -1
  92. package/dist/assets/{react-DT9gMpbF.js → react-rmAoHvXj.js} +1 -1
  93. package/dist/assets/{react-Ls8UDl46.js → react-tooGqts4.js} +1 -1
  94. package/dist/assets/{recharts-DkYxIsLi.js → recharts-DKmpCGIA.js} +1 -1
  95. package/dist/assets/{routePaths-Cz0AF8Dx.js → routePaths-C1OqXYGB.js} +1 -1
  96. package/dist/assets/{sentry-DZ9rNYfw.js → sentry-BCPOyc0G.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Te2Zqy4u.js → stripSplatSuffix-Dmnnw5Oe.js} +1 -1
  98. package/dist/assets/{url-BjdrSaU1.js → url-CdxI2rEH.js} +1 -1
  99. package/dist/assets/{url-DY2r7CPa.js → url-JduagIhH.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-BzNeeZZT.js → useActualMatchingMatchDetail-6t8vcRTI.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CI6Qx_-n.js → useAiCfoDashboardSuggestedQuestionsChips-BO7_rPaJ.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-BvhP40c_.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-1CQ78Q4X.js → useChargeCardPusherEvents-2nVivR1x.js} +1 -1
  104. package/dist/assets/{useDeviceId-gFU5q5zf.js → useDeviceId-2NJBbYPM.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-BkOsYAaQ.js → useEmailConnectResultRefresh-QqukN5jp.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-C3Htu0iZ.js → useInitialThreadRequest-uu8NipM7.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-DxrmaJfc.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-Da1LpD5U.js → useTaskManagerPusherEvents-D5Hm7um3.js} +1 -1
  109. package/dist/assets/{utils-D3rZq_G4.js → utils-rX2IEvjD.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-C1wVwRW0.js +25 -0
  111. package/dist/assets/{zeni-epic-state-95zxmizy.js → zeni-epic-state-DROyxOLw.js} +3 -3
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-BVz7TQgL.js +0 -1
  115. package/dist/assets/AddressScreen-DyDl-tRh.js +0 -9
  116. package/dist/assets/BillPayRoutes-GFA8LUX-.js +0 -119
  117. package/dist/assets/ChargeCardRoutes-D4YlLVsI.js +0 -71
  118. package/dist/assets/ConnectionAuthScreen-DoG98aIj.js +0 -11
  119. package/dist/assets/CustomerOnboardingAuthScreen-sNk7vsur.js +0 -1
  120. package/dist/assets/DashboardRoutes-mW-tjMuc.js +0 -20
  121. package/dist/assets/ExpenseAutomationRoutes-DOepnh8G.js +0 -38
  122. package/dist/assets/InvoicingRoutes-BNkUMYuP.js +0 -2
  123. package/dist/assets/MobileAppDrawer-CHFdUHPo.js +0 -1
  124. package/dist/assets/NotFoundScreen-BPIsWBDH.js +0 -1
  125. package/dist/assets/PandLWithForecastRoutes-gJp3CGBo.js +0 -1
  126. package/dist/assets/PerformanceRoutes-DE0kFKjY.js +0 -1
  127. package/dist/assets/ReimbursementRoutes-ChwPWyQv.js +0 -68
  128. package/dist/assets/ReportsRoutes-CYsPWlxq.js +0 -1
  129. package/dist/assets/RewardsRoutes-C-TWFvBa.js +0 -1
  130. package/dist/assets/SignInScreen-3WOvV3S5.js +0 -1
  131. package/dist/assets/SignOutScreen-CKL0FwKr.js +0 -9
  132. package/dist/assets/TransactionDetailRoutes-D6Gttu9Z.js +0 -1
  133. package/dist/assets/TransactionDetailScreen-CN2_Ei-4.js +0 -5
  134. package/dist/assets/TransactionListRoutes-BBUdWZ4f.js +0 -1
  135. package/dist/assets/TreasuryRoutes-BqcgWSjx.js +0 -37
  136. package/dist/assets/ZeniAccountRoutes-CBtuSj8X.js +0 -57
  137. package/dist/assets/useAskAiCfoHostNavButtonProps-BZHyrLWc.js +0 -1
  138. package/dist/assets/useTaskManagerAccess-C6qhVozS.js +0 -1
  139. package/dist/assets/withTransactionSidePanel-iXTpLDC6.js +0 -25
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-BjcYyeQ6.js";import{t as Tt,A as $e}from"./AddressScreen-DyDl-tRh.js";import wt from"./NotFoundScreen-BPIsWBDH.js";import{a as d,t as Me}from"./sentry-DZ9rNYfw.js";import{h as _e,g as Ee,u as se,i as xe,j as T,N as Q,q as At,l as it,n as Pt,o as H}from"./core-B-8b0iz9.js";import{fF as Y,d_ as Te,dZ as we,bq as Dt,Uc as jt,bR as Bt,pQ as Ft,Bo as Vt,Br as Ut,Vz as Rt,VA as Lt,lu as Oe,lx as ct,UP as Nt,b$ as Gt,c8 as fe,BS as Ae,BD as $t,VB as me,BT as dt,Sm as Mt,mH as ut,di as lt,VC as Qt,VD as Kt,uE as zt,UC as Ce,hV as qt,UB as be,hS as Ht,Gh as Jt,uI as Zt,hK as Wt,hN as Qe,VE as pt,VF as Xt,M7 as Yt,VG as en,Mb as tn,Bu as nn,VH as an,VI as on,ls as sn,lv as rn,C3 as cn,BF as mt,BR as dn,bE as Ke,cE as un,C2 as ze,uX as ln,uL as pn,mz as mn,gG as gn,gF as fn,gE as yn,VJ as hn,Bx as Cn,C4 as bn,C7 as Sn,Ca as In,Cg as kn,dj as On}from"./zeni-epic-state-95zxmizy.js";import{z,o as Pe,S as W,Q as vn,p as q,a9 as re,k as g,aF as _n,aj as gt,a2 as En,O as ft,K as yt,j as X,_ as ge,V as ve,aG as xn,H as qe,v as He,af as Tn,aH as Je,aI as wn,aJ as An}from"./index-Bg2deWZq.js";import{n as De}from"./mui-C33Oegsm.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-DYxxHcdI.js";import{u as jn,a as Bn}from"./useEmailConnectResultRefresh-BkOsYAaQ.js";import{u as Fn}from"./useChargeCardPusherEvents-1CQ78Q4X.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="09b704f6-a5a7-48b8-a0a7-e1cf9cff639c",e._sentryDebugIdIdentifier="sentry-dbid-09b704f6-a5a7-48b8-a0a7-e1cf9cff639c")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vn=()=>{const e=_e(),l=Ee(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=xe(),t=z.getSignedInUser(),{useFeatureGate:n}=Pe(),{isFeatureEnabled:C}=n(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=n(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=n(W.isDebitCardFeatureEnabled),k=vn(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(w,O),b=we(O),D=[],U=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Dt(O?.userRole),E=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),E===!1&&D.push("bill_pay_card","bill_pay_promo_card"),x===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=T((S=>{const V=[];C===!1&&V.push("accounts_payable_aging"),o===!1&&V.push("accounts_receivable_aging"),V.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&V.push("rewards_card"),k===!1&&V.push("expense_automation_card");const J=jt(S,V);return Bt(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Ft(t.userId,F,O.tenantId,!0,!1,D)))}),[a,P,m,b,t,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_n,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
1
+ import{j as s}from"./liveblocks-CIxx6Ub6.js";import{t as Tt,A as $e}from"./AddressScreen-DwDn6adU.js";import wt from"./NotFoundScreen-C2GrPpNy.js";import{a as d,t as Me}from"./sentry-BCPOyc0G.js";import{h as _e,g as xe,u as se,i as Ee,j as T,N as Q,q as At,l as it,n as Pt,o as H}from"./core-Caq7Zbsp.js";import{fF as Y,d_ as Te,dZ as we,bq as Dt,Uc as jt,bR as Bt,pQ as Ft,Bo as Vt,Br as Ut,Vz as Rt,VA as Lt,lu as Oe,lx as ct,UP as Nt,b$ as Gt,c8 as fe,BS as Ae,BD as $t,VB as me,BT as dt,Sm as Mt,mH as ut,di as lt,VC as Qt,VD as Kt,uE as zt,UC as Ce,hV as qt,UB as be,hS as Ht,Gh as Jt,uI as Zt,hK as Wt,hN as Qe,VE as pt,VF as Xt,M7 as Yt,VG as en,Mb as tn,Bu as nn,VH as an,VI as on,ls as sn,lv as rn,C3 as cn,BF as mt,BR as dn,bE as Ke,cE as un,C2 as ze,uX as ln,uL as pn,mz as mn,gG as gn,gF as fn,gE as yn,VJ as hn,Bx as Cn,C4 as bn,C7 as Sn,Ca as In,Cg as kn,dj as On}from"./zeni-epic-state-DROyxOLw.js";import{z,N as Pe,f as W,Q as vn,p as q,a9 as re,k as g,aF as _n,aj as gt,a2 as xn,F as ft,W as yt,l as X,_ as ge,U as ve,aG as En,J as qe,x as He,af as Tn,aH as Je,aI as wn,aJ as An}from"./index-DOXJLxdR.js";import{n as De}from"./mui-DI0hUuFr.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-Chdjbcg8.js";import{u as jn,a as Bn}from"./useEmailConnectResultRefresh-QqukN5jp.js";import{u as Fn}from"./useChargeCardPusherEvents-2nVivR1x.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./empty-CviwvzhB.js";import"./pdf-lib-WBpN-CHj.js";import"./index-Bi5Vnzzf.js";import"./url-CdxI2rEH.js";import"./index-BggnOuo1.js";import"./decodeURIComponentSafe-DmjyT4t5.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new e.Error().stack;l&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[l]="1eeda9c6-7ead-4ef6-9398-c5d925fef5a0",e._sentryDebugIdIdentifier="sentry-dbid-1eeda9c6-7ead-4ef6-9398-c5d925fef5a0")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Vn=()=>{const e=_e(),l=xe(),i=se(),[a,p]=d.useState(!1),[u,c]=d.useState(!1),{tenantEmailDomain:v}=Ee(),t=z.getSignedInUser(),{useFeatureGate:n}=Pe(),{isFeatureEnabled:C}=n(W.isApAgingFeatureEnabled),{isFeatureEnabled:o}=n(W.isArAgingFeatureEnabled),{isFeatureEnabled:A}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:w}=n(W.isDebitCardFeatureEnabled),k=vn(),O=T((S=>Y(S))),P=T((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,F=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Te(w,O),b=we(O),D=[],U=_?.resources?.find((S=>S.resource==="/reports/top_expenses"))==null,h=_?.resources?.find((S=>S.resource==="/reports/task_card"))==null,r=O?.userRole!=null&&Dt(O?.userRole),x=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,E=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;U===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),x===!1&&D.push("bill_pay_card","bill_pay_promo_card"),E===!1&&D.push("reimbursement_card","reimbursement_promo_card"),D.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&D.push("rewards_card");const f=T((S=>{const V=[];C===!1&&V.push("accounts_payable_aging"),o===!1&&V.push("accounts_receivable_aging"),V.push("zeni_accounts_promo_card","treasury_promo_card"),A===!1&&V.push("rewards_card"),k===!1&&V.push("expense_automation_card");const J=jt(S,V);return Bt(J.reportsInOrder.map(($=>({fetchState:$.fetchState,error:$.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Ft(t.userId,F,O.tenantId,!0,!1,D)))}),[a,P,m,b,t,O.tenantId,i]);const j=d.useRef(!1),N=d.useCallback((()=>{const S={pathnameStackToGoBack:q(l.state?.pathnameStackToGoBack,l.pathname),message:"activation"};e(m?"../../checking":b?"../../cards":"../../dashboard",{state:S})}),[e,l,m,b]),G=d.useCallback((()=>{j.current||(j.current=!0,N())}),[N]);if(d.useEffect((()=>{const S=setTimeout((()=>c(!0)),3e3);return()=>clearTimeout(S)}),[]),d.useEffect((()=>{const S=setTimeout(G,6e3);return()=>clearTimeout(S)}),[G]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||G()}),[u,f,m,b,G]),P!=="Completed")return s.jsx(Q,{to:"../"});const L=O.company?.companyOnboardingInfo?.onboardingInfo,ee={timeSinceQuoteSign:L?.onboardingTimeSinceQuoteSigned??"",timeSinceQuoteSignInMinutes:L?.onboardingToQuoteSignMinutes??0,isKybDone:Ze(L?.businessVerified?.status),isKycDone:Ze(L?.identityVerified?.status),paymentType:"",paymentSource:"",qboConnectionSource:L?.accountingConnectionCreationMode??""};return s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:g,onLoad:S=>S.trackOnboardingDashboardActivation(ee)}),s.jsx(_n,{show:!0,onComplete:G})]})},Se=["reading_books","finance_graph","reconciliation","cfo_foundation"],Ie=["llm_fine_tuning","rag_knowledge_graph","personalized_context"],We=(e,l)=>{const i=new Map(e.map((a=>[a.key,a])));return l.map((a=>{return p=i.get(a)?.status,p==="starting"||p==="building"?p:"idle";var p}))},Xe=(e,l)=>{if(e.length===0)return!1;const i=new Map(e.map((a=>[a.key,a])));return l.every((a=>i.get(a)?.status==="ready"))},Ye=De.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  background-color: ${e=>e.theme.colors.grey4};
@@ -23,8 +23,8 @@ import{j as s}from"./liveblocks-BjcYyeQ6.js";import{t as Tt,A as $e}from"./Addre
23
23
  }
24
24
 
25
25
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
26
- `,tt=it((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,t={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},n=Y(e),C=Ae(e,i),o=pt(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xt(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Tn.fileMicroServiceBaseUrl,authParams:t},signedInUser:z.getSignedInUser(),currentTenant:n,isAdmin:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;return{onFetchLinkTokenClick:(t,n)=>{e(kn(t,n))},onEstablishConnectionClick:(t,n)=>{e(In(t,n))},onUpdatePaymentAccountStatus:(t,n,C)=>{e(Sn(t,n,C))},onUpdatePaymentAccountLoginStatus:(t,n)=>{e(bn(!1,t,n))},onEstablishConnectionSuccess:()=>{e(Cn(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:t=>{e(me({isQBOPopupOpen:t}))},onCompanyOfficerUpdated:t=>{const n=t.map((C=>{const{officerType:o,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:F,syncToken:m,selectDocument:b,role:D,ownership:U,isSelectedForVerification:h,userVerificationStatus:r,fileIds:E,isPhoneVerified:x}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:o,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Je(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:E,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:x}}));e(ze({officers:n}))},onGetOtp:(t,n)=>{e(yn(t,"CustomerOnboarding")),n!=null&&e(hn({officerType:n,phone:t}))},onResendOtp:t=>{e(fn(t,"CustomerOnboarding"))},onVerifyOtp:(t,n)=>{g.trackOnboardingPhoneVerified(),e(gn(t,n,"CustomerOnboarding"))},updateFilesEntity:t=>{e(mn({files:t}))},onDeleteFile:t=>{e(pn(t))},onEditFileName:(t,n)=>{e(ln(t,n.split(".")[0]))},onCompanyDetailsChanged:t=>{const{companyDescription:n,companyIndustry:C,companyIndustryType:o,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:F,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:U,stateOfIncorporation:h,incDate:r,companySourceOfFunds:E,companySourceOfFundsDescription:x,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:J,usNexusTypes:$}=t,M={companyId:i,companyDescription:n,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?un(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:U?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:E?.selectedOption??"",companySourceOfFundsDescription:x,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Je(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:J,usNexusTypes:$?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(t,n,C)=>{e(dn(i,!1,n,C,t))},onAddressEditHandler:t=>{if(t!=null){const n=Tt(t);e(ut({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);e(mt(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:t}})},onUpdateStep:t=>{e(dt({step:t}))},onUpdateSubStep:t=>{e(cn({subStep:t}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:t,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:t=>{e(ct(t))},handleConfirmCardSetupIntent:t=>{e(rn(t))},updateCardPaymentModalState:t=>{e(me({isCardPaymentPopupOpen:t}))},handleAddCardPaymentSource:(t,n,C)=>{e(sn(t,n,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(on())},handleResetCardPaymentErrorStatuses:()=>{e(an())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const t=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:t,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(nn(i)))},onIdentityDocumentUploadedForAutofill:t=>{if(i==null)return;const n=en(t.documentType);n!=null&&(g.trackOnboardingDocumentUploaded("kyc",n),e(tn({target:"onboarding",companyId:i,officerType:t.officerType,fileId:t.fileId,documentType:n})))},onCompanyDocumentUploadedForAutofill:t=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",t.documentType),e(Yt({target:"onboarding",companyId:i,fileId:t.fileId,documentType:t.documentType})))}}}))(xn),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=gt(),p=_e(),u=Ee(),c=se(),v=En(),t=ft(),[n,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=xe(),P=yt(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(W.isDebitCardFeatureEnabled),m=At("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=T((y=>y.onboardingCustomerViewState.fetchState)),D=T((y=>y.onboardingCustomerViewState.currentStep)),U=T((y=>y.onboardingCustomerViewState.uiState)),h=T((y=>Y(y))),r=T((y=>y.userRoleConfigState.fetchState)),E=T((y=>y.cardPaymentViewState)),x=X(E.addCardPaymentSourceStatus.fetchState),f=E.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pn(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",J=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(A(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{w||(ct(["card"]),k(!0))}),[w]),d.useEffect((()=>{x==="In-Progress"&&f==="Completed"&&c(Oe())}),[x,f]),d.useEffect((()=>{Dn(j,N,G,V,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Nt(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:J},Gt(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=T((y=>Ae(y,M)));d.useEffect((()=>{n||b!=="Not-Started"||M==null||(C(!0),c($t(M,!0,!m)))}),[n,b,M]);const te=h.externalConnections?.saveConnectionState,je=X(te);d.useEffect((()=>{je==="In-Progress"&&(te==="Completed"||te==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(te==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[te,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(dt({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Mt(!0))}),[r,c]);const ht=X(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&ht==null&&c(ut({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Ct=R.isInterimEmailSent,Be=z.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const bt=Te(F,h),St=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,It=ye===!0&&!lt(h),kt=h.productSettings.isTreasuryEnabled,Ue=Un({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=T((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),ne=T((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vt())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||ne||K(Ut(y))}),[y,ne,K]),Ot=d.useMemo((()=>{if(y==null||y==="")return[];const B=`private-encrypted-${y}`;return[`${B}.ledger-ingestion.counts-updated`,`${B}.ai-agents-activation.phase-changed`]}),[y]),vt=d.useCallback(((B,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(B!=="ledger-ingestion.counts-updated"){if(B==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Lt({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rt({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Fn({events:Ot,onEvent:vt,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=We(B,Se),I=We(B,Ie),ue=Xe(B,Se),Z=Xe(B,Ie),Ne=B.some((xt=>xt.status!=="idle")),oe=!ne&&!Ne,Ge=ne&&!Ne,_t=Ge?Se.map((()=>"building")):ae,Et=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:_t,backgroundRowStatuses:oe?void 0:Et,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,ne,Le])})({companyId:M});if(Fe===!0){if(!ye)return kt?s.jsx(Q,{to:"../../treasury"}):bt?s.jsx(Q,{to:"../../checking"}):St?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Fe===!1&&P?.loggedInUserRoleMap!=null)return Ct===!0&&It?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Un=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=jn(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bn({companyId:i}),t=T((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),n=T((r=>Y(r))),C=T((r=>r.tenantState.fetchState)),o=T((r=>Qt(r,i))),A=T((r=>Kt(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=n.tenantId,O=fe(n.userRole??[]);d.useEffect((()=>{a(zt(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,F=X(P);d.useEffect((()=>{F==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,F,_]);const m=o.externalConnections?.saveOAuthConnectionState,b=o.externalConnections?.saveOAuthConnectionError?.message,D=X(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const U=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=X(U);return d.useEffect((()=>{const r=U??{},E=h??{},x=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(E[f]!=="In-Progress")return;let j;try{j=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",x[f]?.message??"")}))}),[U,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,E])=>[r,E?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",nt()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",nt()))},onConnectHubSpot:(r,E)=>{const x=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(x==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:E,connection_id:x,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,E)=>{const x=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=x!=null?Ce(x):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",E),a(Wt(k,r,be(E)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zt(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Jt())},onSaveChargeBeeCredentials:(r,E)=>{const x=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;x!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Ht(k,x,be("revenue"),Ce("chargebee"),{api_key:r,site:E})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(qt(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:t})),[O,o,C,w,p,k,l,e,a,u,c,v,t])};function nt(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function at(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const ot=De.div`
26
+ `,tt=it((function(e,l){const{companyId:i,isAdmin:a,currentTenant:p,isOnAddressPage:u}=l,c=z.getSignedInUser(),v=p.tenantId,t={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:v??""},n=Y(e),C=Ae(e,i),o=pt(e),A=fe(p?.userRole??[])&&C.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",w=Xt(e.userRoleConfigState);return{onboardingCustomerView:C,analytics:g,isRefreshingViewInBackground:!1,isDisabled:A,companyTitles:w.companyTitles,connectedAccountProvider:n.company?.featuresActivationInfo.connectedAccountProvider??"",fileProps:{filesEndPoint:Tn.fileMicroServiceBaseUrl,authParams:t},signedInUser:z.getSignedInUser(),currentTenant:n,isAdmin:a,isOnAddressPage:u,cardPaymentView:o,isCardPaymentPopupOpen:!1,stripeKey:ge.stripeKey}}),(function(e,l){const{companyId:i,currentTenant:a,themeState:p,navigate:u,location:c}=l,{tenantEmailDomain:v}=a;return{onFetchLinkTokenClick:(t,n)=>{e(kn(t,n))},onEstablishConnectionClick:(t,n)=>{e(In(t,n))},onUpdatePaymentAccountStatus:(t,n,C)=>{e(Sn(t,n,C))},onUpdatePaymentAccountLoginStatus:(t,n)=>{e(bn(!1,t,n))},onEstablishConnectionSuccess:()=>{e(Cn(i,!0,!1))},handleOnConnectClick:()=>{g.trackOnboardingConnectQBO(),ie.handleClick()},updateQBOPopupState:t=>{e(me({isQBOPopupOpen:t}))},onCompanyOfficerUpdated:t=>{const n=t.map((C=>{const{officerType:o,userId:A,name:w,email:k,ssn:O,nationalityCountryCode:P,dob:_,phone:F,syncToken:m,selectDocument:b,role:D,ownership:U,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,isPhoneVerified:E}=C;let f;return b.selectDocumentType==="driverLicense"?f="driving_license":b.selectDocumentType==="passport"?f="passport":b.selectDocumentType==="stateId"?f="id_document":b.selectDocumentType==="ssnCard"&&(f="social_security_card"),{officerType:o,userId:A,firstName:w.firstName,lastName:w.lastName,email:k,ssn:O,nationalityCountryCode:P?.selectedOption!=null?Je(P.selectedOption):void 0,phone:F,birthday:_!=null?Ke(_?.toString()):_,syncToken:m,titleAtCompany:D.selectedOption,ownershipInCompany:U,documentTypeSelectedForVerification:f,isSelectedForVerification:h,userVerificationStatus:r,fileIds:x,additionalDocumentTypesRequestedForVerification:[],additionalSubmittedDocumentsForVerificationFileIds:[],areAdditionalDocumentsRequestedForVerification:!1,areAdditionalDocumentsSubmittedForVerification:!1,isPhoneVerified:E}}));e(ze({officers:n}))},onGetOtp:(t,n)=>{e(yn(t,"CustomerOnboarding")),n!=null&&e(hn({officerType:n,phone:t}))},onResendOtp:t=>{e(fn(t,"CustomerOnboarding"))},onVerifyOtp:(t,n)=>{g.trackOnboardingPhoneVerified(),e(gn(t,n,"CustomerOnboarding"))},updateFilesEntity:t=>{e(mn({files:t}))},onDeleteFile:t=>{e(pn(t))},onEditFileName:(t,n)=>{e(ln(t,n.split(".")[0]))},onCompanyDetailsChanged:t=>{const{companyDescription:n,companyIndustry:C,companyIndustryType:o,companyLegalName:A,companyTaxId:w,companyWebsite:k,companyPhone:O,primaryContactEmail:P,primaryContactName:_,primaryContactUserId:F,primaryContactSyncToken:m,syncToken:b,fileIds:D,typeOfIncorporation:U,stateOfIncorporation:h,incDate:r,companySourceOfFunds:x,companySourceOfFundsDescription:E,companySubIndustry:f,countriesOfOperations:j,purposeOfAccount:N,purposeOfAccountDescription:G,regulatedStatus:L,regulatedStatusDescription:ee,transactionVolume:S,transactionVolumeDescription:V,usNexus:J,usNexusTypes:$}=t,M={companyId:i,companyDescription:n,companyIndustry:C.selectedOption,companyIndustryType:o?.selectedOption??"",companyLegalName:A,taxIdOrEIN:w,website:k!=""&&k!=null?un(k):void 0,phone:O,syncToken:b,fileIds:D,incDate:r!=null?Ke(r?.toString()):r,typeOfIncorporation:U?.selectedOption??"",stateOfIncorporation:h?.selectedOption??"",companySourceOfFunds:x?.selectedOption??"",companySourceOfFundsDescription:E,companySubIndustry:f?.selectedOption??"",countriesOfOperations:j?.selectedOptions.map((R=>R.length===2?R:Je(R)))??[],purposeOfAccount:N?.selectedOption??"",purposeOfAccountDescription:G,regulatedStatus:L??"",regulatedStatusDescription:ee,transactionVolume:S?.selectedOption??"",transactionVolumeDescription:V,usNexus:J,usNexusTypes:$?.selectedOptions??[]},ce={userId:F,firstName:_.firstName,lastName:_.lastName,email:P,syncToken:m};e(ze({companyDetails:M,primaryContactDetails:ce}))},onAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onRegisteredAddressClick:(t,n)=>{const C=at(v,t,n),o=q(c.state?.pathnameStackToGoBack,c.pathname);u(C,{state:{pathnameStackToGoBack:o}})},onUpdateCustomerView:(t,n,C)=>{e(dn(i,!1,n,C,t))},onAddressEditHandler:t=>{if(t!=null){const n=Tt(t);e(ut({addressType:"subscription_billing_address",addressToCreate:n}))}},onSkipSetupClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);e(mt(i,!1,!1)),u("./activation",{state:{pathnameStackToGoBack:t}})},onUpdateStep:t=>{e(dt({step:t}))},onUpdateSubStep:t=>{e(cn({subStep:t}))},onZeniLogoClick:()=>{p.toggle()},handleLogOutClick:()=>{const t=q(c.state?.pathnameStackToGoBack,c.pathname);u("/signout",{replace:!0,state:{pathnameStackToGoBack:t,message:"logout"}})},handleCockpitClick:()=>{g.trackOnboardingFlowExited("cockpit"),window.open("/cockpit")},handleReferralsClick:()=>{u(`/${v}/rewards`)},handleCreateCardSetupIntent:t=>{e(ct(t))},handleConfirmCardSetupIntent:t=>{e(rn(t))},updateCardPaymentModalState:t=>{e(me({isCardPaymentPopupOpen:t}))},handleAddCardPaymentSource:(t,n,C)=>{e(sn(t,n,C))},handleFetchPaymentSources:()=>{e(Oe())},resetCardPaymentViewState:()=>{e(on())},handleResetCardPaymentErrorStatuses:()=>{e(an())},redirectToProductSuitePage:()=>{g.trackOnboardingFlowExited("product_suite");const t=q(c.state?.pathnameStackToGoBack,c.pathname);u(`/${v}/onboarding/thankyou`,{state:{pathnameStackToGoBack:t,message:"OnboardingThankyou"},replace:!0})},onAcknowledgeAiFinanceTeam:()=>{i!=null&&(g.trackOnboardingAiFinanceTeamAcknowledged(),e(nn(i)))},onIdentityDocumentUploadedForAutofill:t=>{if(i==null)return;const n=en(t.documentType);n!=null&&(g.trackOnboardingDocumentUploaded("kyc",n),e(tn({target:"onboarding",companyId:i,officerType:t.officerType,fileId:t.fileId,documentType:n})))},onCompanyDocumentUploadedForAutofill:t=>{i!=null&&(g.trackOnboardingDocumentUploaded("kyb",t.documentType),e(Yt({target:"onboarding",companyId:i,fileId:t.fileId,documentType:t.documentType})))}}}))(En),le=({taxCFOCustomer:e=!1,isOnAddressPage:l=!1,appContent:i})=>{const a=gt(),p=_e(),u=xe(),c=se(),v=xn(),t=ft(),[n,C]=d.useState(!1),[o,A]=d.useState(!1),[w,k]=d.useState(!1),{tenantEmailDomain:O}=Ee(),P=yt(),{useFeatureGate:_}=Pe(),{isFeatureEnabled:F}=_(W.isDebitCardFeatureEnabled),m=At("/:tenantEmailDomain/onboarding")!==null&&u.search?.includes("code"),b=T((y=>y.onboardingCustomerViewState.fetchState)),D=T((y=>y.onboardingCustomerViewState.currentStep)),U=T((y=>y.onboardingCustomerViewState.uiState)),h=T((y=>Y(y))),r=T((y=>y.userRoleConfigState.fetchState)),x=T((y=>y.cardPaymentViewState)),E=X(x.addCardPaymentSourceStatus.fetchState),f=x.addCardPaymentSourceStatus.fetchState,{code:j,realmId:N,state:G}=Pn(u.search),L=h.externalConnections?.accounting[0],ee=L?.connectionType,S=L?.connectionName,V=L?.connectionId??"",J=z.getSignedInUser()?.userId??"",$=d.useRef({realmId:"",connectionId:""});d.useEffect((()=>{o||(A(!0),c(Oe()))}),[o,c]),d.useEffect((()=>{w||(ct(["card"]),k(!0))}),[w]),d.useEffect((()=>{E==="In-Progress"&&f==="Completed"&&c(Oe())}),[E,f]),d.useEffect((()=>{Dn(j,N,G,V,J)===!0&&h.externalConnections?.saveConnectionState!=="In-Progress"&&b==="Completed"&&(c(Nt(h.tenantId,{connection_type:ee??"accounting",connection_name:S??"quickbooks_online",authorization_code:j,realm_id:N,connection_id:V,user_id:J},Gt(window.location.origin+"/onboarding/auth"))),$.current={realmId:N,connectionId:V},g.trackOnboardingSaveQBOConnection(N,V),p(u.pathname))}),[j,N,G,u.pathname,b]),d.useEffect((()=>{ie.isInitiated===!1&&b==="Completed"&&ie.init("/onboarding/auth",h.tenantEmailDomain)}),[b]);const M=h.companyId??z.getSignedInUserTenant(O)?.companyId,ce=fe(h?.userRole??[]),R=T((y=>Ae(y,M)));d.useEffect((()=>{n||b!=="Not-Started"||M==null||(C(!0),c($t(M,!0,!m)))}),[n,b,M]);const te=h.externalConnections?.saveConnectionState,je=X(te);d.useEffect((()=>{je==="In-Progress"&&(te==="Completed"||te==="Error")&&U.isQBOPopupOpen&&D==="connect_ledger"&&(te==="Completed"?g.trackOnboardingQBOConnectionSuccess($.current.realmId,$.current.connectionId):g.trackOnboardingQBOConnectionFailed($.current.realmId,$.current.connectionId,h.externalConnections?.saveOAuthConnectionError?.message??""),c(me({isQBOPopupOpen:!1})))}),[te,je,U.isQBOPopupOpen,D,g,c]),d.useEffect((()=>{b==="Completed"&&m&&(c(dt({step:"connect_ledger"})),c(me({isQBOPopupOpen:!0})))}),[m,b]),d.useEffect((()=>{r==="Not-Started"&&c(Mt(!0))}),[r,c]);const ht=X(R.companyDetailsLocalData?.addressStatus);d.useEffect((()=>{R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate==null&&R.companyDetailsLocalData?.addressStatus?.addressToCreate!=null&&ht==null&&c(ut({addressType:"company_registered_address",addressToCreate:R.companyDetailsLocalData?.addressStatus?.addressToCreate}))}),[R.companyDetailsLocalData?.addressStatus?.addressToCreate,R.companyDetailsLocalData?.registeredAddressStatus?.addressToCreate]);const Ct=R.isInterimEmailSent,Be=z.getSignedInUser();if(Be==null)throw Error("Can't access onboarding flow without signing in...");const bt=Te(F,h),St=we(h),Fe=h.company?.companyOnboardingInfo.isOnboardingCompleted,Ve=y=>y.trackPageLoaded(ve.Event.onboardingPage),ye=h.productSettings.isOtherProductsEnabled,It=ye===!0&&!lt(h),kt=h.productSettings.isTreasuryEnabled,Ue=Un({tenantEmailDomain:O??"",signedInUserEmail:Be.userEmail??"",companyId:M}),Re=(({companyId:y})=>{const K=se(),de=T((B=>B.onboardingCustomerViewState?.aiAgentsActivation)),ne=T((B=>Y(B).company?.companyOnboardingInfo?.onboardingInfo?.onboardingAiActivationInfo?.isOnboardingAiActivationViewed??!1)),he=d.useCallback((()=>{K(Vt())}),[K]);d.useEffect((()=>{he()}),[he]);const Le=d.useCallback((()=>{y==null||y===""||ne||K(Ut(y))}),[y,ne,K]),Ot=d.useMemo((()=>{if(y==null||y==="")return[];const B=`private-encrypted-${y}`;return[`${B}.ledger-ingestion.counts-updated`,`${B}.ai-agents-activation.phase-changed`]}),[y]),vt=d.useCallback(((B,ae)=>{if(ae==null||typeof ae!="object")return;const I=ae;if(B!=="ledger-ingestion.counts-updated"){if(B==="ai-agents-activation.phase-changed"){const ue=typeof I.phase_key=="string"?I.phase_key:typeof I.key=="string"?I.key:"",Z=typeof I.status=="string"?I.status:"idle";if(ue==="")return;K(Lt({key:ue,status:Z==="starting"||Z==="building"||Z==="ready"?Z:"idle",startedAt:typeof I.started_at=="string"?I.started_at:void 0,completedAt:typeof I.completed_at=="string"?I.completed_at:void 0}))}}else K(Rt({customerCount:typeof I.customer_count=="number"?I.customer_count:void 0,glAccountCount:typeof I.gl_account_count=="number"?I.gl_account_count:void 0,targetTransactionCount:typeof I.target_transaction_count=="number"?I.target_transaction_count:void 0,transactionCount:typeof I.transaction_count=="number"?I.transaction_count:void 0,vendorCount:typeof I.vendor_count=="number"?I.vendor_count:void 0}))}),[K]);return Fn({events:Ot,onEvent:vt,onSubscribed:he}),d.useMemo((()=>{const B=de?.phases??[],ae=We(B,Se),I=We(B,Ie),ue=Xe(B,Se),Z=Xe(B,Ie),Ne=B.some((Et=>Et.status!=="idle")),oe=!ne&&!Ne,Ge=ne&&!Ne,_t=Ge?Se.map((()=>"building")):ae,xt=Ge?Ie.map((()=>"building")):I;return{ledgerRowStatuses:oe?void 0:_t,backgroundRowStatuses:oe?void 0:xt,showLedgerReadyInLabel:oe?void 0:ue,showBackgroundReadyInLabel:oe?void 0:Z,forceContinueEnabled:!oe||void 0,counts:de?.counts,onContinueClicked:Le}}),[de?.phases,de?.counts,ne,Le])})({companyId:M});if(Fe===!0){if(!ye)return kt?s.jsx(Q,{to:"../../treasury"}):bt?s.jsx(Q,{to:"../../checking"}):St?s.jsx(Q,{to:"../../cards"}):s.jsx(Q,{to:"../../dashboard"});const y=R.updateStatus.fetchState==="In-Progress";if(ye&&!y)return e?s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:K=>Ve(K)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]}):s.jsx(Q,{to:"../../onboarding/thankyou"})}else if(Fe===!1&&P?.loggedInUserRoleMap!=null)return Ct===!0&&It?s.jsx(Q,{to:"../../onboarding/thankyou"}):s.jsxs(Ye,{children:[s.jsx(re,{analytics:g,onLoad:y=>Ve(y)}),s.jsx(tt,{navigate:p,location:u,companyId:M,currentTenant:h,isAdmin:ce,isOnAddressPage:l,themeState:t,googleAPIKey:ge.googleMapsAPIKey,integrationsSectionProps:Ue,aiAgentsActivationProps:Re,meetingUrl:a("onboarding_overview")}),i!=null?s.jsx(et,{windowSize:v,skipLegacyDrawerOffset:l&&h.productSettings.isOtherProductsEnabled!==!0,children:i}):null]});return null},ke="external_integrations",Un=({tenantEmailDomain:e,signedInUserEmail:l,companyId:i})=>{const a=se(),{pendingAutoFocusTabId:p}=jn(),{plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v}=Bn({companyId:i}),t=T((r=>r.plaidAccountViewState.external_account.plaidConnectionDetails)),n=T((r=>Y(r))),C=T((r=>r.tenantState.fetchState)),o=T((r=>Qt(r,i))),A=T((r=>Kt(r,ke))),w=d.useMemo((()=>new Set(A.map((r=>r.additionalInfo)).filter((r=>r!=null)))),[A]),k=n.tenantId,O=fe(n.userRole??[]);d.useEffect((()=>{a(zt(ke))}),[a]);const P=o.externalConnections?.saveAPIKeyConnectionState,_=o.externalConnections?.saveAPIKeyConnectionError?.message,F=X(P);d.useEffect((()=>{F==="In-Progress"&&(P==="Completed"?g.trackIntegrationConnected("chargebee","Onboarding","revenue"):P==="Error"&&g.trackIntegrationConnectFailed("chargebee","Onboarding","revenue",_??""))}),[P,F,_]);const m=o.externalConnections?.saveOAuthConnectionState,b=o.externalConnections?.saveOAuthConnectionError?.message,D=X(m);d.useEffect((()=>{D==="In-Progress"&&(m==="Completed"?g.trackIntegrationConnected("hubspot","Onboarding","revenue"):m==="Error"&&g.trackIntegrationConnectFailed("hubspot","Onboarding","revenue",b??""))}),[m,D,b]);const U=o.externalConnections?.saveConnectorCredentialsStateBySlug,h=X(U);return d.useEffect((()=>{const r=U??{},x=h??{},E=o.externalConnections?.saveConnectorCredentialsErrorBySlug??{};Object.keys(r).forEach((f=>{if(x[f]!=="In-Progress")return;let j;try{j=Ce(f)}catch{return}r[f]==="Completed"?g.trackIntegrationConnected(j,"Onboarding","payments"):r[f]==="Error"&&g.trackIntegrationConnectFailed(j,"Onboarding","payments",E[f]?.message??"")}))}),[U,h,o]),d.useMemo((()=>({isAdmin:O,analytics:g,referrer:"Onboarding",integrationsView:o,isLoading:C==="In-Progress",notifyMeRegisteredSlugs:w,autoFocusTabId:p??void 0,saveChargeBeeState:o.externalConnections?.saveAPIKeyConnectionState??"Not-Started",saveChargeBeeError:o.externalConnections?.saveAPIKeyConnectionError?.message,saveHubSpotState:o.externalConnections?.saveOAuthConnectionState??"Not-Started",saveHubSpotError:o.externalConnections?.saveOAuthConnectionError?.message,saveConnectorCredentialsStateBySlug:o.externalConnections?.saveConnectorCredentialsStateBySlug??{},saveConnectorCredentialsErrorBySlug:Object.fromEntries(Object.entries(o.externalConnections?.saveConnectorCredentialsErrorBySlug??{}).map((([r,x])=>[r,x?.message]))),deleteConnectionState:o.externalConnections?.deleteConnectionState??"Not-Started",deleteConnectionError:o.externalConnections?.deleteConnectionError?.message,onConnectGmail:()=>{g.trackIntegrationConnectClicked("gmail","Onboarding","email"),a(Qe(k,"gmail",nt()))},onConnectOutlook:()=>{g.trackIntegrationConnectClicked("outlook","Onboarding","email"),a(Qe(k,"outlook",nt()))},onConnectHubSpot:(r,x)=>{const E=o.externalConnections?.revenue?.find((j=>j.connectionName==="hubspot"))?.connectionId;if(E==null)return;g.trackIntegrationCredentialsSubmitted("hubspot","Onboarding","revenue");const f=`${window.location.origin}/oauth/hubspot/callback`;sessionStorage.setItem("hubspot_oauth_pending",JSON.stringify({client_id:r,client_secret:x,connection_id:E,redirect_uri:f,tenant_id:k})),window.location.href=`https://app.hubspot.com/oauth/authorize?client_id=${encodeURIComponent(r)}&scope=${encodeURIComponent("oauth crm.objects.deals.read crm.objects.owners.read")}&redirect_uri=${encodeURIComponent(f)}`},onDisconnect:(r,x)=>{const E=[...o.externalConnections?.accounting??[],...o.externalConnections?.payments??[],...o.externalConnections?.revenue??[]].find((j=>j.connectionId===r))?.connectionName;let f;try{f=E!=null?Ce(E):void 0}catch{f=void 0}f!=null&&g.trackIntegrationDisconnected(f,"Onboarding",x),a(Wt(k,r,be(x)))},onNotifyMe:r=>{g.trackIntegrationsNotifyMeClicked("Onboarding",r),a(Zt(ke,r,l))},onReconnectQBO:()=>{ie.init("/onboarding/auth",e),ie.handleClick()},onRefreshClick:()=>{o.integrations.refreshQBO.fetchState!=="In-Progress"&&a(Jt())},onSaveChargeBeeCredentials:(r,x)=>{const E=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee"))?.connectionId;E!=null&&(g.trackIntegrationCredentialsSubmitted("chargebee","Onboarding","revenue"),a(Ht(k,E,be("revenue"),Ce("chargebee"),{api_key:r,site:x})))},onSaveConnectorCredentials:r=>{g.trackIntegrationCredentialsSubmitted(r.connectionName,"Onboarding","payments"),a(qt(k,be("payments"),r))},plaidAccounts:u,onAddPlaidAccount:c,onReLoginPlaidAccount:v,plaidConnectionDetails:t})),[O,o,C,w,p,k,l,e,a,u,c,v,t])};function nt(){const e=new URL(window.location.href);return e.searchParams.set("onboarding_step","connect_data_source"),e.toString()}function at(e,l,i){let a=`/${e}/onboarding/address`;return a=i!=null?a.concat(`/edit/${l}/${encodeURIComponent(i)}`):a.concat(`/new/${l}`),a}const ot=De.div`
27
27
  display: flex;
28
28
  height: 100vh;
29
29
  background-color: ${e=>e.theme.colors.grey4};
30
- `,st=it((function(e,l){const{companyId:i,currentTenant:a}=l,p=Ae(e,i),u=pt(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(a?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:a}}),(function(e,l){const{currentTenant:i,themeState:a,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{a.toggle()},handleLogOutClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:v,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${c}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(An),Rn=()=>{const e=gt(),l=_e(),i=se(),a=Ee(),p=ft(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=xe(),t=yt(),[n,C]=d.useState(!1);d.useEffect((()=>{n===!1&&a.state?.message==="OnboardingThankyou"&&C(!0)}),[a.state]);const o=T((m=>Y(m))),A=o.productSettings.isOtherProductsEnabled,w=A===!0&&!lt(o);d.useEffect((()=>{i(mt(k,!1,!w))}),[]);const k=o.companyId??z.getSignedInUserTenant(v)?.companyId;if(t.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Te(c,o),P=we(o),_=T((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=o.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!0&&w&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",On(o.productSettings))}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&F===!1&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):s.jsx(wn,{});{const m={pathnameStackToGoBack:a.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rt(){return typeof Me=="function"?Me():void 0}let pe=0;function Ln(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const a=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rt();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&a()}),1e3)),()=>{l=!0,a(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rt();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Ln(),s.jsxs(Pt,{children:[s.jsx(H,{path:"/",element:s.jsx(le,{})}),s.jsx(H,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(H,{path:"/thankyou",element:s.jsx(Rn,{})}),s.jsx(H,{path:"/activation",element:s.jsx(Vn,{})}),s.jsx(H,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"*",element:s.jsx(wt,{})})]})}export{pa as default};
30
+ `,st=it((function(e,l){const{companyId:i,currentTenant:a}=l,p=Ae(e,i),u=pt(e);return{hasVerifiedBankAccount:(p.paymentAccount?.providerVerificationStatus?.code?.includes("verified")??!1)||(u.bankAccountsList[0]?.providerVerificationStatus?.code?.includes("verified")??!1),isDisabled:fe(a?.userRole??[])&&p.updateStatus.fetchState!=="In-Progress"?void 0:"readonly",signedInUser:z.getSignedInUser(),currentTenant:a}}),(function(e,l){const{currentTenant:i,themeState:a,navigate:p,location:u}=l,{tenantEmailDomain:c}=i;return{onZeniLogoClick:()=>{a.toggle()},handleLogOutClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p("/signout",{replace:!0,state:{pathnameStackToGoBack:v,message:"logout"}})},handleCockpitClick:()=>{window.open("/cockpit")},handleReferralsClick:()=>{p(`/${c}/rewards`)},handleUpdatePaymentAddressDetailClick:()=>{const v=q(u.state?.pathnameStackToGoBack,u.pathname);p(`/${c}/onboarding/billing/edit`,{state:{pathnameStackToGoBack:v,message:"UpdatePaymentAddressDetail"}})}}}))(An),Rn=()=>{const e=gt(),l=_e(),i=se(),a=xe(),p=ft(),{useFeatureGate:u}=Pe(),{isFeatureEnabled:c}=u(W.isDebitCardFeatureEnabled),{tenantEmailDomain:v}=Ee(),t=yt(),[n,C]=d.useState(!1);d.useEffect((()=>{n===!1&&a.state?.message==="OnboardingThankyou"&&C(!0)}),[a.state]);const o=T((m=>Y(m))),A=o.productSettings.isOtherProductsEnabled,w=A===!0&&!lt(o);d.useEffect((()=>{i(mt(k,!1,!w))}),[]);const k=o.companyId??z.getSignedInUserTenant(v)?.companyId;if(t.loggedInUser==null)throw Error("Can't access onboarding flow without signing in...");const O=Te(c,o),P=we(o),_=T((m=>m.onboardingCustomerViewState.updateStatus.fetchState)),F=o.company?.companyOnboardingInfo.isOnboardingCompleted;if(F!==!0||w)return _==="Completed"&&F===!0&&w&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingLandingPage,"Onboarding",On(o.productSettings))}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):_==="Completed"&&F===!1&&t?.loggedInUserRoleMap!=null?s.jsxs(ot,{children:[s.jsx(re,{analytics:g,onLoad:m=>{m.trackPageLoaded(ve.Event.onboardingInterimPage)}}),s.jsx(st,{navigate:l,showUpdatePaymentDetailButton:A,location:a,companyId:k,currentTenant:o,themeState:p,isVisitingFirstTime:n,meetingUrl:e("onboarding_overview")})]}):s.jsx(wn,{});{const m={pathnameStackToGoBack:a.state?.pathnameStackToGoBack,message:"activation"};return O?s.jsx(Q,{to:"../../checking",state:m,replace:!0}):P?s.jsx(Q,{to:"../../cards",state:m,replace:!0}):s.jsx(Q,{to:"../../dashboard",state:m,replace:!0})}};function rt(){return typeof Me=="function"?Me():void 0}let pe=0;function Ln(){d.useEffect((()=>{if(!ge.sentryDsn?.trim())return;let e,l=!1,i=0;const a=()=>{e!==void 0&&(clearInterval(e),e=void 0)},p=()=>{const u=rt();return u!==void 0&&(u.flush(),!0)};return pe+=1,p()||(e=setInterval((()=>{i+=1,(l||p()||i>=10)&&a()}),1e3)),()=>{l=!0,a(),pe-=1,queueMicrotask((()=>{pe===0&&(function(){const u=rt();if(u===void 0)return;const c=()=>{if(pe===0)try{u.startBuffering()}catch{}};u.stop().then(c,c)})()}))}}),[])}function pa(){return Ln(),s.jsxs(Pt,{children:[s.jsx(H,{path:"/",element:s.jsx(le,{})}),s.jsx(H,{path:"/billing/edit",element:s.jsx(le,{taxCFOCustomer:!0})}),s.jsx(H,{path:"/thankyou",element:s.jsx(Rn,{})}),s.jsx(H,{path:"/activation",element:s.jsx(Vn,{})}),s.jsx(H,{path:"/address/edit/:addressType/:addressId",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"/address/new/:addressType",element:s.jsx(le,{isOnAddressPage:!0,appContent:s.jsx($e,{})})}),s.jsx(H,{path:"*",element:s.jsx(wt,{})})]})}export{pa as default};
@@ -0,0 +1,20 @@
1
+ import{j as d}from"./liveblocks-CIxx6Ub6.js";import{i as K,j as _,g as Z,u as $,h as H,l as ne,k as oa,n as ht,o as P,N as vn}from"./core-Caq7Zbsp.js";import{fF as B,VV as He,bE as sa,br as Ee,Xh as En,ka as Tn,Xi as Vt,Xj as wn,kd as ft,Xk as Qe,Xl as xn,ki as Dn,Xm as Gt,Xn as Pn,km as gt,Xo as We,Xp as On,Xq as Fn,Wd as jn,lo as Rn,Xr as Mn,bn as Je,Xs as ra,WT as le,bc as ia,lC as ca,ll as la,WV as de,WU as ae,fE as da,ga as Bn,gq as bt,Xt as Un,Xu as Ln,Xv as ua,Xw as Oe,D$ as Be,E0 as Ue,Eo as Te,Ei as ue,E4 as Le,Xx as Yn,b$ as Ye,Xy as Vn,Xz as Gn,XA as ma,XB as Fe,XC as Nn,ei as et,Aa as pa,XD as Xn,XE as ha,XF as $n,XG as zn,XH as Kn,XI as St,UR as _t,ua as we,l$ as xe,Ey as kt,Ah as qn,Ao as Qn,XJ as Wn,XK as Zn,E1 as Nt,XL as Hn,Ad as Ie,A8 as fa,XM as ge,XN as Xt,XO as Jn,XP as yt,UQ as At,Cl as ga,XQ as eo,XR as ba,XS as to,XT as ao,XU as no,XV as It,CA as oo,CH as so,XW as ro,XX as io,E3 as $t,XY as co,Cj as Ca,XZ as be,X_ as zt,X$ as lo,bq as Sa,ED as _a,Y0 as uo,Y1 as ka,Y2 as mo,Y3 as po,Y4 as ho,Y5 as vt,Ev as fo,Ex as go,Y6 as bo,Y7 as Co,E2 as Kt,Y8 as So,EB as ya,Y9 as Ce,Ya as qt,Yb as _o,Yc as ko,Yd as Aa,lQ as Ia,pX as va,lV as Ea,pV as Ta,pU as wa,pT as xa,BI as yo,dc as Ao,pQ as Io,Uc as vo,q5 as Eo,Ye as To,Yf as wo,Yg as xo,b5 as Et,p$ as Do,ic as Po,gI as Oo,p_ as Fo,le as jo,pY as Ro,pW as Mo,d_ as Bo,dZ as Uo}from"./zeni-epic-state-DROyxOLw.js";import{z as U,aw as oe,p as O,k as w,G as q,bc as Lo,at as Ve,a9 as Ge,bd as Da,U as N,be as Yo,bf as Pa,E as Vo,bg as Go,bh as No,a as Oa,a2 as Fa,d as ja,as as Xo,bi as $o,ap as zo,N as Tt,bj as Ra,y as re,bk as Ma,bl as Ba,av as Ua,bm as Ko,aj as Ne,W as Xe,bn as qo,X as Qo,bo as Wo,f as G,Q as Zo,l as Ho,a5 as Jo,ar as es,bp as ts,bq as as,br as ns,bs as ve}from"./index-DOXJLxdR.js";import{n as wt}from"./mui-DI0hUuFr.js";import{a as b}from"./sentry-BCPOyc0G.js";import{w as La}from"./withTransactionSidePanel-C1wVwRW0.js";import{c as Ya,t as De,f as me,b as xt,a as Dt,v as os}from"./routePaths-C1OqXYGB.js";import{u as se}from"./useAskAiCfoHostNavButtonProps-BvhP40c_.js";import Me from"./NotFoundScreen-C2GrPpNy.js";import{u as Pt}from"./useInitialThreadRequest-uu8NipM7.js";import{t as Va}from"./analyticsHelper-DHPcRAai.js";import{C as ss}from"./CompanyPassportScreen-C0r5_u0C.js";import{u as rs}from"./useAiCfoDashboardSuggestedQuestionsChips-BO7_rPaJ.js";import{F as is}from"./FeaturePreviewScreen-t-KcIePh.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./TransactionDetailScreen-fc6wRDCa.js";import"./decodeURIComponentSafe-DmjyT4t5.js";import"./expenseAutomationHelper-B83Qa5Jl.js";import"./stripSplatSuffix-Dmnnw5Oe.js";import"./MobileAppDrawer-DqgtjBKX.js";import"./InboxNotificationsProvider-DcarX1j5.js";import"./useTaskManagerAccess-DxrmaJfc.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]="e7666a96-794c-42c9-a215-bb83356cc962",e._sentryDebugIdIdentifier="sentry-dbid-e7666a96-794c-42c9-a215-bb83356cc962")}catch{}})();const cs=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=K(),s=U.getSignedInUser(),i=_((S=>S.tenantState.currentTenantId)),l=_((S=>B(S))),{tenantEmailDomain:m}=K(),p=Z(),h=l?.companyName??"",f={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i??""},c=b.useMemo((()=>({authParams:f,companyName:h,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:He()})),[]),u=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),C=$(),g=H(),y=_((S=>En(S,u,o))),E=b.useCallback((()=>{o!=null&&y.fetchState!=="In-Progress"&&y.fetchState!=="Completed"&&C(Tn(o,u))}),[u]),I=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),k=b.useCallback(((S,A)=>{C(Vt({sortKey:S,sortOrder:A}))}),[]),T=b.useCallback((S=>{C(Vt({downloadState:S}))}),[]),R=b.useCallback((S=>{if(e)e(S.transactionId,S.transactionType);else if(m!=null){const A=Ya({id:S.transactionId,type:S.transactionType},m);g(A);const L=O(p.state?.pathnameStackToGoBack,p.pathname);g(A,{state:{pathnameStackToGoBack:L}})}}),[m,e]),x=b.useCallback((()=>{y.vendor!=null&&w.trackApAgingDetail("AP Aging",u.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),y.vendor.id,y.vendor.name)}),[y.vendor,u]);return b.useEffect((()=>{E()}),[]),b.useEffect((()=>{y.fetchState==="Completed"&&x()}),[x,y.fetchState]),d.jsx(Lo,{apAgingDetail:y,downloadParams:c,reportDate:u,analytics:w,onTransactionClick:R,onReload:E,onBackClick:I,onColumnSortConfigChanged:k,updateDownloadStateHandler:T,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),ls=()=>{const e=$(),a=H(),t=_((k=>wn(k))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AP Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=U.getSignedInUser(),s=_((k=>k.tenantState.currentTenantId)),i=_((k=>B(k))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${oe}/agingReport`,timezone:He()})),[]),h=t.apAgingUIState.selectedDate??Ee(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(ft(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((k=>{e(Qe({searchString:k}))}),[]),C=b.useCallback(((k,T)=>{e(Qe({sortKey:T,sortOrder:k}))}),[]),g=b.useCallback((k=>{a(`./${k}/${h.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),y=b.useCallback((k=>{e(Qe({downloadState:k}))}),[]),E=b.useCallback(((k,T)=>{}),[]),I=b.useCallback(((k,T)=>{e(Qe({selectedDate:k,agingDateSelectionType:T})),e(ft(k))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:w,onLoad:k=>k.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(Da,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:w,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:y,onSelectedDateChanged:I,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ds=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=K(),s=U.getSignedInUser(),i=_((x=>B(x))),{tenantEmailDomain:l}=K(),m=Z(),p=i.companyName,h={userId:s?.userId??"",sessionId:s?.zeniSessionId??"",tenantId:i.tenantId},f=b.useMemo((()=>({authParams:h,companyName:p,downloadEndPoint:`${oe}/agingDetailedReport`,timezone:He()})),[]),c=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),u=$(),C=H(),g=_((x=>xn(x,c,o))),y=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Dn(o,c))}),[c]),E=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),I=b.useCallback(((x,S)=>{u(Gt({sortKey:x,sortOrder:S}))}),[]),k=b.useCallback((x=>{u(Gt({downloadState:x}))}),[]),T=b.useCallback((x=>{if(e)e(x.transactionId,x.transactionType);else if(l!=null){const S=Ya({id:x.transactionId,type:x.transactionType},l);C(S);const A=O(m.state?.pathnameStackToGoBack,m.pathname);C(S,{state:{pathnameStackToGoBack:A}})}}),[l,e]),R=b.useCallback((()=>{g.customer!=null&&w.trackArAgingDetail("AR Aging",c.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{y()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&R()}),[g.fetchState,R]),d.jsx(Yo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:w,onTransactionClick:T,onReload:y,onBackClick:E,onColumnSortConfigChanged:I,updateDownloadStateHandler:k,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),us=()=>{const e=$(),a=H(),t=_((I=>Pn(I))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AR Aging"});Ve({isDataReady:t.fetchState==="Completed"});const r=U.getSignedInUser(),s=_((I=>B(I))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${oe}/agingReport`,timezone:He()})),[]),p=t.arAgingUIState.selectedDate??Ee(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((I=>{e(We({searchString:I}))}),[]),u=b.useCallback(((I,k)=>{e(We({sortKey:k,sortOrder:I}))}),[]),C=b.useCallback((I=>{a(`./${I}/${p.format(q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((I=>{e(We({downloadState:I}))}),[]),y=b.useCallback(((I,k)=>{e(We({selectedDate:I,agingDateSelectionType:k})),e(gt(I))}),[]),E=b.useCallback(((I,k)=>{e(On({nodeId:I,isCollapsed:k}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ge,{analytics:w,onLoad:I=>I.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(Da,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:w,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:y,onNodeCollapseToggled:E,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ga=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Na(e,a){const t=jn(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=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(Rn(n,o))}}}const ms=ne((function(e){const a=Fn(e).accountsInOrder.map(((t,n)=>Ga(t,n)));return{sectionTitle:q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:w}}),Na)(Pa),ps=ne((function(e){const a=Mn(e).accountsInOrder.map(((o,r)=>Ga(o,r))),t=U.getSignedInUser(),n=Je(t);return{sectionTitle:q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:w}}),Na)(Pa);function hs(){const e=H(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>B(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Me,{}):d.jsx(ms,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function fs(){const e=H(),a=Z(),{tenantEmailDomain:t}=K(),n=_((o=>B(o).company?.companyInfo.firstMonthOfFY??1));return _((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Me,{}):d.jsx(ps,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const gs=wt.div`
2
+ display: flex;
3
+ flex: 1 1 auto;
4
+ min-height: 100%;
5
+ flex-direction: column;
6
+ background-color: ${e=>e.theme.colors.grey4};
7
+ `,bs=wt.div`
8
+ display: flex;
9
+ flex: 1 1 auto;
10
+ flex-direction: column;
11
+ align-items: center;
12
+ background-color: ${e=>e.theme.colors.grey4};
13
+ `;function Cs({title:e,reportId:a,entityAutoCompleteView:t,autoCompleteText:n,isAiCfoAccessEnabled:o,onAskAiCfoClick:r}){const s=H(),i=$(),l=Z(),{tenantEmailDomain:m}=K(),p=Vo();return d.jsxs(gs,{children:[d.jsx(Go,{source:a==="cash_balance"?"CashBalanceDetailScreen":"CardBalanceDetailScreen",title:e,onBackClick:()=>{s("../")},hideSearchBtn:!0,backgroundColor:p.colors.grey4,searchAutoComplete:{autoCompleteData:{entityAutoCompleteView:t,autoCompleteText:n},autoCompleteActions:{onAutoCompleteInputChange:h=>{h.trim().length>=2?i(de({searchString:h,searchOrigin:"navbar"})):h.trim().length===0&&i(ae("navbar"))},onAutoCompleteEntity:h=>{n!=null&&w?.trackSearch(N.Event.search,Ss(a),h.type,h.name,n);const f=me(h,m),c=O(l.state?.pathnameStackToGoBack,l.pathname);s(f,{state:{pathnameStackToGoBack:c}})}}},rightSideComponent:d.jsx(No,{isAiCfoAccessEnabled:o,onAskAiCfoClick:r})}),d.jsx(bs,{children:a==="cash_balance"?d.jsx(hs,{}):d.jsx(fs,{})})]})}function Qt(){const e=Z(),a=$(),t=_((c=>c.cashBalanceState.fetchState)),n=_((c=>c.cardBalanceState.fetchState)),o=U.getSignedInUser();if(o==null)throw Error("Can't access dashboard detail without signing in...");const r=ra((c=>{const u=ia(c,"/").split("/");return u[u.length-1]})(e.pathname));let s="Not-Started",i="";const l=q.getLocalizedStrings();switch(r){case"cash_balance":s=t,i=l.common.texts.cashBalance;break;case"card_balance":s=n,i=l.reportTitleById.card_balance;break;default:console.error(`${r} is not supported!`)}const{isAiCfoAccessEnabled:m,onAskAiCfoClick:p}=se({mobileExploreReferrer:r==="card_balance"?"Card Balance":"Cash Balance"});Ve({isDataReady:s==="Completed"});const h=_((c=>c.entityAutoCompleteState.autoCompleteText.navbar)),f=_((c=>le(c,"navbar")));return b.useEffect((()=>{s==="Not-Started"&&(function(c,u){switch(u){case"card_balance":c(la());break;case"cash_balance":c(ca());break;default:throw new Error(`balance report type ${u} is not yet supported`)}})(a,r)}),[o,a,s]),d.jsxs(d.Fragment,{children:[s==="Completed"?d.jsx(Ge,{analytics:w,onLoad:c=>((u,C)=>{switch(C){case"card_balance":u.trackPageLoaded(N.Event.cardBalance);break;case"cash_balance":u.trackPageLoaded(N.Event.cashBalance);break;default:console.error(`Analytics: Not tracking Page Loaded for ${C}!`)}})(c,r)}):null,d.jsx(Cs,{title:i,reportId:r,autoCompleteText:h,entityAutoCompleteView:f,isAiCfoAccessEnabled:m,onAskAiCfoClick:p})]})}const Ss=e=>{switch(e){case"cash_balance":return"Cash Balance";case"card_balance":return"Card Balance";default:return"Dashboard"}},_s=[],Wt="insights_section";function $e(e){const{mobileExploreReferrer:a}=e,t=$(),n=H(),o=Z(),{tenantEmailDomain:r}=K(),{setIsAiCfoOpen:s,setAiCfoSidePanelQuestionToSubmit:i}=Oa(),l=Fa(),m=Ua(l),p=oa(),h=_((F=>F.tenantState.fetchState==="Completed"||F.tenantState.activeTenantFetchState.fetchState==="Completed"?B(F):void 0)),f=h?.masterTOSInfo?.isMasterTOSAccepted??!1,c=_((F=>da(F))),u=c.uiState?.currentChatSessionId,C=c.allSessionsWithOrderedQuestionAnswers??_s,g=U.getSignedInUser()?.userId,y=ja(),E=Xo()&&y&&r!=null,I=$o(),k=zo(!0),T=_((F=>I!=null?Bn(F,I):void 0)),{useDynamicConfig:R}=Tt(),{configValue:x}=R(Ra.aiCfoMessageDynamicConfig),S=b.useMemo((()=>Array.isArray(x.default_message_list)?x.default_message_list:[]),[x.default_message_list]),A=b.useMemo((()=>S.slice(0,2)),[S]),L=I!=null&&T!=null&&T.fetchState!=="Completed"&&T.fetchState!=="Error"&&(k||T.fetchState==="In-Progress"),pe=b.useMemo((()=>{if(I==null||T?.fetchState==="Error")return A;if(L)return[];const F=(T?.suggestedQuestions??[]).map((J=>J.trim())).filter((J=>J.length>0)).slice(0,2);return F.length===0?A:F}),[A,L,I,T?.fetchState,T?.suggestedQuestions]),Pe=b.useCallback(((F,J)=>{if(g==null||F.trim()==="")return;if(!f)return void re({location:o,navigate:n,mergeState:{referrer:a,aiCfoInitialQuestion:F,aiCfoInitialSubmissionSource:Wt,aiCfoSuggestionIndex:J}});const Ke=Ma(p.getState());if(m){const qe=O(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:qe,referrer:a,aiCfoInitialQuestion:F,aiCfoShouldSubmit:!Ke}})}else{if(Ke)return t(bt(F)),void s(!0);i(F),s(!0),Ba(t,F,Wt,u,C,g,J,void 0)}}),[C,u,t,f,m,o,a,n,s,i,p,r,g]),Se=b.useCallback((()=>{if(f)if(m){const F=O(o.state?.pathnameStackToGoBack,o.pathname);n(`/${r}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:F,referrer:a}})}else s(!0);else re({location:o,navigate:n,mergeState:{referrer:a}})}),[f,m,o,a,n,s,r]);return b.useMemo((()=>{if(E)return{isSuggestedQuestionsLoading:L,onAskSomethingElseClick:Se,onSuggestedQuestionClick:Pe,suggestedQuestions:pe}}),[E,L,Se,Pe,pe])}const ze=Ko,ks=ne((function(e){const a=Un(e),t=Ln(e),n=ua(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_in_cash_out,i=U.getSignedInUser(),l=e.tenantState.currentTenantId,m=B(e),p=m?.companyName??"",h={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:l??""},f=e.entityAutoCompleteState.autoCompleteText.navbar,c=le(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:p,statementEndPoint:`${oe}/statement`,authParams:h},analytics:w,autoCompleteData:{autoCompleteText:f,entityAutoCompleteView:c}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(Yn(t))},onTimeframeSelectionChanged:()=>{},onCOABalancesRangeChanged:(t,n)=>{e(Le(t,n)),e(Oe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(Te("month")),e(ue(a.firstMonthOfFY,t)),e(Oe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Be(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Oe({resetLeftScroll:!0}))),50)},onElementCollapseStateChanged:(t,n)=>{e(Oe({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{e(Oe({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.navigate("../")}}}))(ze),ys=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,o=Ne(),{isAiCfoAccessEnabled:r,onAskAiCfoClick:s}=se({mobileExploreReferrer:"DashboardCashInCashOut"}),i=$e({mobileExploreReferrer:"DashboardCashInCashOut"}),l=_((m=>ua(m))).mode==="compare_mode";return d.jsx(ks,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:l,navigate:n,insightsSectionAiCfoInfo:i,isAiCfoAccessEnabled:r,onAskAiCfoClick:s,meetingUrl:Ye(o("dashboard_report_filters"))})},As=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=et(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=ne((function(e){const a=Vn(e),t=Gn(e),n=ma(e),{scrollPosition:o,...r}=n,s=q.getLocalizedStrings().reportTitleById.cash_position,i=U.getSignedInUser(),l=e.tenantState.currentTenantId,m=B(e),p=m?.companyName??"",h={userId:i?.userId??"",sessionId:i?.zeniSessionId??"",tenantId:l??""},f=e.entityAutoCompleteState.autoCompleteText.navbar,c=le(e,"navbar");return{selectedRangeReport:a,reportLabels:{reportTitle:s},highlightedRangeReport:t,uiState:r,scrollPosition:o,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:p,statementEndPoint:`${oe}/statement`,authParams:h},analytics:w,autoCompleteData:{autoCompleteText:f,entityAutoCompleteView:c}}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(Nn(t))},onTimeframeSelectionChanged:t=>{e(Te(t)),setTimeout((()=>e(Fe({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Le(t,n)),e(Fe({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ue(a.firstMonthOfFY,t)),e(Fe({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Be(a.firstMonthOfFY,t,o,n)),n.length>0&&e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.isCompareModeOn!==t&&setTimeout((()=>e(Fe({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=As(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),l=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:l,referrer:"Cash Position"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onTableScroll:t=>{e(Fe({scrollPosition:t}))},onBackClick:()=>{a.navigate("../")}}}))(ze),vs=e=>{const{tenantEmailDomain:a,location:t,navigate:n}=e,o=Ne(),{isAiCfoAccessEnabled:r,onAskAiCfoClick:s}=se({mobileExploreReferrer:"DashboardCashPosition"}),i=$e({mobileExploreReferrer:"DashboardCashPosition"}),l=_((m=>ma(m))).mode==="compare_mode";return d.jsx(Is,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:a,location:t,isCompareModeOn:l,navigate:n,insightsSectionAiCfoInfo:i,isAiCfoAccessEnabled:r,onAskAiCfoClick:s,meetingUrl:Ye(o("dashboard_report_filters"))})},X=(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}))},Es=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=et(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=ne((function(e){const a=pa(e),t=Xn(e),n=ha(e),o=$n(e),r=zn(e),s=Kn(e),i=St(e),{scrollPosition:l,...m}=i,p=t.reportTitle,h=U.getSignedInUser(),f=e.tenantState.currentTenantId,c=B(e),u=c?.companyName??"",C={userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:f??""},g=e.entityAutoCompleteState.autoCompleteText.navbar,y=le(e,"navbar"),E=_t(c);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,selectedProjectViewRangeReport:r,reportLabels:{reportTitle:p},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,highlightedProjectViewRangeReport:s,uiState:m,scrollPosition:l,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${oe}/statement`,authParams:C},analytics:w,isZeniUser:Je(h),autoCompleteData:{autoCompleteText:g,entityAutoCompleteView:y},isZeniCOAUsed:E,isAccountingClassesEnabled:xe(e),isAccountingProjectsEnabled:we(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(Jn(t))},onTimeframeSelectionChanged:t=>{e(Te(t)),setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Le(t,n)),e(ge({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ue(a.firstMonthOfFY,t)),e(ge({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Be(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&X(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(ge({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Es(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.projectsViewParentId?.projectId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.projectsViewParentId.projectId,s,r,o):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),l=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:l,referrer:"Burn Rate"}})}},onElementCollapseStateChanged:(t,n)=>{a.accountViewMode!=="project"?e(ge({nodeCollapseState:{nodeId:t,isCollapsed:n}})):e(Xt({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{a.accountViewMode!=="project"?e(ge({scrollPosition:t})):e(Xt({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?3:1,n)),t==="forecast_mode"?(e(Nt({viewMode:"account_group"})),e(fa(!1,n?.id)),n!=null&&X(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):X(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(ge({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":t==="project"?"Projects":"Accounts","Burn Rate"),e(Nt({viewMode:t})),e(Hn({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(Zn({classesToFilterOut:t}))},onUpdateProjectsToFilterOut:t=>{e(Wn({projectsToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(qn()),a.isAccountingProjectsEnabled&&e(Qn())},onResyncReports:()=>{e(kt(a.accountViewMode==="project"?"net_burn_or_income_by_projects":"net_burn_or_income_by_classes"))}}}))(ze),ws=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,s=Ne(),{isAiCfoAccessEnabled:i,onAskAiCfoClick:l}=se({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),m=$e({mobileExploreReferrer:"DashboardNetBurnOrIncome"}),p=_((S=>St(S))),h=p.isForecastModeOn,f=p.timeframe,c=p.selectedForecast?.id,u=_((S=>yt(S.forecastState,c??""))),C=_((S=>pa(S))),g=_((S=>At(S))),y=_((S=>xe(S))),E=_((S=>we(S))),I=_((S=>ha(S).uiState.accountViewMode)),k=p.mode==="compare_mode",T=C.dataAvailable;b.useEffect((()=>{if(c!=null&&h===!0&&(X(h,r,c,o),u!=null)){const S=u?.forecastPeriod,A=T!=null&&S.endDate.isAfter(T?.endDate)===!0?T:S;a(ue(e.firstMonthOfFY,{startDate:A.endDate.startOf(f),endDate:A?.endDate}))}}),[c]);const R=Xe(),x=Pt(R?.currentTenant?.companyId,{clearParams:C.fetchState==="Completed"});return d.jsx(Ts,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,forecastIdFromUrlPath:r,location:n,isAccountingClassesEnabled:y,isAccountingProjectsEnabled:E,accountViewMode:I,isCompareModeOn:k,navigate:o,analytics:w,reportsResyncFetchState:g.reportsResyncFetchState,insightsSectionAiCfoInfo:m,isAiCfoAccessEnabled:i,onAskAiCfoClick:l,initialOpenThreadRequest:x,meetingUrl:Ye(s("dashboard_report_filters"))})},xs=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=et(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=ne((function(e){const a=ga(e),t=eo(e),n=ba(e),o=to(e),r=ao(e),s=no(e),i=It(e),{scrollPosition:l,...m}=i,p=q.getLocalizedStrings().common.texts.operatingExpenses,h=U.getSignedInUser(),f=e.tenantState.currentTenantId,c=B(e),u=c?.companyName??"",C={userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:f??""},g=e.entityAutoCompleteState.autoCompleteText.navbar,y=le(e,"navbar"),E=_t(c);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,selectedProjectViewRangeReport:r,reportLabels:{reportTitle:p},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,highlightedProjectViewRangeReport:s,uiState:m,scrollPosition:l,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${oe}/statement`,authParams:C},analytics:w,isZeniUser:Je(h),autoCompleteData:{autoCompleteText:g,entityAutoCompleteView:y},isZeniCOAUsed:E,isAccountingClassesEnabled:xe(e),isAccountingProjectsEnabled:we(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(lo(t))},onTimeframeSelectionChanged:t=>{e(Te(t)),setTimeout((()=>e(be({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Le(t,n)),e(be({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ue(a.firstMonthOfFY,t)),e(be({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Be(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&X(!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}=xs(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.projectsViewParentId?.projectId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.projectsViewParentId.projectId,s,r,o):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),l=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:l,referrer:"Operating Expenses"}})}},onElementCollapseStateChanged:(t,n)=>{a.accountViewMode!=="project"?e(be({nodeCollapseState:{nodeId:t,isCollapsed:n}})):e(zt({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{a.accountViewMode!=="project"?e(be({scrollPosition:t})):e(zt({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?3:1,n)),t=="forecast_mode"?(e($t({viewMode:"account_group"})),e(Ca(!1,n?.id)),n!=null&&X(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):X(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(be({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":t==="project"?"Projects":"Accounts","Operating Expenses"),e($t({viewMode:t})),e(co({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(io({classesToFilterOut:t}))},onUpdateProjectsToFilterOut:t=>{e(ro({projectsToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(oo()),a.isAccountingProjectsEnabled&&e(so())},onResyncReports:()=>{e(kt(a.accountViewMode==="project"?"operating_expenses_by_projects":"operating_expenses_by_classes"))}}}))(ze),Ps=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,s=Ne(),{isAiCfoAccessEnabled:i,onAskAiCfoClick:l}=se({mobileExploreReferrer:"DashboardOpEx"}),m=$e({mobileExploreReferrer:"DashboardOpEx"}),p=_((A=>It(A))),h=p.isForecastModeOn,f=p.timeframe,c=p.selectedForecast?.id,u=_((A=>yt(A.forecastState,c??""))),C=_((A=>ga(A))),g=_((A=>At(A))),y=_((A=>xe(A))),E=_((A=>we(A))),I=_((A=>ba(A).uiState.accountViewMode)),k=p.mode==="compare_mode",T=C.dataAvailable;b.useEffect((()=>{if(c!=null&&h===!0&&(X(h,r,c,o),u!=null)){const A=u?.forecastPeriod,L=T!=null&&A.endDate.isAfter(T?.endDate)===!0?T:A;a(ue(e.firstMonthOfFY,{startDate:L.endDate.startOf(f),endDate:L?.endDate}))}}),[c]);const R=Xe(),x=R?.loggedInUserRole!=null&&Sa(R?.loggedInUserRole)!==!0,S=Pt(R?.currentTenant?.companyId,{clearParams:C.fetchState==="Completed"});return d.jsx(Ds,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,location:n,isAccountingClassesEnabled:y,isAccountingProjectsEnabled:E,accountViewMode:I,isCompareModeOn:k,navigate:o,forecastIdFromUrlPath:r,analytics:w,hasTransactionAccess:x,reportsResyncFetchState:g.reportsResyncFetchState,insightsSectionAiCfoInfo:m,isAiCfoAccessEnabled:i,onAskAiCfoClick:l,initialOpenThreadRequest:S,meetingUrl:Ye(s("dashboard_report_filters"))})},Os=e=>{let a,t;switch(e.balanceTimeFrame){case"month":case"quarter":a=e.balanceTimeFrame,t=et(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}},Fs=ne((function(e){const a=_a(e),t=uo(e),n=ka(e),o=mo(e),r=po(e),s=ho(e),i=vt(e),{scrollPosition:l,...m}=i,p=q.getLocalizedStrings().common.texts.revenue,h=U.getSignedInUser(),f=e.tenantState.currentTenantId,c=B(e),u=c?.companyName??"",C={userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:f??""},g=e.entityAutoCompleteState.autoCompleteText.navbar,y=le(e,"navbar"),E=_t(c);return{selectedRangeReport:a,selectedClassesViewRangeReport:n,selectedProjectViewRangeReport:r,reportLabels:{reportTitle:p},highlightedRangeReport:t,highlightedClassesViewRangeReport:o,highlightedProjectViewRangeReport:s,uiState:m,scrollPosition:l,downloadParams:{downloadState:a.downloadState,currentTenantCompanyName:u,statementEndPoint:`${oe}/statement`,authParams:C},analytics:w,isZeniUser:Je(h),autoCompleteData:{autoCompleteText:g,entityAutoCompleteView:y},isZeniCOAUsed:E,isAccountingClassesEnabled:xe(e),isAccountingProjectsEnabled:we(e)}}),(function(e,a){return{updateDownloadStateHandler:t=>{e(_o(t))},onTimeframeSelectionChanged:t=>{e(Te(t)),setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onCOABalancesRangeChanged:(t,n)=>{e(Le(t,n)),e(Ce({resetLeftScroll:!0}))},onThisPeriodChanged:t=>{e(ue(a.firstMonthOfFY,t)),e(Ce({resetLeftScroll:!0}))},onAdditionalBalanceSelectionChanged:(t,n,o)=>{e(Be(a.firstMonthOfFY,t,o,n)),n.length>0&&(e(Ue(a.firstMonthOfFY,n.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",o,n)),a.forecastIdFromUrlPath!=null&&t==1&&X(!1,a.forecastIdFromUrlPath,"",a.navigate)),a.isCompareModeOn!==t&&setTimeout((()=>e(Ce({resetLeftScroll:!0}))),50)},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Os(n);if(o!=null&&r!=null){const s=t.accountName===""?t.accountDescription:t.accountName,i=t.projectsViewParentId?.projectId!=null?xt(a.tenantEmailDomain,t.accountId,t.accountType,t.projectsViewParentId.projectId,s,r,o):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),l=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:l,referrer:"Revenues"}})}},onElementCollapseStateChanged:(t,n)=>{a.accountViewMode!=="project"?e(Ce({nodeCollapseState:{nodeId:t,isCollapsed:n}})):e(qt({nodeCollapseState:{nodeId:t,isCollapsed:n}}))},onTableScroll:t=>{a.accountViewMode!=="project"?e(Ce({scrollPosition:t})):e(qt({scrollPosition:t}))},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(n,{state:{pathnameStackToGoBack:o}})}},onBackClick:()=>{a.selectedForecastId!=null?a.navigate("../../../"):a.navigate("../")},onForecastToggle:(t,n)=>{e(Ie(a.firstMonthOfFY,t==="forecast_mode",t==="forecast_mode"?3:1,n)),t==="forecast_mode"?(e(Kt({viewMode:"account_group"})),e(ya(!1,n?.id)),n!=null&&X(!0,a.forecastIdFromUrlPath,n?.id??"",a.navigate)):X(!1,a.forecastIdFromUrlPath,n?.id??"",a.navigate),e(Ce({resetLeftScroll:!0}))},onUpdateAccountViewMode:t=>{a.analytics?.trackGroupBySwitch(t==="classes"?"Classes":t==="project"?"Projects":"Accounts","Revenues"),e(Kt({viewMode:t})),e(So({viewMode:t}))},onUpdateClassesToFilterOut:t=>{e(Co({classesToFilterOut:t}))},onUpdateProjectsToFilterOut:t=>{e(bo({projectsToFilterOut:t}))},onOpenAccountViewMode:()=>{a.isAccountingClassesEnabled&&e(fo()),a.isAccountingProjectsEnabled&&e(go())},onResyncReports:()=>{e(kt(a.accountViewMode==="project"?"revenue_by_projects":"revenue_by_classes"))}}}))(ze),js=e=>{const a=$(),{tenantEmailDomain:t,location:n,navigate:o,forecastIdFromUrlPath:r}=e,s=Ne(),{isAiCfoAccessEnabled:i,onAskAiCfoClick:l}=se({mobileExploreReferrer:"DashboardRevenue"}),m=$e({mobileExploreReferrer:"DashboardRevenue"}),p=_((S=>vt(S))),h=p.isForecastModeOn,f=p.timeframe,c=p.selectedForecast?.id,u=_((S=>yt(S.forecastState,c??""))),C=_((S=>_a(S))),g=C.dataAvailable,y=p.mode==="compare_mode",E=_((S=>xe(S))),I=_((S=>we(S))),k=_((S=>ka(S).uiState.accountViewMode)),T=_((S=>At(S)));b.useEffect((()=>{if(c!=null&&h===!0&&(X(h,r,c,o),u!=null)){const S=u?.forecastPeriod,A=g!=null&&S.endDate.isAfter(g?.endDate)===!0?g:S;a(ue(e.firstMonthOfFY,{startDate:A.endDate.startOf(f),endDate:A?.endDate}))}}),[c]);const R=Xe(),x=Pt(R?.currentTenant?.companyId,{clearParams:C.fetchState==="Completed"});return d.jsx(Fs,{firstMonthOfFY:e.firstMonthOfFY,tenantEmailDomain:t,selectedForecastId:r,isAccountingClassesEnabled:E,isAccountingProjectsEnabled:I,accountViewMode:k,isCompareModeOn:y,location:n,navigate:o,forecastIdFromUrlPath:r,analytics:w,reportsResyncFetchState:T.reportsResyncFetchState,insightsSectionAiCfoInfo:m,isAiCfoAccessEnabled:i,onAskAiCfoClick:l,initialOpenThreadRequest:x,meetingUrl:Ye(s("dashboard_report_filters"))})},Rs=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}},Ms=ne((function(e){const a=ko(e),t=e.entityAutoCompleteState.autoCompleteText.navbar,n=le(e,"navbar");return{report:a,analytics:w,autoCompleteData:{autoCompleteText:t,entityAutoCompleteView:n}}}),(function(e,a){return{onTimeframeSelectionChanged:t=>{w.trackTimeframeSwitch(Va(t),"Top Expenses"),e(Aa(t))},onAccountBalanceClick:(t,n)=>{const{timePeriod:o,timeframe:r}=Rs(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),l=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(i,{state:{pathnameStackToGoBack:l,referrer:"Top Expenses"}})}},autoCompleteActions:{onAutoCompleteInputChange:t=>{t.trim().length>=2?e(de({searchString:t,searchOrigin:"navbar"})):t.trim().length===0&&e(ae("navbar"))},onAutoCompleteEntity:t=>{const n=me(t,a.tenantEmailDomain),o=O(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(Ms,{tenantEmailDomain:a,location:t,navigate:n})},Us=wt.div`
14
+ display: flex;
15
+ flex: 1 1 auto;
16
+ min-height: 100%;
17
+ flex-direction: column;
18
+ background-color: ${e=>e.theme.colors.grey5};
19
+ align-items: center;
20
+ `;function Ls({fetchState:e,firstMonthOfFY:a,reportId:t,forecastId:n}){const o=H(),r=Z(),{tenantEmailDomain:s}=K();let i;Ve({isDataReady:!0});const l={firstMonthOfFY:a,tenantEmailDomain:s,location:r,navigate:o,forecastIdFromUrlPath:n,fetchState:e};switch(t){case"operating_expenses":i=d.jsx(Ps,{...l});break;case"revenue":i=d.jsx(js,{...l});break;case"net_burn_or_income":i=d.jsx(ws,{...l});break;case"cash_position":i=d.jsx(vs,{...l});break;case"top_expenses":i=d.jsx(Bs,{...l});break;case"cash_in_cash_out":i=d.jsx(ys,{...l});break;default:console.error(`${t} is not supported!`),i=null}return i!=null?d.jsx(Us,{children:i}):null}function ie(){const e=Z(),a=$(),{forecastId:t}=K();let n="Not-Started";const o=_((c=>It(c).fetchState)),r=_((c=>vt(c).fetchState)),s=_((c=>St(c).fetchState)),i=_((c=>c.cashPositionState.fetchState)),l=_((c=>c.topExState.fetchState)),m=_((c=>c.cashInCashOutState.fetchState));if(U.getSignedInUser()==null)throw Error("Can't access dashboard detail without signing in...");const p=_((c=>B(c))),h=p?.company?.companyInfo?.firstMonthOfFY??1,f=ra((c=>{const u=ia(c,"/").split("/");return t!=null?u[u.length-3]:u[u.length-1]})(e.pathname));switch(f){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=l;break;case"cash_in_cash_out":n=m;break;default:console.error(`${f} is not supported!`)}return b.useEffect((()=>{n==="Not-Started"&&(function(c,u,C,g){switch(u){case"operating_expenses":c(xa(!0)),g!=null&&(c(Ie(C,!0,3,{id:g,index:0})),c(Ca(!1,g)));break;case"revenue":c(wa(!0)),g!=null&&(c(Ie(C,!0,3,{id:g,index:0})),c(ya(!1,g)));break;case"net_burn_or_income":c(Ta(!0)),g!=null&&(c(Ie(C,!0,3,{id:g,index:0})),c(fa(!1,g)));break;case"cash_position":c(Ea(!0));break;case"top_expenses":c(va());break;case"cash_in_cash_out":c(Ia());break;default:throw new Error(`report type ${u} is not yet supported`)}})(a,f,h,t)}),[t]),d.jsxs(d.Fragment,{children:[n==="Completed"?d.jsx(Ge,{analytics:w,onLoad:c=>((u,C)=>{const g=e.state?.referrer;switch(C){case"operating_expenses":u.trackPageLoaded(N.Event.operatingExpenses,g);break;case"revenue":u.trackPageLoaded(N.Event.revenues,g);break;case"net_burn_or_income":u.trackPageLoaded(N.Event.burnRate,g);break;case"cash_position":u.trackPageLoaded(N.Event.cashPosition,g);break;case"top_expenses":u.trackPageLoaded(N.Event.topExpenses,g);break;case"cash_in_cash_out":u.trackPageLoaded(N.Event.cashInCashOut,g);break;default:console.error(`Analytics: Not tracking Page Loaded for ${C}!`)}})(c,f)}):null,d.jsx(Ls,{firstMonthOfFY:h,fetchState:n,reportId:f,forecastId:t})]})}var it=typeof navigator<"u"&&navigator.userAgent.toLowerCase().indexOf("firefox")>0;function ct(e,a,t,n){e.addEventListener?e.addEventListener(a,t,n):e.attachEvent&&e.attachEvent("on".concat(a),(function(){t(window.event)}))}function Xa(e,a){for(var t=a.slice(0,a.length-1),n=0;n<t.length;n++)t[n]=e[t[n].toLowerCase()];return t}function $a(e){typeof e!="string"&&(e="");for(var a=(e=e.replace(/\s/g,"")).split(","),t=a.lastIndexOf("");t>=0;)a[t-1]+=",",a.splice(t,1),t=a.lastIndexOf("");return a}for(var Ot={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,"-":it?173:189,"=":it?61:187,";":it?59:186,"'":222,"[":219,"]":221,"\\":220},ce={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,command:91},Ct={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},M={16:!1,18:!1,17:!1,91:!1},j={},Ze=1;Ze<20;Ze++)Ot["f".concat(Ze)]=111+Ze;var D=[],Zt=!1,za="all",Ht=[],tt=function(e){return Ot[e.toLowerCase()]||ce[e.toLowerCase()]||e.toUpperCase().charCodeAt(0)};function Jt(e){za=e||"all"}function Re(){return za||"all"}var lt=function(e){var a=e.key,t=e.scope,n=e.method,o=e.splitKey,r=o===void 0?"+":o;$a(a).forEach((function(s){var i=s.split(r),l=i.length,m=i[l-1],p=m==="*"?"*":tt(m);if(j[p]){t||(t=Re());var h=l>1?Xa(ce,i):[];j[p]=j[p].filter((function(f){return!((!n||f.method===n)&&f.scope===t&&(function(c,u){for(var C=c.length>=u.length?c:u,g=c.length>=u.length?u:c,y=!0,E=0;E<C.length;E++)g.indexOf(C[E])===-1&&(y=!1);return y})(f.mods,h))}))}}))};function ea(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,M)Object.prototype.hasOwnProperty.call(M,r)&&(!M[r]&&a.mods.indexOf(+r)>-1||M[r]&&a.mods.indexOf(+r)===-1)&&(o=!1);(a.mods.length!==0||M[16]||M[18]||M[17]||M[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 ta(e,a){var t=j["*"],n=e.keyCode||e.which||e.charCode;if(V.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(u){var C=Ct[u];e[u]&&D.indexOf(C)===-1?D.push(C):!e[u]&&D.indexOf(C)>-1?D.splice(D.indexOf(C),1):u==="metaKey"&&e[u]&&D.length===3&&(e.ctrlKey||e.shiftKey||e.altKey||(D=D.slice(D.indexOf(C))))})),n in M){for(var o in M[n]=!0,ce)ce[o]===n&&(V[o]=!0);if(!t)return}for(var r in M)Object.prototype.hasOwnProperty.call(M,r)&&(M[r]=e[Ct[r]]);e.getModifierState&&(!e.altKey||e.ctrlKey)&&e.getModifierState("AltGraph")&&(D.indexOf(17)===-1&&D.push(17),D.indexOf(18)===-1&&D.push(18),M[17]=!0,M[18]=!0);var s=Re();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)&&ea(e,t[i],s,a);if(n in j){for(var l=0;l<j[n].length;l++)if((e.type==="keydown"&&j[n][l].keydown||e.type==="keyup"&&j[n][l].keyup)&&j[n][l].key){for(var m=j[n][l],p=m.splitKey,h=m.key.split(p),f=[],c=0;c<h.length;c++)f.push(tt(h[c]));f.sort().join("")===D.sort().join("")&&ea(e,m,s,a)}}}}function V(e,a,t){D=[];var n=$a(e),o=[],r="all",s=document,i=0,l=!1,m=!0,p="+",h=!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&&(l=a.keyup),a.keydown!==void 0&&(m=a.keydown),a.capture!==void 0&&(h=a.capture),typeof a.splitKey=="string"&&(p=a.splitKey)),typeof a=="string"&&(r=a);i<n.length;i++)o=[],(e=n[i].split(p)).length>1&&(o=Xa(ce,e)),(e=(e=e[e.length-1])==="*"?"*":tt(e))in j||(j[e]=[]),j[e].push({keyup:l,keydown:m,scope:r,mods:o,shortcut:n[i],method:t,key:n[i],splitKey:p,element:s});s!==void 0&&!(function(f){return Ht.indexOf(f)>-1})(s)&&window&&(Ht.push(s),ct(s,"keydown",(function(f){ta(f,s)}),h),Zt||(Zt=!0,ct(window,"focus",(function(){D=[]}),h)),ct(s,"keyup",(function(f){ta(f,s),(function(c){var u=c.keyCode||c.which||c.charCode,C=D.indexOf(u);if(C>=0&&D.splice(C,1),c.key&&c.key.toLowerCase()==="meta"&&D.splice(0,D.length),u!==93&&u!==224||(u=91),u in M)for(var g in M[u]=!1,ce)ce[g]===u&&(V[g]=!1)})(f)}),h))}var dt={setScope:Jt,getScope:Re,deleteScope:function(e,a){var t,n;for(var o in e||(e=Re()),j)if(Object.prototype.hasOwnProperty.call(j,o))for(t=j[o],n=0;n<t.length;)t[n].scope===e?t.splice(n,1):n++;Re()===e&&Jt(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(j).forEach((function(t){var n=j[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(j).forEach((function(s){return delete j[s]}));else if(Array.isArray(e))e.forEach((function(s){s.key&&lt(s)}));else if(typeof e=="object")e.key&&lt(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=""),lt({key:e,scope:o,method:r,splitKey:"+"})}},keyMap:Ot,modifier:ce,modifierMap:Ct};for(var ut in dt)Object.prototype.hasOwnProperty.call(dt,ut)&&(V[ut]=dt[ut]);if(typeof window<"u"){var Ys=window.hotkeys;V.noConflict=function(e){return e&&window.hotkeys===V&&(window.hotkeys=Ys),V},window.hotkeys=V}V.filter=function(){return!0};var aa=function(e,a){var t=e.target,n=t&&t.tagName;return!!(n&&a&&a.includes(n))};function Vs(e,a,t,n){t instanceof Array&&(n=t,t=void 0);var o=t||{},r=o.enableOnTags,s=o.filter,i=o.keyup,l=o.keydown,m=o.filterPreventDefault,p=m===void 0||m,h=o.enabled,f=h===void 0||h,c=o.enableOnContentEditable,u=c!==void 0&&c,C=b.useRef(null),g=b.useCallback((function(y,E){var I,k;return s&&!s(y)?!p:!!(aa(y,["INPUT","TEXTAREA","SELECT"])&&!aa(y,r)||(I=y.target)!=null&&I.isContentEditable&&!u)||!!(C.current===null||document.activeElement===C.current||(k=C.current)!=null&&k.contains(document.activeElement))&&(a(y,E),!0)}),n?[C,r,s].concat(n):[C,r,s]);return b.useEffect((function(){if(f)return i&&l!==!0&&(t.keydown=!1),V(e,t||{},g),function(){return V.unbind(e,g)};V.unbind(e,g)}),[g,e,f]),C}V.isPressed;const Gs=[],mt="dashboard_card",te="ai_cfo_dashboard_card";function na(e,a){return a?e.some((t=>String(t)===te))?e.slice():[te,...e]:e.filter((t=>String(t)!==te))}const Ns=["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","rewards_card"],Xs=(e,a,t,n,o)=>({card:{dimension:Et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e.status!=null?{balanceAmount:e.balance?.available,lastUpdatedTime:e.status.lastRefreshSuccessTime,changePercent:e.balance?.change?.percent,changeComparedToDate:e.balance?.change?.since}:void 0}),je=(e,a,t,n,o)=>({card:{dimension:Et(t),cardType:n,cardIndex:o,fetchState:a,disableAnimations:!1,spansFullDashboardWidth:!1},data:e}),$s=(e,a,t,n)=>je(void 0,e,ve,a,t),zs=e=>{const a=Et(ve);return a.height=ve.height+10,{card:{dimension:a,cardType:te,cardIndex:e,fetchState:"Completed",disableAnimations:!1,spansFullDashboardWidth:!0}}},Ks=ne((function(e,a){const t=Ws(a.dashboardReport),n=a.passedCardsOrdered,o=a.dashboardReport.reportsInOrder,{isInterestedInChargeCard:r,cardsCreditLimit:s,cashbackRate:i}=a;let l=n.map(((m,p)=>{if(m==="reimbursement_promo_card"||m==="bill_pay_promo_card")return $s(t,m,p);if(m==="zeni_promo_card")return je({isExpressedInterest:r,creditLimit:s,cashbackRate:i,fetchState:"Completed"},a.cardBalanceFetchState,ve,m,p);if(m==="information_card")return je(void 0,"Completed",ve,m,p);if(m===te)return zs(p);{const h=o.find((f=>f?.reportId===m));return h?(function(f,c,u,C){const g=f.reportId;switch(g){case"card_balance":case"cash_balance":return[Xs(f,c,u,g,C)];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"rewards_card":return[je(f,c,u,g,C)];case"net_burn_or_income_story_card":return[je(f,c,u,"net_burn_or_income_story_card",C)];default:return console.error(`card type ${g} not yet supported!`),[]}})(h,h.fetchState,ve,p):[]}})).flat();return a.isSummaryCardsFiltered===!0&&(l=l.filter((m=>Ns.includes(m.card.cardType)==0)).filter((m=>{const p=m.data?.availableNumberOfPeriods;return p!=null?p>0:m.card.cardType!="top_expenses"||m.data==null||(function(h){if(h==null||h.length===0)return!0;let f=!0;for(const c of h)if(c.balance.available.amount!==0){f=!1;break}return f})(m.data.topExpenses.accountsOrdered)===!1}))),{cardDataArray:l,autoCompleteData:{autoCompleteText:e.entityAutoCompleteState.autoCompleteText.navbar,entityAutoCompleteView:le(e,"navbar")},analytics:w,isReimbursementEnabled:a.isReimbursementEnabled,isBillPayEnabled:a.isBillPayEnabled}}),(function(e,a){const t=a.tenantId,n=U.getSignedInUser();return{cardActions:{onCardClick:(o,r,s,i)=>{if(console.warn(`onCardClick at ${o} for the type ${r}`),r==="zeni_promo_card"&&i!=null)w.trackDashboardCardClicked("cards promo",2),w.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&&w.trackDashboardCardClicked("rewards promo",o+1),a.navigate("../../rewards/refer",{state:{referrer:s}})):r==="expense_automation_card"?(w.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.isRewardsFeatureEnabled===!1&&s.push("rewards_card"),(function(i,l,m,p){if(l!==te)switch(l){case"card_balance":i(la());break;case"cash_balance":i(ca());break;case"operating_expenses":i(xa(!0));break;case"revenue":i(wa(!0));break;case"net_burn_or_income":i(Ta(!0));break;case"net_burn_or_income_story_card":i(Mo(!0));break;case"cash_position":i(Ea(!0));break;case"top_expenses":i(va());break;case"cash_in_cash_out":i(Ia());break;case"insights_dashboard":i(Ro());break;case"bill_pay_card":i(jo());break;case"reimbursement_card":i(Fo());break;case"company_details":i(Oo(m));break;case"task_card":i(Po());break;case"accounts_payable_aging":p.includes("accounts_payable_aging")===!1&&i(ft(Ee()));break;case"accounts_receivable_aging":i(gt(Ee()));break;case"rewards_card":p.includes("rewards_card")===!1&&i(Do(!0));break;default:throw new Error(`report type ${l} is not yet supported`)}})(e,r,a.companyId,s)},onTimeframeChange:(o,r)=>{w.trackTimeframeSwitch(Va(r),Qs(o),"Dashboard"),(function(s,i,l){switch(i){case"operating_expenses":case"revenue":case"net_burn_or_income":case"cash_position":s(Te(l));break;case"top_expenses":s(Aa(l));break;default:throw new Error(`report type ${i} doesn't support changeTimeframe`)}})(e,o,r)},onUpdateSelectedInsightIndex:o=>{e(xo(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=>{if(o==="bill_pay_promo_card"){const r="../bills",s=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s},relative:"path"})}else if(o==="reimbursement_promo_card"){const r="../reimbursements",s=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s},relative:"path"})}},onSaveClick:(o,r,s)=>{o==="net_burn_or_income_story_card"&&(w.trackUpdateBurnRateCalculatorSettings(r,s,To(s)),e(wo(t,r,s)))}},autoCompleteActions:{onAutoCompleteInputChange:o=>{o.trim().length>=2?e(de({searchString:o,searchOrigin:"navbar"})):o.trim().length===0&&e(ae("navbar"))},onCancelAutoComplete:()=>{e(ae("navbar"))},onAutoCompleteEntity:o=>{let r="";r=o.type!=="vendor"||o.detailType!=="bank_merchant"&&o.detailType!=="card_merchant"?me(o,a.tenantEmailDomain):os(o.zeniId,o.qboId,a.tenantEmailDomain);const s=O(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(r,{state:{pathnameStackToGoBack:s,referrer:"Search"}})}}}}))(ns);function qs(){const e=oa(),a=Fa(),t=Ua(a),{isAiCfoOpen:n,setIsAiCfoOpen:o,setAiCfoSidePanelQuestionToSubmit:r}=Oa(),s=H(),i=$(),l=Z(),m=U.getSignedInUser(),{useFeatureGate:p,useDynamicConfig:h}=Tt(),[f,c]=b.useState(!1),[u,C]=b.useState(!1),g=ja(),{tenantEmailDomain:y}=K(),{isAiCfoAccessEnabled:E,onAskAiCfoClick:I}=se({mobileExploreReferrer:"Dashboard"}),k=_((v=>v.tenantState.fetchState==="Completed"||v.tenantState.activeTenantFetchState.fetchState==="Completed"?B(v):void 0)),T=k??U.getSignedInUserTenant(y),{isCardsShuttingDown:R,shutdownContent:x}=Qo(T?.tenantId,k?.company?.managementInfo?.receiverEmails),S=b.useMemo((()=>R===!0&&x!=null?d.jsx(Wo,{shutdownContent:x}):null),[R,x]),A=k?.masterTOSInfo?.isMasterTOSAccepted??!1,L=T.tenantId,pe=T.companyId;b.useEffect((()=>{f===!1&&l.state?.message==="activation"&&(i(yo(pe)),c(!0))}),[l.state,f,pe,i]),b.useEffect((()=>{g&&!u&&l.state?.message==="open_ai_cfo_drawer"&&(C(!0),A?(o(!0),s({pathname:l.pathname,search:l.search,hash:l.hash},{replace:!0,state:{...l.state,message:void 0}})):re({location:l,navigate:s,mergeState:{referrer:"Dashboard",message:void 0}}))}),[l,u,g,A,o,s]);const{isFeatureEnabled:Pe}=p(G.isApAgingFeatureEnabled),Se=Zo(),F=Ho(Se),{isFeatureEnabled:J}=p(G.isArAgingFeatureEnabled),{isFeatureEnabled:Ke}=p(G.isDepositAccountsFeatureEnabled),{isFeatureEnabled:qe}=p(G.isReferralFeatureEnabled),{isFeatureEnabled:Ka}=p(G.isChargeCardFeatureEnabled),{isFeatureEnabled:qa}=p(G.isAiCfoFileUploadEnabled),{isFeatureEnabled:Qa}=p(G.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Wa}=p(G.isDashboardSidebarNewYearAnimationEnabled),{isFeatureEnabled:Za}=p(G.aiAuditScorePercentage),{configValue:Ft}=h(Ra.zeniCardsConfig),Ha=Ft.charge_card_cashback_rate_per_transaction==null?.0175:Ft.charge_card_cashback_rate_per_transaction;if(l.state?.message==="activation"){const v=Jo(l.state?.pathnameStackToGoBack);s(l.pathname,{state:{...l.state,message:void 0,pathnameStackToGoBack:v.newStack}})}const[jt,Ja]=b.useState(!1),[at,en]=b.useState(!1);Vs("command+p, Control+p",(v=>{en(!at),v.preventDefault()}),{enableOnContentEditable:!0,enableOnTags:["INPUT","SELECT","TEXTAREA"]},[at]);const Rt=k?.externalConnections?.accounting[0]?.isValid;if(m==null)throw Error("Can't access dashboard without signing in...");const he=_((v=>B(v)?.excludedResources)),tn=_((v=>v.expenseAutomationViewState.selectedPeriodByTenantId)),an=!!k?.companyReimbursementInfo?.info?.isReimbursementEnabled,nn=!!k?.companyBillPayInfo?.info?.isBillPayEnabled,on=Xe(),z=[],Mt=he?.resources?.find((v=>v.resource==="/reports/top_expenses"))==null,sn=he?.resources?.find((v=>v.resource==="/reports/task_card"))==null,Bt=k?.userRole!=null&&Sa(k?.userRole),rn=he?.resources?.find((v=>v.resource==="/bills"))==null&&!Bt,cn=he?.resources?.find((v=>v.resource==="/reimbursements"))==null,ln=Ao(on?.loggedInUserRoleMap),dn=k?.company?.companyChargeCardInfo?.chargeCardsCreditAccountLimit??0,un=k?.companyChargeCardInfo?.info?.isCompanyInterestedInChargeCard??!1;Mt===!1&&z.push("top_expenses"),sn===!1&&z.push("task_card"),rn===!1&&z.push("bill_pay_card","bill_pay_promo_card"),Pe===!1&&z.push("accounts_payable_aging"),J===!1&&z.push("accounts_receivable_aging"),(Se===!1||Bt)&&z.push("expense_automation_card"),cn===!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}=es();b.useLayoutEffect((()=>{jt&&F===Se||Rt!==!0||!Ut||he?.fetchState!=="Completed"&&he?.fetchState!=="Error"||(Ja(!0),i(Io(m.userId,pe,L,!0,!1,z)))}),[jt,m,L,i,Mt,Rt,he?.fetchState,Ut]);const mn=_((v=>v.reportUIOptionsState.forecastOnDashboard.isForecastModeOn)),pn=_((v=>v.revenueState.uiState.selectedForecast?.id)),hn=_((v=>v.cardBalanceState.fetchState)),fe=_((v=>vo(v,z))),fn=fe.fetchState,gn=b.useMemo((()=>na(fe.cardsOrdered,E)),[fe.cardsOrdered,E]),bn=b.useMemo((()=>na(fe.cardsForDashboardUI,E)),[fe.cardsForDashboardUI,E]);Ve({isDataReady:!0});const{isSuggestedQuestionsLoading:Cn,suggestedPromptQuestions:Sn}=rs(),Lt=_((v=>da(v))),_e=Lt.uiState?.currentChatSessionId,nt=Lt.allSessionsWithOrderedQuestionAnswers??Gs,{currentSessionQuestionAnswers:_n}=ts(nt,_e),Yt=_n.length===0,kn=b.useCallback(((v,Q,ee)=>{const ke=m?.userId;if(ke==null)return;const Y=v.trim();if(Y.length===0&&Q.length===0)return;if(!A)return void re({location:l,navigate:s,mergeState:{referrer:"Dashboard",...Y.length>0?{aiCfoInitialQuestion:Y,aiCfoInitialSubmissionSource:mt,...typeof ee=="number"?{aiCfoSuggestionIndex:ee}:{}}:{}}});const W=Ma(e.getState()),ye=()=>{const Ae=O(l.state?.pathnameStackToGoBack,l.pathname);s(`/${y}/ai-cfo/explore`,{state:{message:"",origin:"",pathnameStackToGoBack:Ae,referrer:"Dashboard",aiCfoInitialQuestion:Y,aiCfoShouldSubmit:!W&&Y.length>0,aiCfoInitialSubmissionSource:mt,...typeof ee=="number"?{aiCfoSuggestionIndex:ee}:{}}})};return t?Q.length>0?void o(!0):void ye():Q.length>0?W?(i(bt(Y)),void o(!0)):(r(Y.length>0?Y:null),o(!0),void(Y.length>0&&Ba(i,Y,mt,_e,nt,ke,ee,Q.length>0?Q:void 0))):(W&&i(bt(Y)),void ye())}),[nt,_e,i,A,t,l,s,r,o,m?.userId,e,y]),yn=b.useCallback((()=>{A?o(!0):re({location:l,navigate:s,mergeState:{referrer:"Dashboard"}})}),[A,l,s,o]),An=b.useCallback((()=>{if(!A)return void re({location:l,navigate:s,mergeState:{referrer:"Dashboard"}});if(y==null)return;const v=O(l.state?.pathnameStackToGoBack,l.pathname);s(`/${y}/ai-cfo/explore`,{state:{pathnameStackToGoBack:v,referrer:"Dashboard"}})}),[A,l,s,y]),In=b.useCallback((()=>{if(A)if(t){if(y==null||k==null)return;const v=_e==null||Yt?`/${y}/ai-cfo/explore`:`/${y}/ai-cfo/${_e}`,Q=l.state?.pathnameStackToGoBack??[],ee=O(Q,l.pathname);s(v,{state:{...l.state,pathnameStackToGoBack:ee,[as]:!0}})}else re({location:l,navigate:s,mergeState:{referrer:"Dashboard"}});else re({location:l,navigate:s,mergeState:{referrer:"Dashboard"}})}),[A,t,l,s,y,k,_e,Yt]);return d.jsxs(d.Fragment,{children:[fn==="Completed"?d.jsx(Ge,{analytics:w,onLoad:v=>{v.trackPageLoaded(N.Event.dashboard)}}):null,d.jsx(Ks,{cardsShutdownBanner:S,maxColumns:n?2:void 0,isAiCfoAccessEnabled:E,onAskAiCfoClick:I,onAiCfoDashboardOpenPanel:yn,onAiCfoDashboardOpenScopePage:In,isAiCfoFileUploadEnabled:qa===!0&&t===!1,onAiCfoDashboardPromptSubmit:kn,onAiCfoDashboardExpandToFullPage:An,aiCfoDashboardShouldClearPromptOnSubmit:A,aiCfoDashboardSuggestedPromptQuestions:Sn,aiCfoDashboardSuggestedPromptQuestionsLoading:Cn,onDragAndDropCard:(v,Q)=>{if(v===te||Q===te)return;const ee=(function(W,ye,Ae){const ot=Ae.indexOf(W),st=Ae.indexOf(ye);if(ot===-1||st===-1||ot===st)return Ae;const rt=[...Ae];return rt.splice(ot,1),rt.splice(st,0,W),rt})(v,Q,gn),ke=ee.filter((W=>W!==te)),Y=fe.cardsOrdered;(ke.length!==Y.length||ke.some(((W,ye)=>W!==Y[ye])))&&i(Eo(ke))},dashboardReport:fe,passedCardsOrdered:bn,tenantId:L,companyId:pe,tenantEmailDomain:y,location:l,navigate:s,isApAgingFeatureEnabled:Pe,isArAgingFeatureEnabled:J,isBillPayEnabled:nn,isReimbursementEnabled:an,isSummaryCardsFiltered:at,isForecastOn:mn,selectedForecastOnDashboard:pn,isVisitingFirstTime:f,isZeniAccountEnabled:Ke,isRewardsFeatureEnabled:qe,selectedPeriod:tn[L],isChargeCardFeatureEnabled:Ka,isUserHasCardsAccess:ln,cardsCreditLimit:dn,cashbackRate:Ha,isInterestedInChargeCard:un,cardBalanceFetchState:hn,christmasAnimationEnabled:Qa,newYearAnimationEnabled:Wa,aiAuditScorePercentageEnabled:Za})]})}const Qs=e=>{switch(e){case"operating_expenses":return"Operating Expenses";case"revenue":return"Revenues";case"top_expenses":return"Top Expenses";case"net_burn_or_income":return"Burn Rate";case"cash_in_cash_out":return"Cash In, Cash Out";case"cash_position":return"Cash Position"}return"Dashboard"},Ws=e=>e.fetchState!=="Error"?e.fetchState:e.reportsInOrder.map((a=>a.fetchState)).reduce(((a,t)=>a==="In-Progress"||a==="Not-Started"?a:t));function pt(){return d.jsxs(ht,{children:[d.jsx(P,{path:"/",element:d.jsx(ie,{})}),d.jsx(P,{path:"/:forecastId",element:d.jsx(ie,{})}),d.jsx(P,{path:"/:forecastId/*",element:d.jsx(Me,{})})]})}function wr(){const e=Xe(),a=e?.excludedResources?.find((m=>m.resource==="/reports/top_expenses"))==null,{useFeatureGate:t}=Tt(),{isFeatureEnabled:n}=t(G.isApAgingFeatureEnabled),{isFeatureEnabled:o}=t(G.isArAgingFeatureEnabled),r=_((m=>B(m))),{isFeatureEnabled:s}=t(G.isDebitCardFeatureEnabled),i=Bo(s,r),l=Uo(r);return i===!0||l===!0?d.jsx(ht,{children:d.jsx(P,{path:"/*",element:d.jsx(is,{})})}):d.jsxs(ht,{children:[d.jsx(P,{path:"/",element:d.jsx(qs,{})}),d.jsx(P,{path:"cash_balance/*",element:d.jsx(Qt,{})}),d.jsx(P,{path:"card_balance/*",element:d.jsx(Qt,{})}),d.jsx(P,{path:"operating_expenses/*",element:d.jsx(ie,{})}),d.jsx(P,{path:"operating_expenses/forecast/*",element:d.jsx(pt,{})}),d.jsx(P,{path:"revenue/forecast/*",element:d.jsx(pt,{})}),d.jsx(P,{path:"revenue/*",element:d.jsx(ie,{})}),d.jsx(P,{path:"net_burn_or_income/forecast/*",element:d.jsx(pt,{})}),d.jsx(P,{path:"net_burn_or_income/*",element:d.jsx(ie,{})}),n===!0&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_payable_aging/*",element:d.jsx(ls,{})}),d.jsx(P,{path:"accounts_payable_aging/:vendorId/:reportDate/*",element:d.jsx(cs,{})})]}),o&&d.jsxs(d.Fragment,{children:[d.jsx(P,{path:"accounts_receivable_aging/:customerId/:reportDate/*",element:d.jsx(ds,{})}),d.jsx(P,{path:"accounts_receivable_aging/*",element:d.jsx(us,{})})]}),d.jsx(P,{path:"cash_position/*",element:d.jsx(ie,{})}),d.jsx(P,{path:"top_expenses/*",element:a===!0?d.jsx(ie,{}):d.jsx(Me,{})}),d.jsx(P,{path:"cash_in_cash_out/*",element:d.jsx(ie,{})}),d.jsx(P,{path:"company_details",element:d.jsx(ss,{})}),d.jsx(P,{path:"referrals/*",element:d.jsx(vn,{to:"../../rewards/refer",replace:!0})}),d.jsx(P,{path:"*",element:d.jsx(Me,{})})]})}export{wr as default};
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-BjcYyeQ6.js";import{a as u}from"./sentry-DZ9rNYfw.js";import{u as y,j as b,l as w,g as A,N}from"./core-B-8b0iz9.js";import{TX as U,fF as _,gl as k,TY as L,pS as R,TZ as z}from"./zeni-epic-state-95zxmizy.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import{t as P}from"./getLocaleForTenant-BYXijL7f.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.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]="c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb",t._sentryDebugIdIdentifier="sentry-dbid-c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,x)=>l||i.split("/").find((D=>D===x))!=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 F=$(c,p);return v.jsx(N,{to:F,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(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||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-CIxx6Ub6.js";import{a as u}from"./sentry-BCPOyc0G.js";import{u as y,j as b,l as w,g as A,N}from"./core-Caq7Zbsp.js";import{TX as U,fF as _,gl as k,TY as L,pS as R,TZ as z}from"./zeni-epic-state-DROyxOLw.js";import{u as j,z as f,L as C,t as I,G as O,b as $}from"./index-DOXJLxdR.js";import"./mui-DI0hUuFr.js";import{t as P}from"./getLocaleForTenant-YgJPw-1W.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.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]="c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb",t._sentryDebugIdIdentifier="sentry-dbid-c7c68b6d-a0fe-4cb6-8fa0-27eb89e9b7fb")}catch{}})();const G=w((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const T=E(r.pathname);if(T!=null)c=`../${o.tenantEmailDomain}/${T}`,m="comingFromV2UrlPath",T==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,x)=>l||i.split("/").find((D=>D===x))!=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 F=$(c,p);return v.jsx(N,{to:F,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=y(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(C.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(C.TENANT_FETCHING),t(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||(O.updateAppLocaleID(P(c)),o())}),[n,a,c]),v.jsx(G,{})}const Q=["dashboard/cash-balance","dashboard/card-balance","dashboard/operating-expenses","dashboard/revenue","dashboard/burn-rate","dashboard/cash-position","dashboard/top-expenses","dashboard/cash-in-cash-out","dashboard","reports","forecast","uncategorized-expense","uncategorized-income","missing-receipts","bills","cards/activate","cards","reimbursements","wise","checking","aicfo"],q={"dashboard/cash-balance":"dashboard/cash_balance","dashboard/card-balance":"dashboard/card_balance","dashboard/operating-expenses":"dashboard/operating_expenses","dashboard/revenue":"dashboard/revenue","dashboard/burn-rate":"dashboard/net_burn_or_income","dashboard/cash-position":"dashboard/cash_position","dashboard/top-expenses":"dashboard/top_expenses","dashboard/cash-in-cash-out":"dashboard/cash_in_cash_out",dashboard:"dashboard",reports:"reports",forecast:"forecast","uncategorized-expense":"transactions/uncategorized-expense","uncategorized-income":"transactions/uncategorized-income","missing-receipts":"transactions/missing-receipts",bills:"bills",reimbursements:"reimbursements","cards/activate":"cards/activate",cards:"cards",wise:"bills/wise/callback/link-account",checking:"checking",aicfo:"ai-cfo/explore"};function E(t){for(const s of Q)if(t.toLocaleLowerCase().includes(s))return q[s]}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-BjcYyeQ6.js";import{h as w,g as C,j as h,l as E,i as V}from"./core-B-8b0iz9.js";import{YW as k,Z1 as Y,gG as _,gF as L,gE as Q,kP as X,WU as q,uO as J,fF as B,Yt as D,kN as F,YX as S,Z4 as T,kL as G,l6 as j}from"./zeni-epic-state-95zxmizy.js";import{bO as K,a2 as N,o as R,z as U,E as O,a5 as p,S as v,a8 as Z,bP as M,H,bQ as ee,p as te}from"./index-Bg2deWZq.js";import{n as z}from"./mui-C33Oegsm.js";import"./sentry-DZ9rNYfw.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]="23e8f956-33b5-4531-ad31-2ad7f63a97ec",e._sentryDebugIdIdentifier="sentry-dbid-23e8f956-33b5-4531-ad31-2ad7f63a97ec")}catch{}})();const ae=E(null,(function(e,t){return{onSaveVendor:a=>{e(X(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(q("common")),a!=null&&e(J(a))},onGetOtp:a=>{e(Q(a,"BillPayVendor"))},onResendOtp:a=>{e(L(a,"BillPayVendor"))},onVerifyOtp:(a,n)=>{e(_(a,n,"BillPayVendor"))},onVerifyOtpSuccess:(a,n,o)=>{e(Y(a,n,o))}}}))(K);function W({vendorId:e,billId:t,isExpressPayPage:a}){const n=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ae,{location:o,navigate:n,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:a??!1})}const ne=z.div`
1
+ import{j as l}from"./liveblocks-CIxx6Ub6.js";import{h as w,g as C,j as h,l as E,i as V}from"./core-Caq7Zbsp.js";import{YW as k,Z1 as Y,gG as _,gF as J,gE as L,kP as Q,WU as X,uO as q,fF as B,Yt as D,kN as F,YX as S,Z4 as T,kL as G,l6 as j}from"./zeni-epic-state-DROyxOLw.js";import{bO as K,a2 as N,N as R,z as U,E as O,a5 as p,f as v,a8 as Z,bP as M,J as z,bQ as ee,p as te}from"./index-DOXJLxdR.js";import{n as H}from"./mui-DI0hUuFr.js";import"./sentry-BCPOyc0G.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]="1c63d510-9693-4128-af09-09ff161340db",e._sentryDebugIdIdentifier="sentry-dbid-1c63d510-9693-4128-af09-09ff161340db")}catch{}})();const ae=E(null,(function(e,t){return{onSaveVendor:a=>{e(Q(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(X("common")),a!=null&&e(q(a))},onGetOtp:a=>{e(L(a,"BillPayVendor"))},onResendOtp:a=>{e(J(a,"BillPayVendor"))},onVerifyOtp:(a,n)=>{e(_(a,n,"BillPayVendor"))},onVerifyOtpSuccess:(a,n,o)=>{e(Y(a,n,o))}}}))(K);function W({vendorId:e,billId:t,isExpressPayPage:a}){const n=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ae,{location:o,navigate:n,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:a??!1})}const ne=H.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -6,7 +6,7 @@ import{j as l}from"./liveblocks-BjcYyeQ6.js";import{h as w,g as C,j as h,l as E,
6
6
  flex-direction: column;
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
- `,oe=E((function(e,t){const{vendorId:a,billId:n}=t,o=k(e,a),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{navigate:a,location:n,vendorId:o}=t;return{onFetchBankName:s=>{e(j(s))},onSaveHandler:s=>{e(G(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(n.state?.pathnameStackToGoBack),d=s.poppedPathname??P();a(d,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),d=s.poppedPathname??P(0);t.navigate(d,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}}))(M);function fe({vendorIdParam:e,accountContext:t}){const a=w(),n=C(),o=N(),{vendorId:s,billId:d}=V(),c=e??s,{useFeatureGate:r}=R(),i=U.getSignedInUser(),b=h((u=>B(u))),g=O(),x=p(n.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:I}=r(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(v.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ne,{windowSize:o,children:[l.jsx(W,{vendorId:c,billId:d}),l.jsx(oe,{location:n,navigate:a,billId:d,vendorId:c,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t},me=(e,t,a)=>{let n=`/${e}/bill/${encodeURIComponent(t)}`;return a=="draft"&&(n+="/edit"),n},he=e=>`/${e}/bills`,ke=(e,t)=>{let a=`/${e}/bill`;return a=t!=null?a.concat(`/${t}/edit`):a.concat("/new"),a},A=(e,t,a,n)=>{let o=`/${e}/bill`;return o+=a!=null?`/${a}/edit/vendor`:"/new/vendor",o+=n!=null?`/${n}/edit/${t}`:`/create/${t}`,o};function Se(e,t,a){return A(e,"ach",t,a)}function ve(e,t,a){return A(e,"domestic",t,a)}function ge(e,t,a){return A(e,"international",t,a)}const se=(e,t,a)=>{let n=`/${e}/bill/`;return n=a!=null?n.concat(`${encodeURIComponent(a)}/${t}/`):n.concat(`new/${t}/`),n},re=z.div`
9
+ `,oe=E((function(e,t){const{vendorId:a,billId:n}=t,o=k(e,a),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{navigate:a,location:n,vendorId:o}=t;return{onFetchBankName:s=>{e(j(s))},onSaveHandler:s=>{e(G(t.bankAccountContext,s,"standard",o))},onCancel:()=>{(()=>{const s=p(n.state?.pathnameStackToGoBack),d=s.poppedPathname??P();a(d,{state:{pathnameStackToGoBack:s.newStack}})})(),e(S())},onACHDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")a("../",{relative:"path"});else{const s=p(t.location.state?.pathnameStackToGoBack),d=s.poppedPathname??P(0);t.navigate(d,{state:{pathnameStackToGoBack:s.newStack}})}e(S())}}}))(M);function fe({vendorIdParam:e,accountContext:t}){const a=w(),n=C(),o=N(),{vendorId:s,billId:d}=V(),c=e??s,{useFeatureGate:r}=R(),i=U.getSignedInUser(),b=h((u=>B(u))),g=O(),x=p(n.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:I}=r(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=r(v.isDepositAccountsFeatureEnabled);if(i==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:g.colors.grey5}}):l.jsxs(ne,{windowSize:o,children:[l.jsx(W,{vendorId:c,billId:d}),l.jsx(oe,{location:n,navigate:a,billId:d,vendorId:c,currentTenant:b,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const P=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t},me=(e,t,a)=>{let n=`/${e}/bill/${encodeURIComponent(t)}`;return a=="draft"&&(n+="/edit"),n},he=e=>`/${e}/bills`,ke=(e,t)=>{let a=`/${e}/bill`;return a=t!=null?a.concat(`/${t}/edit`):a.concat("/new"),a},A=(e,t,a,n)=>{let o=`/${e}/bill`;return o+=a!=null?`/${a}/edit/vendor`:"/new/vendor",o+=n!=null?`/${n}/edit/${t}`:`/create/${t}`,o};function Se(e,t,a){return A(e,"ach",t,a)}function ve(e,t,a){return A(e,"domestic",t,a)}function ge(e,t,a){return A(e,"international",t,a)}const se=(e,t,a)=>{let n=`/${e}/bill/`;return n=a!=null?n.concat(`${encodeURIComponent(a)}/${t}/`):n.concat(`new/${t}/`),n},re=H.div`
10
10
  display: flex;
11
11
  height: 100vh;
12
12
  width: 100%;
@@ -14,5 +14,5 @@ import{j as l}from"./liveblocks-BjcYyeQ6.js";import{h as w,g as C,j as h,l as E,
14
14
  flex-direction: column;
15
15
  align-items: center;
16
16
  background-color: ${e=>e.theme.colors.grey4};
17
- box-shadow: ${e=>`0px 2px ${H.sp1} ${e.theme.colors.dropShadowNormal}`};
18
- `,de=E((function(e,t){const{vendorId:a,billId:n}=t,o=k(e,a),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:a,navigate:n,location:o,vendorId:s,currentTenant:d}=t,{tenantEmailDomain:c}=d;return{onFetchBankName:r=>{e(j(r))},onSaveHandler:r=>{e(G(t.bankAccountContext,r,"us-domestic",s))},onWireDetailsUpdated:r=>{const{bankAccountSection:i}=r;e(T({data:i}))},onCancel:()=>{(()=>{const r=p(o.state?.pathnameStackToGoBack),i=r.poppedPathname??$();n(i,{state:{pathnameStackToGoBack:r.newStack}})})(),e(S())},onAddressClick:r=>{if(t.bankAccountContext==="express-pay")n("./add-address");else{const i=se(c,r,a),b=te(o.state?.pathnameStackToGoBack,o.pathname);n(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const r=p(t.location.state?.pathnameStackToGoBack),i=r.poppedPathname??$(0);t.navigate(i,{state:{pathnameStackToGoBack:r.newStack}})}e(S())}}}))(ee);function xe({vendorIdParam:e,accountContext:t}){const a=w(),n=C(),o=N(),{vendorId:s,billId:d}=V(),c=e??s,r=U.getSignedInUser(),{useFeatureGate:i}=R(),b=O(),g=h((u=>B(u))),x=p(n.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:I}=i(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=i(v.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${H.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(re,{windowSize:o,children:[l.jsx(W,{vendorId:c,billId:d}),l.jsx(de,{location:n,navigate:a,billId:d,vendorId:c,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t};export{fe as A,xe as D,W as V,me as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
17
+ box-shadow: ${e=>`0px 2px ${z.sp1} ${e.theme.colors.dropShadowNormal}`};
18
+ `,de=E((function(e,t){const{vendorId:a,billId:n}=t,o=k(e,a),s=D(e,t.isVendorRecommendationEnabled,t.isZeniAccountsFeatureEnabled,n);return{billId:n,isDisabled:o.bankAccountCreationState.fetchState==="In-Progress"?"readonly":void 0,vendorViewDetails:o,file:s.file,bankAccountContext:t.bankAccountContext}}),(function(e,t){const{billId:a,navigate:n,location:o,vendorId:s,currentTenant:d}=t,{tenantEmailDomain:c}=d;return{onFetchBankName:r=>{e(j(r))},onSaveHandler:r=>{e(G(t.bankAccountContext,r,"us-domestic",s))},onWireDetailsUpdated:r=>{const{bankAccountSection:i}=r;e(T({data:i}))},onCancel:()=>{(()=>{const r=p(o.state?.pathnameStackToGoBack),i=r.poppedPathname??$();n(i,{state:{pathnameStackToGoBack:r.newStack}})})(),e(S())},onAddressClick:r=>{if(t.bankAccountContext==="express-pay")n("./add-address");else{const i=se(c,r,a),b=te(o.state?.pathnameStackToGoBack,o.pathname);n(i,{state:{pathnameStackToGoBack:b}})}},onBackClick:()=>{if(e(F({fetchState:"Not-Started"})),t.bankAccountContext==="express-pay")n("../",{relative:"path"});else{const r=p(t.location.state?.pathnameStackToGoBack),i=r.poppedPathname??$(0);t.navigate(i,{state:{pathnameStackToGoBack:r.newStack}})}e(S())}}}))(ee);function xe({vendorIdParam:e,accountContext:t}){const a=w(),n=C(),o=N(),{vendorId:s,billId:d}=V(),c=e??s,r=U.getSignedInUser(),{useFeatureGate:i}=R(),b=O(),g=h((u=>B(u))),x=p(n.state?.pathnameStackToGoBack),f=t??(x.poppedPathname?.includes("vendor")===!0?"vendor":"billDetail"),m=h((u=>k(u,c))),{isFeatureEnabled:I}=i(v.isVendorRecommendationFeatureEnabled),{isFeatureEnabled:y}=i(v.isDepositAccountsFeatureEnabled);if(r==null)throw Error("Can't access address page without signing in...");return f==="billDetail"&&m.editVendorState?.saveStatus.fetchState==="In-Progress"?l.jsx(Z,{fetchState:m.editVendorState?.saveStatus.fetchState??"Not-Started",style:{backgroundColor:b.colors.grey5,boxShadow:`0px 2px ${z.sp1} ${b.colors.dropShadowNormal}`}}):l.jsxs(re,{windowSize:o,children:[l.jsx(W,{vendorId:c,billId:d}),l.jsx(de,{location:n,navigate:a,billId:d,vendorId:c,currentTenant:g,bankAccountContext:f,isVendorRecommendationEnabled:I,isZeniAccountsFeatureEnabled:y})]})}const $=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t};export{fe as A,xe as D,W as V,me as a,se as b,ke as c,ve as d,he as g,ge as i,Se as v};
@@ -1 +1 @@
1
- import{j as c}from"./liveblocks-BjcYyeQ6.js";import{a2 as d,ac as f,E as l}from"./index-Bg2deWZq.js";import{D as b}from"./mui-C33Oegsm.js";import"./sentry-DZ9rNYfw.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]="c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff",e._sentryDebugIdIdentifier="sentry-dbid-c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff")}catch{}})();const p={drawerLeftMargin:new f(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:n,onClose:t}=e,a=d(),s=o?.valuePx(a)??p.drawerLeftMargin.valuePx(a),i=l();return c.jsx(b,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:n})}export{h as D};
1
+ import{j as c}from"./liveblocks-CIxx6Ub6.js";import{a2 as d,ac as f,E as l}from"./index-DOXJLxdR.js";import{D as b}from"./mui-DI0hUuFr.js";import"./sentry-BCPOyc0G.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]="c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff",e._sentryDebugIdIdentifier="sentry-dbid-c4a1a051-122a-4bbe-9cb2-6f5c19e6b4ff")}catch{}})();const p={drawerLeftMargin:new f(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:n,onClose:t}=e,a=d(),s=o?.valuePx(a)??p.drawerLeftMargin.valuePx(a),i=l();return c.jsx(b,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:i.colors.black,opacity:.8,cursor:"pointer"}}},onClose:t,children:n})}export{h as D};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-BjcYyeQ6.js";import{a as d}from"./sentry-DZ9rNYfw.js";import{h as B,u as A,g as G,i as F,j as l,N as q,l as $,n as N,o as O}from"./core-B-8b0iz9.js";import{WZ as _,fF as M,We as R,m$ as V,Sf as b,X2 as Y,WT as z,l$ as U,Sg as S,Wj as X,Wk as Z,WV as H,WU as J}from"./zeni-epic-state-95zxmizy.js";import{b9 as K,k as L,a5 as Q,p as tt}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import{d as k}from"./decodeURIComponentSafe-hAviH84T.js";import{w as et}from"./withTransactionSidePanel-iXTpLDC6.js";import{f as at,c as nt}from"./routePaths-Cz0AF8Dx.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./useAskAiCfoHostNavButtonProps-BZHyrLWc.js";import"./TransactionDetailScreen-CN2_Ei-4.js";import"./useInitialThreadRequest-C3Htu0iZ.js";import"./expenseAutomationHelper-BzOPc0En.js";import"./stripSplatSuffix-Te2Zqy4u.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]="2f66b6e9-a790-460e-89c6-eaab7fd60429",a._sentryDebugIdIdentifier="sentry-dbid-2f66b6e9-a790-460e-89c6-eaab7fd60429")}catch{}})();const ot=$((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:L,isAccountingClassesEnabled:U(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(X()),a(Z()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Q(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(K),it=et((function({entityType:a,...t}){const e=B(),o=A(),c=G(),[m,T]=d.useState(!1),[h,g]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:W,entityNameEncoded:j}=F(),r=k(W??""),p=k(j??""),f=rt(r,p),w=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},D=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),x=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>R(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(V(i)))}),[m,f,i]);const E=l((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??D,v=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,D);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(g(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:x,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),g(!1)},...t}):s.jsx(q,{to:I(w.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function xt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{xt as EntityDetailRoutes,xt as default};
1
+ import{j as s}from"./liveblocks-CIxx6Ub6.js";import{a as d}from"./sentry-BCPOyc0G.js";import{h as B,u as A,g as G,i as F,j as l,N as q,l as $,n as N,o as O}from"./core-Caq7Zbsp.js";import{WZ as _,fF as M,We as R,m$ as V,Sf as b,X2 as Y,WT as z,l$ as U,Sg as S,Wj as X,Wk as Z,WV as H,WU as J}from"./zeni-epic-state-DROyxOLw.js";import{b9 as K,k as L,a5 as Q,p as tt}from"./index-DOXJLxdR.js";import"./mui-DI0hUuFr.js";import{d as k}from"./decodeURIComponentSafe-DmjyT4t5.js";import{w as et}from"./withTransactionSidePanel-C1wVwRW0.js";import{f as at,c as nt}from"./routePaths-C1OqXYGB.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./useAskAiCfoHostNavButtonProps-BvhP40c_.js";import"./TransactionDetailScreen-fc6wRDCa.js";import"./useInitialThreadRequest-uu8NipM7.js";import"./expenseAutomationHelper-B83Qa5Jl.js";import"./stripSplatSuffix-Dmnnw5Oe.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]="2f66b6e9-a790-460e-89c6-eaab7fd60429",a._sentryDebugIdIdentifier="sentry-dbid-2f66b6e9-a790-460e-89c6-eaab7fd60429")}catch{}})();const ot=$((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:L,isAccountingClassesEnabled:U(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(H({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(J("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(X()),a(Z()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Q(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(b(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(K),it=et((function({entityType:a,...t}){const e=B(),o=A(),c=G(),[m,T]=d.useState(!1),[h,g]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:W,entityNameEncoded:j}=F(),r=k(W??""),p=k(j??""),f=rt(r,p),w=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},D=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),x=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>R(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(V(i)))}),[m,f,i]);const E=l((n=>n.trendState.fetchState)),P=u?.selectedPeriod?.timePeriod??D,v=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,D);return d.useEffect((()=>{m===!0&&h===!1&&E==="Completed"&&(g(!0),P!=null&&o(b(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:P})))}),[m,h,E]),f?s.jsx(ot,{firstMonthOfFY:x,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),g(!1)},...t}):s.jsx(q,{to:I(w.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function xt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{xt as EntityDetailRoutes,xt as default};