@zeniai/web-app-ui 5.3.61-qa → 5.3.62-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 (139) hide show
  1. package/dist/assets/{AccountMappingScreen-OaD-Ww7N.js → AccountMappingScreen-Br9WdaHc.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-C71W3EXR.js → ActualMatchingMatchDetailScreen-DIn78iaK.js} +1 -1
  3. package/dist/assets/AddressRoutes-Bs2su6QC.js +1 -0
  4. package/dist/assets/AddressScreen-ChRwBMyD.js +9 -0
  5. package/dist/assets/{AiCfoScreen-DO4viMbN.js → AiCfoScreen-BoGQRrg3.js} +1 -1
  6. package/dist/assets/{AppDrawer-BoBT503t.js → AppDrawer-DbFNEZx2.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-UWoiHhFS.js → BillPayApprovalRoutes-Ct7bUe2K.js} +1 -1
  8. package/dist/assets/BillPayRoutes-B9u5uZwl.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-DjqyigwM.js → BusinessVerificationPageScreen-e_hf599B.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-cEaT6Zqk.js → CardsAiCfoScreen-DX5yBLLe.js} +1 -1
  11. package/dist/assets/ChargeCardRoutes-C0BDIoz6.js +71 -0
  12. package/dist/assets/{CompanyPassportScreen-CHnMtfXr.js → CompanyPassportScreen-BlEcfU7b.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-DXkk-oNs.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-AEs3yg3Y.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-CkVSR1Hr.js → CustomerOnboardingRoutes-CYJxOgEd.js} +3 -3
  16. package/dist/assets/DashboardRoutes-g9OAwtyP.js +20 -0
  17. package/dist/assets/{DefaultTenantHome-BWjmQO2E.js → DefaultTenantHome-8TPWmCiF.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-Cs9T_IgO.js → DomesticWireDetailScreen-DjZA-xGp.js} +4 -4
  19. package/dist/assets/{DrawerScreen-CO5oDn6f.js → DrawerScreen-D1drFQnx.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-QbthrUVk.js → EntityDetailRoutes-BecZC3rR.js} +1 -1
  21. package/dist/assets/ExpenseAutomationRoutes-CoBNGWYF.js +38 -0
  22. package/dist/assets/{FeaturePreviewScreen-DWBL39rh.js → FeaturePreviewScreen-BOIyRrPg.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-DAce4xun.js → HubSpotOAuthCallbackScreen-CjBFKEJv.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-B4UF_uUg.js → InboxNotificationsProvider-DcarX1j5.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-BF9bJVNE.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-phTux1TG.js → MagicLinkRoutes-BJpvsEO6.js} +4 -4
  27. package/dist/assets/{MagicLinkSignInScreen-D-3VGahG.js → MagicLinkSignInScreen-CZf88rgm.js} +1 -1
  28. package/dist/assets/MobileAppDrawer-BzxL_djZ.js +1 -0
  29. package/dist/assets/NotFoundScreen-CQm7D9go.js +1 -0
  30. package/dist/assets/{NotificationRoutes-YZJK1G-i.js → NotificationRoutes-BFU33ioz.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-BgBHYWlo.js → OAuthConsentScreen-DWoFdp0W.js} +1 -1
  32. package/dist/assets/PandLWithForecastRoutes-CMfowbmP.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-DCGfHELs.js → PaymentLinkScreen-DVDDW9Xr.js} +9 -9
  34. package/dist/assets/{PeopleRoutes-BWFloBGz.js → PeopleRoutes-Cd8MqER4.js} +3 -3
  35. package/dist/assets/PerformanceRoutes-E86W1j7a.js +1 -0
  36. package/dist/assets/{Preview-Co3i0Xrb.js → Preview-Dxr01VGI.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-DYxxHcdI.js → QBOConnectionScreen-Os4Qkt_2.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-CMbfshMX.js → ReimbursementApprovalRoutes-BUfIlnAM.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CrWl9trk.js → ReimbursementApprovalRuleDetailScreen-Si973dRZ.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-B2UGt9Xo.js +68 -0
  41. package/dist/assets/ReportsRoutes-URtyqRNi.js +1 -0
  42. package/dist/assets/RewardsRoutes-xF2koJkH.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-DTNyy-6E.js → ScheduleDetailsPrepaidExpensesScreen-dZQw9m0s.js} +4 -4
  44. package/dist/assets/{ScreenRoutes-DP4Wjips.js → ScreenRoutes-DivUQ8Cf.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-CDD6OVir.js → SettingsRoutes-DySQSZO0.js} +5 -5
  46. package/dist/assets/{SetupPagesScreen-BlUoKvnc.js → SetupPagesScreen-Ctwh4sou.js} +5 -5
  47. package/dist/assets/SignInScreen-CMjQX-Bq.js +1 -0
  48. package/dist/assets/SignOutScreen-DiORNgD0.js +9 -0
  49. package/dist/assets/{TaskListScreen-UsJ67eRj.js → TaskListScreen-2YfVihcw.js} +2 -2
  50. package/dist/assets/{TaskRoutes-CH6htYb8.js → TaskRoutes-ClUIKKHH.js} +1 -1
  51. package/dist/assets/TransactionDetailRoutes-FefIagFG.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-DG9WnSFK.js +5 -0
  53. package/dist/assets/TransactionListRoutes-DJGbjFDn.js +1 -0
  54. package/dist/assets/TreasuryRoutes-qpLhCja3.js +37 -0
  55. package/dist/assets/{VendorsRoutes-jSHZV8MZ.js → VendorsRoutes-ry-2tBPT.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-Bf_MMExc.js → WiseConfirmationScreen-FC1WiW4f.js} +1 -1
  57. package/dist/assets/ZeniAccountRoutes-CnC3I2P3.js +57 -0
  58. package/dist/assets/{ZeniAccountStatementScreen-CcOG7C5Z.js → ZeniAccountStatementScreen-BkDHVJBF.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-Ci74NLEW.js → accountMappingHelper-DpfYWNe6.js} +1 -1
  60. package/dist/assets/{analytics-8lQ_GaR7.js → analytics-CiEh1qKr.js} +1 -1
  61. package/dist/assets/{analyticsHelper-Bi6R9Hrj.js → analyticsHelper-CyJSZC50.js} +1 -1
  62. package/dist/assets/{core-B-8b0iz9.js → core-Caq7Zbsp.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-hAviH84T.js → decodeURIComponentSafe-DmjyT4t5.js} +1 -1
  64. package/dist/assets/{dnd-CtOxA7uX.js → dnd-DwckO6rX.js} +1 -1
  65. package/dist/assets/{empty-CyiOIGJw.js → empty-CviwvzhB.js} +1 -1
  66. package/dist/assets/{empty-ZUR8mjP1.js → empty-Dl3LsHNf.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-Dch9mr3K.js → emptyVideoElement-0ADxBh21.js} +1 -1
  68. package/dist/assets/{epic-C_YIXfJm.js → epic-DqqOk9a9.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-BzOPc0En.js → expenseAutomationHelper-B83Qa5Jl.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-BYXijL7f.js → getLocaleForTenant-CqonawWC.js} +1 -1
  71. package/dist/assets/{index-BUsi93tT.js → index-B3LhL1WI.js} +2 -2
  72. package/dist/assets/{index-Bg2deWZq.js → index-BFK4rLhv.js} +23226 -23221
  73. package/dist/assets/{index-DeS-5gfC.js → index-BLBexBOn.js} +1 -1
  74. package/dist/assets/{index-CzpjeHcU.js → index-BggnOuo1.js} +1 -1
  75. package/dist/assets/{index-CgYr_9vs.js → index-Bi5Vnzzf.js} +1 -1
  76. package/dist/assets/{index-Ce-G0Vp2.js → index-BsIiLcaT.js} +1 -1
  77. package/dist/assets/{index-haVo7C6B.js → index-DZj1fENq.js} +1 -1
  78. package/dist/assets/{index-b65XjN06.js → index-De1Gw5gW.js} +1 -1
  79. package/dist/assets/{lexical-BVt4M34U.js → lexical-mmp2B1vq.js} +1 -1
  80. package/dist/assets/{liveblocks-BjcYyeQ6.js → liveblocks-CIxx6Ub6.js} +1 -1
  81. package/dist/assets/{lottie-BdAYiWcR.js → lottie-CrKh4Q_r.js} +1 -1
  82. package/dist/assets/{mui-C33Oegsm.js → mui-DI0hUuFr.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bgu6njoM.js → pathToGoBack-Ch5lrOj1.js} +1 -1
  84. package/dist/assets/{pdf-BkfulyEw.js → pdf-BlhN83fm.js} +3 -3
  85. package/dist/assets/{pdf-lib-D8o-uP9K.js → pdf-lib-WBpN-CHj.js} +1 -1
  86. package/dist/assets/{plaid-Bt28AVCt.js → plaid-CXvI7t9H.js} +1 -1
  87. package/dist/assets/{pusher-BWEmmbE9.js → pusher-BZAjVztW.js} +1 -1
  88. package/dist/assets/{react-BAH__mX9.js → react-BHfk4QRe.js} +1 -1
  89. package/dist/assets/{react-CIEK2Ei-.js → react-BqA23JAy.js} +1 -1
  90. package/dist/assets/{react-Dqb011PB.js → react-BsygV86H.js} +1 -1
  91. package/dist/assets/{react-B7GqIpoL.js → react-XoZ7aD8C.js} +1 -1
  92. package/dist/assets/{react-DT9gMpbF.js → react-rmAoHvXj.js} +1 -1
  93. package/dist/assets/{react-Ls8UDl46.js → react-tooGqts4.js} +1 -1
  94. package/dist/assets/{recharts-DkYxIsLi.js → recharts-DKmpCGIA.js} +1 -1
  95. package/dist/assets/{routePaths-Cz0AF8Dx.js → routePaths-BpLibSFl.js} +1 -1
  96. package/dist/assets/{sentry-DZ9rNYfw.js → sentry-BCPOyc0G.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Te2Zqy4u.js → stripSplatSuffix-Dmnnw5Oe.js} +1 -1
  98. package/dist/assets/{url-BjdrSaU1.js → url-CdxI2rEH.js} +1 -1
  99. package/dist/assets/{url-DY2r7CPa.js → url-JduagIhH.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-BzNeeZZT.js → useActualMatchingMatchDetail-DuLHKjLq.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CI6Qx_-n.js → useAiCfoDashboardSuggestedQuestionsChips-BZ908ypV.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-0MZcMlGZ.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-1CQ78Q4X.js → useChargeCardPusherEvents-BxJ5Xbwu.js} +1 -1
  104. package/dist/assets/{useDeviceId-gFU5q5zf.js → useDeviceId-2NJBbYPM.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-BkOsYAaQ.js → useEmailConnectResultRefresh-BgnlRFeW.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-C3Htu0iZ.js → useInitialThreadRequest-DCnYqu0o.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-DR584Qqx.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-Da1LpD5U.js → useTaskManagerPusherEvents-BwxBoB_w.js} +1 -1
  109. package/dist/assets/{utils-D3rZq_G4.js → utils-rX2IEvjD.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-BaNmmFC5.js +25 -0
  111. package/dist/assets/{zeni-epic-state-95zxmizy.js → zeni-epic-state-DROyxOLw.js} +3 -3
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-BVz7TQgL.js +0 -1
  115. package/dist/assets/AddressScreen-DyDl-tRh.js +0 -9
  116. package/dist/assets/BillPayRoutes-GFA8LUX-.js +0 -119
  117. package/dist/assets/ChargeCardRoutes-D4YlLVsI.js +0 -71
  118. package/dist/assets/ConnectionAuthScreen-DoG98aIj.js +0 -11
  119. package/dist/assets/CustomerOnboardingAuthScreen-sNk7vsur.js +0 -1
  120. package/dist/assets/DashboardRoutes-mW-tjMuc.js +0 -20
  121. package/dist/assets/ExpenseAutomationRoutes-DOepnh8G.js +0 -38
  122. package/dist/assets/InvoicingRoutes-BNkUMYuP.js +0 -2
  123. package/dist/assets/MobileAppDrawer-CHFdUHPo.js +0 -1
  124. package/dist/assets/NotFoundScreen-BPIsWBDH.js +0 -1
  125. package/dist/assets/PandLWithForecastRoutes-gJp3CGBo.js +0 -1
  126. package/dist/assets/PerformanceRoutes-DE0kFKjY.js +0 -1
  127. package/dist/assets/ReimbursementRoutes-ChwPWyQv.js +0 -68
  128. package/dist/assets/ReportsRoutes-CYsPWlxq.js +0 -1
  129. package/dist/assets/RewardsRoutes-C-TWFvBa.js +0 -1
  130. package/dist/assets/SignInScreen-3WOvV3S5.js +0 -1
  131. package/dist/assets/SignOutScreen-CKL0FwKr.js +0 -9
  132. package/dist/assets/TransactionDetailRoutes-D6Gttu9Z.js +0 -1
  133. package/dist/assets/TransactionDetailScreen-CN2_Ei-4.js +0 -5
  134. package/dist/assets/TransactionListRoutes-BBUdWZ4f.js +0 -1
  135. package/dist/assets/TreasuryRoutes-BqcgWSjx.js +0 -37
  136. package/dist/assets/ZeniAccountRoutes-CBtuSj8X.js +0 -57
  137. package/dist/assets/useAskAiCfoHostNavButtonProps-BZHyrLWc.js +0 -1
  138. package/dist/assets/useTaskManagerAccess-C6qhVozS.js +0 -1
  139. package/dist/assets/withTransactionSidePanel-iXTpLDC6.js +0 -25
@@ -1,38 +0,0 @@
1
- import{j as b}from"./liveblocks-BjcYyeQ6.js";import{u as he,h as nt,g as be,j as _,i as Oe,t as Yn,l as Hn,n as Kn,o as He,N as Xn}from"./core-B-8b0iz9.js";import{fF as ke,a14 as Qn,q0 as _e,Ue as Zn,A3 as es,a15 as ts,a16 as as,a17 as ns,a18 as gt,a19 as Xe,gh as bt,a1a as ca,eW as ss,g0 as os,a1b as ia,a1c as Qe,qT as cs,uR as is,gS as ls,gQ as rs,a1d as ds,r4 as us,rd as ms,qb as ps,qp as wa,gP as re,gR as hs,a1e as Ss,qL as Ra,re as gs,qm as Cs,qh as fs,uX as Is,gO as Me,a1f as tt,Cd as Da,MA as Fa,a1g as _a,Fy as Ma,a1h as ks,eZ as bs,e$ as Ts,sS as Tt,W_ as la,X0 as Ps,m2 as ys,X1 as vs,m9 as Es,dl as As,Dw as Pt,a1i as xs,a1j as ws,fm as yt,sG as ra,WT as Rs,a1k as Ds,a1l as Fs,mb as _s,a1m as Ms,Rg as Us,ma as Os,l$ as Bs,qE as Ua,rj as at,tt as Oa,tP as Vs,U4 as Ba,ri as da,rl as Va,rn as js,bE as Ls,ny as zs,nv as $s,rm as Ze,rk as pe,a1n as Gs,rE as ua,a1o as Ns,a1p as qs,sK as Js,sL as Ws,WP as Ys,VV as Hs,a0y as Ks,a1q as Xs,WV as ma,WU as Ke,a1r as pa,mq as Qs,a1s as Zs,a1t as eo,a1u as to,a1v as ao,qz as no,a1w as so,a1x as oo,a1y as co,ru as io,md as lo,m4 as ro,a1z as uo,mc as ha,Xb as mo,a1A as po,a1B as ho,us as So,u3 as go,u2 as Ct,a1C as Co,a1D as fo,a1E as Io,a1F as ko,nJ as bo,br as To,nE as Sa,nq as Po,a1G as yo,g$ as vo,nB as Eo,sU as Ao,sW as xo,sD as wo,VY as Ro,VZ as Do,F0 as Fo,E$ as _o,Fg as Mo,a1H as ga,sJ as Uo,a1I as Oo,rU as Bo,r_ as Vo,s9 as jo,rX as Lo,a1J as zo,s8 as $o,sP as Go,a1K as No,t0 as qo,sx as Jo,t6 as Wo,sC as Yo,rF as Ho,a1L as Ko,qX as Xo,qv as Qo,qC as Ca,rp as Zo,a1M as ec,a1N as tc,a1O as ac,a1P as nc,a1Q as sc,a1R as oc,a1S as cc,ta as ic,a1T as lc,a1U as rc,a1V as fa,uD as dc,tW as uc,tL as Ia,tJ as mc,a1W as pc,ty as hc,td as Sc,tM as gc,a1X as Cc,a1Y as fc,tj as Ic,a1Z as kc,te as bc,ti as Tc,tg as Pc,tS as yc}from"./zeni-epic-state-95zxmizy.js";import ja from"./NotFoundScreen-BPIsWBDH.js";import{a as s,R as La}from"./sentry-DZ9rNYfw.js";import{n as Te,S as vc}from"./mui-C33Oegsm.js";import{o as Be,S as H,k as Q,p as te,ar as za,at as $a,dP as Ec,dQ as Ac,M as Ga,z as st,dR as xc,dS as wc,dT as Rc,af as Ue,dU as Dc,dV as ka,bb as ba,dW as Fc,a8 as Na,dX as _c,j as et,a as Mc,dY as Uc,dZ as Oc,O as Bc,K as Vc,d_ as jc,d$ as Lc,e0 as zc,b5 as $c,bt as Gc,ac as Nc,b6 as qc,b7 as Jc,G as Wc,w as Yc,e1 as Hc,aw as Ta,e2 as Kc}from"./index-Bg2deWZq.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-BZHyrLWc.js";import{g as Pa,b as Xc,c as Qc,h as Zc,a as ei,i as ti,r as ai,C as ni}from"./TransactionDetailScreen-CN2_Ei-4.js";import{u as si}from"./useActualMatchingMatchDetail-BzNeeZZT.js";import{d as oi}from"./decodeURIComponentSafe-hAviH84T.js";import{m as Ja,a as Wa}from"./expenseAutomationHelper-BzOPc0En.js";import{u as Ya,a as Ha,w as ci}from"./withTransactionSidePanel-iXTpLDC6.js";import{b as ii,S as li,a as ri,J as di}from"./ScheduleDetailsPrepaidExpensesScreen-DTNyy-6E.js";import{s as ya,i as Ka,h as ui,v as mi,c as pi}from"./routePaths-Cz0AF8Dx.js";import{a as ft}from"./accountMappingHelper-Ci74NLEW.js";import{D as hi}from"./DrawerScreen-CO5oDn6f.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./useInitialThreadRequest-C3Htu0iZ.js";import"./stripSplatSuffix-Te2Zqy4u.js";import"./pathToGoBack-Bgu6njoM.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="2d219bb3-5491-47a2-a5be-6037b8ad0589",t._sentryDebugIdIdentifier="sentry-dbid-2d219bb3-5491-47a2-a5be-6037b8ad0589")}catch{}})();const Si=()=>{const t=he(),n=nt(),f=be(),I=_((C=>ke(C))),{useFeatureGate:k}=Be(),{isFeatureEnabled:o}=k(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(H.aiAuditScorePercentage),E=_((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=_((C=>Qn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=qa({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,L=!1)=>{t(_e({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:L}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(Zn(I.tenantId,C))}),[I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),g=E[I.tenantId],u=s.useCallback((()=>{const C=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(g.month,g.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,C??null),x(g,I.tenantId,!0)}),[x,g,I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=te(f.state?.pathnameStackToGoBack,f.pathname),A=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&g!=null){const C=l.monthEndCloseChecks.monthEndCloseCheckList.find((h=>h.progress<100));if(C!=null)return void n(`./${C.id}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=za();return $a({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{g!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&x(g,I.tenantId)}),[x,g,l.fetchState,I.tenantId,p]),s.useEffect((()=>{g!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(es(g))}),[g,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const C=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(C)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const C=f.state?.referrer;Q.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,C??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),b.jsx(gi,{children:b.jsx(Ec,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},gi=Te.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- background-color: ${t=>t.theme.colors.grey4};
8
- `;function Ci({isFullView:t,matchId:n,onClose:f}){const{match:I,detailFetchState:k,handleOpenBill:o,handleContinueMatch:r,handleRefresh:E,handleUndoReversal:l,lastMatchResults:S,lastUndoResults:R,refreshStatus:x,undoReversalStatus:m}=si(n);return b.jsx(Ac,{match:I,detailFetchState:k.fetchState,isRenderedInPanel:!t,isUndoInFlight:m.fetchState==="In-Progress",refreshStatus:x.fetchState,onNavigateBack:f,onOpenBill:o,onContinueMatch:r,onRefresh:E,onUndoReversal:l,lastMatchResults:S,lastUndoResults:R})}const fi=/^match\/([^/?]+)$/,Ii=Ha({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const{useFeatureGate:n}=Be(),{isFeatureEnabled:f}=n(H.isTransactionDetailSplitViewEnabled),{isFeatureEnabled:I}=n(H.isAccrualEnabled),k=Ga(),o=(function(E=!0){const l=nt(),S=be(),R=Oe(),x=Ja(R),m=Ya({childPathPattern:fi,enabled:E,listPath:x}),g=m.matchGroups[0]!=null&&m.matchGroups[0]!==""?oi(m.matchGroups[0]):void 0,u=R.tenantEmailDomain??S.pathname.split("/").find(Boolean)??"",F=s.useRef({isOpen:m.isOpen,matchId:g});F.current={isOpen:m.isOpen,matchId:g};const A=s.useCallback((h=>{!m.isMobile&&E?F.current.isOpen&&F.current.matchId===h?m.closePanel():m.navigateToChild(`match/${encodeURIComponent(h)}`,{replace:F.current.isOpen}):l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(h)}`)}),[l,m.isMobile,m.navigateToChild,m.closePanel,E,u]),p=s.useCallback((()=>{if(g==null)return;const h=te(S.state?.pathnameStackToGoBack,`${S.pathname}${S.search}`);l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(g)}`,{state:{pathnameStackToGoBack:h}})}),[S.pathname,S.search,S.state,g,l,u]),C=m.isOpen&&g!=null;return{closePanel:m.closePanel,isOpen:C,maximize:p,matchId:E&&C?g:void 0,openPanel:A}})(t&&I===!0&&k===!0&&f===!0),r=s.useMemo((()=>{if(o.isOpen&&o.matchId!=null)return b.jsx(Ci,{isFullView:!1,matchId:o.matchId,onClose:o.closePanel},o.matchId)}),[o.closePanel,o.isOpen,o.matchId]);return{injectedProps:s.useMemo((()=>({closeMatchSidePanel:o.closePanel,isMatchPanelOpen:o.isOpen,matchPanelContent:r,matchPanelMatchId:o.matchId,openMatchPanel:o.openPanel})),[r,o.closePanel,o.isOpen,o.matchId,o.openPanel]),selectedItemId:o.matchId,sidePanel:{closePanel:o.closePanel,maximize:o.maximize}}}}),ki=La.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:f,onFetchLinkTokenClick:I,onEstablishConnectionClick:k})=>{const o=he(),{useFeatureGate:r}=Be(),{isFeatureEnabled:E}=r(H.isReconV3Enabled),{isFeatureEnabled:l}=r(H.isReconciliationCombinedStatementEnabled),S=st.getSignedInUser(),R=_((y=>ke(y))),x=s.useMemo((()=>({userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:R?.tenantId??""})),[S?.userId,S?.zeniSessionId,R?.tenantId]),{accountReconciliationsByAccountID:m,excludedAccountIDs:g,monthYearPeriod:u,statementUploadChosen:F}=t,A=m[n],p=s.useMemo((()=>ts(m,n)),[m,n]),C=s.useMemo((()=>as(m)),[m]),h=s.useMemo((()=>ns(m,n)),[m,n]),L=s.useRef(!1),G=s.useCallback((y=>{L.current=y,ka(n,y)}),[n]),q=s.useCallback((y=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:y.completedSteps,startedAtMs:y.startedAtMs,totalDurationSeconds:y.totalDurationSeconds})),y.accountMappings!=null&&o(Xe({accountId:n,selectedPeriod:u,localData:{combinedStatementAccountMappings:y.accountMappings}})),A!=null&&requestAnimationFrame((()=>{L.current||o(bt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:xc(A)}]}))}))}),[o,u,A,n]),T=s.useCallback((()=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,n,u]),J=s.useCallback((y=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:y}))}),[o,u,n]),N=s.useCallback((()=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:0})),o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,u,n]);s.useEffect((()=>()=>{ka(null,!1)}),[]);const e=A?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??A?.accountReconEntity.statementMetaData?.statementUploadId,a=A?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,i=_((y=>a!=null&&a!==""?ss(os(y.userState,a)):"")),d=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u}))}),[o,n,u]),v=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u})),o(Qe({statementUploadChosen:!0}))}),[o,n,u]),P=(y,z)=>{o(Is(y,z.split(".")[0]))},D=(y,z)=>{if(z===!0){const X=A?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(X!=null&&X!=="")return void o(Cs({accountId:n,selectedPeriod:u,combinedStatementGroupId:X,fileId:y}))}e!=null&&o(fs({accountId:n,selectedPeriod:u,fileId:y,statementUploadId:e}))},M=()=>{o(Qe({statementUploadChosen:!1}))},W=y=>{o(gs({accountId:n,selectedPeriod:u,payload:y,statementAccountScope:l===!0?A?.localData?.statementAccountScope??"single_account":"single_account"}))},Y=s.useCallback(((y,z,X)=>{o(cs({accountId:y,selectedPeriod:z,statementUploadId:X}))}),[o]),se=s.useCallback(((y,z,X,Z,ge)=>{ge!=null&&ge!==""&&o(is(ge)),o(Z==null||Z===""?rs({accountId:y,selectedPeriod:z,statementUploadId:X}):ls({accountId:y,selectedPeriod:z,statementUploadId:X,combinedStatementGroupId:Z}))}),[o]),ce=s.useCallback(((y,z)=>{z!==""&&o(ds({accountId:n,selectedPeriod:u,statementUpdateLocalData:y,statementUploadId:z}))}),[o,n,u]),Pe=s.useCallback((()=>{e!=null&&o(A?.localData?.statementAccountScope!=="multi_account"?ms({accountId:n,selectedPeriod:u,statementUploadId:e}):us({accountId:n,selectedPeriod:u,statementUploadId:e}))}),[o,A?.localData?.statementAccountScope,n,u,e]),ye=s.useCallback((y=>{e!=null&&o(ps({accountId:n,selectedPeriod:u,statementUploadId:e,accountMappings:y}))}),[o,u,n,e]),ve=s.useCallback((()=>{o(Qe({statementUploadChosen:!0}))}),[o]),K=y=>{o(Xe({accountId:n,selectedPeriod:u,localData:{accountSource:y}}))},B=y=>{o(Xe({accountId:n,selectedPeriod:u,localData:{statementAccountScope:y}}))},Ve=s.useCallback((()=>{o(wa({accountId:n}))}),[o,n]),Ee=s.useCallback((y=>{o(re(u,y,!0)),f()}),[o,u,f]),ot=s.useCallback((()=>{o(hs({accountId:n,selectedPeriod:u,statementProcessingFailed:!1})),o(Ss({accountId:n,selectedPeriod:u}))}),[o,n,u]),Se=s.useCallback((()=>{o(Ra({accountId:n}))}),[o,n]),je=g.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(je!=null)return b.jsx(va,{children:b.jsx(Ea,{$isV3:E===!0,children:b.jsx(wc,{excludedAccountReconciliation:je,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:E,onDismissClick:f,onIncludeIntoReconciliation:Se})})});if(A!=null){const y=E===!0?b.jsx(Rc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,onSelectStatementAccountScope:B,isReconciliationCombinedStatementEnabled:l===!0,ledgerAccounts:p,statementOverrideWarningAccountIds:h,unavailableLedgerAccountIds:C,onConfirmStatementMapping:ye,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve,onRetryParsing:Y,onFetchStatementParseInfo:se,onReviewClicked:Ee,statementProcessingFailed:A.statementProcessingFailed,statementProcessingDismissedToBackground:A.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ot,onContinueInBackground:q,onClearStatementProcessingDismissedToBackground:T,onResetStatementProcessingProgress:N,onStatementProcessingProgressChange:J,onStatementFlowVisibilityChange:G,onReuploadStatement:ve,onStatementFormDataChange:ce,onStatementConfirmSave:Pe,reconciledByName:i,onDismissDateConflict:d,onReuploadAfterDateConflict:v,isReconV3Enabled:E}):b.jsx(Dc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve});return b.jsx(va,{children:b.jsx(Ea,{$isV3:E===!0,children:y})})}return null})),va=Te.div`
9
- display: flex;
10
- flex-direction: column;
11
- height: 100%;
12
- `,Ea=Te.div`
13
- flex: 1;
14
- min-height: 0;
15
- display: flex;
16
- flex-direction: column;
17
- box-sizing: border-box;
18
- min-width: 0;
19
- overflow-x: hidden;
20
- overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
21
- `;function bi({panelType:t,scheduleId:n,onClose:f,onCloseAfterDecision:I}){return b.jsx(Pi,{children:b.jsx(yi,{children:Ti(t,n,f,I)})})}function Ti(t,n,f,I){switch(t){case"one_time_accrual":return b.jsx(di,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:f});case"accrued_expenses":return b.jsx(ri,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"fixed_assets":return b.jsx(li,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"prepaid_expenses":return b.jsx(ii,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:f,onPanelCloseAfterDecision:I})}}const Pi=Te.div`
22
- display: flex;
23
- flex-direction: column;
24
- height: 100%;
25
- `,yi=Te.div`
26
- flex: 1;
27
- min-height: 0;
28
- display: flex;
29
- flex-direction: column;
30
- box-sizing: border-box;
31
- min-width: 0;
32
- overflow-x: hidden;
33
- overflow-y: auto;
34
- `,vi=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,Ei=Ha({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(m=!0){const g=nt(),u=be(),F=he(),A=Oe(),p=Ya({childPathPattern:vi,enabled:m}),C=p.matchGroups[0],h=Ka(C)?C:void 0,L=p.matchGroups[1]!=null&&p.matchGroups[1]!==""?p.matchGroups[1]:void 0,G=p.isOpen&&h!=null&&L!=null,q=A.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",T=s.useRef({isOpen:G,scheduleId:L});T.current={isOpen:G,scheduleId:L};const J=s.useCallback(((e,a,i)=>{i!=null&&(a==="prepaid_expenses"||a==="fixed_assets")&&F(Ma({selectedJEScheduleKey:i})),!p.isMobile&&m?T.current.isOpen&&T.current.scheduleId===e?p.closePanel():p.navigateToChild(`schedule/${a}/${e}`,{replace:T.current.isOpen}):g(ya(a,e,q),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[F,g,p.isMobile,p.navigateToChild,p.closePanel,m,q]),N=s.useCallback((()=>{if(h==null||L==null)return;const e=te(u.state?.pathnameStackToGoBack,u.pathname);g(ya(h,L,q),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[g,h,L,q,u.pathname,u.state]);return{closePanel:p.closePanel,isOpen:G,maximize:N,openPanel:J,panelType:G?h:void 0,scheduleId:G?L:void 0}})(t),f=s.useRef(null),[I,k]=s.useState(null),o=s.useMemo((()=>({registerPanelDirtyGuard:m=>{f.current=m}})),[]),r=s.useCallback((m=>{f.current?.isDirty()===!0?k((()=>m)):m()}),[]),E=s.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=s.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),S=s.useCallback(((m,g,u)=>{r((()=>n.openPanel(m,g,u)))}),[r,n.openPanel]),R=s.useMemo((()=>{if(I!=null)return{onCancel:()=>k(null),onDiscard:()=>{f.current=null,k(null),I()}}}),[I]),x=s.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return b.jsx(Fc.Provider,{value:o,children:b.jsx(bi,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:E,onCloseAfterDecision:()=>{f.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,E,o]);return{injectedProps:s.useMemo((()=>({closeSchedulePanel:E,isSchedulePanelOpen:n.isOpen,openSchedulePanel:S,schedulePanelContent:x,schedulePendingDiscardConfirmation:R})),[E,S,x,R,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:E,maximize:l}}}});function Ai({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:f,resetCustomerRequest:I}){const k=st.getSignedInUser();if(k==null)throw Error("Can't access Customer Request page without signing in...");const o=_((r=>ks(r,t,k)));return s.useEffect((()=>{I()}),[]),b.jsx(b.Fragment,{children:o.fetchState==="In-Progress"||o.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?b.jsx(Na,{fetchState:"In-Progress"}):b.jsx(_c,{onCloseClick:n,addCustomerRequest:f,snippets:o.companyMonthEndReportTemplatesData,bulletPoints:o.zeniRequestsData??[]})})}const xi={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},wi=()=>{const t=_((R=>Me(R))),n=be(),{currentSelectedViewFetchState:f,currentSelectedView:I,selectedPeriod:k}=t,o=et(I),r=et(f.fetchState),E=t.jeSchedules.uiState.selectedPageTab??"schedules",l=et(E),S=s.useCallback((R=>{const x=n.state?.referrer;I==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?Q.trackTransactionsReviewPage(k.month,k.year,t.transactionView.totalCountByTab.review,0,R,x??null):Q.trackTransactionsAutoCategorisedPage(k.month,k.year,t.transactionView.totalCountByTab.autoCategorized,0,R,x??null)),I==="missing_receipts"&&Q.trackMissingReceiptsPage(k.month,k.year,R,t.missingReceipts.transactions.length,x??null),I==="je_schedules"&&Q.trackMonthCloseScheduleListPage(k.month,k.year,R,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.failedPostings.length,(m=>{const g={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return m.forEach((u=>{if(bs(u))g.oneTimeAccrualCount+=1;else switch(Ts(u)){case"prepaid_expenses":g.prepaidCount+=1;break;case"fixed_assets":g.fixedAssetsCount+=1;break;case"accrued_expenses":g.accruedCount+=1}})),g})(t.jeSchedules.pendingReviewSchedules),xi[E],x??null),I==="flux_analysis"&&Q.trackFluxAnalysisPage(k.month,k.year,R,Ri(t.fluxAnalysis),x??null),I==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&Q.trackInsightsEmailPage(k.month,k.year,R,"draft",t.auditSummary.auditScorePercentage,null,x??null)}),[k,t,E]);return s.useEffect((()=>{(r!==f.fetchState||I!==o||I==="je_schedules"&&l!=null&&E!==l)&&f.fetchState==="Completed"&&S(!1)}),[I,f.fetchState,o,E,l]),S},Ri=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Di,comma:Aa,space:Fi}},dateFormat:Xa}=Wc.getLocalizedStrings(),xa=yc,_i=Hn((function(t,n){const{uncategorizedAccounts:f,vendorSearchAutoCompleteData:I,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,companyId:r,isMissingReceiptsBulkUploadEnabled:E,isTransactionActivityEnabled:l,newScheduleActiveType:S}=n,R=st.getSignedInUser(),x=t.tenantState.currentTenantId,m={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:x??""},g=Me(t),{selectedTransactionCategorizationTab:u}=g,{searchTransactionsResults:F,searchTransactionsFetchState:A}=Ns(t),p=S==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:C,classListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:L,newScheduleLocalData:G,saveStatus:q}=qs(t,p);return{expenseAutomationViewSelector:g,accountListNestedAccountHierarchy:C,allDepreciationAccountListNestedAccountHierarchy:L,baseTransactionSearchFetchState:A,baseTransactionSearchResults:F,classListNestedAccountHierarchy:h,newScheduleLocalData:G,initialSelectedBaseTransaction:G.selectedBaseTransactionId!=null?Js(t.transactionState,Ws(G.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Ys(t),newScheduleSaveStatus:q,bulkUploadSelector:E===!0?g.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:I,authParams:m,receiptUploadEndpoint:`${Ue.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Ta}/transaction_attachments`,bulkUploadEndpoint:E===!0?`${Ue.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:g.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:R,uncategorizedAccounts:f,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:Ks(t.tenantState,x),downloadParams:{authParams:m,jeScheduleEndPoint:`${Ta}/jeScheduleReports`,timezone:Hs(),companyName:ke(t).companyName}}}),(function(t,n){const{themeState:f,isAccountingClassesEnabled:I,isCOTEnabled:k,isMissingReceiptsBulkUploadEnabled:o,location:r,vendorSearchAutoCompleteData:E,expenseAutomationViewSelector:l,currentTenant:S,newScheduleActiveType:R,uncategorizedAccounts:x,navigate:m,onClickCustomerRequest:g,handleEditClick:u,closeSchedulePanel:F,isSchedulePanelOpen:A,openSchedulePanel:p,setActivityLogTransactionId:C}=n,{selectedPeriod:h,currentSelectedView:L,reconciliation:{selectedAccountId:G}}=l,{accountSettingsView:q}=l.jeSchedules,T=Ua(h),J=at(T.start),N=at(T.end);return{onZeniLogoClick:()=>{f.toggle()},onUploadReceiptAttachment:e=>{Q.trackMissingReceiptAttached(h.month,h.year),t(uc(e))},onUploadTransactionReceipt:(e,a,i,d,v,P)=>{t(fa(e,a,{fetchState:"In-Progress"}));const D=()=>t(fa(e,a,{fetchState:"Error"}));Kc(`${Ue.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,P,a,i,d,v).then((M=>{M!=null?t(dc(e,M)):D()})).catch(D)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(rc(e,a)),S!=null&&t(_e({tenantId:S.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,i,d)=>{t(lc(e,{fetchState:a,error:i})),i!=null&&t(bt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:d!=null?Fi+Di+d+Aa:Aa}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,i=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,d=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;i&&n.closeMatchSidePanel?.(),A===!0&&(i||d)&&F?.(),e.createdGroupCollapsed!=null?t(nc()):e.pendingGroupCollapsed!=null?t(sc()):e.failedGroupCollapsed!=null?t(oc()):e.selectedJETypeFilter!==void 0?t(cc(e.selectedJETypeFilter)):t(ic(e))},onUpdateMissingReceiptsUIState:e=>{t(ac(e))},onFetchMissingReceiptsList:()=>{N!=null&&J!=null&&t(Va({start:J,end:N},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...o===!0?{onBulkUploadFiles:e=>{t(Pc(e))},onBulkUploadProgress:e=>{t(Tc(e))},onBulkUploadSuccess:e=>{t(bc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(kc(e))},onConfirmBulkUploadMatch:(e,a,i,d,v)=>{t(Ic(e,a,i,d,v))},onBulkUploadConfirmMatchAcknowledged:()=>{t(fc())},onSetBulkUploadResultsTab:e=>{t(Cc(e))},onSetBulkUploadCompletedSubTab:e=>{t(gc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(Ia({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(Sc())},onSearchTransactionsForManualMatch:(e,a)=>{t(xa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(xa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(hc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(pc())},onFetchBulkUploadBatches:e=>{t(Oa(e))},onFetchMoreBatchDetails:()=>{t(mc())},onResetBulkUploadSort:()=>{t(Ia({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(tc())},onSearchTextChanged:e=>{const a=l.currentSelectedView,i=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(Ct({selectedTab:i,uiState:{searchString:e}})),N!=null&&J!=null&&t(pe(i,{start:J,end:N},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(ec({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(Zo())},onClose:()=>{L==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0})),m("../")},onBack:()=>{L==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(Qo(e))},onSaveReconciliationReview:e=>{t(Xo(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:i,referrer:l.currentSelectedView}}),t(Ba(e))},handleLogOutClick:()=>{const e=te(r.state?.pathnameStackToGoBack,r.pathname);m("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:i,fixedAssetsAccount:d,accruedExpensesAccount:v}=a,P=ft(q.prepaidExpensesAccountList,i.selectedOptions),D=ft(q.fixedAssetsAccountList,d.selectedOptions),M=ft(q.accruedExpensesAccountList,v.selectedOptions),W={selectedPrepaidExpensesAccountIds:P.map((Y=>Y.accountId)),selectedFixedAssetsAccountIds:D.map((Y=>Y.accountId)),selectedAccruedExpensesAccountIds:M.map((Y=>Y.accountId))};t(Ko({data:W}))},onSaveJeAccountSettingsClick:()=>{t(Ho())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:i,accumulatedDepreciationCategory:d,scheduleClass:v,scheduleExpenseCategory:P,vendor:D}=a,{allAccountList:M,allClassList:W,allDepreciationAccountList:Y}=l.jeSchedules,se=E.entityAutoCompleteView.vendor.length>0?E.entityAutoCompleteView.vendor.find((K=>K.id===D?.selectedOption)):void 0,ce={id:se?.zeniId??D?.selectedOption??"",name:se?.name??D?.defaultOptions.find((K=>K.value===D?.selectedOption))?.label??"",logo:se?.logo},Pe=P?.selectedOption!=null?M.find((K=>K.qboId===P.selectedOption)):void 0,ye=v?.selectedOption!=null?W.find((K=>K.classId===v.selectedOption)):void 0,ve=d?.selectedOption!=null?Y.find((K=>K.qboId===d.selectedOption)):void 0;t(Yo({scheduledJournalEntryID:e,localData:{jeScheduleID:i,scheduledJournalEntryID:e,updatedCategoryId:Pe?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:ve?.accountId,updatedVendor:{id:ce.id,name:ce.name}}}))},onRevertJeSchedule(e,a,i,d,v){t(Wo(e,a,i,d,v))},ignoreRecommendedJeSchedule(e,a,i,d){t(Jo(e,a,i,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(ma({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onCancelAutoComplete:()=>{t(Ke("common"))}},onPostJESchedule(e,a){t(qo({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(No())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=pi(e,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(Go({query:e,scheduleType:R==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const i=yt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(ga({scheduleType:i,localData:a}))},onOpenMatchNewModal(e){t($o(e))},onCloseMatchNewModal(){t(zo())},onClearMatchNewModal(){t(Lo())},onSearchMatchTransactions(e,a){t(jo(e,a))},onSearchMatchAccruals(e,a){t(Vo(e,a))},onMatchAndReverse(e){t(Bo(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds))},onUpdateActualMatchingUIState(e){t(Oo(e))},onSaveSchedule(e,a){const i=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:d,allDepreciationAccountList:v}=l.jeSchedules,P=a.selectedAccount!=null?d.find((M=>M.qboId===a.selectedAccount)):void 0,D=a.selectedAccumulatedDepreciationCategory!=null?v.find((M=>M.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(ga({scheduleType:i,localData:{...a,selectedAccount:P?.accountId,selectedAccumulatedDepreciationCategory:D?.accountId}})),t(Uo({scheduleType:i}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Ro()),t(Do()),t(Fo({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(_o({scheduleType:a})),t(Mo(a,void 0))},onCreateOneTimeAccrual(e){t(wo(e))},handleJeScheduleClick:(e,a,i)=>{if((function(v,P){return P!=="accrued_expenses"})(0,i)&&t(Ma({selectedJEScheduleKey:a})),p!=null&&Ka(i))return void p(e,i,a);const d=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/${i}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,i,d)=>{t(a!=="revert"?xo(e,i,d):Ao(e,i,d))},onOneTimeAccrualClick:e=>{if(p!=null)return void p(e,"one_time_accrual");const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},improveMonthEndInsightsUsingZeniGPTClick:e=>{S!=null&&t(Eo(e,S.companyId,S.tenantId))},onClickCustomerRequest:g,setActivityLogTransactionId:C,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(vo())},onOpenFileAttachmentSnackBar:()=>{t(bt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(yo(e))},onUpdateFileAttachment:e=>{t(Po({files:e}))},previewMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(Sa(e,S.companyId,a,!0,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},saveMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(Sa(e,S.companyId,a,!1,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:i,auditSummary:d}=l;S!=null&&d?.auditScorePercentage!=null&&(t(bo(S.companyId,e,S.tenantId)),Q.trackInsightsEmailPage(i.month,i.year,!1,"draft",d.auditScorePercentage,To().format(Xa.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const i=l.transactionView.uiState.searchString??"",d=l.transactionView.transactions,v=d.findIndex((M=>M.id===e)),P=i.length>0?{resultPosition:v>=0?v+1:void 0,resultsCount:d.length,searchTerm:i}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,P);const D=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:D,message:"expenseAutomation",origin:"transaction_categorization",searchContext:P}})},setLocalDataForCategoryAndClass:(e,a,i,d,v,P,D,M,W,Y,se,ce)=>{t(ko(e,a,i,d,x,v,P,D,M,W,Y,se,ce))},onCancelAutoComplete:()=>{t(Ke("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(pa({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(pe(e,{start:J,end:N},!1,!1)),t(Io(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(fo(e)),t(pe("autoCategorized",{start:J,end:N},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(Co(e)),t(pe(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:J,end:N},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a})),N!=null&&J!=null&&t(pe(e,{start:J,end:N},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,i,d,v,P)=>{N!=null&&J!=null&&t(pe(e,{start:J,end:N},!0,i,a,d,v,P))},resetTransactionCategorizationLocalData:(e,a,i,d,v,P,D)=>{t(go(e,a,i,d,D??null,v,P,!1)),ai(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,i,d,v)=>{t(ha({selectedTab:e,transactionId:a,lineId:i,selectedTransaction:d,uncategorizedAccounts:x,updatedVendor:v,isAccountingClassesEnabled:I}))},onSaveUpdateTransactionCategorization:(e,a,i)=>{const d=r.state?.referrer;e==="autoCategorized"?Q.trackTransactionsAutoCategorisedPage(h.month,h.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,d??null):Q.trackTransactionsReviewPage(h.month,h.year,l.transactionView.totalCountByTab.review,a.length,!1,d??null),t(So(e,a,i)),ti(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(ho({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&t(mo({transactionId:D,customerUpdates:P})),t(po({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedCustomer:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))},onFetchRecommendationsForEntityCategorization:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&(t(lo({transactionId:D,vendorUpdates:{name:P.name,id:P.id?P.id:void 0}})),t(ro({vendorId:P.id?P.id:void 0,localData:{vendorName:P.name,vendorId:P.id?P.id:void 0}}))),P?.id?(t(ha({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedVendor:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))):t(uo({selectedTab:d,transactionId:D.id,lineId:W[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(Ze(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(Ze(h,!0,!1,null,!1,!1))},markAsReview:(e,a,i,d)=>{Q.trackFluxAnalysisReviewed(i.month,i.year,d??!1,e),t(io(a,e,i,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(co(e))},updateOperatingExpensesIdsForReview:e=>{t(oo({operatingExpenseIds:e,selectedPeriod:h}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=mi(e.id,e.qboId,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(so({sectionId:e,selectedPeriod:h}))},onFetchReimbursementView:(e,a,i)=>{t(Ze(e,!0,!1,a,!0,i))},onReviewClicked:e=>{t(re(h,e))},setOpenDrawerClicked:e=>{t(tt({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Da("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const i=S?.companyId;i!=null&&(t(Fa(e,i,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(_a({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(tt({selectedDrawerAccountId:e})),t(Xe({accountId:e,selectedPeriod:h,localData:{accountSource:"bank_statement"}})),t(Qe({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(re(h,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(no({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(ao({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(to({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{n.closeSidePanel?.(),t(eo({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,i)=>{const d=e.vendor?.id;i&&d!=null&&t(Qs(d)),t(Zs({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,Tt("bill"));const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{m(-1)},onReconListPageScroll:e=>{t(pa({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ma({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Xs({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(wa({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Ra({accountId:e}))}}}),((t,n,f)=>{const{isMissingReceiptsBulkUploadEnabled:I,...k}=f;return(function(o,r,E){return{...o,...r,...E,onUploadTransactionReceipt:(l,S,R,x,m)=>{r.onUploadTransactionReceipt(l,S,R,x,m,o.authParams)}}})(t,n,k)}))(Yc(Hc)),It="newScheduleMode",kt="newScheduleType",Mi=Ei(ci((function(t){const n=t.displayName??t.name??"Component",f=La.memo(t),I=k=>{const o=he(),r=(function(){const p=he(),C=_((h=>Me(h).reconciliation.selectedDrawerAccountId));return{isOpen:C!=null,selectedAccountId:C,openPanel:s.useCallback((h=>{p(tt({selectedDrawerAccountId:h}))}),[p]),closePanel:s.useCallback((()=>{p(tt({selectedDrawerAccountId:void 0}))}),[p])}})(),E=_((p=>Me(p).reconciliation)),l=_((p=>ke(p))),S=s.useCallback(((p,C)=>{o(Da("expense_automation_reconcile",p,C))}),[o]),R=s.useCallback(((p,C)=>{const h=l?.companyId;h!=null&&(o(Fa(p,h,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",C)),o(_a({accountId:C,connectionInProgress:!0})))}),[o,l?.companyId]),x=s.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return b.jsx(ki,{reconciliation:E,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:S,onEstablishConnectionClick:R})}),[r.isOpen,r.selectedAccountId,r.closePanel,E,S,R]),m=s.useMemo((()=>({reconPanelContent:x,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[x,r.isOpen,r.closePanel]),{useFeatureGate:g}=Be(),{isFeatureEnabled:u}=g(H.isReconV3Enabled),F=s.useContext(ba),A=s.useMemo((()=>r.isOpen?u===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:F),[r.isOpen,r.closePanel,r.selectedAccountId,F,u]);return b.jsx(ba.Provider,{value:A,children:b.jsx(f,{...k,...m})})};return I.displayName=`withReconSidePanel(${n})`,I})(Ii((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:f,matchPanelContent:I,isMatchPanelOpen:k,openMatchPanel:o,openTransactionPanel:r,panelContent:E,reconPanelContent:l,reconSidePanelIsOpen:S,isSchedulePanelOpen:R,closeSchedulePanel:x,openSchedulePanel:m,schedulePanelContent:g,schedulePendingDiscardConfirmation:u,sidePanelIsFullView:F,sidePanelIsOpen:A})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:C}=Mc(),h=Uc(),{isOpen:L}=Oc(),G=nt(),q=be(),T=he(),{isAiCfoAccessEnabled:J,onAskAiCfoClick:N}=qa({mobileExploreReferrer:"Transaction categorization"}),e=s.useCallback((()=>{k===!0&&t?.(),A===!0&&F!==!0&&f?.()}),[t,f,k,F,A]),a=_(xs);s.useEffect((()=>{a===!0&&(e(),T(ws()))}),[a,e,T]);const{areTenantIdsInSync:i}=za(),d=wi(),v=Bc(),[P,D]=s.useState(!1),[M,W]=Yn(),Y=s.useCallback((c=>{W((w=>{const $=new URLSearchParams(w);return c==null?($.delete(It),$.delete(kt),$):($.set(It,c.scheduleDetailsMode),$.set(kt,c.scheduleType),$)}),{replace:!0})}),[W]),[se,ce]=s.useState(void 0),Pe=s.useCallback(((c,w,$)=>{const j=yt(c);ce(j),Y({scheduleDetailsMode:w,scheduleType:c}),T(ra({scheduleType:j==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:$}))}),[T,Y]),ye=s.useMemo((()=>{const c=M.get(It),w=M.get(kt);return c!=null&&w!=null?{scheduleDetailsMode:c,scheduleType:w}:void 0}),[M]),ve=s.useCallback((c=>{Y(c),c!=null&&T(ra({scheduleType:yt(c.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[T,Y]),K=_((c=>la(c))),B=_((c=>ke(c))),[Ve,Ee]=s.useState(!1),[ot,Se]=s.useState(!1),[je,y]=s.useState([]),[z,X]=s.useState(null),Z=s.useCallback((()=>{X(null)}),[]),ge=z?.contentType==="activity"?z.detail.transactionId:void 0,ct=s.useCallback((c=>{c!=null?(p&&C(!1),h(),e(),X({contentType:"activity",detail:{transactionId:c}})):X((w=>w?.contentType==="activity"?null:w))}),[e,p,h,C]),Qa=s.useCallback((c=>{p&&C(!1),h(),e(),X({contentType:"transfer",detail:c})}),[e,p,h,C]),Za=s.useCallback((()=>{h(),Z(),e(),N()}),[e,Z,N,h]),vt=s.useRef(p);s.useEffect((()=>{p===!0&&vt.current===!1&&(h(),Z(),e()),vt.current=p}),[e,Z,p,h]);const Et=s.useRef(L);s.useEffect((()=>{L===!0&&Et.current===!1&&(p&&C(!1),Z(),k===!0&&t?.(),A===!0&&F!==!0&&f?.()),Et.current=L}),[Z,t,f,L,p,k,C,F,A]);const Le=A===!0&&F!==!0||k===!0,At=s.useRef(Le);s.useEffect((()=>{Le&&!At.current&&(p&&C(!1),h(),Z()),At.current=Le}),[Z,p,Le,h,C]);const[xt,en]=s.useState(!1),wt=s.useRef(!1),{selectedTab:tn}=Oe(),{tenantEmailDomain:it}=Oe(),[lt,Rt]=s.useState(q.state?.message==="comingFromTransactionDetail"),Dt=q.state?.message==="comingFromOverview",an=Vc(),rt=st.getSignedInUser(),{useFeatureGate:oe}=Be(),{isFeatureEnabled:Ft}=oe(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:Ae}=oe(H.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:dt}=oe(H.isTransactionActivityEnabled),{isFeatureEnabled:_t}=oe(H.isAccrualEnabled),nn=Ga(),de=_t===!0&&nn===!0,{isFeatureEnabled:Mt}=oe(H.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:sn}=oe(H.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:on}=oe(H.isProjectsTransactionsEnabled),{isFeatureEnabled:cn}=oe(H.isReconV3Enabled),ln=s.useCallback((c=>{const w=Tt(c.transactionType??(c.view==="reconciliation"?"bill":"expense")),$=te(q.state?.pathnameStackToGoBack,q.pathname),j=new URLSearchParams({view:"full"});c.threadId!=null&&j.set("thread_id",c.threadId),c.entityType!=null&&j.set("entity_type",c.entityType),G(`/${it}/transaction/${encodeURIComponent(w)}/${c.transactionId??c.entityId}?${j.toString()}`,{state:{pathnameStackToGoBack:$,message:"expenseAutomation"}})}),[G,it,q.state,q.pathname]),rn=_((c=>Rs(c,"common"))),V=_((c=>Me(c))),{categoryOptions:dn,paymentAccountNames:un}=_((c=>Ds(c.accountState))),mn=_((c=>Fs(c.classState))),{monthEndCloseChecksView:ee,currentSelectedView:U,selectedPeriod:O,selectedTransactionCategorizationTab:ut,currentSelectedViewBackgroundRefreshFetchState:pn,currentSelectedViewFetchState:ie,jeSchedules:mt,reconciliation:Ut}=V;Xc(U==="transaction_categorization");const hn=V.transactionView.saveStatus.fetchState,ze=V.transactionView.transactions,Ot=s.useRef(ze);Ot.current=ze;const Bt=_((c=>c.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Vt=_((c=>c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),jt=s.useRef(Bt);jt.current=Bt;const Lt=s.useRef(Vt);Lt.current=Vt;const $e=_((c=>{const w=c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return w!=null?c.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[w]?.filters:void 0})),zt=s.useRef("");s.useEffect((()=>{if(U!=="transaction_categorization")return;const c=V.transactionView.uiState.searchString??"";if(ie.fetchState!=="Completed"||c.length===0||c===zt.current)return;zt.current=c;const w=$e!=null?jc($e):0,$=$e?.categories.filter((j=>j.values.length>0&&String(j.values[0]??"").trim()!=="")).map((j=>`${j.field}:${j.values.join(",")}`))??[];Q.trackAiCloseTransactionSearch({filtersApplied:$,hasResults:ze.length>0,isFiltered:w>0,resultsCount:ze.length,searchTerm:c,searchType:"free_text"})}),[U,ie.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,$e]);const le=Qc(hn,(()=>{const c=[],w=Lt.current,$=jt.current,j=$!=null&&w!=null?$[w]:void 0;if(j?.transactionReviewLocalDataById!=null)for(const fe of Object.values(j.transactionReviewLocalDataById)){const ae=fe?.transactionReviewLocalData?.lineItemById;if(ae!=null)for(const pt of Object.values(ae)){const Fe=pt?.account;Fe?.accountId!=null&&c.push(Fe.accountId)}}const Ce=Ot.current;for(const fe of Ce)for(const ae of fe.lines??[])"account"in ae&&ae.account?.accountId!=null&&c.push(ae.account.accountId);return c}));s.useEffect((()=>{U==="transaction_categorization"&&A!==!0||ct(void 0)}),[U,ct,A]),s.useEffect((()=>{S===!0&&n?.()}),[U,Ut.selectedAccountId]);const Sn=V.transactionView.selectedTransactionCategorizationCompletedSubTab,gn=V.transactionView.selectedTransactionGroup,Ge=`${ut}|${Sn}|${gn}`,Ne=s.useRef(null),$t=s.useRef(null);s.useEffect((()=>{Ne.current!==null?Ne.current!==Ge&&(Ne.current=Ge,U==="transaction_categorization"&&Z()):Ne.current=Ge}),[Z,U,Ge]);const Cn=_((c=>ge==null?void 0:_s(c.transactionState,ge))),ue=Cn?.qboId,Gt=_((c=>ue==null?void 0:Ms(c,ue)));s.useEffect((()=>{ue!=null&&T(Us(ue))}),[T,ue]);const{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transferAccounts:Jt}=V.transactionView,Wt=s.useCallback((c=>Zc(T,c)),[T]),Yt=s.useMemo((()=>U!=="transaction_categorization"||z==null?null:z.contentType==="activity"?dt===!0?b.jsx(Lc,{activityLogView:Gt,qboId:ue,onClose:()=>X(null),selectedTransactionId:z.detail.transactionId,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null:z.contentType==="transfer"?b.jsx(zc,{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transaction:z.detail,transferAccounts:Jt,onClose:()=>X(null),onCreateTransfer:Wt,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null),[U,z,dt,Gt,ue,Nt,qt,Jt,Wt]),fn=Yt!=null,{selectedAccountId:xe}=Ut,Ht=et(mt.accountSettingsView.saveState.fetchState),In=_((c=>Os(c.accountState,c.accountListState,"accountList"))),kn=_((c=>Bs(c))),we=Wa(tn)??U,bn=_((c=>c.entityAutoCompleteState.autoCompleteText.common));if($a({isDataReady:ie.fetchState==="Completed"}),rt==null)throw Error("Can't access expense automation screen without signing in...");const Kt=Ua(O),Re=at(Kt.start),De=at(Kt.end);if(Re==null||De==null)throw Error(`Invalid start - ${Re} and end - ${De} period from given ${O}`);const Tn=s.useCallback((()=>{Ee(!1)}),[]),Pn=s.useCallback((()=>{Se(!0)}),[]),yn=s.useCallback((c=>{y(c),Se(!1)}),[]),vn=s.useCallback((()=>{y([])}),[]),qe=V.missingReceipts.bulkUpload.phase,Xt=V.missingReceipts.bulkUpload.currentBatchId;s.useEffect((()=>{Ae===!0&&U==="missing_receipts"&&qe==="matching"&&Xt!=null&&T(Oa({cacheOverride:!0}))}),[Ae,U,qe,Xt,T]);const Qt=rt?.userId,En=O.month,An=O.year,Zt=B?.tenantId;s.useEffect((()=>{U==="missing_receipts"&&Ae!==!1&&qe==="idle"&&Qt!=null&&Zt!=null&&T(Vs())}),[U,Ae,qe,Qt,Zt,En,An,T]),s.useEffect((()=>{K.newVendorState?.vendorDetailLocalData?.vendorName!=null?D(!0):D(!1)}),[K.newVendorState?.vendorDetailLocalData?.vendorName]),s.useEffect((()=>{we!=null&&U!==we&&T(Ba(we))}),[we]),s.useEffect((()=>{xt===!1&&ie.fetchState==="Completed"&&i&&(en(!0),T(da(!1,!1,de)))}),[xt,ie,i,de]),s.useEffect((()=>{const c={month:O.month,year:O.year},w=$t.current;$t.current=c,w===null||w.month===c.month&&w.year===c.year||!Dt&&i&&(T(da(!1,!1,de)),T(re(O,xe,!1,!1)))}),[O.month,O.year,i,de]);const Je=s.useCallback(((c=!1,w=!1)=>{const $={start:Re,end:De};switch(U){case"transaction_categorization":T(pe(ut,$,c,!lt,void 0,void 0,w)),Rt(!1);break;case"flux_analysis":T(Ze(O,c,w,null));break;case"month_end_insights":if(w===!1){const j=new Date(O.year,O.month,0),Ce=Ls(j.toDateString()).format(Xa.analytics.YYYYDashMMDashDDFormat);T(zs(!0,B.companyId,B.tenantId,Ce)),T($s(B.companyId,B.tenantId))}break;case"je_schedules":T(js($,w,de));break;case"missing_receipts":T(Va($,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,w));break;default:T(re(O,xe,c,w))}}),[U,Re,De,B.companyId,B.tenantId,ut,O,xe,lt,Rt,de]),xn=s.useCallback((()=>{Je(!0,!0)}),[Je]);s.useEffect((()=>{U===we&&ie.fetchState==="Not-Started"&&i&&Je(!0)}),[ie,Re,De,B.companyId,B.tenantId,i]),s.useEffect((()=>{Dt||lt||wt.current||pn.fetchState==="In-Progress"||ie.fetchState!=="Completed"||(wt.current=!0,Je(!0,!0))}),[]),s.useEffect((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState!=="Completed"&&ee.fetchState!=="Error"&&B?.tenantId!=null&&T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!1}))}),[ee.fetchState,B?.tenantId]),s.useEffect((()=>{ee.fetchState!=="Completed"||!i||(ee.monthEndCloseChecks?.monthEndCloseCheckList.some((c=>c.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&T(re(O,void 0,!1,!1))}),[ee.fetchState,i,O.month,O.year,V.reconciliation.fetchStatus.fetchState,T]),s.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?Ee(!0):Ee(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),s.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&i&&(T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!0})),T(Gs({companyId:B.companyId})),G("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,B.tenantId,O,B.companyId,i]),s.useEffect((()=>{const c=setInterval((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState==="Completed"&&T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(c)}),[ee.fetchState,B.tenantId,O,T]),s.useEffect((()=>{const c=setInterval((()=>{U==="reconciliation"&&xe==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&T(re(O,void 0,!0,!0))}),3e5);return()=>clearInterval(c)}),[U,T,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,re,xe,O]);const wn=Pa(),{isFeatureEnabled:Rn}=oe(H.isRecommendationFeedbackEnabled),ea=$c(),{onRecommendationSelection:ta,popup:Dn}=ei({isEnabled:Rn}),Fn=s.useMemo((()=>({...ea,onRecommendationSelection:ta})),[ea,ta]);s.useEffect((()=>{const c=(ee.monthEndCloseChecks?.monthEndCloseCheckList.find((w=>w.id==="month_end_insights"))?.isDisabled??!1)&&!Ft;U!=="month_end_insights"||!c&&ee.monthEndCloseChecks?.reportEmailSentDate==null||G("../")}),[U,ee.monthEndCloseChecks]);const _n=S===!0?l:E,Mn=S===!0||A===!0,Un=S===!0?n:f,On=S!==!0&&F;s.useEffect((()=>{Ht==="In-Progress"&&mt.accountSettingsView.saveState.fetchState==="Completed"&&T(ua())}),[Ht,mt.accountSettingsView.saveState.fetchState,ua]);const{transactionId:aa,onSaveVendor:Bn,onSaveSuccess:Vn,onCancel:jn,vendorViewDetails:Ln}=(({expenseAutomationViewSelector:c,closeDrawerHandler:w,currentSelectedView:$})=>{const j=he();let Ce,fe,ae;const pt=Pa(),Fe=c.transactionView;let na=()=>{};const{transactions:zn,selectedTransactionId:Ie,selectedTransactionLineId:We,transactionLocalData:$n}=Fe;if($==="transaction_categorization"){const ht=$n.find((me=>me.transactionId===Ie)),ne=zn.find((me=>me.id===Ie)),sa=We!=null?ht?.transactionReviewLocalData?.lineItemById[We]:void 0,oa=sa?.account;fe=sa?.class?.classId,Ce=["Uncategorized Income","Uncategorized Expense"].includes(oa?.accountName??"")?void 0:oa?.accountId;const Nn=ui(Ie,ne?.typeOfTransaction);ne!=null&&Nn&&(ae={id:Ie,type:Tt(ne.typeOfTransaction)}),na=()=>{if(Ie!=null&&We!=null&&ne!=null){const me=Fe.transactionLocalData.find((Ye=>Ye.transactionId===Ie))?.transactionReviewLocalData;if(me!=null&&ne.lines!=null&&ne.lines.length>0){const Ye=me.lineItemById[We];let St=me.selectedEntity;if(As(ne)||(St=Ye.selectedEntityLine),St!=null){const qn=St,Jn={transactionId:{id:ne.id,type:ne.type},transaction:ne,lineIds:ne.lines.map((Wn=>Wn.id))??[]};j(Pt({entity:qn,amount:Ye.amount.amount,transactionDetails:Jn,flowType:"categorization",selectedTab:c.selectedTransactionCategorizationTab,isFetchCOT:pt}))}}}}}const Gn=_((ht=>la(ht,void 0,Ce,fe)));return{transactionId:ae,onSaveVendor:()=>{j(Es(ae,void 0,!1,!0))},onSaveSuccess:na,onCancel:()=>{ae!=null&&j(Ps({transactionId:ae})),j(ys()),j(vs()),w()},vendorViewDetails:Gn}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{D(!1)},currentSelectedView:U});return an?.loggedInUserRoleMap==null?ee.fetchState==="Error"?b.jsx(Gc,{onGoHome:()=>G("../",{replace:!0}),onReload:()=>window.location.reload()}):b.jsx(Na,{fetchState:"In-Progress"}):b.jsxs(b.Fragment,{children:[b.jsx(hi,{isOpen:ot,drawerLeftMargin:new Nc(0,0,300,650),onClose:()=>{Se(!1)},children:b.jsx(Ui,{onClick:c=>c.stopPropagation(),children:b.jsx(Ai,{companyId:B.companyId,closeCustomerRequestDrawer:()=>Se(!1),addCustomerRequest:yn,resetCustomerRequest:vn})})}),aa!=null&&P&&b.jsx(ni,{isOpen:P,transactionId:aa,onSaveVendor:Bn,onSaveSuccess:Vn,onCancel:jn,vendorViewDetails:Ln}),b.jsx(qc,{toolkit:Fn,children:b.jsx(_i,{events:[],eventCallback:(c,w,$)=>{},navigate:G,location:q,themeState:v,categoryOptions:dn,classesForFilters:mn,accountsForFilters:un,vendorSearchAutoCompleteData:{autoCompleteText:bn,entityAutoCompleteView:rn},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:Ae,monthEndInsightsPreviewMode:Ve,monthEndInsightsCustomerRequestData:je,isRealtimeInsightsFeatureEnabled:Ft,isCreateTransferEntryFromExpenseEnabled:Mt,isAccountingClassesEnabled:kn,isProjectsTransactionsEnabled:on,isCOTEnabled:wn,currentTenant:B,companyId:B.companyId,signedInUser:rt,isTransactionActivityEnabled:dt,isRightPanelOpen:fn,rightSidePanel:Yt,onOpenTransferRightPanel:Mt===!0?Qa:void 0,uncategorizedAccounts:In,newScheduleActiveType:se,isAccrualEnabled:_t,isActualMatchingEnabled:de,newScheduleSelection:ye,onNewScheduleSelectionChange:ve,onScheduleTypeChange:Pe,onNewScheduleSaved:xn,onClickCustomerRequest:Pn,handleEditClick:Tn,tenantEmailDomain:it,trackExpenseAutomationTabAnalytics:d,setActivityLogTransactionId:ct,closeMatchSidePanel:t,closeSidePanel:Un,openTransactionPanel:r,closeSchedulePanel:x,openSchedulePanel:m,openMatchPanel:o,sidePanelIsOpen:Mn,sidePanelIsFullView:On,panelContent:_n,isAiCfoAccessEnabled:J,onAskAiCfoClick:Za,isExpenseAutomationCommentingEnabled:sn,isReconV3Enabled:cn,onExpenseAutomationCommentingThreadClick:ln,sidePanelListPercent:S===!0?66:void 0,isMatchPanelOpen:k,isSchedulePanelOpen:R,matchPanelContent:I,schedulePanelContent:g,schedulePendingDiscardConfirmation:u})}),Dn,le.showPopup&&le.popupType!=null&&b.jsx(Jc,{popupType:le.popupType,currencySymbol:le.currencySymbol,accountId:le.popupAccountId??"",accountName:le.popupAccountName??"",onSubmit:le.handleSubmit,onDismiss:le.handleDismiss})]})}))))),Ui=Te(vc)`
35
- display: flex;
36
- min-height: 100%;
37
- flex-direction: column;
38
- `;function Oi(){const t=be(),{selectedTab:n,tenantEmailDomain:f}=Oe(),I=_((r=>ke(r))),k=_((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[I.tenantId]));if(Wa(n)==null)return b.jsx(ja,{});const o=Ja({tenantEmailDomain:f,selectedTab:n,selectedPeriod:k!=null?`${k.month}-${k.year}`:void 0});return o==null?null:b.jsx(Xn,{to:o,replace:!0,state:t.state})}function ml(){return b.jsxs(Kn,{children:[b.jsx(He,{index:!0,element:b.jsx(Si,{})}),b.jsx(He,{path:"/:selectedTab/:selectedPeriod/*",element:b.jsx(Mi,{})}),b.jsx(He,{path:"/:selectedTab",element:b.jsx(Oi,{})}),b.jsx(He,{path:"*",element:b.jsx(ja,{})})]})}export{ml as default};
@@ -1,2 +0,0 @@
1
- import{j as a}from"./liveblocks-BjcYyeQ6.js";import{a as r}from"./sentry-DZ9rNYfw.js";import{u as L,h as A,i as R,j as C,t as G,l as O,s as H,g as Z,N as B,n as ie,o as x}from"./core-B-8b0iz9.js";import{a9 as nt,k as S,ar as _,V as m,cd as tt,ce as it,cf as ot,cg as at,ch as st,ci as ct,cj as rt,ck as lt,cl as dt,cm as ut,cn as gt,co as mt,p as W,cp as vt,cq as pt,af as se,cr as St,cs as ft,z as ye,ct as ht,cu as It,cv as Ct,cw as Et,cx as kt,cy as yt,cz as xt,cA as bt,K as jt,aj as dn,cB as Dt,cC as Lt,cD as At,cE as Pt,cF as $t,cG as Ft,cH as wt,cI as Rt,cJ as _t,cK as Tt,cL as Ot,t as He,j as Pe,cM as Mt,cN as Nt,cO as Ut,cP as Bt,cQ as Vt,cR as Ht,cS as qt}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import{A as Q}from"./AddressScreen-DyDl-tRh.js";import M from"./NotFoundScreen-BPIsWBDH.js";import{ZQ as zt,ZR as Qt,vp as qe,ZS as K,vS as ce,ZT as $e,ZU as re,wt as xe,wA as Kt,wF as un,ZV as Fe,wx as gn,y7 as ze,vR as Qe,ZW as Gt,ZX as mn,wQ as be,ZY as le,wU as Zt,ZZ as Wt,Z_ as vn,wX as pn,z2 as Xt,Z$ as pe,_0 as Ke,_1 as Sn,vP as Jt,_2 as Yt,vJ as ei,_3 as ni,yk as ti,_4 as fn,yt as Ge,_5 as ii,yq as oi,_6 as we,gh as ai,_7 as ne,_8 as te,xa as si,vX as Ze,w0 as hn,v_ as ci,vU as ri,x3 as li,w2 as di,xc as ui,_9 as je,xl as In,xj as X,xh as de,xg as gi,_a as Cn,yz as We,_b as mi,vQ as En,_c as Re,wb as De,w8 as Le,wl as kn,wk as _e,w5 as vi,we as yn,wn as oe,fF as Te,VC as xn,vT as Oe,wi as pi,wj as Si,wh as fi,_d as hi,wV as Ii,wR as bn,_e as jn,vD as Xe,_f as Ci,vz as Ei,_g as ki,yF as yi,yJ as q,yE as xi,xN as Se,_h as bi,_i as Dn,yS as Je,_j as ji,yP as Di,_k as Ln,xQ as Li,xR as V,xU as Ai,_l as An,y2 as Ce,_m as Pi,xb as Pn,U8 as $n,_n as $i,yc as Fi,_o as Fn,_p as wi,_q as Ri,_r as _i,zH as Ti,_s as Oi,_t as wn,yZ as Rn,_u as _n,zF as Ee,_v as Mi,zC as Ni,_w as Ui,_x as Bi,_y as Vi,_z as Hi,_A as qi,_B as Ye,_C as zi,eg as Qi,zL as Ki,_D as Me,xv as Gi,xq as Zi,_E as ue,xG as Tn,xy as ge,xx as Wi,xB as On,_F as Xi,xw as Ji,_G as Mn,z3 as Nn,zu as en,zp as Yi,_H as eo,z4 as no,_I as to,zv as io,zz as oo,_J as Ne,wv as Un,zg as ao,ww as so,_K as co,_L as Bn,c8 as ro,ms as lo,mt as uo,_M as nn,wu as me,gl as go,mz as mo,zm as Vn,zX as vo,zj as Hn,uX as po,zU as tn,uL as So,zR as on,hS as fo,UB as an,UC as ho,Gh as qn,hK as Io,_N as Co,Vr as Eo,_O as ko,A0 as ke,A1 as yo,_P as xo,_Q as zn,z_ as bo,_R as jo,_S as Do,yg as Lo,_T as Ao}from"./zeni-epic-state-95zxmizy.js";import{M as Po}from"./MobileAppDrawer-CHFdUHPo.js";import{q as ve}from"./QBOConnectionScreen-DYxxHcdI.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-C6qhVozS.js";import"./empty-CyiOIGJw.js";import"./pdf-lib-D8o-uP9K.js";import"./index-CgYr_9vs.js";import"./url-BjdrSaU1.js";import"./index-CzpjeHcU.js";import"./decodeURIComponentSafe-hAviH84T.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e6c826c0-a044-4093-86f3-4705657846f0",t._sentryDebugIdIdentifier="sentry-dbid-e6c826c0-a044-4093-86f3-4705657846f0")}catch{}})();const $=({event:t,isReady:e=!0})=>e?a.jsx(nt,{analytics:S,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function $o(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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:g,hasMore:f,items:p,nextCursor:h,auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b}=C(zt),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${n??""}/invoicing`,I=r.useCallback(((P,U)=>{const T=Qt(y,P,U,D);T!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:P,entityId:U,fromScreen:"audit_log"}),e(T))}),[D,e,y]);r.useEffect((()=>{const P=setTimeout((()=>d(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,t]);const j=g==="Not-Started"||g==="In-Progress"&&p.length===0,E=g==="In-Progress"&&p.length>0,F=g==="Completed";return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:F}),a.jsx(tt,{auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b,entries:p,hasMore:f,isLoading:j,isLoadingMore:E,searchValue:s,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{f&&h!=null&&t(qe({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function fe(t,e=!1){const n=L(),i=C((c=>K(c).productNextCursor!=null)),s=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&s!=null&&n(ce({cursor:s,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,s])}function J(t,e,n,i){const[s,o]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),o((v=>v+1)))}),[c,e]),s}const Fo=new Set(["plan"]),wo=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?s=>{i!==""&&t(gn({action:s,id:i}))}:void 0,onEditChange:s=>{i!==""&&t(Fe({id:i,localData:s}))},onSaveEdit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(un({id:i}))},onSubFamilyLifecycleAction:(s,o)=>{i!==""&&t(Kt({action:o,id:s,parentItemId:i}))}}}))(it);function Ro(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=(d=s.get("kind"))!=null&&Fo.has(d)?d:"plan";var d;const l=C((k=>$e(k,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(re({id:n})),()=>{t(re({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:c}))}),[o,n,c,t]);const g=r.useCallback((k=>t(xe({cacheOverride:!0,id:k,kind:c}))),[t,c]),f=J(l.fetchState,l.isFormLoading,n,g),p=u==="Completed"&&!l.isFormLoading;fe(o,!0);const[h,D]=r.useState(p?n:void 0);r.useEffect((()=>{n!=null&&p&&D(n)}),[n,p]);const b=h!==n&&(u==="Not-Started"||u==="In-Progress"||l.isFormLoading);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:p}),a.jsx(wo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:b,view:l},f)]})}const _o=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=$e(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:s}=e,o=s!=null?`${n}/catalog/${encodeURIComponent(s)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(re({id:s})),e.navigate(`${n}/catalog`)},onChange:c=>{t(Fe({id:s,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(un({id:s}))}}}))(ot);function Mo(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=n!=null,d=s.get("type"),l=d!=null&&_o.has(d)?d:void 0,v=(u=s.get("kind"))!=null&&To.has(u)?u:"plan";var u;const g=C((f=>$e(f,n)));return fe(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:v}))}),[o,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(Fe({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const f=g.savedItemId??n,p=f!=null?`/${i}/invoicing/catalog/${encodeURIComponent(f)}`:`/${i}/invoicing/catalog`;e(p),t(re({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),a.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",s=e.activeTab==="all",o=i?n.plans:s?[...n.plans,...n.products]:n.products,c=i||s&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:s&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",s=e.activeTab==="all",o=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:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=No[e.activeTab];S.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(gn({action:Gt(d),id:c}))},onLoadMore:()=>{if(s)return e.planNextCursor!=null&&t(Qe({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Qe({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(at);function Bo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),f=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),p=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:p,type:"plan"})),[p]),D=r.useMemo((()=>({search:p,type:"addon|charge"})),[p]),b=C((P=>K(P))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",F=b.runningActionId??null;return r.useEffect((()=>{const P=setTimeout((()=>v(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[i,t,h,D,f]),r.useEffect((()=>{i&&(p!==k||f?.field!==y?.field||f?.dir!==y?.dir)&&t(ze({cacheOverride:!0,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[k,y,i,t,h,D,p,f]),N(b.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),a.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:s,sortState:u,planFilters:h,productFilters:D,sort:f,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:F,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Vo=O((function(t,e){const n=mn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(le({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(Wt({id:i,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:s}),t(Zt({id:i}))}}}))(st);function Ho(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,savedCouponId:c}=C((d=>mn(d,n)));return r.useEffect((()=>{s&&t(be({id:n}))}),[s,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(le({id:n}))}}),[o,c,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCouponFormPage}),a.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=vn(t);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(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:s=>{e(Sn(s))},onSubmit:()=>{const s=Yt(t.localData);S.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:s.customer_id,lineItemCount:s.line_items?.length}),e(ei(s))}}}))(rt);function zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),[i]=G(),{areTenantIdsInSync:s}=_(),o=i.get("customerId"),c=C((I=>vn(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(pn),g=C((I=>Xt(I))),f=C(pe),p=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,D=p||h,b=g.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(t(Ke()),()=>{t(Ke())})),[t]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,t(Sn({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{s&&t(Jt({cacheOverride:!1}))}),[s,t]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(j)}}),[d,v,e,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),D?a.jsx(ct,{}):a.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(lt);function Ko(){const t=L(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>ni(d,n??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&n!=null&&t(ti({id:n}))}),[s,n,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),a.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=fn(t),{fetchState:n}=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:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(dt);function Zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,creditNoteListFetchState:b}=C((y=>{const I=fn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Ge({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ge({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),a.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ii(y)),onSortChange:v})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:s=>{t(je({id:i,localData:s}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(X(de)),t(gi({id:i}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",de,i),o=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(je({id:i,localData:s})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:s=>t(ui({cacheOverride:s,customerId:i})),onSendPaymentLink:(s,o,c)=>t(di({body:c,customerId:i,email:s,subject:o})),onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)}}}))(mt);function Xo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((T=>we(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[v,u]=r.useState(!1),[g,f]=r.useState(!1),[p,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const D=p===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const T=c.record.sendLinkState.fetchState;E.current!=="Error"&&T==="Error"&&t(ai({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=T}),[t,c.record.sendLinkState.fetchState]);const F=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ne()),t(te()),()=>{t(ne()),t(te())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(si({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&j&&t(Ze({customerId:i}))}),[o,i,t,j]);const P=r.useCallback((T=>t(hn({id:T}))),[t]),U=J(c.fetchState,c.isFormLoading,i,P);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),a.jsx(Wo,{customerId:i??"",editView:c,hasLoadedRecord:D,location:n,navigate:e,tenantEmailDomain:s,onAddPaymentMethod:()=>{t(ne()),i!=null&&j&&t(Ze({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(te()),f(!0)}},U),a.jsx(ut,{errorMessage:F,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&t(ri({customerId:i}))},onClose:()=>{u(!1),t(ne())},onSavePaymentMethod:T=>{i!=null&&t(ci({customerId:i,data:T}))}}),a.jsx(gt,{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:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{f(!1),t(te())},onSubmit:({amount:T,description:ee})=>{i!=null&&t(li({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const Jo=O((function(t,e){const n=we(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(Cn({id:i})),t(X(de)),e.navigate(`${n}/customers`)},onChange:c=>{t(je({id:i,localData:c}))},onOpenAddress:()=>{const c=Qn(e.tenantEmailDomain??"",de,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:s}),t(In({id:i}))}}}))(vt);function Yo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),{fetchState:c,savedCustomerId:d}=C((l=>we(l,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${s}/invoicing/customers/${encodeURIComponent(l)}`:`/${s}/invoicing/customers`;e(v),t(Cn({id:i}))}}),[c,d,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerFormPage}),a.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:s})]})}const ea=O((function(t){const e=pe(t),{fetchState:n}=e;return{addressesById:t.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:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,s)=>{switch(s){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(En({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function na(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,customerListFetchState:b}=C((y=>{const I=pe(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(We({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),a.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(mi(y)),onSortChange:v})]})}const Ae=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{filters:n,sessionId:i,view:s}=e,o=i==null?void 0:s.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:n,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Ae(s,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:s,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Ae(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",f=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>s(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&t(Le({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&t(_e(o))},onRollback:f?()=>{o!=null&&t(kn(o))}:void 0}}))(St);function ia(){const t=L(),e=A(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),[o,c]=r.useState({}),d=C(Re),l=Ae(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{s&&n!=null&&t(De(n))}),[s,t,n]),r.useEffect((()=>{if(!s||n==null)return;const p=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(p)}),[s,t,o,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!s||n==null||!u)return;const p=setInterval((()=>{t(De(n)),t(Le({...o,sessionId:n}))}),3e3);return()=>clearInterval(p)}),[s,t,o,u,n]);const g=r.useMemo((()=>{if(n==null)return;const p=new URLSearchParams;o.moduleId!=null&&p.set("module_id",o.moduleId),o.level!=null&&p.set("level",o.level),o.outcome!=null&&p.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&p.set("search",o.search.trim());const h=p.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),f=v?.fetch.fetchState??"Not-Started";return N(f)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&f!=="Not-Started"}),a.jsx(ta,{downloadUrl:g,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Kn=t=>`invoicing_active_migration:${t}`,ae=(t,e)=>{if(t!=null&&t!=="")try{const n=Kn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:s,statusRows:o}=e.view;return{isLoading:!(s.fetchState!=="Not-Started"&&s.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,s=o=>{const c=o??null;t(oe(c)),ae(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),s(o)},onNewImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),s()},onRetrySession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(_e(o)),s(o)},onRollbackSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(ft);function aa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(Re);r.useEffect((()=>{i&&(t(vi()),t(yn()))}),[i,t]);const o=s.statusFetch.fetchState==="Completed"&&s.sessionsFetch.fetchState==="Completed";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),a.jsx(oa,{navigate:e,tenantEmailDomain:n,view:s})]})}const sa=O((function(t,e){const{activeId:n,integrationsView:i,settings:s,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:s?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:s?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:s}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{S.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(fi())},onGoToIntegrations:()=>{i(`/${s}/invoicing/settings`)},onGoToOverview:()=>i(`/${s}/invoicing/overview`),onRetry:()=>{n!=null&&t(_e(n))},onSaveLater:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(Si(n))},onUpload:o=>{S.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(pi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${s}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ht);function ca(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(pn),o=C(Te).companyId??ye.getSignedInUserTenant(n??"")?.companyId,c=C((p=>xn(p,o))),d=C(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((p=>p.id===v)):void 0;r.useEffect((()=>{i&&(t(Oe()),t(yn()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const p=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Kn(h))}catch{return null}})(n);p!=null&&t(oe(p))}),[l,t,n]),r.useEffect((()=>{ae(n,l)}),[l,n]);const g=u?.status,f=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!f)return;const p=setInterval((()=>{t(De(v))}),3e3);return()=>clearInterval(p)}),[i,v,f,t]),r.useEffect((()=>{g==="done"&&(t(oe(null)),ae(n,null))}),[t,g,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportMigratePage}),a.jsx(sa,{activeId:v,integrationsView:c,navigate:e,settings:s,tenantEmailDomain:n,view:d,onBack:()=>{t(oe(null)),ae(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ra=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:s=>{t(bn({action:s,id:i}))},onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(Ii({data:s,id:i}))}}}))(It);function la(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((h=>hi(h,n))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[n,t]),r.useEffect((()=>{s&&t(be({id:n}))}),[s,n,t]);const f=r.useCallback((h=>t(be({cacheOverride:!0,id:h}))),[t]),p=J(o.fetchState,o.isFormLoading,n,f);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),a.jsx(ra,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},p)]})}const da=O((function(t){const e=jn(t),{fetchState:n}=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:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,s)=>{t(bn({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Ei({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ct);function ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=jn(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),a.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>t(Ci(I)),onSortChange:v})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,s=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCancel:s?()=>t(q({action:"cancel",id:i})):void 0,onResolve:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:s?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(kt);function ma(){const t=L(),e=A(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((E=>ki(E,n??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[f,p]=r.useState(),[h,D]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),p(void 0),D(!1)}),[]),k=r.useCallback((()=>{if(n==null)return;t(yi({id:n})),v("idle"),g(!1);const E=o.emailPreview.preview;p(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),D(!0)}),[n,t,o.emailPreview.preview]),y=r.useCallback((E=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:E,id:n})))}),[n,t,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{s&&n!=null&&t(xi({id:n}))}),[s,n,t]),r.useEffect((()=>{s&&d!=null&&t(Se({invoiceId:d}))}),[s,d,t]),r.useEffect((()=>{v("idle"),g(!1),p(void 0),D(!1)}),[n]),r.useEffect((()=>{s||(v("idle"),g(!1),p(void 0),D(!1))}),[s]),r.useEffect((()=>{h&&f==null&&o.emailPreview.preview!=null&&p({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,f,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(n!=null&&t(bi({id:n})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,b,t,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),a.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:j,onSendEmail:k}),a.jsx(Et,{initialDraft:f,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const va=O((function(t){const e=Dn(t),{fetchState:n}=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:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${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(`${n}/data_import`),onDunningCaseClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{s!=="retry"&&s!=="resume"&&s!=="resolve"&&s!=="cancel"||t(q({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(yt);function pa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,dunningCaseListFetchState:b}=C((y=>{const I=Dn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),a.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ji(y)),onSortChange:v})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Ai({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
- `).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))}}}))(xt);function fa(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((p=>Ln(p,n??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;r.useEffect((()=>{s&&n!=null&&t(Li({invoiceId:n}))}),[s,n,t]);const g=r.useCallback((p=>t(Se({invoiceId:p}))),[t]),f=J(o.actionState.fetchState,o.fetchState==="In-Progress",n,g);return N(c)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o},f)]})}const ha=O((function(t){const e=An(t),{fetchState:n}=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:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="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(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{switch(s){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,s)=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))},onLoadMore:()=>{e.nextCursor!=null&&t(Pn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function Ia(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=An(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(Ce({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ce({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),a.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{t(Pi(I)),t(Ce({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function sn(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=jt(),s=dn(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C($n),v=$i(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=f=>{c(f)};return l==="completed"?a.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?a.jsx(B,{to:`${u}/settings`,replace:!0}):a.jsxs(a.Fragment,{children:[a.jsx(Po,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),a.jsx(Dt,{analytics:S,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:s("invoicing_promo"),onAcceptClick:()=>{t(Fi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Ca=O((function(t,e){const n=Fn(t,e.invoiceId),{invoice:i,localData:s,reasonCodeOptions:o,submitState:c,typeOptions:d}=n;return{fieldHelp:n.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:s,reasonCodeOptions:o,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:s=>{t(Oi({localData:s}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ti())}}}))(Lt);function Ea(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((p=>Fn(p,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(wi()),g.current=null}),[t,n]),r.useEffect((()=>{s&&n!=null&&t(Se({invoiceId:n}))}),[s,t,n]),r.useEffect((()=>{c!=null&&n!=null&&o==="Completed"&&g.current!==n&&(g.current=n,t(Ri({localData:_i(c)})))}),[t,o,c,n]);const f=r.useRef(v.fetchState);return r.useEffect((()=>{const p=f.current;f.current=v.fetchState,p!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ka=O((function(t){return{invoicingOverview:wn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Rn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(At);function ya(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>wn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Rn(s))}),[i,t,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),a.jsx(ka,{navigate:e,selectedPeriod:s,tenantEmailDomain:n})]})}const xa=O((function(t){const e=_n(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${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:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Pt);function ba(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:f,appliedSearch:p,appliedSort:h,nextCursor:D,transactionListFetchState:b,transactions:k}=C((F=>{const P=_n(F);return{activeType:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,transactionListFetchState:P.fetchState,transactions:P.transactions}}),H),y=b==="Completed",I=`/${n}/invoicing`,j=r.useCallback((F=>{const P=k.find((T=>T.id===F)),U=P?.linkedInvoices?.[0]?.invoiceID??P?.invoiceID;U!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((F=>{const P=k.find((U=>U.id===F))?.customerID;P!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:P,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(P)}`))}),[e,I,k]);return r.useEffect((()=>{const F=setTimeout((()=>d(s)),300);return()=>clearTimeout(F)}),[s]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ee({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),a.jsx(xa,{navigate:e,tenantEmailDomain:n,activeType:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onTypeChange:F=>{t(Mi(F)),t(Ee({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const ja=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function cn(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=n!=null&&n!=="",c=C(pe),d=C((E=>Ui(E))),l=C(Bi),v=C((E=>Ln(E,n??""))),u=v.invoice,g=`/${i}/invoicing`,f=r.useRef(null),p=r.useRef("");r.useEffect((()=>{t(Vi()),f.current=null,p.current=""}),[t,n]),r.useEffect((()=>{s&&t(o&&n!=null?Se({invoiceId:n}):En({filters:{},keepExistingListItems:!1}))}),[s,t,n,o]),r.useEffect((()=>{o&&u!=null&&n!=null&&v.fetchState==="Completed"&&f.current!==n&&(f.current=n,t(Hi({contextInvoiceId:n,localData:qi(u)})))}),[t,u,n,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==p.current&&(p.current=E,t(Pn({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(Ye({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[t,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const D=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:ja(E)})))),[c.customers]),b=C((E=>zi(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(F=E.amountDue,P=Qi.currencySymbol,wt("0,0.00",F,P)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var F,P}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",F=u.amountDue?.amount??0;return{amountDue:$t("0,0.00",u.amountDue),amountDueValue:F,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),a.jsx(Ft,{customers:D,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{t(Ye({localData:E}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Ki(o?n??void 0:void 0))}})]})}const Gn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Da=O((function(t,e){const{editView:n}=e,i=n.subscription,s=i?.status,o=s!=null&&e.commercialEditAllowedFromStatuses.includes(s);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=="",o=(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(On({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ue({id:i,localData:c}))},onChangeTermEnd:s?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(X(ge)),t(Wi({id:i}))},onOpenAddress:()=>{const c=Gn(e.tenantEmailDomain??"",ge,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ue({id:i,localData:c})),t(Tn({id:i}))},onCancelSubscription:s?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:s?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Rt);function La(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((k=>Me(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed"&&!c.isFormLoading,[f,p]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&p(i)}),[i,g]);const h=f===i;fe(o),r.useEffect((()=>{o&&i!=null&&t(Gi({id:i}))}),[o,i,t]);const D=r.useCallback((k=>t(Zi({id:k}))),[t]),b=J(c.fetchState,c.isFormLoading,i,D);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),a.jsx(Da,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:s},b)]})}const Aa=O((function(t,e){const n=Me(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=null?"edit":"create";return{onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Mn({id:i})),t(X(ge)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(ue({id:i,localData:o}))},onOpenAddress:()=>{const o=Gn(e.tenantEmailDomain??"",ge,i),c=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:s}),t(Tn({id:i}))}}}))(_t);function Pa(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),[o]=G(),{areTenantIdsInSync:c}=_(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((f=>Xi(f,i))),u=C((f=>Me(f,i).localData));fe(c),r.useEffect((()=>{c&&t(Ji({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(ue({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const f=v??i,p=f!=null?`/${s}/invoicing/subscriptions/${encodeURIComponent(f)}`:`/${s}/invoicing/subscriptions`;e(p),t(Mn({id:i}))}}),[l,v,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),a.jsx(Aa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:s})]})}const $a=O((function(t){const e=Nn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(s,o,c)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:s}),t(On({action:o,id:s,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(s,o)=>{const c=o?.trim()??"";c!==""&&i(s,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(s,o,c)=>{o!=="pause"?i(s,o):i(s,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(s,o)=>{i(s,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:s}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(no({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tt);function Fa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,o]=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]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:p,appliedSort:h,nextCursor:D,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Nn(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),H),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(s)),300);return()=>clearTimeout(j)}),[s]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==p||u?.field!==h?.field||u?.dir!==h?.dir)&&t(en({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,p,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&t(Yi())}),[k,i,t]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),a.jsx($a,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>t(eo(j)),onSortChange:v})]})}const wa=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onInvoiceClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onSubscriptionClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onCapture:i!==""?()=>{S.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(oo({action:"capture",id:i}))}:void 0}}))(Ot);function Ra(){const t=L(),e=A(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>to(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&i!=null&&t(io({id:i}))}),[s,i,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),a.jsx(wa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Zn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:s=!1}=t,o=L(),{areTenantIdsInSync:c}=_(),d=C(Ne),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(s&&v!=="Not-Started"||o(Un()),n&&o(ao()))}),[c,o,e,n,s]),r.useEffect((()=>{e&&c&&l&&i&&o(so())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const _a={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function Y(t){const e=L(),{areTenantIdsInSync:n}=_(),{tenantEmailDomain:i}=R(),{fetchState:s,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(co),{configError:u,configFetchState:g,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:p,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D}=C(Bn),b=C(Ne);Zn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Te),y=t==="dunning"||t==="quickbooks",I=k.companyId??ye.getSignedInUserTenant(i??"")?.companyId,j=C((w=>xn(w,I))),E=ro(k.userRole??[]),F=k.tenantId??"",P=ye.getSignedInUser(),U={userId:P?.userId??"",sessionId:P?.zeniSessionId??"",tenantId:F},T=c?.fileId,ee=C((w=>T!=null&&T!==""?lo(w,T):void 0)),Ue=C((w=>T!=null&&T!==""?uo(w,T):void 0)),Wn=T!=null&&T!==""&&ee!=null?{[T]:ee}:{},Xn=T!=null&&T!==""&&Ue!=null?{[T]:Ue}:{};r.useEffect((()=>(e(nn()),()=>{e(nn())})),[e]),r.useEffect((()=>{n&&(s!=="Not-Started"&&s!=="Error"||e(Oe()))}),[n,e,s]),r.useEffect((()=>{n&&y&&g==="Not-Started"&&e(me())}),[n,e,g,y]),r.useEffect((()=>{if(!n)return;const w=P?.userId;w!=null&&w!==""&&F!==""&&He.shouldFetchActiveTenant(F)&&(He.markActiveTenantFetchStarted(F),e(go(w,F,P?.zeniSessionId)))}),[n,e,P?.userId,P?.zeniSessionId,F]);const Jn=f.length>0||p.length>0,Yn=s==="Not-Started"||s==="In-Progress"&&l==null||y&&!Jn&&(g==="Not-Started"||g==="In-Progress"),et=s==="Completed"&&(!y||g==="Completed"),Be=j.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,he=se?.invoicingMicroServiceBaseUrl,Ve=he!=null&&he.length>0?`${he}/1.0/webhooks/stripe`:"",Ie={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:w=>e(on(w)),onDisconnect:(w,z)=>{F!==""&&e(Io(F,w,an(z)))},onDisconnectStripe:()=>e(tn()),onReconnectQBO:()=>{const w=k.tenantEmailDomain??i??"";ve.init("/connection/auth",w),ve.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(qn())},onSaveChargeBeeCredentials:(w,z)=>{Be!=null&&F!==""&&e(fo(F,Be,an("revenue"),ho("chargebee"),{api_key:w,site:z}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve};return{authParams:U,deleteFileStatusById:Wn,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:Ie,isInvoicingPageReady:et,isLoading:Yn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:p,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve,updateFileStatusById:Xn,onConnectStripe:w=>e(on(w)),onDeleteFile:w=>e(So(w,F)),onDisconnectStripe:()=>e(tn()),onEditFileName:(w,z)=>e(po(w,z.split(".")[0],F)),onReconnectQBO:Ie.onReconnectQBO,onRefreshQBO:Ie.onRefreshQBO,onRetryQboSyncTask:w=>e(Hn(w)),onSave:w=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(vo({settings:w,snackbarSection:_a[t??""]}))},onStartQboBackfill:w=>e(Vn(w)),updateFilesEntity:w=>{S.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(mo({files:w}))}}}function rn({appContent:t}){const e=A(),n=Z(),i=L(),{tenantEmailDomain:s}=R(),o=Y("branding"),c=C((v=>Co(v))),d=C((v=>Eo(ke,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(ko()),i(X(ke)))}),[c.saveState.fetchState,i]);const l=Pe(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Mt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(xo({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${s}/invoicing/settings/branding/${ke}/`,u=W(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(yo()),updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=A(),e=Y("dunning");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Nt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=A(),e=Y("integrations");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Ut,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=A(),e=Y("payment-destination");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Bt,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const Na=O((function(t){const e=zn(t);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(t){return{onChange:e=>{t(Do({localData:e}))},onReset:()=>{t(jo())},onRetryTask:e=>{t(Hn(e))},onSave:()=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(bo())},onStartBackfill:e=>{t(Vn(e))}}}))(Vt);function Ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=C(Te),{configFetchState:s,saveState:o,settingsFetchState:c}=C(zn),d=Pe(o.fetchState);return r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&e("..")}),[e,d,o.fetchState]),r.useEffect((()=>{c!=="Not-Started"&&c!=="Error"||t(Oe())}),[t,c]),r.useEffect((()=>{s==="Not-Started"&&t(me())}),[s,t]),Zn({fetchSyncHealth:!0,loadAccountingPickers:!0}),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage}),a.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{ve.init("/connection/auth",i.tenantEmailDomain??n??""),ve.handleClick()},onRefresh:()=>t(qn())})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=dn(),e=L(),n=A(),[i,s]=G(),o=Y(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Bn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const f=Ba[g];s({},{replace:!0}),f!=null&&n(f,{replace:!0})}),[g,n,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Ht,{analytics:S,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Lo())}})]})}function ln(){return a.jsxs(ie,{children:[a.jsx(x,{index:!0,element:a.jsx(Va,{})}),a.jsx(x,{path:"payment-destination",element:a.jsx(Ma,{})}),a.jsx(x,{path:"branding",element:a.jsx(rn,{})}),a.jsx(x,{path:"branding/:addressType",element:a.jsx(rn,{appContent:a.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),a.jsx(x,{path:"integrations",element:a.jsx(Oa,{})}),a.jsx(x,{path:"dunning",element:a.jsx(Ta,{})}),a.jsx(x,{path:"quickbooks",element:a.jsx(Ua,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:"..",replace:!0})})]})}function Ss(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),{enableState:s,fetchState:o,status:c}=C($n),d=Pe(s.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=C((g=>Ne(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,t(me({cacheOverride:!1}))):t(me({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&u==="Not-Started"&&t(Un())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&s.fetchState==="Completed"&&(e(`${l}/catalog`),t(Ao()))}),[d,s.fetchState,l,t,e]),c==null&&o!=="Error"?a.jsx(qt,{fetchState:"In-Progress"}):c==="not_started"?a.jsxs(ie,{children:[a.jsx(x,{path:"promo",element:a.jsx(sn,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?a.jsxs(ie,{children:[a.jsx(x,{path:"promo",element:a.jsx(sn,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(ln,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/settings`,replace:!0})})]}):a.jsxs(ie,{children:[a.jsx(x,{path:"/",element:a.jsx(B,{to:"overview",replace:!0})}),a.jsx(x,{path:"overview",element:a.jsx(ya,{})}),a.jsx(x,{path:"promo",element:a.jsx(B,{to:`${l}/overview`,replace:!0})}),a.jsx(x,{path:"customers",element:a.jsx(na,{})}),a.jsx(x,{path:"customers/new",element:a.jsx(Yo,{})}),a.jsx(x,{path:"customers/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"customers/:customer_id",element:a.jsx(Xo,{})}),a.jsx(x,{path:"customers/:customer_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions",element:a.jsx(Fa,{})}),a.jsx(x,{path:"subscriptions/new",element:a.jsx(Pa,{})}),a.jsx(x,{path:"subscriptions/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions/:subscription_id",element:a.jsx(La,{})}),a.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"invoices",element:a.jsx(Ia,{})}),a.jsx(x,{path:"invoices/create",element:a.jsx(zo,{})}),a.jsx(x,{path:"invoices/:invoice_id",element:a.jsx(fa,{})}),a.jsx(x,{path:"invoices/:invoice_id/record-payment",element:a.jsx(cn,{})}),a.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:a.jsx(Ea,{})}),a.jsx(x,{path:"payments",element:a.jsx(ba,{})}),a.jsx(x,{path:"payments/record",element:a.jsx(cn,{})}),a.jsx(x,{path:"payments/:transaction_id",element:a.jsx(Ra,{})}),a.jsx(x,{path:"credits",element:a.jsx(Zo,{})}),a.jsx(x,{path:"credits/:credit_note_id",element:a.jsx(Ko,{})}),a.jsx(x,{path:"discounts",element:a.jsx(ua,{})}),a.jsx(x,{path:"discounts/new",element:a.jsx(Ho,{})}),a.jsx(x,{path:"discounts/:coupon_id",element:a.jsx(la,{})}),a.jsx(x,{path:"dunning",element:a.jsx(pa,{})}),a.jsx(x,{path:"dunning/:case_id",element:a.jsx(ma,{})}),a.jsx(x,{path:"catalog",element:a.jsx(Bo,{})}),a.jsx(x,{path:"catalog/new",element:a.jsx(Mo,{})}),a.jsx(x,{path:"catalog/:item_id",element:a.jsx(Ro,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(ln,{})}),a.jsx(x,{path:"audit_log",element:a.jsx($o,{})}),a.jsx(x,{path:"data_import",element:a.jsx(aa,{})}),a.jsx(x,{path:"data_import/migrate",element:a.jsx(ca,{})}),a.jsx(x,{path:"data_import/:sessionId",element:a.jsx(ia,{})}),a.jsx(x,{path:"*",element:a.jsx(M,{})})]})}export{Ss as default};
@@ -1 +0,0 @@
1
- import{j as _}from"./liveblocks-BjcYyeQ6.js";import{a as f}from"./sentry-DZ9rNYfw.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-B-8b0iz9.js";import{fF as ne,T_ as Ue,T$ as se,g9 as xe,fE as Ne,U8 as Pe,U1 as Re,U2 as Ve,p$ as Oe,gm as Le,U5 as h,Ua as je,Ub as K,gn as Ze,Uc as ze,Eb as qe,h1 as He,cV as Ye,Ud as Qe,g8 as We,go as Je}from"./zeni-epic-state-95zxmizy.js";import{w as Ke,i as Xe,O as ea,o as aa,c as ta,e as na,u as sa,S as c,f as oa,Q as ia,z as ra,d as da,l as ca,N as la,r as ua,n as fa,q as X,L as ma,C as ba,D as ha,p as g,k as ee,x as pa,I as ae,A as Sa,B as ga}from"./index-Bg2deWZq.js";import{D as Ea}from"./mui-C33Oegsm.js";import{u as ka}from"./InboxNotificationsProvider-B4UF_uUg.js";import{u as Ca}from"./useTaskManagerAccess-C6qhVozS.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]="994bf8b4-2edc-472f-b29c-86d4a830f60a",l._sentryDebugIdIdentifier="sentry-dbid-994bf8b4-2edc-472f-b29c-86d4a830f60a")}catch{}})();const Ta=Ke((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Ne(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,M]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,U=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),N=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(e)));f.useEffect((()=>{C&&T&&!m&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[C,T,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Le(e):[])),S=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:be}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:he}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>h(e).totalUnreadCount)),Ce=t((e=>h(e).reducedFetchCountState)),R=t((e=>h(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>h(e).notificationDetailsByTab.comments.uiState.unreadCount)),O=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();f.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;M(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),f.useEffect((()=>{C&&k&&!m&&O.fetchState==="Not-Started"&&B.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,k,m,O.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(K({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(K({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:ke},q=s!=null?ra.getSignedInUserTenant(s):null,H=t((e=>q?.tenantId!=null?Ze(e,q.tenantId):void 0)),b=[];me===!1&&b.push("accounts_payable_aging"),be===!1&&b.push("accounts_receivable_aging"),b.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&b.push("rewards_card"),P===!1&&b.push("expense_automation_card");const Y=t((e=>ze(e,b).fetchState)),Q=t((e=>qe(e).fetchState)),ye=A&&(Y==="Completed"||Y==="Error")||U&&(Q==="Completed"||Q==="Error")||!A&&!U?void 0:"disabled",we=f.useMemo((()=>He(o.userRole)),[o.userRole]),Ae=Ye(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&N.fetchState==="Completed"&&Qe(N.notificationSettings,p.userEmail,x,o,k),W=da(),Fe=W&&ca(a);return _.jsx(Ea,{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:H!=null?[H]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=R===0&&V>0?"notifications/comments":"notifications/tasks";X(a)&&(e=R===0&&V>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),ba({dispatch:r,navigate:n,pathToNavigate:ha(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:Se,newYearAnimationEnabled:ge})})})),Ba=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Xe(n)&&Ue(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BjcYyeQ6.js";import{h as r,l as n}from"./core-B-8b0iz9.js";import{an as i}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import"./sentry-DZ9rNYfw.js";import"./zeni-epic-state-95zxmizy.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var 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]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
@@ -1 +0,0 @@
1
- import{j as n}from"./liveblocks-BjcYyeQ6.js";import{h as Z,u as H,g as J,i as Q,j as d,l as X,n as ee,o as C}from"./core-B-8b0iz9.js";import{fF as w,Ac as U,v5 as ae,Vw as M,v0 as y,bq as te,b$ as se,v1 as oe,Vx as re,Ve as S,ei as ne,E0 as ce,Vy as ie,Eo as le,d_ as de,dZ as me}from"./zeni-epic-state-95zxmizy.js";import{aj as fe,z as pe,ar as ue,at as he,K as Fe,o as _,S as V,a9 as ge,k as B,aE as be,p as Ie}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import Ce from"./NotFoundScreen-BPIsWBDH.js";import{F as Se}from"./FeaturePreviewScreen-DWBL39rh.js";import{a as F}from"./sentry-DZ9rNYfw.js";import{u as ye}from"./useAskAiCfoHostNavButtonProps-BZHyrLWc.js";import{u as Te}from"./useInitialThreadRequest-C3Htu0iZ.js";import{t as Ae}from"./routePaths-Cz0AF8Dx.js";import{M as xe}from"./MobileAppDrawer-CHFdUHPo.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-C6qhVozS.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="c0448635-f5ba-42ed-a87a-7b75fa49f4be",s._sentryDebugIdIdentifier="sentry-dbid-c0448635-f5ba-42ed-a87a-7b75fa49f4be")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},Ee=X((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:B}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(M(a,o)),e.isPandLReportFetched(a)||s(y(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=Ae(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function v(){const s=fe(),e=Z(),a=H(),o=J(),{forecastId:r,tenantEmailDomain:c}=Q(),[p,u]=F.useState(!1),[m,A]=F.useState(!1),g=pe.getSignedInUser(),x=d((t=>w(t))),N=x.company?.companyInfo.firstMonthOfFY??1,i=d((t=>U(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),E=d((t=>t.profitAndLossState)),D=d((t=>t.reportUIOptionsState.selectedForecast)),j=t=>E.pandLByForecastID[t]!=null&&oe(t,E).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:$,onAskAiCfoClick:q}=ye({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){A(!0);const t=((f,R,O)=>R!=null?f.forecasts.findIndex((I=>I.id===R)):O!=null?f.forecasts.findIndex((I=>I.id===O)):f.forecasts.length>0?0:-1)(i,r,D?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=D?.index?(a(M(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!j(i.forecasts[t].id)&&b&&a(y(i.forecasts[t].id))}}),[p,u,a,l,i,m,A,U,y,b]);const k=Fe(),G=k?.loggedInUserRole!=null&&te(k.loggedInUserRole),{useFeatureGate:Y}=_(),{isFeatureEnabled:L}=Y(V.isReportsCommentingEnabled),W=Te(L?x?.companyId:void 0,{clearParams:l&&m}),[z,K]=F.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",g?.firstName??""),h.searchParams.set("lastname",g?.lastName??""),h.searchParams.set("email",g?.userEmail??"");const P=t=>{K(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(ge,{analytics:B,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(xe,{isAppContentDrawerOpen:z,handleDrawerToggle:P}),n.jsx(Ee,{firstMonthOfFY:N,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:j,meetingUrl:se(h.toString()),hasTransactionAccess:G,isAiCfoAccessEnabled:$,onAskAiCfoClick:q,isReportsCommentingEnabled:L,initialOpenThreadRequest:W,onClickMenuIcon:()=>{P(!0)}})]})}function He(){const s=d((c=>w(c))),{useFeatureGate:e}=_(),{isFeatureEnabled:a}=e(V.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{He as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BjcYyeQ6.js";import E from"./NotFoundScreen-BPIsWBDH.js";import{a as r}from"./sentry-DZ9rNYfw.js";import{h as _,g as v,j as p,i as M,u as O,N as U,l as P,n as z,o as b}from"./core-B-8b0iz9.js";import{fF as F,a13 as h,bo as B,bn as N,iL as V,gh as L}from"./zeni-epic-state-95zxmizy.js";import{O as $,z as I,at as q,dO as G}from"./index-Bg2deWZq.js";import"./mui-C33Oegsm.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-BZHyrLWc.js";import{M as J}from"./MobileAppDrawer-CHFdUHPo.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-C6qhVozS.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]="c4374ca6-3afb-4331-b911-9152fb1df22b",e._sentryDebugIdIdentifier="sentry-dbid-c4374ca6-3afb-4331-b911-9152fb1df22b")}catch{}})();const K=P((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=h(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),c=$(),o=p((a=>F(a))),{aggregatedReportViewState:n}=p((a=>h(a))),{tenantEmailDomain:m}=M(),u=O(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const f=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(l),y=C||k||x,d=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&f.current&&(u(L({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),f.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||d(a,i,!0),f.current=!0}),[n?.fetchState,d]),j=r.useCallback(((a,i)=>{d(a,i,!1)}),[d]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return q({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:c,currentTenant:o,signedInUser:l,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(U,{to:`/${m}/dashboard`,replace:!0})};function be(){return s.jsxs(z,{children:[s.jsx(b,{path:"*",element:s.jsx(Q,{})}),s.jsx(b,{path:"*",element:s.jsx(E,{})})]})}export{be as default};
@@ -1,68 +0,0 @@
1
- import{j as s}from"./liveblocks-BjcYyeQ6.js";import{u as ae,j as A,h as Q,g as J,i as ie,N as P,l as ee,q as ct,n as dt,o as w}from"./core-B-8b0iz9.js";import{fF as V,NG as ut,_U as ge,c8 as he,MM as $e,ma as pt,M$ as ce,M_ as de,_V as bt,bn as fe,gV as Le,_W as gt,WT as ht,l$ as Me,WU as Ce,WV as ft,kN as St,YX as It,l0 as yt,MA as Rt,Cd as At,kU as vt,Nl as Pe,_X as _e,_Y as Ee,_Z as kt,__ as Ct,_$ as Et,N5 as we,l6 as wt,Z4 as xt,MZ as Bt,MK as Tt,$0 as Dt,MJ as jt,$1 as Ut,MR as xe,N9 as Ft,N8 as $t,N4 as Lt,$2 as Ne,Sj as Mt,bo as Pt,MU as _t,ND as Nt,$3 as Ot,$4 as Zt,Nh as Gt,Ne as Be,Yr as zt,MH as Vt,$5 as Oe,O4 as Te,Oc as Wt,$6 as Ht,$7 as Y,$8 as qt,$9 as Ze,$a as Yt,$b as Ge,$c as ze,Nt as ue,bu as Kt,bK as Se,cM as Ie,d_ as Ve,dZ as We,$d as Jt,gh as Xt,YE as Qt,$e as en,$f as He,YI as tn,Zq as nn,$g as an,ZP as sn,O9 as De,O8 as on,$h as rn,$i as ln,$j as mn,$k as cn,$l as dn,Za as un,N$ as pn,O3 as bn,bq as gn,bJ as hn,cG as fn,cu as Sn,bt as In,Ui as yn,da as Rn,dd as An,dc as vn,cF as kn}from"./zeni-epic-state-95zxmizy.js";import{bU as Cn,O as qe,a2 as Ye,o as oe,S as x,z as L,cT as Ke,a9 as re,k as C,aT as je,H as U,af as se,ag as En,G as Je,cU as wn,p as K,at as Xe,cV as xn,K as le,cW as Bn,ar as Tn,ac as Dn,a8 as ye,V as Qe,w as jn,bC as Un,aw as Fn,aj as $n,E as et,cX as Ln,f as Mn}from"./index-Bg2deWZq.js";import{n as _,S as Pn}from"./mui-C33Oegsm.js";import pe from"./NotFoundScreen-BPIsWBDH.js";import{S as Ue}from"./SetupPagesScreen-BlUoKvnc.js";import{F as tt}from"./FeaturePreviewScreen-DWBL39rh.js";import{a as h}from"./sentry-DZ9rNYfw.js";import{u as Re}from"./useAskAiCfoHostNavButtonProps-BZHyrLWc.js";import{u as nt}from"./useInitialThreadRequest-C3Htu0iZ.js";import{D as _n}from"./DrawerScreen-CO5oDn6f.js";import{M as at}from"./MobileAppDrawer-CHFdUHPo.js";import{F as Nn}from"./ScreenRoutes-DP4Wjips.js";import{R as On}from"./ReimbursementApprovalRoutes-CMbfshMX.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";import"./BusinessVerificationPageScreen-DjqyigwM.js";import"./routePaths-Cz0AF8Dx.js";import"./analyticsHelper-Bi6R9Hrj.js";import"./InboxNotificationsProvider-B4UF_uUg.js";import"./useTaskManagerAccess-C6qhVozS.js";import"./getLocaleForTenant-BYXijL7f.js";import"./ReimbursementApprovalRuleDetailScreen-CrWl9trk.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]="de70e4e2-81ad-4d69-9048-73d9d9e2f148",e._sentryDebugIdIdentifier="sentry-dbid-de70e4e2-81ad-4d69-9048-73d9d9e2f148")}catch{}})();const st=e=>`/${e}/reimbursements`,Zn=e=>h.createElement("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...e},h.createElement("path",{d:"M12.5 3.5L3.5 12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),h.createElement("path",{d:"M12.5 12.5L3.5 3.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),{common:q,spendManagement:{reimbursement:{reimbursementDetail:ne}}}=Je.getLocalizedStrings(),Gn=ee((function(e,t){const n=t.currentTenant?.companyId,r=bt(e.plaidAccountViewState,"user_reimbursement_account"),c=L.getSignedInUser(),d=fe(c),m=r.plaidConnectionDetails,o=Le(e.companyState,n),a=e.tenantState.currentTenantId,i={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:a??""},l=ge(e,t.reimbursementId),b=gt(e,c?.userId??"");let y=`${c?.firstName} ${c?.lastName}`,f=!0;t.reimbursementId!=null&&(y=`${l.createdBy?.firstName??"Zeni"} ${l.createdBy?.lastName??""}`,f=c?.userId===l.createdBy?.userId);const B=e.entityAutoCompleteState?.autoCompleteText?.common,u=ht(e,"common");return{remiDetails:l,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,reimbursementId:t.reimbursementId,customerSearchAutoCompleteData:{autoCompleteText:B,entityAutoCompleteView:u},authParams:i,defaultCurrency:{currencySymbol:o?.company.companyLocaleInfo.currencySymbol??"$",currencyCode:o?.company.companyLocaleInfo.currencyCode??"USD"},companyMileageConfigInfo:o?.company.configInfo.mileageRateConfig,createdBy:y,isUserAdmin:he(t.currentTenant?.userRole??[]),isZeniUser:d,plaidConnectionDetails:m,bankNameByRouting:l.bankNameByRouting,bankAccountCreationState:b.bankAccountCreationState,bankAccounts:b.bankAccounts,analytics:C,bankAccountToCreate:l.bankAccountToCreate,fetchBankNameByRoutingStatus:l.fetchBankNameByRoutingStatus,isSignedInUserReimbursementCreator:f,disableInternalOverlay:t.disableInternalOverlay,showSkipAutoFill:t.showSkipAutoFill,setShowSkipAutoFill:t.setShowSkipAutoFill,isAccountingClassesEnabled:Me(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:c,navigate:d,themeState:m}=t,{tenantEmailDomain:o}=r,a=L.getSignedInUser();return{onReceiptsUpload:(i,l,b)=>{i!=null&&e(de(i,l,b,n,a?.userId))},onExistingMerchantChange:(i,l)=>{e(xe(!1,l,n,i,void 0))},fetchDuplicateReimbursement:()=>{a?.userId!=null&&e(Lt(a.userId,!0,n))},clearDuplicateReimbursementDetail:()=>{e($t())},clearRemiSaveStatus:()=>{e(Ft("Not-Started",n))},onDuplicateLineClick:(i,l)=>window.open(`/${o}/reimbursement/${i}#L${l}`),onNewMerchantChange:(i,l)=>{e(xe(!1,l,n,void 0,i))},removeFileFromLine:i=>{e(Ut({lineId:i,reimbursementId:n}))},onAmountChanged:(i,l)=>{e(jt(l,i,n))},updateReimbursementType:(i,l,b)=>{e(Dt({reimbursementId:b,lineId:l,reimbursementType:i}))},onHomeCurrencyConversionUpdate:(i,l,b)=>{e(Tt({reimbursementId:b,lineId:l,amountPayload:{amount:i.amount,currency_code:i.currencyCode,currency_symbol:i.currencySymbol}}))},onReimbursementDetailsChanged:i=>{e(Bt({remiDetailLocalData:i,reimbursementId:n}))},saveRemiDetails:i=>{e(we(i,!1,n))},onUserBankDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(xt({data:l}))},onFetchBankName:i=>{e(wt(i))},submitRemiDetails:()=>{e(we("pending_approval",!0,n))},discardReimbursementDetailsFromLocalStore:i=>{e(Ee({reimbursementId:i}))},updateInvoiceUploadFetchState:i=>{e(ce({reimbursementId:n,fetchState:i}))},clearTentativeNameForLine:i=>{e(Et({reimbursementId:n,lineId:i}))},removeDuplicateReimbursementForLine:i=>{e(Ct({lineId:i}))},onZeniLogoClick:()=>{m.toggle()},clearAddRemiAutoFields:i=>{e(kt({reimbursementId:n,lineId:i}))},redirectToReimbursementListScreen:()=>{e(_e()),e(Ee({}));const i=st(o),l=K(c.state?.pathnameStackToGoBack,c.pathname);d(i,{state:{pathnameStackToGoBack:l}})},redirectToReimbursementDetailScreen:()=>{t.navigate("../")},deleteReimbursement:()=>{n!=null&&(C.trackReimbursementDeleteReimbursement(n),e(Pe(n)))},onSaveBankAccount:()=>{a?.userId&&e(vt(a?.userId,n))},onFetchLinkTokenClick:i=>{e(At("user_reimbursement_account",i))},onEstablishConnectionClick:i=>{e(Rt(i,r.companyId,"user_reimbursement_account",void 0,"link_account_no_microdeposit"))},deleteBankAccount:i=>{e(yt(i,a?.userId??""))},onBackClickFromBankAccountPage:()=>{e(St({fetchState:"Not-Started"})),e(It())},customerSearchAutoCompleteActions:{onAutoCompleteInputChange:(i,l)=>{i.trim().length>=2?e(ft({searchString:i,entityType:l,searchOrigin:"common"})):e(Ce("common"))},onCancelAutoComplete:()=>{e(Ce("common"))}}}}))(wn);function Fe(){const e=Q(),t=ae(),n=J(),{reimbursementId:r}=ie(),c=qe(),d=Ye(),[m,o]=h.useState(r==null),[a,i]=h.useState(1),{useFeatureGate:l}=oe(),{isFeatureEnabled:b}=l(x.isLimitedCategoryForReimbursement),{isFeatureEnabled:y}=l(x.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:f}=l(x.isReimbursementCommentingEnabled),{isAiCfoAccessEnabled:B,onAskAiCfoClick:u}=Re({mobileExploreReferrer:"Reimbursement Details"}),T=J().pathname,D=T.includes("edit"),j=T.includes("reimbursement/new"),[v,k]=h.useState(!1),E=L.getSignedInUser(),I=A((p=>V(p))),g=A((p=>ge(p,r))),F=nt(I?.companyId,{clearParams:g.fetchState==="Completed"}),$=he(I?.userRole??[]);(function(){const p=ae(),N=A((X=>V(X))),O=N?.tenantId,{isApprovalRulesV3Enabled:Z,isLoading:W}=Cn(O),H=A((X=>X.remiSetupApproverViewState.fetchState));h.useEffect((()=>{O==null||W||H==="Not-Started"&&p(ut(!0,!1,!1,Z))}),[O,W,Z,H,p])})(),h.useEffect((()=>{(j&&!v||D&&!v&&g.fetchState!="Completed"&&g.fetchState!="In-Progress")&&(k(!0),t($e(!1,b,y,r)))}));const M=A((p=>pt(p.accountState,p.accountListState,"reimbursementAccountList")));if(E==null)throw Error("Can't access address page without signing in...");const R={pathname:`../${r}`,search:n.search};return g.isDeleted===!0||g.billStage=="paid"||g.billStage=="scheduled"||g.fetchState=="Not-Started"||$&&g.billStatus==="rejected"||$===!1&&g.billStage==="pending_approval"&&g.billStatus!=="rejected"?s.jsx(P,{to:R}):g.deleteStatus.fetchState==="In-Progress"||g.fetchState!=="Completed"?s.jsx(Ke,{isNewReimbursement:r==null}):s.jsxs(zn,{windowSize:d,children:[s.jsx(re,{analytics:C,onLoad:p=>(N=>{r!=null&&g.deleteStatus.fetchState!=="Completed"&&N.trackReimbursementEditReimbursement(r)})(p)}),m&&d!=="small"?s.jsx(Vn,{}):null,m&&d!=="small"?s.jsx(Wn,{children:s.jsx(je,{showAutofill:m,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:I?.tenantId??""},onSkipAutofill:()=>o(!1),onInvoiceUpload:p=>{p!=null&&t(de(p,a,!0,r,E?.userId))},updateInvoiceUploadFetchState:p=>{t(ce({reimbursementId:r,fetchState:p}))},allowMultiFiles:m,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:"78px",paddingRight:U.sp3,paddingBottom:"15px",paddingLeft:U.sp5},dropFilePlaceholder:{upload:q.upload,single:ne.dropReceipt.single,or:q.texts.or,multiple:ne.dropReceipt.multiple,receipts:q.texts.receipts2}})}):null,m&&d==="small"?s.jsxs(Hn,{children:[s.jsx(qn,{onClick:()=>o(!1),children:s.jsx(Zn,{})}),s.jsx(je,{showAutofill:m,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:I?.tenantId??""},onSkipAutofill:()=>o(!1),onInvoiceUpload:p=>{p!=null&&t(de(p,a,!0,r,E?.userId))},updateInvoiceUploadFetchState:p=>{t(ce({reimbursementId:r,fetchState:p}))},allowMultiFiles:m,showInfoText:!1,type:"reimbursement",style:{width:"100%",paddingTop:U.sp5,paddingRight:U.sp3,paddingBottom:U.sp5,paddingLeft:U.sp3},dropFilePlaceholder:{upload:q.upload,single:ne.dropReceipt.single,or:q.texts.or,multiple:ne.dropReceipt.multiple,receipts:q.texts.receipts2}})]}):null,s.jsx(Yn,{windowSize:d,children:s.jsx(Gn,{initialOpenThreadRequest:F??void 0,isReimbursementCommentingEnabled:f,location:n,navigate:e,currentTenant:I,reimbursementId:r,themeState:c,uncategorizedAccounts:M,disableInternalOverlay:!0,showSkipAutoFill:m,setShowSkipAutoFill:o,onCurrentLineIdForUploadChange:i,isAiCfoAccessEnabled:B,onAskAiCfoClick:u})})]})}const zn=_.div`
2
- display: flex;
3
- position: relative;
4
- height: 100vh;
5
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
6
- background-color: ${e=>e.theme.colors.grey4};
7
- `,Vn=_.div`
8
- position: fixed;
9
- top: 0;
10
- left: 0;
11
- right: 0;
12
- bottom: 0;
13
- background-color: ${En.overlayBackgroundBlack};
14
- z-index: 5;
15
- `,Wn=_.div`
16
- position: absolute;
17
- top: 0;
18
- left: 0;
19
- width: 42%;
20
- height: 100%;
21
- z-index: 6;
22
- display: flex;
23
- background-color: transparent;
24
- overflow: hidden;
25
- `,Hn=_.div`
26
- position: fixed;
27
- top: 0;
28
- left: 0;
29
- right: 0;
30
- bottom: 0;
31
- z-index: 11;
32
- display: flex;
33
- flex-direction: column;
34
- overflow-y: auto;
35
- background-color: ${e=>e.theme.colors.grey4};
36
- `,qn=_.button`
37
- align-self: flex-end;
38
- background: none;
39
- border: none;
40
- cursor: pointer;
41
- padding: ${U.sp2} ${U.sp3};
42
- line-height: 1;
43
- color: ${e=>e.theme.colors.hero};
44
- &:hover {
45
- color: ${e=>e.theme.colors.primary};
46
- }
47
- svg {
48
- width: ${U.sp4};
49
- height: ${U.sp4};
50
- }
51
- `,Yn=_.div`
52
- display: flex;
53
- flex-direction: column;
54
- width: 100%;
55
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
56
- `,Kn=ee((function(e,t){const n=Ne(e,t.reimbursementId),r=L.getSignedInUser(),c=fe(r),d=e.tenantState.currentTenantId,m={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:d??""},o=`${n.createdBy?.firstName??"Zeni"} ${n.createdBy?.lastName??""}`;let a=!1;n?.remiActivities.length>0&&(a=Ot(n.remiActivities,Zt(t.currentTenant),r));const i=he(t.currentTenant?.userRole??[]),l=r?.userId===n.createdBy?.userId;return{remiDetails:n,uploadInvoiceEndPoint:`${se.communicationAgentMicroServiceBaseUrl}`,authParams:m,signedInUser:r,createdBy:o,isRealTimeApprovalEnabled:t.isRealTimeApprovalEnabled,isAdmin:i,showApproveRejectBtns:a,isZeniUser:c,isSignedInUserReimbursementCreator:l,isAccountingClassesEnabled:Me(e)}}),(function(e,t){const{reimbursementId:n,currentTenant:r,location:c,navigate:d,themeState:m}=t,{tenantEmailDomain:o}=r;return{onDuplicateLineClick:(a,i)=>window.open(`/${o}/reimbursement/${a}#L${i}`),redirectToReimbursementListScreen:()=>{e(_e());const a=st(o),i=K(c.state?.pathnameStackToGoBack,c.pathname);d(a,{state:{pathnameStackToGoBack:i}})},onSaveRealTimeApprovals:a=>{e(Vt(n,"reimbursement",a))},updateEditRealTimeApproverClicked:a=>{e(zt({isEdit:a,entityId:n,entityType:"reimbursement"}))},approveOrRejectRemi:a=>{a.type==="approved"?e(Be(n,a.type,"")):e(Be(n,a.type,a.description??""))},redirectToEditableReimbursementScreen:()=>{const a=K(c.state?.pathnameStackToGoBack,c.pathname);d("./edit",{state:{pathnameStackToGoBack:a}})},deleteReimbursement:()=>{C.trackReimbursementDeleteReimbursement(n),e(Pe(n))},cancelAndDeleteReport:a=>{a===!0?C.trackReimbursementCancelAndDeleteReimbursement(n):C.trackReimbursementCancelReimbursement(n),e(Gt(n,a))},handleZeniLogoClick:()=>{m.toggle()}}}))(xn);function Jn(){const e=Q(),t=ae(),n=J(),r=n.hash.substring(1),c=qe(),{reimbursementId:d}=ie(),m=L.getSignedInUser(),o=A((R=>V(R))),a=A((R=>Ne(R,d??""))),i=a.remiDetails?.reimbursementInfo.stage.code==="draft",l=nt(o?.companyId,{clearParams:a.fetchState==="Completed"&&!i}),{isAiCfoAccessEnabled:b,onAskAiCfoClick:y}=Re({mobileExploreReferrer:"Reimbursement Details"});Xe({isDataReady:a.fetchState==="Completed"});const{useFeatureGate:f}=oe(),{isFeatureEnabled:B}=f(x.isLimitedCategoryForReimbursement),[u,T]=h.useState(!1),[D,j]=h.useState(!1),[v,k]=h.useState(!1),{isFeatureEnabled:E}=f(x.isReimbursementCommentingEnabled),{isFeatureEnabled:I}=f(x.isShowDeletedReimbursementsFeatureEnabled),g=A((R=>ge(R,d??""))),F=Mt(o),$=Pt(o.userRole),M=a.fetchState;if(h.useEffect((()=>{u||d==null?u==1&&M==="Error"&&e("page-not-found",{replace:!0}):(T(!0),t(_t(d,!1,I)))}),[u,d,t,M]),h.useEffect((()=>{I&&a.remiDetails?.isDeleted===!0||o.isZeni===!0&&m?.userEmailDomain==="zeni.ai"&&F===!1?k(!1):k(a.remiActivities[0]?.isRealTimeApprovalEnabled&&($||a.allApprovers.find((R=>R.user.userId===m?.userId))!=null||a.remiDetails?.lastUpdatedBy===m?.userId))}),[a.remiActivities[0]?.isRealTimeApprovalEnabled,a.allApprovers,a.remiDetails?.lastUpdatedBy,$,o.isZeni,F,m]),h.useEffect((()=>{D||a.fetchState!="Completed"||a.remiDetails?.reimbursementInfo.stage.code=="paid"||a.remiDetails?.reimbursementInfo.stage.code=="scheduled"||g.fetchState=="Completed"||g.fetchState=="In-Progress"||(j(!0),t($e(!1,B,I,d)),a.remiActivities[0]?.isRealTimeApprovalEnabled===!0&&t(Nt(!1,!0,!0,a.lastUpdatedByUserId)))}),[D,a,d,t]),m==null)throw Error("Can't access address page without signing in...");return a.remiDetails?.reimbursementInfo.stage.code=="draft"&&g.fetchState=="Completed"&&a.remiDetails.isDeleted===!1?s.jsx(P,{to:`./edit${n.search}`}):a.deleteStatus.fetchState==="In-Progress"||a.cancelAndDeleteStatus.fetchState==="In-Progress"||a.remiDetails?.reimbursementInfo.stage.code=="draft"&&g.fetchState!="Completed"||a.fetchState!="Completed"?s.jsx(Ke,{}):s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:C,onLoad:R=>(p=>{d!=null&&p.trackReimbursementReimbursementDetails(d)})(R)}),s.jsx(Kn,{initialOpenThreadRequest:l??void 0,scrollId:r,isReimbursementCommentingEnabled:E,isShowDeletedReimbursementEnabled:I,location:n,navigate:e,isRealTimeApprovalEnabled:v,currentTenant:o,reimbursementId:d??"",themeState:c,isAiCfoAccessEnabled:b,onAskAiCfoClick:y})]})}const Xn=ee((function(e,t){return{remisReviewView:Oe(e),analytics:t.analytics}}),(function(e,t){return{onCloseOverlay:()=>{t.navigate(`/${t.tenantEmailDomain}/reimbursements`),e(Y())},onCloseReviewItem:n=>{e(Ht(n))},onProceedForBulkActionClick:(n,r)=>{switch(n){case"send_for_approval":e(Wt());break;case"approve":e(Te("approved",r??""));break;case"reject":e(Te("rejected",r??""))}}}}))(Bn);function Qn({tenantEmailDomain:e}){const t=Q(),n=A((m=>m.remisBulkActionViewState.bulkSubmissionFetchState.fetchState)),{remisForReview:r}=A((m=>Oe(m))),c=le(),d=c?.loggedInUserRole?.includes("admin")===!0;return h.useEffect((()=>{n!=="Completed"&&r.length!==0||t(`/${e}/reimbursements`)}),[n,r.length,e]),s.jsx(Xn,{navigate:t,analytics:C,isAdmin:d,tenantEmailDomain:e})}const z=tn(),it="bulk-operation-update",be="reimbursement-approval-rule-update",{spendManagement:ea,common:me}=Je.getLocalizedStrings(),ta=ea.reimbursement.bulkActions,na=_.div`
57
- display: flex;
58
- min-height: 100%;
59
- width: 100%;
60
- flex: 1 1 auto;
61
- flex-direction: column;
62
- align-items: center;
63
- background-color: ${e=>e.theme.colors.grey4};
64
- `,aa=ee((function(e,t){const n=ze(e,z,t.isBulkActionEnabled);let r=n.allSubTabs;const c=L.getSignedInUser(),d=fe(c),m=e.tenantState.currentTenantId,o=V(e),a=o?.companyName??"",i={userId:c?.userId??"",sessionId:c?.zeniSessionId??"",tenantId:m??""},l=e.remiListState.downloadUIState.downloadState;t.isShowDeletedReimbursementEnabled===!1&&(r=r.filter((f=>f!=="deleted")));const b=n.fetchState,y=nn(e);return{transactionList:t.isShowDeletedReimbursementEnabled?n.reimbursements:n.reimbursements.filter((f=>f.isDeleted===!1)),isAdmin:t.isAdmin,isZeniUser:d,isBillPayCommentingEnabled:t.isBillPayCommentingEnabled,isReimbursementCommentingEnabled:t.isReimbursementCommentingEnabled,allSubTabs:r,isEmployee:t.isEmployee,currentTab:n.currentTab,currentSubTab:n.currentSubTab,approvalCount:n.approvalCount,fetchState:b,botEmail:n.reimbursementBotEmail,analytics:C,uiState:n.uiState,searchText:n.searchText,filters:n.filters,downloadParams:{authParams:i,companyName:a,timePeriod:z,spendManagementEndPoint:`${Fn}/spendManagement`,isShowDeletedBillsEnabled:t.isShowDeletedBillsEnabled,isShowDeletedReimbursementEnabled:t.isShowDeletedReimbursementEnabled},downloadState:l,isBulkActionAllowed:n.remiListBulkActionInfo?.isBulkActionAllowed,transactionsSelectedForBulkAction:n.remiListBulkActionInfo?.remisSelectedForBulkAction,allowedBulkActions:n.remiListBulkActionInfo?.allowedBulkActions,remiApprovalRulesAffectedEntityIds:y.affectedEntityIds}}),(function(e,t){const{navigate:n,currentTenant:r,location:c,period:d}=t,{tenantEmailDomain:m}=r;return{updateTabToState:o=>{e(Y()),e(Ze(o))},onSubtabChange:o=>{e(Y()),e(Ge(o))},onTransactionClick:(o,a)=>{const i=oa(m,o,a),l=K(c.state?.pathnameStackToGoBack,c.pathname);n(i,{state:{pathnameStackToGoBack:l}})},onClickSetupIcon:()=>{const o=ia(m),a=K(c.state?.pathnameStackToGoBack,c.pathname);n(o,{state:{pathnameStackToGoBack:a}})},onAddTransactionClick:()=>{const{tenantEmailDomain:o}=t.currentTenant;C?.trackReimbursementNewReimbursement();const a=`/${o}/reimbursement/new`,i=K(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(a,{state:{pathnameStackToGoBack:i}})},onColumnSortConfigChanged:(o,a)=>{e(dn({uiState:{sortKey:o,sortOrder:a},period:t.period}))},onSearchTextChanged:o=>{e(cn(o))},onFiltersChange:o=>{e(mn({filters:o})),o.categories.every((a=>a.field!=null&&a.values?.length!==0))&&C.trackSpendManagmentFilterChange("reimbursement",o.categories.map((a=>`${a.field}-${JSON.stringify(a.values)}`)))},updateDownloadStateHandler:o=>{o==="In-Progress"&&C.trackSpendManagementDownloadClick("reimbursement"),e(ln({uiState:{downloadState:o}}))},onReloadTransactions:()=>{e(ue(d,!0,t.isShowDeletedReimbursementEnabled,!1,!0))},onBackClick:()=>{n("../",{relative:"path"})},onNavigateToSettings:()=>{n("../reimbursements/setup")},updateBulkActionList:o=>{e(rn(o))},removeAllTransactionsFromBulkActionList:()=>{e(Y())},onProceedForBulkActionClick:(o,a)=>{switch(o){case"delete":case"cancel":e(on(o,a??""));break;case"send_for_approval":e(De("send_for_approval")),t.navigate("./bulk-review");break;case"review":e(De("approve")),t.navigate("./bulk-review")}},onReimbursementApprovalRulesEventReceived:o=>{o.endsWith(be)&&e(sn(!1))},onEventReceived:o=>{o===it&&e(an())}}}))(jn(Un));function sa(){const e=Q(),t=ae(),n=J(),r=n.state,c=Ye(),[d,m]=h.useState(null),o=ct("/:tenantEmailDomain/reimbursements/bulk-review")!=null;h.useEffect((()=>{if(r?.tab!=null&&r?.subTab!=null){const S=qt(r.tab.toString());S!=null?t(Ze(S)):console.log("Warning:Not a valid remiListTab");const G=Yt(r.subTab.toString());G!=null?t(Ge(G)):console.log("Warning:Not a valid remiListSubTab")}return()=>{t(Y())}}),[]);const{useFeatureGate:a}=oe(),{isFeatureEnabled:i}=a(x.isShowDeletedBillsFeatureEnabled),{isFeatureEnabled:l}=a(x.isShowDeletedReimbursementsFeatureEnabled),{isFeatureEnabled:b}=a(x.isBillPayCommentingEnabled),{isFeatureEnabled:y}=a(x.isReimbursementCommentingEnabled),{isFeatureEnabled:f}=a(x.isReimbursementBulkActionEnabled),B=L.getSignedInUser(),u=A((S=>V(S))),[T,D]=h.useState(!1),[j,v]=h.useState(!1),k=le(),E=k?.loggedInUserRole?.includes("admin")===!0,I=A((S=>ze(S,z,f))),{areTenantIdsInSync:g}=Tn(),F=I.fetchState,{isAiCfoAccessEnabled:$,onAskAiCfoClick:M}=Re({mobileExploreReferrer:"Reimbursement List"});if(Xe({isDataReady:F==="Completed"}),h.useEffect((()=>{!j&&g&&(v(!0),t(ue(z,!0,l,!1,!0)))}),[j,z,t,g]),B==null)throw Error("Can't access address page without signing in...");const R=!!u?.userRole&&Kt(u),p=Se(k?.loggedInUserRoleMap),N=Ie(k?.loggedInUserRoleMap),O=!!u.userReimbursementInfo?.isReimbursementTOSAccepted,Z=!!u.companyReimbursementInfo?.info?.isReimbursementEnabled,W=!!u.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,H=A((S=>Le(S.companyState,u.companyId))),X=H?.company.featuresActivationInfo.connectedAccountProvider,Ae=S=>{D(S)},{isFeatureEnabled:ot}=a(x.isDebitCardFeatureEnabled),rt=Ve(ot,u),lt=We(u),{remisProcessed:te,remisProcessing:ve}=A((S=>Jt(S)));h.useEffect((()=>{te===ve&&d!=null&&(t(Xt({messageSection:"reimbursement_bulk_processed",messageText:"success",type:"success",showStatusIcon:!0,variables:[{variableName:"_report_",variableValue:te>1?me.texts.reports2:ta.report},{variableName:"_has_",variableValue:te>1?me.texts.have:me.texts.has},{variableName:"_action_",variableValue:Qt(d)}]})),t(en()),setTimeout((()=>{t(ue(z,!0,l,!1,!0,!0))}),3e3),m(null))}),[te,ve]);const mt={events:u.companyId!=null?[`private-encrypted-${u.companyId}.${it}`,`private-encrypted-${u.companyId}.${be}`]:[],eventCallback:(S,G,ke)=>{S.endsWith(be)?ke.onReimbursementApprovalRulesEventReceived?.(S):G.entity_type==="reimbursement"&&(m(G.operation_type),ke.onEventReceived(S))}};return n.pathname.endsWith("/reimbursements/")||n.pathname.endsWith("/reimbursements")||n.pathname.endsWith("/reimbursements/bulk-review")?rt===!0||lt===!0?s.jsx(tt,{}):Z&&(!R||p)||N&&O?s.jsxs(s.Fragment,{children:[F==="Completed"?s.jsx(re,{analytics:C,onLoad:S=>(G=>G.trackPageLoaded(Qe.Event.reimbursementHome))(S)}):null,s.jsx(at,{isAppContentDrawerOpen:T,handleDrawerToggle:Ae}),s.jsxs(na,{windowSize:c,children:[s.jsx(_n,{isOpen:o,drawerLeftMargin:new Dn(0,0,300,600),onClose:()=>{e(`/${u.tenantEmailDomain}/reimbursements`),t(Y())},children:s.jsx(ra,{onClick:S=>S.stopPropagation(),children:s.jsx(Qn,{tenantEmailDomain:u.tenantEmailDomain})})}),s.jsx(aa,{isShowDeletedBillsEnabled:i,isShowDeletedReimbursementEnabled:l,isBillPayCommentingEnabled:b,isReimbursementCommentingEnabled:y,location:n,navigate:e,currentTenant:u,period:z,isAdmin:E,isEmployee:R,entity:"reimbursement",onClickMenuIcon:()=>{Ae(!0)},createdByUserList:I.createdByUserList,createdByUserListFetchState:I.createdByUserListFetchState,isDownloadEnabled:I.isDownloadEnabled,connectedAccountProvider:X,isBulkActionEnabled:f,bulkSubmissionLimit:I.remiBulkSubmissionLimit,bulkSubmissionFetchState:I.remiListBulkActionInfo.bulkSubmissionFetchState,isAiCfoAccessEnabled:$,onAskAiCfoClick:M,...mt})]})]}):W&&p?s.jsx(P,{to:"../setup"}):k!=null&&He(u,k.loggedInUserRoleMap)?s.jsx(P,{to:"../promo"}):s.jsx(ye,{fetchState:"In-Progress"}):s.jsx(pe,{})}const ia=e=>`/${e}/reimbursements/setup`,oa=(e,t,n)=>{let r=`/${e}/reimbursement/${encodeURIComponent(t)}`;return n=="draft"&&(r+="/edit"),r},ra=_(Pn)`
65
- display: flex;
66
- min-height: 100%;
67
- flex-direction: column;
68
- `,la=ee((function(e,t){const{companyId:n}=t;return{reimbursementSetupView:un(e,n),analytics:C,videoUrl:"https://player.vimeo.com/video/814821498?h=e7fd11e13e&badge=0&autopause=0&player_id=0&app_id=122963"}}),(function(e,t){const{companyId:n,navigate:r}=t;return{onSetupButtonClick:()=>{e(bn(n))},onCreateNewRemiButtonClick:()=>{e(pn(t.userRoleId))},onBackClick:()=>{r("../..",{relative:"path"})},onSetupReimbursementSuccess:()=>{t.isEmployee?r("../../reimbursement/new",{relative:"path"}):r("../reimbursements/setup",{relative:"path"})}}}))(Ln),ma=()=>{const e=$n(),t=Q(),n=J(),{tenantEmailDomain:r}=ie(),c=et(),[d,m]=h.useState(!1),o=A((v=>V(v))),a=L.getSignedInUserTenant(r)?.companyId??o.companyId,i=L.getSignedInUser(),l=o.userRoleId,b=!!o.userRole?.includes("reimbursements_user"),y=le(),f=Se(y?.loggedInUserRoleMap),B=Ie(y?.loggedInUserRoleMap),u=!!o.userReimbursementInfo?.isReimbursementTOSAccepted,T=!!o.companyReimbursementInfo?.info?.isReimbursementEnabled,D=!!o.companyReimbursementInfo?.info?.isReimbursementTOSAccepted,j=v=>{m(v)};if(i==null)throw Error("Can't access reimbursement promo page without signing in...");return T&&B&&u?s.jsx(P,{to:"../../../reimbursements"}):D&&f?s.jsx(P,{to:"../../reimbursements/setup"}):o.companyReimbursementInfo&&!D||o.userReimbursementInfo&&B&&u===!1?s.jsxs(s.Fragment,{children:[s.jsx(re,{analytics:C,onLoad:v=>(k=>k.trackPageLoaded(Qe.Event.reimbursementPromoPage))(v)}),s.jsx(at,{isAppContentDrawerOpen:d,handleDrawerToggle:j}),s.jsx(la,{companyId:a,navigate:t,meetingUrl:e("reimbursement_promo"),location:n,userReimbursementInfo:o.userReimbursementInfo,userRoleId:l,isEmployee:b,onClickMenuIcon:()=>{j(!0)}})]}):s.jsx(ye,{fetchState:"In-Progress",style:{backgroundColor:c.colors.grey5}})};function Oa(){const e=A((H=>V(H))),t=le(),n=!!e.company?.companyReimbursementInfo.isReimbursementEnabled,r=et(),c=!!e.company?.companyReimbursementInfo.isReimbursementTOSAccepted,d=!!e.userReimbursementInfo?.isReimbursementTOSAccepted,{useFeatureGate:m}=oe(),{isFeatureEnabled:o}=m(x.isChargeCardFeatureEnabled),{isFeatureEnabled:a}=m(x.isDebitCardFeatureEnabled),i=Ve(a,e),l=We(e),b=e?.userRole!=null&&gn(e?.userRole),y=(e?.company==null||e.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!b)&&hn(t?.loggedInUserRoleMap),f=fn(t?.loggedInUserRoleMap),B=e?.company==null||e.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!b,u=Se(t?.loggedInUserRoleMap),T=B&&u,D=!!e.company?.companyZeniAccountInfo?.isZeniAccountEnabled&&!b,j=D&&Sn(t?.loggedInUserRoleMap),v=Mn(e,o,a)&&!b,k=v&&In(t?.loggedInUserRoleMap),E=yn(t?.loggedInUserRoleMap),I=Rn(t?.loggedInUserRoleMap),g=An(t?.loggedInUserRoleMap),F=D&&I,$=e.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified"&&!b&&g,M=vn(t?.loggedInUserRoleMap),R=kn(t?.loggedInUserRoleMap),p=Ie(t?.loggedInUserRoleMap),N=v&&M,{tenantEmailDomain:O}=ie(),Z=J(),W=n===!0&&(u||p&&d);return s.jsxs(dt,{children:[Z.pathname.includes("/reimbursements")?s.jsxs(s.Fragment,{children:[s.jsx(w,{path:"verification",element:s.jsx(Ue,{isBillPayAdminLevelAccess:y,isUserHasOnlyBillPayAccess:f,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:k,isUserHasOnlyCardAccess:E,productType:"reimbursement",type:"verification"})}),s.jsx(w,{path:"setup",element:s.jsx(Ue,{isBillPayAdminLevelAccess:y,isUserHasOnlyBillPayAccess:f,isReimbursementAdminLevelAccess:T,isZeniAccountAdminLevelAccess:j,isChargeCardAdminLevelAccess:k,isUserHasOnlyCardAccess:E,productType:"reimbursement",type:"setup"})}),s.jsx(w,{path:"promo",element:s.jsx(ma,{})}),s.jsx(w,{path:"approval-rules/*",element:T?s.jsx(On,{}):s.jsx(Nn,{showZeniAccountRoute:F,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:p,showTreasuryRoute:$,isTenantBankingOnly:i,showChargeCardRoute:N,tenantEmailDomain:O??""})}),W&&s.jsx(w,{path:"*",element:s.jsx(sa,{})}),(i===!0||l===!0)&&s.jsx(w,{path:"/*",element:s.jsx(tt,{})}),t!=null&&He(e,t?.loggedInUserRoleMap)&&s.jsx(w,{path:"*",element:s.jsx(P,{to:"../promo"})}),c&&u&&s.jsx(w,{path:"*",element:s.jsx(P,{to:"../setup"})})]}):Z.pathname.includes("/reimbursement")?s.jsxs(s.Fragment,{children:[s.jsx(w,{path:"new",element:s.jsx(Fe,{})}),s.jsx(w,{path:":reimbursementId",element:s.jsx(Jn,{})}),s.jsx(w,{path:":reimbursementId/edit",element:s.jsx(Fe,{})}),s.jsx(w,{path:"*",element:s.jsx(pe,{})})]}):s.jsx(w,{path:"*",element:s.jsx(ye,{fetchState:"In-Progress",style:{backgroundColor:r.colors.grey5,boxShadow:`0px 2px ${U.sp1} ${r.colors.dropShadowNormal}`}})}),s.jsx(w,{path:"*",element:s.jsx(pe,{})})]})}export{Oa as default};