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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/assets/{AccountMappingScreen-Dt4x9DJz.js → AccountMappingScreen-DwM3_WTC.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-BfyrJWDJ.js → ActualMatchingMatchDetailScreen---3NQIlW.js} +1 -1
  3. package/dist/assets/AddressRoutes-CRWje5aU.js +1 -0
  4. package/dist/assets/AddressScreen-DwDn6adU.js +9 -0
  5. package/dist/assets/{AiCfoScreen-SBmgGufP.js → AiCfoScreen-CmI1WP3p.js} +1 -1
  6. package/dist/assets/{AppDrawer-D7FI4GcX.js → AppDrawer-CqAnDatC.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-BxCZdf21.js → BillPayApprovalRoutes-uF3lLPXa.js} +1 -1
  8. package/dist/assets/BillPayRoutes-CxGXv0Eb.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-B20TVwus.js → BusinessVerificationPageScreen-CWJBny4J.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-DkokQGnk.js → CardsAiCfoScreen-DTmIk225.js} +1 -1
  11. package/dist/assets/ChargeCardRoutes-CBA-C6S5.js +71 -0
  12. package/dist/assets/{CompanyPassportScreen-BEG9__1k.js → CompanyPassportScreen-C0r5_u0C.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-D97ZGKWy.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-DREpIR3e.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-BFFEQyjG.js → CustomerOnboardingRoutes-BFK8USjA.js} +3 -3
  16. package/dist/assets/DashboardRoutes-CIiFmVuR.js +20 -0
  17. package/dist/assets/{DefaultTenantHome-CMvE7WXj.js → DefaultTenantHome-BWhhfpNZ.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-B2YgkOu5.js → DomesticWireDetailScreen-C8g5HYbF.js} +4 -4
  19. package/dist/assets/{DrawerScreen-I5-Ak-b_.js → DrawerScreen-jGeXohet.js} +1 -1
  20. package/dist/assets/{EntityDetailRoutes-BPqa4e5a.js → EntityDetailRoutes-DDbPZyaE.js} +1 -1
  21. package/dist/assets/ExpenseAutomationRoutes-BhSlFN1-.js +38 -0
  22. package/dist/assets/{FeaturePreviewScreen-v5dVXn4p.js → FeaturePreviewScreen-t-KcIePh.js} +1 -1
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-CsqGaYGM.js → HubSpotOAuthCallbackScreen-B9Xsd5UE.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-B4UF_uUg.js → InboxNotificationsProvider-DcarX1j5.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-BQHOoyRc.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-DDza_62u.js → MagicLinkRoutes-CfUJpVA_.js} +4 -4
  27. package/dist/assets/{MagicLinkSignInScreen-DGzxNaiE.js → MagicLinkSignInScreen-BR70G8WN.js} +1 -1
  28. package/dist/assets/MobileAppDrawer-DqgtjBKX.js +1 -0
  29. package/dist/assets/NotFoundScreen-C2GrPpNy.js +1 -0
  30. package/dist/assets/{NotificationRoutes-i3qnEWcR.js → NotificationRoutes-C1V1-m3K.js} +1 -1
  31. package/dist/assets/{OAuthConsentScreen-CRExXXMv.js → OAuthConsentScreen-UVKKdhYW.js} +1 -1
  32. package/dist/assets/PandLWithForecastRoutes-x9MBz-SJ.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-D0Hr5oRB.js → PaymentLinkScreen-BtszXnNs.js} +9 -9
  34. package/dist/assets/{PeopleRoutes-CypmG1ct.js → PeopleRoutes-By-929Rc.js} +3 -3
  35. package/dist/assets/PerformanceRoutes-DwUVercL.js +1 -0
  36. package/dist/assets/{Preview-Co3i0Xrb.js → Preview-Dxr01VGI.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-BiN0lu_W.js → QBOConnectionScreen-Chdjbcg8.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-ryr0mHPH.js → ReimbursementApprovalRoutes-DVM8rE5F.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CRU8C8RZ.js → ReimbursementApprovalRuleDetailScreen-Bf1LI70e.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-ByU4nWbt.js +68 -0
  41. package/dist/assets/ReportsRoutes-Be1H67SI.js +1 -0
  42. package/dist/assets/RewardsRoutes-iweGs61q.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-UKD1lb2-.js → ScheduleDetailsPrepaidExpensesScreen-HIrqgD7A.js} +4 -4
  44. package/dist/assets/{ScreenRoutes-6zCS0eXm.js → ScreenRoutes-CFuAOQvL.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-Bh4g9wCj.js → SettingsRoutes-CYdVWZYv.js} +5 -5
  46. package/dist/assets/{SetupPagesScreen-CdpIgBzw.js → SetupPagesScreen-BccJSzRN.js} +5 -5
  47. package/dist/assets/SignInScreen-DM0sUU51.js +1 -0
  48. package/dist/assets/SignOutScreen-Bs1NyDBL.js +9 -0
  49. package/dist/assets/{TaskListScreen-h6ryhshy.js → TaskListScreen-DQj6h_q_.js} +2 -2
  50. package/dist/assets/{TaskRoutes-BiQOVouS.js → TaskRoutes-DY92MrHK.js} +1 -1
  51. package/dist/assets/TransactionDetailRoutes-BFj2-oES.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-fc6wRDCa.js +5 -0
  53. package/dist/assets/TransactionListRoutes-DoEWtZb8.js +1 -0
  54. package/dist/assets/TreasuryRoutes-BwZlVh2U.js +37 -0
  55. package/dist/assets/{VendorsRoutes-C9tsCt7G.js → VendorsRoutes-rWAhbgUX.js} +1 -1
  56. package/dist/assets/{WiseConfirmationScreen-XbaBW0oW.js → WiseConfirmationScreen-twAmgAST.js} +1 -1
  57. package/dist/assets/ZeniAccountRoutes-BqSVR2HC.js +57 -0
  58. package/dist/assets/{ZeniAccountStatementScreen-L3XK5pKW.js → ZeniAccountStatementScreen-xKZWX655.js} +1 -1
  59. package/dist/assets/{accountMappingHelper-Ci74NLEW.js → accountMappingHelper-DpfYWNe6.js} +1 -1
  60. package/dist/assets/{analytics-8lQ_GaR7.js → analytics-CiEh1qKr.js} +1 -1
  61. package/dist/assets/{analyticsHelper-C6SU-53H.js → analyticsHelper-DHPcRAai.js} +1 -1
  62. package/dist/assets/{core-B-8b0iz9.js → core-Caq7Zbsp.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-hAviH84T.js → decodeURIComponentSafe-DmjyT4t5.js} +1 -1
  64. package/dist/assets/{dnd-CtOxA7uX.js → dnd-DwckO6rX.js} +1 -1
  65. package/dist/assets/{empty-CyiOIGJw.js → empty-CviwvzhB.js} +1 -1
  66. package/dist/assets/{empty-ZUR8mjP1.js → empty-Dl3LsHNf.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-Dch9mr3K.js → emptyVideoElement-0ADxBh21.js} +1 -1
  68. package/dist/assets/{epic-C_YIXfJm.js → epic-DqqOk9a9.js} +1 -1
  69. package/dist/assets/{expenseAutomationHelper-BzOPc0En.js → expenseAutomationHelper-B83Qa5Jl.js} +1 -1
  70. package/dist/assets/{getLocaleForTenant-D57C4sYC.js → getLocaleForTenant-YgJPw-1W.js} +1 -1
  71. package/dist/assets/{index-BUsi93tT.js → index-B3LhL1WI.js} +2 -2
  72. package/dist/assets/{index-DeS-5gfC.js → index-BLBexBOn.js} +1 -1
  73. package/dist/assets/{index-CzpjeHcU.js → index-BggnOuo1.js} +1 -1
  74. package/dist/assets/{index-CgYr_9vs.js → index-Bi5Vnzzf.js} +1 -1
  75. package/dist/assets/{index-Ce-G0Vp2.js → index-BsIiLcaT.js} +1 -1
  76. package/dist/assets/{index-DuxR1XDX.js → index-DOXJLxdR.js} +23226 -23221
  77. package/dist/assets/{index-haVo7C6B.js → index-DZj1fENq.js} +1 -1
  78. package/dist/assets/{index-b65XjN06.js → index-De1Gw5gW.js} +1 -1
  79. package/dist/assets/{lexical-BVt4M34U.js → lexical-mmp2B1vq.js} +1 -1
  80. package/dist/assets/{liveblocks-BjcYyeQ6.js → liveblocks-CIxx6Ub6.js} +1 -1
  81. package/dist/assets/{lottie-BdAYiWcR.js → lottie-CrKh4Q_r.js} +1 -1
  82. package/dist/assets/{mui-C33Oegsm.js → mui-DI0hUuFr.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bgu6njoM.js → pathToGoBack-Ch5lrOj1.js} +1 -1
  84. package/dist/assets/{pdf-BkfulyEw.js → pdf-BlhN83fm.js} +3 -3
  85. package/dist/assets/{pdf-lib-D8o-uP9K.js → pdf-lib-WBpN-CHj.js} +1 -1
  86. package/dist/assets/{plaid-Bt28AVCt.js → plaid-CXvI7t9H.js} +1 -1
  87. package/dist/assets/{pusher-BWEmmbE9.js → pusher-BZAjVztW.js} +1 -1
  88. package/dist/assets/{react-BAH__mX9.js → react-BHfk4QRe.js} +1 -1
  89. package/dist/assets/{react-CIEK2Ei-.js → react-BqA23JAy.js} +1 -1
  90. package/dist/assets/{react-Dqb011PB.js → react-BsygV86H.js} +1 -1
  91. package/dist/assets/{react-B7GqIpoL.js → react-XoZ7aD8C.js} +1 -1
  92. package/dist/assets/{react-DT9gMpbF.js → react-rmAoHvXj.js} +1 -1
  93. package/dist/assets/{react-Ls8UDl46.js → react-tooGqts4.js} +1 -1
  94. package/dist/assets/{recharts-DkYxIsLi.js → recharts-DKmpCGIA.js} +1 -1
  95. package/dist/assets/{routePaths-B1syYHWh.js → routePaths-C1OqXYGB.js} +1 -1
  96. package/dist/assets/{sentry-DZ9rNYfw.js → sentry-BCPOyc0G.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Te2Zqy4u.js → stripSplatSuffix-Dmnnw5Oe.js} +1 -1
  98. package/dist/assets/{url-BjdrSaU1.js → url-CdxI2rEH.js} +1 -1
  99. package/dist/assets/{url-DY2r7CPa.js → url-JduagIhH.js} +1 -1
  100. package/dist/assets/{useActualMatchingMatchDetail-DZnxtuQj.js → useActualMatchingMatchDetail-6t8vcRTI.js} +1 -1
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-SBKf0Pu3.js → useAiCfoDashboardSuggestedQuestionsChips-BO7_rPaJ.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-BvhP40c_.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-DmcXit2D.js → useChargeCardPusherEvents-2nVivR1x.js} +1 -1
  104. package/dist/assets/{useDeviceId-gFU5q5zf.js → useDeviceId-2NJBbYPM.js} +1 -1
  105. package/dist/assets/{useEmailConnectResultRefresh-BwFVhfcX.js → useEmailConnectResultRefresh-QqukN5jp.js} +1 -1
  106. package/dist/assets/{useInitialThreadRequest-Chu-ipGI.js → useInitialThreadRequest-uu8NipM7.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-DxrmaJfc.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-BnGLCsCG.js → useTaskManagerPusherEvents-D5Hm7um3.js} +1 -1
  109. package/dist/assets/{utils-D3rZq_G4.js → utils-rX2IEvjD.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-C1wVwRW0.js +25 -0
  111. package/dist/assets/{zeni-epic-state-95zxmizy.js → zeni-epic-state-DROyxOLw.js} +3 -3
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-DfkTMfYF.js +0 -1
  115. package/dist/assets/AddressScreen-DvJ6yyMx.js +0 -9
  116. package/dist/assets/BillPayRoutes-07S7DRSx.js +0 -119
  117. package/dist/assets/ChargeCardRoutes-BO6dVldC.js +0 -71
  118. package/dist/assets/ConnectionAuthScreen-C_s5VCbI.js +0 -11
  119. package/dist/assets/CustomerOnboardingAuthScreen-DFMNQmWy.js +0 -1
  120. package/dist/assets/DashboardRoutes-B4NxbMLL.js +0 -20
  121. package/dist/assets/ExpenseAutomationRoutes-BW9gVxz9.js +0 -38
  122. package/dist/assets/InvoicingRoutes-CxKyyTQc.js +0 -2
  123. package/dist/assets/MobileAppDrawer-0TaE2Qid.js +0 -1
  124. package/dist/assets/NotFoundScreen-BatgS8le.js +0 -1
  125. package/dist/assets/PandLWithForecastRoutes-DiipWbFp.js +0 -1
  126. package/dist/assets/PerformanceRoutes-eA0QwQYt.js +0 -1
  127. package/dist/assets/ReimbursementRoutes-B8NK1spY.js +0 -68
  128. package/dist/assets/ReportsRoutes-DRBiAxJk.js +0 -1
  129. package/dist/assets/RewardsRoutes-DqoIHOPS.js +0 -1
  130. package/dist/assets/SignInScreen-C5RNgyDG.js +0 -1
  131. package/dist/assets/SignOutScreen-BZdppeCA.js +0 -9
  132. package/dist/assets/TransactionDetailRoutes-L8u6TmTF.js +0 -1
  133. package/dist/assets/TransactionDetailScreen-KBMzz0Xq.js +0 -5
  134. package/dist/assets/TransactionListRoutes-CKeYxgtl.js +0 -1
  135. package/dist/assets/TreasuryRoutes-DsNk_W1Q.js +0 -37
  136. package/dist/assets/ZeniAccountRoutes-Bgi1019U.js +0 -57
  137. package/dist/assets/useAskAiCfoHostNavButtonProps-CvEN7QS-.js +0 -1
  138. package/dist/assets/useTaskManagerAccess-ECD0Ec-b.js +0 -1
  139. package/dist/assets/withTransactionSidePanel-qep2Sc8k.js +0 -25
@@ -0,0 +1,38 @@
1
+ import{j as b}from"./liveblocks-CIxx6Ub6.js";import{u as he,h as nt,g as be,j as _,i as Oe,t as Wn,l as Yn,n as Hn,o as He,N as Kn}from"./core-Caq7Zbsp.js";import{fF as ke,a14 as Xn,q0 as _e,Ue as Qn,A3 as Zn,a15 as es,a16 as ts,a17 as as,a18 as gt,a19 as Xe,gh as bt,a1a as ca,eW as ns,g0 as ss,a1b as ia,a1c as Qe,qT as os,uR as cs,gS as is,gQ as ls,a1d as rs,r4 as ds,rd as us,qb as ms,qp as wa,gP as re,gR as ps,a1e as hs,qL as Ra,re as Ss,qm as gs,qh as Cs,uX as fs,gO as Me,a1f as tt,Cd as Da,MA as Fa,a1g as _a,Fy as Ma,a1h as Is,eZ as ks,e$ as bs,sS as Tt,W_ as la,X0 as Ts,m2 as Ps,X1 as ys,m9 as Es,dl as vs,Dw as Pt,a1i as As,a1j as xs,fm as yt,sG as ra,WT as ws,a1k as Rs,a1l as Ds,mb as Fs,a1m as _s,Rg as Ms,ma as Us,l$ as Os,qE as Ua,rj as at,tt as Oa,tP as Bs,U4 as Ba,ri as da,rl as Va,rn as Vs,bE as js,ny as Ls,nv as zs,rm as Ze,rk as pe,a1n as $s,rE as ua,a1o as Gs,a1p as Ns,sK as qs,sL as Js,WP as Ws,VV as Ys,a0y as Hs,a1q as Ks,WV as ma,WU as Ke,a1r as pa,mq as Xs,a1s as Qs,a1t as Zs,a1u as eo,a1v as to,qz as ao,a1w as no,a1x as so,a1y as oo,ru as co,md as io,m4 as lo,a1z as ro,mc as ha,Xb as uo,a1A as mo,a1B as po,us as ho,u3 as So,u2 as Ct,a1C as go,a1D as Co,a1E as fo,a1F as Io,nJ as ko,br as bo,nE as Sa,nq as To,a1G as Po,g$ as yo,nB as Eo,sU as vo,sW as Ao,sD as xo,VY as wo,VZ as Ro,F0 as Do,E$ as Fo,Fg as _o,a1H as ga,sJ as Mo,a1I as Uo,rU as Oo,r_ as Bo,s9 as Vo,rX as jo,a1J as Lo,s8 as zo,sP as $o,a1K as Go,t0 as No,sx as qo,t6 as Jo,sC as Wo,rF as Yo,a1L as Ho,qX as Ko,qv as Xo,qC as Ca,rp as Qo,a1M as Zo,a1N as ec,a1O as tc,a1P as ac,a1Q as nc,a1R as sc,a1S as oc,ta as cc,a1T as ic,a1U as lc,a1V as fa,uD as rc,tW as dc,tL as Ia,tJ as uc,a1W as mc,ty as pc,td as hc,tM as Sc,a1X as gc,a1Y as Cc,tj as fc,a1Z as Ic,te as kc,ti as bc,tg as Tc,tS as Pc}from"./zeni-epic-state-DROyxOLw.js";import ja from"./NotFoundScreen-C2GrPpNy.js";import{a as s,R as La}from"./sentry-BCPOyc0G.js";import{n as Te,S as yc}from"./mui-DI0hUuFr.js";import{N as Be,f as X,k as Q,p as te,ar as za,at as $a,dP as Ec,dQ as vc,O as Ga,z as st,dR as Ac,dS as xc,dT as wc,af as Ue,dU as Rc,dV as ka,bb as ba,dW as Dc,a8 as Na,dX as Fc,l as et,a as _c,dY as Mc,dZ as Uc,F as Oc,W as Bc,d_ as Vc,d$ as jc,e0 as Lc,b5 as zc,bt as $c,ac as Gc,b6 as Nc,b7 as qc,G as Jc,w as Wc,e1 as Yc,aw as Ta,e2 as Hc}from"./index-DOXJLxdR.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-BvhP40c_.js";import{g as Pa,b as Kc,c as Xc,h as Qc,a as Zc,i as ei,r as ti,C as ai}from"./TransactionDetailScreen-fc6wRDCa.js";import{u as ni}from"./useActualMatchingMatchDetail-6t8vcRTI.js";import{d as si}from"./decodeURIComponentSafe-DmjyT4t5.js";import{m as Ja,a as Wa}from"./expenseAutomationHelper-B83Qa5Jl.js";import{u as Ya,a as Ha,w as oi}from"./withTransactionSidePanel-C1wVwRW0.js";import{b as ci,S as ii,a as li,J as ri}from"./ScheduleDetailsPrepaidExpensesScreen-HIrqgD7A.js";import{s as ya,i as Ka,h as di,v as ui,c as mi}from"./routePaths-C1OqXYGB.js";import{a as ft}from"./accountMappingHelper-DpfYWNe6.js";import{D as pi}from"./DrawerScreen-jGeXohet.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./useInitialThreadRequest-uu8NipM7.js";import"./stripSplatSuffix-Dmnnw5Oe.js";import"./pathToGoBack-Ch5lrOj1.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]="b9bdfee1-3a03-48dc-b4d2-c341b9f9ed12",t._sentryDebugIdIdentifier="sentry-dbid-b9bdfee1-3a03-48dc-b4d2-c341b9f9ed12")}catch{}})();const hi=()=>{const t=he(),n=nt(),f=be(),I=_((C=>ke(C))),{useFeatureGate:k}=Be(),{isFeatureEnabled:o}=k(X.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(X.aiAuditScorePercentage),v=_((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=_((C=>Xn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=qa({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,L=!1)=>{t(_e({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:L}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(Qn(I.tenantId,C))}),[I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),g=v[I.tenantId],u=s.useCallback((()=>{const C=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(g.month,g.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,C??null),x(g,I.tenantId,!0)}),[x,g,I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=te(f.state?.pathnameStackToGoBack,f.pathname),A=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&g!=null){const C=l.monthEndCloseChecks.monthEndCloseCheckList.find((h=>h.progress<100));if(C!=null)return void n(`./${C.id}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=za();return $a({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{g!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&x(g,I.tenantId)}),[x,g,l.fetchState,I.tenantId,p]),s.useEffect((()=>{g!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(Zn(g))}),[g,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const C=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(C)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const C=f.state?.referrer;Q.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,C??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),b.jsx(Si,{children:b.jsx(Ec,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},Si=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 gi({isFullView:t,matchId:n,onClose:f}){const{match:I,detailFetchState:k,handleOpenBill:o,handleContinueMatch:r,handleRefresh:v,handleUndoReversal:l,lastMatchResults:S,lastUndoResults:R,refreshStatus:x,undoReversalStatus:m}=ni(n);return b.jsx(vc,{match:I,detailFetchState:k.fetchState,isRenderedInPanel:!t,isUndoInFlight:m.fetchState==="In-Progress",refreshStatus:x.fetchState,onNavigateBack:f,onOpenBill:o,onContinueMatch:r,onRefresh:v,onUndoReversal:l,lastMatchResults:S,lastUndoResults:R})}const Ci=/^match\/([^/?]+)$/,fi=Ha({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const{useFeatureGate:n}=Be(),{isFeatureEnabled:f}=n(X.isTransactionDetailSplitViewEnabled),{isFeatureEnabled:I}=n(X.isAccrualEnabled),k=Ga(),o=(function(v=!0){const l=nt(),S=be(),R=Oe(),x=Ja(R),m=Ya({childPathPattern:Ci,enabled:v,listPath:x}),g=m.matchGroups[0]!=null&&m.matchGroups[0]!==""?si(m.matchGroups[0]):void 0,u=R.tenantEmailDomain??S.pathname.split("/").find(Boolean)??"",F=s.useRef({isOpen:m.isOpen,matchId:g});F.current={isOpen:m.isOpen,matchId:g};const A=s.useCallback((h=>{!m.isMobile&&v?F.current.isOpen&&F.current.matchId===h?m.closePanel():m.navigateToChild(`match/${encodeURIComponent(h)}`,{replace:F.current.isOpen}):l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(h)}`)}),[l,m.isMobile,m.navigateToChild,m.closePanel,v,u]),p=s.useCallback((()=>{if(g==null)return;const h=te(S.state?.pathnameStackToGoBack,`${S.pathname}${S.search}`);l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(g)}`,{state:{pathnameStackToGoBack:h}})}),[S.pathname,S.search,S.state,g,l,u]),C=m.isOpen&&g!=null;return{closePanel:m.closePanel,isOpen:C,maximize:p,matchId:v&&C?g:void 0,openPanel:A}})(t&&I===!0&&k===!0&&f===!0),r=s.useMemo((()=>{if(o.isOpen&&o.matchId!=null)return b.jsx(gi,{isFullView:!1,matchId:o.matchId,onClose:o.closePanel},o.matchId)}),[o.closePanel,o.isOpen,o.matchId]);return{injectedProps:s.useMemo((()=>({closeMatchSidePanel:o.closePanel,isMatchPanelOpen:o.isOpen,matchPanelContent:r,matchPanelMatchId:o.matchId,openMatchPanel:o.openPanel})),[r,o.closePanel,o.isOpen,o.matchId,o.openPanel]),selectedItemId:o.matchId,sidePanel:{closePanel:o.closePanel,maximize:o.maximize}}}}),Ii=La.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:f,onFetchLinkTokenClick:I,onEstablishConnectionClick:k})=>{const o=he(),{useFeatureGate:r}=Be(),{isFeatureEnabled:v}=r(X.isReconV3Enabled),{isFeatureEnabled:l}=r(X.isReconciliationCombinedStatementEnabled),S=st.getSignedInUser(),R=_((y=>ke(y))),x=s.useMemo((()=>({userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:R?.tenantId??""})),[S?.userId,S?.zeniSessionId,R?.tenantId]),{accountReconciliationsByAccountID:m,excludedAccountIDs:g,monthYearPeriod:u,statementUploadChosen:F}=t,A=m[n],p=s.useMemo((()=>es(m,n)),[m,n]),C=s.useMemo((()=>ts(m)),[m]),h=s.useMemo((()=>as(m,n)),[m,n]),L=s.useRef(!1),G=s.useCallback((y=>{L.current=y,ka(n,y)}),[n]),q=s.useCallback((y=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:y.completedSteps,startedAtMs:y.startedAtMs,totalDurationSeconds:y.totalDurationSeconds})),y.accountMappings!=null&&o(Xe({accountId:n,selectedPeriod:u,localData:{combinedStatementAccountMappings:y.accountMappings}})),A!=null&&requestAnimationFrame((()=>{L.current||o(bt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Ac(A)}]}))}))}),[o,u,A,n]),T=s.useCallback((()=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,n,u]),J=s.useCallback((y=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:y}))}),[o,u,n]),N=s.useCallback((()=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:0})),o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,u,n]);s.useEffect((()=>()=>{ka(null,!1)}),[]);const e=A?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??A?.accountReconEntity.statementMetaData?.statementUploadId,a=A?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,i=_((y=>a!=null&&a!==""?ns(ss(y.userState,a)):"")),d=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u}))}),[o,n,u]),E=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u})),o(Qe({statementUploadChosen:!0}))}),[o,n,u]),P=(y,z)=>{o(fs(y,z.split(".")[0]))},D=(y,z)=>{if(z===!0){const K=A?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(K!=null&&K!=="")return void o(gs({accountId:n,selectedPeriod:u,combinedStatementGroupId:K,fileId:y}))}e!=null&&o(Cs({accountId:n,selectedPeriod:u,fileId:y,statementUploadId:e}))},M=()=>{o(Qe({statementUploadChosen:!1}))},W=y=>{o(Ss({accountId:n,selectedPeriod:u,payload:y,statementAccountScope:l===!0?A?.localData?.statementAccountScope??"single_account":"single_account"}))},Y=s.useCallback(((y,z,K)=>{o(os({accountId:y,selectedPeriod:z,statementUploadId:K}))}),[o]),se=s.useCallback(((y,z,K,Z,ge)=>{ge!=null&&ge!==""&&o(cs(ge)),o(Z==null||Z===""?ls({accountId:y,selectedPeriod:z,statementUploadId:K}):is({accountId:y,selectedPeriod:z,statementUploadId:K,combinedStatementGroupId:Z}))}),[o]),oe=s.useCallback(((y,z)=>{z!==""&&o(rs({accountId:n,selectedPeriod:u,statementUpdateLocalData:y,statementUploadId:z}))}),[o,n,u]),Pe=s.useCallback((()=>{e!=null&&o(A?.localData?.statementAccountScope!=="multi_account"?us({accountId:n,selectedPeriod:u,statementUploadId:e}):ds({accountId:n,selectedPeriod:u,statementUploadId:e}))}),[o,A?.localData?.statementAccountScope,n,u,e]),ye=s.useCallback((y=>{e!=null&&o(ms({accountId:n,selectedPeriod:u,statementUploadId:e,accountMappings:y}))}),[o,u,n,e]),Ee=s.useCallback((()=>{o(Qe({statementUploadChosen:!0}))}),[o]),H=y=>{o(Xe({accountId:n,selectedPeriod:u,localData:{accountSource:y}}))},B=y=>{o(Xe({accountId:n,selectedPeriod:u,localData:{statementAccountScope:y}}))},Ve=s.useCallback((()=>{o(wa({accountId:n}))}),[o,n]),ve=s.useCallback((y=>{o(re(u,y,!0)),f()}),[o,u,f]),ot=s.useCallback((()=>{o(ps({accountId:n,selectedPeriod:u,statementProcessingFailed:!1})),o(hs({accountId:n,selectedPeriod:u}))}),[o,n,u]),Se=s.useCallback((()=>{o(Ra({accountId:n}))}),[o,n]),je=g.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(je!=null)return b.jsx(Ea,{children:b.jsx(va,{$isV3:v===!0,children:b.jsx(xc,{excludedAccountReconciliation:je,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:v,onDismissClick:f,onIncludeIntoReconciliation:Se})})});if(A!=null){const y=v===!0?b.jsx(wc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:H,onSelectStatementAccountScope:B,isReconciliationCombinedStatementEnabled:l===!0,ledgerAccounts:p,statementOverrideWarningAccountIds:h,unavailableLedgerAccountIds:C,onConfirmStatementMapping:ye,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve,onRetryParsing:Y,onFetchStatementParseInfo:se,onReviewClicked:ve,statementProcessingFailed:A.statementProcessingFailed,statementProcessingDismissedToBackground:A.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ot,onContinueInBackground:q,onClearStatementProcessingDismissedToBackground:T,onResetStatementProcessingProgress:N,onStatementProcessingProgressChange:J,onStatementFlowVisibilityChange:G,onReuploadStatement:Ee,onStatementFormDataChange:oe,onStatementConfirmSave:Pe,reconciledByName:i,onDismissDateConflict:d,onReuploadAfterDateConflict:E,isReconV3Enabled:v}):b.jsx(Rc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:H,filesEndPoint:Ue.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve});return b.jsx(Ea,{children:b.jsx(va,{$isV3:v===!0,children:y})})}return null})),Ea=Te.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
12
+ `,va=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 ki({panelType:t,scheduleId:n,onClose:f,onCloseAfterDecision:I}){return b.jsx(Ti,{children:b.jsx(Pi,{children:bi(t,n,f,I)})})}function bi(t,n,f,I){switch(t){case"one_time_accrual":return b.jsx(ri,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:f});case"accrued_expenses":return b.jsx(li,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"fixed_assets":return b.jsx(ii,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"prepaid_expenses":return b.jsx(ci,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:f,onPanelCloseAfterDecision:I})}}const Ti=Te.div`
22
+ display: flex;
23
+ flex-direction: column;
24
+ height: 100%;
25
+ `,Pi=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
+ `,yi=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,Ei=Ha({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(m=!0){const g=nt(),u=be(),F=he(),A=Oe(),p=Ya({childPathPattern:yi,enabled:m}),C=p.matchGroups[0],h=Ka(C)?C:void 0,L=p.matchGroups[1]!=null&&p.matchGroups[1]!==""?p.matchGroups[1]:void 0,G=p.isOpen&&h!=null&&L!=null,q=A.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",T=s.useRef({isOpen:G,scheduleId:L});T.current={isOpen:G,scheduleId:L};const J=s.useCallback(((e,a,i)=>{i!=null&&(a==="prepaid_expenses"||a==="fixed_assets")&&F(Ma({selectedJEScheduleKey:i})),!p.isMobile&&m?T.current.isOpen&&T.current.scheduleId===e?p.closePanel():p.navigateToChild(`schedule/${a}/${e}`,{replace:T.current.isOpen}):g(ya(a,e,q),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[F,g,p.isMobile,p.navigateToChild,p.closePanel,m,q]),N=s.useCallback((()=>{if(h==null||L==null)return;const e=te(u.state?.pathnameStackToGoBack,u.pathname);g(ya(h,L,q),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[g,h,L,q,u.pathname,u.state]);return{closePanel:p.closePanel,isOpen:G,maximize:N,openPanel:J,panelType:G?h:void 0,scheduleId:G?L:void 0}})(t),f=s.useRef(null),[I,k]=s.useState(null),o=s.useMemo((()=>({registerPanelDirtyGuard:m=>{f.current=m}})),[]),r=s.useCallback((m=>{f.current?.isDirty()===!0?k((()=>m)):m()}),[]),v=s.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=s.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),S=s.useCallback(((m,g,u)=>{r((()=>n.openPanel(m,g,u)))}),[r,n.openPanel]),R=s.useMemo((()=>{if(I!=null)return{onCancel:()=>k(null),onDiscard:()=>{f.current=null,k(null),I()}}}),[I]),x=s.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return b.jsx(Dc.Provider,{value:o,children:b.jsx(ki,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:v,onCloseAfterDecision:()=>{f.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,v,o]);return{injectedProps:s.useMemo((()=>({closeSchedulePanel:v,isSchedulePanelOpen:n.isOpen,openSchedulePanel:S,schedulePanelContent:x,schedulePendingDiscardConfirmation:R})),[v,S,x,R,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:v,maximize:l}}}});function vi({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:f,resetCustomerRequest:I}){const k=st.getSignedInUser();if(k==null)throw Error("Can't access Customer Request page without signing in...");const o=_((r=>Is(r,t,k)));return s.useEffect((()=>{I()}),[]),b.jsx(b.Fragment,{children:o.fetchState==="In-Progress"||o.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?b.jsx(Na,{fetchState:"In-Progress"}):b.jsx(Fc,{onCloseClick:n,addCustomerRequest:f,snippets:o.companyMonthEndReportTemplatesData,bulletPoints:o.zeniRequestsData??[]})})}const Ai={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},xi=()=>{const t=_((R=>Me(R))),n=be(),{currentSelectedViewFetchState:f,currentSelectedView:I,selectedPeriod:k}=t,o=et(I),r=et(f.fetchState),v=t.jeSchedules.uiState.selectedPageTab??"schedules",l=et(v),S=s.useCallback((R=>{const x=n.state?.referrer;I==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?Q.trackTransactionsReviewPage(k.month,k.year,t.transactionView.totalCountByTab.review,0,R,x??null):Q.trackTransactionsAutoCategorisedPage(k.month,k.year,t.transactionView.totalCountByTab.autoCategorized,0,R,x??null)),I==="missing_receipts"&&Q.trackMissingReceiptsPage(k.month,k.year,R,t.missingReceipts.transactions.length,x??null),I==="je_schedules"&&Q.trackMonthCloseScheduleListPage(k.month,k.year,R,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.failedPostings.length,(m=>{const g={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return m.forEach((u=>{if(ks(u))g.oneTimeAccrualCount+=1;else switch(bs(u)){case"prepaid_expenses":g.prepaidCount+=1;break;case"fixed_assets":g.fixedAssetsCount+=1;break;case"accrued_expenses":g.accruedCount+=1}})),g})(t.jeSchedules.pendingReviewSchedules),Ai[v],x??null),I==="flux_analysis"&&Q.trackFluxAnalysisPage(k.month,k.year,R,wi(t.fluxAnalysis),x??null),I==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&Q.trackInsightsEmailPage(k.month,k.year,R,"draft",t.auditSummary.auditScorePercentage,null,x??null)}),[k,t,v]);return s.useEffect((()=>{(r!==f.fetchState||I!==o||I==="je_schedules"&&l!=null&&v!==l)&&f.fetchState==="Completed"&&S(!1)}),[I,f.fetchState,o,v,l]),S},wi=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Ri,comma:Aa,space:Di}},dateFormat:Xa}=Jc.getLocalizedStrings(),xa=Pc,Fi=Yn((function(t,n){const{uncategorizedAccounts:f,vendorSearchAutoCompleteData:I,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,companyId:r,isMissingReceiptsBulkUploadEnabled:v,isTransactionActivityEnabled:l,newScheduleActiveType:S}=n,R=st.getSignedInUser(),x=t.tenantState.currentTenantId,m={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:x??""},g=Me(t),{selectedTransactionCategorizationTab:u}=g,{searchTransactionsResults:F,searchTransactionsFetchState:A}=Gs(t),p=S==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:C,classListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:L,newScheduleLocalData:G,saveStatus:q}=Ns(t,p);return{expenseAutomationViewSelector:g,accountListNestedAccountHierarchy:C,allDepreciationAccountListNestedAccountHierarchy:L,baseTransactionSearchFetchState:A,baseTransactionSearchResults:F,classListNestedAccountHierarchy:h,newScheduleLocalData:G,initialSelectedBaseTransaction:G.selectedBaseTransactionId!=null?qs(t.transactionState,Js(G.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Ws(t),newScheduleSaveStatus:q,bulkUploadSelector:v===!0?g.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:I,authParams:m,receiptUploadEndpoint:`${Ue.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Ta}/transaction_attachments`,bulkUploadEndpoint:v===!0?`${Ue.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:g.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:R,uncategorizedAccounts:f,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:Hs(t.tenantState,x),downloadParams:{authParams:m,jeScheduleEndPoint:`${Ta}/jeScheduleReports`,timezone:Ys(),companyName:ke(t).companyName}}}),(function(t,n){const{themeState:f,isAccountingClassesEnabled:I,isCOTEnabled:k,isMissingReceiptsBulkUploadEnabled:o,location:r,vendorSearchAutoCompleteData:v,expenseAutomationViewSelector:l,currentTenant:S,newScheduleActiveType:R,uncategorizedAccounts:x,navigate:m,onClickCustomerRequest:g,handleEditClick:u,closeSchedulePanel:F,isSchedulePanelOpen:A,openSchedulePanel:p,setActivityLogTransactionId:C}=n,{selectedPeriod:h,currentSelectedView:L,reconciliation:{selectedAccountId:G}}=l,{accountSettingsView:q}=l.jeSchedules,T=Ua(h),J=at(T.start),N=at(T.end);return{onZeniLogoClick:()=>{f.toggle()},onUploadReceiptAttachment:e=>{Q.trackMissingReceiptAttached(h.month,h.year),t(dc(e))},onUploadTransactionReceipt:(e,a,i,d,E,P)=>{t(fa(e,a,{fetchState:"In-Progress"}));const D=()=>t(fa(e,a,{fetchState:"Error"}));Hc(`${Ue.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,P,a,i,d,E).then((M=>{M!=null?t(rc(e,M)):D()})).catch(D)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(lc(e,a)),S!=null&&t(_e({tenantId:S.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,i,d)=>{t(ic(e,{fetchState:a,error:i})),i!=null&&t(bt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:d!=null?Di+Ri+d+Aa:Aa}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,i=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,d=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;i&&n.closeMatchSidePanel?.(),A===!0&&(i||d)&&F?.(),e.createdGroupCollapsed!=null?t(ac()):e.pendingGroupCollapsed!=null?t(nc()):e.failedGroupCollapsed!=null?t(sc()):e.selectedJETypeFilter!==void 0?t(oc(e.selectedJETypeFilter)):t(cc(e))},onUpdateMissingReceiptsUIState:e=>{t(tc(e))},onFetchMissingReceiptsList:()=>{N!=null&&J!=null&&t(Va({start:J,end:N},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...o===!0?{onBulkUploadFiles:e=>{t(Tc(e))},onBulkUploadProgress:e=>{t(bc(e))},onBulkUploadSuccess:e=>{t(kc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Ic(e))},onConfirmBulkUploadMatch:(e,a,i,d,E)=>{t(fc(e,a,i,d,E))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Cc())},onSetBulkUploadResultsTab:e=>{t(gc(e))},onSetBulkUploadCompletedSubTab:e=>{t(Sc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(Ia({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(hc())},onSearchTransactionsForManualMatch:(e,a)=>{t(xa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(xa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(pc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(mc())},onFetchBulkUploadBatches:e=>{t(Oa(e))},onFetchMoreBatchDetails:()=>{t(uc())},onResetBulkUploadSort:()=>{t(Ia({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(ec())},onSearchTextChanged:e=>{const a=l.currentSelectedView,i=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(Ct({selectedTab:i,uiState:{searchString:e}})),N!=null&&J!=null&&t(pe(i,{start:J,end:N},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(Zo({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(Qo())},onClose:()=>{L==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0})),m("../")},onBack:()=>{L==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(Xo(e))},onSaveReconciliationReview:e=>{t(Ko(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:i,referrer:l.currentSelectedView}}),t(Ba(e))},handleLogOutClick:()=>{const e=te(r.state?.pathnameStackToGoBack,r.pathname);m("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:i,fixedAssetsAccount:d,accruedExpensesAccount:E}=a,P=ft(q.prepaidExpensesAccountList,i.selectedOptions),D=ft(q.fixedAssetsAccountList,d.selectedOptions),M=ft(q.accruedExpensesAccountList,E.selectedOptions),W={selectedPrepaidExpensesAccountIds:P.map((Y=>Y.accountId)),selectedFixedAssetsAccountIds:D.map((Y=>Y.accountId)),selectedAccruedExpensesAccountIds:M.map((Y=>Y.accountId))};t(Ho({data:W}))},onSaveJeAccountSettingsClick:()=>{t(Yo())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:i,accumulatedDepreciationCategory:d,scheduleClass:E,scheduleExpenseCategory:P,vendor:D}=a,{allAccountList:M,allClassList:W,allDepreciationAccountList:Y}=l.jeSchedules,se=v.entityAutoCompleteView.vendor.length>0?v.entityAutoCompleteView.vendor.find((H=>H.id===D?.selectedOption)):void 0,oe={id:se?.zeniId??D?.selectedOption??"",name:se?.name??D?.defaultOptions.find((H=>H.value===D?.selectedOption))?.label??"",logo:se?.logo},Pe=P?.selectedOption!=null?M.find((H=>H.qboId===P.selectedOption)):void 0,ye=E?.selectedOption!=null?W.find((H=>H.classId===E.selectedOption)):void 0,Ee=d?.selectedOption!=null?Y.find((H=>H.qboId===d.selectedOption)):void 0;t(Wo({scheduledJournalEntryID:e,localData:{jeScheduleID:i,scheduledJournalEntryID:e,updatedCategoryId:Pe?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:Ee?.accountId,updatedVendor:{id:oe.id,name:oe.name}}}))},onRevertJeSchedule(e,a,i,d,E){t(Jo(e,a,i,d,E))},ignoreRecommendedJeSchedule(e,a,i,d){t(qo(e,a,i,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(ma({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onCancelAutoComplete:()=>{t(Ke("common"))}},onPostJESchedule(e,a){t(No({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(Go())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=mi(e,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t($o({query:e,scheduleType:R==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const i=yt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(ga({scheduleType:i,localData:a}))},onOpenMatchNewModal(e){t(zo(e))},onCloseMatchNewModal(){t(Lo())},onClearMatchNewModal(){t(jo())},onSearchMatchTransactions(e,a){t(Vo(e,a))},onSearchMatchAccruals(e,a){t(Bo(e,a))},onMatchAndReverse(e){t(Oo(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds))},onUpdateActualMatchingUIState(e){t(Uo(e))},onSaveSchedule(e,a){const i=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:d,allDepreciationAccountList:E}=l.jeSchedules,P=a.selectedAccount!=null?d.find((M=>M.qboId===a.selectedAccount)):void 0,D=a.selectedAccumulatedDepreciationCategory!=null?E.find((M=>M.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(ga({scheduleType:i,localData:{...a,selectedAccount:P?.accountId,selectedAccumulatedDepreciationCategory:D?.accountId}})),t(Mo({scheduleType:i}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(wo()),t(Ro()),t(Do({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(Fo({scheduleType:a})),t(_o(a,void 0))},onCreateOneTimeAccrual(e){t(xo(e))},handleJeScheduleClick:(e,a,i)=>{if((function(E,P){return P!=="accrued_expenses"})(0,i)&&t(Ma({selectedJEScheduleKey:a})),p!=null&&Ka(i))return void p(e,i,a);const d=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/${i}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,i,d)=>{t(a!=="revert"?Ao(e,i,d):vo(e,i,d))},onOneTimeAccrualClick:e=>{if(p!=null)return void p(e,"one_time_accrual");const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},improveMonthEndInsightsUsingZeniGPTClick:e=>{S!=null&&t(Eo(e,S.companyId,S.tenantId))},onClickCustomerRequest:g,setActivityLogTransactionId:C,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(yo())},onOpenFileAttachmentSnackBar:()=>{t(bt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Po(e))},onUpdateFileAttachment:e=>{t(To({files:e}))},previewMonthEndReport:(e,a,i,d,E)=>{S!=null&&t(Sa(e,S.companyId,a,!0,i,d,{agentInsightEdits:E,tenantId:S.tenantId}))},saveMonthEndReport:(e,a,i,d,E)=>{S!=null&&t(Sa(e,S.companyId,a,!1,i,d,{agentInsightEdits:E,tenantId:S.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:i,auditSummary:d}=l;S!=null&&d?.auditScorePercentage!=null&&(t(ko(S.companyId,e,S.tenantId)),Q.trackInsightsEmailPage(i.month,i.year,!1,"draft",d.auditScorePercentage,bo().format(Xa.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const i=l.transactionView.uiState.searchString??"",d=l.transactionView.transactions,E=d.findIndex((M=>M.id===e)),P=i.length>0?{resultPosition:E>=0?E+1:void 0,resultsCount:d.length,searchTerm:i}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,P);const D=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:D,message:"expenseAutomation",origin:"transaction_categorization",searchContext:P}})},setLocalDataForCategoryAndClass:(e,a,i,d,E,P,D,M,W,Y,se,oe)=>{t(Io(e,a,i,d,x,E,P,D,M,W,Y,se,oe))},onCancelAutoComplete:()=>{t(Ke("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(pa({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(pe(e,{start:J,end:N},!1,!1)),t(fo(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(Co(e)),t(pe("autoCategorized",{start:J,end:N},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(go(e)),t(pe(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:J,end:N},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a})),N!=null&&J!=null&&t(pe(e,{start:J,end:N},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,i,d,E,P)=>{N!=null&&J!=null&&t(pe(e,{start:J,end:N},!0,i,a,d,E,P))},resetTransactionCategorizationLocalData:(e,a,i,d,E,P,D)=>{t(So(e,a,i,d,D??null,E,P,!1)),ti(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,i,d,E)=>{t(ha({selectedTab:e,transactionId:a,lineId:i,selectedTransaction:d,uncategorizedAccounts:x,updatedVendor:E,isAccountingClassesEnabled:I}))},onSaveUpdateTransactionCategorization:(e,a,i)=>{const d=r.state?.referrer;e==="autoCategorized"?Q.trackTransactionsAutoCategorisedPage(h.month,h.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,d??null):Q.trackTransactionsReviewPage(h.month,h.year,l.transactionView.totalCountByTab.review,a.length,!1,d??null),t(ho(e,a,i)),ei(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(po({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,i,d,E,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&t(uo({transactionId:D,customerUpdates:P})),t(mo({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedCustomer:P,selectedEntity:E,isAccountingClassesEnabled:I})),E!=null&&t(Pt({entity:E,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))},onFetchRecommendationsForEntityCategorization:(e,a,i,d,E,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&(t(io({transactionId:D,vendorUpdates:{name:P.name,id:P.id?P.id:void 0}})),t(lo({vendorId:P.id?P.id:void 0,localData:{vendorName:P.name,vendorId:P.id?P.id:void 0}}))),P?.id?(t(ha({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedVendor:P,selectedEntity:E,isAccountingClassesEnabled:I})),E!=null&&t(Pt({entity:E,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))):t(ro({selectedTab:d,transactionId:D.id,lineId:W[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(Ze(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(Ze(h,!0,!1,null,!1,!1))},markAsReview:(e,a,i,d)=>{Q.trackFluxAnalysisReviewed(i.month,i.year,d??!1,e),t(co(a,e,i,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(oo(e))},updateOperatingExpensesIdsForReview:e=>{t(so({operatingExpenseIds:e,selectedPeriod:h}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=ui(e.id,e.qboId,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(no({sectionId:e,selectedPeriod:h}))},onFetchReimbursementView:(e,a,i)=>{t(Ze(e,!0,!1,a,!0,i))},onReviewClicked:e=>{t(re(h,e))},setOpenDrawerClicked:e=>{t(tt({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Da("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const i=S?.companyId;i!=null&&(t(Fa(e,i,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(_a({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(tt({selectedDrawerAccountId:e})),t(Xe({accountId:e,selectedPeriod:h,localData:{accountSource:"bank_statement"}})),t(Qe({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(re(h,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(ao({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(to({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(eo({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{n.closeSidePanel?.(),t(Zs({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,i)=>{const d=e.vendor?.id;i&&d!=null&&t(Xs(d)),t(Qs({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,Tt("bill"));const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{m(-1)},onReconListPageScroll:e=>{t(pa({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ma({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Ks({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(wa({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Ra({accountId:e}))}}}),((t,n,f)=>{const{isMissingReceiptsBulkUploadEnabled:I,...k}=f;return(function(o,r,v){return{...o,...r,...v,onUploadTransactionReceipt:(l,S,R,x,m)=>{r.onUploadTransactionReceipt(l,S,R,x,m,o.authParams)}}})(t,n,k)}))(Wc(Yc)),It="newScheduleMode",kt="newScheduleType",_i=Ei(oi((function(t){const n=t.displayName??t.name??"Component",f=La.memo(t),I=k=>{const o=he(),r=(function(){const p=he(),C=_((h=>Me(h).reconciliation.selectedDrawerAccountId));return{isOpen:C!=null,selectedAccountId:C,openPanel:s.useCallback((h=>{p(tt({selectedDrawerAccountId:h}))}),[p]),closePanel:s.useCallback((()=>{p(tt({selectedDrawerAccountId:void 0}))}),[p])}})(),v=_((p=>Me(p).reconciliation)),l=_((p=>ke(p))),S=s.useCallback(((p,C)=>{o(Da("expense_automation_reconcile",p,C))}),[o]),R=s.useCallback(((p,C)=>{const h=l?.companyId;h!=null&&(o(Fa(p,h,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",C)),o(_a({accountId:C,connectionInProgress:!0})))}),[o,l?.companyId]),x=s.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return b.jsx(Ii,{reconciliation:v,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:S,onEstablishConnectionClick:R})}),[r.isOpen,r.selectedAccountId,r.closePanel,v,S,R]),m=s.useMemo((()=>({reconPanelContent:x,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[x,r.isOpen,r.closePanel]),{useFeatureGate:g}=Be(),{isFeatureEnabled:u}=g(X.isReconV3Enabled),F=s.useContext(ba),A=s.useMemo((()=>r.isOpen?u===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:F),[r.isOpen,r.closePanel,r.selectedAccountId,F,u]);return b.jsx(ba.Provider,{value:A,children:b.jsx(f,{...k,...m})})};return I.displayName=`withReconSidePanel(${n})`,I})(fi((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:f,matchPanelContent:I,isMatchPanelOpen:k,openMatchPanel:o,openTransactionPanel:r,panelContent:v,reconPanelContent:l,reconSidePanelIsOpen:S,isSchedulePanelOpen:R,closeSchedulePanel:x,openSchedulePanel:m,schedulePanelContent:g,schedulePendingDiscardConfirmation:u,sidePanelIsFullView:F,sidePanelIsOpen:A})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:C}=_c(),h=Mc(),{isOpen:L}=Uc(),G=nt(),q=be(),T=he(),{isAiCfoAccessEnabled:J,onAskAiCfoClick:N}=qa({mobileExploreReferrer:"Transaction categorization"}),e=s.useCallback((()=>{k===!0&&t?.(),A===!0&&F!==!0&&f?.()}),[t,f,k,F,A]),a=_(As);s.useEffect((()=>{a===!0&&(e(),T(xs()))}),[a,e,T]);const{areTenantIdsInSync:i}=za(),d=xi(),E=Oc(),[P,D]=s.useState(!1),[M,W]=Wn(),Y=s.useCallback((c=>{W((w=>{const $=new URLSearchParams(w);return c==null?($.delete(It),$.delete(kt),$):($.set(It,c.scheduleDetailsMode),$.set(kt,c.scheduleType),$)}),{replace:!0})}),[W]),[se,oe]=s.useState(void 0),Pe=s.useCallback(((c,w,$)=>{const j=yt(c);oe(j),Y({scheduleDetailsMode:w,scheduleType:c}),T(ra({scheduleType:j==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:$}))}),[T,Y]),ye=s.useMemo((()=>{const c=M.get(It),w=M.get(kt);return c!=null&&w!=null?{scheduleDetailsMode:c,scheduleType:w}:void 0}),[M]),Ee=s.useCallback((c=>{Y(c),c!=null&&T(ra({scheduleType:yt(c.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[T,Y]),H=_((c=>la(c))),B=_((c=>ke(c))),[Ve,ve]=s.useState(!1),[ot,Se]=s.useState(!1),[je,y]=s.useState([]),[z,K]=s.useState(null),Z=s.useCallback((()=>{K(null)}),[]),ge=z?.contentType==="activity"?z.detail.transactionId:void 0,ct=s.useCallback((c=>{c!=null?(p&&C(!1),h(),e(),K({contentType:"activity",detail:{transactionId:c}})):K((w=>w?.contentType==="activity"?null:w))}),[e,p,h,C]),Qa=s.useCallback((c=>{p&&C(!1),h(),e(),K({contentType:"transfer",detail:c})}),[e,p,h,C]),Za=s.useCallback((()=>{h(),Z(),e(),N()}),[e,Z,N,h]),Et=s.useRef(p);s.useEffect((()=>{p===!0&&Et.current===!1&&(h(),Z(),e()),Et.current=p}),[e,Z,p,h]);const vt=s.useRef(L);s.useEffect((()=>{L===!0&&vt.current===!1&&(p&&C(!1),Z(),k===!0&&t?.(),A===!0&&F!==!0&&f?.()),vt.current=L}),[Z,t,f,L,p,k,C,F,A]);const Le=A===!0&&F!==!0||k===!0,At=s.useRef(Le);s.useEffect((()=>{Le&&!At.current&&(p&&C(!1),h(),Z()),At.current=Le}),[Z,p,Le,h,C]);const[xt,en]=s.useState(!1),wt=s.useRef(!1),{selectedTab:tn}=Oe(),{tenantEmailDomain:it}=Oe(),[lt,Rt]=s.useState(q.state?.message==="comingFromTransactionDetail"),Dt=q.state?.message==="comingFromOverview",an=Bc(),rt=st.getSignedInUser(),{useFeatureGate:ce}=Be(),{isFeatureEnabled:Ft}=ce(X.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:Ae}=ce(X.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:dt}=ce(X.isTransactionActivityEnabled),{isFeatureEnabled:_t}=ce(X.isAccrualEnabled),nn=Ga(),de=_t===!0&&nn===!0,{isFeatureEnabled:Mt}=ce(X.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:sn}=ce(X.isProjectsTransactionsEnabled),{isFeatureEnabled:on}=ce(X.isReconV3Enabled),cn=s.useCallback((c=>{const w=Tt(c.transactionType??(c.view==="reconciliation"?"bill":"expense")),$=te(q.state?.pathnameStackToGoBack,q.pathname),j=new URLSearchParams({view:"full"});c.threadId!=null&&j.set("thread_id",c.threadId),c.entityType!=null&&j.set("entity_type",c.entityType),G(`/${it}/transaction/${encodeURIComponent(w)}/${c.transactionId??c.entityId}?${j.toString()}`,{state:{pathnameStackToGoBack:$,message:"expenseAutomation"}})}),[G,it,q.state,q.pathname]),ln=_((c=>ws(c,"common"))),V=_((c=>Me(c))),{categoryOptions:rn,paymentAccountNames:dn}=_((c=>Rs(c.accountState))),un=_((c=>Ds(c.classState))),{monthEndCloseChecksView:ee,currentSelectedView:U,selectedPeriod:O,selectedTransactionCategorizationTab:ut,currentSelectedViewBackgroundRefreshFetchState:mn,currentSelectedViewFetchState:ie,jeSchedules:mt,reconciliation:Ut}=V;Kc(U==="transaction_categorization");const pn=V.transactionView.saveStatus.fetchState,ze=V.transactionView.transactions,Ot=s.useRef(ze);Ot.current=ze;const Bt=_((c=>c.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Vt=_((c=>c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),jt=s.useRef(Bt);jt.current=Bt;const Lt=s.useRef(Vt);Lt.current=Vt;const $e=_((c=>{const w=c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return w!=null?c.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[w]?.filters:void 0})),zt=s.useRef("");s.useEffect((()=>{if(U!=="transaction_categorization")return;const c=V.transactionView.uiState.searchString??"";if(ie.fetchState!=="Completed"||c.length===0||c===zt.current)return;zt.current=c;const w=$e!=null?Vc($e):0,$=$e?.categories.filter((j=>j.values.length>0&&String(j.values[0]??"").trim()!=="")).map((j=>`${j.field}:${j.values.join(",")}`))??[];Q.trackAiCloseTransactionSearch({filtersApplied:$,hasResults:ze.length>0,isFiltered:w>0,resultsCount:ze.length,searchTerm:c,searchType:"free_text"})}),[U,ie.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,$e]);const le=Xc(pn,(()=>{const c=[],w=Lt.current,$=jt.current,j=$!=null&&w!=null?$[w]:void 0;if(j?.transactionReviewLocalDataById!=null)for(const fe of Object.values(j.transactionReviewLocalDataById)){const ae=fe?.transactionReviewLocalData?.lineItemById;if(ae!=null)for(const pt of Object.values(ae)){const Fe=pt?.account;Fe?.accountId!=null&&c.push(Fe.accountId)}}const Ce=Ot.current;for(const fe of Ce)for(const ae of fe.lines??[])"account"in ae&&ae.account?.accountId!=null&&c.push(ae.account.accountId);return c}));s.useEffect((()=>{U==="transaction_categorization"&&A!==!0||ct(void 0)}),[U,ct,A]),s.useEffect((()=>{S===!0&&n?.()}),[U,Ut.selectedAccountId]);const hn=V.transactionView.selectedTransactionCategorizationCompletedSubTab,Sn=V.transactionView.selectedTransactionGroup,Ge=`${ut}|${hn}|${Sn}`,Ne=s.useRef(null),$t=s.useRef(null);s.useEffect((()=>{Ne.current!==null?Ne.current!==Ge&&(Ne.current=Ge,U==="transaction_categorization"&&Z()):Ne.current=Ge}),[Z,U,Ge]);const gn=_((c=>ge==null?void 0:Fs(c.transactionState,ge))),ue=gn?.qboId,Gt=_((c=>ue==null?void 0:_s(c,ue)));s.useEffect((()=>{ue!=null&&T(Ms(ue))}),[T,ue]);const{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transferAccounts:Jt}=V.transactionView,Wt=s.useCallback((c=>Qc(T,c)),[T]),Yt=s.useMemo((()=>U!=="transaction_categorization"||z==null?null:z.contentType==="activity"?dt===!0?b.jsx(jc,{activityLogView:Gt,qboId:ue,onClose:()=>K(null),selectedTransactionId:z.detail.transactionId,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null:z.contentType==="transfer"?b.jsx(Lc,{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transaction:z.detail,transferAccounts:Jt,onClose:()=>K(null),onCreateTransfer:Wt,isQuickViewCardStyle:!0},String(z.detail.transactionId)):null),[U,z,dt,Gt,ue,Nt,qt,Jt,Wt]),Cn=Yt!=null,{selectedAccountId:xe}=Ut,Ht=et(mt.accountSettingsView.saveState.fetchState),fn=_((c=>Us(c.accountState,c.accountListState,"accountList"))),In=_((c=>Os(c))),we=Wa(tn)??U,kn=_((c=>c.entityAutoCompleteState.autoCompleteText.common));if($a({isDataReady:ie.fetchState==="Completed"}),rt==null)throw Error("Can't access expense automation screen without signing in...");const Kt=Ua(O),Re=at(Kt.start),De=at(Kt.end);if(Re==null||De==null)throw Error(`Invalid start - ${Re} and end - ${De} period from given ${O}`);const bn=s.useCallback((()=>{ve(!1)}),[]),Tn=s.useCallback((()=>{Se(!0)}),[]),Pn=s.useCallback((c=>{y(c),Se(!1)}),[]),yn=s.useCallback((()=>{y([])}),[]),qe=V.missingReceipts.bulkUpload.phase,Xt=V.missingReceipts.bulkUpload.currentBatchId;s.useEffect((()=>{Ae===!0&&U==="missing_receipts"&&qe==="matching"&&Xt!=null&&T(Oa({cacheOverride:!0}))}),[Ae,U,qe,Xt,T]);const Qt=rt?.userId,En=O.month,vn=O.year,Zt=B?.tenantId;s.useEffect((()=>{U==="missing_receipts"&&Ae!==!1&&qe==="idle"&&Qt!=null&&Zt!=null&&T(Bs())}),[U,Ae,qe,Qt,Zt,En,vn,T]),s.useEffect((()=>{H.newVendorState?.vendorDetailLocalData?.vendorName!=null?D(!0):D(!1)}),[H.newVendorState?.vendorDetailLocalData?.vendorName]),s.useEffect((()=>{we!=null&&U!==we&&T(Ba(we))}),[we]),s.useEffect((()=>{xt===!1&&ie.fetchState==="Completed"&&i&&(en(!0),T(da(!1,!1,de)))}),[xt,ie,i,de]),s.useEffect((()=>{const c={month:O.month,year:O.year},w=$t.current;$t.current=c,w===null||w.month===c.month&&w.year===c.year||!Dt&&i&&(T(da(!1,!1,de)),T(re(O,xe,!1,!1)))}),[O.month,O.year,i,de]);const Je=s.useCallback(((c=!1,w=!1)=>{const $={start:Re,end:De};switch(U){case"transaction_categorization":T(pe(ut,$,c,!lt,void 0,void 0,w)),Rt(!1);break;case"flux_analysis":T(Ze(O,c,w,null));break;case"month_end_insights":if(w===!1){const j=new Date(O.year,O.month,0),Ce=js(j.toDateString()).format(Xa.analytics.YYYYDashMMDashDDFormat);T(Ls(!0,B.companyId,B.tenantId,Ce)),T(zs(B.companyId,B.tenantId))}break;case"je_schedules":T(Vs($,w,de));break;case"missing_receipts":T(Va($,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,w));break;default:T(re(O,xe,c,w))}}),[U,Re,De,B.companyId,B.tenantId,ut,O,xe,lt,Rt,de]),An=s.useCallback((()=>{Je(!0,!0)}),[Je]);s.useEffect((()=>{U===we&&ie.fetchState==="Not-Started"&&i&&Je(!0)}),[ie,Re,De,B.companyId,B.tenantId,i]),s.useEffect((()=>{Dt||lt||wt.current||mn.fetchState==="In-Progress"||ie.fetchState!=="Completed"||(wt.current=!0,Je(!0,!0))}),[]),s.useEffect((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState!=="Completed"&&ee.fetchState!=="Error"&&B?.tenantId!=null&&T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!1}))}),[ee.fetchState,B?.tenantId]),s.useEffect((()=>{ee.fetchState!=="Completed"||!i||(ee.monthEndCloseChecks?.monthEndCloseCheckList.some((c=>c.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&T(re(O,void 0,!1,!1))}),[ee.fetchState,i,O.month,O.year,V.reconciliation.fetchStatus.fetchState,T]),s.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?ve(!0):ve(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),s.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&i&&(T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!0})),T($s({companyId:B.companyId})),G("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,B.tenantId,O,B.companyId,i]),s.useEffect((()=>{const c=setInterval((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState==="Completed"&&T(_e({tenantId:B.tenantId,period:O,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(c)}),[ee.fetchState,B.tenantId,O,T]),s.useEffect((()=>{const c=setInterval((()=>{U==="reconciliation"&&xe==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&T(re(O,void 0,!0,!0))}),3e5);return()=>clearInterval(c)}),[U,T,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,re,xe,O]);const xn=Pa(),{isFeatureEnabled:wn}=ce(X.isRecommendationFeedbackEnabled),ea=zc(),{onRecommendationSelection:ta,popup:Rn}=Zc({isEnabled:wn}),Dn=s.useMemo((()=>({...ea,onRecommendationSelection:ta})),[ea,ta]);s.useEffect((()=>{const c=(ee.monthEndCloseChecks?.monthEndCloseCheckList.find((w=>w.id==="month_end_insights"))?.isDisabled??!1)&&!Ft;U!=="month_end_insights"||!c&&ee.monthEndCloseChecks?.reportEmailSentDate==null||G("../")}),[U,ee.monthEndCloseChecks]);const Fn=S===!0?l:v,_n=S===!0||A===!0,Mn=S===!0?n:f,Un=S!==!0&&F;s.useEffect((()=>{Ht==="In-Progress"&&mt.accountSettingsView.saveState.fetchState==="Completed"&&T(ua())}),[Ht,mt.accountSettingsView.saveState.fetchState,ua]);const{transactionId:aa,onSaveVendor:On,onSaveSuccess:Bn,onCancel:Vn,vendorViewDetails:jn}=(({expenseAutomationViewSelector:c,closeDrawerHandler:w,currentSelectedView:$})=>{const j=he();let Ce,fe,ae;const pt=Pa(),Fe=c.transactionView;let na=()=>{};const{transactions:Ln,selectedTransactionId:Ie,selectedTransactionLineId:We,transactionLocalData:zn}=Fe;if($==="transaction_categorization"){const ht=zn.find((me=>me.transactionId===Ie)),ne=Ln.find((me=>me.id===Ie)),sa=We!=null?ht?.transactionReviewLocalData?.lineItemById[We]:void 0,oa=sa?.account;fe=sa?.class?.classId,Ce=["Uncategorized Income","Uncategorized Expense"].includes(oa?.accountName??"")?void 0:oa?.accountId;const Gn=di(Ie,ne?.typeOfTransaction);ne!=null&&Gn&&(ae={id:Ie,type:Tt(ne.typeOfTransaction)}),na=()=>{if(Ie!=null&&We!=null&&ne!=null){const me=Fe.transactionLocalData.find((Ye=>Ye.transactionId===Ie))?.transactionReviewLocalData;if(me!=null&&ne.lines!=null&&ne.lines.length>0){const Ye=me.lineItemById[We];let St=me.selectedEntity;if(vs(ne)||(St=Ye.selectedEntityLine),St!=null){const Nn=St,qn={transactionId:{id:ne.id,type:ne.type},transaction:ne,lineIds:ne.lines.map((Jn=>Jn.id))??[]};j(Pt({entity:Nn,amount:Ye.amount.amount,transactionDetails:qn,flowType:"categorization",selectedTab:c.selectedTransactionCategorizationTab,isFetchCOT:pt}))}}}}}const $n=_((ht=>la(ht,void 0,Ce,fe)));return{transactionId:ae,onSaveVendor:()=>{j(Es(ae,void 0,!1,!0))},onSaveSuccess:na,onCancel:()=>{ae!=null&&j(Ts({transactionId:ae})),j(Ps()),j(ys()),w()},vendorViewDetails:$n}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{D(!1)},currentSelectedView:U});return an?.loggedInUserRoleMap==null?ee.fetchState==="Error"?b.jsx($c,{onGoHome:()=>G("../",{replace:!0}),onReload:()=>window.location.reload()}):b.jsx(Na,{fetchState:"In-Progress"}):b.jsxs(b.Fragment,{children:[b.jsx(pi,{isOpen:ot,drawerLeftMargin:new Gc(0,0,300,650),onClose:()=>{Se(!1)},children:b.jsx(Mi,{onClick:c=>c.stopPropagation(),children:b.jsx(vi,{companyId:B.companyId,closeCustomerRequestDrawer:()=>Se(!1),addCustomerRequest:Pn,resetCustomerRequest:yn})})}),aa!=null&&P&&b.jsx(ai,{isOpen:P,transactionId:aa,onSaveVendor:On,onSaveSuccess:Bn,onCancel:Vn,vendorViewDetails:jn}),b.jsx(Nc,{toolkit:Dn,children:b.jsx(Fi,{events:[],eventCallback:(c,w,$)=>{},navigate:G,location:q,themeState:E,categoryOptions:rn,classesForFilters:un,accountsForFilters:dn,vendorSearchAutoCompleteData:{autoCompleteText:kn,entityAutoCompleteView:ln},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:Ae,monthEndInsightsPreviewMode:Ve,monthEndInsightsCustomerRequestData:je,isRealtimeInsightsFeatureEnabled:Ft,isCreateTransferEntryFromExpenseEnabled:Mt,isAccountingClassesEnabled:In,isProjectsTransactionsEnabled:sn,isCOTEnabled:xn,currentTenant:B,companyId:B.companyId,signedInUser:rt,isTransactionActivityEnabled:dt,isRightPanelOpen:Cn,rightSidePanel:Yt,onOpenTransferRightPanel:Mt===!0?Qa:void 0,uncategorizedAccounts:fn,newScheduleActiveType:se,isAccrualEnabled:_t,isActualMatchingEnabled:de,newScheduleSelection:ye,onNewScheduleSelectionChange:Ee,onScheduleTypeChange:Pe,onNewScheduleSaved:An,onClickCustomerRequest:Tn,handleEditClick:bn,tenantEmailDomain:it,trackExpenseAutomationTabAnalytics:d,setActivityLogTransactionId:ct,closeMatchSidePanel:t,closeSidePanel:Mn,openTransactionPanel:r,closeSchedulePanel:x,openSchedulePanel:m,openMatchPanel:o,sidePanelIsOpen:_n,sidePanelIsFullView:Un,panelContent:Fn,isAiCfoAccessEnabled:J,onAskAiCfoClick:Za,isReconV3Enabled:on,onExpenseAutomationCommentingThreadClick:cn,sidePanelListPercent:S===!0?66:void 0,isMatchPanelOpen:k,isSchedulePanelOpen:R,matchPanelContent:I,schedulePanelContent:g,schedulePendingDiscardConfirmation:u})}),Rn,le.showPopup&&le.popupType!=null&&b.jsx(qc,{popupType:le.popupType,currencySymbol:le.currencySymbol,accountId:le.popupAccountId??"",accountName:le.popupAccountName??"",onSubmit:le.handleSubmit,onDismiss:le.handleDismiss})]})}))))),Mi=Te(yc)`
35
+ display: flex;
36
+ min-height: 100%;
37
+ flex-direction: column;
38
+ `;function Ui(){const t=be(),{selectedTab:n,tenantEmailDomain:f}=Oe(),I=_((r=>ke(r))),k=_((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[I.tenantId]));if(Wa(n)==null)return b.jsx(ja,{});const o=Ja({tenantEmailDomain:f,selectedTab:n,selectedPeriod:k!=null?`${k.month}-${k.year}`:void 0});return o==null?null:b.jsx(Kn,{to:o,replace:!0,state:t.state})}function ul(){return b.jsxs(Hn,{children:[b.jsx(He,{index:!0,element:b.jsx(hi,{})}),b.jsx(He,{path:"/:selectedTab/:selectedPeriod/*",element:b.jsx(_i,{})}),b.jsx(He,{path:"/:selectedTab",element:b.jsx(Ui,{})}),b.jsx(He,{path:"*",element:b.jsx(ja,{})})]})}export{ul as default};
@@ -1 +1 @@
1
- import{j as s}from"./liveblocks-BjcYyeQ6.js";import{a as r}from"./sentry-DZ9rNYfw.js";import{ax as l,ay as p,R as m,a5 as b}from"./index-DuxR1XDX.js";import"./mui-C33Oegsm.js";import f from"./NotFoundScreen-BatgS8le.js";import{h as c,g as u}from"./core-B-8b0iz9.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]="84290e3a-b5eb-4a67-b663-116401857d00",e._sentryDebugIdIdentifier="sentry-dbid-84290e3a-b5eb-4a67-b663-116401857d00")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=b(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:m(o),onDemoClick:t,onGoBack:i}):s.jsx(f,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
1
+ import{j as s}from"./liveblocks-CIxx6Ub6.js";import{a as r}from"./sentry-BCPOyc0G.js";import{ax as l,ay as p,R as m,a5 as b}from"./index-DOXJLxdR.js";import"./mui-DI0hUuFr.js";import f from"./NotFoundScreen-C2GrPpNy.js";import{h as c,g as u}from"./core-Caq7Zbsp.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]="84290e3a-b5eb-4a67-b663-116401857d00",e._sentryDebugIdIdentifier="sentry-dbid-84290e3a-b5eb-4a67-b663-116401857d00")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=b(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:m(o),onDemoClick:t,onGoBack:i}):s.jsx(f,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -1 +1 @@
1
- import{a as r}from"./sentry-DZ9rNYfw.js";import{u as l,h as f,g as m}from"./core-B-8b0iz9.js";import{hY as p,UB as g,UC as _}from"./zeni-epic-state-95zxmizy.js";import{u as b,L as h,z as y}from"./index-DuxR1XDX.js";import"./liveblocks-BjcYyeQ6.js";import"./recharts-DkYxIsLi.js";import"./mui-C33Oegsm.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var 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]="2a93d830-e3af-449b-98b3-7756e027ec7c",e._sentryDebugIdIdentifier="sentry-dbid-2a93d830-e3af-449b-98b3-7756e027ec7c")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
1
+ import{a as r}from"./sentry-BCPOyc0G.js";import{u as l,h as f,g as m}from"./core-Caq7Zbsp.js";import{hY as p,UB as g,UC as _}from"./zeni-epic-state-DROyxOLw.js";import{u as b,L as h,z as y}from"./index-DOXJLxdR.js";import"./liveblocks-CIxx6Ub6.js";import"./recharts-DKmpCGIA.js";import"./mui-DI0hUuFr.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var 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]="2a93d830-e3af-449b-98b3-7756e027ec7c",e._sentryDebugIdIdentifier="sentry-dbid-2a93d830-e3af-449b-98b3-7756e027ec7c")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -1 +1 @@
1
- import{n as s}from"./liveblocks-BjcYyeQ6.js";import{j as d}from"./core-B-8b0iz9.js";import{fF as a}from"./zeni-epic-state-95zxmizy.js";import"./sentry-DZ9rNYfw.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
1
+ import{n as s}from"./liveblocks-CIxx6Ub6.js";import{j as d}from"./core-Caq7Zbsp.js";import{fF as a}from"./zeni-epic-state-DROyxOLw.js";import"./sentry-BCPOyc0G.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -0,0 +1,2 @@
1
+ import{j as a}from"./liveblocks-CIxx6Ub6.js";import{a as r}from"./sentry-BCPOyc0G.js";import{u as P,h as L,i as _,j as E,t as Z,l as O,s as H,g as W,N as B,n as oe,o as j}from"./core-Caq7Zbsp.js";import{a9 as tt,k as S,ar as R,U as m,cd as it,ce as ot,cf as at,cg as st,ch as ct,ci as rt,cj as lt,ck as dt,cl as ut,cm as gt,cn as mt,co as vt,p as X,cp as pt,cq as St,z as G,af as ce,cr as ft,cs as ht,ct as It,cu as Ct,cv as Et,cw as kt,cx as yt,cy as xt,cz as bt,cA as jt,W as Dt,aj as un,cB as Pt,cC as Lt,cD as At,cE as $t,cF as wt,cG as Ft,cH as _t,cI as Rt,cJ as Tt,cK as Ot,cL as Mt,t as qe,l as $e,cM as Nt,cN as Ut,cO as Bt,cP as Vt,cQ as Ht,cR as qt,cS as zt}from"./index-DOXJLxdR.js";import"./mui-DI0hUuFr.js";import{A as Q}from"./AddressScreen-DwDn6adU.js";import M from"./NotFoundScreen-C2GrPpNy.js";import{ZQ as Qt,ZR as Kt,vp as ze,ZS as K,vS as re,ZT as we,ZU as le,wt as be,wA as Gt,wF as gn,ZV as Fe,wx as mn,y7 as Qe,vR as Ke,ZW as Zt,ZX as vn,wQ as je,ZY as de,wU as Wt,ZZ as Xt,Z_ as pn,wX as Sn,z2 as Jt,Z$ as Se,_0 as Ge,_1 as fn,vP as Yt,_2 as ei,vJ as ni,_3 as ti,yk as ii,_4 as hn,yt as Ze,_5 as oi,yq as ai,_6 as _e,gh as Re,_7 as te,_8 as ie,xa as si,vX as We,w0 as In,v_ as ci,vU as ri,x3 as li,w2 as di,xc as ui,_9 as De,xl as Cn,xj as J,xh as ue,xg as gi,_a as En,yz as Xe,_b as mi,vQ as kn,_c as Te,fF as fe,wb as Pe,w8 as Le,wl as yn,wk as Oe,w5 as vi,we as xn,wn as ae,VC as bn,vT as Me,wi as pi,wj as Si,wh as fi,_d as hi,wV as Ii,wR as jn,_e as Dn,vD as Je,_f as Ci,vz as Ei,_g as ki,yF as yi,yJ as q,yE as xi,xN as he,_h as bi,_i as Pn,yS as Ye,_j as ji,yP as Di,_k as Ln,xQ as Pi,xR as V,xU as Li,_l as An,y2 as ke,_m as Ai,xb as $n,U8 as wn,_n as $i,yc as wi,_o as Fn,_p as Fi,_q as _i,_r as Ri,zH as Ti,_s as Oi,_t as _n,yZ as Rn,_u as Tn,zF as ye,_v as Mi,zC as Ni,_w as Ui,_x as Bi,_y as Vi,_z as Hi,_A as qi,_B as en,_C as zi,eg as Qi,zL as Ki,_D as Ne,xv as Gi,xq as Zi,_E as ge,xG as On,xy as me,xx as Wi,xB as Mn,_F as Xi,xw as Ji,_G as Nn,z3 as Un,zu as nn,zp as Yi,_H as eo,z4 as no,_I as to,zv as io,zz as oo,_J as Ue,wv as Bn,zg as ao,ww as so,_K as co,_L as Vn,c8 as ro,ms as lo,mt as uo,_M as tn,wu as ve,gl as go,mz as mo,zm as Hn,zX as vo,zj as qn,uX as po,zU as on,uL as So,zR as an,hS as fo,UB as sn,UC as ho,Gh as zn,hK as Io,_N as Co,Vr as Eo,_O as ko,A0 as xe,A1 as yo,_P as xo,_Q as Qn,z_ as bo,_R as jo,_S as Do,yg as Po,_T as Lo}from"./zeni-epic-state-DROyxOLw.js";import{M as Ao}from"./MobileAppDrawer-DqgtjBKX.js";import{q as pe}from"./QBOConnectionScreen-Chdjbcg8.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";import"./InboxNotificationsProvider-DcarX1j5.js";import"./useTaskManagerAccess-DxrmaJfc.js";import"./empty-CviwvzhB.js";import"./pdf-lib-WBpN-CHj.js";import"./index-Bi5Vnzzf.js";import"./url-CdxI2rEH.js";import"./index-BggnOuo1.js";import"./decodeURIComponentSafe-DmjyT4t5.js";(function(){try{var 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]="9091bdc6-d761-4883-8449-a83066fb69c6",t._sentryDebugIdIdentifier="sentry-dbid-9091bdc6-d761-4883-8449-a83066fb69c6")}catch{}})();const $=({event:t,isReady:e=!0})=>e?a.jsx(tt,{analytics:S,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function $o(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:p,items:f,nextCursor:h,auditLogEntityRouteOptions:k,auditLogListSortFieldOptions:I}=E(Qt),y=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${n??""}/invoicing`,C=r.useCallback(((A,U)=>{const T=Kt(b,A,U,k);T!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:A,entityId:U,fromScreen:"audit_log"}),e(T))}),[k,e,b]);r.useEffect((()=>{const A=setTimeout((()=>d(o)),300);return()=>clearTimeout(A)}),[o]),r.useEffect((()=>{i&&t(ze({filters:y,keepExistingListItems:!1,sort:u}))}),[i,y,u,t]);const D=g==="Not-Started"||g==="In-Progress"&&f.length===0,x=g==="In-Progress"&&f.length>0,w=g==="Completed";return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:w}),a.jsx(it,{auditLogEntityRouteOptions:k,auditLogListSortFieldOptions:I,entries:f,hasMore:p,isLoading:D,isLoadingMore:x,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{p&&h!=null&&t(ze({cursor:h,filters:y,keepExistingListItems:!0,sort:u}))},onSearchChange:s,onSortChange:v})]})}function Ie(t,e=!1){const n=P(),i=E((c=>K(c).productNextCursor!=null)),o=E((c=>K(c).productNextCursor)),s=E((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&s!=="Not-Started"||n(re({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&s!=="In-Progress"&&i&&o!=null&&n(re({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,s,i,o])}function Y(t,e,n,i){const[o,s]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),s((v=>v+1)))}),[c,e]),o}const wo=new Set(["plan"]),Fo=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!==""?o=>{i!==""&&t(mn({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&t(Fe({id:i,localData:o}))},onSaveEdit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(gn({id:i}))},onSubFamilyLifecycleAction:(o,s)=>{i!==""&&t(Gt({action:s,id:o,parentItemId:i}))}}}))(ot);function _o(){const t=P(),e=L(),{item_id:n,tenantEmailDomain:i}=_(),[o]=Z(),{areTenantIdsInSync:s}=R(),c=(d=o.get("kind"))!=null&&wo.has(d)?d:"plan";var d;const l=E((y=>we(y,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[t,n]),r.useEffect((()=>{s&&t(be({id:n,kind:c}))}),[s,n,c,t]);const g=r.useCallback((y=>t(be({cacheOverride:!0,id:y,kind:c}))),[t,c]),p=Y(l.fetchState,l.isFormLoading,n,g),f=u==="Completed"&&!l.isFormLoading;Ie(s,!0);const[h,k]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&k(n)}),[n,f]);const I=h!==n&&(u==="Not-Started"||u==="In-Progress"||l.isFormLoading);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:f}),a.jsx(Fo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:I,view:l},p)]})}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:o}=e,s=o!=null?`${n}/catalog/${encodeURIComponent(o)}`:`${n}/catalog`;return{onBack:()=>e.navigate(s),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(le({id:o})),e.navigate(`${n}/catalog`)},onChange:c=>{t(Fe({id:o,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(gn({id:o}))}}}))(at);function Mo(){const t=P(),e=L(),{item_id:n,tenantEmailDomain:i}=_(),[o]=Z(),{areTenantIdsInSync:s}=R(),c=n!=null,d=o.get("type"),l=d!=null&&Ro.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&To.has(u)?u:"plan";var u;const g=E((p=>we(p,n)));return Ie(s,!0),r.useEffect((()=>{s&&t(be({id:n,kind:v}))}),[s,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(Fe({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const p=g.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(le({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),a.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",o=e.activeTab==="all",s=i?n.plans:o?[...n.plans,...n.products]:n.products,c=i||o&&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:o&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&s.length===0,isLoadingMore:c==="In-Progress"&&s.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",s=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=No[e.activeTab];S.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(mn({action:Zt(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&t(Ke({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(re({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));s!=null&&t(i?Ke({cursor:s,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):re({cursor:s,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(st);function Bo(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),p=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),k=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),I=E((A=>K(A))),y=I.planFilters.search,b=I.planSort,C=I.planNextCursor,D=I.productNextCursor,x=I.fetchState==="Completed",w=I.runningActionId??null;return r.useEffect((()=>{const A=setTimeout((()=>v(o)),300);return()=>clearTimeout(A)}),[o]),r.useEffect((()=>{i&&t(Qe({cacheOverride:!1,planFilters:h,productFilters:k,planSort:p,productSort:p}))}),[i,t,h,k,p]),r.useEffect((()=>{i&&(f!==y||p?.field!==b?.field||p?.dir!==b?.dir)&&t(Qe({cacheOverride:!0,planFilters:h,productFilters:k,planSort:p,productSort:p}))}),[y,b,i,t,h,k,f,p]),N(I.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogPage,isReady:x}),a.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:o,sortState:u,planFilters:h,productFilters:k,sort:p,planNextCursor:C,productNextCursor:D,runningCatalogItemActionId:w,onSearchChange:s,onTabChange:d,onSortChange:g})]})}const Vo=O((function(t,e){const n=vn(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,o=i!=null?"edit":"create",s=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(s),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(de({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(Xt({id:i,localData:c}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:o}),t(Wt({id:i}))}}}))(ct);function Ho(){const t=P(),e=L(),{coupon_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCouponId:c}=E((d=>vn(d,n)));return r.useEffect((()=>{o&&t(je({id:n}))}),[o,n,t]),r.useEffect((()=>{if(s==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(de({id:n}))}}),[s,c,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCouponFormPage}),a.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=pn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:o=>{e(fn(o))},onSubmit:()=>{const o=ei(t.localData);S.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(ni(o))}}}))(lt);function zo(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),[i]=Z(),{areTenantIdsInSync:o}=R(),s=i.get("customerId"),c=E((C=>pn(C))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(Sn),g=E((C=>Jt(C))),p=E(Se),f=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,k=f||h,I=g.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||s==null||s===""||l.customerId!==""||(y.current=!0,t(fn({...l,customerId:s})))}),[s,l,t]),r.useEffect((()=>{o&&t(Yt({cacheOverride:!1}))}),[o,t]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const D=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(D)}}),[d,v,e,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:I}),k?a.jsx(rt,{}):a.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(dt);function Ko(){const t=P(),e=L(),{credit_note_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),s=E((d=>ti(d,n??""))),c=s.fetchState==="Completed";return r.useEffect((()=>{o&&n!=null&&t(ii({id:n}))}),[o,n,t]),N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),a.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:s})]})}const Go=O((function(t){const e=hn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(ai({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(ut);function Zo(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,creditNoteListFetchState:I}=E((b=>{const C=hn(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ze({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:y}),a.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,onSearchChange:s,onStatusChange:b=>t(oi(b)),onSortChange:v})]})}const Kn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:o=>{t(De({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(J(ue)),t(gi({id:i}))},onOpenAddress:()=>{const o=Kn(e.tenantEmailDomain??"",ue,i),s=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:o=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(De({id:i,localData:o})),t(Cn({id:i}))},onFetchPaymentLinkEmailPreview:o=>t(ui({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,s,c)=>t(di({body:c,customerId:i,email:o,subject:s})),onSubscriptionClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)}}}))(vt);function Xo(){const t=P(),e=L(),n=W(),{customer_id:i,tenantEmailDomain:o}=_(),{areTenantIdsInSync:s}=R(),c=E((T=>_e(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[v,u]=r.useState(!1),[g,p]=r.useState(!1),[f,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const k=f===i,{plaidTokenFetchState:I,promotionalCreditSubmitState:y}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:D}=c.record,x=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const T=c.record.sendLinkState.fetchState;x.current!=="Error"&&T==="Error"&&t(Re({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),x.current=T}),[t,c.record.sendLinkState.fetchState]);const w=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":I.fetchState==="Error"?I.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(te()),t(ie()),()=>{t(te()),t(ie())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(p(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{s&&i!=null&&t(si({id:i}))}),[s,i,t]),r.useEffect((()=>{s&&i!=null&&D&&t(We({customerId:i}))}),[s,i,t,D]);const A=r.useCallback((T=>t(In({id:T}))),[t]),U=Y(c.fetchState,c.isFormLoading,i,A);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),a.jsx(Wo,{customerId:i??"",editView:c,hasLoadedRecord:k,location:n,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{t(te()),i!=null&&D&&t(We({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ie()),p(!0)}},U),a.jsx(gt,{errorMessage:w,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:D,onChooseCard:()=>{i!=null&&t(ri({customerId:i}))},onClose:()=>{u(!1),t(te())},onSavePaymentMethod:T=>{i!=null&&t(ci({customerId:i,data:T}))}}),a.jsx(mt,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:g,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ie())},onSubmit:({amount:T,description:ne})=>{i!=null&&t(li({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ne}))}})]})}const Jo=O((function(t,e){const n=_e(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,o=i!=null?"edit":"create",s=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(s),onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(En({id:i})),t(J(ue)),e.navigate(`${n}/customers`)},onChange:c=>{t(De({id:i,localData:c}))},onOpenAddress:()=>{const c=Kn(e.tenantEmailDomain??"",ue,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:o}),t(Cn({id:i}))}}}))(pt);function Yo(){const t=P(),e=L(),n=W(),{customer_id:i,tenantEmailDomain:o}=_(),{areTenantIdsInSync:s}=R(),{fetchState:c,savedCustomerId:d}=E((l=>_e(l,i)));return r.useEffect((()=>{s&&i!=null&&t(In({id:i}))}),[s,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),t(En({id:i}))}}),[c,d,i,t,e,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerFormPage}),a.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:o})]})}const ea=O((function(t){const e=Se(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(kn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(St);function na(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,customerListFetchState:I}=E((b=>{const C=Se(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:y}),a.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,onSearchChange:s,onStatusChange:b=>t(mi(b)),onSortChange:v})]})}const Ae=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:o,sessionId:s,view:c}=e,d=s==null?void 0:c.diagnosticsBySession[s],l=d?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:d?.items??[],errorMessage:l==="Error"?d?.fetch.error?.message:void 0,expired:d?.expired??!1,filters:o,hasMore:d?.nextCursor!=null,isLoading:l==="Not-Started"||l==="In-Progress",isLoadingMore:l==="In-Progress"&&(d?.items.length??0)>0,session:Ae(c,s)}}),(function(t,e){const{filters:n,navigate:i,sessionId:o,tenantEmailDomain:s,view:c}=e,d=o==null?void 0:c.diagnosticsBySession[o],l=Ae(c,o),v=c.actionStateByKind.retry?.fetchState==="In-Progress",u=c.actionStateByKind.rollback?.fetchState==="In-Progress",g=l?.status==="done"&&l.rollback_available_until!=null&&new Date(l.rollback_available_until).getTime()>Date.now()&&!u;return{onBack:()=>i(`/${s}/invoicing/data_import`),onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&d?.nextCursor!=null&&t(Le({...n,cursor:d.nextCursor,sessionId:o}))},onRetry:l?.status!=="failed"||v?void 0:()=>{o!=null&&t(Oe(o))},onRollback:g?()=>{o!=null&&t(yn(o))}:void 0}}))(ft);function ia(){const t=P(),e=L(),{sessionId:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),[s,c]=r.useState({}),d=E(Te),l=E(fe),v=r.useMemo((()=>{const k=G.getSignedInUser();return{userId:k?.userId??"",sessionId:k?.zeniSessionId??"",tenantId:l.tenantId}}),[l.tenantId]),u=Ae(d,n),g=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{o&&n!=null&&t(Pe(n))}),[o,t,n]),r.useEffect((()=>{if(!o||n==null)return;const k=setTimeout((()=>{t(Le({...s,sessionId:n}))}),300);return()=>clearTimeout(k)}),[o,t,s,n]);const p=u?.status==="scanning"||u?.status==="importing";r.useEffect((()=>{if(!o||n==null||!p)return;const k=setInterval((()=>{t(Pe(n)),t(Le({...s,sessionId:n}))}),3e3);return()=>clearInterval(k)}),[o,t,s,p,n]);const f=r.useMemo((()=>{if(n==null)return"";const k=new URLSearchParams;s.moduleId!=null&&k.set("module_id",s.moduleId),s.level!=null&&k.set("level",s.level),s.outcome!=null&&k.set("outcome",s.outcome),s.search!=null&&s.search.trim()!==""&&k.set("search",s.search.trim());const I=k.toString();return`${ce?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${I===""?"":`?${I}`}`}),[s,n]),h=g?.fetch.fetchState??"Not-Started";return N(h)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:u!=null&&h!=="Not-Started"}),a.jsx(ta,{authParams:v,csvDownloadUrl:f,filters:s,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Gn=t=>`invoicing_active_migration:${t}`,se=(t,e)=>{if(t!=null&&t!=="")try{const n=Gn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:o,statusRows:s}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||s.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:s}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,o=s=>{const c=s??null;t(ae(c)),se(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:s=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:s}),o(s)},onNewImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),o()},onRetrySession:s=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:s}),t(Oe(s)),o(s)},onRollbackSession:s=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:s}),t(yn(s))},onViewSession:s=>{S.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:s}),n(`/${i}/invoicing/data_import/${encodeURIComponent(s)}`)}}}))(ht);function aa(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),o=E(Te);r.useEffect((()=>{i&&(t(vi()),t(xn()))}),[i,t]);const s=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:s}),a.jsx(oa,{navigate:e,tenantEmailDomain:n,view:o})]})}const sa=O((function(t,e){const{activeId:n,authParams:i,integrationsView:o,settings:s,templatesDownloadUrl:c,view:d}=e,{actionStateByKind:l,sessionDetail:v,sessions:u}=d,g=o.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),p=n!=null?v[n]:void 0;return{authParams:i,templatesDownloadUrl:c,chargebeeConnected:s?.chargebee_connected===!0||(g?.isValid??!1),chargebeeConnectorAvailable:g!=null,chargebeeSite:s?.chargebee_site,connectError:l.connect?.error?.message,connecting:l.connect?.fetchState==="In-Progress",retrying:l.retry?.fetchState==="In-Progress",session:p??u.find((f=>f.id===n)),starting:l.start?.fetchState==="In-Progress",uploading:l.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{S.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(fi())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{n!=null&&t(Oe(n))},onSaveLater:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(Si(n))},onUpload:s=>{S.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(pi({files:s}))},onViewDetails:n==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(It);function ca(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),o=E(Sn),s=E(fe),c=r.useMemo((()=>{const I=G.getSignedInUser();return{userId:I?.userId??"",sessionId:I?.zeniSessionId??"",tenantId:s.tenantId}}),[s.tenantId]),d=`${ce?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,l=s.companyId??G.getSignedInUserTenant(n??"")?.companyId,v=E((I=>bn(I,l))),u=E(Te),{activeMigrationSessionId:g}=u,p=g??void 0,f=p!=null?u.sessionDetail[p]??u.sessions.find((I=>I.id===p)):void 0;r.useEffect((()=>{i&&(t(Me()),t(xn()))}),[i,t]),r.useEffect((()=>{if(g!=null)return;const I=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Gn(y))}catch{return null}})(n);I!=null&&t(ae(I))}),[g,t,n]),r.useEffect((()=>{se(n,g)}),[g,n]);const h=f?.status,k=h==="scanning"||h==="importing";return r.useEffect((()=>{if(!i||p==null||!k)return;const I=setInterval((()=>{t(Pe(p))}),3e3);return()=>clearInterval(I)}),[i,p,k,t]),r.useEffect((()=>{h==="done"&&(t(ae(null)),se(n,null))}),[t,h,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportMigratePage}),a.jsx(sa,{activeId:p,authParams:c,integrationsView:v,navigate:e,settings:o,templatesDownloadUrl:d,tenantEmailDomain:n,view:u,onBack:()=>{t(ae(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:o=>{t(jn({action:o,id:i}))},onSaveEdit:o=>{S.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(Ii({data:o,id:i}))}}}))(Ct);function la(){const t=P(),e=L(),{coupon_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),s=E((h=>hi(h,n))),c=s.actionState.fetchState==="In-Progress",d=s.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[n,t]),r.useEffect((()=>{o&&t(je({id:n}))}),[o,n,t]);const p=r.useCallback((h=>t(je({cacheOverride:!0,id:h}))),[t]),f=Y(s.fetchState,s.isFormLoading,n,p);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),a.jsx(ra,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:s.discountLifecycleActionOptions,editView:s,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=Dn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,o)=>{t(jn({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Ei({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Et);function ua(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,couponListFetchState:I,runningDiscountActionId:y}=E((C=>{const D=Dn(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),H),b=I==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:b}),a.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,runningDiscountActionId:y,onSearchChange:s,onStatusChange:C=>t(Ci(C)),onSortChange:v})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:s=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onCancel:o?()=>t(q({action:"cancel",id:i})):void 0,onResolve:o?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:o?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:o?()=>{S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(yt);function ma(){const t=P(),e=L(),{case_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),s=E((x=>ki(x,n??""))),c=s.fetchState==="Completed",d=s.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[p,f]=r.useState(),[h,k]=r.useState(!1),I=r.useCallback((()=>{v("idle"),g(!1),f(void 0),k(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(yi({id:n})),v("idle"),g(!1);const x=s.emailPreview.preview;f(x==null?void 0:{body:x.body,cc:x.cc,subject:x.subject,to:x.to}),k(!0)}),[n,t,s.emailPreview.preview]),b=r.useCallback((x=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),S.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:x,id:n})))}),[n,t,l]),C=r.useMemo((()=>s.emailPreview.preview==null?void 0:{bodyToken:s.emailPreview.preview.bodyToken,renderedHtmlTemplate:s.emailPreview.preview.renderedHtmlTemplate,subjectToken:s.emailPreview.preview.subjectToken}),[s.emailPreview.preview]);r.useEffect((()=>{o&&n!=null&&t(xi({id:n}))}),[o,n,t]),r.useEffect((()=>{o&&d!=null&&t(he({invoiceId:d}))}),[o,d,t]),r.useEffect((()=>{v("idle"),g(!1),f(void 0),k(!1)}),[n]),r.useEffect((()=>{o||(v("idle"),g(!1),f(void 0),k(!1))}),[o]),r.useEffect((()=>{h&&p==null&&s.emailPreview.preview!=null&&f({body:s.emailPreview.preview.body,cc:s.emailPreview.preview.cc,subject:s.emailPreview.preview.subject,to:s.emailPreview.preview.to})}),[s.emailPreview.preview,p,h]),r.useEffect((()=>{l==="pending"&&(s.actionState.fetchState!=="In-Progress"?u&&s.actionState.fetchState==="Completed"?(n!=null&&t(bi({id:n})),I()):u&&s.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,I,t,l,u,s.actionState.fetchState]);const D=d!=null&&s.linkedInvoice?.id===d?s.linkedInvoice.dunningAttempts:void 0;return N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),a.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:s,dunningAttempts:D,onSendEmail:y}),a.jsx(kt,{initialDraft:p,isPreviewLoading:s.emailPreview.fetchState==="Not-Started"||s.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:I,onSend:b,open:h,preview:C,previewErrorMessage:s.emailPreview.fetchState==="Error"?s.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?s.actionState.error?.message:void 0})]})}const va=O((function(t){const e=Pn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||t(q({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(xt);function pa(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,dunningCaseListFetchState:I}=E((b=>{const C=Pn(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),H),y=I==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ye({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningListPage,isReady:y}),a.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,onSearchChange:s,onStatusChange:b=>t(ji(b)),onSortChange:v})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Li({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
2
+ `).map((s=>s.trim())).filter((s=>s!=="")).map((s=>({note:s}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))}}}))(bt);function fa(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),s=E((f=>Ln(f,n??""))),c=s.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;r.useEffect((()=>{o&&n!=null&&t(Pi({invoiceId:n}))}),[o,n,t]);const g=r.useCallback((f=>t(he({invoiceId:f}))),[t]),p=Y(s.actionState.fetchState,s.fetchState==="In-Progress",n,g);return N(c)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:s},p)]})}const ha=O((function(t){const e=An(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{S.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&t($n({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(jt);function Ia(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,invoiceListFetchState:I,voidingInvoiceId:y}=E((C=>{const D=An(C);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),H),b=I==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&t(ke({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(ke({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:b}),a.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,voidingInvoiceId:y,onSearchChange:s,onStatusChange:C=>{t(Ai(C)),t(ke({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function cn(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),i=Dt(),o=un(),[s,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(wn),v=$i(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=p=>{c(p)};return l==="completed"?a.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?a.jsx(B,{to:`${u}/settings`,replace:!0}):a.jsxs(a.Fragment,{children:[a.jsx(Ao,{isAppContentDrawerOpen:s,handleDrawerToggle:g}),a.jsx(Pt,{analytics:S,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{t(wi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Ca=O((function(t,e){const n=Fn(t,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:s,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:s,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:o=>{t(Oi({localData:o}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ti())}}}))(Lt);function Ea(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),{fetchState:s,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Fn(f,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(Fi()),g.current=null}),[t,n]),r.useEffect((()=>{o&&n!=null&&t(he({invoiceId:n}))}),[o,t,n]),r.useEffect((()=>{c!=null&&n!=null&&s==="Completed"&&g.current!==n&&(g.current=n,t(_i({localData:Ri(c)})))}),[t,s,c,n]);const p=r.useRef(v.fetchState);return r.useEffect((()=>{const f=p.current;p.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ka=O((function(t){return{invoicingOverview:_n(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Rn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{S.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(At);function ya(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),s=E((c=>_n(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Rn(o))}),[i,t,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingOverviewPage,isReady:s}),a.jsx(ka,{navigate:e,selectedPeriod:o,tenantEmailDomain:n})]})}const xa=O((function(t){const e=Tn(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))($t);function ba(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:p,appliedSearch:f,appliedSort:h,nextCursor:k,transactionListFetchState:I,transactions:y}=E((w=>{const A=Tn(w);return{activeType:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,transactionListFetchState:A.fetchState,transactions:A.transactions}}),H),b=I==="Completed",C=`/${n}/invoicing`,D=r.useCallback((w=>{const A=y.find((T=>T.id===w)),U=A?.linkedInvoices?.[0]?.invoiceID??A?.invoiceID;U!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(U)}`))}),[e,C,y]),x=r.useCallback((w=>{const A=y.find((U=>U.id===w))?.customerID;A!=null&&(S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:A,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(A)}`))}),[e,C,y]);return r.useEffect((()=>{const w=setTimeout((()=>d(o)),300);return()=>clearTimeout(w)}),[o]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(ye({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:b}),a.jsx(xa,{navigate:e,tenantEmailDomain:n,activeType:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,onSearchChange:s,onTypeChange:w=>{t(Mi(w)),t(ye({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:x,onViewTransactionInvoice:D})]})}const ja=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function rn(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=_(),{areTenantIdsInSync:o}=R(),s=n!=null&&n!=="",c=E(Se),d=E((x=>Ui(x))),l=E(Bi),v=E((x=>Ln(x,n??""))),u=v.invoice,g=`/${i}/invoicing`,p=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Vi()),p.current=null,f.current=""}),[t,n]),r.useEffect((()=>{o&&t(s&&n!=null?he({invoiceId:n}):kn({filters:{},keepExistingListItems:!1}))}),[o,t,n,s]),r.useEffect((()=>{s&&u!=null&&n!=null&&v.fetchState==="Completed"&&p.current!==n&&(p.current=n,t(Hi({contextInvoiceId:n,localData:qi(u)})))}),[t,u,n,v.fetchState,s]),r.useEffect((()=>{if(s)return;const x=d.localData.customerId;x!==""&&x!==f.current&&(f.current=x,t($n({filters:{customerId:x},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(en({localData:{...d.localData,customerId:x,invoiceToLink:""}})))}),[t,d.localData,s]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const x=h.current;if(h.current=l.fetchState,x!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const k=r.useMemo((()=>c.customers.map((x=>({id:x.id,name:ja(x)})))),[c.customers]),I=E((x=>zi(x,d.localData.customerId))),y=r.useMemo((()=>I.map((x=>{return{amountDue:(w=x.amountDue,A=Qi.currencySymbol,_t("0,0.00",w,A)),amountDueValue:x.amountDue,id:x.id,label:x.invoiceNumber};var w,A}))),[I]),b=r.useMemo((()=>{if(!s||u==null)return;const x=u.currencyCode??"USD",w=u.amountDue?.amount??0;return{amountDue:wt("0,0.00",u.amountDue),amountDueValue:w,currencyCode:x,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,s]),C=s?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,D=!s||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:D}),a.jsx(Ft,{customers:k,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:y,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:s?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(C)},onChange:x=>{t(en({localData:x}))},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:s?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Ki(s?n??void 0:void 0))}})]})}const Zn=(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,o=i?.status,s=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:s,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,o=i!=="",s=(c,d)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Mn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ge({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&s("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(J(me)),t(Wi({id:i}))},onOpenAddress:()=>{const c=Zn(e.tenantEmailDomain??"",me,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ge({id:i,localData:c})),t(On({id:i}))},onCancelSubscription:o?c=>{s("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?s(c):s(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Rt);function Pa(){const t=P(),e=L(),n=W(),{subscription_id:i,tenantEmailDomain:o}=_(),{areTenantIdsInSync:s}=R(),c=E((y=>Ne(y,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed"&&!c.isFormLoading,[p,f]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&f(i)}),[i,g]);const h=p===i;Ie(s),r.useEffect((()=>{s&&i!=null&&t(Gi({id:i}))}),[s,i,t]);const k=r.useCallback((y=>t(Zi({id:y}))),[t]),I=Y(c.fetchState,c.isFormLoading,i,k);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),a.jsx(Da,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},I)]})}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,o=i!=null?"edit":"create";return{onCancel:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Nn({id:i})),t(J(me)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:s=>{t(ge({id:i,localData:s}))},onOpenAddress:()=>{const s=Zn(e.tenantEmailDomain??"",me,i),c=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:o}),t(On({id:i}))}}}))(Tt);function Aa(){const t=P(),e=L(),n=W(),{subscription_id:i,tenantEmailDomain:o}=_(),[s]=Z(),{areTenantIdsInSync:c}=R(),d=s.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((p=>Xi(p,i))),u=E((p=>Ne(p,i).localData));Ie(c),r.useEffect((()=>{c&&t(Ji({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(ge({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const p=v??i,f=p!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(p)}`:`/${o}/invoicing/subscriptions`;e(f),t(Nn({id:i}))}}),[l,v,i,t,e,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),a.jsx(La,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const $a=O((function(t){const e=Un(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=(o,s,c)=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:s,subscriptionId:o}),t(Mn({action:s,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{S.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{S.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(o,s)=>{const c=s?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,s,c)=>{s!=="pause"?i(o,s):i(o,s,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,s)=>{i(o,"cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(no({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ot);function wa(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),[o,s]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:p,appliedSearch:f,appliedSort:h,nextCursor:k,subscriptionListFetchState:I,runningActionSubscriptionId:y}=E((D=>{const x=Un(D);return{activeStatus:x.activeTab,appliedSearch:x.filters.search,appliedSort:x.sort,nextCursor:x.nextCursor,subscriptionListFetchState:x.fetchState,runningActionSubscriptionId:x.runningActionId??null}}),H),b=I==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(o)),300);return()=>clearTimeout(D)}),[o]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(nn({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]);const C=r.useRef(y);return r.useEffect((()=>{const D=C.current!=null&&y==null;C.current=y,D&&i&&t(Yi())}),[y,i,t]),N(I)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:b}),a.jsx($a,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:o,sortState:l,filters:g,sort:u,nextCursor:k,runningActionSubscriptionId:y,onSearchChange:s,onStatusChange:D=>t(eo(D)),onSortChange:v})]})}const Fa=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:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{S.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{S.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(oo({action:"capture",id:i}))}:void 0}}))(Mt);function _a(){const t=P(),e=L(),{tenantEmailDomain:n,transaction_id:i}=_(),{areTenantIdsInSync:o}=R(),s=E((d=>to(d,i??""))),c=s.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&t(io({id:i}))}),[o,i,t]),N(s.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),a.jsx(Fa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:s})]})}function Wn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=t,s=P(),{areTenantIdsInSync:c}=R(),d=E(Ue),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||s(Bn()),n&&s(ao()))}),[c,s,e,n,o]),r.useEffect((()=>{e&&c&&l&&i&&s(so())}),[c,s,e,l,i]),{isQboConnected:l,qboView:d}}const Ra={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ee(t){const e=P(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=_(),{fetchState:o,fieldHelp:s,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=E(co),{configError:u,configFetchState:g,dunningScheduleActionOptions:p,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:k}=E(Vn),I=E(Ue);Wn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(fe),b=t==="dunning"||t==="quickbooks",C=y.companyId??G.getSignedInUserTenant(i??"")?.companyId,D=E((F=>bn(F,C))),x=ro(y.userRole??[]),w=y.tenantId??"",A=G.getSignedInUser(),U={userId:A?.userId??"",sessionId:A?.zeniSessionId??"",tenantId:w},T=c?.fileId,ne=E((F=>T!=null&&T!==""?lo(F,T):void 0)),Be=E((F=>T!=null&&T!==""?uo(F,T):void 0)),Xn=T!=null&&T!==""&&ne!=null?{[T]:ne}:{},Jn=T!=null&&T!==""&&Be!=null?{[T]:Be}:{};r.useEffect((()=>(e(tn()),()=>{e(tn())})),[e]),r.useEffect((()=>{n&&(o!=="Not-Started"&&o!=="Error"||e(Me()))}),[n,e,o]),r.useEffect((()=>{n&&b&&g==="Not-Started"&&e(ve())}),[n,e,g,b]),r.useEffect((()=>{if(!n)return;const F=A?.userId;F!=null&&F!==""&&w!==""&&qe.shouldFetchActiveTenant(w)&&(qe.markActiveTenantFetchStarted(w),e(go(F,w,A?.zeniSessionId)))}),[n,e,A?.userId,A?.zeniSessionId,w]);const Yn=p.length>0||f.length>0,et=o==="Not-Started"||o==="In-Progress"&&l==null||b&&!Yn&&(g==="Not-Started"||g==="In-Progress"),nt=o==="Completed"&&(!b||g==="Completed"),Ve=D.externalConnections?.revenue?.find((F=>F.connectionName==="chargebee"))?.connectionId,Ce=ce?.invoicingMicroServiceBaseUrl,He=Ce!=null&&Ce.length>0?`${Ce}/1.0/webhooks/stripe`:"",Ee={deleteConnectionError:D.externalConnections?.deleteConnectionError?.message,deleteConnectionState:D.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:D,isAdmin:x,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:F=>e(an(F)),onDisconnect:(F,z)=>{w!==""&&e(Io(w,F,sn(z)))},onDisconnectStripe:()=>e(on()),onReconnectQBO:()=>{const F=y.tenantEmailDomain??i??"";pe.init("/connection/auth",F),pe.handleClick()},onRefreshQBO:()=>{D.integrations.refreshQBO.fetchState!=="In-Progress"&&e(zn())},onSaveChargeBeeCredentials:(F,z)=>{Ve!=null&&w!==""&&e(fo(w,Ve,sn("revenue"),ho("chargebee"),{api_key:F,site:z}))},saveChargeBeeError:D.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:D.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He};return{authParams:U,deleteFileStatusById:Xn,fieldHelp:s,dunningScheduleActionOptions:p,filesEndPoint:ce?.fileMicroServiceBaseUrl??"",integrationsSectionProps:Ee,isInvoicingPageReady:nt,isLoading:et,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:k,qboView:I,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":b&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He,updateFileStatusById:Jn,onConnectStripe:F=>e(an(F)),onDeleteFile:F=>e(So(F,w)),onDisconnectStripe:()=>e(on()),onEditFileName:(F,z)=>e(po(F,z.split(".")[0],w)),onReconnectQBO:Ee.onReconnectQBO,onRefreshQBO:Ee.onRefreshQBO,onRetryQboSyncTask:F=>e(qn(F)),onSave:F=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(vo({settings:F,snackbarSection:Ra[t??""]}))},onStartQboBackfill:F=>e(Hn(F)),updateFilesEntity:F=>{S.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(mo({files:F}))}}}function ln({appContent:t}){const e=L(),n=W(),i=P(),{tenantEmailDomain:o}=_(),s=ee("branding"),c=E((v=>Co(v))),d=E((v=>Eo(xe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(ko()),i(J(xe)))}),[c.saveState.fetchState,i]);const l=$e(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:s.isInvoicingPageReady}),a.jsx(Nt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:s.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:s.deleteFileStatusById,filesEndPoint:s.filesEndPoint,isLoading:s.isLoading,isSaving:s.isSaving,localData:c.localData,logoFile:s.logoFile,saveErrorMessage:s.saveErrorMessage,settings:s.settings,updateFileStatusById:s.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(xo({localData:v}))},onDeleteFile:s.onDeleteFile,onEditFileName:s.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${xe}/`,u=X(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(yo()),updateFilesEntity:s.updateFilesEntity})]})}function Ta(){const t=L(),e=ee("dunning");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Ut,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=L(),e=ee("integrations");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Bt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=L(),e=ee("payment-destination");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Vt,{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:()=>{t(jo())},onRetryTask:e=>{t(qn(e))},onSave:()=>{S.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(bo())},onStartBackfill:e=>{t(Hn(e))}}}))(Ht);function Ua(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),i=E(fe),{configFetchState:o,saveState:s,settingsFetchState:c}=E(Qn),d=$e(s.fetchState);return r.useEffect((()=>{d==="In-Progress"&&s.fetchState==="Completed"&&e("..")}),[e,d,s.fetchState]),r.useEffect((()=>{c!=="Not-Started"&&c!=="Error"||t(Me())}),[t,c]),r.useEffect((()=>{o==="Not-Started"&&t(ve())}),[o,t]),Wn({fetchSyncHealth:!0,loadAccountingPickers:!0}),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage}),a.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{pe.init("/connection/auth",i.tenantEmailDomain??n??""),pe.handleClick()},onRefresh:()=>t(zn())})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=un(),e=P(),n=L(),[i,o]=Z(),s=ee(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Vn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const p=Ba[g];o({},{replace:!0}),p!=null&&n(p,{replace:!0})}),[g,n,o]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:s.isInvoicingPageReady}),a.jsx(qt,{analytics:S,integrationsSectionProps:{...s.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:s.isLoading,meetingUrl:t("invoicing_settings"),settings:s.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Po())}})]})}function dn(){return a.jsxs(oe,{children:[a.jsx(j,{index:!0,element:a.jsx(Va,{})}),a.jsx(j,{path:"payment-destination",element:a.jsx(Ma,{})}),a.jsx(j,{path:"branding",element:a.jsx(ln,{})}),a.jsx(j,{path:"branding/:addressType",element:a.jsx(ln,{appContent:a.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),a.jsx(j,{path:"integrations",element:a.jsx(Oa,{})}),a.jsx(j,{path:"dunning",element:a.jsx(Ta,{})}),a.jsx(j,{path:"quickbooks",element:a.jsx(Ua,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:"..",replace:!0})})]})}function Ss(){const t=P(),e=L(),{tenantEmailDomain:n}=_(),{areTenantIdsInSync:i}=R(),{enableState:o,fetchState:s,status:c}=E(wn),d=$e(o.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=E((g=>Ue(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(s!=="Not-Started"?s!=="Error"||v.current||(v.current=!0,t(ve({cacheOverride:!1}))):t(ve({cacheOverride:!1})))}),[i,t,s]),r.useEffect((()=>{i&&u==="Not-Started"&&t(Bn())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),t(Lo()))}),[d,o.fetchState,l,t,e]),c==null&&s!=="Error"?a.jsx(zt,{fetchState:"In-Progress"}):c==="not_started"?a.jsxs(oe,{children:[a.jsx(j,{path:"promo",element:a.jsx(cn,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?a.jsxs(oe,{children:[a.jsx(j,{path:"promo",element:a.jsx(cn,{})}),a.jsx(j,{path:"settings/*",element:a.jsx(dn,{})}),a.jsx(j,{path:"*",element:a.jsx(B,{to:`${l}/settings`,replace:!0})})]}):a.jsxs(oe,{children:[a.jsx(j,{path:"/",element:a.jsx(B,{to:"overview",replace:!0})}),a.jsx(j,{path:"overview",element:a.jsx(ya,{})}),a.jsx(j,{path:"promo",element:a.jsx(B,{to:`${l}/overview`,replace:!0})}),a.jsx(j,{path:"customers",element:a.jsx(na,{})}),a.jsx(j,{path:"customers/new",element:a.jsx(Yo,{})}),a.jsx(j,{path:"customers/new/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"customers/:customer_id",element:a.jsx(Xo,{})}),a.jsx(j,{path:"customers/:customer_id/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"subscriptions",element:a.jsx(wa,{})}),a.jsx(j,{path:"subscriptions/new",element:a.jsx(Aa,{})}),a.jsx(j,{path:"subscriptions/new/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"subscriptions/:subscription_id",element:a.jsx(Pa,{})}),a.jsx(j,{path:"subscriptions/:subscription_id/:addressType",element:a.jsx(Q,{})}),a.jsx(j,{path:"invoices",element:a.jsx(Ia,{})}),a.jsx(j,{path:"invoices/create",element:a.jsx(zo,{})}),a.jsx(j,{path:"invoices/:invoice_id",element:a.jsx(fa,{})}),a.jsx(j,{path:"invoices/:invoice_id/record-payment",element:a.jsx(rn,{})}),a.jsx(j,{path:"invoices/:invoice_id/issue-credit-note",element:a.jsx(Ea,{})}),a.jsx(j,{path:"payments",element:a.jsx(ba,{})}),a.jsx(j,{path:"payments/record",element:a.jsx(rn,{})}),a.jsx(j,{path:"payments/:transaction_id",element:a.jsx(_a,{})}),a.jsx(j,{path:"credits",element:a.jsx(Zo,{})}),a.jsx(j,{path:"credits/:credit_note_id",element:a.jsx(Ko,{})}),a.jsx(j,{path:"discounts",element:a.jsx(ua,{})}),a.jsx(j,{path:"discounts/new",element:a.jsx(Ho,{})}),a.jsx(j,{path:"discounts/:coupon_id",element:a.jsx(la,{})}),a.jsx(j,{path:"dunning",element:a.jsx(pa,{})}),a.jsx(j,{path:"dunning/:case_id",element:a.jsx(ma,{})}),a.jsx(j,{path:"catalog",element:a.jsx(Bo,{})}),a.jsx(j,{path:"catalog/new",element:a.jsx(Mo,{})}),a.jsx(j,{path:"catalog/:item_id",element:a.jsx(_o,{})}),a.jsx(j,{path:"settings/*",element:a.jsx(dn,{})}),a.jsx(j,{path:"audit_log",element:a.jsx($o,{})}),a.jsx(j,{path:"data_import",element:a.jsx(aa,{})}),a.jsx(j,{path:"data_import/migrate",element:a.jsx(ca,{})}),a.jsx(j,{path:"data_import/:sessionId",element:a.jsx(ia,{})}),a.jsx(j,{path:"*",element:a.jsx(M,{})})]})}export{Ss as default};
@@ -1,4 +1,4 @@
1
- import{j as t}from"./liveblocks-BjcYyeQ6.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-B-8b0iz9.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-95zxmizy.js";import{a2 as x,H as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,o as ue,S as he,a7 as ge,O as xe,E as fe,e as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-DuxR1XDX.js";import{n as m}from"./mui-C33Oegsm.js";import f from"./NotFoundScreen-BatgS8le.js";import{a as I}from"./sentry-DZ9rNYfw.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var 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]="b542e5ff-f569-4c94-ab05-47235204c79f",e._sentryDebugIdIdentifier="sentry-dbid-b542e5ff-f569-4c94-ab05-47235204c79f")}catch{}})();const Ie=m.div`
1
+ import{j as t}from"./liveblocks-CIxx6Ub6.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-Caq7Zbsp.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-DROyxOLw.js";import{a2 as x,J as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,N as ue,f as he,a7 as ge,F as xe,E as fe,e as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-DOXJLxdR.js";import{n as m}from"./mui-DI0hUuFr.js";import f from"./NotFoundScreen-C2GrPpNy.js";import{a as I}from"./sentry-BCPOyc0G.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var 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]="6de49a9c-e956-4832-85a2-fab455119f03",e._sentryDebugIdIdentifier="sentry-dbid-6de49a9c-e956-4832-85a2-fab455119f03")}catch{}})();const Ie=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -16,7 +16,7 @@ import{j as t}from"./liveblocks-BjcYyeQ6.js";import{i as S,l as g,h as C,g as y,
16
16
  align-items: center;
17
17
  background-color: ${e=>e.theme.colors.grey4};
18
18
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=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}),Le=m.div`
19
+ `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=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}),Ne=m.div`
20
20
  display: flex;
21
21
  height: 100%;
22
22
  width: 100%;
@@ -25,7 +25,7 @@ import{j as t}from"./liveblocks-BjcYyeQ6.js";import{i as S,l as g,h as C,g as y,
25
25
  align-items: center;
26
26
  background-color: ${e=>e.theme.colors.grey4};
27
27
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ne=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Le,{windowSize:n,children:t.jsx(Ne,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
28
+ `,Le=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Le,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
29
  display: flex;
30
30
  height: 100%;
31
31
  width: 100%;
@@ -69,4 +69,4 @@ import{j as t}from"./liveblocks-BjcYyeQ6.js";import{i as S,l as g,h as C,g as y,
69
69
  width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
70
  background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
71
  margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),M=n.pathname.includes("address"),w=x(),H=xe(),A=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:O,billFetchState:P,companyName:q,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:L,sessionId:N}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[b,c,i,o,d,a]),I.useEffect((()=>{b&&c==="Completed"&&($(L,N,z),l!=null&&a(re(l)))}),[c,b,L,N,z,l,a]),c==="Error"?t.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",q,l??"",Ke(n.pathname),Q,R))(u)}),t.jsxs(Me,{windowSize:w,children:[w!=="small"?t.jsx(Je,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:O,type:"bill"})}),t.jsx(He,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
72
+ `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),M=n.pathname.includes("address"),w=x(),H=xe(),A=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:N,sessionId:L}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[b,c,i,o,d,a]),I.useEffect((()=>{b&&c==="Completed"&&($(N,L,z),l!=null&&a(re(l)))}),[c,b,N,L,z,l,a]),c==="Error"?t.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,R))(u)}),t.jsxs(Me,{windowSize:w,children:[w!=="small"?t.jsx(Je,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(He,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -1,4 +1,4 @@
1
- import{j as u}from"./liveblocks-BjcYyeQ6.js";import{a as g}from"./sentry-DZ9rNYfw.js";import{u as O,g as _,h as w,t as V,j as l,N as L}from"./core-B-8b0iz9.js";import{z as r,E as M,G as P,U as A,k as N,V as $,$ as q,a0 as G,Y as R}from"./index-DuxR1XDX.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-95zxmizy.js";import{n as ne}from"./mui-C33Oegsm.js";import{u as se}from"./useDeviceId-gFU5q5zf.js";import{f as ae}from"./analyticsHelper-C6SU-53H.js";import{t as ie}from"./getLocaleForTenant-D57C4sYC.js";import"./recharts-DkYxIsLi.js";import"./analytics-8lQ_GaR7.js";import"./plaid-Bt28AVCt.js";import"./dnd-CtOxA7uX.js";import"./stripe-cKAAJElX.js";import"./lottie-BdAYiWcR.js";import"./lexical-BVt4M34U.js";import"./pdf-BkfulyEw.js";import"./utils-D3rZq_G4.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="61d49e01-f580-4606-8e7e-75decca31fbc",t._sentryDebugIdIdentifier="sentry-dbid-61d49e01-f580-4606-8e7e-75decca31fbc")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>Y(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="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)||f==null||I==="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??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
1
+ import{j as u}from"./liveblocks-CIxx6Ub6.js";import{a as g}from"./sentry-BCPOyc0G.js";import{u as O,g as _,h as w,t as M,j as l,N as L}from"./core-Caq7Zbsp.js";import{z as r,E as P,G as V,T as A,k as N,U as $,$ as q,a0 as G,Y as R}from"./index-DOXJLxdR.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-DROyxOLw.js";import{n as ne}from"./mui-DI0hUuFr.js";import{u as se}from"./useDeviceId-2NJBbYPM.js";import{f as ae}from"./analyticsHelper-DHPcRAai.js";import{t as ie}from"./getLocaleForTenant-YgJPw-1W.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="0ab82f79-c1f2-4b52-97be-58b8803cd4d3",t._sentryDebugIdIdentifier="sentry-dbid-0ab82f79-c1f2-4b52-97be-58b8803cd4d3")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[k]=M(),n=k.get("token"),p=k.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),b=l((e=>Y(e))),D=r.getSignedInUser(),v=P().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(b.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,y,s,o,b,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="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)||f==null||I==="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??"")||I==="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
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -0,0 +1 @@
1
+ import{j as _}from"./liveblocks-CIxx6Ub6.js";import{a as m}from"./sentry-BCPOyc0G.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-Caq7Zbsp.js";import{fF as ne,T_ as Ue,T$ as se,g9 as Ne,fE as xe,U8 as Pe,U1 as Re,U2 as Ve,p$ as Le,gm as Oe,U5 as h,Ua as je,Ub as J,gn as Ze,Uc as ze,Eb as He,h1 as qe,cV as Ye,Ud as Ke,g8 as Qe,go as We}from"./zeni-epic-state-DROyxOLw.js";import{w as Je,i as Xe,F as ea,N as aa,c as ta,e as na,u as sa,f as c,g as oa,Q as ia,z as ra,d as da,n as ca,o as la,s as ua,q as ma,r as X,L as fa,D as ba,H as ha,p as S,k as ee,y as pa,K as ae,B as ga,C as Sa}from"./index-DOXJLxdR.js";import{D as Ea}from"./mui-DI0hUuFr.js";import{u as ka}from"./InboxNotificationsProvider-DcarX1j5.js";import{u as Ca}from"./useTaskManagerAccess-DxrmaJfc.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]="abe252d7-08e3-4a24-93c8-2bd04d638f9b",l._sentryDebugIdIdentifier="sentry-dbid-abe252d7-08e3-4a24-93c8-2bd04d638f9b")}catch{}})();const Ta=Je((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=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,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,U=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),v=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&v.fetchState==="Not-Started"&&r(Le(!0))}),[C,T,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Oe(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:be}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:he}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>h(e).totalUnreadCount)),Ce=t((e=>h(e).reducedFetchCountState)),R=t((e=>h(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>h(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),m.useEffect((()=>{C&&k&&!f&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,k,f,L.fetchState,B.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(J({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(J({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:ke},H=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),b=[];fe===!1&&b.push("accounts_payable_aging"),be===!1&&b.push("accounts_receivable_aging"),b.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&b.push("rewards_card"),P===!1&&b.push("expense_automation_card");const Y=t((e=>ze(e,b).fetchState)),K=t((e=>He(e).fetchState)),ye=A&&(Y==="Completed"||Y==="Error")||U&&(K==="Completed"||K==="Error")||!A&&!U?void 0:"disabled",we=m.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=Ye(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&x.fetchState==="Completed"&&Ke(x.notificationSettings,p.userEmail,N,o,k),Q=da(),Fe=Q&&ca(a);return _.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:Q,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),W=e.type,_e=ae(W)&&W!=="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(We()),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),ba({dispatch:r,navigate:n,pathToNavigate:ha(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Qe({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Xe(n)&&Ue(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-CIxx6Ub6.js";import{h as r,l as n}from"./core-Caq7Zbsp.js";import{an as i}from"./index-DOXJLxdR.js";import"./mui-DI0hUuFr.js";import"./sentry-BCPOyc0G.js";import"./zeni-epic-state-DROyxOLw.js";import"./recharts-DKmpCGIA.js";import"./analytics-CiEh1qKr.js";import"./plaid-CXvI7t9H.js";import"./dnd-DwckO6rX.js";import"./stripe-cKAAJElX.js";import"./lottie-CrKh4Q_r.js";import"./lexical-mmp2B1vq.js";import"./pdf-BlhN83fm.js";import"./utils-rX2IEvjD.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};