@zeniai/web-app-ui 5.3.25-qa → 5.3.26-qa

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/assets/{AccountMappingScreen-C0aQk3eU.js → AccountMappingScreen-vvnlkgXd.js} +1 -1
  2. package/dist/assets/AddressRoutes-CqGLkDqt.js +1 -0
  3. package/dist/assets/{AddressScreen-BD6hfTYm.js → AddressScreen-anqh6to9.js} +1 -1
  4. package/dist/assets/{AiCfoScreen-BQBOwbGt.js → AiCfoScreen-ZhNzgLev.js} +1 -1
  5. package/dist/assets/{AppDrawer-DhN1iuHe.js → AppDrawer-DMcZyfYw.js} +1 -1
  6. package/dist/assets/{BillPayApprovalRoutes-D-5hMi6f.js → BillPayApprovalRoutes-BWcKljpL.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-Bl_cSE9O.js → BillPayRoutes-DxfZSGDE.js} +1 -1
  8. package/dist/assets/{BusinessVerificationPageScreen-C37udtB6.js → BusinessVerificationPageScreen-BnngOdPs.js} +1 -1
  9. package/dist/assets/{CardsAiCfoScreen-DmUDeMY2.js → CardsAiCfoScreen-C9jErKn4.js} +1 -1
  10. package/dist/assets/{ChargeCardRoutes-BbRPoXSC.js → ChargeCardRoutes-CpllRZ3I.js} +1 -1
  11. package/dist/assets/{CompanyPassportScreen-C02FQ11m.js → CompanyPassportScreen-BQcZnLc-.js} +1 -1
  12. package/dist/assets/{ConnectionAuthScreen-MC_AsURR.js → ConnectionAuthScreen-D3Mf7qK3.js} +1 -1
  13. package/dist/assets/CustomerOnboardingAuthScreen-C0sBjs60.js +1 -0
  14. package/dist/assets/{CustomerOnboardingRoutes-C3c9eOtd.js → CustomerOnboardingRoutes-C4NalCKf.js} +1 -1
  15. package/dist/assets/{DashboardRoutes-C_2UjNDc.js → DashboardRoutes-BYYgNdD2.js} +1 -1
  16. package/dist/assets/{DefaultTenantHome-DhIA-Auv.js → DefaultTenantHome-C6nJD7za.js} +1 -1
  17. package/dist/assets/{DomesticWireDetailScreen-BQNmPyj8.js → DomesticWireDetailScreen-Df9Zx-eI.js} +1 -1
  18. package/dist/assets/{DrawerScreen-BRJIwisq.js → DrawerScreen-B_ZAZq-c.js} +1 -1
  19. package/dist/assets/{EntityDetailRoutes-DbfX6l2s.js → EntityDetailRoutes-BPJmlwG-.js} +1 -1
  20. package/dist/assets/{ExpenseAutomationRoutes-BTeDD1VK.js → ExpenseAutomationRoutes-8pbTDpsO.js} +1 -1
  21. package/dist/assets/{FeaturePreviewScreen-o3aGYwm3.js → FeaturePreviewScreen-BhcrS0dM.js} +1 -1
  22. package/dist/assets/{HubSpotOAuthCallbackScreen-WSu5A4Ct.js → HubSpotOAuthCallbackScreen-DY9bdeeM.js} +1 -1
  23. package/dist/assets/{InboxNotificationsProvider-DDRknvRh.js → InboxNotificationsProvider-yp4VlF4V.js} +1 -1
  24. package/dist/assets/InvoicingRoutes-D5cSux-9.js +2 -0
  25. package/dist/assets/{MagicLinkRoutes-BjW61OFo.js → MagicLinkRoutes-rwao6E2u.js} +1 -1
  26. package/dist/assets/{MagicLinkSignInScreen-CuZ2N1Pw.js → MagicLinkSignInScreen-e8SmU6Yc.js} +1 -1
  27. package/dist/assets/{MobileAppDrawer-Dt611RZ9.js → MobileAppDrawer-C9wi8312.js} +1 -1
  28. package/dist/assets/NotFoundScreen-B6L1cY3I.js +1 -0
  29. package/dist/assets/{NotificationRoutes-BrF6wQ3V.js → NotificationRoutes-HbqGfq1a.js} +1 -1
  30. package/dist/assets/{OAuthConsentScreen-BmxCN9Az.js → OAuthConsentScreen-CwgWaIOt.js} +1 -1
  31. package/dist/assets/{PandLWithForecastRoutes-CHdKE6AL.js → PandLWithForecastRoutes-nx90MfxG.js} +1 -1
  32. package/dist/assets/{PaymentLinkScreen-DvX14mnT.js → PaymentLinkScreen-CxAwIeqN.js} +1 -1
  33. package/dist/assets/{PeopleRoutes-DdiAV2ss.js → PeopleRoutes-4LCfOWjr.js} +1 -1
  34. package/dist/assets/{PerformanceRoutes-DJdm2Hjh.js → PerformanceRoutes-EfI4IfLY.js} +1 -1
  35. package/dist/assets/{Preview-CscVzNW8.js → Preview-BxM5wosg.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-Ck8uFfex.js → QBOConnectionScreen-CIODRsNA.js} +1 -1
  37. package/dist/assets/{ReimbursementApprovalRoutes-5mZE12FG.js → ReimbursementApprovalRoutes-DfUkgvoL.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BFUt_Xh2.js → ReimbursementApprovalRuleDetailScreen-HPs-AWde.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-CLw3cjMk.js → ReimbursementRoutes-DvUFtazN.js} +1 -1
  40. package/dist/assets/{ReportsRoutes-CBUKpJzK.js → ReportsRoutes-CFpVRFNe.js} +1 -1
  41. package/dist/assets/{RewardsRoutes-BBrOnwnJ.js → RewardsRoutes-CS-_8unl.js} +1 -1
  42. package/dist/assets/{ScreenRoutes-BUG6uyqt.js → ScreenRoutes-B_vqHZtF.js} +2 -2
  43. package/dist/assets/{SettingsRoutes-D9auvf6o.js → SettingsRoutes-Dv5UDyEV.js} +1 -1
  44. package/dist/assets/{SetupPagesScreen-C6kDqRGd.js → SetupPagesScreen-CvaReXCR.js} +1 -1
  45. package/dist/assets/{SignInScreen-DRDEbF4D.js → SignInScreen-Cis2Hrqo.js} +1 -1
  46. package/dist/assets/{SignOutScreen-uoV20vWX.js → SignOutScreen-CgiJ4aJR.js} +1 -1
  47. package/dist/assets/{TaskListScreen-Cln-YyNE.js → TaskListScreen-DsFWTjuD.js} +1 -1
  48. package/dist/assets/{TaskRoutes-CMDSqiu4.js → TaskRoutes-BDVAqm9e.js} +1 -1
  49. package/dist/assets/TransactionDetailRoutes-BDvPcX4f.js +1 -0
  50. package/dist/assets/{TransactionDetailScreen-B38w1Q4M.js → TransactionDetailScreen-Bgc2K53s.js} +1 -1
  51. package/dist/assets/{TransactionListRoutes-CtUzO7h7.js → TransactionListRoutes-ChfbF5Yn.js} +1 -1
  52. package/dist/assets/{TreasuryRoutes-CaCxjqBo.js → TreasuryRoutes-OIkwuzMV.js} +1 -1
  53. package/dist/assets/{VendorsRoutes-P3oVwEbQ.js → VendorsRoutes-BUXB41aT.js} +1 -1
  54. package/dist/assets/{WiseConfirmationScreen-BCBFNvno.js → WiseConfirmationScreen-D9W1pM9c.js} +1 -1
  55. package/dist/assets/{ZeniAccountRoutes-BRGQxOqx.js → ZeniAccountRoutes-DD4g7Ugu.js} +1 -1
  56. package/dist/assets/{ZeniAccountStatementScreen-DQaLVOUo.js → ZeniAccountStatementScreen-BlteVo42.js} +1 -1
  57. package/dist/assets/{accountMappingHelper-L9SkIWKz.js → accountMappingHelper-C4yUO_tP.js} +1 -1
  58. package/dist/assets/{analytics-CsbG8awP.js → analytics-p9dV2gEo.js} +1 -1
  59. package/dist/assets/{analyticsHelper-DtAHYi5r.js → analyticsHelper-Cq4tYGNc.js} +1 -1
  60. package/dist/assets/{core-CGqhbBHO.js → core-35eDsgGP.js} +1 -1
  61. package/dist/assets/{decodeURIComponentSafe-6FvQaIqS.js → decodeURIComponentSafe-DhnAz_92.js} +1 -1
  62. package/dist/assets/{dnd-CyZNzT3I.js → dnd-Dm1d6mZC.js} +1 -1
  63. package/dist/assets/{empty-CIUWZs8G.js → empty-BDPRkuRZ.js} +1 -1
  64. package/dist/assets/{empty-EE_1cMfQ.js → empty-DpY1OPz6.js} +1 -1
  65. package/dist/assets/{emptyVideoElement-CPGcaaig.js → emptyVideoElement-C6tD2_Is.js} +1 -1
  66. package/dist/assets/{epic-Cxd3kHt9.js → epic-BLC2ItWM.js} +1 -1
  67. package/dist/assets/{expenseAutomationHelper-wwug0Eyp.js → expenseAutomationHelper-XBf0IYWB.js} +1 -1
  68. package/dist/assets/{getLocaleForTenant-CSGkphtC.js → getLocaleForTenant-C0JZQLGG.js} +1 -1
  69. package/dist/assets/{index-BcNWzeQF.js → index-B3U6gyEe.js} +1 -1
  70. package/dist/assets/{index-CoKBrrSw.js → index-BBhWSYD8.js} +6 -6
  71. package/dist/assets/{index-Dv01hTrY.js → index-CJI7GB_s.js} +1 -1
  72. package/dist/assets/{index-QncEC5ur.js → index-D-ldiYpS.js} +1 -1
  73. package/dist/assets/{index-BVFow4eV.js → index-D-oz9cOM.js} +1 -1
  74. package/dist/assets/{index-BswIxmLx.js → index-DHtuXNZa.js} +1 -1
  75. package/dist/assets/{index-CpkJ0bAk.js → index-DqXFykf0.js} +1 -1
  76. package/dist/assets/{index-tzevB3Ch.js → index-g5u7iWai.js} +2 -2
  77. package/dist/assets/{lexical-C5ZCOEAv.js → lexical-DQ4lSvQh.js} +1 -1
  78. package/dist/assets/{liveblocks-D83XGo_c.js → liveblocks-D0hIH2N0.js} +1 -1
  79. package/dist/assets/{lottie-DeqWxWVC.js → lottie-TJOzQ6Cz.js} +1 -1
  80. package/dist/assets/{mui-CD71lp6N.js → mui-CY_LMiAy.js} +1 -1
  81. package/dist/assets/{pathToGoBack-CoDJzfH-.js → pathToGoBack-n4Mx0taW.js} +1 -1
  82. package/dist/assets/{pdf-D4eEcTTi.js → pdf-DElOA9Iz.js} +3 -3
  83. package/dist/assets/{pdf-lib-Bd7L71QV.js → pdf-lib-D54M6RaZ.js} +1 -1
  84. package/dist/assets/{plaid-C8_LWTII.js → plaid-CoaHurGj.js} +1 -1
  85. package/dist/assets/{pusher-BsMqYR11.js → pusher-BBz5Zhu2.js} +1 -1
  86. package/dist/assets/{react-Dd8IfcKg.js → react-CFjwLJT9.js} +1 -1
  87. package/dist/assets/{react-1_9r2O7V.js → react-CcppuOI-.js} +1 -1
  88. package/dist/assets/{react-DvKEjk5s.js → react-Cn6RRlX0.js} +1 -1
  89. package/dist/assets/{react-CNf4SjYR.js → react-DRB89Tf-.js} +1 -1
  90. package/dist/assets/{react-l2dFGOnI.js → react-DlGIFhE7.js} +1 -1
  91. package/dist/assets/{react-BEE0PagD.js → react-psgyYffq.js} +1 -1
  92. package/dist/assets/{recharts-2kmMgB1t.js → recharts-B8j-bW95.js} +1 -1
  93. package/dist/assets/{routePaths-DU2fgaW2.js → routePaths-BgYQMm9p.js} +1 -1
  94. package/dist/assets/{sentry-BPfEBx2C.js → sentry-DhqS_W-k.js} +1 -1
  95. package/dist/assets/{url-DSofFSVz.js → url-BlblTlRS.js} +1 -1
  96. package/dist/assets/{url-WFx5ES50.js → url-BniS_9P1.js} +1 -1
  97. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BBuMQpNs.js → useAiCfoDashboardSuggestedQuestionsChips-Dw4vBi90.js} +1 -1
  98. package/dist/assets/{useAskAiCfoHostNavButtonProps-C4V1Wf7u.js → useAskAiCfoHostNavButtonProps-DGTLHvUD.js} +1 -1
  99. package/dist/assets/{useChargeCardPusherEvents-B1n0Fi92.js → useChargeCardPusherEvents-COwRMcoJ.js} +1 -1
  100. package/dist/assets/{useDeviceId-D_DsCe-9.js → useDeviceId-Cd5EU_Dl.js} +1 -1
  101. package/dist/assets/{useEmailConnectResultRefresh-BxNSbaGA.js → useEmailConnectResultRefresh-D_zBEeqz.js} +1 -1
  102. package/dist/assets/{useInitialThreadRequest-CP8MsLNf.js → useInitialThreadRequest-UvGRmRxR.js} +1 -1
  103. package/dist/assets/{useTaskManagerAccess-Dl-8FUHJ.js → useTaskManagerAccess-DRrr5b-Z.js} +1 -1
  104. package/dist/assets/{utils-B6XFkcn3.js → utils-CgQOqOwX.js} +1 -1
  105. package/dist/assets/{withTransactionSidePanel-D0UiF_in.js → withTransactionSidePanel-Cyf8gB6i.js} +1 -1
  106. package/dist/assets/{zeni-epic-state-DASyz1An.js → zeni-epic-state-BRRtwAQl.js} +3 -3
  107. package/dist/index.html +1 -1
  108. package/package.json +1 -1
  109. package/dist/assets/AddressRoutes-sfAfU_xp.js +0 -1
  110. package/dist/assets/CustomerOnboardingAuthScreen-96EM2Iem.js +0 -1
  111. package/dist/assets/InvoicingRoutes-BC26Hbp1.js +0 -2
  112. package/dist/assets/NotFoundScreen-RGfzDsux.js +0 -1
  113. package/dist/assets/TransactionDetailRoutes-DMotJtMw.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as s}from"./liveblocks-D83XGo_c.js";import{t as At,A as Ge}from"./AddressScreen-BD6hfTYm.js";import Et from"./NotFoundScreen-RGfzDsux.js";import{a as d,t as Me}from"./sentry-BPfEBx2C.js";import{h as _e,g as Te,u as se,i as xe,j as A,N as Q,q as wt,l as it,n as Pt,o as H}from"./core-CGqhbBHO.js";import{fB as Y,dV as Ae,dU as Ee,bq as Dt,T7 as jt,bR as Ut,pu as Bt,Aq as Ft,At as Rt,Us as Vt,Ut as Lt,l8 as Oe,lb as ct,TI as Nt,b_ as $t,c7 as fe,AU as we,AF as Gt,Uu as me,AV as dt,Rk as Mt,ml as ut,de as lt,Uv as Qt,Uw as Kt,tK as zt,Tw as Ce,hS as qt,Tv as be,hP as Ht,Fi as Jt,tO as Zt,hH as Wt,hK as Qe,Ux as pt,Uy as Xt,L5 as Yt,Uz as en,L9 as tn,Aw as nn,UA as an,UB as on,l6 as sn,l9 as rn,B5 as cn,AH as mt,AT as dn,bE as Ke,cD as un,B4 as ze,u1 as ln,tR as pn,md as mn,gD as gn,gC as fn,gB as yn,UC as hn,Az as Cn,B6 as bn,B9 as Sn,Bc as In,Bi as kn,df as On}from"./zeni-epic-state-DASyz1An.js";import{z,I as Pe,d as W,N as vn,p as q,a6 as re,k as g,aC as _n,ag as gt,$ as Tn,c as ft,U as yt,j as X,X as ge,S as ve,aD as xn,J as qe,x as He,ac as An,aE as Je,aF as En,aG as wn}from"./index-CoKBrrSw.js";import{n as De}from"./mui-CD71lp6N.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-Ck8uFfex.js";import{u as jn,a as Un}from"./useEmailConnectResultRefresh-BxNSbaGA.js";import{u as Bn}from"./useChargeCardPusherEvents-B1n0Fi92.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";import"./empty-CIUWZs8G.js";import"./pdf-lib-Bd7L71QV.js";import"./index-QncEC5ur.js";import"./url-DSofFSVz.js";import"./index-BcNWzeQF.js";import"./decodeURIComponentSafe-6FvQaIqS.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]="6cdb5b44-ea61-4349-a06c-e16e5e14067d",e._sentryDebugIdIdentifier="sentry-dbid-6cdb5b44-ea61-4349-a06c-e16e5e14067d")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Fn=()=>{const e=_e(),l=Te(),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:w}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:E}=n(W.isDebitCardFeatureEnabled),k=vn(),O=A((S=>Y(S))),P=A((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,B=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Ae(E,O),b=Ee(O),D=[],R=_?.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),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;R===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),T===!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"),w===!1&&D.push("rewards_card");const f=A((S=>{const F=[];C===!1&&F.push("accounts_payable_aging"),o===!1&&F.push("accounts_receivable_aging"),F.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&F.push("rewards_card"),k===!1&&F.push("expense_automation_card");const J=jt(S,F);return Ut(J.reportsInOrder.map((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Bt(t.userId,B,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]),$=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($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,b,$]),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:$})]})},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-D0hIH2N0.js";import{t as At,A as Ge}from"./AddressScreen-anqh6to9.js";import Et from"./NotFoundScreen-B6L1cY3I.js";import{a as d,t as Me}from"./sentry-DhqS_W-k.js";import{h as _e,g as Te,u as se,i as xe,j as A,N as Q,q as wt,l as it,n as Pt,o as H}from"./core-35eDsgGP.js";import{fB as Y,dV as Ae,dU as Ee,bq as Dt,T7 as jt,bR as Ut,pu as Bt,Aq as Ft,At as Rt,Us as Vt,Ut as Lt,l8 as Oe,lb as ct,TI as Nt,b_ as $t,c7 as fe,AU as we,AF as Gt,Uu as me,AV as dt,Rk as Mt,ml as ut,de as lt,Uv as Qt,Uw as Kt,tK as zt,Tw as Ce,hS as qt,Tv as be,hP as Ht,Fi as Jt,tO as Zt,hH as Wt,hK as Qe,Ux as pt,Uy as Xt,L5 as Yt,Uz as en,L9 as tn,Aw as nn,UA as an,UB as on,l6 as sn,l9 as rn,B5 as cn,AH as mt,AT as dn,bE as Ke,cD as un,B4 as ze,u1 as ln,tR as pn,md as mn,gD as gn,gC as fn,gB as yn,UC as hn,Az as Cn,B6 as bn,B9 as Sn,Bc as In,Bi as kn,df as On}from"./zeni-epic-state-BRRtwAQl.js";import{z,I as Pe,d as W,N as vn,p as q,a6 as re,k as g,aC as _n,ag as gt,$ as Tn,c as ft,U as yt,j as X,X as ge,S as ve,aD as xn,J as qe,x as He,ac as An,aE as Je,aF as En,aG as wn}from"./index-BBhWSYD8.js";import{n as De}from"./mui-CY_LMiAy.js";import{g as Pn,h as Dn,q as ie}from"./QBOConnectionScreen-CIODRsNA.js";import{u as jn,a as Un}from"./useEmailConnectResultRefresh-D_zBEeqz.js";import{u as Bn}from"./useChargeCardPusherEvents-COwRMcoJ.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";import"./empty-BDPRkuRZ.js";import"./pdf-lib-D54M6RaZ.js";import"./index-D-ldiYpS.js";import"./url-BlblTlRS.js";import"./index-B3U6gyEe.js";import"./decodeURIComponentSafe-DhnAz_92.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]="6cdb5b44-ea61-4349-a06c-e16e5e14067d",e._sentryDebugIdIdentifier="sentry-dbid-6cdb5b44-ea61-4349-a06c-e16e5e14067d")}catch{}})();const Ze=e=>{switch(e){case"Complete":return"yes";case"Pending Review":case"Incomplete":return"partially";default:return"no"}},Fn=()=>{const e=_e(),l=Te(),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:w}=n(W.isReferralFeatureEnabled),{isFeatureEnabled:E}=n(W.isDebitCardFeatureEnabled),k=vn(),O=A((S=>Y(S))),P=A((S=>S.onboardingCustomerViewState.fetchState)),_=O.excludedResources,B=O.companyId??z.getSignedInUserTenant(v)?.companyId;if(t==null)throw Error("Can't access onboarding flow without signing in...");const m=Ae(E,O),b=Ee(O),D=[],R=_?.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),T=_?.resources?.find((S=>S.resource==="/bills"))==null&&!r,x=_?.resources?.find((S=>S.resource==="/reimbursements"))==null;R===!1&&D.push("top_expenses"),h===!1&&D.push("task_card"),T===!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"),w===!1&&D.push("rewards_card");const f=A((S=>{const F=[];C===!1&&F.push("accounts_payable_aging"),o===!1&&F.push("accounts_receivable_aging"),F.push("zeni_accounts_promo_card","treasury_promo_card"),w===!1&&F.push("rewards_card"),k===!1&&F.push("expense_automation_card");const J=jt(S,F);return Ut(J.reportsInOrder.map((G=>({fetchState:G.fetchState,error:G.error})))).fetchState}));d.useEffect((()=>{P!=="Completed"||a||m||b||(p(!0),i(Bt(t.userId,B,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]),$=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($,6e3);return()=>clearTimeout(S)}),[$]),d.useEffect((()=>{m||b||!u||f!=="Completed"&&f!=="Error"||$()}),[u,f,m,b,$]),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:$})]})},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};
@@ -1,4 +1,4 @@
1
- import{j as d}from"./liveblocks-D83XGo_c.js";import{i as q,j as S,g as Z,u as z,h as J,l as ne,k as oa,n as ft,o as F,N as yn}from"./core-CGqhbBHO.js";import{fB as L,UY as Ze,bE as sa,br as Ee,W9 as vn,jQ as An,Wa as Wt,Wb as In,jT as gt,Wc as Qe,Wd as En,jY as Tn,We as Yt,Wf as Dn,k0 as bt,Wg as Xe,Wh as xn,Wi as wn,Vg as Pn,l2 as On,Wj as Fn,bn as Je,Wk as ra,UM as ue,bc as ia,lg as ca,k$ as la,UO as me,UN as ae,fA as da,g6 as jn,gm as Ct,Wl as Rn,Wm as Bn,Wn as ua,Wo as Oe,C$ as Me,D0 as Ue,Do as Te,Di as pe,D4 as Le,Wp as Mn,b_ as Ve,Wq as Un,Wr as Ln,Ws as ma,Wt as Fe,Wu as Vn,e8 as et,zc as pa,Wv as Wn,Ww as ha,Wx as Yn,Wy as Gn,Wz as Nn,WA as _t,TK as kt,tg as De,lF as xe,Dy as yt,zj as $n,zq as zn,WB as Kn,WC as qn,D1 as Gt,WD as Qn,zf as Ae,za as fa,WE as be,WF as Nt,WG as Xn,WH as vt,TJ as At,Bn as ga,WI as Hn,WJ as ba,WK as Zn,WL as Jn,WM as eo,WN as It,BC as to,BJ as ao,WO as no,WP as oo,D3 as $t,WQ as so,Bl as Ca,WR as Ce,WS as zt,WT as ro,bq as Sa,DD as _a,WU as io,WV as ka,WW as co,WX as lo,WY as uo,WZ as Et,Dv as mo,Dx as po,W_ as ho,W$ as fo,D2 as Kt,X0 as go,DB as ya,X1 as Se,X2 as qt,X3 as bo,X4 as Co,X5 as va,lu as Aa,pB as Ia,lz as Ea,pz as Ta,py as Da,px as xa,AK as So,d8 as _o,pu as ko,T7 as yo,pL as vo,X6 as Ao,X7 as Io,X8 as Eo,b5 as Tt,pF as To,i9 as Do,gF as xo,pE as wo,kU as Po,pC as Oo,pA as Fo,dV as jo,dU as Ro}from"./zeni-epic-state-DASyz1An.js";import{z as V,at as oe,p as j,k as T,G as Q,b9 as Bo,aq as We,a6 as Ye,ba as wa,S as N,bb as Mo,bc as Pa,E as Uo,bd as Lo,be as Vo,a as Oa,$ as Fa,f as ja,ap as Wo,bf as Yo,am as Go,I as we,bg as Ra,y as ce,bh as Ba,bi as Ma,as as Ua,bj as No,ag as Ge,U as Ne,d as W,bk as $o,N as zo,j as Ko,a2 as qo,ao as Qo,bl as Xo,bm as Ho,bn as Zo,bo as Ie}from"./index-CoKBrrSw.js";import{n as Dt}from"./mui-CD71lp6N.js";import{a as b}from"./sentry-BPfEBx2C.js";import{w as La}from"./withTransactionSidePanel-D0UiF_in.js";import{c as Va,t as Pe,f as he,b as xt,a as wt,v as Jo}from"./routePaths-DU2fgaW2.js";import{u as se}from"./useAskAiCfoHostNavButtonProps-C4V1Wf7u.js";import Be from"./NotFoundScreen-RGfzDsux.js";import{u as Pt}from"./useInitialThreadRequest-CP8MsLNf.js";import{t as Wa}from"./analyticsHelper-DtAHYi5r.js";import{C as es}from"./CompanyPassportScreen-C02FQ11m.js";import{u as ts}from"./useAiCfoDashboardSuggestedQuestionsChips-BBuMQpNs.js";import{F as as}from"./FeaturePreviewScreen-o3aGYwm3.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";import"./TransactionDetailScreen-B38w1Q4M.js";import"./decodeURIComponentSafe-6FvQaIqS.js";import"./expenseAutomationHelper-wwug0Eyp.js";import"./MobileAppDrawer-Dt611RZ9.js";import"./InboxNotificationsProvider-DDRknvRh.js";import"./useTaskManagerAccess-Dl-8FUHJ.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]="6e6b88d2-7de6-484f-921b-3eac64c1e651",e._sentryDebugIdIdentifier="sentry-dbid-6e6b88d2-7de6-484f-921b-3eac64c1e651")}catch{}})();const ns=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=q(),s=V.getSignedInUser(),i=S((E=>E.tenantState.currentTenantId)),l=S((E=>L(E))),{tenantEmailDomain:m}=q(),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:Ze()})),[]),u=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),C=z(),g=J(),k=S((E=>vn(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(An(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),_=b.useCallback(((E,B)=>{C(Wt({sortKey:E,sortOrder:B}))}),[]),D=b.useCallback((E=>{C(Wt({downloadState:E}))}),[]),P=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const B=Va({id:E.transactionId,type:E.transactionType},m);g(B);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(B,{state:{pathnameStackToGoBack:y}})}}),[m,e]),x=b.useCallback((()=>{k.vendor!=null&&T.trackApAgingDetail("AP Aging",u.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&x()}),[x,k.fetchState]),d.jsx(Bo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:T,onTransactionClick:P,onReload:I,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:D,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),os=()=>{const e=z(),a=J(),t=S((_=>In(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AP Aging"});We({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=S((_=>_.tenantState.currentTenantId)),i=S((_=>L(_))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),h=t.apAgingUIState.selectedDate??Ee(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((_=>{e(Qe({searchString:_}))}),[]),C=b.useCallback(((_,D)=>{e(Qe({sortKey:D,sortOrder:_}))}),[]),g=b.useCallback((_=>{a(`./${_}/${h.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((_=>{e(Qe({downloadState:_}))}),[]),I=b.useCallback(((_,D)=>{}),[]),v=b.useCallback(((_,D)=>{e(Qe({selectedDate:_,agingDateSelectionType:D})),e(gt(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:T,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ss=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=q(),s=V.getSignedInUser(),i=S((x=>L(x))),{tenantEmailDomain:l}=q(),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:Ze()})),[]),c=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),u=z(),C=J(),g=S((x=>En(x,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Tn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((x,E)=>{u(Yt({sortKey:x,sortOrder:E}))}),[]),_=b.useCallback((x=>{u(Yt({downloadState:x}))}),[]),D=b.useCallback((x=>{if(e)e(x.transactionId,x.transactionType);else if(l!=null){const E=Va({id:x.transactionId,type:x.transactionType},l);C(E);const B=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:B}})}}),[l,e]),P=b.useCallback((()=>{g.customer!=null&&T.trackArAgingDetail("AR Aging",c.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&P()}),[g.fetchState,P]),d.jsx(Mo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:T,onTransactionClick:D,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),rs=()=>{const e=z(),a=J(),t=S((v=>Dn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AR Aging"});We({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=S((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),p=t.arAgingUIState.selectedDate??Ee(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(Xe({searchString:v}))}),[]),u=b.useCallback(((v,_)=>{e(Xe({sortKey:_,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(Xe({downloadState:v}))}),[]),k=b.useCallback(((v,_)=>{e(Xe({selectedDate:v,agingDateSelectionType:_})),e(bt(v))}),[]),I=b.useCallback(((v,_)=>{e(xn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Ga(e,a){const t=Pn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(On(n,o))}}}const is=ne((function(e){const a=wn(e).accountsInOrder.map(((t,n)=>Ya(t,n)));return{sectionTitle:Q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Ga)(Pa),cs=ne((function(e){const a=Fn(e).accountsInOrder.map(((o,r)=>Ya(o,r))),t=V.getSignedInUser(),n=Je(t);return{sectionTitle:Q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Ga)(Pa);function ls(){const e=J(),a=Z(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(is,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function ds(){const e=J(),a=Z(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(cs,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const us=Dt.div`
1
+ import{j as d}from"./liveblocks-D0hIH2N0.js";import{i as q,j as S,g as Z,u as z,h as J,l as ne,k as oa,n as ft,o as F,N as yn}from"./core-35eDsgGP.js";import{fB as L,UY as Ze,bE as sa,br as Ee,W9 as vn,jQ as An,Wa as Wt,Wb as In,jT as gt,Wc as Qe,Wd as En,jY as Tn,We as Yt,Wf as Dn,k0 as bt,Wg as Xe,Wh as xn,Wi as wn,Vg as Pn,l2 as On,Wj as Fn,bn as Je,Wk as ra,UM as ue,bc as ia,lg as ca,k$ as la,UO as me,UN as ae,fA as da,g6 as jn,gm as Ct,Wl as Rn,Wm as Bn,Wn as ua,Wo as Oe,C$ as Me,D0 as Ue,Do as Te,Di as pe,D4 as Le,Wp as Mn,b_ as Ve,Wq as Un,Wr as Ln,Ws as ma,Wt as Fe,Wu as Vn,e8 as et,zc as pa,Wv as Wn,Ww as ha,Wx as Yn,Wy as Gn,Wz as Nn,WA as _t,TK as kt,tg as De,lF as xe,Dy as yt,zj as $n,zq as zn,WB as Kn,WC as qn,D1 as Gt,WD as Qn,zf as Ae,za as fa,WE as be,WF as Nt,WG as Xn,WH as vt,TJ as At,Bn as ga,WI as Hn,WJ as ba,WK as Zn,WL as Jn,WM as eo,WN as It,BC as to,BJ as ao,WO as no,WP as oo,D3 as $t,WQ as so,Bl as Ca,WR as Ce,WS as zt,WT as ro,bq as Sa,DD as _a,WU as io,WV as ka,WW as co,WX as lo,WY as uo,WZ as Et,Dv as mo,Dx as po,W_ as ho,W$ as fo,D2 as Kt,X0 as go,DB as ya,X1 as Se,X2 as qt,X3 as bo,X4 as Co,X5 as va,lu as Aa,pB as Ia,lz as Ea,pz as Ta,py as Da,px as xa,AK as So,d8 as _o,pu as ko,T7 as yo,pL as vo,X6 as Ao,X7 as Io,X8 as Eo,b5 as Tt,pF as To,i9 as Do,gF as xo,pE as wo,kU as Po,pC as Oo,pA as Fo,dV as jo,dU as Ro}from"./zeni-epic-state-BRRtwAQl.js";import{z as V,at as oe,p as j,k as T,G as Q,b9 as Bo,aq as We,a6 as Ye,ba as wa,S as N,bb as Mo,bc as Pa,E as Uo,bd as Lo,be as Vo,a as Oa,$ as Fa,f as ja,ap as Wo,bf as Yo,am as Go,I as we,bg as Ra,y as ce,bh as Ba,bi as Ma,as as Ua,bj as No,ag as Ge,U as Ne,d as W,bk as $o,N as zo,j as Ko,a2 as qo,ao as Qo,bl as Xo,bm as Ho,bn as Zo,bo as Ie}from"./index-BBhWSYD8.js";import{n as Dt}from"./mui-CY_LMiAy.js";import{a as b}from"./sentry-DhqS_W-k.js";import{w as La}from"./withTransactionSidePanel-Cyf8gB6i.js";import{c as Va,t as Pe,f as he,b as xt,a as wt,v as Jo}from"./routePaths-BgYQMm9p.js";import{u as se}from"./useAskAiCfoHostNavButtonProps-DGTLHvUD.js";import Be from"./NotFoundScreen-B6L1cY3I.js";import{u as Pt}from"./useInitialThreadRequest-UvGRmRxR.js";import{t as Wa}from"./analyticsHelper-Cq4tYGNc.js";import{C as es}from"./CompanyPassportScreen-BQcZnLc-.js";import{u as ts}from"./useAiCfoDashboardSuggestedQuestionsChips-Dw4vBi90.js";import{F as as}from"./FeaturePreviewScreen-BhcrS0dM.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";import"./TransactionDetailScreen-Bgc2K53s.js";import"./decodeURIComponentSafe-DhnAz_92.js";import"./expenseAutomationHelper-XBf0IYWB.js";import"./MobileAppDrawer-C9wi8312.js";import"./InboxNotificationsProvider-yp4VlF4V.js";import"./useTaskManagerAccess-DRrr5b-Z.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]="6e6b88d2-7de6-484f-921b-3eac64c1e651",e._sentryDebugIdIdentifier="sentry-dbid-6e6b88d2-7de6-484f-921b-3eac64c1e651")}catch{}})();const ns=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{vendorId:o,reportDate:r}=q(),s=V.getSignedInUser(),i=S((E=>E.tenantState.currentTenantId)),l=S((E=>L(E))),{tenantEmailDomain:m}=q(),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:Ze()})),[]),u=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),C=z(),g=J(),k=S((E=>vn(E,u,o))),I=b.useCallback((()=>{o!=null&&k.fetchState!=="In-Progress"&&k.fetchState!=="Completed"&&C(An(o,u))}),[u]),v=b.useCallback((()=>{g("../../",{relative:"path"})}),[]),_=b.useCallback(((E,B)=>{C(Wt({sortKey:E,sortOrder:B}))}),[]),D=b.useCallback((E=>{C(Wt({downloadState:E}))}),[]),P=b.useCallback((E=>{if(e)e(E.transactionId,E.transactionType);else if(m!=null){const B=Va({id:E.transactionId,type:E.transactionType},m);g(B);const y=j(p.state?.pathnameStackToGoBack,p.pathname);g(B,{state:{pathnameStackToGoBack:y}})}}),[m,e]),x=b.useCallback((()=>{k.vendor!=null&&T.trackApAgingDetail("AP Aging",u.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),k.vendor.id,k.vendor.name)}),[k.vendor,u]);return b.useEffect((()=>{I()}),[]),b.useEffect((()=>{k.fetchState==="Completed"&&x()}),[x,k.fetchState]),d.jsx(Bo,{apAgingDetail:k,downloadParams:c,reportDate:u,analytics:T,onTransactionClick:P,onReload:I,onBackClick:v,onColumnSortConfigChanged:_,updateDownloadStateHandler:D,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),os=()=>{const e=z(),a=J(),t=S((_=>In(_))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AP Aging"});We({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=S((_=>_.tenantState.currentTenantId)),i=S((_=>L(_))),l=i?.companyName??"",m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s??""},p=b.useMemo((()=>({authParams:m,companyName:l,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),h=t.apAgingUIState.selectedDate??Ee(),f=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(gt(h))}),[]);b.useEffect((()=>{f()}),[]);const c=b.useCallback((()=>{a("../",{relative:"path"})}),[]),u=b.useCallback((_=>{e(Qe({searchString:_}))}),[]),C=b.useCallback(((_,D)=>{e(Qe({sortKey:D,sortOrder:_}))}),[]),g=b.useCallback((_=>{a(`./${_}/${h.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[h]),k=b.useCallback((_=>{e(Qe({downloadState:_}))}),[]),I=b.useCallback(((_,D)=>{}),[]),v=b.useCallback(((_,D)=>{e(Qe({selectedDate:_,agingDateSelectionType:D})),e(gt(_))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:_=>_.trackPageLoaded(N.Event.agingReport,"AP Aging")}):null,d.jsx(wa,{uiState:t.apAgingUIState,report:t,downloadParams:p,analytics:T,onReloadReport:f,onBackClick:c,onSearchTextChange:u,onSortOrderChange:C,onEntityNameClick:g,updateDownloadStateHandler:k,onSelectedDateChanged:v,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},ss=La((function({openTransactionPanel:e,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n}){const{customerId:o,reportDate:r}=q(),s=V.getSignedInUser(),i=S((x=>L(x))),{tenantEmailDomain:l}=q(),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:Ze()})),[]),c=b.useMemo((()=>r!=null?sa(r):Ee()),[r]),u=z(),C=J(),g=S((x=>En(x,c,o))),k=b.useCallback((()=>{o!=null&&g.fetchState!=="In-Progress"&&g.fetchState!=="Completed"&&u(Tn(o,c))}),[c]),I=b.useCallback((()=>{C("../../",{relative:"path"})}),[]),v=b.useCallback(((x,E)=>{u(Yt({sortKey:x,sortOrder:E}))}),[]),_=b.useCallback((x=>{u(Yt({downloadState:x}))}),[]),D=b.useCallback((x=>{if(e)e(x.transactionId,x.transactionType);else if(l!=null){const E=Va({id:x.transactionId,type:x.transactionType},l);C(E);const B=j(m.state?.pathnameStackToGoBack,m.pathname);C(E,{state:{pathnameStackToGoBack:B}})}}),[l,e]),P=b.useCallback((()=>{g.customer!=null&&T.trackArAgingDetail("AR Aging",c.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat),g.customer.id,g.customer.name)}),[g.customer,c]);return b.useEffect((()=>{k()}),[]),b.useEffect((()=>{g.fetchState==="Completed"&&P()}),[g.fetchState,P]),d.jsx(Mo,{arAgingDetail:g,downloadParams:f,reportDate:c,analytics:T,onTransactionClick:D,onReload:k,onBackClick:I,onColumnSortConfigChanged:v,updateDownloadStateHandler:_,panelContent:a,sidePanelIsOpen:t,sidePanelIsFullView:n})})),rs=()=>{const e=z(),a=J(),t=S((v=>Dn(v))),{isAiCfoAccessEnabled:n,onAskAiCfoClick:o}=se({mobileExploreReferrer:"AR Aging"});We({isDataReady:t.fetchState==="Completed"});const r=V.getSignedInUser(),s=S((v=>L(v))),i=s.companyName,l={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:s.tenantId},m=b.useMemo((()=>({authParams:l,companyName:i,downloadEndPoint:`${oe}/agingReport`,timezone:Ze()})),[]),p=t.arAgingUIState.selectedDate??Ee(),h=b.useCallback((()=>{t.fetchState!=="In-Progress"&&t.fetchState!=="Completed"&&e(bt(p))}),[]);b.useEffect((()=>{h()}),[]);const f=b.useCallback((()=>{a("../",{relative:"path"})}),[]),c=b.useCallback((v=>{e(Xe({searchString:v}))}),[]),u=b.useCallback(((v,_)=>{e(Xe({sortKey:_,sortOrder:v}))}),[]),C=b.useCallback((v=>{a(`./${v}/${p.format(Q.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat)}`)}),[p]),g=b.useCallback((v=>{e(Xe({downloadState:v}))}),[]),k=b.useCallback(((v,_)=>{e(Xe({selectedDate:v,agingDateSelectionType:_})),e(bt(v))}),[]),I=b.useCallback(((v,_)=>{e(xn({nodeId:v,isCollapsed:_}))}),[]);return d.jsxs(d.Fragment,{children:[t.fetchState==="Completed"?d.jsx(Ye,{analytics:T,onLoad:v=>v.trackPageLoaded(N.Event.agingReport,"AR Aging")}):null,d.jsx(wa,{uiState:t.arAgingUIState,report:t,downloadParams:m,analytics:T,onReloadReport:h,onBackClick:f,onSearchTextChange:c,onSortOrderChange:u,onEntityNameClick:C,updateDownloadStateHandler:g,onSelectedDateChanged:k,onNodeCollapseToggled:I,isAiCfoAccessEnabled:n,onAskAiCfoClick:o})]})},Ya=(e,a)=>({key:a,title:e.accountName,amount:e.balance?.available,logoUri:e.logo?.toString(),source:e});function Ga(e,a){const t=Pn(a.firstMonthOfFY);return{onItemClick:(n,o)=>{const r=o.accountName===""?o.accountDescription:o.accountName,s=Pe(a.tenantEmailDomain,o.accountId,o.accountType,r,"quarter",t,!1),i=j(a.location.state?.pathnameStackToGoBack,a.location.pathname);a.navigate(s,{state:{pathnameStackToGoBack:i,referrer:a.referrerType}})},onSetAccountsStatementDate:(n,o)=>{e(On(n,o))}}}const is=ne((function(e){const a=wn(e).accountsInOrder.map(((t,n)=>Ya(t,n)));return{sectionTitle:Q.getLocalizedStrings().balanceCard.cashBalanceSectionTitle,transactionArray:a,fetchState:e.cashBalanceState.fetchState,analytics:T}}),Ga)(Pa),cs=ne((function(e){const a=Fn(e).accountsInOrder.map(((o,r)=>Ya(o,r))),t=V.getSignedInUser(),n=Je(t);return{sectionTitle:Q.getLocalizedStrings().balanceCard.cardBalanceSectionTitle,transactionArray:a,isZeniUser:n,fetchState:e.cardBalanceState.fetchState,analytics:T}}),Ga)(Pa);function ls(){const e=J(),a=Z(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cashBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(is,{tenantEmailDomain:t,location:a,referrerType:"Cash Balance",navigate:e,firstMonthOfFY:n})}function ds(){const e=J(),a=Z(),{tenantEmailDomain:t}=q(),n=S((o=>L(o).company?.companyInfo.firstMonthOfFY??1));return S((o=>o.cardBalanceState.fetchState))==="Error"?d.jsx(Be,{}):d.jsx(cs,{tenantEmailDomain:t,location:a,referrerType:"Card Balance",navigate:e,firstMonthOfFY:n})}const us=Dt.div`
2
2
  display: flex;
3
3
  flex: 1 1 auto;
4
4
  min-height: 100%;
@@ -1 +1 @@
1
- import{j as v}from"./liveblocks-D83XGo_c.js";import{a as u}from"./sentry-BPfEBx2C.js";import{u as w,j as b,l as y,g as A,N}from"./core-CGqhbBHO.js";import{SV as U,fB as _,gh as k,SW as L,pw as R,SX as z}from"./zeni-epic-state-DASyz1An.js";import{u as j,z as f,L as T,t as I,G as O,b as $}from"./index-CoKBrrSw.js";import"./mui-CD71lp6N.js";import{t as P}from"./getLocaleForTenant-CSGkphtC.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.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]="f8756728-1c04-4d1c-a6a4-22d782091e0d",t._sentryDebugIdIdentifier="sentry-dbid-f8756728-1c04-4d1c-a6a4-22d782091e0d")}catch{}})();const G=y((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(N,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=w(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(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"],V={"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 V[s]}export{oe as default};
1
+ import{j as v}from"./liveblocks-D0hIH2N0.js";import{a as u}from"./sentry-DhqS_W-k.js";import{u as w,j as b,l as y,g as A,N}from"./core-35eDsgGP.js";import{SV as U,fB as _,gh as k,SW as L,pw as R,SX as z}from"./zeni-epic-state-BRRtwAQl.js";import{u as j,z as f,L as T,t as I,G as O,b as $}from"./index-BBhWSYD8.js";import"./mui-CY_LMiAy.js";import{t as P}from"./getLocaleForTenant-C0JZQLGG.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.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]="f8756728-1c04-4d1c-a6a4-22d782091e0d",t._sentryDebugIdIdentifier="sentry-dbid-f8756728-1c04-4d1c-a6a4-22d782091e0d")}catch{}})();const G=y((function(t){return{fetchState:t.tenantState.fetchState,activeTenantFetchState:t.tenantState.activeTenantFetchState.fetchState,currentTenant:_(t),tenantsInOrder:z(t).tenantsInOrder}}))((function({fetchState:t,activeTenantFetchState:s,currentTenant:o,tenantsInOrder:h}){const r=A(),p=new URLSearchParams(r.search);if(o==null||t!=="Completed"&&s!=="Completed")return null;{let m="";const n=h.map((l=>l.tenantEmailDomain)),i=r.state?.origin,a=r.state?.queryParams;let c=`../${o.tenantEmailDomain}`,d=null,e=!1,g=null,S=null;const C=E(r.pathname);if(C!=null)c=`../${o.tenantEmailDomain}/${C}`,m="comingFromV2UrlPath",C==="ai-cfo/explore"&&(d=p.get("question")?.replace(/^["']|["']$/g,"")??null,e=p.get("should_submit")==="true");else if(i!=null)if(n.reduce(((l,F)=>l||i.split("/").find((D=>D===F))!=null),!1))c=i,i.includes("ai-cfo")&&a!=null&&(g=a.aiCfoRef??null,S=a.aiCfoEmailRefId??null);else{const l=E(i);l!=null?(c=`../${o.tenantEmailDomain}/${l}`,m="comingFromV2UrlPath",l==="ai-cfo/explore"&&a!=null&&(a.aiCfoQuestion!=null&&(d=a.aiCfoQuestion),a.aiCfoShouldSubmit==="true"&&(e=!0))):console.warn("Don't have access to previous path tenant!")}const x=$(c,p);return v.jsx(N,{to:x,replace:!0,state:{...r.state,origin:"",message:m,aiCfoInitialQuestion:d,aiCfoShouldSubmit:e,aiCfoRef:g,aiCfoEmailRefId:S}})}}));function oe(){const t=w(),{setLoading:s,clearAllLoading:o}=j(),h=u.useRef(!1),r=u.useRef(!1),p=u.useRef(null),m=b((e=>U(e))),n=b((e=>e.tenantState.fetchState)),i=b((e=>e.tenantState.error)),a=b((e=>e.tenantState.activeTenantFetchState.fetchState)),c=b((e=>_(e))),d=f.getSignedInUser();return u.useLayoutEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId??null;p.current!==e&&(p.current=e,h.current=!1,r.current=!1,s(T.TENANT_FETCHING)),!h.current||a!=="Completed"&&a!=="Error"||(h.current=!1),!r.current||n!=="Completed"&&n!=="Error"||(r.current=!1)}),[a,n]),u.useEffect((()=>{const e=f.getActiveTenantForUser()?.tenantId;h.current===!1&&d!=null&&e!=null&&I.shouldFetchActiveTenant(e)&&(h.current=!0,I.markActiveTenantFetchStarted(e),n==="Completed"||a!=="Not-Started"&&a!=="Error"||(s(T.TENANT_FETCHING),t(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"],V={"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 V[s]}export{oe as default};
@@ -1,4 +1,4 @@
1
- import{j as l}from"./liveblocks-D83XGo_c.js";import{h as w,g as C,j as h,l as A,i as B}from"./core-CGqhbBHO.js";import{XO as k,XV as _,gD as M,gC as J,gB as K,kt as L,UN as W,tU as Y,fB as V,Xl as D,kr as T,XP as S,XY as F,kp as G,kM as j}from"./zeni-epic-state-DASyz1An.js";import{bK as q,$ as N,I as R,z as U,E as O,a2 as p,d as v,a5 as X,bL as Q,J as Z,bM as ee,p as te}from"./index-CoKBrrSw.js";import{n as z}from"./mui-CD71lp6N.js";import"./sentry-BPfEBx2C.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]="f31a6d4e-386f-4100-8b2e-59b5f89862dc",e._sentryDebugIdIdentifier="sentry-dbid-f31a6d4e-386f-4100-8b2e-59b5f89862dc")}catch{}})();const ne=A(null,(function(e,t){return{onSaveVendor:n=>{e(L(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(W("common")),n!=null&&e(Y(n))},onGetOtp:n=>{e(K(n,"BillPayVendor"))},onResendOtp:n=>{e(J(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(M(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}}))(q);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=z.div`
1
+ import{j as l}from"./liveblocks-D0hIH2N0.js";import{h as w,g as C,j as h,l as A,i as B}from"./core-35eDsgGP.js";import{XO as k,XV as _,gD as M,gC as J,gB as K,kt as L,UN as W,tU as Y,fB as V,Xl as D,kr as T,XP as S,XY as F,kp as G,kM as j}from"./zeni-epic-state-BRRtwAQl.js";import{bK as q,$ as N,I as R,z as U,E as O,a2 as p,d as v,a5 as X,bL as Q,J as Z,bM as ee,p as te}from"./index-BBhWSYD8.js";import{n as z}from"./mui-CY_LMiAy.js";import"./sentry-DhqS_W-k.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]="f31a6d4e-386f-4100-8b2e-59b5f89862dc",e._sentryDebugIdIdentifier="sentry-dbid-f31a6d4e-386f-4100-8b2e-59b5f89862dc")}catch{}})();const ne=A(null,(function(e,t){return{onSaveVendor:n=>{e(L(t.vendorId!==void 0?t.vendorId:void 0,t.billId,void 0,t.isExpressPayPage)),e(W("common")),n!=null&&e(Y(n))},onGetOtp:n=>{e(K(n,"BillPayVendor"))},onResendOtp:n=>{e(J(n,"BillPayVendor"))},onVerifyOtp:(n,a)=>{e(M(n,a,"BillPayVendor"))},onVerifyOtpSuccess:(n,a,o)=>{e(_(n,a,o))}}}))(q);function H({vendorId:e,billId:t,isExpressPayPage:n}){const a=w(),o=C(),s=h((d=>k(d,e)));return l.jsx(ne,{location:o,navigate:a,vendorId:e,billId:t,vendorViewDetails:s,isExpressPayPage:n??!1})}const ae=z.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as i}from"./liveblocks-D83XGo_c.js";import{$ as l,a9 as c,E as f}from"./index-CoKBrrSw.js";import{D as p}from"./mui-CD71lp6N.js";import"./sentry-BPfEBx2C.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]="2824c378-4612-492a-96d5-c25aed4d9576",e._sentryDebugIdIdentifier="sentry-dbid-2824c378-4612-492a-96d5-c25aed4d9576")}catch{}})();const u={drawerLeftMargin:new c(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:a}=e,n=l(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),d=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:d.colors.black,opacity:.8,cursor:"pointer"}}},onClose:a,children:t})}export{h as D};
1
+ import{j as i}from"./liveblocks-D0hIH2N0.js";import{$ as l,a9 as c,E as f}from"./index-BBhWSYD8.js";import{D as p}from"./mui-CY_LMiAy.js";import"./sentry-DhqS_W-k.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]="2824c378-4612-492a-96d5-c25aed4d9576",e._sentryDebugIdIdentifier="sentry-dbid-2824c378-4612-492a-96d5-c25aed4d9576")}catch{}})();const u={drawerLeftMargin:new c(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:a}=e,n=l(),s=o?.valuePx(n)??u.drawerLeftMargin.valuePx(n),d=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:d.colors.black,opacity:.8,cursor:"pointer"}}},onClose:a,children:t})}export{h as D};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-D83XGo_c.js";import{a as d}from"./sentry-BPfEBx2C.js";import{h as G,u as A,g as F,i as V,j as l,N as q,l as R,n as N,o as O}from"./core-CGqhbBHO.js";import{VR as _,fB as M,Vh as U,mF as W,Rd as k,VW as Y,UM as $,lF as z,Re as P,Vm as H,Vn as J,UO as K,UN as L}from"./zeni-epic-state-DASyz1An.js";import{b6 as Q,k as X,a2 as Z,p as tt}from"./index-CoKBrrSw.js";import"./mui-CD71lp6N.js";import{d as S}from"./decodeURIComponentSafe-6FvQaIqS.js";import{w as et}from"./withTransactionSidePanel-D0UiF_in.js";import{f as at,c as nt}from"./routePaths-DU2fgaW2.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";import"./useAskAiCfoHostNavButtonProps-C4V1Wf7u.js";import"./TransactionDetailScreen-B38w1Q4M.js";import"./useInitialThreadRequest-CP8MsLNf.js";import"./expenseAutomationHelper-wwug0Eyp.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]="2e947abe-e8b9-49bc-b541-a66d3c6937b8",a._sentryDebugIdIdentifier="sentry-dbid-2e947abe-e8b9-49bc-b541-a66d3c6937b8")}catch{}})();const ot=R((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:$(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:z(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(K({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(H()),a(J()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(P(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(P(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(Q),it=et((function({entityType:a,...t}){const e=G(),o=A(),c=F(),[m,h]=d.useState(!1),[T,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:j}=V(),r=S(x??""),p=S(j??""),u=rt(r,p),v=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),w=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),f=l((n=>U(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&u===!0&&(h(!0),o(W(i)))}),[m,u,i]);const b=l((n=>n.trendState.fetchState)),E=f?.selectedPeriod?.timePeriod??g,B=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(f?.selectedPeriod?.timePeriod,g);return d.useEffect((()=>{m===!0&&T===!1&&b==="Completed"&&(D(!0),E!=null&&o(k(i,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:E})))}),[m,T,b]),u?s.jsx(ot,{firstMonthOfFY:w,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:B,resetTrendIsFetchedStates:()=>{h(!1),D(!1)},...t}):s.jsx(q,{to:I(v.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function vt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{vt as EntityDetailRoutes,vt as default};
1
+ import{j as s}from"./liveblocks-D0hIH2N0.js";import{a as d}from"./sentry-DhqS_W-k.js";import{h as G,u as A,g as F,i as V,j as l,N as q,l as R,n as N,o as O}from"./core-35eDsgGP.js";import{VR as _,fB as M,Vh as U,mF as W,Rd as k,VW as Y,UM as $,lF as z,Re as P,Vm as H,Vn as J,UO as K,UN as L}from"./zeni-epic-state-BRRtwAQl.js";import{b6 as Q,k as X,a2 as Z,p as tt}from"./index-BBhWSYD8.js";import"./mui-CY_LMiAy.js";import{d as S}from"./decodeURIComponentSafe-DhnAz_92.js";import{w as et}from"./withTransactionSidePanel-Cyf8gB6i.js";import{f as at,c as nt}from"./routePaths-BgYQMm9p.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";import"./useAskAiCfoHostNavButtonProps-DGTLHvUD.js";import"./TransactionDetailScreen-Bgc2K53s.js";import"./useInitialThreadRequest-UvGRmRxR.js";import"./expenseAutomationHelper-XBf0IYWB.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]="2e947abe-e8b9-49bc-b541-a66d3c6937b8",a._sentryDebugIdIdentifier="sentry-dbid-2e947abe-e8b9-49bc-b541-a66d3c6937b8")}catch{}})();const ot=R((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:$(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:z(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(K({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(L("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(H()),a(J()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(P(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(P(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(Q),it=et((function({entityType:a,...t}){const e=G(),o=A(),c=F(),[m,h]=d.useState(!1),[T,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:x,entityNameEncoded:j}=V(),r=S(x??""),p=S(j??""),u=rt(r,p),v=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>_(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),w=l((n=>M(n).company?.companyInfo.firstMonthOfFY??1)),f=l((n=>U(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&u===!0&&(h(!0),o(W(i)))}),[m,u,i]);const b=l((n=>n.trendState.fetchState)),E=f?.selectedPeriod?.timePeriod??g,B=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(f?.selectedPeriod?.timePeriod,g);return d.useEffect((()=>{m===!0&&T===!1&&b==="Completed"&&(D(!0),E!=null&&o(k(i,"EntityDetail",{timeframe:f?.selectedPeriod?.timeframe??"quarter",timePeriod:E})))}),[m,T,b]),u?s.jsx(ot,{firstMonthOfFY:w,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:B,resetTrendIsFetchedStates:()=>{h(!1),D(!1)},...t}):s.jsx(q,{to:I(v.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function vt({entityType:a}){return s.jsx(N,{children:s.jsx(O,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{vt as EntityDetailRoutes,vt as default};
@@ -1,4 +1,4 @@
1
- import{j as T}from"./liveblocks-D83XGo_c.js";import An from"./NotFoundScreen-RGfzDsux.js";import{a as n,R as ka}from"./sentry-BPfEBx2C.js";import{n as Qe,S as vn}from"./mui-CD71lp6N.js";import{u as Ce,h as Ta,g as It,j as D,l as wn,t as Pn,i as Wt,n as Rn,o as rt}from"./core-CGqhbBHO.js";import{fB as De,$_ as xn,pG as Pe,T9 as Dn,z5 as Fn,$$ as Un,a00 as _n,a01 as Vn,a02 as dt,a03 as Ge,gd as St,a04 as Zt,eJ as Bn,fY as Mn,a05 as Xt,a06 as qe,qy as On,tX as Ln,gP as jn,gN as zn,a07 as $n,qL as Gn,qU as qn,pR as Nn,q4 as ya,gM as le,gO as Jn,a08 as Yn,qq as ba,qV as Hn,q1 as Kn,pY as Qn,u1 as Wn,gL as Re,a09 as Ye,Bf as Ea,Ly as Aa,a0a as va,a0b as Zn,fh as Xn,fj as eo,rY as gt,VS as ea,VU as to,lI as ao,VV as no,lP as oo,dh as so,Cy as Ct,a0c as co,a0d as io,rO as lo,rP as ro,UH as uo,UY as mo,$s as po,qj as wa,q_ as He,a0e as ho,UO as ta,UN as $e,a0f as aa,m4 as So,a0g as go,a0h as Co,a0i as fo,a0j as Io,qe as ko,r1 as Ne,a0k as To,a0l as yo,a0m as bo,r9 as Eo,lT as Ao,lK as vo,a0n as wo,lS as na,W3 as Po,a0o as Ro,a0p as xo,ty as Do,t9 as Fo,q$ as ue,t8 as ut,a0q as Uo,a0r as _o,a0s as Vo,a0t as Bo,nn as Mo,br as Oo,ni as oa,n4 as Lo,a0u as jo,gY as zo,nf as $o,r_ as Go,s0 as qo,Ey as No,rH as Jo,U$ as Yo,V0 as Ho,E0 as Ko,D$ as Qo,Eg as Wo,a0v as sa,rN as Zo,fg as ft,rT as Xo,a0w as es,s7 as ts,rB as as,sc as ns,rG as os,rk as ss,a0x as cs,T1 as Pa,qC as is,qa as ls,qh as ca,r4 as rs,a0y as ds,a0z as us,r0 as Ra,a0A as ms,a0B as ps,a0C as hs,a0D as Ss,sg as gs,a0E as Cs,a0F as fs,a0G as ia,tJ as Is,t0 as ks,rK as la,UM as Ts,a0H as ys,a0I as bs,lR as Es,a0J as As,Qe as vs,lQ as ws,lF as Ps,T0 as Rs,sz as xa,sV as xs,qZ as ra,r2 as Ds,bE as Fs,nc as Us,n9 as _s,a0K as Vs,rj as da,sR as ua,sP as Bs,a0L as Ms,sE as Os,sj as Ls,sS as js,a0M as zs,a0N as $s,sp as Gs,a0O as qs,sk as Ns,so as Js,sm as Ys,sY as Hs}from"./zeni-epic-state-DASyz1An.js";import{I as Ke,d as H,k as G,p as te,ao as Da,aq as Fa,dM as Ks,z as We,dN as Qs,dO as Ws,dP as Zs,ac as xe,dQ as Xs,dR as ma,b8 as pa,a5 as Ua,dS as ec,j as Je,G as tc,w as ac,dT as nc,at as ha,dU as oc,a as sc,dV as cc,dW as ic,c as lc,U as rc,dX as dc,dY as uc,dZ as mc,b2 as pc,bp as hc,a9 as Sc,b3 as gc,b4 as Cc}from"./index-CoKBrrSw.js";import{u as _a}from"./useAskAiCfoHostNavButtonProps-C4V1Wf7u.js";import{g as Sa,h as fc,r as Ic,b as kc,c as Tc,i as yc,a as bc,C as Ec}from"./TransactionDetailScreen-B38w1Q4M.js";import{w as Ac}from"./withTransactionSidePanel-D0UiF_in.js";import{h as vc,v as wc,c as Pc}from"./routePaths-DU2fgaW2.js";import{a as mt}from"./accountMappingHelper-L9SkIWKz.js";import{D as Rc}from"./DrawerScreen-BRJIwisq.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";import"./decodeURIComponentSafe-6FvQaIqS.js";import"./useInitialThreadRequest-CP8MsLNf.js";import"./expenseAutomationHelper-wwug0Eyp.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]="9e33b5e4-654a-4232-95d1-ea19b3a66e8c",t._sentryDebugIdIdentifier="sentry-dbid-9e33b5e4-654a-4232-95d1-ea19b3a66e8c")}catch{}})();const xc=()=>{const t=Ce(),s=Ta(),P=It(),C=D((m=>De(m))),{useFeatureGate:f}=Ke(),{isFeatureEnabled:r}=f(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:u}=f(H.aiAuditScorePercentage),x=D((m=>m.expenseAutomationViewState.selectedPeriodByTenantId)),i=D((m=>xn(m,C.tenantId))),{isAiCfoAccessEnabled:g,onAskAiCfoClick:y}=_a({mobileExploreReferrer:"Month-End Close Overview"}),w=n.useCallback(((m,M,W=!1)=>{t(Pe({tenantId:M,period:{month:m.month,year:m.year},refreshViewInBackground:W}))}),[]),b=n.useCallback((m=>{const M=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(m.month,m.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,M??null),t(Dn(C.tenantId,m))}),[C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),p=x[C.tenantId],c=n.useCallback((()=>{const m=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(p.month,p.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,m??null),w(p,C.tenantId,!0)}),[w,p,C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),$=te(P.state?.pathnameStackToGoBack,P.pathname),I=n.useCallback((()=>{if(i.monthEndCloseChecks!=null&&p!=null){const m=i.monthEndCloseChecks.monthEndCloseCheckList.find((M=>M.progress<100));if(m!=null)return void s(`./${m.id}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}});s(`./month_end_insights/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}})}}),[i.monthEndCloseChecks,p]),{areTenantIdsInSync:v}=Da();return Fa({isDataReady:i.fetchState==="Completed"}),n.useEffect((()=>{p!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&v&&w(p,C.tenantId)}),[w,p,i.fetchState,C.tenantId,v]),n.useEffect((()=>{p!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&v&&t(Fn(p))}),[p,i.monthClosePerformanceTrendFetchStatus.fetchState,v]),n.useEffect((()=>{const m=setInterval((()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&c()}),3e5);return()=>clearInterval(m)}),[i.fetchState]),n.useEffect((()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const m=P.state?.referrer;G.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,m??null)}}),[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),T.jsx(Dc,{children:T.jsx(Ks,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:r,onMonthEndCheckClick:m=>{s(`./${m}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:b,handleReviewButtonClick:I,onBackClick:()=>{s("../../dashboard")},onReload:c,isAiCfoAccessEnabled:g,onAskAiCfoClick:y,aiAuditScorePercentageEnabled:u})})},Dc=Qe.div`
1
+ import{j as T}from"./liveblocks-D0hIH2N0.js";import An from"./NotFoundScreen-B6L1cY3I.js";import{a as n,R as ka}from"./sentry-DhqS_W-k.js";import{n as Qe,S as vn}from"./mui-CY_LMiAy.js";import{u as Ce,h as Ta,g as It,j as D,l as wn,t as Pn,i as Wt,n as Rn,o as rt}from"./core-35eDsgGP.js";import{fB as De,$_ as xn,pG as Pe,T9 as Dn,z5 as Fn,$$ as Un,a00 as _n,a01 as Vn,a02 as dt,a03 as Ge,gd as St,a04 as Zt,eJ as Bn,fY as Mn,a05 as Xt,a06 as qe,qy as On,tX as Ln,gP as jn,gN as zn,a07 as $n,qL as Gn,qU as qn,pR as Nn,q4 as ya,gM as le,gO as Jn,a08 as Yn,qq as ba,qV as Hn,q1 as Kn,pY as Qn,u1 as Wn,gL as Re,a09 as Ye,Bf as Ea,Ly as Aa,a0a as va,a0b as Zn,fh as Xn,fj as eo,rY as gt,VS as ea,VU as to,lI as ao,VV as no,lP as oo,dh as so,Cy as Ct,a0c as co,a0d as io,rO as lo,rP as ro,UH as uo,UY as mo,$s as po,qj as wa,q_ as He,a0e as ho,UO as ta,UN as $e,a0f as aa,m4 as So,a0g as go,a0h as Co,a0i as fo,a0j as Io,qe as ko,r1 as Ne,a0k as To,a0l as yo,a0m as bo,r9 as Eo,lT as Ao,lK as vo,a0n as wo,lS as na,W3 as Po,a0o as Ro,a0p as xo,ty as Do,t9 as Fo,q$ as ue,t8 as ut,a0q as Uo,a0r as _o,a0s as Vo,a0t as Bo,nn as Mo,br as Oo,ni as oa,n4 as Lo,a0u as jo,gY as zo,nf as $o,r_ as Go,s0 as qo,Ey as No,rH as Jo,U$ as Yo,V0 as Ho,E0 as Ko,D$ as Qo,Eg as Wo,a0v as sa,rN as Zo,fg as ft,rT as Xo,a0w as es,s7 as ts,rB as as,sc as ns,rG as os,rk as ss,a0x as cs,T1 as Pa,qC as is,qa as ls,qh as ca,r4 as rs,a0y as ds,a0z as us,r0 as Ra,a0A as ms,a0B as ps,a0C as hs,a0D as Ss,sg as gs,a0E as Cs,a0F as fs,a0G as ia,tJ as Is,t0 as ks,rK as la,UM as Ts,a0H as ys,a0I as bs,lR as Es,a0J as As,Qe as vs,lQ as ws,lF as Ps,T0 as Rs,sz as xa,sV as xs,qZ as ra,r2 as Ds,bE as Fs,nc as Us,n9 as _s,a0K as Vs,rj as da,sR as ua,sP as Bs,a0L as Ms,sE as Os,sj as Ls,sS as js,a0M as zs,a0N as $s,sp as Gs,a0O as qs,sk as Ns,so as Js,sm as Ys,sY as Hs}from"./zeni-epic-state-BRRtwAQl.js";import{I as Ke,d as H,k as G,p as te,ao as Da,aq as Fa,dM as Ks,z as We,dN as Qs,dO as Ws,dP as Zs,ac as xe,dQ as Xs,dR as ma,b8 as pa,a5 as Ua,dS as ec,j as Je,G as tc,w as ac,dT as nc,at as ha,dU as oc,a as sc,dV as cc,dW as ic,c as lc,U as rc,dX as dc,dY as uc,dZ as mc,b2 as pc,bp as hc,a9 as Sc,b3 as gc,b4 as Cc}from"./index-BBhWSYD8.js";import{u as _a}from"./useAskAiCfoHostNavButtonProps-DGTLHvUD.js";import{g as Sa,h as fc,r as Ic,b as kc,c as Tc,i as yc,a as bc,C as Ec}from"./TransactionDetailScreen-Bgc2K53s.js";import{w as Ac}from"./withTransactionSidePanel-Cyf8gB6i.js";import{h as vc,v as wc,c as Pc}from"./routePaths-BgYQMm9p.js";import{a as mt}from"./accountMappingHelper-C4yUO_tP.js";import{D as Rc}from"./DrawerScreen-B_ZAZq-c.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";import"./decodeURIComponentSafe-DhnAz_92.js";import"./useInitialThreadRequest-UvGRmRxR.js";import"./expenseAutomationHelper-XBf0IYWB.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]="9e33b5e4-654a-4232-95d1-ea19b3a66e8c",t._sentryDebugIdIdentifier="sentry-dbid-9e33b5e4-654a-4232-95d1-ea19b3a66e8c")}catch{}})();const xc=()=>{const t=Ce(),s=Ta(),P=It(),C=D((m=>De(m))),{useFeatureGate:f}=Ke(),{isFeatureEnabled:r}=f(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:u}=f(H.aiAuditScorePercentage),x=D((m=>m.expenseAutomationViewState.selectedPeriodByTenantId)),i=D((m=>xn(m,C.tenantId))),{isAiCfoAccessEnabled:g,onAskAiCfoClick:y}=_a({mobileExploreReferrer:"Month-End Close Overview"}),w=n.useCallback(((m,M,W=!1)=>{t(Pe({tenantId:M,period:{month:m.month,year:m.year},refreshViewInBackground:W}))}),[]),b=n.useCallback((m=>{const M=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(m.month,m.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,M??null),t(Dn(C.tenantId,m))}),[C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),p=x[C.tenantId],c=n.useCallback((()=>{const m=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(p.month,p.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,m??null),w(p,C.tenantId,!0)}),[w,p,C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),$=te(P.state?.pathnameStackToGoBack,P.pathname),I=n.useCallback((()=>{if(i.monthEndCloseChecks!=null&&p!=null){const m=i.monthEndCloseChecks.monthEndCloseCheckList.find((M=>M.progress<100));if(m!=null)return void s(`./${m.id}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}});s(`./month_end_insights/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}})}}),[i.monthEndCloseChecks,p]),{areTenantIdsInSync:v}=Da();return Fa({isDataReady:i.fetchState==="Completed"}),n.useEffect((()=>{p!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&v&&w(p,C.tenantId)}),[w,p,i.fetchState,C.tenantId,v]),n.useEffect((()=>{p!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&v&&t(Fn(p))}),[p,i.monthClosePerformanceTrendFetchStatus.fetchState,v]),n.useEffect((()=>{const m=setInterval((()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&c()}),3e5);return()=>clearInterval(m)}),[i.fetchState]),n.useEffect((()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const m=P.state?.referrer;G.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,m??null)}}),[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),T.jsx(Dc,{children:T.jsx(Ks,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:r,onMonthEndCheckClick:m=>{s(`./${m}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:b,handleReviewButtonClick:I,onBackClick:()=>{s("../../dashboard")},onReload:c,isAiCfoAccessEnabled:g,onAskAiCfoClick:y,aiAuditScorePercentageEnabled:u})})},Dc=Qe.div`
2
2
  display: flex;
3
3
  height: 100vh;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-D83XGo_c.js";import{a as r}from"./sentry-BPfEBx2C.js";import{au as i,av as b,r as f,a2 as l}from"./index-CoKBrrSw.js";import"./mui-CD71lp6N.js";import p from"./NotFoundScreen-RGfzDsux.js";import{h as m,g as u}from"./core-CGqhbBHO.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]="3e0b62bd-24c2-4dc7-beeb-ffec556cb516",e._sentryDebugIdIdentifier="sentry-dbid-3e0b62bd-24c2-4dc7-beeb-ffec556cb516")}catch{}})();const _=()=>{const e=m(),t=u(),a=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),c=r.useCallback((()=>{(()=>{const n=l(t.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=i(t.pathname);return o!=null?s.jsx(b,{menuItem:f(o),onDemoClick:a,onGoBack:c}):s.jsx(p,{})},k=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t};export{_ as F};
1
+ import{j as s}from"./liveblocks-D0hIH2N0.js";import{a as r}from"./sentry-DhqS_W-k.js";import{au as i,av as b,r as f,a2 as l}from"./index-BBhWSYD8.js";import"./mui-CY_LMiAy.js";import p from"./NotFoundScreen-B6L1cY3I.js";import{h as m,g as u}from"./core-35eDsgGP.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]="3e0b62bd-24c2-4dc7-beeb-ffec556cb516",e._sentryDebugIdIdentifier="sentry-dbid-3e0b62bd-24c2-4dc7-beeb-ffec556cb516")}catch{}})();const _=()=>{const e=m(),t=u(),a=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),c=r.useCallback((()=>{(()=>{const n=l(t.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=i(t.pathname);return o!=null?s.jsx(b,{menuItem:f(o),onDemoClick:a,onGoBack:c}):s.jsx(p,{})},k=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t};export{_ as F};
@@ -1 +1 @@
1
- import{a as r}from"./sentry-BPfEBx2C.js";import{u as l,h as f,g as m}from"./core-CGqhbBHO.js";import{hV as p,Tv as g,Tw as _}from"./zeni-epic-state-DASyz1An.js";import{u as b,L as h,z as y}from"./index-CoKBrrSw.js";import"./liveblocks-D83XGo_c.js";import"./recharts-2kmMgB1t.js";import"./mui-CD71lp6N.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c4d32c4d-de76-41fa-b7d5-e5b16e46ad70",e._sentryDebugIdIdentifier="sentry-dbid-c4d32c4d-de76-41fa-b7d5-e5b16e46ad70")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:u}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
1
+ import{a as r}from"./sentry-DhqS_W-k.js";import{u as l,h as f,g as m}from"./core-35eDsgGP.js";import{hV as p,Tv as g,Tw as _}from"./zeni-epic-state-BRRtwAQl.js";import{u as b,L as h,z as y}from"./index-BBhWSYD8.js";import"./liveblocks-D0hIH2N0.js";import"./recharts-B8j-bW95.js";import"./mui-CY_LMiAy.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c4d32c4d-de76-41fa-b7d5-e5b16e46ad70",e._sentryDebugIdIdentifier="sentry-dbid-c4d32c4d-de76-41fa-b7d5-e5b16e46ad70")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:u}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -1 +1 @@
1
- import{m as s}from"./liveblocks-D83XGo_c.js";import{j as r}from"./core-CGqhbBHO.js";import{fB as d}from"./zeni-epic-state-DASyz1An.js";import"./sentry-BPfEBx2C.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
1
+ import{m as s}from"./liveblocks-D0hIH2N0.js";import{j as r}from"./core-35eDsgGP.js";import{fB as d}from"./zeni-epic-state-BRRtwAQl.js";import"./sentry-DhqS_W-k.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -0,0 +1,2 @@
1
+ import{j as s}from"./liveblocks-D0hIH2N0.js";import{a as r}from"./sentry-DhqS_W-k.js";import{u as P,h as L,i as w,j as E,t as z,l as T,s as H,g as W,N as B,n as ie,o as x}from"./core-35eDsgGP.js";import{a6 as ln,k as p,ao as F,S as g,c9 as dn,ca as un,cb as gn,cc as mn,cd as vn,ce as pn,cf as fn,cg as Sn,ch as hn,ci as Cn,cj as In,ck as En,cl as kn,cm as yn,p as J,cn as xn,co as bn,ac as se,cp as jn,cq as Dn,z as he,cr as Pn,cs as Ln,ct as An,cu as $n,cv as wn,cw as Fn,cx as Rn,cy as Tn,U as On,ag as ft,cz as _n,cA as Mn,cB as Nn,cC as Un,cD as Bn,cE as Vn,cF as Hn,cG as Zn,cH as qn,t as Ye,j as St,cI as Yn,cJ as Kn,cK as Qn,cL as Gn,cM as zn,cN as Wn,cO as Jn}from"./index-BBhWSYD8.js";import"./mui-CY_LMiAy.js";import{A as Y}from"./AddressScreen-anqh6to9.js";import N from"./NotFoundScreen-B6L1cY3I.js";import{YI as Xn,YJ as ei,uv as Ke,YK as De,YL as K,vz as Qe,vG as ti,vL as ht,YM as Pe,YN as Ct,vD as It,YO as Le,vB as Et,yg as ni,vC as ii,YP as Q,uY as ce,vv as oi,x7 as Ge,uX as Ce,YQ as ai,YR as kt,vS as si,YS as G,vZ as ci,YT as ri,YU as yt,YV as xt,y2 as li,YW as ue,YX as ze,YY as bt,uV as di,YZ as ui,uP as gi,Y_ as mi,xk as vi,Y$ as jt,xt as We,Z0 as pi,xq as fi,Z1 as Ae,gd as Si,Z2 as te,Z3 as ne,wc as hi,v1 as Je,Z4 as $e,v6 as Dt,v4 as Ci,u_ as Ii,w5 as Ei,v8 as ki,we as yi,Z5 as Ie,wm as Pt,wk as Ee,F6 as we,xz as Xe,Z6 as xi,uW as Fe,Z7 as Re,vh as ke,ve as ye,vr as Lt,vq as Te,vb as bi,vk as At,vt as oe,fB as Oe,Uv as $t,uZ as _e,vo as ji,vp as Di,vn as Pi,Z8 as Li,vV as et,v_ as Ai,vW as wt,Z9 as Ft,uJ as tt,Za as $i,uF as Rt,Zb as wi,xF as Fi,xJ as Z,xE as Ri,wN as Me,Zc as Ti,Zd as Tt,xS as nt,Ze as Oi,xP as _i,Zf as Ot,wQ as Mi,wR as V,wU as Ni,Zg as _t,x2 as ve,Zh as Ui,wd as Mt,T3 as Nt,Zi as Bi,xc as Vi,Zj as Ut,Zk as Hi,Zl as Zi,Zm as qi,yH as Yi,Zn as Ki,Zo as Bt,xZ as Vt,Zp as Ht,yF as pe,Zq as Qi,yC as Gi,Zr as zi,Zs as Wi,Zt as Ji,Zu as Xi,Zv as eo,Zw as it,Zx as to,yL as no,Zy as Ne,ww as ot,Zz as Ue,ZA as re,wG as Zt,wB as qt,wz as xe,ZB as io,wr as oo,y3 as Yt,yu as at,yp as ao,ZC as so,y4 as co,ZD as ro,yv as lo,yz as uo,ZE as go,ZF as Kt,c7 as mo,m6 as vo,m7 as po,ZG as st,vA as le,gh as fo,tX as So,md as ho,ym as Qt,yX as Co,yj as Gt,u1 as Io,yU as ct,tR as Eo,yR as rt,hP as ko,Tv as lt,Tw as yo,Fi as zt,hH as xo,ZH as bo,Uk as jo,ZI as Do,z1 as fe,z2 as Po,ZJ as Lo,ZK as Wt,y_ as Ao,ZL as $o,ZM as wo,xg as Fo,ZN as Ro}from"./zeni-epic-state-BRRtwAQl.js";import{M as To}from"./MobileAppDrawer-C9wi8312.js";import{q as de}from"./QBOConnectionScreen-CIODRsNA.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";import"./InboxNotificationsProvider-yp4VlF4V.js";import"./useTaskManagerAccess-DRrr5b-Z.js";import"./empty-BDPRkuRZ.js";import"./pdf-lib-D54M6RaZ.js";import"./index-D-ldiYpS.js";import"./url-BlblTlRS.js";import"./index-B3U6gyEe.js";import"./decodeURIComponentSafe-DhnAz_92.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="719194b2-d41e-406a-9f93-28fbb714f3d7",n._sentryDebugIdIdentifier="sentry-dbid-719194b2-d41e-406a-9f93-28fbb714f3d7")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Xn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,C=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(Ke({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:D,isLoadingMore:h,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{S&&I!=null&&n(Ke({cursor:I,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Jt=[],Mo=Ct((n=>n.length>0?n:Jt),mn),No=Ct((n=>n.length>0?n:Jt),gn),Uo=T((function(n,e){const{view:t}=e;return{groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?o=>{i!==""&&n(It({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&n(Pe({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&n(ti({action:a,id:o,parentItemId:i}))}}}))(un);function Bo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=z(),{areTenantIdsInSync:a}=F(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>De(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(K()),()=>{n(K())})),[n]),r.useEffect((()=>{a&&n(Qe({id:t,kind:c}))}),[a,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(K()),n(Qe({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed",[I,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=I!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Be(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=n,a=P(),{areTenantIdsInSync:c}=F(),d=E(Le),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(Et()),t&&a(ni()))}),[c,a,e,t,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Ve(n,e=!1){const t=P(),i=E((c=>Q(c).productNextCursor!=null)),o=E((c=>Q(c).productNextCursor)),a=E((c=>Q(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&a!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&a!=="In-Progress"&&i&&o!=null&&t(ce({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Ho=new Set(["plan"]),Zo=T((function(n,e){const t=De(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:o}=e,a=o!=null?`${t}/catalog/${encodeURIComponent(o)}`:`${t}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(K()),e.navigate(`${t}/catalog`)},onChange:c=>{n(Pe({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:o}))}}}))(vn);function qo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=z(),{areTenantIdsInSync:a}=F(),c=t!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Ho.has(u)?u:"plan";var u;const m=E((S=>De(S,t)));return Ve(a,!0),Be({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&t!=null&&n(oi({id:t,kind:v}))}),[a,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(Pe({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(K())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Zo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Yo={addons:"addon",all:"item",charges:"charge",plans:"plan"},Ko=T((function(n,e){const t=Q(n),i=e.activeTab==="plans",o=e.activeTab==="all",a=i?t.plans:o?[...t.plans,...t.products]:t.products,c=i||o&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:o&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",a=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Yo[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(It({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&n(Ce({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));a!=null&&n(i?Ce({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function Qo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>Q(O))),k=y.planFilters.search,b=y.planSort,C=y.planNextCursor,D=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(Ge({cacheOverride:!1,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[i,n,I,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(Ge({cacheOverride:!0,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,I,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Ko,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:o,sortState:u,planFilters:I,productFilters:j,sort:S,planNextCursor:C,productNextCursor:D,runningCatalogItemActionId:_,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const Go=T((function(n,e){const t=kt(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(G()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),n(ci({id:i}))}}}))(fn);function zo(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{o&&t!=null&&n(si({id:t}))}),[o,t,n]),r.useEffect((()=>{if(a==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(G())}}),[a,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCouponFormPage}),s.jsx(Go,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Wo=T((function(n){const e=yt(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:o=>{e(bt(o))},onSubmit:()=>{const o=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(hn);function Jo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),[i]=z(),{areTenantIdsInSync:o}=F(),a=i.get("customerId"),c=E((C=>yt(C))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((C=>li(C))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||I,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(ze()),()=>{n(ze())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||a==null||a===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:a})))}),[a,l,n]),r.useEffect((()=>{o&&n(di({cacheOverride:!1}))}),[o,n]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const D=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(D)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Wo,{navigate:e,tenantEmailDomain:t})]})}const Xo=T((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(Cn);function ea(){const n=P(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>mi(d,t??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&t!=null&&n(vi({id:t}))}),[o,t,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Xo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:a})]})}const ta=T((function(n){const e=jt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function na(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const C=jt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),H),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(We({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(We({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:o=>{n(Ie({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const o=Xt(e.tenantEmailDomain??"",Ee,i),a=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ie({id:i,localData:o})),n(Pt({id:i}))},onFetchPaymentLinkEmailPreview:o=>n(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>n(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)}}}))(yn);function oa(){const n=P(),e=L(),t=W(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((M=>Ae(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,I]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&I(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:D}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{a&&i!=null&&n(hi({id:i}))}),[a,i,n]),r.useEffect((()=>{a&&i!=null&&D&&n(Je({customerId:i}))}),[a,i,n,D]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n($e()),i!=null&&n(Dt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{n(te()),i!=null&&D&&n(Je({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:D,onChooseCard:()=>{i!=null&&n(Ii({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ci({customerId:i,data:M}))}}),s.jsx(kn,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=Ae(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),n($e()),n(we(Ee)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ie({id:i,localData:c}))},onOpenAddress:()=>{const c=Xt(e.tenantEmailDomain??"",Ee,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),n(Pt({id:i}))}}}))(xn);function sa(){const n=P(),e=L(),t=W(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&n(Dt({id:i}))}),[a,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),n($e())}}),[c,d,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:o})]})}const ca=T((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(Fe({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,customerListFetchState:y}=E((b=>{const C=ue(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),H),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Xe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Xe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const be=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:t,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:be(o,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=be(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&n(ye({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&n(Te(a))},onRollback:S?()=>{a!=null&&n(Lt(a))}:void 0}}))(jn);function da(){const n=P(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),[a,c]=r.useState({}),d=E(Re),l=be(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{o&&t!=null&&n(ke(t))}),[o,n,t]),r.useEffect((()=>{if(!o||t==null)return;const f=setTimeout((()=>{n(ye({...a,sessionId:t}))}),300);return()=>clearTimeout(f)}),[o,n,a,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||t==null||!u)return;const f=setInterval((()=>{n(ke(t)),n(ye({...a,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[o,n,a,u,t]);const m=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const I=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${I===""?"":`?${I}`}`}),[a,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const en=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=en(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},ua=T((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:a}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,o=a=>{const c=a??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),n(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),n(Lt(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),t(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Dn);function ga(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(Re);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:o})]})}const ma=T((function(n,e){const{activeId:t,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=se?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),n(Pi())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{t!=null&&n(Te(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Di(t))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:a}))},onViewDetails:t==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Pn);function va(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(xt),a=E(Oe).companyId??he.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,a))),d=E(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(_e()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(I=>{if(I==null||I==="")return null;try{return sessionStorage.getItem(en(I))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ke(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:o=>{n(wt({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:o,id:i}))}}}))(Ln);function fa(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((I=>Li(I,t))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const m=v===t;r.useEffect((()=>(n(G()),()=>{n(G())})),[n]),r.useEffect((()=>{o&&n(et({id:t}))}),[o,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(n(G()),n(et({cacheOverride:!0,id:t})),f((I=>I+1)))}),[a.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,o)=>{n(wt({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function ha(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((C=>{const D=Ft(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),H),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:a,onStatusChange:C=>n($i(C)),onSortChange:v})]})}const Ca=T((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>n(Z({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(Z({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(Z({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(Z({action:"retry",id:i}))}:void 0}}))(wn);function Ia(){const n=P(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((h=>wi(h,t??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[I,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=a.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,a.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(Z({action:"send-email",body:h,id:t})))}),[t,n,l]),C=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&t!=null&&n(Ri({id:t}))}),[o,t,n]),r.useEffect((()=>{o&&d!=null&&n(Me({invoiceId:d}))}),[o,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{I&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,I]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,a.actionState.fetchState]);const D=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:a,dunningAttempts:D,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:I,preview:C,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||n(Z({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const C=Tt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),H),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
2
+ `).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))}}}))(Rn);function xa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((m=>Ot(m,t??""))),c=a.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{o&&t!=null&&n(Mi({invoiceId:t}))}),[o,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:a})]})}const ba=T((function(n){const e=_t(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function ja(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((C=>{const D=_t(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),H),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(ve({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:a,onStatusChange:C=>{n(Ui(C)),n(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=On(),o=ft(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Da=T((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:a,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:o=>{n(Ki({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Yi())}}}))(Mn);function Pa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Hi()),m.current=null}),[n,t]),r.useEffect((()=>{o&&t!=null&&n(Me({invoiceId:t}))}),[o,n,t]),r.useEffect((()=>{c!=null&&t!=null&&a==="Completed"&&m.current!==t&&(m.current=t,n(Zi({localData:qi(c)})))}),[n,a,c,t]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(o))}),[i,n,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(La,{navigate:e,selectedPeriod:o,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Ht(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(Gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function wa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Ht(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),H),b=y==="Completed",C=`/${t}/invoicing`,D=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(R)}`))}),[e,C,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(O)}`))}),[e,C,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:_=>{n(Qi(_)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:D})]})}const Fa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=t!=null&&t!=="",c=E(ue),d=E((h=>zi(h))),l=E(Wi),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Ji()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{o&&n(a&&t!=null?Me({invoiceId:t}):Fe({filters:{},keepExistingListItems:!1}))}),[o,n,t,a]),r.useEffect((()=>{a&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Xi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,a]),r.useEffect((()=>{if(a)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,a]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const h=I.current;if(I.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!a||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),C=a?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,D=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:D}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(C)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(a?t??void 0:void 0))}})]})}const tn=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:t.coupons.map(Oa),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",xe,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Zt({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Ma(){const n=P(),e=L(),t=W(),{subscription_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((k=>Ne(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=S===i;Ve(a),r.useEffect((()=>{a&&i!=null&&n(ot({id:i}))}),[a,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Ue()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},j)]})}const Na=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},je=(n,e,t)=>{const i=[n,Ua(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),Se=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:je(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Ha=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Za=T((function(n,e){const t=Ne(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Ha),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(Se).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Ue()),n(we(xe)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{n(re({id:i,localData:a}))},onOpenAddress:()=>{const a=tn(e.tenantEmailDomain??"",xe,i),c=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),n(Zt({id:i}))}}}))(Hn);function qa(){const n=P(),e=L(),t=W(),{subscription_id:i,tenantEmailDomain:o}=w(),[a]=z(),{areTenantIdsInSync:c}=F(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ne(S,i).localData));Ve(c),r.useEffect((()=>{c&&(n(Fe({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),n(Ue())}}),[l,v,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Za,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ya=T((function(n){const e=Yt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(o,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),n(qt({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Zn);function Ka(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((D=>{const h=Yt(D);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),H),b=y==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(o)),300);return()=>clearTimeout(D)}),[o]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]);const C=r.useRef(k);return r.useEffect((()=>{const D=C.current!=null&&k==null;C.current=k,D&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ya,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:a,onStatusChange:D=>n(so(D)),onSortChange:v})]})}const Qa=T((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function Ga(){const n=P(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&n(lo({id:i}))}),[o,i,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Qa,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:a})]})}const za={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=P(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I}=E(Kt),j=E(Le);Be({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(Oe),k=n==="dunning"||n==="quickbooks",b=y.companyId??he.getSignedInUserTenant(i??"")?.companyId,C=E((A=>$t(A,b))),D=mo(y.userRole??[]),h=y.tenantId??"",_=he.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),He=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&He!=null?{[R]:He}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(o!=="Not-Started"&&o!=="Error"||e(_e()))}),[t,e,o]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ye.shouldFetchActiveTenant(h)&&(Ye.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=o==="Not-Started"||o==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=o==="Completed"&&(!k||u==="Completed"),Ze=C.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,ge=se?.invoicingMicroServiceBaseUrl,qe=ge!=null&&ge.length>0?`${ge}/1.0/webhooks/stripe`:"",me={deleteConnectionError:C.externalConnections?.deleteConnectionError?.message,deleteConnectionState:C.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:C,isAdmin:D,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{C.integrations.refreshQBO.fetchState!=="In-Progress"&&e(zt())},onSaveChargeBeeCredentials:(A,q)=>{Ze!=null&&h!==""&&e(ko(h,Ze,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:C.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:C.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:me,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Io(A,q)),onReconnectQBO:me.onReconnectQBO,onRefreshQBO:me.onRefreshQBO,onRetryQboSyncTask:A=>e(Gt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Co({settings:A,snackbarSection:za[n??""]}))},onStartQboBackfill:A=>e(Qt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=W(),i=P(),{tenantEmailDomain:o}=w(),a=X("branding"),c=E((v=>bo(v))),d=E((v=>jo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i(we(fe)))}),[c.saveState.fetchState,i]);const l=St(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Yn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Lo({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${fe}/`,u=J(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:a.updateFilesEntity})]})}function Wa(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Kn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Ja(){const n=L(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Xa(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const es=T((function(n){const e=Wt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(Gt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(Qt(e))}}}))(zn);function ts(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=E(Oe),{configFetchState:o,settingsFetchState:a}=E(Wt);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||n(_e())}),[n,a]),r.useEffect((()=>{o==="Not-Started"&&n(le())}),[o,n]),Be({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(zt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=P(),t=L(),[i,o]=z(),a=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Kt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];o({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Wn,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:n("invoicing_settings"),settings:a.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Xa,{})}),s.jsx(x,{path:"branding",element:s.jsx(vt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(vt,{appContent:s.jsx(Y,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Ja,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Wa,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:o,fetchState:a,status:c}=E(Nt),d=St(o.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Le(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,a]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),n(Ro()))}),[d,o.fetchState,l,n,e]),c==null&&a!=="Error"?s.jsx(Jn,{}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(Y,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(Y,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Ka,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(Y,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(Y,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Jo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Ga,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(zo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Qo,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-D83XGo_c.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-CGqhbBHO.js";import{To as k,Tp as v,Tq as F,Iw as D,Ii as G,Tr as B,Ts as oe,Tt as ie,Im as se,ge as j,It as le,Iq as re}from"./zeni-epic-state-DASyz1An.js";import{$ as x,J as r,a0 as de,k as I,X as M,a1 as ce,a2 as me,a3 as pe,p as V,I as ue,d as he,a4 as ge,c as xe,E as fe,g as we,a5 as be,a6 as Se,Z as ye,a7 as ke,a8 as ve,a9 as Ie,aa as je}from"./index-CoKBrrSw.js";import{n as m}from"./mui-CD71lp6N.js";import f from"./NotFoundScreen-RGfzDsux.js";import{a as $}from"./sentry-BPfEBx2C.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.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]="016e604d-869b-4b82-a07c-3316ed6157fe",e._sentryDebugIdIdentifier="sentry-dbid-016e604d-869b-4b82-a07c-3316ed6157fe")}catch{}})();const $e=m.div`
1
+ import{j as a}from"./liveblocks-D0hIH2N0.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-35eDsgGP.js";import{To as k,Tp as v,Tq as F,Iw as D,Ii as G,Tr as B,Ts as oe,Tt as ie,Im as se,ge as j,It as le,Iq as re}from"./zeni-epic-state-BRRtwAQl.js";import{$ as x,J as r,a0 as de,k as I,X as M,a1 as ce,a2 as me,a3 as pe,p as V,I as ue,d as he,a4 as ge,c as xe,E as fe,g as we,a5 as be,a6 as Se,Z as ye,a7 as ke,a8 as ve,a9 as Ie,aa as je}from"./index-BBhWSYD8.js";import{n as m}from"./mui-CY_LMiAy.js";import f from"./NotFoundScreen-B6L1cY3I.js";import{a as $}from"./sentry-DhqS_W-k.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.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]="016e604d-869b-4b82-a07c-3316ed6157fe",e._sentryDebugIdIdentifier="sentry-dbid-016e604d-869b-4b82-a07c-3316ed6157fe")}catch{}})();const $e=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{j as g}from"./liveblocks-D83XGo_c.js";import{a as u}from"./sentry-BPfEBx2C.js";import{u as U,g as _,h as w,t as V,j as l,N as L}from"./core-CGqhbBHO.js";import{z as r,E as M,G as P,R as A,k as N,S as R,Y as B,Z as G,V as W}from"./index-CoKBrrSw.js";import{fB as X,SX as Y,Tk as Z,Tb as $,ge as q,gg as H,Tg as J,gR as K,df as Q,Tl as ee,Tm as te}from"./zeni-epic-state-DASyz1An.js";import{n as ne}from"./mui-CD71lp6N.js";import{u as se}from"./useDeviceId-D_DsCe-9.js";import{f as ae}from"./analyticsHelper-DtAHYi5r.js";import{t as ie}from"./getLocaleForTenant-CSGkphtC.js";import"./recharts-2kmMgB1t.js";import"./analytics-CsbG8awP.js";import"./plaid-C8_LWTII.js";import"./dnd-CyZNzT3I.js";import"./stripe-cKAAJElX.js";import"./lottie-DeqWxWVC.js";import"./lexical-C5ZCOEAv.js";import"./pdf-D4eEcTTi.js";import"./utils-B6XFkcn3.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="2d72e980-59c4-43cb-9933-6d6ca74de767",t._sentryDebugIdIdentifier="sentry-dbid-2d72e980-59c4-43cb-9933-6d6ca74de767")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=_(),f=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:D}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>X(e))),k=l((e=>Y(e))),E=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),u.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants($(k.tenantsInOrder),s.zeniSessionId),q(s.userId,s.zeniSessionId,o.tenantId),t(H(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(J("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),K().then((()=>{const e=W();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Q(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,a.state,t]);const j=u.useCallback((()=>{f("/signin/auth")}),[f]),F=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return g.jsx(B,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
1
+ import{j as g}from"./liveblocks-D0hIH2N0.js";import{a as u}from"./sentry-DhqS_W-k.js";import{u as U,g as _,h as w,t as V,j as l,N as L}from"./core-35eDsgGP.js";import{z as r,E as M,G as P,R as A,k as N,S as R,Y as B,Z as G,V as W}from"./index-BBhWSYD8.js";import{fB as X,SX as Y,Tk as Z,Tb as $,ge as q,gg as H,Tg as J,gR as K,df as Q,Tl as ee,Tm as te}from"./zeni-epic-state-BRRtwAQl.js";import{n as ne}from"./mui-CY_LMiAy.js";import{u as se}from"./useDeviceId-Cd5EU_Dl.js";import{f as ae}from"./analyticsHelper-Cq4tYGNc.js";import{t as ie}from"./getLocaleForTenant-C0JZQLGG.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="2d72e980-59c4-43cb-9933-6d6ca74de767",t._sentryDebugIdIdentifier="sentry-dbid-2d72e980-59c4-43cb-9933-6d6ca74de767")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=_(),f=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:D}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>X(e))),k=l((e=>Y(e))),E=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),u.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants($(k.tenantsInOrder),s.zeniSessionId),q(s.userId,s.zeniSessionId,o.tenantId),t(H(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(J("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),K().then((()=>{const e=W();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Q(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,a.state,t]);const j=u.useCallback((()=>{f("/signin/auth")}),[f]),F=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return g.jsx(B,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -1 +1 @@
1
- import{j as _}from"./liveblocks-D83XGo_c.js";import{a as f}from"./sentry-BPfEBx2C.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-CGqhbBHO.js";import{fB as ne,SY as Ne,SZ as se,g5 as xe,fA as Pe,T3 as Re,S_ as Ve,S$ as je,pF as Le,gi as Oe,T2 as b,T5 as Ue,T6 as Q,gj as Ze,T7 as ze,Db as Ye,g_ as qe,cS as He,T8 as Ke,g4 as We,gk as Je}from"./zeni-epic-state-DASyz1An.js";import{w as Qe,i as Xe,c as ea,I as aa,e as ta,g as na,u as sa,d as c,h as oa,N as ia,z as ra,f as da,l as ca,n as la,s as ua,o as fa,q as X,L as ma,D as ha,F as ba,p as g,k as ee,y as pa,K as ae,B as Sa,C as ga}from"./index-CoKBrrSw.js";import{D as ka}from"./mui-CD71lp6N.js";import{u as Ea}from"./InboxNotificationsProvider-DDRknvRh.js";import{u as Ta}from"./useTaskManagerAccess-Dl-8FUHJ.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new l.Error().stack;i&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[i]="2f099332-bb28-41dd-97f1-b5021e116a2a",l._sentryDebugIdIdentifier="sentry-dbid-2f099332-bb28-41dd-97f1-b5021e116a2a")}catch{}})();const Ca=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=Ta(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Re),G=$.uiState.currentChatSessionId,T=na(),{setLoading:re}=sa(),[w,M]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,N=F("/:tenantEmailDomain/reports")!==null,m=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),P=t((e=>Ve(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>je(e)));f.useEffect((()=>{T&&C&&!m&&v.fetchState==="Not-Started"&&r(Le(!0))}),[T,C,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Oe(e):[])),S=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),Te=t((e=>b(e).reducedFetchCountState)),V=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ea();f.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),f.useEffect((()=>{T&&E&&!m&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[T,E,m,L.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Te,count:Ee},Y=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>Y?.tenantId!=null?Ze(e,Y.tenantId):void 0)),h=[];me===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const H=t((e=>ze(e,h).fetchState)),K=t((e=>Ye(e).fetchState)),ye=A&&(H==="Completed"||H==="Error")||N&&(K==="Completed"||K==="Error")||!A&&!N?void 0:"disabled",we=f.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=He(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&Ke(P.notificationSettings,p.userEmail,x,o,E),W=da(),Fe=W&&ca(a);return _.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=V===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=V===0&&j>0?"../../notifications/comments":"../../notifications/tasks");const u=g(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=g(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:g(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=g(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=g(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,_e=ae(J)&&J!=="command_center";if(ae(e.type)&&S[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(S[o.tenantId].month,S[o.tenantId].year,"Sidebar"),_e&&S[o.tenantId]!=null){const y=S[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=Sa(e.type);ga(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(ma.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:Se,newYearAnimationEnabled:ge})})})),Ba=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Xe(n)&&Ne(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
1
+ import{j as _}from"./liveblocks-D0hIH2N0.js";import{a as f}from"./sentry-DhqS_W-k.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-35eDsgGP.js";import{fB as ne,SY as Ne,SZ as se,g5 as xe,fA as Pe,T3 as Re,S_ as Ve,S$ as je,pF as Le,gi as Oe,T2 as b,T5 as Ue,T6 as Q,gj as Ze,T7 as ze,Db as Ye,g_ as qe,cS as He,T8 as Ke,g4 as We,gk as Je}from"./zeni-epic-state-BRRtwAQl.js";import{w as Qe,i as Xe,c as ea,I as aa,e as ta,g as na,u as sa,d as c,h as oa,N as ia,z as ra,f as da,l as ca,n as la,s as ua,o as fa,q as X,L as ma,D as ha,F as ba,p as g,k as ee,y as pa,K as ae,B as Sa,C as ga}from"./index-BBhWSYD8.js";import{D as ka}from"./mui-CY_LMiAy.js";import{u as Ea}from"./InboxNotificationsProvider-yp4VlF4V.js";import{u as Ta}from"./useTaskManagerAccess-DRrr5b-Z.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new l.Error().stack;i&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[i]="2f099332-bb28-41dd-97f1-b5021e116a2a",l._sentryDebugIdIdentifier="sentry-dbid-2f099332-bb28-41dd-97f1-b5021e116a2a")}catch{}})();const Ca=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=Ta(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Re),G=$.uiState.currentChatSessionId,T=na(),{setLoading:re}=sa(),[w,M]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,N=F("/:tenantEmailDomain/reports")!==null,m=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),P=t((e=>Ve(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>je(e)));f.useEffect((()=>{T&&C&&!m&&v.fetchState==="Not-Started"&&r(Le(!0))}),[T,C,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Oe(e):[])),S=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),Te=t((e=>b(e).reducedFetchCountState)),V=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ea();f.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),f.useEffect((()=>{T&&E&&!m&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[T,E,m,L.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Te,count:Ee},Y=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>Y?.tenantId!=null?Ze(e,Y.tenantId):void 0)),h=[];me===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const H=t((e=>ze(e,h).fetchState)),K=t((e=>Ye(e).fetchState)),ye=A&&(H==="Completed"||H==="Error")||N&&(K==="Completed"||K==="Error")||!A&&!N?void 0:"disabled",we=f.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=He(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&Ke(P.notificationSettings,p.userEmail,x,o,E),W=da(),Fe=W&&ca(a);return _.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=V===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=V===0&&j>0?"../../notifications/comments":"../../notifications/tasks");const u=g(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=g(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:g(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=g(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=g(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,_e=ae(J)&&J!=="command_center";if(ae(e.type)&&S[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(S[o.tenantId].month,S[o.tenantId].year,"Sidebar"),_e&&S[o.tenantId]!=null){const y=S[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=Sa(e.type);ga(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(ma.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:Se,newYearAnimationEnabled:ge})})})),Ba=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Xe(n)&&Ne(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-D0hIH2N0.js";import{h as r,l as i}from"./core-35eDsgGP.js";import{ak as n}from"./index-BBhWSYD8.js";import"./mui-CY_LMiAy.js";import"./sentry-DhqS_W-k.js";import"./zeni-epic-state-BRRtwAQl.js";import"./recharts-B8j-bW95.js";import"./analytics-p9dV2gEo.js";import"./plaid-CoaHurGj.js";import"./dnd-Dm1d6mZC.js";import"./stripe-cKAAJElX.js";import"./lottie-TJOzQ6Cz.js";import"./lexical-DQ4lSvQh.js";import"./pdf-DElOA9Iz.js";import"./utils-CgQOqOwX.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="e1fe4b0b-a509-4443-892f-577d1dfd5036",o._sentryDebugIdIdentifier="sentry-dbid-e1fe4b0b-a509-4443-892f-577d1dfd5036")}catch{}})();const a=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};