@zeniai/web-app-ui 5.3.64-qa → 5.3.65-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 (163) hide show
  1. package/dist/assets/AccountMappingScreen-Bn4DiIps.js +9 -0
  2. package/dist/assets/ActualMatchingMatchDetailScreen-CyKLkfoX.js +1 -0
  3. package/dist/assets/AddressRoutes-CMlXZdpL.js +1 -0
  4. package/dist/assets/{AddressScreen-rwxaZTG1.js → AddressScreen-CPZX6Mga.js} +2 -2
  5. package/dist/assets/{AiCfoScreen-bINGDW9e.js → AiCfoScreen-BJhHFB_H.js} +5 -5
  6. package/dist/assets/AppDrawer-f4P22T-s.js +10 -0
  7. package/dist/assets/{BillPayApprovalRoutes-B_lv7T-J.js → BillPayApprovalRoutes-U0Rf3A34.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-0Sw-GQIA.js → BillPayRoutes-DGRh7xdO.js} +7 -7
  9. package/dist/assets/{BusinessVerificationPageScreen-D3HFVVs1.js → BusinessVerificationPageScreen-r1Ek9gB4.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-0le7ZJMu.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-GPeivNsL.js → ChargeCardRoutes-DJ2vt6zk.js} +6 -6
  12. package/dist/assets/CompanyPassportScreen-RZ6JI1G1.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-DmnnDeQw.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-DbeMqdYb.js +1 -0
  15. package/dist/assets/CustomerOnboardingRoutes-s6nbTZNu.js +30 -0
  16. package/dist/assets/{DashboardRoutes-DiVKBsiD.js → DashboardRoutes-BT8Ep0Zj.js} +4 -4
  17. package/dist/assets/DefaultTenantHome-Df11kb8h.js +1 -0
  18. package/dist/assets/DomesticWireDetailScreen-y2obrXna.js +18 -0
  19. package/dist/assets/DrawerScreen-oFb1moZ7.js +1 -0
  20. package/dist/assets/EntityDetailRoutes-BSBRT0xT.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-Ca8MyQ3F.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-hmh5qa1F.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-BO5xFdxD.js +1 -0
  24. package/dist/assets/InboxNotificationsProvider-J2K-16R3.js +1 -0
  25. package/dist/assets/InvoicingRoutes-CdrMbO5s.js +2 -0
  26. package/dist/assets/MagicLinkRoutes-BK5YhMpS.js +72 -0
  27. package/dist/assets/MagicLinkSignInScreen-CwfKFdEK.js +12 -0
  28. package/dist/assets/MobileAppDrawer-jPjMoXMc.js +1 -0
  29. package/dist/assets/NotFoundScreen-Cw8n2XQn.js +1 -0
  30. package/dist/assets/NotificationRoutes-bPTL-gx1.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-qHIRXDfy.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-iv8FS1Jh.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-Bp_f7EM0.js → PaymentLinkScreen-ssw1HUNS.js} +5 -5
  34. package/dist/assets/PeopleRoutes-gWK7cISf.js +22 -0
  35. package/dist/assets/PerformanceRoutes-Q-0RiFCz.js +1 -0
  36. package/dist/assets/{Preview-Cqz8sG2s.js → Preview-DB5CbRio.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-TwPTSdM4.js → QBOConnectionScreen-CGXzaY9Z.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-C_sgAcum.js +1 -0
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-NNjpXxDw.js → ReimbursementApprovalRuleDetailScreen-BaabHenl.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-uxVKhJh3.js +68 -0
  41. package/dist/assets/{ReportsRoutes-LNVh_-sv.js → ReportsRoutes-DO9Wko2u.js} +1 -1
  42. package/dist/assets/RewardsRoutes-CpyMm_K4.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BtoKhMiB.js → ScheduleDetailsPrepaidExpensesScreen-DMzBHsBi.js} +5 -5
  44. package/dist/assets/ScreenRoutes-2kGhSSY5.js +2 -0
  45. package/dist/assets/{SettingsRoutes-C4j0IBI2.js → SettingsRoutes-DLS1pb7Z.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-7E5X1hE5.js → SetupPagesScreen-LpdfT-pH.js} +5 -5
  47. package/dist/assets/SignInScreen-D0AGVtSB.js +1 -0
  48. package/dist/assets/SignOutScreen-DqG7ICcF.js +9 -0
  49. package/dist/assets/{TaskListScreen-lzy6FFpY.js → TaskListScreen-Mlh19Bfa.js} +2 -2
  50. package/dist/assets/TaskRoutes-BLQqIb0y.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-B7iSSfjs.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-CeJRenTr.js → TransactionDetailScreen-DSLjb6UM.js} +2 -2
  53. package/dist/assets/TransactionListRoutes-Bw5UrSgh.js +1 -0
  54. package/dist/assets/{TreasuryRoutes-BjSaj-AP.js → TreasuryRoutes-CssMsW2Q.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-CeQ2Hysa.js → VendorsRoutes-owMMCmOI.js} +10 -10
  56. package/dist/assets/WiseConfirmationScreen-DjHi2MKV.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-wpK9n9Q7.js → ZeniAccountRoutes-CmkqZp90.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-Cs6xkdf1.js +9 -0
  59. package/dist/assets/{accountMappingHelper-Gh8rpbjD.js → accountMappingHelper-mjWJVrZb.js} +1 -1
  60. package/dist/assets/{analytics-S5MhEivL.js → analytics-cC2XJoxx.js} +1 -1
  61. package/dist/assets/{analyticsHelper-vbAuZJHT.js → analyticsHelper-B0PgYJQ4.js} +1 -1
  62. package/dist/assets/{core-Cc7wW2EM.js → core-BBG4mxvC.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-DhqIXi_U.js → decodeURIComponentSafe-DgKmvHaP.js} +1 -1
  64. package/dist/assets/{dnd-DEyyKSEC.js → dnd-oIrpOltC.js} +1 -1
  65. package/dist/assets/{empty-CjY9w6q2.js → empty-BVUnugO_.js} +1 -1
  66. package/dist/assets/{empty-6MFM8UPN.js → empty-zUa_Ywzm.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-MGXFhhLz.js → emptyVideoElement-WG4m8gNp.js} +1 -1
  68. package/dist/assets/epic-Du6qCFYI.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-BkZxz0F-.js +1 -0
  70. package/dist/assets/getLocaleForTenant-DnBPPnzL.js +1 -0
  71. package/dist/assets/{index-Cm43WhAF.js → index-B9QH_oKn.js} +2 -2
  72. package/dist/assets/{index-DpnxiqBj.js → index-Bgwcwudg.js} +1 -1
  73. package/dist/assets/{index-CFXYM6OK.js → index-BhDgyETA.js} +15538 -15403
  74. package/dist/assets/{index-ldlm2cjp.js → index-BlZF-J3g.js} +1 -1
  75. package/dist/assets/{index-D2oCZR3F.js → index-CD8RychW.js} +1 -1
  76. package/dist/assets/{index-gtGWrJ79.js → index-CyCQjJen.js} +1 -1
  77. package/dist/assets/{index-BZ6qOKkD.js → index-DlbH0-p0.js} +1 -1
  78. package/dist/assets/{index-2QCkbhu2.js → index-lbu92FYh.js} +1 -1
  79. package/dist/assets/{lexical-DXgKWO29.js → lexical-BRrdO5Cu.js} +1 -1
  80. package/dist/assets/{liveblocks-CgHUgeBY.js → liveblocks-CzCs-qU3.js} +1 -1
  81. package/dist/assets/{lottie-C1A2hiZE.js → lottie-ULJlrwjP.js} +1 -1
  82. package/dist/assets/{mui-C4zFSCiU.js → mui-B2F_PvWe.js} +1 -1
  83. package/dist/assets/{pathToGoBack-C17GqrA7.js → pathToGoBack-e0pJACvC.js} +1 -1
  84. package/dist/assets/{pdf-rXyPRm1U.js → pdf-CeVn9A9c.js} +3 -3
  85. package/dist/assets/{pdf-lib-CsM74zBq.js → pdf-lib-DiMa7ymi.js} +1 -1
  86. package/dist/assets/{plaid-vsHcqLdj.js → plaid-BWZxX3Bn.js} +1 -1
  87. package/dist/assets/{pusher-C0EhdUPA.js → pusher-wcP4-1ih.js} +1 -1
  88. package/dist/assets/{react-CzfY0Vx3.js → react-3Jh1nOTX.js} +1 -1
  89. package/dist/assets/{react-DG8YneWb.js → react-BrDYknqm.js} +1 -1
  90. package/dist/assets/{react-Yy9ZuxR6.js → react-CGMaXwI-.js} +1 -1
  91. package/dist/assets/{react-BU_8yW5D.js → react-Chuw6ptT.js} +1 -1
  92. package/dist/assets/{react-CEepHjWP.js → react-D7hd8riP.js} +1 -1
  93. package/dist/assets/{react-Gc0eJCMR.js → react-Dv-IwMT5.js} +1 -1
  94. package/dist/assets/{recharts-DJGeJ2v_.js → recharts-CzGMTm3v.js} +1 -1
  95. package/dist/assets/{routePaths-BvBrBOWH.js → routePaths-BvbR2--r.js} +1 -1
  96. package/dist/assets/{sentry-DSWD_gIh.js → sentry-CWp8Ph3h.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-kLnY55Qt.js → stripSplatSuffix-BWJSV6oD.js} +1 -1
  98. package/dist/assets/{url-DCbpXgdk.js → url-CnTmKJO0.js} +1 -1
  99. package/dist/assets/{url-DUlo21cY.js → url-DV6CtKQ5.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-vmzr0KEG.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BsM9KkGc.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-BmnPs4uO.js +1 -0
  103. package/dist/assets/useChargeCardPusherEvents-BiuqGlTA.js +1 -0
  104. package/dist/assets/{useDeviceId-B5zol9VP.js → useDeviceId-Bzw6IkAe.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DMSbnQoq.js +1 -0
  106. package/dist/assets/useInitialThreadRequest-CdCPw0ds.js +1 -0
  107. package/dist/assets/useTaskManagerAccess-ljLSKJCt.js +1 -0
  108. package/dist/assets/useTaskManagerPusherEvents-BBtG4erb.js +1 -0
  109. package/dist/assets/{utils-DiIEQ7_h.js → utils-u0mlLj2I.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-DG1lldsp.js +25 -0
  111. package/dist/assets/{zeni-epic-state-BVJjEVAA.js → zeni-epic-state-FRanwwFO.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -4
  114. package/dist/assets/AccountMappingScreen-DivKdf2Z.js +0 -9
  115. package/dist/assets/ActualMatchingMatchDetailScreen-BVGeVheO.js +0 -1
  116. package/dist/assets/AddressRoutes-BokWmAg8.js +0 -1
  117. package/dist/assets/AppDrawer-Dp7qEJuM.js +0 -10
  118. package/dist/assets/CardsAiCfoScreen-oXR70NHe.js +0 -14
  119. package/dist/assets/CompanyPassportScreen-BQIdqUeH.js +0 -1
  120. package/dist/assets/ConnectionAuthScreen-B6OliLVm.js +0 -11
  121. package/dist/assets/CustomerOnboardingAuthScreen-CBVP8bsG.js +0 -1
  122. package/dist/assets/CustomerOnboardingRoutes-C0r1dw1S.js +0 -30
  123. package/dist/assets/DefaultTenantHome-BrlnSikW.js +0 -1
  124. package/dist/assets/DomesticWireDetailScreen-sF9fArJp.js +0 -18
  125. package/dist/assets/DrawerScreen-_LTFqCkp.js +0 -1
  126. package/dist/assets/EntityDetailRoutes-4B2Yzc2k.js +0 -1
  127. package/dist/assets/ExpenseAutomationRoutes-BO6oNRaR.js +0 -38
  128. package/dist/assets/FeaturePreviewScreen--_B7whPE.js +0 -1
  129. package/dist/assets/HubSpotOAuthCallbackScreen-DYtx9CHZ.js +0 -1
  130. package/dist/assets/InboxNotificationsProvider-CYNlrTK-.js +0 -1
  131. package/dist/assets/InvoicingRoutes-B76qsOVo.js +0 -2
  132. package/dist/assets/MagicLinkRoutes-BLMLAWL4.js +0 -72
  133. package/dist/assets/MagicLinkSignInScreen-ul8q5KIh.js +0 -12
  134. package/dist/assets/MobileAppDrawer-B_iTAp0X.js +0 -1
  135. package/dist/assets/NotFoundScreen-ytl2lDpJ.js +0 -1
  136. package/dist/assets/NotificationRoutes-CHchBCXf.js +0 -1
  137. package/dist/assets/OAuthConsentScreen-ByZnDGsv.js +0 -1
  138. package/dist/assets/PandLWithForecastRoutes-CEbI4eNj.js +0 -1
  139. package/dist/assets/PeopleRoutes-Bnjxv-wy.js +0 -22
  140. package/dist/assets/PerformanceRoutes-D_c4D-Lq.js +0 -1
  141. package/dist/assets/ReimbursementApprovalRoutes-WuV-IA60.js +0 -1
  142. package/dist/assets/ReimbursementRoutes-VHBLpzUI.js +0 -68
  143. package/dist/assets/RewardsRoutes-CoqgpEpv.js +0 -1
  144. package/dist/assets/ScreenRoutes-59q3MUGL.js +0 -2
  145. package/dist/assets/SignInScreen-CEUScjMX.js +0 -1
  146. package/dist/assets/SignOutScreen-BIBuRC_E.js +0 -9
  147. package/dist/assets/TaskRoutes-DiG1t9-7.js +0 -9
  148. package/dist/assets/TransactionDetailRoutes-B0iRCFEi.js +0 -1
  149. package/dist/assets/TransactionListRoutes-YHpSLzO6.js +0 -1
  150. package/dist/assets/WiseConfirmationScreen-DgytZSXe.js +0 -12
  151. package/dist/assets/ZeniAccountStatementScreen-DbrLHVIs.js +0 -9
  152. package/dist/assets/epic-D9Y6xcsI.js +0 -2
  153. package/dist/assets/expenseAutomationHelper-iXuIUZiF.js +0 -1
  154. package/dist/assets/getLocaleForTenant-rFLZBDSf.js +0 -1
  155. package/dist/assets/useActualMatchingMatchDetail-CF9oxT8n.js +0 -1
  156. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CDkZMoxt.js +0 -1
  157. package/dist/assets/useAskAiCfoHostNavButtonProps-QQl24-IT.js +0 -1
  158. package/dist/assets/useChargeCardPusherEvents-CXbFOxvL.js +0 -1
  159. package/dist/assets/useEmailConnectResultRefresh-Dd25HleM.js +0 -1
  160. package/dist/assets/useInitialThreadRequest-DIgkNFzN.js +0 -1
  161. package/dist/assets/useTaskManagerAccess-P-CWGdcX.js +0 -1
  162. package/dist/assets/useTaskManagerPusherEvents-BREP8CYU.js +0 -1
  163. package/dist/assets/withTransactionSidePanel-CF9KOU3s.js +0 -25
@@ -0,0 +1,38 @@
1
+ import{j as k}from"./liveblocks-CzCs-qU3.js";import{u as ge,h as nt,g as be,j as F,i as Be,t as Jn,l as Yn,n as Hn,o as We,N as Wn}from"./core-BBG4mxvC.js";import{fI as ke,a1a as Kn,q3 as Me,Uk as Qn,A9 as Xn,a1b as Zn,a1c as es,a1d as ts,a1e as Ct,a1f as Qe,gk as Tt,a1g as ia,eY as as,g3 as ns,a1h as la,a1i as Xe,qW as ss,uX as os,gV as cs,gT as is,a1j as ls,r7 as rs,rg as ds,qe as us,qs as Ra,gS as ue,gU as ms,a1k as ps,qO as Da,rh as hs,qp as Ss,qk as gs,v1 as Cs,gR as Oe,a1l as tt,Cj as Fa,MG as _a,a1m as Ma,FE as Oa,a1n as fs,f0 as Is,f2 as ks,sY as Pt,X4 as ra,X6 as bs,m5 as Ts,X7 as Ps,mc as ys,dm as vs,DC as yt,a1o as Es,a1p as As,a1q as xs,a1r as ws,fp as vt,sM as da,WZ as Rs,a1s as Ds,a1t as Fs,me as _s,a1u as Ms,Rm as Os,md as Us,m2 as Bs,qH as Ua,rm as at,tz as Ba,tV as Vs,Ua as Va,rl as ua,ro as ja,rq as js,bF as zs,nB as Ls,ny as $s,rp as Ze,rn as Se,a1v as Gs,rH as ma,a1w as Ns,a1x as qs,sQ as Js,sR as Ys,WV as Hs,V$ as Ws,a0E as Ks,a1y as Qs,W$ as pa,W_ as Ke,a1z as ha,mt as Xs,a1A as Zs,a1B as eo,a1C as to,a1D as ao,qC as no,a1E as so,a1F as oo,a1G as co,rx as io,mg as lo,m7 as ro,a1H as uo,mf as Sa,Xh as mo,a1I as po,a1J as ho,uy as So,u9 as go,u8 as ft,a1K as Co,a1L as fo,a1M as Io,a1N as ko,nM as bo,br as To,nH as ga,nt as Po,a1O as yo,h2 as vo,nE as Eo,s_ as Ao,t0 as xo,sJ as wo,W2 as Ro,W3 as Do,F6 as Fo,F5 as _o,Fm as Mo,a1P as Ca,sP as Oo,sk as Uo,a1Q as Bo,s0 as Vo,s5 as jo,sg as zo,s3 as Lo,a1R as $o,rY as Go,sf as No,sV as qo,a1S as Jo,t6 as Yo,sD as Ho,tc as Wo,sI as Ko,rI as Qo,a1T as Xo,q_ as Zo,qy as ec,qF as fa,rs as tc,a1U as ac,a1V as nc,a1W as sc,a1X as oc,a1Y as cc,a1Z as ic,a1_ as lc,tg as rc,a1$ as dc,a20 as uc,a21 as Ia,uJ as mc,u0 as pc,tR as ka,tP as hc,a22 as Sc,tE as gc,tj as Cc,tS as fc,a23 as Ic,a24 as kc,tp as bc,a25 as Tc,tk as Pc,to as yc,tm as vc,tY as Ec}from"./zeni-epic-state-FRanwwFO.js";import za from"./NotFoundScreen-Cw8n2XQn.js";import{a as s,R as La}from"./sentry-CWp8Ph3h.js";import{n as Te,S as Ac}from"./mui-B2F_PvWe.js";import{c as Ve,m as H,j as W,p as ee,aq as $a,as as Ga,dO as xc,dP as wc,z as st,dQ as Rc,dR as Dc,dS as Fc,ae as Ue,dT as _c,dU as ba,ba as Ta,dV as Mc,a7 as Na,dW as Oc,l as et,a as Uc,dX as Bc,dY as Vc,Z as jc,_ as zc,dZ as Lc,d_ as $c,d$ as Gc,b4 as Nc,bs as qc,ab as Jc,b5 as Yc,b6 as Hc,G as Wc,w as Kc,e0 as Qc,av as Pa,e1 as Xc}from"./index-BhDgyETA.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-BmnPs4uO.js";import{g as ya,b as Zc,c as ei,h as ti,a as ai,i as ni,r as si,C as oi}from"./TransactionDetailScreen-DSLjb6UM.js";import{u as ci,a as ii}from"./useActualMatchingMatchDetail-vmzr0KEG.js";import{d as li}from"./decodeURIComponentSafe-DgKmvHaP.js";import{m as Ja,a as Ya}from"./expenseAutomationHelper-BkZxz0F-.js";import{u as Ha,a as Wa,w as ri}from"./withTransactionSidePanel-DG1lldsp.js";import{b as di,S as ui,a as mi,J as pi}from"./ScheduleDetailsPrepaidExpensesScreen-DMzBHsBi.js";import{s as va,i as Ka,h as hi,v as Si,c as gi}from"./routePaths-BvbR2--r.js";import{a as It}from"./accountMappingHelper-mjWJVrZb.js";import{D as Ci}from"./DrawerScreen-oFb1moZ7.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";import"./useInitialThreadRequest-CdCPw0ds.js";import"./stripSplatSuffix-BWJSV6oD.js";import"./pathToGoBack-e0pJACvC.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]="bb7c6e7b-e52a-46a2-89c5-53658d2067c5",t._sentryDebugIdIdentifier="sentry-dbid-bb7c6e7b-e52a-46a2-89c5-53658d2067c5")}catch{}})();const fi=()=>{const t=ge(),n=nt(),S=be(),g=F((p=>ke(p))),{useFeatureGate:d}=Ve(),{isFeatureEnabled:i}=d(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=d(H.aiAuditScorePercentage),A=F((p=>p.expenseAutomationViewState.selectedPeriodByTenantId)),l=F((p=>Kn(p,g.tenantId))),{isAiCfoAccessEnabled:v,onAskAiCfoClick:x}=qa({mobileExploreReferrer:"Month-End Close Overview"}),T=s.useCallback(((p,P,_=!1)=>{t(Me({tenantId:P,period:{month:p.month,year:p.year},refreshViewInBackground:_}))}),[]),C=s.useCallback((p=>{const P=S.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&W.trackMonthCloseAuditPage(p.month,p.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,P??null),t(Qn(g.tenantId,p))}),[g.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),f=A[g.tenantId],m=s.useCallback((()=>{const p=S.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&W.trackMonthCloseAuditPage(f.month,f.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,p??null),T(f,g.tenantId,!0)}),[T,f,g.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),z=ee(S.state?.pathnameStackToGoBack,S.pathname),w=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&f!=null){const p=l.monthEndCloseChecks.monthEndCloseCheckList.find((P=>P.progress<100));if(p!=null)return void n(`./${p.id}/${f.month}-${f.year}`,{state:{pathnameStackToGoBack:z,message:"comingFromOverview"}});n(`./month_end_insights/${f.month}-${f.year}`,{state:{pathnameStackToGoBack:z,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,f]),{areTenantIdsInSync:I}=$a();return Ga({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{f!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&I&&T(f,g.tenantId)}),[T,f,l.fetchState,g.tenantId,I]),s.useEffect((()=>{f!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&I&&t(Xn(f))}),[f,l.monthClosePerformanceTrendFetchStatus.fetchState,I]),s.useEffect((()=>{const p=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&m()}),3e5);return()=>clearInterval(p)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const p=S.state?.referrer;W.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,p??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),k.jsx(Ii,{children:k.jsx(xc,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:i,onMonthEndCheckClick:p=>{n(`./${p}/${f.month}-${f.year}`,{state:{pathnameStackToGoBack:z,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:C,handleReviewButtonClick:w,onBackClick:()=>{n("../../dashboard")},onReload:m,isAiCfoAccessEnabled:v,onAskAiCfoClick:x,aiAuditScorePercentageEnabled:r})})},Ii=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 ki({isFullView:t,matchId:n,onClose:S}){const{match:g,detailFetchState:d,handleOpenBill:i,handleApproveAndReverse:r,handleIgnoreMatchSuggestion:A,handleRefresh:l,handleUndoReversal:v,lastMatchResults:x,lastUndoResults:T,refreshStatus:C,ignoreStatus:f,matchAndReverseStatus:m,undoReversalStatus:z}=ci(n);return k.jsx(wc,{match:g,detailFetchState:d.fetchState,isRenderedInPanel:!t,isApproveInFlight:m.fetchState==="In-Progress",isIgnoreInFlight:f.fetchState==="In-Progress",isUndoInFlight:z.fetchState==="In-Progress",refreshStatus:C.fetchState,onNavigateBack:S,onOpenBill:i,onApproveAndReverse:r,onIgnoreMatchSuggestion:A,onRefresh:l,onUndoReversal:v,lastMatchResults:x,lastUndoResults:T})}const bi=/^match\/([^/?]+)$/,Ti=Wa({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const{useFeatureGate:n}=Ve(),{isFeatureEnabled:S}=n(H.isTransactionDetailSplitViewEnabled),{isFeatureEnabled:g}=n(H.isAccrualEnabled),d=(function(r=!0){const A=nt(),l=be(),v=Be(),x=Ja(v),T=Ha({childPathPattern:bi,enabled:r,listPath:x}),C=T.matchGroups[0]!=null&&T.matchGroups[0]!==""?li(T.matchGroups[0]):void 0,f=v.tenantEmailDomain??l.pathname.split("/").find(Boolean)??"",m=s.useRef({isOpen:T.isOpen,matchId:C});m.current={isOpen:T.isOpen,matchId:C};const z=s.useCallback((p=>{!T.isMobile&&r?m.current.isOpen&&m.current.matchId===p?T.closePanel():T.navigateToChild(`match/${encodeURIComponent(p)}`,{replace:m.current.isOpen}):A(`/${f}/expense-automation/actual-matching/${encodeURIComponent(p)}`)}),[A,T.isMobile,T.navigateToChild,T.closePanel,r,f]),w=s.useCallback((()=>{if(C==null)return;const p=ee(l.state?.pathnameStackToGoBack,`${l.pathname}${l.search}`);A(`/${f}/expense-automation/actual-matching/${encodeURIComponent(C)}`,{state:{pathnameStackToGoBack:p}})}),[l.pathname,l.search,l.state,C,A,f]),I=T.isOpen&&C!=null;return{closePanel:T.closePanel,isOpen:I,maximize:w,matchId:r&&I?C:void 0,openPanel:z}})(t&&g===!0&&S===!0),i=s.useMemo((()=>{if(d.isOpen&&d.matchId!=null)return k.jsx(ki,{isFullView:!1,matchId:d.matchId,onClose:d.closePanel},d.matchId)}),[d.closePanel,d.isOpen,d.matchId]);return{injectedProps:s.useMemo((()=>({closeMatchSidePanel:d.closePanel,isMatchPanelOpen:d.isOpen,matchPanelContent:i,matchPanelMatchId:d.matchId,openMatchPanel:d.openPanel})),[i,d.closePanel,d.isOpen,d.matchId,d.openPanel]),selectedItemId:d.matchId,sidePanel:{closePanel:d.closePanel,maximize:d.maximize}}}}),Pi=La.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:S,onFetchLinkTokenClick:g,onEstablishConnectionClick:d})=>{const i=ge(),{useFeatureGate:r}=Ve(),{isFeatureEnabled:A}=r(H.isReconV3Enabled),{isFeatureEnabled:l}=r(H.isReconciliationCombinedStatementEnabled),v=st.getSignedInUser(),x=F((y=>ke(y))),T=s.useMemo((()=>({userId:v?.userId??"",sessionId:v?.zeniSessionId??"",tenantId:x?.tenantId??""})),[v?.userId,v?.zeniSessionId,x?.tenantId]),{accountReconciliationsByAccountID:C,excludedAccountIDs:f,monthYearPeriod:m,statementUploadChosen:z}=t,w=C[n],I=s.useMemo((()=>Zn(C,n)),[C,n]),p=s.useMemo((()=>es(C)),[C]),P=s.useMemo((()=>ts(C,n)),[C,n]),_=s.useRef(!1),G=s.useCallback((y=>{_.current=y,ba(n,y)}),[n]),N=s.useCallback((y=>{i(Ct({accountId:n,selectedPeriod:m,dismissedToBackground:!0,backgroundCompletedSteps:y.completedSteps,startedAtMs:y.startedAtMs,totalDurationSeconds:y.totalDurationSeconds})),y.accountMappings!=null&&i(Qe({accountId:n,selectedPeriod:m,localData:{combinedStatementAccountMappings:y.accountMappings}})),w!=null&&requestAnimationFrame((()=>{_.current||i(Tt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Rc(w)}]}))}))}),[i,m,w,n]),q=s.useCallback((()=>{i(Ct({accountId:n,selectedPeriod:m,dismissedToBackground:!1}))}),[i,n,m]),h=s.useCallback((y=>{i(ia({accountId:n,selectedPeriod:m,backgroundCompletedSteps:y}))}),[i,m,n]),$=s.useCallback((()=>{i(ia({accountId:n,selectedPeriod:m,backgroundCompletedSteps:0})),i(Ct({accountId:n,selectedPeriod:m,dismissedToBackground:!1}))}),[i,m,n]);s.useEffect((()=>()=>{ba(null,!1)}),[]);const e=w?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??w?.accountReconEntity.statementMetaData?.statementUploadId,a=w?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,c=F((y=>a!=null&&a!==""?as(ns(y.userState,a)):"")),u=s.useCallback((()=>{i(la({accountId:n,selectedPeriod:m}))}),[i,n,m]),b=s.useCallback((()=>{i(la({accountId:n,selectedPeriod:m})),i(Xe({statementUploadChosen:!0}))}),[i,n,m]),E=(y,Z)=>{i(Cs(y,Z.split(".")[0]))},D=(y,Z)=>{if(Z===!0){const ne=w?.combinedStatementGroupId??w?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??w?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(ne!=null&&ne!=="")return void i(Ss({accountId:n,selectedPeriod:m,combinedStatementGroupId:ne,fileId:y}))}e!=null&&i(gs({accountId:n,selectedPeriod:m,fileId:y,statementUploadId:e}))},M=()=>{i(Xe({statementUploadChosen:!1}))},J=y=>{i(hs({accountId:n,selectedPeriod:m,payload:y,statementAccountScope:l===!0?w?.localData?.statementAccountScope??"single_account":"single_account"}))},Y=s.useCallback(((y,Z,ne)=>{i(ss({accountId:y,selectedPeriod:Z,statementUploadId:ne}))}),[i]),oe=s.useCallback(((y,Z,ne,Q,ce)=>{ce!=null&&ce!==""&&i(os(ce)),i(Q==null||Q===""?is({accountId:y,selectedPeriod:Z,statementUploadId:ne}):cs({accountId:y,selectedPeriod:Z,statementUploadId:ne,combinedStatementGroupId:Q}))}),[i]),ae=s.useCallback(((y,Z)=>{Z!==""&&i(ls({accountId:n,selectedPeriod:m,statementUpdateLocalData:y,statementUploadId:Z}))}),[i,n,m]),Pe=s.useCallback((()=>{e!=null&&i(w?.localData?.statementAccountScope!=="multi_account"?ds({accountId:n,selectedPeriod:m,statementUploadId:e}):rs({accountId:n,selectedPeriod:m,statementUploadId:e}))}),[i,w?.localData?.statementAccountScope,n,m,e]),ye=s.useCallback((y=>{e!=null&&i(us({accountId:n,selectedPeriod:m,statementUploadId:e,accountMappings:y}))}),[i,m,n,e]),ve=s.useCallback((()=>{i(Xe({statementUploadChosen:!0}))}),[i]),K=y=>{i(Qe({accountId:n,selectedPeriod:m,localData:{accountSource:y}}))},ot=y=>{i(Qe({accountId:n,selectedPeriod:m,localData:{statementAccountScope:y}}))},Ee=s.useCallback((()=>{i(Ra({accountId:n}))}),[i,n]),B=s.useCallback((y=>{i(ue(m,y,!0)),S()}),[i,m,S]),ct=s.useCallback((()=>{i(ms({accountId:n,selectedPeriod:m,statementProcessingFailed:!1})),i(ps({accountId:n,selectedPeriod:m}))}),[i,n,m]),Ae=s.useCallback((()=>{i(Da({accountId:n}))}),[i,n]),je=f.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(je!=null)return k.jsx(Ea,{children:k.jsx(Aa,{$isV3:A===!0,children:k.jsx(Dc,{excludedAccountReconciliation:je,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:A,onDismissClick:S,onIncludeIntoReconciliation:Ae})})});if(w!=null){const y=A===!0?k.jsx(Fc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:w,monthYearPeriod:m,onDismissClick:S,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:d,onEditFileName:E,onDeleteFile:D,onSelectSourceType:K,onSelectStatementAccountScope:ot,isReconciliationCombinedStatementEnabled:l===!0,ledgerAccounts:I,statementOverrideWarningAccountIds:P,unavailableLedgerAccountIds:p,onConfirmStatementMapping:ye,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:T,openFilePicker:z,onStatementUploadSuccess:J,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ee,onRetryParsing:Y,onFetchStatementParseInfo:oe,onReviewClicked:B,statementProcessingFailed:w.statementProcessingFailed,statementProcessingDismissedToBackground:w.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ct,onContinueInBackground:N,onClearStatementProcessingDismissedToBackground:q,onResetStatementProcessingProgress:$,onStatementProcessingProgressChange:h,onStatementFlowVisibilityChange:G,onReuploadStatement:ve,onStatementFormDataChange:ae,onStatementConfirmSave:Pe,reconciledByName:c,onDismissDateConflict:u,onReuploadAfterDateConflict:b,isReconV3Enabled:A}):k.jsx(_c,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:w,monthYearPeriod:m,onDismissClick:S,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:d,onEditFileName:E,onDeleteFile:D,onSelectSourceType:K,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:T,openFilePicker:z,onStatementUploadSuccess:J,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ee});return k.jsx(Ea,{children:k.jsx(Aa,{$isV3:A===!0,children:y})})}return null})),Ea=Te.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
12
+ `,Aa=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 yi({panelType:t,scheduleId:n,onClose:S,onCloseAfterDecision:g}){return k.jsx(Ei,{children:k.jsx(Ai,{children:vi(t,n,S,g)})})}function vi(t,n,S,g){switch(t){case"one_time_accrual":return k.jsx(pi,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:S});case"accrued_expenses":return k.jsx(mi,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:S,onPanelCloseAfterDecision:g});case"fixed_assets":return k.jsx(ui,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:S,onPanelCloseAfterDecision:g});case"prepaid_expenses":return k.jsx(di,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:S,onPanelCloseAfterDecision:g})}}const Ei=Te.div`
22
+ display: flex;
23
+ flex-direction: column;
24
+ height: 100%;
25
+ `,Ai=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
+ `,xi=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,wi=Wa({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(C=!0){const f=nt(),m=be(),z=ge(),w=Be(),I=Ha({childPathPattern:xi,enabled:C}),p=I.matchGroups[0],P=Ka(p)?p:void 0,_=I.matchGroups[1]!=null&&I.matchGroups[1]!==""?I.matchGroups[1]:void 0,G=I.isOpen&&P!=null&&_!=null,N=w.tenantEmailDomain??m.pathname.split("/").find(Boolean)??"",q=s.useRef({isOpen:G,scheduleId:_});q.current={isOpen:G,scheduleId:_};const h=s.useCallback(((e,a,c)=>{c!=null&&(a==="prepaid_expenses"||a==="fixed_assets")&&z(Oa({selectedJEScheduleKey:c})),!I.isMobile&&C?q.current.isOpen&&q.current.scheduleId===e?I.closePanel():I.navigateToChild(`schedule/${a}/${e}`,{replace:q.current.isOpen}):f(va(a,e,N),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[z,f,I.isMobile,I.navigateToChild,I.closePanel,C,N]),$=s.useCallback((()=>{if(P==null||_==null)return;const e=ee(m.state?.pathnameStackToGoBack,m.pathname);f(va(P,_,N),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[f,P,_,N,m.pathname,m.state]);return{closePanel:I.closePanel,isOpen:G,maximize:$,openPanel:h,panelType:G?P:void 0,scheduleId:G?_:void 0}})(t),S=s.useRef(null),[g,d]=s.useState(null),i=s.useMemo((()=>({registerPanelDirtyGuard:C=>{S.current=C}})),[]),r=s.useCallback((C=>{S.current?.isDirty()===!0?d((()=>C)):C()}),[]),A=s.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=s.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),v=s.useCallback(((C,f,m)=>{r((()=>n.openPanel(C,f,m)))}),[r,n.openPanel]),x=s.useMemo((()=>{if(g!=null)return{onCancel:()=>d(null),onDiscard:()=>{S.current=null,d(null),g()}}}),[g]),T=s.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return k.jsx(Mc.Provider,{value:i,children:k.jsx(yi,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:A,onCloseAfterDecision:()=>{S.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,A,i]);return{injectedProps:s.useMemo((()=>({closeSchedulePanel:A,isSchedulePanelOpen:n.isOpen,openSchedulePanel:v,schedulePanelContent:T,schedulePendingDiscardConfirmation:x})),[A,v,T,x,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:A,maximize:l}}}});function Ri({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:S,resetCustomerRequest:g}){const d=st.getSignedInUser();if(d==null)throw Error("Can't access Customer Request page without signing in...");const i=F((r=>fs(r,t,d)));return s.useEffect((()=>{g()}),[]),k.jsx(k.Fragment,{children:i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?k.jsx(Na,{fetchState:"In-Progress"}):k.jsx(Oc,{onCloseClick:n,addCustomerRequest:S,snippets:i.companyMonthEndReportTemplatesData,bulletPoints:i.zeniRequestsData??[]})})}const Di={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},Fi=()=>{const t=F((x=>Oe(x))),n=be(),{currentSelectedViewFetchState:S,currentSelectedView:g,selectedPeriod:d}=t,i=et(g),r=et(S.fetchState),A=t.jeSchedules.uiState.selectedPageTab??"schedules",l=et(A),v=s.useCallback((x=>{const T=n.state?.referrer;g==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?W.trackTransactionsReviewPage(d.month,d.year,t.transactionView.totalCountByTab.review,0,x,T??null):W.trackTransactionsAutoCategorisedPage(d.month,d.year,t.transactionView.totalCountByTab.autoCategorized,0,x,T??null)),g==="missing_receipts"&&W.trackMissingReceiptsPage(d.month,d.year,x,t.missingReceipts.transactions.length,T??null),g==="je_schedules"&&W.trackMonthCloseScheduleListPage(d.month,d.year,x,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.failedPostings.length,(C=>{const f={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return C.forEach((m=>{if(Is(m))f.oneTimeAccrualCount+=1;else switch(ks(m)){case"prepaid_expenses":f.prepaidCount+=1;break;case"fixed_assets":f.fixedAssetsCount+=1;break;case"accrued_expenses":f.accruedCount+=1}})),f})(t.jeSchedules.pendingReviewSchedules),Di[A],T??null),g==="flux_analysis"&&W.trackFluxAnalysisPage(d.month,d.year,x,_i(t.fluxAnalysis),T??null),g==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&W.trackInsightsEmailPage(d.month,d.year,x,"draft",t.auditSummary.auditScorePercentage,null,T??null)}),[d,t,A]);return s.useEffect((()=>{(r!==S.fetchState||g!==i||g==="je_schedules"&&l!=null&&A!==l)&&S.fetchState==="Completed"&&v(!1)}),[g,S.fetchState,i,A,l]),v},_i=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Mi,comma:xa,space:Oi}},dateFormat:Qa}=Wc.getLocalizedStrings(),wa=Ec,Ui=Yn((function(t,n){const{uncategorizedAccounts:S,vendorSearchAutoCompleteData:g,monthEndInsightsCustomerRequestData:d,monthEndInsightsPreviewMode:i,companyId:r,isMissingReceiptsBulkUploadEnabled:A,isTransactionActivityEnabled:l,newScheduleActiveType:v}=n,x=st.getSignedInUser(),T=t.tenantState.currentTenantId,C={userId:x?.userId??"",sessionId:x?.zeniSessionId??"",tenantId:T??""},f=Oe(t),{selectedTransactionCategorizationTab:m}=f,{searchTransactionsResults:z,searchTransactionsFetchState:w}=Ns(t),I=v==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:p,classListNestedAccountHierarchy:P,allDepreciationAccountListNestedAccountHierarchy:_,newScheduleLocalData:G,saveStatus:N}=qs(t,I);return{expenseAutomationViewSelector:f,accountListNestedAccountHierarchy:p,allDepreciationAccountListNestedAccountHierarchy:_,baseTransactionSearchFetchState:w,baseTransactionSearchResults:z,classListNestedAccountHierarchy:P,newScheduleLocalData:G,initialSelectedBaseTransaction:G.selectedBaseTransactionId!=null?Js(t.transactionState,Ys(G.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Hs(t),newScheduleSaveStatus:N,bulkUploadSelector:A===!0?f.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:g,authParams:C,receiptUploadEndpoint:`${Ue.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Pa}/transaction_attachments`,bulkUploadEndpoint:A===!0?`${Ue.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:m,selectedTransactionGroup:f.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:d,monthEndInsightsPreviewMode:i,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:x,uncategorizedAccounts:S,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:Ks(t.tenantState,T),downloadParams:{authParams:C,jeScheduleEndPoint:`${Pa}/jeScheduleReports`,timezone:Ws(),companyName:ke(t).companyName}}}),(function(t,n){const{themeState:S,isAccountingClassesEnabled:g,isCOTEnabled:d,isMissingReceiptsBulkUploadEnabled:i,location:r,vendorSearchAutoCompleteData:A,expenseAutomationViewSelector:l,currentTenant:v,newScheduleActiveType:x,uncategorizedAccounts:T,navigate:C,onClickCustomerRequest:f,handleEditClick:m,closeSchedulePanel:z,isSchedulePanelOpen:w,openSchedulePanel:I,setActivityLogTransactionId:p}=n,{selectedPeriod:P,currentSelectedView:_,reconciliation:{selectedAccountId:G}}=l,{accountSettingsView:N}=l.jeSchedules,q=Ua(P),h=at(q.start),$=at(q.end);return{onZeniLogoClick:()=>{S.toggle()},onUploadReceiptAttachment:e=>{W.trackMissingReceiptAttached(P.month,P.year),t(pc(e))},onUploadTransactionReceipt:(e,a,c,u,b,E)=>{t(Ia(e,a,{fetchState:"In-Progress"}));const D=()=>t(Ia(e,a,{fetchState:"Error"}));Xc(`${Ue.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,E,a,c,u,b).then((M=>{M!=null?t(mc(e,M)):D()})).catch(D)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const c=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(uc(e,a)),v!=null&&t(Me({tenantId:v.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,c,u)=>{t(dc(e,{fetchState:a,error:c})),c!=null&&t(Tt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:u!=null?Oi+Mi+u+xa:xa}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,c=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,u=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;c&&n.closeMatchSidePanel?.(),w===!0&&(c||u)&&z?.(),e.createdGroupCollapsed!=null?t(oc()):e.pendingGroupCollapsed!=null?t(cc()):e.failedGroupCollapsed!=null?t(ic()):e.selectedJETypeFilter!==void 0?t(lc(e.selectedJETypeFilter)):t(rc(e))},onUpdateMissingReceiptsUIState:e=>{t(sc(e))},onFetchMissingReceiptsList:()=>{$!=null&&h!=null&&t(ja({start:h,end:$},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...i===!0?{onBulkUploadFiles:e=>{t(vc(e))},onBulkUploadProgress:e=>{t(yc(e))},onBulkUploadSuccess:e=>{t(Pc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Tc(e))},onConfirmBulkUploadMatch:(e,a,c,u,b)=>{t(bc(e,a,c,u,b))},onBulkUploadConfirmMatchAcknowledged:()=>{t(kc())},onSetBulkUploadResultsTab:e=>{t(Ic(e))},onSetBulkUploadCompletedSubTab:e=>{t(fc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(ka({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(Cc())},onSearchTransactionsForManualMatch:(e,a)=>{t(wa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(wa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(gc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(Sc())},onFetchBulkUploadBatches:e=>{t(Ba(e))},onFetchMoreBatchDetails:()=>{t(hc())},onResetBulkUploadSort:()=>{t(ka({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(nc())},onSearchTextChanged:e=>{const a=l.currentSelectedView,c=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(ft({selectedTab:c,uiState:{searchString:e}})),$!=null&&h!=null&&t(Se(c,{start:h,end:$},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(ac({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(tc())},onClose:()=>{_==="reconciliation"&&G!=null&&t(fa({selectedAccountId:void 0})),C("../")},onBack:()=>{_==="reconciliation"&&G!=null&&t(fa({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(ec(e))},onSaveReconciliationReview:e=>{t(Zo(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,c=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:c,referrer:l.currentSelectedView}}),t(Va(e))},handleLogOutClick:()=>{const e=ee(r.state?.pathnameStackToGoBack,r.pathname);C("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:c,fixedAssetsAccount:u,accruedExpensesAccount:b}=a,E=It(N.prepaidExpensesAccountList,c.selectedOptions),D=It(N.fixedAssetsAccountList,u.selectedOptions),M=It(N.accruedExpensesAccountList,b.selectedOptions),J={selectedPrepaidExpensesAccountIds:E.map((Y=>Y.accountId)),selectedFixedAssetsAccountIds:D.map((Y=>Y.accountId)),selectedAccruedExpensesAccountIds:M.map((Y=>Y.accountId))};t(Xo({data:J}))},onSaveJeAccountSettingsClick:()=>{t(Qo())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:c,accumulatedDepreciationCategory:u,scheduleClass:b,scheduleExpenseCategory:E,vendor:D}=a,{allAccountList:M,allClassList:J,allDepreciationAccountList:Y}=l.jeSchedules,oe=A.entityAutoCompleteView.vendor.length>0?A.entityAutoCompleteView.vendor.find((K=>K.id===D?.selectedOption)):void 0,ae={id:oe?.zeniId??D?.selectedOption??"",name:oe?.name??D?.defaultOptions.find((K=>K.value===D?.selectedOption))?.label??"",logo:oe?.logo},Pe=E?.selectedOption!=null?M.find((K=>K.qboId===E.selectedOption)):void 0,ye=b?.selectedOption!=null?J.find((K=>K.classId===b.selectedOption)):void 0,ve=u?.selectedOption!=null?Y.find((K=>K.qboId===u.selectedOption)):void 0;t(Ko({scheduledJournalEntryID:e,localData:{jeScheduleID:c,scheduledJournalEntryID:e,updatedCategoryId:Pe?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:ve?.accountId,updatedVendor:{id:ae.id,name:ae.name}}}))},onRevertJeSchedule(e,a,c,u,b){t(Wo(e,a,c,u,b))},ignoreRecommendedJeSchedule(e,a,c,u){t(Ho(e,a,c,u))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(pa({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onCancelAutoComplete:()=>{t(Ke("common"))}},onPostJESchedule(e,a){t(Yo({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(Jo())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=gi(e,n.tenantEmailDomain),c=ee(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(qo({query:e,scheduleType:x==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const c=vt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(Ca({scheduleType:c,localData:a}))},onOpenMatchNewModal(){t(No())},onIgnoreMatchSuggestion(e,a,c){t(Go(e,a,c))},onCloseMatchNewModal(){t($o())},onClearMatchNewModal(){t(Lo())},onSearchMatchTransactions(e,a){t(zo(e,a))},onSearchMatchAccruals(e,a){t(jo(e,a))},onMatchAndReverse(e){t(Vo(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds,!0))},onUpdateActualMatchingUIState(e){t(Bo(e))},onUndoReversal(e,a){t(Uo(e,a))},onSaveSchedule(e,a){const c=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:u,allDepreciationAccountList:b}=l.jeSchedules,E=a.selectedAccount!=null?u.find((M=>M.qboId===a.selectedAccount)):void 0,D=a.selectedAccumulatedDepreciationCategory!=null?b.find((M=>M.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(Ca({scheduleType:c,localData:{...a,selectedAccount:E?.accountId,selectedAccumulatedDepreciationCategory:D?.accountId}})),t(Oo({scheduleType:c}))},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,c)=>{if((function(b,E){return E!=="accrued_expenses"})(0,c)&&t(Oa({selectedJEScheduleKey:a})),I!=null&&Ka(c))return void I(e,c,a);const u=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../../vendors/schedules/${c}/details/${e}`,{state:{pathnameStackToGoBack:u,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,c,u)=>{t(a!=="revert"?xo(e,c,u):Ao(e,c,u))},onOneTimeAccrualClick:e=>{if(I!=null)return void I(e,"one_time_accrual");const a=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},onOpenBill(e){if(n.tenantEmailDomain==null)return;const a=ii(e,n.tenantEmailDomain,n.location);n.navigate(a.pathname,{state:a.state})},improveMonthEndInsightsUsingZeniGPTClick:e=>{v!=null&&t(Eo(e,v.companyId,v.tenantId))},onClickCustomerRequest:f,setActivityLogTransactionId:p,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(vo())},onOpenFileAttachmentSnackBar:()=>{t(Tt({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,c,u,b)=>{v!=null&&t(ga(e,v.companyId,a,!0,c,u,{agentInsightEdits:b,tenantId:v.tenantId}))},saveMonthEndReport:(e,a,c,u,b)=>{v!=null&&t(ga(e,v.companyId,a,!1,c,u,{agentInsightEdits:b,tenantId:v.tenantId}))},onEditMonthEndInsightsClick:m,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:c,auditSummary:u}=l;v!=null&&u?.auditScorePercentage!=null&&(t(bo(v.companyId,e,v.tenantId)),W.trackInsightsEmailPage(c.month,c.year,!1,"draft",u.auditScorePercentage,To().format(Qa.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const c=l.transactionView.uiState.searchString??"",u=l.transactionView.transactions,b=u.findIndex((M=>M.id===e)),E=c.length>0?{resultPosition:b>=0?b+1:void 0,resultsCount:u.length,searchTerm:c}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,E);const D=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:D,message:"expenseAutomation",origin:"transaction_categorization",searchContext:E}})},setLocalDataForCategoryAndClass:(e,a,c,u,b,E,D,M,J,Y,oe,ae)=>{t(ko(e,a,c,u,T,b,E,D,M,J,Y,oe,ae))},onCancelAutoComplete:()=>{t(Ke("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(ha({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),$!=null&&h!=null&&(t(Se(e,{start:h,end:$},!1,!1)),t(Io(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),$!=null&&h!=null&&(t(fo(e)),t(Se("autoCategorized",{start:h,end:$},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),$!=null&&h!=null&&(t(Co(e)),t(Se(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:h,end:$},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(ft({selectedTab:e,uiState:a})),$!=null&&h!=null&&t(Se(e,{start:h,end:$},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(ft({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,c,u,b,E)=>{$!=null&&h!=null&&t(Se(e,{start:h,end:$},!0,c,a,u,b,E))},resetTransactionCategorizationLocalData:(e,a,c,u,b,E,D)=>{t(go(e,a,c,u,D??null,b,E,!1)),si(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,c,u,b)=>{t(Sa({selectedTab:e,transactionId:a,lineId:c,selectedTransaction:u,uncategorizedAccounts:T,updatedVendor:b,isAccountingClassesEnabled:g}))},onSaveUpdateTransactionCategorization:(e,a,c)=>{const u=r.state?.referrer;e==="autoCategorized"?W.trackTransactionsAutoCategorisedPage(P.month,P.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,u??null):W.trackTransactionsReviewPage(P.month,P.year,l.transactionView.totalCountByTab.review,a.length,!1,u??null),t(So(e,a,c)),ni(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(ho({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,c,u,b,E)=>{const{transactionId:D,transaction:M,lineIds:J}=a;E!=null&&t(mo({transactionId:D,customerUpdates:E})),t(po({selectedTab:u,transactionId:D.id,lineId:J[0],selectedTransaction:M,uncategorizedAccounts:T,updatedCustomer:E,selectedEntity:b,isAccountingClassesEnabled:g})),b!=null&&t(yt({entity:b,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:u,isFetchCOT:d}))},onFetchRecommendationsForEntityCategorization:(e,a,c,u,b,E)=>{const{transactionId:D,transaction:M,lineIds:J}=a;E!=null&&(t(lo({transactionId:D,vendorUpdates:{name:E.name,id:E.id?E.id:void 0}})),t(ro({vendorId:E.id?E.id:void 0,localData:{vendorName:E.name,vendorId:E.id?E.id:void 0}}))),E?.id?(t(Sa({selectedTab:u,transactionId:D.id,lineId:J[0],selectedTransaction:M,uncategorizedAccounts:T,updatedVendor:E,selectedEntity:b,isAccountingClassesEnabled:g})),b!=null&&t(yt({entity:b,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:u,isFetchCOT:d}))):t(uo({selectedTab:u,transactionId:D.id,lineId:J[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(Ze(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(Ze(P,!0,!1,null,!1,!1))},markAsReview:(e,a,c,u)=>{W.trackFluxAnalysisReviewed(c.month,c.year,u??!1,e),t(io(a,e,c,u??!1))},onUpdateFluxAnalysisUIState:e=>{t(co(e))},updateOperatingExpensesIdsForReview:e=>{t(oo({operatingExpenseIds:e,selectedPeriod:P}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=Si(e.id,e.qboId,n.tenantEmailDomain),c=ee(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(so({sectionId:e,selectedPeriod:P}))},onFetchReimbursementView:(e,a,c)=>{t(Ze(e,!0,!1,a,!0,c))},onReviewClicked:e=>{t(ue(P,e))},setOpenDrawerClicked:e=>{t(tt({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Fa("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const c=v?.companyId;c!=null&&(t(_a(e,c,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(Ma({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(tt({selectedDrawerAccountId:e})),t(Qe({accountId:e,selectedPeriod:P,localData:{accountSource:"bank_statement"}})),t(Xe({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(ue(P,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,c)=>{const u=e.vendor?.id;c&&u!=null&&t(Xs(u)),t(Zs({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,Pt("bill"));const a=ee(r.state?.pathnameStackToGoBack,r.pathname);C(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{C(-1)},onReconListPageScroll:e=>{t(ha({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(pa({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Qs({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(Ra({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Da({accountId:e}))}}}),((t,n,S)=>{const{isMissingReceiptsBulkUploadEnabled:g,...d}=S;return(function(i,r,A){return{...i,...r,...A,onUploadTransactionReceipt:(l,v,x,T,C)=>{r.onUploadTransactionReceipt(l,v,x,T,C,i.authParams)}}})(t,n,d)}))(Kc(Qc)),kt="newScheduleMode",bt="newScheduleType",Bi=wi(ri((function(t){const n=t.displayName??t.name??"Component",S=La.memo(t),g=d=>{const i=ge(),r=(function(){const I=ge(),p=F((P=>Oe(P).reconciliation.selectedDrawerAccountId));return{isOpen:p!=null,selectedAccountId:p,openPanel:s.useCallback((P=>{I(tt({selectedDrawerAccountId:P}))}),[I]),closePanel:s.useCallback((()=>{I(tt({selectedDrawerAccountId:void 0}))}),[I])}})(),A=F((I=>Oe(I).reconciliation)),l=F((I=>ke(I))),v=s.useCallback(((I,p)=>{i(Fa("expense_automation_reconcile",I,p))}),[i]),x=s.useCallback(((I,p)=>{const P=l?.companyId;P!=null&&(i(_a(I,P,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",p)),i(Ma({accountId:p,connectionInProgress:!0})))}),[i,l?.companyId]),T=s.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return k.jsx(Pi,{reconciliation:A,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:v,onEstablishConnectionClick:x})}),[r.isOpen,r.selectedAccountId,r.closePanel,A,v,x]),C=s.useMemo((()=>({reconPanelContent:T,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[T,r.isOpen,r.closePanel]),{useFeatureGate:f}=Ve(),{isFeatureEnabled:m}=f(H.isReconV3Enabled),z=s.useContext(Ta),w=s.useMemo((()=>r.isOpen?m===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:z),[r.isOpen,r.closePanel,r.selectedAccountId,z,m]);return k.jsx(Ta.Provider,{value:w,children:k.jsx(S,{...d,...C})})};return g.displayName=`withReconSidePanel(${n})`,g})(Ti((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:S,matchPanelContent:g,isMatchPanelOpen:d,matchPanelMatchId:i,openMatchPanel:r,openTransactionPanel:A,panelContent:l,reconPanelContent:v,reconSidePanelIsOpen:x,isSchedulePanelOpen:T,closeSchedulePanel:C,openSchedulePanel:f,schedulePanelContent:m,schedulePendingDiscardConfirmation:z,sidePanelIsFullView:w,sidePanelIsOpen:I})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:P}=Uc(),_=Bc(),{isOpen:G}=Vc(),N=nt(),q=be(),h=ge(),{isAiCfoAccessEnabled:$,onAskAiCfoClick:e}=qa({mobileExploreReferrer:"Transaction categorization"}),a=s.useCallback((()=>{d===!0&&t?.(),I===!0&&w!==!0&&S?.()}),[t,S,d,w,I]),c=F(Es);s.useEffect((()=>{c!=null&&(i===c&&a(),h(As()))}),[c,a,h,i]);const u=F(xs);s.useEffect((()=>{u!=null&&(i===u&&a(),h(ws()))}),[u,a,h,i]);const{areTenantIdsInSync:b}=$a(),E=Fi(),D=jc(),[M,J]=s.useState(!1),[Y,oe]=Jn(),ae=s.useCallback((o=>{oe((R=>{const L=new URLSearchParams(R);return o==null?(L.delete(kt),L.delete(bt),L):(L.set(kt,o.scheduleDetailsMode),L.set(bt,o.scheduleType),L)}),{replace:!0})}),[oe]),[Pe,ye]=s.useState(void 0),ve=s.useCallback(((o,R,L)=>{const j=vt(o);ye(j),ae({scheduleDetailsMode:R,scheduleType:o}),h(da({scheduleType:j==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:L}))}),[h,ae]),K=s.useMemo((()=>{const o=Y.get(kt),R=Y.get(bt);return o!=null&&R!=null?{scheduleDetailsMode:o,scheduleType:R}:void 0}),[Y]),ot=s.useCallback((o=>{ae(o),o!=null&&h(da({scheduleType:vt(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[h,ae]),Ee=F((o=>ra(o))),B=F((o=>ke(o))),[ct,Ae]=s.useState(!1),[je,y]=s.useState(!1),[Z,ne]=s.useState([]),[Q,ce]=s.useState(null),ie=s.useCallback((()=>{ce(null)}),[]),Et=Q?.contentType==="activity"?Q.detail.transactionId:void 0,it=s.useCallback((o=>{o!=null?(p&&P(!1),_(),a(),ce({contentType:"activity",detail:{transactionId:o}})):ce((R=>R?.contentType==="activity"?null:R))}),[a,p,_,P]),Xa=s.useCallback((o=>{p&&P(!1),_(),a(),ce({contentType:"transfer",detail:o})}),[a,p,_,P]),Za=s.useCallback((()=>{_(),ie(),a(),e()}),[a,ie,e,_]),At=s.useRef(p);s.useEffect((()=>{p===!0&&At.current===!1&&(_(),ie(),a()),At.current=p}),[a,ie,p,_]);const xt=s.useRef(G);s.useEffect((()=>{G===!0&&xt.current===!1&&(p&&P(!1),ie(),d===!0&&t?.(),I===!0&&w!==!0&&S?.()),xt.current=G}),[ie,t,S,G,p,d,P,w,I]);const ze=I===!0&&w!==!0||d===!0,wt=s.useRef(ze);s.useEffect((()=>{ze&&!wt.current&&(p&&P(!1),_(),ie()),wt.current=ze}),[ie,p,ze,_,P]);const[Rt,en]=s.useState(!1),Dt=s.useRef(!1),{selectedTab:tn}=Be(),{tenantEmailDomain:lt}=Be(),[rt,Ft]=s.useState(q.state?.message==="comingFromTransactionDetail"),_t=q.state?.message==="comingFromOverview",an=zc(),dt=st.getSignedInUser(),{useFeatureGate:le}=Ve(),{isFeatureEnabled:Mt}=le(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:xe}=le(H.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:ut}=le(H.isTransactionActivityEnabled),{isFeatureEnabled:me}=le(H.isAccrualEnabled),{isFeatureEnabled:Ot}=le(H.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:nn}=le(H.isProjectsTransactionsEnabled),{isFeatureEnabled:sn}=le(H.isReconV3Enabled),on=s.useCallback((o=>{const R=Pt(o.transactionType??(o.view==="reconciliation"?"bill":"expense")),L=ee(q.state?.pathnameStackToGoBack,q.pathname),j=new URLSearchParams({view:"full"});o.threadId!=null&&j.set("thread_id",o.threadId),o.entityType!=null&&j.set("entity_type",o.entityType),N(`/${lt}/transaction/${encodeURIComponent(R)}/${o.transactionId??o.entityId}?${j.toString()}`,{state:{pathnameStackToGoBack:L,message:"expenseAutomation"}})}),[N,lt,q.state,q.pathname]),cn=F((o=>Rs(o,"common"))),V=F((o=>Oe(o))),{categoryOptions:ln,paymentAccountNames:rn}=F((o=>Ds(o.accountState))),dn=F((o=>Fs(o.classState))),{monthEndCloseChecksView:X,currentSelectedView:O,selectedPeriod:U,selectedTransactionCategorizationTab:mt,currentSelectedViewBackgroundRefreshFetchState:un,currentSelectedViewFetchState:re,jeSchedules:pt,reconciliation:Ut}=V;Zc(O==="transaction_categorization");const mn=V.transactionView.saveStatus.fetchState,Le=V.transactionView.transactions,Bt=s.useRef(Le);Bt.current=Le;const Vt=F((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),jt=F((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),zt=s.useRef(Vt);zt.current=Vt;const Lt=s.useRef(jt);Lt.current=jt;const $e=F((o=>{const R=o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return R!=null?o.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[R]?.filters:void 0})),$t=s.useRef("");s.useEffect((()=>{if(O!=="transaction_categorization")return;const o=V.transactionView.uiState.searchString??"";if(re.fetchState!=="Completed"||o.length===0||o===$t.current)return;$t.current=o;const R=$e!=null?Lc($e):0,L=$e?.categories.filter((j=>j.values.length>0&&String(j.values[0]??"").trim()!=="")).map((j=>`${j.field}:${j.values.join(",")}`))??[];W.trackAiCloseTransactionSearch({filtersApplied:L,hasResults:Le.length>0,isFiltered:R>0,resultsCount:Le.length,searchTerm:o,searchType:"free_text"})}),[O,re.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,$e]);const de=ei(mn,(()=>{const o=[],R=Lt.current,L=zt.current,j=L!=null&&R!=null?L[R]:void 0;if(j?.transactionReviewLocalDataById!=null)for(const fe of Object.values(j.transactionReviewLocalDataById)){const te=fe?.transactionReviewLocalData?.lineItemById;if(te!=null)for(const ht of Object.values(te)){const _e=ht?.account;_e?.accountId!=null&&o.push(_e.accountId)}}const Ce=Bt.current;for(const fe of Ce)for(const te of fe.lines??[])"account"in te&&te.account?.accountId!=null&&o.push(te.account.accountId);return o}));s.useEffect((()=>{O==="transaction_categorization"&&I!==!0||it(void 0)}),[O,it,I]),s.useEffect((()=>{x===!0&&n?.()}),[O,Ut.selectedAccountId]);const pn=V.transactionView.selectedTransactionCategorizationCompletedSubTab,hn=V.transactionView.selectedTransactionGroup,Ge=`${mt}|${pn}|${hn}`,Ne=s.useRef(null),Gt=s.useRef(null);s.useEffect((()=>{Ne.current!==null?Ne.current!==Ge&&(Ne.current=Ge,O==="transaction_categorization"&&ie()):Ne.current=Ge}),[ie,O,Ge]);const Sn=F((o=>Et==null?void 0:_s(o.transactionState,Et))),pe=Sn?.qboId,Nt=F((o=>pe==null?void 0:Ms(o,pe)));s.useEffect((()=>{pe!=null&&h(Os(pe))}),[h,pe]);const{createTransferEntryStatus:qt,creditCardTransferAccountsList:Jt,transferAccounts:Yt}=V.transactionView,Ht=s.useCallback((o=>ti(h,o)),[h]),Wt=s.useMemo((()=>O!=="transaction_categorization"||Q==null?null:Q.contentType==="activity"?ut===!0?k.jsx($c,{activityLogView:Nt,qboId:pe,onClose:()=>ce(null),selectedTransactionId:Q.detail.transactionId,isQuickViewCardStyle:!0},String(Q.detail.transactionId)):null:Q.contentType==="transfer"?k.jsx(Gc,{createTransferEntryStatus:qt,creditCardTransferAccountsList:Jt,transaction:Q.detail,transferAccounts:Yt,onClose:()=>ce(null),onCreateTransfer:Ht,isQuickViewCardStyle:!0},String(Q.detail.transactionId)):null),[O,Q,ut,Nt,pe,qt,Jt,Yt,Ht]),gn=Wt!=null,{selectedAccountId:we}=Ut,Kt=et(pt.accountSettingsView.saveState.fetchState),Cn=F((o=>Us(o.accountState,o.accountListState,"accountList"))),fn=F((o=>Bs(o))),Re=Ya(tn)??O,In=F((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Ga({isDataReady:re.fetchState==="Completed"}),dt==null)throw Error("Can't access expense automation screen without signing in...");const Qt=Ua(U),De=at(Qt.start),Fe=at(Qt.end);if(De==null||Fe==null)throw Error(`Invalid start - ${De} and end - ${Fe} period from given ${U}`);const kn=s.useCallback((()=>{Ae(!1)}),[]),bn=s.useCallback((()=>{y(!0)}),[]),Tn=s.useCallback((o=>{ne(o),y(!1)}),[]),Pn=s.useCallback((()=>{ne([])}),[]),qe=V.missingReceipts.bulkUpload.phase,Xt=V.missingReceipts.bulkUpload.currentBatchId;s.useEffect((()=>{xe===!0&&O==="missing_receipts"&&qe==="matching"&&Xt!=null&&h(Ba({cacheOverride:!0}))}),[xe,O,qe,Xt,h]);const Zt=dt?.userId,yn=U.month,vn=U.year,ea=B?.tenantId;s.useEffect((()=>{O==="missing_receipts"&&xe!==!1&&qe==="idle"&&Zt!=null&&ea!=null&&h(Vs())}),[O,xe,qe,Zt,ea,yn,vn,h]),s.useEffect((()=>{Ee.newVendorState?.vendorDetailLocalData?.vendorName!=null?J(!0):J(!1)}),[Ee.newVendorState?.vendorDetailLocalData?.vendorName]),s.useEffect((()=>{Re!=null&&O!==Re&&h(Va(Re))}),[Re]),s.useEffect((()=>{Rt===!1&&re.fetchState==="Completed"&&b&&(en(!0),h(ua(!1,!1,me===!0)))}),[Rt,re,b,me]),s.useEffect((()=>{const o={month:U.month,year:U.year},R=Gt.current;Gt.current=o,R===null||R.month===o.month&&R.year===o.year||!_t&&b&&(h(ua(!1,!1,me===!0)),h(ue(U,we,!1,!1)))}),[U.month,U.year,b,me]);const Je=s.useCallback(((o=!1,R=!1)=>{const L={start:De,end:Fe};switch(O){case"transaction_categorization":h(Se(mt,L,o,!rt,void 0,void 0,R)),Ft(!1);break;case"flux_analysis":h(Ze(U,o,R,null));break;case"month_end_insights":if(R===!1){const j=new Date(U.year,U.month,0),Ce=zs(j.toDateString()).format(Qa.analytics.YYYYDashMMDashDDFormat);h(Ls(!0,B.companyId,B.tenantId,Ce)),h($s(B.companyId,B.tenantId))}break;case"je_schedules":h(js(L,R,me===!0));break;case"missing_receipts":h(ja(L,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,R));break;default:h(ue(U,we,o,R))}}),[O,De,Fe,B.companyId,B.tenantId,mt,U,we,rt,Ft,me]),En=s.useCallback((()=>{Je(!0,!0)}),[Je]);s.useEffect((()=>{O===Re&&re.fetchState==="Not-Started"&&b&&Je(!0)}),[re,De,Fe,B.companyId,B.tenantId,b]),s.useEffect((()=>{_t||rt||Dt.current||un.fetchState==="In-Progress"||re.fetchState!=="Completed"||(Dt.current=!0,Je(!0,!0))}),[]),s.useEffect((()=>{X.fetchState!=="In-Progress"&&X.fetchState!=="Completed"&&X.fetchState!=="Error"&&B?.tenantId!=null&&h(Me({tenantId:B.tenantId,period:U,refreshViewInBackground:!1}))}),[X.fetchState,B?.tenantId]),s.useEffect((()=>{X.fetchState!=="Completed"||!b||(X.monthEndCloseChecks?.monthEndCloseCheckList.some((o=>o.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&h(ue(U,void 0,!1,!1))}),[X.fetchState,b,U.month,U.year,V.reconciliation.fetchStatus.fetchState,h]),s.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?Ae(!0):Ae(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),s.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&b&&(h(Me({tenantId:B.tenantId,period:U,refreshViewInBackground:!0})),h(Gs({companyId:B.companyId})),N("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,B.tenantId,U,B.companyId,b]),s.useEffect((()=>{const o=setInterval((()=>{X.fetchState!=="In-Progress"&&X.fetchState==="Completed"&&h(Me({tenantId:B.tenantId,period:U,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[X.fetchState,B.tenantId,U,h]),s.useEffect((()=>{const o=setInterval((()=>{O==="reconciliation"&&we==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&h(ue(U,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[O,h,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,ue,we,U]);const An=ya(),{isFeatureEnabled:xn}=le(H.isRecommendationFeedbackEnabled),ta=Nc(),{onRecommendationSelection:aa,popup:wn}=ai({isEnabled:xn}),Rn=s.useMemo((()=>({...ta,onRecommendationSelection:aa})),[ta,aa]);s.useEffect((()=>{const o=(X.monthEndCloseChecks?.monthEndCloseCheckList.find((R=>R.id==="month_end_insights"))?.isDisabled??!1)&&!Mt;O!=="month_end_insights"||!o&&X.monthEndCloseChecks?.reportEmailSentDate==null||N("../")}),[O,X.monthEndCloseChecks]);const Dn=x===!0?v:l,Fn=x===!0||I===!0,_n=x===!0?n:S,Mn=x!==!0&&w;s.useEffect((()=>{Kt==="In-Progress"&&pt.accountSettingsView.saveState.fetchState==="Completed"&&h(ma())}),[Kt,pt.accountSettingsView.saveState.fetchState,ma]);const{transactionId:na,onSaveVendor:On,onSaveSuccess:Un,onCancel:Bn,vendorViewDetails:Vn}=(({expenseAutomationViewSelector:o,closeDrawerHandler:R,currentSelectedView:L})=>{const j=ge();let Ce,fe,te;const ht=ya(),_e=o.transactionView;let sa=()=>{};const{transactions:jn,selectedTransactionId:Ie,selectedTransactionLineId:Ye,transactionLocalData:zn}=_e;if(L==="transaction_categorization"){const St=zn.find((he=>he.transactionId===Ie)),se=jn.find((he=>he.id===Ie)),oa=Ye!=null?St?.transactionReviewLocalData?.lineItemById[Ye]:void 0,ca=oa?.account;fe=oa?.class?.classId,Ce=["Uncategorized Income","Uncategorized Expense"].includes(ca?.accountName??"")?void 0:ca?.accountId;const $n=hi(Ie,se?.typeOfTransaction);se!=null&&$n&&(te={id:Ie,type:Pt(se.typeOfTransaction)}),sa=()=>{if(Ie!=null&&Ye!=null&&se!=null){const he=_e.transactionLocalData.find((He=>He.transactionId===Ie))?.transactionReviewLocalData;if(he!=null&&se.lines!=null&&se.lines.length>0){const He=he.lineItemById[Ye];let gt=he.selectedEntity;if(vs(se)||(gt=He.selectedEntityLine),gt!=null){const Gn=gt,Nn={transactionId:{id:se.id,type:se.type},transaction:se,lineIds:se.lines.map((qn=>qn.id))??[]};j(yt({entity:Gn,amount:He.amount.amount,transactionDetails:Nn,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:ht}))}}}}}const Ln=F((St=>ra(St,void 0,Ce,fe)));return{transactionId:te,onSaveVendor:()=>{j(ys(te,void 0,!1,!0))},onSaveSuccess:sa,onCancel:()=>{te!=null&&j(bs({transactionId:te})),j(Ts()),j(Ps()),R()},vendorViewDetails:Ln}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{J(!1)},currentSelectedView:O});return an?.loggedInUserRoleMap==null?X.fetchState==="Error"?k.jsx(qc,{onGoHome:()=>N("../",{replace:!0}),onReload:()=>window.location.reload()}):k.jsx(Na,{fetchState:"In-Progress"}):k.jsxs(k.Fragment,{children:[k.jsx(Ci,{isOpen:je,drawerLeftMargin:new Jc(0,0,300,650),onClose:()=>{y(!1)},children:k.jsx(Vi,{onClick:o=>o.stopPropagation(),children:k.jsx(Ri,{companyId:B.companyId,closeCustomerRequestDrawer:()=>y(!1),addCustomerRequest:Tn,resetCustomerRequest:Pn})})}),na!=null&&M&&k.jsx(oi,{isOpen:M,transactionId:na,onSaveVendor:On,onSaveSuccess:Un,onCancel:Bn,vendorViewDetails:Vn}),k.jsx(Yc,{toolkit:Rn,children:k.jsx(Ui,{events:[],eventCallback:(o,R,L)=>{},navigate:N,location:q,themeState:D,categoryOptions:ln,classesForFilters:dn,accountsForFilters:rn,vendorSearchAutoCompleteData:{autoCompleteText:In,entityAutoCompleteView:cn},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:xe,monthEndInsightsPreviewMode:ct,monthEndInsightsCustomerRequestData:Z,isRealtimeInsightsFeatureEnabled:Mt,isCreateTransferEntryFromExpenseEnabled:Ot,isAccountingClassesEnabled:fn,isProjectsTransactionsEnabled:nn,isCOTEnabled:An,currentTenant:B,companyId:B.companyId,signedInUser:dt,isTransactionActivityEnabled:ut,isRightPanelOpen:gn,rightSidePanel:Wt,onOpenTransferRightPanel:Ot===!0?Xa:void 0,uncategorizedAccounts:Cn,newScheduleActiveType:Pe,isAccrualEnabled:me,newScheduleSelection:K,onNewScheduleSelectionChange:ot,onScheduleTypeChange:ve,onNewScheduleSaved:En,onClickCustomerRequest:bn,handleEditClick:kn,tenantEmailDomain:lt,trackExpenseAutomationTabAnalytics:E,setActivityLogTransactionId:it,closeMatchSidePanel:t,closeSidePanel:_n,openTransactionPanel:A,closeSchedulePanel:C,openSchedulePanel:f,openMatchPanel:r,sidePanelIsOpen:Fn,sidePanelIsFullView:Mn,panelContent:Dn,isAiCfoAccessEnabled:$,onAskAiCfoClick:Za,isReconV3Enabled:sn,onExpenseAutomationCommentingThreadClick:on,sidePanelListPercent:x===!0?66:void 0,isMatchPanelOpen:d,isSchedulePanelOpen:T,matchPanelContent:g,schedulePanelContent:m,schedulePendingDiscardConfirmation:z})}),wn,de.showPopup&&de.popupType!=null&&k.jsx(Hc,{popupType:de.popupType,currencySymbol:de.currencySymbol,accountId:de.popupAccountId??"",accountName:de.popupAccountName??"",onSubmit:de.handleSubmit,onDismiss:de.handleDismiss})]})}))))),Vi=Te(Ac)`
35
+ display: flex;
36
+ min-height: 100%;
37
+ flex-direction: column;
38
+ `;function ji(){const t=be(),{selectedTab:n,tenantEmailDomain:S}=Be(),g=F((r=>ke(r))),d=F((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[g.tenantId]));if(Ya(n)==null)return k.jsx(za,{});const i=Ja({tenantEmailDomain:S,selectedTab:n,selectedPeriod:d!=null?`${d.month}-${d.year}`:void 0});return i==null?null:k.jsx(Wn,{to:i,replace:!0,state:t.state})}function Sl(){return k.jsxs(Hn,{children:[k.jsx(We,{index:!0,element:k.jsx(fi,{})}),k.jsx(We,{path:"/:selectedTab/:selectedPeriod/*",element:k.jsx(Bi,{})}),k.jsx(We,{path:"/:selectedTab",element:k.jsx(ji,{})}),k.jsx(We,{path:"*",element:k.jsx(za,{})})]})}export{Sl as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-CzCs-qU3.js";import{a as r}from"./sentry-CWp8Ph3h.js";import{aw as d,ax as l,s as p,a4 as m}from"./index-BhDgyETA.js";import"./mui-B2F_PvWe.js";import c from"./NotFoundScreen-Cw8n2XQn.js";import{h as u,g as b}from"./core-BBG4mxvC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="052e3476-042d-44ff-b15b-67fe1524a52f",e._sentryDebugIdIdentifier="sentry-dbid-052e3476-042d-44ff-b15b-67fe1524a52f")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),f=r.useCallback((()=>{(()=>{const n=m(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=d(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:f}):s.jsx(c,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -0,0 +1 @@
1
+ import{a as r}from"./sentry-CWp8Ph3h.js";import{u as l,h as f,g as m}from"./core-BBG4mxvC.js";import{h$ as p,UH as g,UI as b}from"./zeni-epic-state-FRanwwFO.js";import{u as _,L as h,z as y}from"./index-BhDgyETA.js";import"./liveblocks-CzCs-qU3.js";import"./recharts-CzGMTm3v.js";import"./mui-B2F_PvWe.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cbaf99b7-e770-4476-819d-df693b100290",e._sentryDebugIdIdentifier="sentry-dbid-cbaf99b7-e770-4476-819d-df693b100290")}catch{}})();function R(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:c}=_(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(p(t.tenant_id,t.connection_id,g("revenue"),b("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}c();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{R as default};
@@ -0,0 +1 @@
1
+ import{n as s}from"./liveblocks-CzCs-qU3.js";import{j as c}from"./core-BBG4mxvC.js";import{fI as f}from"./zeni-epic-state-FRanwwFO.js";import"./sentry-CWp8Ph3h.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="25fc1afa-344c-4436-b7c0-ce0cb6697f63",e._sentryDebugIdIdentifier="sentry-dbid-25fc1afa-344c-4436-b7c0-ce0cb6697f63")}catch{}})();const b=()=>c((e=>f(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{b as u};
@@ -0,0 +1,2 @@
1
+ import{j as c}from"./liveblocks-CzCs-qU3.js";import{a as r}from"./sentry-CWp8Ph3h.js";import{u as L,h as _,i as F,j as k,t as Z,l as O,s as H,g as X,N as B,n as ae,o as x}from"./core-BBG4mxvC.js";import{a8 as et,j as g,aq as R,T as l,cc as nt,cd as tt,ce as it,cf as ot,cg as at,ch as ct,ci as st,cj as rt,ck as lt,cl as dt,cm as ut,cn as gt,p as Y,co as vt,cp as mt,z as W,ae as re,cq as pt,cr as St,cs as ft,ct as It,cu as ht,cv as Ct,cw as kt,cx as Et,cy as yt,cz as bt,_ as xt,ai as ln,cA as At,cB as Dt,cC as jt,cD as Lt,cE as _t,cF as Pt,cG as wt,cH as $t,cI as Ft,cJ as Rt,cK as Tt,t as qe,l as Pe,cL as Ot,cM as Mt,cN as Nt,cO as Ut,cP as Bt,cQ as Vt,cR as Ht}from"./index-BhDgyETA.js";import"./mui-B2F_PvWe.js";import{A as K}from"./AddressScreen-CPZX6Mga.js";import M from"./NotFoundScreen-Cw8n2XQn.js";import{ZW as qt,ZX as Qt,vv as Qe,ZY as G,vY as le,ZZ as we,Z_ as de,wz as xe,wG as zt,wL as dn,Z$ as $e,wD as un,yd as ze,vX as Ke,_0 as Kt,_1 as gn,wW as Ae,_2 as ue,w_ as Gt,_3 as Wt,_4 as vn,x1 as mn,z8 as Zt,_5 as fe,_6 as Ge,_7 as pn,vV as Xt,_8 as Yt,vP as Jt,_9 as ei,yq as ni,_a as Sn,yz as We,_b as ti,yw as ii,_c as Fe,gk as Re,_d as ie,_e as oe,xg as oi,w1 as Ze,w6 as fn,w4 as ai,v_ as ci,x9 as si,w8 as ri,xi as li,_f as De,xr as In,xp as J,xn as ge,xm as di,_g as hn,yF as Xe,_h as ui,vW as Cn,_i as Te,fI as Ie,wh as je,we as Le,wr as kn,wq as Oe,wb as gi,wk as En,wt as ce,VI as yn,vZ as Me,wo as vi,wp as mi,wn as pi,_j as Si,w$ as fi,wX as bn,_k as xn,vJ as Ye,_l as Ii,vF as hi,_m as Ci,yL as ki,yP as Q,yK as Ei,xT as he,_n as yi,_o as An,yY as Je,_p as bi,yV as xi,_q as Dn,xW as Ai,xX as V,x_ as Di,_r as jn,y8 as Ee,_s as ji,xh as Ln,Ue as _n,_t as Li,yi as _i,_u as Pn,_v as Pi,_w as wi,_x as $i,zN as Fi,_y as Ri,_z as wn,z3 as $n,_A as Fn,zL as ye,_B as Ti,zI as Oi,_C as Mi,_D as Ni,_E as Ui,_F as Bi,_G as Vi,_H as en,_I as Hi,ei as qi,zR as Qi,_J as Ne,xB as zi,xw as Ki,_K as ve,xM as Rn,xE as me,xD as Gi,xH as Tn,_L as Wi,xC as Zi,_M as On,z9 as Mn,zA as nn,zv as Xi,_N as Yi,za as Ji,_O as eo,zB as no,zF as to,_P as Ue,wB as Nn,zm as io,wC as oo,_Q as ao,_R as Un,c9 as co,mv as so,mw as ro,_S as tn,wA as pe,go as lo,mC as uo,zs as Bn,A1 as go,zp as Vn,v1 as vo,uR as mo,hV as po,UH as on,UI as So,Gn as Hn,z_ as fo,hN as Io,zX as ho,_T as Co,Vx as ko,_U as Eo,A6 as be,A7 as yo,_V as bo,_W as qn,A4 as xo,_X as Ao,_Y as Do,ym as jo,_Z as Lo}from"./zeni-epic-state-FRanwwFO.js";import{M as _o}from"./MobileAppDrawer-jPjMoXMc.js";import{q as Se}from"./QBOConnectionScreen-CGXzaY9Z.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";import"./InboxNotificationsProvider-J2K-16R3.js";import"./useTaskManagerAccess-ljLSKJCt.js";import"./empty-zUa_Ywzm.js";import"./pdf-lib-DiMa7ymi.js";import"./index-lbu92FYh.js";import"./url-DV6CtKQ5.js";import"./index-CD8RychW.js";import"./decodeURIComponentSafe-DgKmvHaP.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]="cd761501-48e7-478b-9cbf-bc58dc919697",t._sentryDebugIdIdentifier="sentry-dbid-cd761501-48e7-478b-9cbf-bc58dc919697")}catch{}})();const w=({event:t,isReady:e=!0})=>e?c.jsx(et,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function Po(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:m,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(qt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((P,U)=>{const T=Qt(D,P,U,E);T!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:P,entityId:U,fromScreen:"audit_log",toScreen:P}),e(T))}),[E,e,D]);r.useEffect((()=>{const P=setTimeout((()=>u(a)),300);return()=>clearTimeout(P)}),[a]),r.useEffect((()=>{i&&t(Qe({filters:y,keepExistingListItems:!1,sort:v}))}),[i,y,v,t]);const A=m==="Not-Started"||m==="In-Progress"&&f.length===0,C=m==="In-Progress"&&f.length>0,j=m==="Completed";return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(nt,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:S,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{S&&I!=null&&t(Qe({cursor:I,filters:y,keepExistingListItems:!0,sort:v}))},onSearchChange:o,onSortChange:p})]})}function Ce(t,e=!1){const n=L(),i=k((s=>G(s).productNextCursor!=null)),a=k((s=>G(s).productNextCursor)),o=k((s=>G(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ee(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const p=d.current==="In-Progress";d.current=t,t==="Completed"&&p&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((p=>p+1)))}),[s,e]),a}const wo=new Set(["plan"]),$o=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!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(un({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t($e({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i}),t(dn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(zt({action:o,id:a,parentItemId:i}))}}}))(tt);function Fo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=F(),[a]=Z(),{areTenantIdsInSync:o}=R(),s=(u=a.get("kind"))!=null&&wo.has(u)?u:"plan";var u;const d=k((y=>we(y,n))),{pageFetchState:p}=d,v=p.fetchState;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:s}))}),[o,n,s,t]);const m=r.useCallback((y=>t(xe({cacheOverride:!0,id:y,kind:s}))),[t,s]),S=ee(d.fetchState,d.isFormLoading,n,m),f=v==="Completed"&&!d.isFormLoading;Ce(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(v==="Not-Started"||v==="In-Progress"||d.isFormLoading);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx($o,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},S)]})}const Ro=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=we(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:a}=e,o=a!=null?`${n}/catalog/${encodeURIComponent(a)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(de({id:a})),e.navigate(`${n}/catalog`)},onChange:s=>{t($e({id:a,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{mode:i}),t(dn({id:a}))}}}))(it);function Mo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=F(),[a]=Z(),{areTenantIdsInSync:o}=R(),s=n!=null,u=a.get("type"),d=u!=null&&Ro.has(u)?u:void 0,p=(v=a.get("kind"))!=null&&To.has(v)?v:"plan";var v;const m=k((S=>we(S,n)));return Ce(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:p}))}),[o,n,p,t]),r.useEffect((()=>{s||d==null||m.localData.catalogType===d||t($e({localData:{...m.localData,catalogType:d}}))}),[s,d,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(de({id:n}))}}),[m.fetchState,m.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&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:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="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",a=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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=No[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onCatalogItemLifecycleAction:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:u,fromScreen:"catalog_list",itemId:s}),t(un({action:Kt(u),id:s}))},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(Ke({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Ke({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(ot);function Bo(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,p]=r.useState(""),[v,m]=r.useState(null),S=r.useMemo((()=>v!=null?{dir:v.direction,field:v.columnKey}:void 0),[v]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((P=>G(P))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed",j=h.runningActionId??null;return r.useEffect((()=>{const P=setTimeout((()=>p(a)),300);return()=>clearTimeout(P)}),[a]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[i,t,I,E,S]),r.useEffect((()=>{i&&(f!==y||S?.field!==D?.field||S?.dir!==D?.dir)&&t(ze({cacheOverride:!0,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[y,D,i,t,I,E,f,S]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:v,planFilters:I,productFilters:E,sort:S,planNextCursor:b,productNextCursor:A,runningCatalogItemActionId:j,onSearchChange:o,onTabChange:u,onSortChange:m})]})}const Vo=O((function(t,e){const n=gn(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,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ue({id:i})),e.navigate(`${n}/discounts`)},onChange:s=>{t(Wt({id:i,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{mode:a}),t(Gt({id:i}))}}}))(at);function Ho(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,savedCouponId:s}=k((u=>gn(u,n)));return r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ue({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCouponFormPage}),c.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:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(pn(a))},onSubmit:()=>{const a=Yt(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(Jt(a))}}}))(st);function Qo(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),[i]=Z(),{areTenantIdsInSync:a}=R(),o=i.get("customerId"),s=k((b=>vn(b))),u=s.fetchState,d=s.localData,p=s.savedInvoiceId,v=k(mn),m=k((b=>Zt(b))),S=k(fe),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&v==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,E=f||I,h=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(pn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(Xt({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=p!=null?`/${n}/invoicing/invoices/${encodeURIComponent(p)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,p,e,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(ct,{}):c.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const zo=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=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(rt);function Ko(){const t=L(),e=_(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>ei(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(ni({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(zo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=Sn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ii({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(lt);function Wo(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=Sn(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(We({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ti(D)),onSortChange:p})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Zo=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:a=>{t(De({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new`)},onDiscardEdit:()=>{t(J(ge)),t(di({id:i}))},onOpenAddress:()=>{const a=Qn(e.tenantEmailDomain??"",ge,i),o=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i}),t(De({id:i,localData:a})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(li({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(ri({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(gt);function Xo(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((T=>Fe(T,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[p,v]=r.useState(!1),[m,S]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;C.current!=="Error"&&T==="Error"&&t(Re({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=T}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ie()),t(oe()),()=>{t(ie()),t(oe())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(oi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(Ze({customerId:i}))}),[o,i,t,A]);const P=r.useCallback((T=>t(fn({id:T}))),[t]),U=ee(s.fetchState,s.isFormLoading,i,P);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(Zo,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(ie()),i!=null&&A&&t(Ze({customerId:i})),v(!0)},onCreatePromotionalCredits:()=>{t(oe()),S(!0)}},U),c.jsx(dt,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:p,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(ci({customerId:i}))},onClose:()=>{v(!1),t(ie())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(ai({customerId:i,data:T})))}}),c.jsx(ut,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:m,submitSucceeded:y.fetchState==="Completed",onClose:()=>{S(!1),t(oe())},onSubmit:({amount:T,description:te})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(si({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:te})))}})]})}const Yo=O((function(t,e){const n=Fe(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,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(hn({id:i})),t(J(ge)),e.navigate(`${n}/customers`)},onChange:s=>{t(De({id:i,localData:s}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const s=Qn(e.tenantEmailDomain??"",ge,i),u=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{mode:a}),t(In({id:i}))}}}))(vt);function Jo(){const t=L(),e=_(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCustomerId:u}=k((d=>Fe(d,i)));return r.useEffect((()=>{o&&i!=null&&t(fn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,p=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(p),t(hn({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerFormPage}),c.jsx(Yo,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ea=O((function(t){const e=fe(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(Cn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(mt);function na(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ui(D)),onSortChange:p})]})}const _e=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:_e(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=_e(s,a),p=s.actionStateByKind.retry?.fetchState==="In-Progress",v=s.actionStateByKind.rollback?.fetchState==="In-Progress",m=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!v;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Le({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||p?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Oe(a)))},onRollback:m?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(kn(a)))}:void 0}}))(pt);function ia(){const t=L(),e=_(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),[o,s]=r.useState({}),u=k(Te),d=k(Ie),p=r.useMemo((()=>{const E=W.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),v=_e(u,n),m=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(je(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const S=v?.status==="scanning"||v?.status==="importing";r.useEffect((()=>{if(!a||n==null||!S)return;const E=setInterval((()=>{t(je(n)),t(Le({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,S,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=m?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportDetailPage,isReady:v!=null&&I!=="Not-Started"}),c.jsx(ta,{authParams:p,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const zn=t=>`invoicing_active_migration:${t}`,se=(t,e)=>{if(t!=null&&t!=="")try{const n=zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.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,a=o=>{const s=o??null;t(ce(s)),se(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Oe(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(St);function aa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(Te);r.useEffect((()=>{i&&(t(gi()),t(En()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(oa,{navigate:e,tenantEmailDomain:n,view:a})]})}const ca=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:p,sessions:v}=u,m=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),S=n!=null?p[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(m?.isValid??!1),chargebeeConnectorAvailable:m!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:S??v.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(pi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(Oe(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(mi(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(vi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ft);function sa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(mn),o=k(Ie),s=r.useMemo((()=>{const h=W.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??W.getSignedInUserTenant(n??"")?.companyId,p=k((h=>yn(h,d))),v=k(Te),{activeMigrationSessionId:m}=v,S=m??void 0,f=S!=null?v.sessionDetail[S]??v.sessions.find((h=>h.id===S)):void 0;r.useEffect((()=>{i&&(t(Me()),t(En()))}),[i,t]),r.useEffect((()=>{if(m!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(zn(y))}catch{return null}})(n);h!=null&&t(ce(h))}),[m,t,n]),r.useEffect((()=>{se(n,m)}),[m,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||S==null||!E)return;const h=setInterval((()=>{t(je(S))}),3e3);return()=>clearInterval(h)}),[i,S,E,t]),r.useEffect((()=>{I==="done"&&(t(ce(null)),se(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(ca,{activeId:S,authParams:s,integrationsView:p,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:v,onBack:()=>{t(ce(null)),se(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:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(bn({action:a,id:i}))},onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i}),t(fi({data:a,id:i}))}}}))(It);function la(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((I=>Si(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[p,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const m=p===n;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]);const S=r.useCallback((I=>t(Ae({cacheOverride:!0,id:I}))),[t]),f=ee(o.fetchState,o.isFormLoading,n,S);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(ra,{hasLoadedRecord:m,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=xn(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=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(bn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(hi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(ht);function ua(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=xn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ye({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(Ii(b)),onSortChange:p})]})}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,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(Q({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(Q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(Q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(Q({action:"retry",id:i}))}:void 0}}))(kt);function va(){const t=L(),e=_(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((C=>Ci(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,p]=r.useState("idle"),[v,m]=r.useState(!1),[S,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{p("idle"),m(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(ki({id:n})),p("idle"),m(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(m(!1),p("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(Q({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=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((()=>{a&&n!=null&&t(Ei({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(he({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{p("idle"),m(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(p("idle"),m(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?v&&o.actionState.fetchState==="Completed"?(n!=null&&t(yi({id:n})),h()):v&&o.actionState.fetchState==="Error"&&p("failed"):m(!0))}),[n,h,t,d,v,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(Ct,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const ma=O((function(t){const e=An(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`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};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:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(Q({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(xi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Et);function pa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=An(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Je({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(ma,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(bi(b)),onSortChange:p})]})}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,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail"}),t(Di({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
+ `).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(V({action:"void",invoiceId:i,body:s}))}}}))(yt);function fa(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((f=>Dn(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,p]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&p(n)}),[n,u]);const v=d===n;r.useEffect((()=>{a&&n!=null&&t(Ai({invoiceId:n}))}),[a,n,t]);const m=r.useCallback((f=>t(he({invoiceId:f}))),[t]),S=ee(o.actionState.fetchState,o.fetchState==="In-Progress",n,m);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:v,navigate:e,tenantEmailDomain:i,view:o},S)]})}const Ia=O((function(t){const e=jn(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`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(V({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(V({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(Ln({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(bt);function ha(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=jn(A);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:C.nextCursor,invoiceListFetchState:C.fetchState,voidingInvoiceId:C.runningActionId,invoices:C.invoices}}),H),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ee({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(ji(A)),t(Ee({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p})]})}function an(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),i=xt(),a=ln(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=k(_n),p=Li(i?.loggedInUserRoleMap),v=`/${n}/invoicing`,m=S=>{s(S)};return d==="completed"?c.jsx(B,{to:`${v}/overview`,replace:!0}):d==="settings"&&p?c.jsx(B,{to:`${v}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPromoPage}),c.jsx(_o,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),c.jsx(At,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!p,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(_i())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Ca=O((function(t,e){const n=Pn(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(Ri({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Fi())}}}))(Dt);function ka(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:p}=k((f=>Pn(f,n??""))),v=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(Pi()),m.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(he({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&m.current!==n&&(m.current=n,t(wi({localData:$i(s)})))}),[t,o,s,n]);const S=r.useRef(p.fetchState);return r.useEffect((()=>{const f=S.current;S.current=p.fetchState,f!=="Completed"&&p.fetchState==="Completed"&&d!=null&&e(`${v}/credits/${encodeURIComponent(d)}`)}),[d,e,p.fetchState,v]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Ea=O((function(t){return{invoicingOverview:wn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingOverviewRefreshed),t($n(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(jt);function ya(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>wn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t($n(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(Ea,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const ba=O((function(t){const e=Fn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Lt);function xa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const P=Fn(j);return{activeType:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,transactionListFetchState:P.fetchState,transactions:P.transactions}}),H),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const P=y.find((T=>T.id===j)),U=P?.linkedInvoices?.[0]?.invoiceID??P?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const P=y.find((U=>U.id===j))?.customerID;P!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:P,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(P)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(ba,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(Ti(j)),t(ye({cacheOverride:!1,filters:m,sort:v}))},onSortChange:p,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const Aa=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=_(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=n!=null&&n!=="",s=k(fe),u=k((C=>Mi(C))),d=k(Ni),p=k((C=>Dn(C,n??""))),v=p.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ui()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?he({invoiceId:n}):Cn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&v!=null&&n!=null&&p.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Bi({contextInvoiceId:n,localData:Vi(v)})))}),[t,v,n,p.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Ln({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(en({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=d.fetchState,C!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,m]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:Aa(C)})))),[s.customers]),h=k((C=>Hi(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,P=qi.currencySymbol,wt("0,0.00",j,P)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,P}))),[h]),D=r.useMemo((()=>{if(!o||v==null)return;const C=v.currencyCode??"USD",j=v.amountDue?.amount??0;return{amountDue:_t("0,0.00",v.amountDue),amountDueValue:j,currencyCode:C,customerName:v.customerName??v.customerID,invoiceId:v.id,invoiceNumber:v.invoiceNumber??v.id}}),[v,o]),b=o?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,A=!o||p.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(Pt,{customers:E,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(en({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Qi(o?n??void 0:void 0))}})]})}const Kn=(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,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);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,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Tn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(ve({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(J(me)),t(Gi({id:i}))},onOpenAddress:()=>{const s=Kn(e.tenantEmailDomain??"",me,i),u=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ve({id:i,localData:s})),t(Rn({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))($t);function ja(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((y=>Ne(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:p}=s,v=s.pageFetchState.fetchState,m=v==="Completed"&&!s.isFormLoading,[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=S===i;Ce(o),r.useEffect((()=>{o&&i!=null&&t(zi({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(Ki({id:y}))),[t]),h=ee(s.fetchState,s.isFormLoading,i,E);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionDetailPage,isReady:m}),c.jsx(Da,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:p,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const La=O((function(t,e){const n=Ne(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,a=i!=null?"edit":"create";return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(On({id:i})),t(J(me)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(ve({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const o=Kn(e.tenantEmailDomain??"",me,i),s=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,{mode:a}),t(Rn({id:i}))}}}))(Ft);function _a(){const t=L(),e=_(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),[o]=Z(),{areTenantIdsInSync:s}=R(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:p}=k((S=>Wi(S,i))),v=k((S=>Ne(S,i).localData));Ce(s),r.useEffect((()=>{s&&t(Zi({subscriptionId:i}))}),[s,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||u==null||u===""||v.customerId!==""||(m.current=!0,t(ve({id:i,localData:{...v,customerId:u}})))}),[u,i,v,t]),r.useEffect((()=>{if(d==="Completed"){const S=p??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),t(On({id:i}))}}),[d,p,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(La,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Pa=O((function(t){const e=Mn(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=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Tn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(Ji({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Rt);function wa(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),v=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Mn(C);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),H),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(nn({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(Xi())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(Pa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:m,sort:v,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(Yi(C)),onSortChange:p})]})}const $a=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:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(to({action:"capture",id:i}))}:void 0}}))(Tt);function Fa(){const t=L(),e=_(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>eo(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(no({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx($a,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Gn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=R(),u=k(Ue),d=u.connection?.connected===!0,p=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&p!=="Not-Started"||o(Nn()),n&&o(io()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(oo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const Ra={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ne(t){const e=L(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=F(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:p}=k(ao),{configError:v,configFetchState:m,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Un),h=k(Ue);Gn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(Ie),D=t==="dunning"||t==="quickbooks",b=y.companyId??W.getSignedInUserTenant(i??"")?.companyId,A=k(($=>yn($,b))),C=co(y.userRole??[]),j=y.tenantId??"",P=W.getSignedInUser(),U={userId:P?.userId??"",sessionId:P?.zeniSessionId??"",tenantId:j},T=s?.fileId,te=k(($=>T!=null&&T!==""?so($,T):void 0)),Be=k(($=>T!=null&&T!==""?ro($,T):void 0)),Wn=T!=null&&T!==""&&te!=null?{[T]:te}:{},Zn=T!=null&&T!==""&&Be!=null?{[T]:Be}:{};r.useEffect((()=>(e(tn()),()=>{e(tn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[n,e,a]),r.useEffect((()=>{n&&D&&m==="Not-Started"&&e(pe())}),[n,e,m,D]),r.useEffect((()=>{if(!n)return;const $=P?.userId;$!=null&&$!==""&&j!==""&&qe.shouldFetchActiveTenant(j)&&(qe.markActiveTenantFetchStarted(j),e(lo($,j,P?.zeniSessionId)))}),[n,e,P?.userId,P?.zeniSessionId,j]);const Xn=S.length>0||f.length>0,Yn=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!Xn&&(m==="Not-Started"||m==="In-Progress"),Jn=a==="Completed"&&(!D||m==="Completed"),Ve=A.externalConnections?.revenue?.find(($=>$.connectionName==="chargebee"))?.connectionId,ke=re?.invoicingMicroServiceBaseUrl,He=ke!=null&&ke.length>0?`${ke}/1.0/webhooks/stripe`:"",z={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:p.fetchState==="In-Progress",onConnectStripe:$=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(ho($))},onDisconnect:($,q)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:q,entityId:$,fromScreen:t??"hub"}),e(Io(j,$,on(q))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(fo())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const $=y.tenantEmailDomain??i??"";Se.init("/connection/auth",$),Se.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Hn()))},onSaveChargeBeeCredentials:($,q)=>{Ve!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(po(j,Ve,on("revenue"),So("chargebee"),{api_key:$,site:q})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He};return{authParams:U,deleteFileStatusById:Wn,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:re?.fileMicroServiceBaseUrl??"",integrationsSectionProps:z,isInvoicingPageReady:Jn,isLoading:Yn,isSaving:u.fetchState==="In-Progress",isStripeBusy:p.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&m==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He,updateFileStatusById:Zn,onConnectStripe:z.onConnectStripe,onDeleteFile:$=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(mo($,j))},onDisconnectStripe:z.onDisconnectStripe,onEditFileName:($,q)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(vo($,q.split(".")[0],j))},onReconnectQBO:z.onReconnectQBO,onRefreshQBO:z.onRefreshQBO,onRetryQboSyncTask:$=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:$,fromScreen:t??"hub"}),e(Vn($))},onSave:$=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(go({settings:$,snackbarSection:Ra[t??""]}))},onStartQboBackfill:$=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Bn($))},updateFilesEntity:$=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(uo({files:$}))}}}function sn({appContent:t}){const e=_(),n=X(),i=L(),{tenantEmailDomain:a}=F(),o=ne("branding"),s=k((p=>Co(p))),u=k((p=>ko(be,p)?.addressToCreate));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&(i(Eo()),i(J(be)))}),[s.saveState.fetchState,i]);const d=Pe(s.saveState.fetchState);return r.useEffect((()=>{d==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[d,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ot,{address:u,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:p=>{i(bo({localData:p}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const p=`/${a}/invoicing/settings/branding/${be}/`,v=Y(n.state?.pathnameStackToGoBack,n.pathname);e(p,{state:{pathnameStackToGoBack:v}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"branding"}),i(yo())},updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=_(),e=ne("dunning");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Mt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=_(),e=ne("integrations");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Nt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=_(),e=ne("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Ut,{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=qn(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:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(Ao())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Vn(e))},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(xo())},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Bn(e))}}}))(Bt);function Ua(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),i=k(Ie),{configFetchState:a,saveState:o,settingsFetchState:s}=k(qn),u=Pe(o.fetchState);return r.useEffect((()=>{u==="In-Progress"&&o.fetchState==="Completed"&&e("..")}),[e,u,o.fetchState]),r.useEffect((()=>{s!=="Not-Started"&&s!=="Error"||t(Me())}),[t,s]),r.useEffect((()=>{a==="Not-Started"&&t(pe())}),[a,t]),Gn({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Se.init("/connection/auth",i.tenantEmailDomain??n??""),Se.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Hn())}})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=ln(),e=L(),n=_(),[i,a]=Z(),o=ne(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:p,isStripeConnected:v}=k(Un),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=Ba[m];a({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[m,n,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Vt,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:p,isStripePaymentsReady:v,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(jo())}})]})}function rn(){return c.jsxs(ae,{children:[c.jsx(x,{index:!0,element:c.jsx(Va,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Ma,{})}),c.jsx(x,{path:"branding",element:c.jsx(sn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(sn,{appContent:c.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Oa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Ta,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ua,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:"..",replace:!0})})]})}function Sc(){const t=L(),e=_(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),{enableState:a,fetchState:o,status:s}=k(_n),u=Pe(a.fetchState),d=`/${n}/invoicing`,p=r.useRef(!1),v=k((m=>Ue(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||p.current||(p.current=!0,t(pe({cacheOverride:!1}))):t(pe({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&v==="Not-Started"&&t(Nn())}),[i,t,v]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(Lo()))}),[u,a.fetchState,d,t,e]),s==null&&o!=="Error"?c.jsx(Ht,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ae,{children:[c.jsx(x,{path:"/",element:c.jsx(B,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(ya,{})}),c.jsx(x,{path:"promo",element:c.jsx(B,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(na,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(Jo,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(Xo,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(wa,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(_a,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(ja,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"invoices",element:c.jsx(ha,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Qo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(fa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(cn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(ka,{})}),c.jsx(x,{path:"payments",element:c.jsx(xa,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(cn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Fa,{})}),c.jsx(x,{path:"credits",element:c.jsx(Wo,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(Ko,{})}),c.jsx(x,{path:"discounts",element:c.jsx(ua,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Ho,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(la,{})}),c.jsx(x,{path:"dunning",element:c.jsx(pa,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(va,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Bo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(Mo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Fo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(Po,{})}),c.jsx(x,{path:"data_import",element:c.jsx(aa,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(sa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ia,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{Sc as default};
@@ -0,0 +1,72 @@
1
+ import{j as a}from"./liveblocks-CzCs-qU3.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as L,N as te,n as ne,o as p}from"./core-BBG4mxvC.js";import{UA as k,UB as v,UC as T,JE as B,Jq as U,UD as D,UE as oe,UF as ie,Ju as se,gl as $,JB as le,Jy as de}from"./zeni-epic-state-FRanwwFO.js";import{a1 as x,M as d,a2 as re,j,W as G,a3 as ce,a4 as me,a5 as pe,p as J,c as ue,m as he,a6 as ge,Z as xe,E as fe,f as be,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as ve,ab as je,ac as $e}from"./index-BhDgyETA.js";import{n as m}from"./mui-B2F_PvWe.js";import f from"./NotFoundScreen-Cw8n2XQn.js";import{a as I}from"./sentry-CWp8Ph3h.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.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]="33cbb1ac-e21d-4c20-8868-de3397ad7be1",e._sentryDebugIdIdentifier="sentry-dbid-33cbb1ac-e21d-4c20-8868-de3397ad7be1")}catch{}})();const Ie=m.div`
2
+ display: flex;
3
+ height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
10
+ `,Ce=g((function(e){const t=k(e),n=v(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(B(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(re);function F(){const e=x(),{vendorId:t,billId:n}=S();return t==null||n==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Ie,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const Be=m.div`
11
+ display: flex;
12
+ height: 100vh;
13
+ width: 100%;
14
+ flex: 1 1 auto;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ background-color: ${e=>e.theme.colors.grey4};
18
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
19
+ `,De=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:D(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=Ee(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(Be,{windowSize:o,children:a.jsx(De,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},Ee=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),ze=m.div`
20
+ display: flex;
21
+ height: 100%;
22
+ width: 100%;
23
+ flex: 1 1 auto;
24
+ flex-direction: column;
25
+ align-items: center;
26
+ background-color: ${e=>e.theme.colors.grey4};
27
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
28
+ `,Ne=g((function(e){const t=k(e),n=v(e),o=D(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(T({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),r=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(pe);function Le(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(ze,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
+ display: flex;
30
+ height: 100%;
31
+ width: 100%;
32
+ flex: 1 1 auto;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ background-color: ${e=>e.theme.colors.grey4};
36
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
37
+ `,Te=g((function(e){const t=k(e),n=v(e),o=D(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:r}=s;e(ie({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),r=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(ge);function Ue(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Fe,{windowSize:n,children:a.jsx(Te,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Je=m(ke)`
38
+ width: ${d.sp4};
39
+ height: ${d.sp4};
40
+ margin-bottom: ${d.sp3};
41
+ margin-top: ${d.sp3};
42
+ margin-left: ${d.sp8};
43
+ cursor: pointer;
44
+ position: absolute;
45
+ color: ${e=>e.theme.colors.brandColorJade};
46
+ `,Me=m.div`
47
+ display: flex;
48
+ height: 100vh;
49
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
+ width: 100vw;
51
+ overflow-y: scroll;
52
+ background-color: ${e=>e.theme.colors.grey4};
53
+ `,He=m.div`
54
+ display: flex;
55
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
+ flex-direction: column;
57
+ width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
+ box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
60
+ padding-top: ${e=>e.windowSize!=="small"?d.sp2:"0px"};
61
+ `,Ve=m.div`
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ padding: ${e=>e.windowSize==="small"?d.sp3:`62px ${d.sp6} ${d.sp9} ${d.sp8}`};
67
+ height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
+ overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
+ width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
+ background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
+ margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
+ `,We=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),r=s.get("token"),M=n.pathname.includes("address"),b=x(),H=xe(),A=fe(),w=be(),V=()=>{H.toggle()},W=L((u=>k(u))),_=L((u=>v(u))),{authParams:K,fetchState:c,billAttachment:Z,billFetchState:P,companyName:q,currencySymbol:O,amount:Q}=W,{tenantId:E,userId:z,sessionId:N}=K,{fetchState:R,internationalBankAccountCreateStatus:X}=_;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&r!=null&&t(le(i,o,r))}),[w,c,i,o,r,t]),I.useEffect((()=>{w&&c==="Completed"&&($(z,N,E),l!=null&&t(de(l)))}),[c,w,z,N,E,l,t]),c==="Error"?a.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?($(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${d.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:j,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",q,l??"",_e(n.pathname),O,Q))(u)}),a.jsxs(Me,{windowSize:b,children:[b!=="small"?a.jsx(Je,{onClick:V}):null,a.jsx(Ve,{windowSize:b,isAddressPage:M,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(We,{file:Z,type:"bill"})}),a.jsx(He,{windowSize:b,children:e})]})]})}const _e=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ke(){return a.jsx($e,{})}function ra(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Ke,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Le,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ue,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{ra as default};
@@ -0,0 +1,12 @@
1
+ import{j as u}from"./liveblocks-CzCs-qU3.js";import{a as f}from"./sentry-CWp8Ph3h.js";import{u as O,g as w,h as _,t as M,j as l,N as L}from"./core-BBG4mxvC.js";import{z as r,E as P,G as V,S as A,j as N,T as X,X as $,$ as G,U as R}from"./index-BhDgyETA.js";import{fI as W,U3 as q,Uw as B,Un as H,gl as J,gn as K,Us as Q,gX as Y,dk as Z,Ux as ee,Uy as te}from"./zeni-epic-state-FRanwwFO.js";import{n as ne}from"./mui-B2F_PvWe.js";import{u as se}from"./useDeviceId-Bzw6IkAe.js";import{f as ae}from"./analyticsHelper-B0PgYJQ4.js";import{t as ie}from"./getLocaleForTenant-DnBPPnzL.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="7e10fda2-7a5f-44f9-8707-bc4a5f1b433b",t._sentryDebugIdIdentifier="sentry-dbid-7e10fda2-7a5f-44f9-8707-bc4a5f1b433b")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=w(),m=_(),[k]=M(),n=k.get("token"),p=k.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:C,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),b=l((e=>q(e))),D=r.getSignedInUser(),v=P().mode;f.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(B(n,i,g)))}),[n,p,t,i,g,s?.zeniSessionId]),f.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(b.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),Y().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(X.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,y,s,o,b,v,a.state,t]);const E=f.useCallback((()=>{m("/signin/auth")}),[m]),j=f.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=f.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx($,{phoneNumber:x,verifyOtpFetchState:C.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||g==null||h==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ z-index: 9999;
11
+ background-color: ${t=>t.theme.colors.background};
12
+ `;export{Te as default};
@@ -0,0 +1 @@
1
+ import{j as _}from"./liveblocks-CzCs-qU3.js";import{a as m}from"./sentry-CWp8Ph3h.js";import{u as te,j as t,i as $e,g as Ge,h as Ue,q as F}from"./core-BBG4mxvC.js";import{fI as ne,U4 as Me,U5 as se,gc as Ne,fH as xe,Ue as Pe,U7 as Re,U8 as Ve,q2 as je,gp as Le,Ub as b,Ug as Oe,Uh as Q,gq as Ze,Ui as qe,Eh as He,h4 as ze,cW as We,Uj as Ye,gb as Je,gr as Ke}from"./zeni-epic-state-FRanwwFO.js";import{w as Qe,i as Xe,Z as ea,c as aa,d as ta,f as na,u as sa,m as c,g as oa,k as ia,z as ra,e as da,o as ca,v as la,y as ua,q as ma,r as X,L as fa,I as ha,J as ba,p as S,j as ee,C as pa,N as ae,F as ga,H as Sa}from"./index-BhDgyETA.js";import{D as ka}from"./mui-B2F_PvWe.js";import{u as Ea}from"./InboxNotificationsProvider-J2K-16R3.js";import{u as Ca}from"./useTaskManagerAccess-ljLSKJCt.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]="b14a8333-84c5-4d08-a66e-39711e37f614",l._sentryDebugIdIdentifier="sentry-dbid-b14a8333-84c5-4d08-a66e-39711e37f614")}catch{}})();const Ta=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Ue(),B=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>xe(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,U]=m.useState(void 0),v=F("/:tenantEmailDomain/dashboard")!==null,M=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,N),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),x=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),A=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&A.fetchState==="Not-Started"&&r(je(!0))}),[C,T,A.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Le(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),Ce=t((e=>b(e).reducedFetchCountState)),R=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:O,isFetchingMore:Z,hasFetchedAll:q,fetchMore:Te}=Ea();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(O===!1&&Z===!1&&q===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;U(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else U(0)}),[O,Z,q]),m.useEffect((()=>{C&&E&&!f&&j.fetchState==="Not-Started"&&B.tenantId!=null&&r(Oe("task_manager","dashboard"))}),[C,E,f,j.fetchState,B.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:Ee},H=s!=null?ra.getSignedInUserTenant(s):null,z=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&h.push("rewards_card"),P===!1&&h.push("expense_automation_card");const W=t((e=>qe(e,h).fetchState)),Y=t((e=>He(e).fetchState)),ye=v&&(W==="Completed"||W==="Error")||M&&(Y==="Completed"||Y==="Error")||!v&&!M?void 0:"disabled",we=m.useMemo((()=>ze(o.userRole)),[o.userRole]),ve=We(we),Ae=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&x.fetchState==="Completed"&&Ye(x.notificationSettings,p.userEmail,N,o,E),J=da(),Fe=J&&ca(a);return _.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:z!=null?[z]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:ve,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:Ae,rewardsPlan:A.rewardsPlan},isAiCfoAccessEnabled:J,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=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(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:S(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=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),K=e.type,_e=ae(K)&&K!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(Ke()),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(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:v,updateCurrentChatSessionId:e=>{r(Je({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Xe(n)&&Me(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-CzCs-qU3.js";import{h as r,l as i}from"./core-BBG4mxvC.js";import{am as n}from"./index-BhDgyETA.js";import"./mui-B2F_PvWe.js";import"./sentry-CWp8Ph3h.js";import"./zeni-epic-state-FRanwwFO.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.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]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-CzCs-qU3.js";import ut from"./NotFoundScreen-Cw8n2XQn.js";import{a as k}from"./sentry-CWp8Ph3h.js";import{h as ht,g as pt,i as kt,u as gt,j as S,l as St,n as bt,o as X}from"./core-BBG4mxvC.js";import{cB as It,U7 as z,fI as J,h4 as Ct,Ub as b,a15 as Q,Uh as m,U5 as y,Ax as F,Ge as Tt,a16 as At,U4 as yt,Uj as Et,AC as _t,a17 as j,br as $,gk as w,AG as Y,a18 as Nt,cN as Bt,cG as xt}from"./zeni-epic-state-FRanwwFO.js";import{aq as wt,d as Ut,c as Gt,m as vt,as as Dt,dK as Rt,p as B,dL as Pt,w as Mt,dM as jt,i as $t,a4 as Ft}from"./index-BhDgyETA.js";import"./mui-B2F_PvWe.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-BmnPs4uO.js";import{u as qt}from"./useTaskManagerAccess-ljLSKJCt.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="84f697c8-1b92-4c3a-9743-ed5732e78370",t._sentryDebugIdIdentifier="sentry-dbid-84f697c8-1b92-4c3a-9743-ed5732e78370")}catch{}})();const Lt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),Wt=St((function(t,l){const n=z(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=J(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:G}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,C=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,C=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}d==="unread"&&t(Y("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(j([a],$())));let i=`/${h}/${r[1]}`;const C=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!xt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(Q(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(F("task_manager","dashboard",d))}else G?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(Y("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(j([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(w({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(w({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(w({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Lt(o,I).then((()=>{t(j(o,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({unreadCount:0},"comments")),t(w({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(w({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=Ft(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt(jt)),Ht=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=wt(),c=It(h??""),o=gt(),f=Ut(),[I,G]=k.useState(!1),a=S((e=>z(e))),s=S((e=>J(e))),{useFeatureGate:d}=Gt(),{isFeatureEnabled:r}=d(vt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:C}=Vt({mobileExploreReferrer:"Notifications"});Dt({isDataReady:!0});const Z=Ct(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),q=S((e=>b(e).currentTab)),v=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),D=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:x,isLoading:E,hasFetchedAll:T,isFetchingMore:R,fetchMore:ot}=mt(),{threads:L,isLoading:W,fetchMore:H,isFetchingMore:K,hasFetchedAll:O}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(q!==c&&c!=null&&o(Q(c)),c==null){const e=`../${q}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&T===!0&&s?.companyId!=null&&x!=null){const e=`dashboard_${s.companyId}`,p=x.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(y({unreadCount:p},"comments"))}}),[E,T]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(F("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=E||R===!0||T!==!0||E||R===!0||T!==!0;k.useEffect((()=>{P&&D!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||D!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,D]),k.useEffect((()=>{o(y({hasMore:T!==!0},"comments"))}),[T]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(G(!0),o(Tt()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&W===!1&&x!=null&&L!=null){const e=`dashboard_${s.companyId}`,p=x.filter((u=>u.roomId===e)).filter((u=>Pt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=L.find((dt=>{return dt.id===((U=u).kind==="thread"?U.threadId:"subjectId"in U?U.subjectId:void 0);var U}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(K||O===!0||H==null||H(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,R,K,T,O,W,x?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if($t(p)){const A=yt(p.mode);if(A==="dashboard"&&o(y({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];v==="all"?_.push("read","unread"):v!=="mentions"&&_.push(v),o(F("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=qt(f);return N.jsx(Wt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:C,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(X,{path:"/:selectedTab",element:N.jsx(Ht,{})}),N.jsx(X,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};