@zeniai/web-app-ui 5.3.32-qa → 5.3.33-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 (156) hide show
  1. package/dist/assets/AccountMappingScreen-DDC4e1RD.js +9 -0
  2. package/dist/assets/AddressRoutes-zzmrmZ16.js +1 -0
  3. package/dist/assets/AddressScreen-BtP59nWf.js +9 -0
  4. package/dist/assets/AiCfoScreen-0WwVR_RT.js +22 -0
  5. package/dist/assets/AppDrawer-C7u6yO5k.js +10 -0
  6. package/dist/assets/{BillPayApprovalRoutes-B-dRM1ET.js → BillPayApprovalRoutes-B12E_S91.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-Bw7Zsd_q.js → BillPayRoutes-D3YiGZXB.js} +18 -18
  8. package/dist/assets/{BusinessVerificationPageScreen-BpB36lD4.js → BusinessVerificationPageScreen-Bh5Bjz_t.js} +2 -2
  9. package/dist/assets/CardsAiCfoScreen-StazhLCy.js +14 -0
  10. package/dist/assets/{ChargeCardRoutes-BN5gmMDY.js → ChargeCardRoutes-BpwgRJW2.js} +1 -1
  11. package/dist/assets/{CompanyPassportScreen-BgOKbeIV.js → CompanyPassportScreen-1B8KqxCX.js} +1 -1
  12. package/dist/assets/ConnectionAuthScreen-_WPAiqQD.js +11 -0
  13. package/dist/assets/CustomerOnboardingAuthScreen-B2-KkeTM.js +1 -0
  14. package/dist/assets/CustomerOnboardingRoutes-eoKq-jK4.js +30 -0
  15. package/dist/assets/{DashboardRoutes-C--0vzwA.js → DashboardRoutes-CKdZegGm.js} +4 -4
  16. package/dist/assets/DefaultTenantHome-CvzwpBoC.js +1 -0
  17. package/dist/assets/DomesticWireDetailScreen-BOxoSeoJ.js +18 -0
  18. package/dist/assets/DrawerScreen-Cvypy_pu.js +1 -0
  19. package/dist/assets/EntityDetailRoutes-BLeAjK3e.js +1 -0
  20. package/dist/assets/ExpenseAutomationRoutes-t_w4KaUv.js +38 -0
  21. package/dist/assets/FeaturePreviewScreen-KgN7vGcF.js +1 -0
  22. package/dist/assets/HubSpotOAuthCallbackScreen-Bj9Wgjht.js +1 -0
  23. package/dist/assets/InboxNotificationsProvider-B-NFQuyv.js +1 -0
  24. package/dist/assets/InvoicingRoutes-DD8ii9Jo.js +2 -0
  25. package/dist/assets/{MagicLinkRoutes-B3OI8_Y8.js → MagicLinkRoutes-B5onTuVg.js} +7 -7
  26. package/dist/assets/MagicLinkSignInScreen-Z_KEEjY_.js +12 -0
  27. package/dist/assets/MobileAppDrawer-PtjV_ofL.js +1 -0
  28. package/dist/assets/NotFoundScreen-BYb00fRD.js +1 -0
  29. package/dist/assets/NotificationRoutes-Ct_RdrSm.js +1 -0
  30. package/dist/assets/OAuthConsentScreen-Cp21VEUM.js +1 -0
  31. package/dist/assets/PandLWithForecastRoutes-B8aCeyQm.js +1 -0
  32. package/dist/assets/{PaymentLinkScreen-oiuP5YE8.js → PaymentLinkScreen-Dom-ZdiQ.js} +6 -6
  33. package/dist/assets/PeopleRoutes-CMQ5JoaT.js +22 -0
  34. package/dist/assets/PerformanceRoutes-BaFYyetl.js +1 -0
  35. package/dist/assets/{Preview-C7FOgz3Q.js → Preview-BUFd_sPW.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-CiKgrKX6.js → QBOConnectionScreen-DLKvgPCe.js} +23 -23
  37. package/dist/assets/ReimbursementApprovalRoutes-yZ6qt8vR.js +1 -0
  38. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-D7_1V-ZV.js → ReimbursementApprovalRuleDetailScreen-PjSqLE3K.js} +1 -1
  39. package/dist/assets/{ReimbursementRoutes-CfqcRhl_.js → ReimbursementRoutes-BHhFNphA.js} +9 -9
  40. package/dist/assets/ReportsRoutes-DwjpNsBH.js +1 -0
  41. package/dist/assets/RewardsRoutes-D1qLb1Hr.js +1 -0
  42. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BXydpQNl.js +25 -0
  43. package/dist/assets/ScreenRoutes-C2Pczg6X.js +2 -0
  44. package/dist/assets/{SettingsRoutes-C_BHKgxc.js → SettingsRoutes-DNifcLKF.js} +6 -6
  45. package/dist/assets/{SetupPagesScreen-CZfthydR.js → SetupPagesScreen-DxyeAl-N.js} +5 -5
  46. package/dist/assets/SignInScreen-xjjVbfK1.js +1 -0
  47. package/dist/assets/SignOutScreen-z53qiWi7.js +9 -0
  48. package/dist/assets/{TaskListScreen-vihEMCMo.js → TaskListScreen-B_OtLRex.js} +2 -2
  49. package/dist/assets/TaskRoutes-CwGUiyuW.js +9 -0
  50. package/dist/assets/TransactionDetailRoutes-Dlicv1YU.js +1 -0
  51. package/dist/assets/{TransactionDetailScreen-dG3SEGK8.js → TransactionDetailScreen-C21UfodB.js} +2 -2
  52. package/dist/assets/TransactionListRoutes-c14Zp_GU.js +1 -0
  53. package/dist/assets/TreasuryRoutes-BOUBbZba.js +37 -0
  54. package/dist/assets/VendorsRoutes-DQPJ2ahX.js +88 -0
  55. package/dist/assets/WiseConfirmationScreen-BgAYLRbZ.js +12 -0
  56. package/dist/assets/{ZeniAccountRoutes-C9gyx-Lb.js → ZeniAccountRoutes-Cm5PZOYy.js} +10 -10
  57. package/dist/assets/ZeniAccountStatementScreen-C-8gKp6H.js +9 -0
  58. package/dist/assets/{accountMappingHelper-DOs7iAIL.js → accountMappingHelper-C_PJMCg9.js} +1 -1
  59. package/dist/assets/{analytics-DZ6cwnOO.js → analytics-elDziMbO.js} +1 -1
  60. package/dist/assets/{analyticsHelper-D6TeBlJQ.js → analyticsHelper-vLClPvL0.js} +1 -1
  61. package/dist/assets/{core-BL7rYGUF.js → core-DF6XZR6t.js} +1 -1
  62. package/dist/assets/{decodeURIComponentSafe-B4a7LpJx.js → decodeURIComponentSafe-DjR1JOrN.js} +1 -1
  63. package/dist/assets/{dnd-BsiKGZTJ.js → dnd-Cjk62kit.js} +1 -1
  64. package/dist/assets/{empty-SbPe4M90.js → empty-BFMGUQ5p.js} +1 -1
  65. package/dist/assets/{empty-qvcbLK7S.js → empty-Blp6QSRg.js} +1 -1
  66. package/dist/assets/{emptyVideoElement-BMPAb-cr.js → emptyVideoElement-BxiyyOIX.js} +1 -1
  67. package/dist/assets/{epic-Bt3rVBX8.js → epic-CjuOPpmP.js} +2 -2
  68. package/dist/assets/{expenseAutomationHelper-DfYMglD1.js → expenseAutomationHelper-DtYcu9lZ.js} +1 -1
  69. package/dist/assets/getLocaleForTenant-BghPhTTn.js +1 -0
  70. package/dist/assets/{index-CPdgrrgU.js → index-73l2EN6L.js} +1 -1
  71. package/dist/assets/{index-BRAI-aTk.js → index-BJMpQHkg.js} +1 -1
  72. package/dist/assets/{index-DLTi5gVy.js → index-BN3P-M0E.js} +1 -1
  73. package/dist/assets/{index-BtCYCCEX.js → index-CGw0d03E.js} +1 -1
  74. package/dist/assets/{index-te7nCILo.js → index-Cm1WGUI8.js} +1 -1
  75. package/dist/assets/{index-E1NwyJIP.js → index-DDlsb2Pe.js} +12665 -12665
  76. package/dist/assets/{index-B_AHleOS.js → index-DV9ITGuT.js} +2 -2
  77. package/dist/assets/{index-C4WC13bA.js → index-DvD4ADMb.js} +1 -1
  78. package/dist/assets/{lexical-BSRawlvX.js → lexical-CSD0azk6.js} +1 -1
  79. package/dist/assets/{liveblocks-BeSMR7a1.js → liveblocks-D4WYBu5d.js} +1 -1
  80. package/dist/assets/{lottie-joMwFamf.js → lottie-BmpBYIvu.js} +1 -1
  81. package/dist/assets/{mui-CPSuUssr.js → mui-B4yW9pH-.js} +1 -1
  82. package/dist/assets/{pathToGoBack-rem3sHLx.js → pathToGoBack-D8-KE8Du.js} +1 -1
  83. package/dist/assets/{pdf-CcTg_U5O.js → pdf-CGyqZzIC.js} +4 -4
  84. package/dist/assets/{pdf-lib-Cu5wZc2A.js → pdf-lib-Dh61rZh4.js} +1 -1
  85. package/dist/assets/{plaid-DMXel13h.js → plaid-D38FQUk-.js} +1 -1
  86. package/dist/assets/{pusher-IEbMI61m.js → pusher-CqUxDVhu.js} +1 -1
  87. package/dist/assets/{react-34F3zNgD.js → react-BMMd1waU.js} +1 -1
  88. package/dist/assets/{react-B6LrhCL-.js → react-BMRcwifd.js} +1 -1
  89. package/dist/assets/{react-D5rCBPHe.js → react-CIXsO3WM.js} +1 -1
  90. package/dist/assets/{react-p4SZ9iHE.js → react-DhQUnxri.js} +1 -1
  91. package/dist/assets/{react-Cyo5bdBF.js → react-DuBQLZ-9.js} +1 -1
  92. package/dist/assets/{react-BtgwZRYq.js → react-Uo80T9aY.js} +1 -1
  93. package/dist/assets/{recharts-BP8J0UHA.js → recharts-BiczA0FA.js} +1 -1
  94. package/dist/assets/routePaths-DGP8B7_s.js +1 -0
  95. package/dist/assets/{sentry-Uj7AWjah.js → sentry-xA0rcm0B.js} +1 -1
  96. package/dist/assets/{url-Cc0feVFM.js → url-D7Tfrndr.js} +1 -1
  97. package/dist/assets/{url-CnKkchc3.js → url-teROgVHf.js} +1 -1
  98. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-p6fhiYGJ.js +1 -0
  99. package/dist/assets/useAskAiCfoHostNavButtonProps-d04WxUMr.js +1 -0
  100. package/dist/assets/useChargeCardPusherEvents-EdGQYrNX.js +1 -0
  101. package/dist/assets/{useDeviceId-CR3YwHzW.js → useDeviceId-CIwJhP5U.js} +1 -1
  102. package/dist/assets/useEmailConnectResultRefresh-DkeO72N3.js +1 -0
  103. package/dist/assets/useInitialThreadRequest-BCZ9SXeA.js +1 -0
  104. package/dist/assets/{useTaskManagerAccess-BVyRgvZH.js → useTaskManagerAccess-GgG1qznV.js} +1 -1
  105. package/dist/assets/{utils-Dn95OB7n.js → utils-Tr_0gxNT.js} +1 -1
  106. package/dist/assets/withTransactionSidePanel-DKKp2Btj.js +25 -0
  107. package/dist/assets/{zeni-epic-state-CxdZGPla.js → zeni-epic-state-C1PKBe4c.js} +5 -5
  108. package/dist/index.html +1 -1
  109. package/package.json +4 -4
  110. package/dist/assets/AccountMappingScreen-Cv_JISNl.js +0 -9
  111. package/dist/assets/AddressRoutes-D1wfXuM-.js +0 -1
  112. package/dist/assets/AddressScreen-DKIOTZOx.js +0 -9
  113. package/dist/assets/AiCfoScreen-BbhOSIw9.js +0 -22
  114. package/dist/assets/AppDrawer-DyJQZA6-.js +0 -10
  115. package/dist/assets/CardsAiCfoScreen-ZXvSY5tv.js +0 -14
  116. package/dist/assets/ConnectionAuthScreen-DXPq3qhF.js +0 -11
  117. package/dist/assets/CustomerOnboardingAuthScreen-C1BQROr2.js +0 -1
  118. package/dist/assets/CustomerOnboardingRoutes-BbMnpjPH.js +0 -30
  119. package/dist/assets/DefaultTenantHome-gR6Y3pYc.js +0 -1
  120. package/dist/assets/DomesticWireDetailScreen-B6SysKxJ.js +0 -18
  121. package/dist/assets/DrawerScreen-BUtXmCMv.js +0 -1
  122. package/dist/assets/EntityDetailRoutes-BJRFJx06.js +0 -1
  123. package/dist/assets/ExpenseAutomationRoutes-8h-9Hyes.js +0 -25
  124. package/dist/assets/FeaturePreviewScreen-07vQ7ieK.js +0 -1
  125. package/dist/assets/HubSpotOAuthCallbackScreen-B6PLbaf4.js +0 -1
  126. package/dist/assets/InboxNotificationsProvider-BH2D62uC.js +0 -1
  127. package/dist/assets/InvoicingRoutes-C2RjAxZA.js +0 -2
  128. package/dist/assets/MagicLinkSignInScreen-Y0R0oylb.js +0 -12
  129. package/dist/assets/MobileAppDrawer-CjyikhYJ.js +0 -1
  130. package/dist/assets/NotFoundScreen-C2tiSpQ7.js +0 -1
  131. package/dist/assets/NotificationRoutes-CFog6J5Q.js +0 -1
  132. package/dist/assets/OAuthConsentScreen-g72Ugnk9.js +0 -1
  133. package/dist/assets/PandLWithForecastRoutes-CMaqNXj1.js +0 -1
  134. package/dist/assets/PeopleRoutes-sgSiMpSO.js +0 -22
  135. package/dist/assets/PerformanceRoutes-CjfeH4u4.js +0 -1
  136. package/dist/assets/ReimbursementApprovalRoutes-LWePNTvC.js +0 -1
  137. package/dist/assets/ReportsRoutes-uMoEApCu.js +0 -1
  138. package/dist/assets/RewardsRoutes-CCLIDX41.js +0 -1
  139. package/dist/assets/ScreenRoutes-T2NqNjGF.js +0 -2
  140. package/dist/assets/SignInScreen-Ch6DTnK6.js +0 -1
  141. package/dist/assets/SignOutScreen-CfAh7qk3.js +0 -9
  142. package/dist/assets/TaskRoutes-DO-tMTQu.js +0 -9
  143. package/dist/assets/TransactionDetailRoutes-zmryAi6y.js +0 -1
  144. package/dist/assets/TransactionListRoutes-D_3U5FSp.js +0 -1
  145. package/dist/assets/TreasuryRoutes-XotmNx9W.js +0 -37
  146. package/dist/assets/VendorsRoutes-DCuo1D8L.js +0 -112
  147. package/dist/assets/WiseConfirmationScreen-D3ybpk8W.js +0 -12
  148. package/dist/assets/ZeniAccountStatementScreen-4u5gSdu6.js +0 -9
  149. package/dist/assets/getLocaleForTenant-akYNGA2f.js +0 -1
  150. package/dist/assets/routePaths-Cf2E-_nR.js +0 -1
  151. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-DABf-MX6.js +0 -1
  152. package/dist/assets/useAskAiCfoHostNavButtonProps-CC7G-KyB.js +0 -1
  153. package/dist/assets/useChargeCardPusherEvents-DJOucGr5.js +0 -1
  154. package/dist/assets/useEmailConnectResultRefresh-DDRUKxe2.js +0 -1
  155. package/dist/assets/useInitialThreadRequest-DifgMaO6.js +0 -1
  156. package/dist/assets/withTransactionSidePanel-CPfQcd4u.js +0 -25
@@ -1,25 +0,0 @@
1
- import{j as T}from"./liveblocks-BeSMR7a1.js";import vn from"./NotFoundScreen-C2tiSpQ7.js";import{a as n,R as Ia}from"./sentry-Uj7AWjah.js";import{n as Qe,S as wn}from"./mui-CPSuUssr.js";import{u as Ce,h as ka,g as It,j as D,l as Pn,t as xn,i as Qt,n as Rn,o as rt}from"./core-BL7rYGUF.js";import{fB as De,a0e as Dn,pY as Pe,Tp as Fn,zl as _n,a0f as Un,a0g as Vn,a0h as Bn,a0i as dt,a0j as Ge,gd as St,a0k as Kt,eJ as Mn,fY as On,a0l as Xt,a0m as qe,qP as Ln,uc as jn,gP as zn,gN as $n,a0n as Gn,r0 as qn,r9 as Nn,q7 as Jn,ql as Ta,gM as le,gO as Yn,a0o as Hn,qH as ba,ra as Wn,qi as Qn,qd as Kn,ui as Xn,gL as xe,a0p as Ye,Bv as ya,LO as Ea,a0q as Aa,a0r as Zn,fh as eo,fj as to,sd as gt,W6 as Zt,W8 as ao,l_ as no,W9 as oo,m5 as so,dh as co,CO as Ct,a0s as io,a0t as lo,s3 as ro,s4 as uo,UX as mo,Vc as po,$I as ho,qA as va,rf as He,a0u as So,V2 as ea,V1 as $e,a0v as ta,mm as go,a0w as Co,a0x as fo,a0y as Io,a0z as ko,qv as To,ri as Ne,a0A as bo,a0B as yo,a0C as Eo,rq as Ao,m9 as vo,m0 as wo,a0D as Po,m8 as aa,Wj as xo,a0E as Ro,a0F as Do,tP as Fo,tq as _o,rg as ue,tp as ut,a0G as Uo,a0H as Vo,a0I as Bo,a0J as Mo,nF as Oo,br as Lo,nA as na,nm as jo,a0K as zo,gY as $o,nx as Go,sf as qo,sh as No,EO as Jo,rY as Yo,Vf as Ho,Vg as Wo,Eg as Qo,Ef as Ko,Ew as Xo,a0L as oa,s2 as Zo,fg as ft,s8 as es,a0M as ts,so as as,rS as ns,st as os,rX as ss,rB as cs,a0N as is,Th as wa,qT as ls,qr as rs,qy as sa,rl as ds,a0O as us,a0P as ms,rh as Pa,a0Q as ps,a0R as hs,a0S as Ss,a0T as gs,sx as Cs,a0U as fs,a0V as Is,a0W as ca,t_ as ks,th as Ts,r$ as ia,V0 as bs,a0X as ys,a0Y as Es,m7 as As,a0Z as vs,Qu as ws,m6 as Ps,lX as xs,Tg as Rs,sQ as xa,ta as Ds,re as la,rj as Fs,bE as _s,nu as Us,nr as Vs,a0_ as Bs,rA as ra,t6 as da,t4 as Ms,a0$ as Os,sV as Ls,sA as js,t7 as zs,a10 as $s,a11 as Gs,sG as qs,a12 as Ns,sB as Js,sF as Ys,sD as Hs,td as Ws}from"./zeni-epic-state-CxdZGPla.js";import{O as We,y as Y,h as G,p as te,ao as Ra,aq as Da,dM as Qs,z as Ke,dN as Ks,dO as Xs,dP as Zs,ac as Re,dQ as ec,dR as ua,b8 as ma,a5 as Fa,dS as tc,g as Je,G as ac,w as nc,dT as oc,at as pa,dU as sc,a as cc,dV as ic,dW as lc,U as rc,V as dc,dX as uc,dY as mc,dZ as pc,b2 as hc,bp as Sc,a9 as gc,b3 as Cc,b4 as fc}from"./index-E1NwyJIP.js";import{u as _a}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{g as ha,h as Ic,r as kc,b as Tc,c as bc,i as yc,a as Ec,C as Ac}from"./TransactionDetailScreen-dG3SEGK8.js";import{w as vc}from"./withTransactionSidePanel-CPfQcd4u.js";import{h as wc,v as Pc,c as xc}from"./routePaths-Cf2E-_nR.js";import{a as mt}from"./accountMappingHelper-DOs7iAIL.js";import{D as Rc}from"./DrawerScreen-BUtXmCMv.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./decodeURIComponentSafe-B4a7LpJx.js";import"./useInitialThreadRequest-DifgMaO6.js";import"./expenseAutomationHelper-DfYMglD1.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="3426353f-8a2a-46d6-adad-99a149d23e42",t._sentryDebugIdIdentifier="sentry-dbid-3426353f-8a2a-46d6-adad-99a149d23e42")}catch{}})();const Dc=()=>{const t=Ce(),s=ka(),P=It(),C=D((m=>De(m))),{useFeatureGate:f}=We(),{isFeatureEnabled:r}=f(Y.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:u}=f(Y.aiAuditScorePercentage),R=D((m=>m.expenseAutomationViewState.selectedPeriodByTenantId)),i=D((m=>Dn(m,C.tenantId))),{isAiCfoAccessEnabled:g,onAskAiCfoClick:b}=_a({mobileExploreReferrer:"Month-End Close Overview"}),w=n.useCallback(((m,M,K=!1)=>{t(Pe({tenantId:M,period:{month:m.month,year:m.year},refreshViewInBackground:K}))}),[]),y=n.useCallback((m=>{const M=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(m.month,m.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,M??null),t(Fn(C.tenantId,m))}),[C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),p=R[C.tenantId],c=n.useCallback((()=>{const m=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(p.month,p.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,m??null),w(p,C.tenantId,!0)}),[w,p,C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),$=te(P.state?.pathnameStackToGoBack,P.pathname),I=n.useCallback((()=>{if(i.monthEndCloseChecks!=null&&p!=null){const m=i.monthEndCloseChecks.monthEndCloseCheckList.find((M=>M.progress<100));if(m!=null)return void s(`./${m.id}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}});s(`./month_end_insights/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}})}}),[i.monthEndCloseChecks,p]),{areTenantIdsInSync:v}=Ra();return Da({isDataReady:i.fetchState==="Completed"}),n.useEffect((()=>{p!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&v&&w(p,C.tenantId)}),[w,p,i.fetchState,C.tenantId,v]),n.useEffect((()=>{p!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&v&&t(_n(p))}),[p,i.monthClosePerformanceTrendFetchStatus.fetchState,v]),n.useEffect((()=>{const m=setInterval((()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&c()}),3e5);return()=>clearInterval(m)}),[i.fetchState]),n.useEffect((()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const m=P.state?.referrer;G.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,m??null)}}),[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),T.jsx(Fc,{children:T.jsx(Qs,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:r,onMonthEndCheckClick:m=>{s(`./${m}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:y,handleReviewButtonClick:I,onBackClick:()=>{s("../../dashboard")},onReload:c,isAiCfoAccessEnabled:g,onAskAiCfoClick:b,aiAuditScorePercentageEnabled:u})})},Fc=Qe.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
- `,_c=Ia.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:P,onFetchLinkTokenClick:C,onEstablishConnectionClick:f})=>{const r=Ce(),{useFeatureGate:u}=We(),{isFeatureEnabled:R}=u(Y.isReconV3Enabled),{isFeatureEnabled:i}=u(Y.isReconciliationCombinedStatementEnabled),g=Ke.getSignedInUser(),b=D((h=>De(h))),w=n.useMemo((()=>({userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:b?.tenantId??""})),[g?.userId,g?.zeniSessionId,b?.tenantId]),{accountReconciliationsByAccountID:y,excludedAccountIDs:p,monthYearPeriod:c,statementUploadChosen:$}=t,I=y[s],v=n.useMemo((()=>Un(y,s)),[y,s]),m=n.useMemo((()=>Vn(y)),[y]),M=n.useMemo((()=>Bn(y,s)),[y,s]),K=n.useRef(!1),U=n.useCallback((h=>{K.current=h,ua(s,h)}),[s]),O=n.useCallback((h=>{r(dt({accountId:s,selectedPeriod:c,dismissedToBackground:!0,backgroundCompletedSteps:h.completedSteps,startedAtMs:h.startedAtMs,totalDurationSeconds:h.totalDurationSeconds})),h.accountMappings!=null&&r(Ge({accountId:s,selectedPeriod:c,localData:{combinedStatementAccountMappings:h.accountMappings}})),I!=null&&requestAnimationFrame((()=>{K.current||r(St({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Ks(I)}]}))}))}),[r,c,I,s]),e=n.useCallback((()=>{r(dt({accountId:s,selectedPeriod:c,dismissedToBackground:!1}))}),[r,s,c]),a=n.useCallback((h=>{r(Kt({accountId:s,selectedPeriod:c,backgroundCompletedSteps:h}))}),[r,c,s]),l=n.useCallback((()=>{r(Kt({accountId:s,selectedPeriod:c,backgroundCompletedSteps:0})),r(dt({accountId:s,selectedPeriod:c,dismissedToBackground:!1}))}),[r,c,s]);n.useEffect((()=>()=>{ua(null,!1)}),[]);const d=I?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??I?.accountReconEntity.statementMetaData?.statementUploadId,S=I?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,k=D((h=>S!=null&&S!==""?Mn(On(h.userState,S)):"")),x=n.useCallback((()=>{r(Xt({accountId:s,selectedPeriod:c}))}),[r,s,c]),L=n.useCallback((()=>{r(Xt({accountId:s,selectedPeriod:c})),r(qe({statementUploadChosen:!0}))}),[r,s,c]),z=(h,N)=>{r(Xn(h,N.split(".")[0]))},A=(h,N)=>{if(N===!0){const Z=I?.combinedStatementGroupId??I?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??I?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(Z!=null&&Z!=="")return void r(Qn({accountId:s,selectedPeriod:c,combinedStatementGroupId:Z,fileId:h}))}d!=null&&r(Kn({accountId:s,selectedPeriod:c,fileId:h,statementUploadId:d}))},ae=()=>{r(qe({statementUploadChosen:!1}))},X=h=>{r(Wn({accountId:s,selectedPeriod:c,payload:h,statementAccountScope:i===!0?I?.localData?.statementAccountScope??"single_account":"single_account"}))},fe=n.useCallback(((h,N,Z)=>{r(Ln({accountId:h,selectedPeriod:N,statementUploadId:Z}))}),[r]),oe=n.useCallback(((h,N,Z,Te,pe)=>{pe!=null&&pe!==""&&r(jn(pe)),r(Te==null||Te===""?$n({accountId:h,selectedPeriod:N,statementUploadId:Z}):zn({accountId:h,selectedPeriod:N,statementUploadId:Z,combinedStatementGroupId:Te}))}),[r]),Ie=n.useCallback(((h,N)=>{N!==""&&r(Gn({accountId:s,selectedPeriod:c,statementUpdateLocalData:h,statementUploadId:N}))}),[r,s,c]),q=n.useCallback((()=>{d!=null&&r(I?.localData?.statementAccountScope!=="multi_account"?Nn({accountId:s,selectedPeriod:c,statementUploadId:d}):qn({accountId:s,selectedPeriod:c,statementUploadId:d}))}),[r,I?.localData?.statementAccountScope,s,c,d]),W=n.useCallback((h=>{d!=null&&r(Jn({accountId:s,selectedPeriod:c,statementUploadId:d,accountMappings:h}))}),[r,c,s,d]),se=n.useCallback((()=>{r(qe({statementUploadChosen:!0}))}),[r]),H=h=>{r(Ge({accountId:s,selectedPeriod:c,localData:{accountSource:h}}))},Fe=h=>{r(Ge({accountId:s,selectedPeriod:c,localData:{statementAccountScope:h}}))},me=n.useCallback((()=>{r(Ta({accountId:s}))}),[r,s]),Xe=n.useCallback((h=>{r(le(c,h,!0)),P()}),[r,c,P]),Ze=n.useCallback((()=>{r(Yn({accountId:s,selectedPeriod:c,statementProcessingFailed:!1})),r(Hn({accountId:s,selectedPeriod:c}))}),[r,s,c]),_e=n.useCallback((()=>{r(ba({accountId:s}))}),[r,s]),ke=p.includes(s)?t.excludedAccountReconciliationByAccountID[s]:void 0;if(ke!=null)return T.jsx(Sa,{children:T.jsx(ga,{$isV3:R===!0,children:T.jsx(Xs,{excludedAccountReconciliation:ke,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:R,onDismissClick:P,onIncludeIntoReconciliation:_e})})});if(I!=null){const h=R===!0?T.jsx(Zs,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:I,monthYearPeriod:c,onDismissClick:P,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:C,onEstablishConnectionClick:f,onEditFileName:z,onDeleteFile:A,onSelectSourceType:H,onSelectStatementAccountScope:Fe,isReconciliationCombinedStatementEnabled:i===!0,ledgerAccounts:v,statementOverrideWarningAccountIds:M,unavailableLedgerAccountIds:m,onConfirmStatementMapping:W,filesEndPoint:Re.fileMicroServiceBaseUrl,authParams:w,openFilePicker:$,onStatementUploadSuccess:X,onUploadWindowOpenedOnce:ae,onExcludeFromReconciliation:me,onRetryParsing:fe,onFetchStatementParseInfo:oe,onReviewClicked:Xe,statementProcessingFailed:I.statementProcessingFailed,statementProcessingDismissedToBackground:I.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:Ze,onContinueInBackground:O,onClearStatementProcessingDismissedToBackground:e,onResetStatementProcessingProgress:l,onStatementProcessingProgressChange:a,onStatementFlowVisibilityChange:U,onReuploadStatement:se,onStatementFormDataChange:Ie,onStatementConfirmSave:q,reconciledByName:k,onDismissDateConflict:x,onReuploadAfterDateConflict:L,isReconV3Enabled:R}):T.jsx(ec,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:I,monthYearPeriod:c,onDismissClick:P,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:C,onEstablishConnectionClick:f,onEditFileName:z,onDeleteFile:A,onSelectSourceType:H,filesEndPoint:Re.fileMicroServiceBaseUrl,authParams:w,openFilePicker:$,onStatementUploadSuccess:X,onUploadWindowOpenedOnce:ae,onExcludeFromReconciliation:me});return T.jsx(Sa,{children:T.jsx(ga,{$isV3:R===!0,children:h})})}return null})),Sa=Qe.div`
9
- display: flex;
10
- flex-direction: column;
11
- height: 100%;
12
- `,ga=Qe.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 Uc({companyId:t,closeCustomerRequestDrawer:s,addCustomerRequest:P,resetCustomerRequest:C}){const f=Ke.getSignedInUser();if(f==null)throw Error("Can't access Customer Request page without signing in...");const r=D((u=>Zn(u,t,f)));return n.useEffect((()=>{C()}),[]),T.jsx(T.Fragment,{children:r.fetchState==="In-Progress"||r.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?T.jsx(Fa,{fetchState:"In-Progress"}):T.jsx(tc,{onCloseClick:s,addCustomerRequest:P,snippets:r.companyMonthEndReportTemplatesData,bulletPoints:r.zeniRequestsData??[]})})}const Vc={schedules:"Review Schedules",existing_schedules:"Existing Schedules"},Bc=()=>{const t=D((b=>xe(b))),s=It(),{currentSelectedViewFetchState:P,currentSelectedView:C,selectedPeriod:f}=t,r=Je(C),u=Je(P.fetchState),R=t.jeSchedules.uiState.selectedPageTab??"schedules",i=Je(R),g=n.useCallback((b=>{const w=s.state?.referrer;C==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?G.trackTransactionsReviewPage(f.month,f.year,t.transactionView.totalCountByTab.review,0,b,w??null):G.trackTransactionsAutoCategorisedPage(f.month,f.year,t.transactionView.totalCountByTab.autoCategorized,0,b,w??null)),C==="missing_receipts"&&G.trackMissingReceiptsPage(f.month,f.year,b,t.missingReceipts.transactions.length,w??null),C==="je_schedules"&&G.trackMonthCloseScheduleListPage(f.month,f.year,b,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(y=>{const p={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return y.forEach((c=>{if(eo(c))p.oneTimeAccrualCount+=1;else switch(to(c)){case"prepaid_expenses":p.prepaidCount+=1;break;case"fixed_assets":p.fixedAssetsCount+=1;break;case"accrued_expenses":p.accruedCount+=1}})),p})(t.jeSchedules.pendingReviewSchedules),Vc[R],w??null),C==="flux_analysis"&&G.trackFluxAnalysisPage(f.month,f.year,b,Mc(t.fluxAnalysis),w??null),C==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&G.trackInsightsEmailPage(f.month,f.year,b,"draft",t.auditSummary.auditScorePercentage,null,w??null)}),[f,t,R]);return n.useEffect((()=>{(u!==P.fetchState||C!==r||C==="je_schedules"&&i!=null&&R!==i)&&P.fetchState==="Completed"&&g(!1)}),[C,P.fetchState,r,R,i]),g},Mc=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Oc,comma:Ca,space:Lc}},dateFormat:Ua}=ac.getLocalizedStrings(),fa=Ws,jc=Pn((function(t,s){const{uncategorizedAccounts:P,vendorSearchAutoCompleteData:C,monthEndInsightsCustomerRequestData:f,monthEndInsightsPreviewMode:r,companyId:u,isMissingReceiptsBulkUploadEnabled:R,isTransactionActivityEnabled:i,newScheduleActiveType:g}=s,b=Ke.getSignedInUser(),w=t.tenantState.currentTenantId,y={userId:b?.userId??"",sessionId:b?.zeniSessionId??"",tenantId:w??""},p=xe(t),{selectedTransactionCategorizationTab:c}=p,{searchTransactionsResults:$,searchTransactionsFetchState:I}=io(t),v=g==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:m,classListNestedAccountHierarchy:M,allDepreciationAccountListNestedAccountHierarchy:K,newScheduleLocalData:U,saveStatus:O}=lo(t,v);return{expenseAutomationViewSelector:p,accountListNestedAccountHierarchy:m,allDepreciationAccountListNestedAccountHierarchy:K,baseTransactionSearchFetchState:I,baseTransactionSearchResults:$,classListNestedAccountHierarchy:M,newScheduleLocalData:U,initialSelectedBaseTransaction:U.selectedBaseTransactionId!=null?ro(t.transactionState,uo(U.selectedBaseTransactionId)):void 0,newAccrualAccountsView:mo(t),newScheduleSaveStatus:O,bulkUploadSelector:R===!0?p.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:C,authParams:y,receiptUploadEndpoint:`${Re.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${pa}/transaction_attachments`,bulkUploadEndpoint:R===!0?`${Re.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:c,selectedTransactionGroup:p.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:f,monthEndInsightsPreviewMode:r,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:b,uncategorizedAccounts:P,companyId:u,isTransactionActivityEnabled:i,receiptsEmail:ho(t.tenantState,w),downloadParams:{authParams:y,jeScheduleEndPoint:`${pa}/jeScheduleReports`,timezone:po(),companyName:De(t).companyName}}}),(function(t,s){const{themeState:P,isAccountingClassesEnabled:C,isCOTEnabled:f,isMissingReceiptsBulkUploadEnabled:r,location:u,vendorSearchAutoCompleteData:R,expenseAutomationViewSelector:i,currentTenant:g,newScheduleActiveType:b,uncategorizedAccounts:w,navigate:y,onClickCustomerRequest:p,handleEditClick:c,setActivityLogTransactionId:$}=s,{selectedPeriod:I,currentSelectedView:v,reconciliation:{selectedAccountId:m}}=i,{accountSettingsView:M}=i.jeSchedules,K=va(I),U=He(K.start),O=He(K.end);return{onZeniLogoClick:()=>{P.toggle()},onUploadReceiptAttachment:e=>{G.trackMissingReceiptAttached(I.month,I.year),t(Ts(e))},onUploadTransactionReceipt:(e,a,l,d,S,k)=>{t(ca(e,a,{fetchState:"In-Progress"}));const x=()=>t(ca(e,a,{fetchState:"Error"}));sc(`${Re.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,k,a,l,d,S).then((L=>{L!=null?t(ks(e,L)):x()})).catch(x)},onMissingReceiptsRowClick:(e,a)=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,a);const l=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:l,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(Is(e,a)),g!=null&&t(Pe({tenantId:g.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,l,d)=>{t(fs(e,{fetchState:a,error:l})),l!=null&&t(St({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:d!=null?Lc+Oc+d+Ca:Ca}]}))},onUpdateJESchedulesUIState:e=>{e.createdGroupCollapsed!=null?t(hs()):e.pendingGroupCollapsed!=null?t(Ss()):e.selectedJETypeFilter!==void 0?t(gs(e.selectedJETypeFilter)):t(Cs(e))},onUpdateMissingReceiptsUIState:e=>{t(ps(e))},onFetchMissingReceiptsList:()=>{O!=null&&U!=null&&t(Pa({start:U,end:O},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...r===!0?{onBulkUploadFiles:e=>{t(Hs(e))},onBulkUploadProgress:e=>{t(Ys(e))},onBulkUploadSuccess:e=>{t(Js({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Ns(e))},onConfirmBulkUploadMatch:(e,a,l,d,S)=>{t(qs(e,a,l,d,S))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Gs())},onSetBulkUploadResultsTab:e=>{t($s(e))},onSetBulkUploadCompletedSubTab:e=>{t(zs(e))},onSetBulkUploadSortConfig:(e,a)=>{t(da({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(js())},onSearchTransactionsForManualMatch:(e,a)=>{t(fa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=i.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(fa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(Ls(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(Os())},onFetchBulkUploadBatches:e=>{t(xa(e))},onFetchMoreBatchDetails:()=>{t(Ms())},onResetBulkUploadSort:()=>{t(da({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(ms())},onSearchTextChanged:e=>{const a=i.currentSelectedView,l=i.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(ut({selectedTab:l,uiState:{searchString:e}})),O!=null&&U!=null&&t(ue(l,{start:U,end:O},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=i.selectedTransactionCategorizationTab;t(us({filters:e,selectedTab:a}))},onRefresh:()=>{s.trackExpenseAutomationTabAnalytics(!0),t(ds())},onClose:()=>{v==="reconciliation"&&m!=null&&t(sa({selectedAccountId:void 0})),y("../")},onBack:()=>{v==="reconciliation"&&m!=null&&t(sa({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(rs(e))},onSaveReconciliationReview:e=>{t(ls(e))},onUpdateStep:e=>{const{selectedPeriod:a}=i,l=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:l,referrer:i.currentSelectedView}}),t(wa(e))},handleLogOutClick:()=>{const e=te(u.state?.pathnameStackToGoBack,u.pathname);y("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:l,fixedAssetsAccount:d,accruedExpensesAccount:S}=a,k=mt(M.prepaidExpensesAccountList,l.selectedOptions),x=mt(M.fixedAssetsAccountList,d.selectedOptions),L=mt(M.accruedExpensesAccountList,S.selectedOptions),z={selectedPrepaidExpensesAccountIds:k.map((A=>A.accountId)),selectedFixedAssetsAccountIds:x.map((A=>A.accountId)),selectedAccruedExpensesAccountIds:L.map((A=>A.accountId))};t(is({data:z}))},onSaveJeAccountSettingsClick:()=>{t(cs())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:l,accumulatedDepreciationCategory:d,scheduleClass:S,scheduleExpenseCategory:k,vendor:x}=a,{allAccountList:L,allClassList:z,allDepreciationAccountList:A}=i.jeSchedules,ae=R.entityAutoCompleteView.vendor.length>0?R.entityAutoCompleteView.vendor.find((q=>q.id===x?.selectedOption)):void 0,X={id:ae?.zeniId??x?.selectedOption??"",name:ae?.name??x?.defaultOptions.find((q=>q.value===x?.selectedOption))?.label??"",logo:ae?.logo},fe=k?.selectedOption!=null?L.find((q=>q.qboId===k.selectedOption)):void 0,oe=S?.selectedOption!=null?z.find((q=>q.classId===S.selectedOption)):void 0,Ie=d?.selectedOption!=null?A.find((q=>q.qboId===d.selectedOption)):void 0;t(ss({scheduledJournalEntryID:e,localData:{jeScheduleID:l,scheduledJournalEntryID:e,updatedCategoryId:fe?.accountId,updatedClassId:oe?.classId,updatedAccumulatedDepreciationCategoryID:Ie?.accountId,updatedVendor:{id:X.id,name:X.name}}}))},onRevertJeSchedule(e,a,l,d,S){t(os(e,a,l,d,S))},ignoreRecommendedJeSchedule(e,a,l,d){t(ns(e,a,l,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(ea({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t($e("common"))},onCancelAutoComplete:()=>{t($e("common"))}},onPostJESchedule(e,a){t(as({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(ts())},onViewTransaction(e){if(s.tenantEmailDomain==null)return;const a=xc(e,s.tenantEmailDomain),l=te(s.location.state?.pathnameStackToGoBack,`${s.location.pathname}${s.location.search}`);s.navigate(a,{state:{pathnameStackToGoBack:l,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(es({query:e,scheduleType:b==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const l=ft(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(oa({scheduleType:l,localData:a}))},onSaveSchedule(e,a){const l=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:d,allDepreciationAccountList:S}=i.jeSchedules,k=a.selectedAccount!=null?d.find((L=>L.qboId===a.selectedAccount)):void 0,x=a.selectedAccumulatedDepreciationCategory!=null?S.find((L=>L.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(oa({scheduleType:l,localData:{...a,selectedAccount:k?.accountId,selectedAccumulatedDepreciationCategory:x?.accountId}})),t(Zo({scheduleType:l}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Ho()),t(Wo()),t(Qo({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(Ko({scheduleType:a})),t(Xo(a,void 0))},onCreateOneTimeAccrual(e){t(Yo(e))},handleJeScheduleClick:(e,a,l)=>{(function(S,k){return k!=="accrued_expenses"})(0,l)&&t(Jo({selectedJEScheduleKey:a}));const d=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../../vendors/schedules/${l}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,l,d)=>{t(a!=="revert"?No(e,l,d):qo(e,l,d))},onOneTimeAccrualClick:e=>{const a=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{g!=null&&t(Go(e,g.companyId,g.tenantId))},onClickCustomerRequest:p,setActivityLogTransactionId:$,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t($o())},onOpenFileAttachmentSnackBar:()=>{t(St({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(zo(e))},onUpdateFileAttachment:e=>{t(jo({files:e}))},previewMonthEndReport:(e,a,l,d,S)=>{g!=null&&t(na(e,g.companyId,a,!0,l,d,{agentInsightEdits:S,tenantId:g.tenantId}))},saveMonthEndReport:(e,a,l,d,S)=>{g!=null&&t(na(e,g.companyId,a,!1,l,d,{agentInsightEdits:S,tenantId:g.tenantId}))},onEditMonthEndInsightsClick:c,sendMonthEndReport:e=>{const a=u.state?.referrer,{selectedPeriod:l,auditSummary:d}=i;g!=null&&d?.auditScorePercentage!=null&&(t(Oo(g.companyId,e,g.tenantId)),G.trackInsightsEmailPage(l.month,l.year,!1,"draft",d.auditScorePercentage,Lo().format(Ua.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const l=i.transactionView.uiState.searchString??"",d=i.transactionView.transactions,S=d.findIndex((L=>L.id===e)),k=l.length>0?{resultPosition:S>=0?S+1:void 0,resultsCount:d.length,searchTerm:l}:void 0;if(s.openTransactionPanel)return void s.openTransactionPanel(e,a,k);const x=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:x,message:"expenseAutomation",origin:"transaction_categorization",searchContext:k}})},setLocalDataForCategoryAndClass:(e,a,l,d,S,k,x,L,z,A,ae,X)=>{t(Mo(e,a,l,d,w,S,k,x,L,z,A,ae,X))},onCancelAutoComplete:()=>{t($e("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(ta({scrollPosition:e}))},onUpdateTab:e=>{s.closeSidePanel?.(),O!=null&&U!=null&&(t(ue(e,{start:U,end:O},!1,!1)),t(Bo(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{s.closeSidePanel?.(),O!=null&&U!=null&&(t(Vo(e)),t(ue("autoCategorized",{start:U,end:O},!1,!1)))},onTransactionGroupChange:e=>{s.closeSidePanel?.(),O!=null&&U!=null&&(t(Uo(e)),t(ue(s.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:U,end:O},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(ut({selectedTab:e,uiState:a})),O!=null&&U!=null&&t(ue(e,{start:U,end:O},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(ut({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,l,d,S,k)=>{O!=null&&U!=null&&t(ue(e,{start:U,end:O},!0,l,a,d,S,k))},resetTransactionCategorizationLocalData:(e,a,l,d,S,k,x)=>{t(_o(e,a,l,d,x??null,S,k,!1)),kc(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,l,d,S)=>{t(aa({selectedTab:e,transactionId:a,lineId:l,selectedTransaction:d,uncategorizedAccounts:w,updatedVendor:S,isAccountingClassesEnabled:C}))},onSaveUpdateTransactionCategorization:(e,a,l)=>{const d=u.state?.referrer;e==="autoCategorized"?G.trackTransactionsAutoCategorisedPage(I.month,I.year,i.transactionView.totalCountByTab.autoCategorized,a.length,!1,d??null):G.trackTransactionsReviewPage(I.month,I.year,i.transactionView.totalCountByTab.review,a.length,!1,d??null),t(Fo(e,a,l)),Ic(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(Do({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,l,d,S,k)=>{const{transactionId:x,transaction:L,lineIds:z}=a;k!=null&&t(xo({transactionId:x,customerUpdates:k})),t(Ro({selectedTab:d,transactionId:x.id,lineId:z[0],selectedTransaction:L,uncategorizedAccounts:w,updatedCustomer:k,selectedEntity:S,isAccountingClassesEnabled:C})),S!=null&&t(Ct({entity:S,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:f}))},onFetchRecommendationsForEntityCategorization:(e,a,l,d,S,k)=>{const{transactionId:x,transaction:L,lineIds:z}=a;k!=null&&(t(vo({transactionId:x,vendorUpdates:{name:k.name,id:k.id?k.id:void 0}})),t(wo({vendorId:k.id?k.id:void 0,localData:{vendorName:k.name,vendorId:k.id?k.id:void 0}}))),k?.id?(t(aa({selectedTab:d,transactionId:x.id,lineId:z[0],selectedTransaction:L,uncategorizedAccounts:w,updatedVendor:k,selectedEntity:S,isAccountingClassesEnabled:C})),S!=null&&t(Ct({entity:S,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:f}))):t(Po({selectedTab:d,transactionId:x.id,lineId:z[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(Ne(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(Ne(I,!0,!1,null,!1,!1))},markAsReview:(e,a,l,d)=>{G.trackFluxAnalysisReviewed(l.month,l.year,d??!1,e),t(Ao(a,e,l,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(Eo(e))},updateOperatingExpensesIdsForReview:e=>{t(yo({operatingExpenseIds:e,selectedPeriod:I}))},redirectToVendorDetailPage:e=>{if(s.tenantEmailDomain!=null){const a=Pc(e.id,e.qboId,s.tenantEmailDomain),l=te(s.location.state?.pathnameStackToGoBack,s.location.pathname);s.navigate(a,{state:{pathnameStackToGoBack:l,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(bo({sectionId:e,selectedPeriod:I}))},onFetchReimbursementView:(e,a,l)=>{t(Ne(e,!0,!1,a,!0,l))},onReviewClicked:e=>{t(le(I,e))},setOpenDrawerClicked:e=>{t(Ye({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(ya("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const l=g?.companyId;l!=null&&(t(Ea(e,l,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(Aa({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(Ye({selectedDrawerAccountId:e})),t(Ge({accountId:e,selectedPeriod:I,localData:{accountSource:"bank_statement"}})),t(qe({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(le(I,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(To({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(ko({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(Io({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{s.closeSidePanel?.(),t(fo({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,l)=>{const d=e.vendor?.id;l&&d!=null&&t(go(d)),t(Co({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,gt("bill"));const a=te(u.state?.pathnameStackToGoBack,u.pathname);y(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{y(-1)},onReconListPageScroll:e=>{t(ta({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ea({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t($e("common"))},onReconNodeCollapseToggled:(e,a)=>{t(So({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(Ta({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(ba({accountId:e}))}}}),((t,s,P)=>{const{isMissingReceiptsBulkUploadEnabled:C,...f}=P;return(function(r,u,R){return{...r,...u,...R,onUploadTransactionReceipt:(i,g,b,w,y)=>{u.onUploadTransactionReceipt(i,g,b,w,y,r.authParams)}}})(t,s,f)}))(nc(oc)),pt="newScheduleMode",ht="newScheduleType",zc=vc((function(t){const s=t.displayName??t.name??"Component",P=Ia.memo(t),C=f=>{const r=Ce(),u=(function(){const v=Ce(),m=D((M=>xe(M).reconciliation.selectedDrawerAccountId));return{isOpen:m!=null,selectedAccountId:m,openPanel:n.useCallback((M=>{v(Ye({selectedDrawerAccountId:M}))}),[v]),closePanel:n.useCallback((()=>{v(Ye({selectedDrawerAccountId:void 0}))}),[v])}})(),R=D((v=>xe(v).reconciliation)),i=D((v=>De(v))),g=n.useCallback(((v,m)=>{r(ya("expense_automation_reconcile",v,m))}),[r]),b=n.useCallback(((v,m)=>{const M=i?.companyId;M!=null&&(r(Ea(v,M,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",m)),r(Aa({accountId:m,connectionInProgress:!0})))}),[r,i?.companyId]),w=n.useMemo((()=>{if(u.isOpen&&u.selectedAccountId!=null)return T.jsx(_c,{reconciliation:R,selectedDrawerAccountId:u.selectedAccountId,onClose:u.closePanel,onFetchLinkTokenClick:g,onEstablishConnectionClick:b})}),[u.isOpen,u.selectedAccountId,u.closePanel,R,g,b]),y=n.useMemo((()=>({reconPanelContent:w,reconSidePanelIsOpen:u.isOpen,closeReconSidePanel:u.closePanel})),[w,u.isOpen,u.closePanel]),{useFeatureGate:p}=We(),{isFeatureEnabled:c}=p(Y.isReconV3Enabled),$=n.useContext(ma),I=n.useMemo((()=>u.isOpen?c===!0?{selectedItemId:u.selectedAccountId}:{closePanel:u.closePanel,selectedItemId:u.selectedAccountId}:$),[u.isOpen,u.closePanel,u.selectedAccountId,$,c]);return T.jsx(ma.Provider,{value:I,children:T.jsx(P,{...f,...y})})};return C.displayName=`withReconSidePanel(${s})`,C})((({closeSidePanel:t,openTransactionPanel:s,panelContent:P,sidePanelIsFullView:C,sidePanelIsOpen:f,reconPanelContent:r,reconSidePanelIsOpen:u,closeReconSidePanel:R})=>{const{isAiCfoOpen:i,setIsAiCfoOpen:g}=cc(),b=ic(),{isOpen:w}=lc(),y=ka(),p=It(),c=Ce(),{isAiCfoAccessEnabled:$,onAskAiCfoClick:I}=_a({mobileExploreReferrer:"Transaction categorization"}),v=n.useCallback((()=>{f===!0&&C!==!0&&t?.()}),[t,f,C]),{areTenantIdsInSync:m}=Ra(),M=Bc(),K=rc(),[U,O]=n.useState(!1),[e,a]=xn(),l=n.useCallback((o=>{a((E=>{const j=new URLSearchParams(E);return o==null?(j.delete(pt),j.delete(ht),j):(j.set(pt,o.scheduleDetailsMode),j.set(ht,o.scheduleType),j)}),{replace:!0})}),[a]),[d,S]=n.useState(void 0),k=n.useCallback(((o,E,j)=>{const B=ft(o);S(B),l({scheduleDetailsMode:E,scheduleType:o}),c(ia({scheduleType:B==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:j}))}),[c,l]),x=n.useMemo((()=>{const o=e.get(pt),E=e.get(ht);return o!=null&&E!=null?{scheduleDetailsMode:o,scheduleType:E}:void 0}),[e]),L=n.useCallback((o=>{l(o),o!=null&&c(ia({scheduleType:ft(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[c,l]),z=D((o=>Zt(o))),A=D((o=>De(o))),[ae,X]=n.useState(!1),[fe,oe]=n.useState(!1),[Ie,q]=n.useState([]),[W,se]=n.useState(null),H=n.useCallback((()=>{se(null)}),[]),Fe=W?.contentType==="activity"?W.detail.transactionId:void 0,me=n.useCallback((o=>{o!=null?(i&&g(!1),b(),v(),se({contentType:"activity",detail:{transactionId:o}})):se((E=>E?.contentType==="activity"?null:E))}),[v,i,b,g]),Xe=n.useCallback((o=>{i&&g(!1),b(),v(),se({contentType:"transfer",detail:o})}),[v,i,b,g]),Ze=n.useCallback((()=>{b(),H(),v(),I()}),[v,H,I,b]),_e=n.useRef(i);n.useEffect((()=>{i===!0&&_e.current===!1&&(b(),H(),v()),_e.current=i}),[v,H,i,b]);const ke=n.useRef(w);n.useEffect((()=>{w===!0&&ke.current===!1&&(i&&g(!1),H(),f===!0&&C!==!0&&t?.()),ke.current=w}),[H,t,w,i,g,C,f]);const h=f===!0&&C!==!0,N=n.useRef(h);n.useEffect((()=>{h&&!N.current&&(i&&g(!1),b(),H()),N.current=h}),[H,i,h,b,g]);const[Z,Te]=n.useState(!1),pe=n.useRef(!1),{selectedTab:kt}=Qt(),{tenantEmailDomain:et}=Qt(),[tt,Tt]=n.useState(p.state?.message==="comingFromTransactionDetail"),bt=p.state?.message==="comingFromOverview",Va=dc(),at=Ke.getSignedInUser(),{useFeatureGate:ne}=We(),{isFeatureEnabled:yt}=ne(Y.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:be}=ne(Y.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:nt}=ne(Y.isTransactionActivityEnabled),{isFeatureEnabled:Ba}=ne(Y.isAccrualEnabled),{isFeatureEnabled:Et}=ne(Y.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:Ma}=ne(Y.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:Oa}=ne(Y.isProjectsTransactionsEnabled),{isFeatureEnabled:La}=ne(Y.isReconV3Enabled),ja=n.useCallback((o=>{const E=gt(o.transactionType??(o.view==="reconciliation"?"bill":"expense")),j=te(p.state?.pathnameStackToGoBack,p.pathname),B=new URLSearchParams({view:"full"});o.threadId!=null&&B.set("thread_id",o.threadId),o.entityType!=null&&B.set("entity_type",o.entityType),y(`/${et}/transaction/${encodeURIComponent(E)}/${o.transactionId??o.entityId}?${B.toString()}`,{state:{pathnameStackToGoBack:j,message:"expenseAutomation"}})}),[y,et,p.state,p.pathname]),za=D((o=>bs(o,"common"))),V=D((o=>xe(o))),{categoryOptions:$a,paymentAccountNames:Ga}=D((o=>ys(o.accountState))),qa=D((o=>Es(o.classState))),{monthEndCloseChecksView:J,currentSelectedView:F,selectedPeriod:_,selectedTransactionCategorizationTab:ot,currentSelectedViewBackgroundRefreshFetchState:Na,currentSelectedViewFetchState:ce,jeSchedules:st,reconciliation:At}=V;Tc(F==="transaction_categorization");const Ja=V.transactionView.saveStatus.fetchState,Ue=V.transactionView.transactions,vt=n.useRef(Ue);vt.current=Ue;const wt=D((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Pt=D((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),xt=n.useRef(wt);xt.current=wt;const Rt=n.useRef(Pt);Rt.current=Pt;const Ve=D((o=>{const E=o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return E!=null?o.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[E]?.filters:void 0})),Dt=n.useRef("");n.useEffect((()=>{if(F!=="transaction_categorization")return;const o=V.transactionView.uiState.searchString??"";if(ce.fetchState!=="Completed"||o.length===0||o===Dt.current)return;Dt.current=o;const E=Ve!=null?uc(Ve):0,j=Ve?.categories.filter((B=>B.values.length>0&&String(B.values[0]??"").trim()!=="")).map((B=>`${B.field}:${B.values.join(",")}`))??[];G.trackAiCloseTransactionSearch({filtersApplied:j,hasResults:Ue.length>0,isFiltered:E>0,resultsCount:Ue.length,searchTerm:o,searchType:"free_text"})}),[F,ce.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,Ve]);const ie=bc(Ja,(()=>{const o=[],E=Rt.current,j=xt.current,B=j!=null&&E!=null?j[E]:void 0;if(B?.transactionReviewLocalDataById!=null)for(const Se of Object.values(B.transactionReviewLocalDataById)){const Q=Se?.transactionReviewLocalData?.lineItemById;if(Q!=null)for(const ct of Object.values(Q)){const we=ct?.account;we?.accountId!=null&&o.push(we.accountId)}}const he=vt.current;for(const Se of he)for(const Q of Se.lines??[])"account"in Q&&Q.account?.accountId!=null&&o.push(Q.account.accountId);return o}));n.useEffect((()=>{F==="transaction_categorization"&&f!==!0||me(void 0)}),[F,me,f]),n.useEffect((()=>{u===!0&&R?.()}),[F,At.selectedAccountId]);const Ya=V.transactionView.selectedTransactionCategorizationCompletedSubTab,Ha=V.transactionView.selectedTransactionGroup,Be=`${ot}|${Ya}|${Ha}`,Me=n.useRef(null),Ft=n.useRef(null);n.useEffect((()=>{Me.current!==null?Me.current!==Be&&(Me.current=Be,F==="transaction_categorization"&&H()):Me.current=Be}),[H,F,Be]);const Wa=D((o=>Fe==null?void 0:As(o.transactionState,Fe))),re=Wa?.qboId,_t=D((o=>re==null?void 0:vs(o,re)));n.useEffect((()=>{re!=null&&c(ws(re))}),[c,re]);const{createTransferEntryStatus:Ut,creditCardTransferAccountsList:Vt,transferAccounts:Bt}=V.transactionView,Mt=n.useCallback((o=>yc(c,o)),[c]),Ot=n.useMemo((()=>F!=="transaction_categorization"||W==null?null:W.contentType==="activity"?nt===!0?T.jsx(mc,{activityLogView:_t,qboId:re,onClose:()=>se(null),selectedTransactionId:W.detail.transactionId,isQuickViewCardStyle:!0},String(W.detail.transactionId)):null:W.contentType==="transfer"?T.jsx(pc,{createTransferEntryStatus:Ut,creditCardTransferAccountsList:Vt,transaction:W.detail,transferAccounts:Bt,onClose:()=>se(null),onCreateTransfer:Mt,isQuickViewCardStyle:!0},String(W.detail.transactionId)):null),[F,W,nt,_t,re,Ut,Vt,Bt,Mt]),Qa=Ot!=null,{selectedAccountId:ye}=At,Lt=Je(st.accountSettingsView.saveState.fetchState),Ka=D((o=>Ps(o.accountState,o.accountListState,"accountList"))),Xa=D((o=>xs(o))),Ee=kt!=null?Rs(kt):F,Za=D((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Da({isDataReady:ce.fetchState==="Completed"}),at==null)throw Error("Can't access expense automation screen without signing in...");const jt=va(_),Ae=He(jt.start),ve=He(jt.end);if(Ae==null||ve==null)throw Error(`Invalid start - ${Ae} and end - ${ve} period from given ${_}`);const en=n.useCallback((()=>{X(!1)}),[]),tn=n.useCallback((()=>{oe(!0)}),[]),an=n.useCallback((o=>{q(o),oe(!1)}),[]),nn=n.useCallback((()=>{q([])}),[]),Oe=V.missingReceipts.bulkUpload.phase,zt=V.missingReceipts.bulkUpload.currentBatchId;n.useEffect((()=>{be===!0&&F==="missing_receipts"&&Oe==="matching"&&zt!=null&&c(xa({cacheOverride:!0}))}),[be,F,Oe,zt,c]);const $t=at?.userId,on=_.month,sn=_.year,Gt=A?.tenantId;n.useEffect((()=>{F==="missing_receipts"&&be!==!1&&Oe==="idle"&&$t!=null&&Gt!=null&&c(Ds())}),[F,be,Oe,$t,Gt,on,sn,c]),n.useEffect((()=>{z.newVendorState?.vendorDetailLocalData?.vendorName!=null?O(!0):O(!1)}),[z.newVendorState?.vendorDetailLocalData?.vendorName]),n.useEffect((()=>{Ee!=null&&F!==Ee&&c(wa(Ee))}),[Ee]),n.useEffect((()=>{Z===!1&&ce.fetchState==="Completed"&&m&&(Te(!0),c(la(!1,!1)))}),[Z,ce,m]),n.useEffect((()=>{const o={month:_.month,year:_.year},E=Ft.current;Ft.current=o,E===null||E.month===o.month&&E.year===o.year||!bt&&m&&(c(la(!1,!1)),c(le(_,ye,!1,!1)))}),[_.month,_.year,m]);const Le=n.useCallback(((o=!1,E=!1)=>{const j={start:Ae,end:ve};switch(F){case"transaction_categorization":c(ue(ot,j,o,!tt,void 0,void 0,E)),Tt(!1);break;case"flux_analysis":c(Ne(_,o,E,null));break;case"month_end_insights":if(E===!1){const B=new Date(_.year,_.month,0),he=_s(B.toDateString()).format(Ua.analytics.YYYYDashMMDashDDFormat);c(Us(!0,A.companyId,A.tenantId,he)),c(Vs(A.companyId,A.tenantId))}break;case"je_schedules":c(Fs(j,E));break;case"missing_receipts":c(Pa(j,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,E));break;default:c(le(_,ye,o,E))}}),[F,Ae,ve,A.companyId,A.tenantId,ot,_,ye,tt,Tt]),cn=n.useCallback((()=>{Le(!0,!0)}),[Le]);n.useEffect((()=>{F===Ee&&ce.fetchState==="Not-Started"&&m&&Le(!0)}),[ce,Ae,ve,A.companyId,A.tenantId,m]),n.useEffect((()=>{bt||tt||pe.current||Na.fetchState==="In-Progress"||ce.fetchState!=="Completed"||(pe.current=!0,Le(!0,!0))}),[]),n.useEffect((()=>{J.fetchState!=="In-Progress"&&J.fetchState!=="Completed"&&J.fetchState!=="Error"&&A?.tenantId!=null&&c(Pe({tenantId:A.tenantId,period:_,refreshViewInBackground:!1}))}),[J.fetchState,A?.tenantId]),n.useEffect((()=>{J.fetchState!=="Completed"||!m||(J.monthEndCloseChecks?.monthEndCloseCheckList.some((o=>o.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&c(le(_,void 0,!1,!1))}),[J.fetchState,m,_.month,_.year,V.reconciliation.fetchStatus.fetchState,c]),n.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?X(!0):X(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),n.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&m&&(c(Pe({tenantId:A.tenantId,period:_,refreshViewInBackground:!0})),c(Bs({companyId:A.companyId})),y("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,A.tenantId,_,A.companyId,m]),n.useEffect((()=>{const o=setInterval((()=>{J.fetchState!=="In-Progress"&&J.fetchState==="Completed"&&c(Pe({tenantId:A.tenantId,period:_,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[J.fetchState,A.tenantId,_,c]),n.useEffect((()=>{const o=setInterval((()=>{F==="reconciliation"&&ye==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&c(le(_,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[F,c,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,le,ye,_]);const ln=ha(),{isFeatureEnabled:rn}=ne(Y.isRecommendationFeedbackEnabled),qt=hc(),{onRecommendationSelection:Nt,popup:dn}=Ec({isEnabled:rn}),un=n.useMemo((()=>({...qt,onRecommendationSelection:Nt})),[qt,Nt]);n.useEffect((()=>{const o=(J.monthEndCloseChecks?.monthEndCloseCheckList.find((E=>E.id==="month_end_insights"))?.isDisabled??!1)&&!yt;F!=="month_end_insights"||!o&&J.monthEndCloseChecks?.reportEmailSentDate==null||y("../")}),[F,J.monthEndCloseChecks]);const mn=u===!0?r:P,pn=u===!0||f===!0,hn=u===!0?R:t;n.useEffect((()=>{Lt==="In-Progress"&&st.accountSettingsView.saveState.fetchState==="Completed"&&c(ra())}),[Lt,st.accountSettingsView.saveState.fetchState,ra]);const{transactionId:Jt,onSaveVendor:Sn,onSaveSuccess:gn,onCancel:Cn,vendorViewDetails:fn}=(({expenseAutomationViewSelector:o,closeDrawerHandler:E,currentSelectedView:j})=>{const B=Ce();let he,Se,Q;const ct=ha(),we=o.transactionView;let Yt=()=>{};const{transactions:In,selectedTransactionId:ge,selectedTransactionLineId:je,transactionLocalData:kn}=we;if(j==="transaction_categorization"){const it=kn.find((de=>de.transactionId===ge)),ee=In.find((de=>de.id===ge)),Ht=je!=null?it?.transactionReviewLocalData?.lineItemById[je]:void 0,Wt=Ht?.account;Se=Ht?.class?.classId,he=["Uncategorized Income","Uncategorized Expense"].includes(Wt?.accountName??"")?void 0:Wt?.accountId;const bn=wc(ge,ee?.typeOfTransaction);ee!=null&&bn&&(Q={id:ge,type:gt(ee.typeOfTransaction)}),Yt=()=>{if(ge!=null&&je!=null&&ee!=null){const de=we.transactionLocalData.find((ze=>ze.transactionId===ge))?.transactionReviewLocalData;if(de!=null&&ee.lines!=null&&ee.lines.length>0){const ze=de.lineItemById[je];let lt=de.selectedEntity;if(co(ee)||(lt=ze.selectedEntityLine),lt!=null){const yn=lt,En={transactionId:{id:ee.id,type:ee.type},transaction:ee,lineIds:ee.lines.map((An=>An.id))??[]};B(Ct({entity:yn,amount:ze.amount.amount,transactionDetails:En,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:ct}))}}}}}const Tn=D((it=>Zt(it,void 0,he,Se)));return{transactionId:Q,onSaveVendor:()=>{B(so(Q,void 0,!1,!0))},onSaveSuccess:Yt,onCancel:()=>{Q!=null&&B(ao({transactionId:Q})),B(no()),B(oo()),E()},vendorViewDetails:Tn}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{O(!1)},currentSelectedView:F});return Va?.loggedInUserRoleMap==null?J.fetchState==="Error"?T.jsx(Sc,{onGoHome:()=>y("../",{replace:!0}),onReload:()=>window.location.reload()}):T.jsx(Fa,{fetchState:"In-Progress"}):T.jsxs(T.Fragment,{children:[T.jsx(Rc,{isOpen:fe,drawerLeftMargin:new gc(0,0,300,650),onClose:()=>{oe(!1)},children:T.jsx($c,{onClick:o=>o.stopPropagation(),children:T.jsx(Uc,{companyId:A.companyId,closeCustomerRequestDrawer:()=>oe(!1),addCustomerRequest:an,resetCustomerRequest:nn})})}),Jt!=null&&U&&T.jsx(Ac,{isOpen:U,transactionId:Jt,onSaveVendor:Sn,onSaveSuccess:gn,onCancel:Cn,vendorViewDetails:fn}),T.jsx(Cc,{toolkit:un,children:T.jsx(jc,{events:[],eventCallback:(o,E,j)=>{},navigate:y,location:p,themeState:K,categoryOptions:$a,classesForFilters:qa,accountsForFilters:Ga,vendorSearchAutoCompleteData:{autoCompleteText:Za,entityAutoCompleteView:za},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:be,monthEndInsightsPreviewMode:ae,monthEndInsightsCustomerRequestData:Ie,isRealtimeInsightsFeatureEnabled:yt,isCreateTransferEntryFromExpenseEnabled:Et,isAccountingClassesEnabled:Xa,isProjectsTransactionsEnabled:Oa,isCOTEnabled:ln,currentTenant:A,companyId:A.companyId,signedInUser:at,isTransactionActivityEnabled:nt,isRightPanelOpen:Qa,rightSidePanel:Ot,onOpenTransferRightPanel:Et===!0?Xe:void 0,uncategorizedAccounts:Ka,newScheduleActiveType:d,isAccrualEnabled:Ba,newScheduleSelection:x,onNewScheduleSelectionChange:L,onScheduleTypeChange:k,onNewScheduleSaved:cn,onClickCustomerRequest:tn,handleEditClick:en,tenantEmailDomain:et,trackExpenseAutomationTabAnalytics:M,setActivityLogTransactionId:me,closeSidePanel:hn,openTransactionPanel:s,sidePanelIsOpen:pn,sidePanelIsFullView:u!==!0&&C,panelContent:mn,isAiCfoAccessEnabled:$,onAskAiCfoClick:Ze,isExpenseAutomationCommentingEnabled:Ma,isReconV3Enabled:La,onExpenseAutomationCommentingThreadClick:ja,sidePanelListPercent:u===!0?66:void 0})}),dn,ie.showPopup&&ie.popupType!=null&&T.jsx(fc,{popupType:ie.popupType,currencySymbol:ie.currencySymbol,accountId:ie.popupAccountId??"",accountName:ie.popupAccountName??"",onSubmit:ie.handleSubmit,onDismiss:ie.handleDismiss})]})}))),$c=Qe(wn)`
22
- display: flex;
23
- min-height: 100%;
24
- flex-direction: column;
25
- `;function hi(){return T.jsxs(Rn,{children:[T.jsx(rt,{path:"*",element:T.jsx(Dc,{})}),T.jsx(rt,{path:"/:selectedTab/:selectedPeriod/*",element:T.jsx(zc,{})}),T.jsx(rt,{path:"*",element:T.jsx(vn,{})})]})}export{hi as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BeSMR7a1.js";import{a as r}from"./sentry-Uj7AWjah.js";import{au as i,av as l,Y as p,a2 as f}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import m from"./NotFoundScreen-C2tiSpQ7.js";import{h as u,g as b}from"./core-BL7rYGUF.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]="93541eca-5673-4733-9e72-1dbbcdcf5193",e._sentryDebugIdIdentifier="sentry-dbid-93541eca-5673-4733-9e72-1dbbcdcf5193")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=f(a.state?.pathnameStackToGoBack),c=n.poppedPathname??k();e(c,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=i(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:d}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -1 +0,0 @@
1
- import{a as r}from"./sentry-Uj7AWjah.js";import{u as l,h as f,g as m}from"./core-BL7rYGUF.js";import{hV as p,TL as g,TM as _}from"./zeni-epic-state-CxdZGPla.js";import{u as b,L as h,z as y}from"./index-E1NwyJIP.js";import"./liveblocks-BeSMR7a1.js";import"./recharts-BP8J0UHA.js";import"./mui-CPSuUssr.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.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]="8b0a8898-5f56-46ba-acaa-cc394e4a51f0",e._sentryDebugIdIdentifier="sentry-dbid-8b0a8898-5f56-46ba-acaa-cc394e4a51f0")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),a=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(a.current)return;a.current=!0;const s=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),s!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:s,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 +0,0 @@
1
- import{m as s}from"./liveblocks-BeSMR7a1.js";import{j as r}from"./core-BL7rYGUF.js";import{fB as d}from"./zeni-epic-state-CxdZGPla.js";import"./sentry-Uj7AWjah.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -1,2 +0,0 @@
1
- import{j as s}from"./liveblocks-BeSMR7a1.js";import{a as r}from"./sentry-Uj7AWjah.js";import{u as P,h as A,i as F,j as E,t as W,l as O,s as Z,g as Y,N as B,n as te,o as y}from"./core-BL7rYGUF.js";import{a6 as lt,h as p,ao as T,N as g,c9 as dt,ca as ut,cb as gt,cc as mt,cd as vt,ce as pt,cf as ft,cg as St,ch as ht,ci as Ct,cj as It,ck as Et,cl as kt,cm as yt,p as J,cn as xt,co as bt,ac as ae,cp as jt,cq as Dt,z as Se,cr as Pt,cs as At,ct as Lt,cu as $t,cv as wt,cw as Ft,cx as Tt,cy as Rt,V as Ot,ag as Sn,cz as _t,cA as Mt,cB as Nt,cC as Ut,cD as Bt,cE as Vt,cF as Zt,cG as Ht,cH as qt,t as Ke,g as hn,cI as Kt,cJ as Qt,cK as Gt,cL as zt,cM as Wt,cN as Yt,cO as Jt}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import{A as K}from"./AddressScreen-DKIOTZOx.js";import M from"./NotFoundScreen-C2tiSpQ7.js";import{YY as Xt,YZ as ei,uM as Qe,Y_ as je,Y$ as Q,vQ as Ge,vX as ni,w0 as Cn,Z0 as De,Z1 as In,vU as En,Z2 as Pe,vS as kn,yw as ti,vT as ii,Z3 as G,vd as se,vM as oi,xn as ze,vc as he,Z4 as ai,Z5 as yn,w7 as si,Z6 as z,we as ci,Z7 as ri,Z8 as xn,Z9 as bn,yi as li,Za as de,Zb as We,Zc as jn,va as di,Zd as ui,v4 as gi,Ze as mi,xA as vi,Zf as Dn,xJ as Ye,Zg as pi,xG as fi,Zh as Ae,gd as Si,Zi as ee,Zj as ne,wt as hi,vi as Je,Zk as Le,vn as Pn,vl as Ci,vf as Ii,wm as Ei,vp as ki,wv as yi,Zl as Ce,wC as An,wA as Ie,Fm as $e,xP as Xe,Zm as xi,vb as we,Zn as Fe,vy as Ee,vv as ke,vI as Ln,vH as Te,vs as bi,vB as $n,vK as ie,fB as Re,UL as wn,ve as Oe,vF as ji,vG as Di,vE as Pi,Zo as Ai,wa as en,wf as Li,wb as Fn,Zp as Tn,u_ as nn,Zq as $i,uW as Rn,Zr as wi,xV as Fi,xZ as H,xU as Ti,x1 as _e,Zs as Ri,Zt as On,y6 as tn,Zu as Oi,y3 as _i,Zv as _n,x4 as Mi,x5 as V,x8 as Ni,Zw as Mn,xi as me,Zx as Ui,wu as Nn,Tj as Un,Zy as Bi,xs as Vi,Zz as Bn,ZA as Zi,ZB as Hi,ZC as qi,yX as Ki,ZD as Qi,ZE as Vn,yd as Zn,ZF as Hn,yV as ve,ZG as Gi,yS as zi,ZH as Wi,ZI as Yi,ZJ as Ji,ZK as Xi,ZL as eo,ZM as on,ZN as no,y$ as to,ZO as Me,wM as an,ZP as Ne,ZQ as ce,wW as qn,wR as Kn,wP as ye,ZR as io,wH as oo,yj as Qn,yK as sn,yF as ao,ZS as so,yk as co,ZT as ro,yL as lo,yP as uo,ZU as go,ZV as Gn,c7 as mo,mo as vo,mp as po,ZW as cn,vR as re,gh as fo,uc as So,mv as ho,yC as zn,zb as Co,yz as Wn,ui as Io,z8 as rn,u6 as Eo,z5 as ln,hP as ko,TL as dn,TM as yo,Fy as Yn,hH as xo,ZX as bo,UA as jo,ZY as Do,zh as pe,zi as Po,ZZ as Ao,Z_ as Jn,ze as Lo,Z$ as $o,_0 as wo,xw as Fo,_1 as To}from"./zeni-epic-state-CxdZGPla.js";import{M as Ro}from"./MobileAppDrawer-CjyikhYJ.js";import{q as le}from"./QBOConnectionScreen-CiKgrKX6.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";import"./empty-qvcbLK7S.js";import"./pdf-lib-Cu5wZc2A.js";import"./index-te7nCILo.js";import"./url-CnKkchc3.js";import"./index-BtCYCCEX.js";import"./decodeURIComponentSafe-B4a7LpJx.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]="fc711bf9-656b-445c-9539-0fbe0f62f2dd",t._sentryDebugIdIdentifier="sentry-dbid-fc711bf9-656b-445c-9539-0fbe0f62f2dd")}catch{}})();const w=({event:t,isReady:e=!0})=>e?s.jsx(lt,{analytics:p,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function Oo(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:k}=E(Xt),x=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${n??""}/invoicing`,I=r.useCallback(((_,R)=>{const U=ei(b,_,R,j);U!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:_,entityId:R,fromScreen:"audit_log"}),e(U))}),[j,e,b]);r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&t(Qe({filters:x,keepExistingListItems:!1,sort:u}))}),[i,x,u,t]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,C=m==="In-Progress"&&f.length>0,L=m==="Completed";return N(m)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingAuditLogPage,isReady:L}),s.jsx(dt,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:k,entries:f,hasMore:S,isLoading:D,isLoadingMore:C,searchValue:o,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&h!=null&&t(Qe({cursor:h,filters:x,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Xn=[],Mo=In((t=>t.length>0?t:Xn),mt),No=In((t=>t.length>0?t:Xn),gt),Uo=O((function(t,e){const{view:n}=e;return{groupedAccountOptions:Mo(n.qboAccountHierarchy),groupedClassOptions:No(n.qboClassHierarchy),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(En({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&t(De({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),t(Cn({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&t(ni({action:a,id:o,parentItemId:i}))}}}))(ut);function Bo(){const t=P(),e=A(),{item_id:n,tenantEmailDomain:i}=F(),[o]=W(),{areTenantIdsInSync:a}=T(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>je(k,n))),{pageFetchState:v,plan:u}=l,m=v.fetchState;r.useEffect((()=>(t(Q()),()=>{t(Q())})),[t]),r.useEffect((()=>{a&&t(Ge({id:n,kind:c}))}),[a,n,c,t]);const[S,f]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(t(Q()),t(Ge({cacheOverride:!0,id:n,kind:c})),f((k=>k+1)))}),[l.fetchState,t,n,c]);const h=u==null&&(m==="Not-Started"||m==="In-Progress"),j=m==="Completed";return N(m)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogItemDetailPage,isReady:j}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:h,view:l},S)]})}function Ue(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=t,a=P(),{areTenantIdsInSync:c}=T(),d=E(Pe),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(kn()),n&&a(ti()))}),[c,a,e,n,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Be(t,e=!1){const n=P(),i=E((c=>G(c).productNextCursor!=null)),o=E((c=>G(c).productNextCursor)),a=E((c=>G(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&a!=="Not-Started"||n(se({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&a!=="In-Progress"&&i&&o!=null&&n(se({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=O((function(t,e){const n=je(t,e.itemId);return{fieldHelp:n.fieldHelp,isQboPickerDataLoading:n.isQboPickerDataLoading,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,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",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,a=o!=null?`${n}/catalog/${encodeURIComponent(o)}`:`${n}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),t(Q()),e.navigate(`${n}/catalog`)},onChange:c=>{t(De({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),t(Cn({id:o}))}}}))(vt);function qo(){const t=P(),e=A(),{item_id:n,tenantEmailDomain:i}=F(),[o]=W(),{areTenantIdsInSync:a}=T(),c=n!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>je(S,n)));return Be(a,!0),Ue({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&n!=null&&t(oi({id:n,kind:v}))}),[a,n,v,t]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||t(De({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(Q())}}),[m.fetchState,m.savedItemId,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",o=e.activeTab==="all",a=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"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.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",a=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(En({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&t(he({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(se({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));a!=null&&t(i?he({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):se({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function Go(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),k=E((_=>G(_))),x=k.planFilters.search,b=k.planSort,I=k.planNextCursor,D=k.productNextCursor,C=k.fetchState==="Completed",L=k.runningActionId??null;return r.useEffect((()=>{const _=setTimeout((()=>v(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:h,productFilters:j,planSort:S,productSort:S}))}),[i,t,h,j,S]),r.useEffect((()=>{i&&(f!==x||S?.field!==b?.field||S?.dir!==b?.dir)&&t(ze({cacheOverride:!0,planFilters:h,productFilters:j,planSort:S,productSort:S}))}),[x,b,i,t,h,j,f,S]),N(k.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogPage,isReady:C}),s.jsx(Qo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:o,sortState:u,planFilters:h,productFilters:j,sort:S,planNextCursor:I,productNextCursor:D,runningCatalogItemActionId:L,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const zo=O((function(t,e){const n=yn(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,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),t(z()),e.navigate(`${n}/discounts`)},onChange:c=>{t(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),t(ci({id:i}))}}}))(ft);function Wo(){const t=P(),e=A(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),{fetchState:a,savedCouponId:c}=E((d=>yn(d,n)));return r.useEffect((()=>{o&&n!=null&&t(si({id:n}))}),[o,n,t]),r.useEffect((()=>{if(a==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(z())}}),[a,c,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCouponFormPage}),s.jsx(zo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Yo=O((function(t){const e=xn(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:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:o=>{e(jn(o))},onSubmit:()=>{const o=ui(t.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(ht);function Jo(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),[i]=W(),{areTenantIdsInSync:o}=T(),a=i.get("customerId"),c=E((I=>xn(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(bn),m=E((I=>li(I))),S=E(de),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||h,k=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(We()),()=>{t(We())})),[t]);const x=r.useRef(!1);r.useEffect((()=>{x.current||a==null||a===""||l.customerId!==""||(x.current=!0,t(jn({...l,customerId:a})))}),[a,l,t]),r.useEffect((()=>{o&&t(di({cacheOverride:!1}))}),[o,t]);const b=r.useRef(d);return r.useEffect((()=>{const I=b.current;if(b.current=d,I!=="Completed"&&d==="Completed"){const D=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(D)}}),[d,v,e,n]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreateInvoicePage,isReady:k}),j?s.jsx(St,{}):s.jsx(Yo,{navigate:e,tenantEmailDomain:n})]})}const Xo=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=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(Ct);function ea(){const t=P(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((d=>mi(d,n??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&n!=null&&t(vi({id:n}))}),[o,n,t]),N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Xo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:a})]})}const na=O((function(t){const e=Dn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",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:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(It);function ta(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,creditNoteListFetchState:k}=E((b=>{const I=Dn(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),Z),x=k==="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&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ye({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreditsListPage,isReady:x}),s.jsx(na,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(pi(b)),onSortChange:v})]})}const et=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},ia=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:n.record.invoicingCustomer==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),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(Ce({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onOpenAddress:()=>{const o=et(e.tenantEmailDomain??"",Ie,i),a=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),t(Ce({id:i,localData:o})),t(An({id:i}))},onFetchPaymentLinkEmailPreview:o=>t(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>t(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)}}}))(yt);function oa(){const t=P(),e=A(),n=Y(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),c=E((L=>Ae(L,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),{plaidTokenFetchState:f,promotionalCreditSubmitState:h}=c,{paymentMethodSaveState:j,setupIntentFetchState:k,stripeConnected:x}=c.record,b=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const L=c.record.sendLinkState.fetchState;b.current!=="Error"&&L==="Error"&&t(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),b.current=L}),[t,c.record.sendLinkState.fetchState]);const I=k.fetchState==="Error"?k.error?.message??"Failed to start card setup.":j.fetchState==="Error"?j.error?.message??"Failed to save payment method.":f.fetchState==="Error"?f.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ee()),t(ne()),()=>{t(ee()),t(ne())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{a&&i!=null&&t(hi({id:i}))}),[a,i,t]),r.useEffect((()=>{a&&i!=null&&x&&t(Je({customerId:i}))}),[a,i,t,x]);const[D,C]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(t(Le()),i!=null&&t(Pn({id:i})),C((L=>L+1)))}),[c.fetchState,t,i]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,location:n,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{t(ee()),i!=null&&x&&t(Je({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ne()),S(!0)}},D),s.jsx(Et,{errorMessage:I,isCreatingSetupIntent:k.fetchState==="In-Progress",isSaving:j.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:j.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:x,onChooseCard:()=>{i!=null&&t(Ii({customerId:i}))},onClose:()=>{u(!1),t(ee())},onSavePaymentMethod:L=>{i!=null&&t(Ci({customerId:i,data:L}))}}),s.jsx(kt,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:h.fetchState==="Error"?h.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:h.fetchState==="In-Progress",open:m,submitSucceeded:h.fetchState==="Completed",onClose:()=>{S(!1),t(ne())},onSubmit:({amount:L,description:_})=>{i!=null&&t(Ei({amount:L,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:_}))}})]})}const aa=O((function(t,e){const n=Ae(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",localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),t(Le()),t($e(Ie)),e.navigate(`${n}/customers`)},onChange:c=>{t(Ce({id:i,localData:c}))},onOpenAddress:()=>{const c=et(e.tenantEmailDomain??"",Ie,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),t(An({id:i}))}}}))(xt);function sa(){const t=P(),e=A(),n=Y(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&t(Pn({id:i}))}),[a,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(Le())}}),[c,d,i,t,e,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:n,navigate:e,tenantEmailDomain:o})]})}const ca=O((function(t){const e=de(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:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.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(we({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function ra(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,customerListFetchState:k}=E((b=>{const I=de(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),Z),x=k==="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&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomersListPage,isReady:x}),s.jsx(ca,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(xi(b)),onSortChange:v})]})}const xe=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),la=O((function(t,e){const{filters:n,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:n,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:xe(o,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=xe(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&t(ke({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&t(Te(a))},onRollback:S?()=>{a!=null&&t(Ln(a))}:void 0}}))(jt);function da(){const t=P(),e=A(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),[a,c]=r.useState({}),d=E(Fe),l=xe(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{o&&n!=null&&t(Ee(n))}),[o,t,n]),r.useEffect((()=>{if(!o||n==null)return;const f=setTimeout((()=>{t(ke({...a,sessionId:n}))}),300);return()=>clearTimeout(f)}),[o,t,a,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||n==null||!u)return;const f=setInterval((()=>{t(Ee(n)),t(ke({...a,sessionId:n}))}),3e3);return()=>clearInterval(f)}),[o,t,a,u,n]);const m=r.useMemo((()=>{if(n==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const h=f.toString();return`${ae?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[a,n]),S=v?.fetch.fetchState??"Not-Started";return N(S)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const nt=t=>`invoicing_active_migration:${t}`,oe=(t,e)=>{if(t!=null&&t!=="")try{const n=nt(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ua=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:a}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,o=a=>{const c=a??null;t(ie(c)),oe(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),t(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),t(Ln(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),n(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Dt);function ga(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),o=E(Fe);r.useEffect((()=>{i&&(t(bi()),t($n()))}),[i,t]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:n,view:o})]})}const ma=O((function(t,e){const{activeId:n,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=ae?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),t(Pi())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{n!=null&&t(Te(n))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),n!=null&&t(Di(n))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),t(ji({files:a}))},onViewDetails:n==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(Pt);function va(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),o=E(bn),a=E(Re).companyId??Se.getSignedInUserTenant(n??"")?.companyId,c=E((f=>wn(f,a))),d=E(Fe),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(t(Oe()),t($n()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const f=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(nt(h))}catch{return null}})(n);f!=null&&t(ie(f))}),[l,t,n]),r.useEffect((()=>{oe(n,l)}),[l,n]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{t(Ee(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,t]),r.useEffect((()=>{m==="done"&&(t(ie(null)),oe(n,null))}),[t,m,n]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:n,view:d,onBack:()=>{t(ie(null)),oe(n,null),e(`/${n}/invoicing/data_import`)}})]})}const pa=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:n.coupon==null&&(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(Fn({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),t(Li({data:o,id:i}))}}}))(At);function fa(){const t=P(),e=A(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((m=>Ai(m,n))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed";r.useEffect((()=>(t(z()),()=>{t(z())})),[t]),r.useEffect((()=>{o&&t(en({id:n}))}),[o,n,t]);const[v,u]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(t(z()),t(en({cacheOverride:!0,id:n})),u((m=>m+1)))}),[a.fetchState,t,n]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{couponId:n??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},v)]})}const Sa=O((function(t){const e=Tn(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=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,o)=>{t(Fn({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Rn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Lt);function ha(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,couponListFetchState:k,runningDiscountActionId:x}=E((I=>{const D=Tn(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),Z),b=k==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(o)),300);return()=>clearTimeout(I)}),[o]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(nn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:x,onSearchChange:a,onStatusChange:I=>t($i(I)),onSortChange:v})]})}const Ca=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:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>t(H({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(H({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(H({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(H({action:"retry",id:i}))}:void 0}}))(wt);function Ia(){const t=P(),e=A(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((C=>wi(C,n??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[h,j]=r.useState(!1),k=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),x=r.useCallback((()=>{if(n==null)return;t(Fi({id:n})),v("idle"),m(!1);const C=a.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),j(!0)}),[n,t,a.emailPreview.preview]),b=r.useCallback((C=>{n!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(H({action:"send-email",body:C,id:n})))}),[n,t,l]),I=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&n!=null&&t(Ti({id:n}))}),[o,n,t]),r.useEffect((()=>{o&&d!=null&&t(_e({invoiceId:d}))}),[o,d,t]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[n]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{h&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(n!=null&&t(Ri({id:n})),k()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[n,k,t,l,u,a.actionState.fetchState]);const D=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:a,dunningAttempts:D,onSendEmail:x}),s.jsx($t,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:k,onSend:b,open:h,preview:I,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=O((function(t){const e=On(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=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||t(H({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ft);function ka(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,dunningCaseListFetchState:k}=E((b=>{const I=On(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),Z),x=k==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(tn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(tn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDunningListPage,isReady:x}),s.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(Oi(b)),onSortChange:v})]})}const ya=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:n.invoice==null&&(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=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
2
- `).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))}}}))(Tt);function xa(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((l=>_n(l,n??""))),c=a.pageFetchState.fetchState,d=c==="Completed";return r.useEffect((()=>{o&&n!=null&&t(Mi({invoiceId:n}))}),[o,n,t]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:n??"",navigate:e,tenantEmailDomain:i,view:a})]})}const ba=O((function(t){const e=Mn(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:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.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)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&t(Nn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Rt);function ja(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,invoiceListFetchState:k,voidingInvoiceId:x}=E((I=>{const D=Mn(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),Z),b=k==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(o)),300);return()=>clearTimeout(I)}),[o]),r.useEffect((()=>{i&&t(me({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(me({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:x,onSearchChange:a,onStatusChange:I=>{t(Ui(I)),t(me({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function un(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),i=Ot(),o=Sn(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Un),v=Bi(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(Ro,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_t,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{t(Vi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Da=O((function(t,e){const n=Bn(t,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,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:a,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(Qi({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ki())}}}))(Mt);function Pa(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Bn(f,n??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(Zi()),m.current=null}),[t,n]),r.useEffect((()=>{o&&n!=null&&t(_e({invoiceId:n}))}),[o,t,n]),r.useEffect((()=>{c!=null&&n!=null&&a==="Completed"&&m.current!==n&&(m.current=n,t(Hi({localData:qi(c)})))}),[t,a,c,n]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Aa=O((function(t){return{invoicingOverview:Vn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Zn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Nt);function La(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Vn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Zn(o))}),[i,t,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(Aa,{navigate:e,selectedPeriod:o,tenantEmailDomain:n})]})}const $a=O((function(t){const e=Hn(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:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ut);function wa(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:j,transactionListFetchState:k,transactions:x}=E((L=>{const _=Hn(L);return{activeType:_.activeTab,appliedSearch:_.filters.search,appliedSort:_.sort,nextCursor:_.nextCursor,transactionListFetchState:_.fetchState,transactions:_.transactions}}),Z),b=k==="Completed",I=`/${n}/invoicing`,D=r.useCallback((L=>{const _=x.find((U=>U.id===L)),R=_?.linkedInvoices?.[0]?.invoiceID??_?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(R)}`))}),[e,I,x]),C=r.useCallback((L=>{const _=x.find((R=>R.id===L))?.customerID;_!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:_,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(_)}`))}),[e,I,x]);return r.useEffect((()=>{const L=setTimeout((()=>d(o)),300);return()=>clearTimeout(L)}),[o]),r.useEffect((()=>{i&&t(ve({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:L=>{t(Gi(L)),t(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:C,onViewTransactionInvoice:D})]})}const Fa=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},gn=(t,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(t);function mn(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=n!=null&&n!=="",c=E(de),d=E((C=>Wi(C))),l=E(Yi),v=E((C=>_n(C,n??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ji()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{o&&t(a&&n!=null?_e({invoiceId:n}):we({filters:{},keepExistingListItems:!1}))}),[o,t,n,a]),r.useEffect((()=>{a&&u!=null&&n!=null&&v.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Xi({contextInvoiceId:n,localData:eo(u)})))}),[t,u,n,v.fetchState,a]),r.useEffect((()=>{if(a)return;const C=d.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Nn({filters:{customerId:C},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(on({localData:{...d.localData,customerId:C,invoiceToLink:""}})))}),[t,d.localData,a]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const C=h.current;if(h.current=l.fetchState,C!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((C=>({id:C.id,name:Fa(C)})))),[c.customers]),k=E((C=>no(C,d.localData.customerId))),x=r.useMemo((()=>k.map((C=>({amountDue:gn(C.amountDue,"USD"),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber})))),[k]),b=r.useMemo((()=>{if(!a||u==null)return;const C=u.currencyCode??"USD",L=u.amountDue?.amount??0;return{amountDue:gn(L,C),amountDueValue:L,currencyCode:C,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),I=a?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,D=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingRecordPaymentPage,isReady:D}),s.jsx(Bt,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:x,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(I)},onChange:C=>{t(on({localData:C}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(to(a?n??void 0:void 0))}})]})}const tt=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Ta=(t,e)=>{if(t==null)return;const n=new Intl.NumberFormat("en-US",{currency:t.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(t.amount);return e!=null?`${n}/${e}`:n},it=(t,e,n)=>{const i=[t,Ta(e,n)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},vn=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Ra=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:it(t.productCode,t.price,t.periodUnit),value:t.priceCode}),Oa=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),_a=O((function(t,e){const{editView:n}=e,i=n.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.products.filter((c=>c.itemType==="addon")).filter(vn).map((c=>({label:c.name??c.id,subtitle:it(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:n.coupons.map(Oa),isLoading:n.subscription==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans.filter(vn).map(Ra),shippingAddressLabel:n.shippingAddressLabel,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Kn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ce({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tt(e.tenantEmailDomain??"",ye,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ce({id:i,localData:c})),t(qn({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vt);function Ma(){const t=P(),e=A(),n=Y(),{subscription_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),c=E((h=>Me(h,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed";Be(a),r.useEffect((()=>{a&&i!=null&&t(an({id:i}))}),[a,i,t]);const[S,f]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(t(Ne()),t(an({cacheOverride:!0,id:i})),f((h=>h+1)))}),[c.fetchState,t,i]),N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},S)]})}const Na=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},Ua=(t,e)=>{if(t==null)return;const n=new Intl.NumberFormat("en-US",{currency:t.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(t.amount);return e!=null?`${n}/${e}`:n},be=(t,e,n)=>{const i=[t,Ua(e,n)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=t=>({label:Na(t),value:t.id}),fe=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Va=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:be(t.productCode,t.price,t.periodUnit),trialPeriod:t.trialPeriod,trialPeriodUnit:t.trialPeriodUnit,value:t.priceCode}),Za=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Ha=O((function(t,e){const n=Me(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.products.filter((i=>i.itemType==="addon")).filter(fe).map((i=>({label:i.name??i.id,subtitle:be(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:n.products.filter((i=>i.itemType==="charge")).filter(fe).map((i=>({label:i.name??i.id,subtitle:be(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:n.coupons.map(Za),customers:n.customers.map(Ba),errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode,plans:n.plans.filter(fe).map(Va),shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),t(Ne()),t($e(ye)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{t(ce({id:i,localData:a}))},onOpenAddress:()=>{const a=tt(e.tenantEmailDomain??"",ye,i),c=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),t(qn({id:i}))}}}))(Zt);function qa(){const t=P(),e=A(),n=Y(),{subscription_id:i,tenantEmailDomain:o}=F(),[a]=W(),{areTenantIdsInSync:c}=T(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Me(S,i).localData));Be(c),r.useEffect((()=>{c&&(t(we({filters:{},keepExistingListItems:!1})),t(he({filters:{type:"plan"},keepExistingListItems:!1})),t(Rn({filters:{},keepExistingListItems:!1})),i!=null&&t(oo({id:i})))}),[c,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,t(ce({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),t(Ne())}}),[l,v,i,t,e,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ka=O((function(t){const e=Qn(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,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),t(Kn({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ht);function Qa(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,subscriptionListFetchState:k,runningActionSubscriptionId:x}=E((D=>{const C=Qn(D);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,subscriptionListFetchState:C.fetchState,runningActionSubscriptionId:C.runningActionId??null}}),Z),b=k==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(o)),300);return()=>clearTimeout(D)}),[o]),r.useEffect((()=>{i&&t(sn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(sn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]);const I=r.useRef(x);return r.useEffect((()=>{const D=I.current!=null&&x==null;I.current=x,D&&i&&t(ao())}),[x,i,t]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:x,onSearchChange:a,onStatusChange:D=>t(so(D)),onSortChange:v})]})}const Ga=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=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),t(uo({action:"capture",id:i}))}:void 0}}))(qt);function za(){const t=P(),e=A(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:o}=T(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&t(lo({id:i}))}),[o,i,t]),N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:a})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(t){const e=P(),{areTenantIdsInSync:n}=T(),{tenantEmailDomain:i}=F(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:h}=E(Gn),j=E(Pe);Ue({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=E(Re),x=t==="dunning"||t==="quickbooks",b=k.companyId??Se.getSignedInUserTenant(i??"")?.companyId,I=E(($=>wn($,b))),D=mo(k.userRole??[]),C=k.tenantId??"",L=Se.getSignedInUser(),_={userId:L?.userId??"",sessionId:L?.zeniSessionId??"",tenantId:C},R=d?.logo_file_id,U=E(($=>R!=null&&R!==""?$.fileState.fileByFileId[R]:void 0)),Ve=E(($=>R!=null&&R!==""?vo($,R):void 0)),Ze=E(($=>R!=null&&R!==""?po($,R):void 0)),ot=R!=null&&R!==""&&Ve!=null?{[R]:Ve}:{},at=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(cn()),()=>{e(cn())})),[e]),r.useEffect((()=>{n&&(o!=="Not-Started"&&o!=="Error"||e(Oe()))}),[n,e,o]),r.useEffect((()=>{n&&x&&u==="Not-Started"&&e(re())}),[n,e,u,x]),r.useEffect((()=>{if(!n)return;const $=L?.userId;$!=null&&$!==""&&C!==""&&Ke.shouldFetchActiveTenant(C)&&(Ke.markActiveTenantFetchStarted(C),e(fo($,C,L?.zeniSessionId)))}),[n,e,L?.userId,L?.zeniSessionId,C]),r.useEffect((()=>{n&&R!=null&&R!==""&&C!==""&&U==null&&e(So(R,C))}),[n,e,U,R,C]);const st=m.length>0||S.length>0,ct=o==="Not-Started"||o==="In-Progress"&&d==null||x&&!st&&(u==="Not-Started"||u==="In-Progress"),rt=o==="Completed"&&(!x||u==="Completed"),He=I.externalConnections?.revenue?.find(($=>$.connectionName==="chargebee"))?.connectionId,ue=ae?.invoicingMicroServiceBaseUrl,qe=ue!=null&&ue.length>0?`${ue}/1.0/webhooks/stripe`:"",ge={deleteConnectionError:I.externalConnections?.deleteConnectionError?.message,deleteConnectionState:I.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:I,isAdmin:D,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:$=>e(ln($)),onDisconnect:($,q)=>{C!==""&&e(xo(C,$,dn(q)))},onDisconnectStripe:()=>e(rn()),onReconnectQBO:()=>{const $=k.tenantEmailDomain??i??"";le.init("/connection/auth",$),le.handleClick()},onRefreshQBO:()=>{I.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Yn())},onSaveChargeBeeCredentials:($,q)=>{He!=null&&C!==""&&e(ko(C,He,dn("revenue"),yo("chargebee"),{api_key:$,site:q}))},saveChargeBeeError:I.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:I.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:_,deleteFileStatusById:ot,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:ae?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ge,isInvoicingPageReady:rt,isLoading:ct,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:U,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:h,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":x&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:at,onConnectStripe:$=>e(ln($)),onDeleteFile:$=>e(Eo($)),onDisconnectStripe:()=>e(rn()),onEditFileName:($,q)=>e(Io($,q)),onReconnectQBO:ge.onReconnectQBO,onRefreshQBO:ge.onRefreshQBO,onRetryQboSyncTask:$=>e(Wn($)),onSave:$=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(Co({settings:$,snackbarSection:Wa[t??""]}))},onStartQboBackfill:$=>e(zn($)),updateFilesEntity:$=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:$}))}}}function pn({appContent:t}){const e=A(),n=Y(),i=P(),{tenantEmailDomain:o}=F(),a=X("branding"),c=E((v=>bo(v))),d=E((v=>jo(pe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i($e(pe)))}),[c.saveState.fetchState,i]);const l=hn(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Kt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Ao({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${pe}/`,u=J(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:a.updateFilesEntity})]})}function Ya(){const t=A(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Ja(){const t=A(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Xa(){const t=A(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zt,{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 es=O((function(t){const e=Jn(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(wo({localData:e}))},onReset:()=>{t($o())},onRetryTask:e=>{t(Wn(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(Lo())},onStartBackfill:e=>{t(zn(e))}}}))(Wt);function ns(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),i=E(Re),{configFetchState:o,settingsFetchState:a}=E(Jn);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||t(Oe())}),[t,a]),r.useEffect((()=>{o==="Not-Started"&&t(re())}),[o,t]),Ue({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{le.init("/connection/auth",i.tenantEmailDomain??n??""),le.handleClick()},onRefresh:()=>t(Yn())})]})}const ts={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const t=Sn(),e=P(),n=A(),[i,o]=W(),a=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Gn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ts[m];o({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[m,n,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Yt,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:t("invoicing_settings"),settings:a.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function fn(){return s.jsxs(te,{children:[s.jsx(y,{index:!0,element:s.jsx(is,{})}),s.jsx(y,{path:"payment-destination",element:s.jsx(Xa,{})}),s.jsx(y,{path:"branding",element:s.jsx(pn,{})}),s.jsx(y,{path:"branding/:addressType",element:s.jsx(pn,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(y,{path:"integrations",element:s.jsx(Ja,{})}),s.jsx(y,{path:"dunning",element:s.jsx(Ya,{})}),s.jsx(y,{path:"quickbooks",element:s.jsx(ns,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),{enableState:o,fetchState:a,status:c}=E(Un),d=hn(o.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=E((m=>Pe(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,t(re({cacheOverride:!1}))):t(re({cacheOverride:!1})))}),[i,t,a]),r.useEffect((()=>{i&&u==="Not-Started"&&t(kn())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),t(To()))}),[d,o.fetchState,l,t,e]),c==null&&a!=="Error"?s.jsx(Jt,{}):c==="not_started"?s.jsxs(te,{children:[s.jsx(y,{path:"promo",element:s.jsx(un,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(te,{children:[s.jsx(y,{path:"promo",element:s.jsx(un,{})}),s.jsx(y,{path:"settings/*",element:s.jsx(fn,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(te,{children:[s.jsx(y,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(y,{path:"overview",element:s.jsx(La,{})}),s.jsx(y,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(y,{path:"customers",element:s.jsx(ra,{})}),s.jsx(y,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(y,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(y,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(y,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(y,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(y,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(y,{path:"invoices/create",element:s.jsx(Jo,{})}),s.jsx(y,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(y,{path:"invoices/:invoice_id/record-payment",element:s.jsx(mn,{})}),s.jsx(y,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(y,{path:"payments",element:s.jsx(wa,{})}),s.jsx(y,{path:"payments/record",element:s.jsx(mn,{})}),s.jsx(y,{path:"payments/:transaction_id",element:s.jsx(za,{})}),s.jsx(y,{path:"credits",element:s.jsx(ta,{})}),s.jsx(y,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(y,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(y,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(y,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(y,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(y,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(y,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(y,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(y,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(y,{path:"settings/*",element:s.jsx(fn,{})}),s.jsx(y,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(y,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(y,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(y,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(y,{path:"*",element:s.jsx(M,{})})]})}export{$s as default};
@@ -1,12 +0,0 @@
1
- import{j as g}from"./liveblocks-BeSMR7a1.js";import{a as u}from"./sentry-Uj7AWjah.js";import{u as U,g as w,h as _,t as M,j as l,N as L}from"./core-BL7rYGUF.js";import{z as r,E as A,G as P,M as V,h as N,N as R,W as B,X as W,R as G}from"./index-E1NwyJIP.js";import{fB as X,Tb as $,TA as q,Tr as H,ge as J,gg as K,Tw as Q,gR as Y,df as Z,TB as ee,TC as te}from"./zeni-epic-state-CxdZGPla.js";import{n as ne}from"./mui-CPSuUssr.js";import{u as se}from"./useDeviceId-CR3YwHzW.js";import{f as ae}from"./analyticsHelper-D6TeBlJQ.js";import{t as ie}from"./getLocaleForTenant-akYNGA2f.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.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]="48d6980c-a3e5-4852-9401-f199f33ad109",t._sentryDebugIdIdentifier="sentry-dbid-48d6980c-a3e5-4852-9401-f199f33ad109")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=w(),m=_(),[y]=M(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:D}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>X(e))),k=l((e=>$(e))),E=r.getSignedInUser(),T=A().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),u.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(H(k.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,T,void 0,k.tenantsInOrder),Y().then((()=>{const e=G();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[h,S,b,s,o,k,T,a.state,t]);const j=u.useCallback((()=>{m("/signin/auth")}),[m]),F=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return g.jsx(B,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",v=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:v,magicLinkExpired:!v&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(W,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- right: 0;
6
- bottom: 0;
7
- display: flex;
8
- align-items: center;
9
- justify-content: center;
10
- z-index: 9999;
11
- background-color: ${t=>t.theme.colors.background};
12
- `;export{Ce as default};
@@ -1 +0,0 @@
1
- import{j as B}from"./liveblocks-BeSMR7a1.js";import{a as m}from"./sentry-Uj7AWjah.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-BL7rYGUF.js";import{fB as ne,Tc as xe,Td as se,g5 as Ne,fA as Pe,Tj as Re,Te as je,Tf as Ve,pX as Oe,gi as Le,Ti as b,Tl as Ue,Tm as J,gj as Ze,Tn as ze,Dr as He,g_ as Ye,cS as qe,To as Ke,g4 as We,gk as Xe}from"./zeni-epic-state-CxdZGPla.js";import{w as Je,i as Qe,U as ea,O as aa,c as ta,e as na,u as sa,y as c,f as oa,n as ia,z as ra,d as da,j as ca,K as la,o as ua,k as ma,l as Q,L as fa,B as ha,C as ba,p as S,h as ee,s as pa,Z as ae,x as ga,A as Sa}from"./index-E1NwyJIP.js";import{D as ka}from"./mui-CPSuUssr.js";import{u as Ta}from"./InboxNotificationsProvider-BH2D62uC.js";import{u as Ea}from"./useTaskManagerAccess-BVyRgvZH.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]="d92644fc-6b76-43c3-87e0-069ba80d21a5",l._sentryDebugIdIdentifier="sentry-dbid-d92644fc-6b76-43c3-87e0-069ba80d21a5")}catch{}})();const Ca=Je((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Me(),_=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:T}=Ea(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Re),G=$.uiState.currentChatSessionId,E=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,x=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),P=t((e=>je(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(e)));m.useEffect((()=>{E&&C&&!f&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[E,C,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Le(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Te=t((e=>b(e).totalUnreadCount)),Ee=t((e=>b(e).reducedFetchCountState)),j=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),O=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ta();m.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;M(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),m.useEffect((()=>{E&&T&&!f&&O.fetchState==="Not-Started"&&_.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[E,T,f,O.fetchState,_.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:Ee,count:Te},H=s!=null?ra.getSignedInUserTenant(s):null,Y=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const q=t((e=>ze(e,h).fetchState)),K=t((e=>He(e).fetchState)),ye=A&&(q==="Completed"||q==="Error")||x&&(K==="Completed"||K==="Error")||!A&&!x?void 0:"disabled",we=m.useMemo((()=>Ye(o.userRole)),[o.userRole]),Ae=qe(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&Ke(P.notificationSettings,p.userEmail,N,o,T),W=da(),Fe=W&&ca(a);return B.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:B.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:Y!=null?[Y]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:Q(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=j===0&&V>0?"notifications/comments":"notifications/tasks";Q(a)&&(e=j===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),X=e.type,Be=ae(X)&&X!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),Be&&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 _e=ga(e.type);Sa(e.type)?(G!=null&&r(Xe()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${_e}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:T,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),_a=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Qe(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return B.jsx(Ca,{...l,...a})};export{_a as M};
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BeSMR7a1.js";import{h as r,l as i}from"./core-BL7rYGUF.js";import{ak as n}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import"./sentry-Uj7AWjah.js";import"./zeni-epic-state-CxdZGPla.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="e1fe4b0b-a509-4443-892f-577d1dfd5036",o._sentryDebugIdIdentifier="sentry-dbid-e1fe4b0b-a509-4443-892f-577d1dfd5036")}catch{}})();const a=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
@@ -1 +0,0 @@
1
- import{m as mt,a as lt,n as ft,j as N}from"./liveblocks-BeSMR7a1.js";import ut from"./NotFoundScreen-C2tiSpQ7.js";import{a as k}from"./sentry-Uj7AWjah.js";import{h as ht,g as pt,i as kt,u as gt,j as S,l as St,n as bt,o as W}from"./core-BL7rYGUF.js";import{cz as It,Te as Y,fB as H,g_ as Tt,Ti as b,a09 as Q,Tm as m,Td as E,zJ as j,Fp as Ct,a0a as yt,Tc as Et,To as At,zO as _t,a0b as F,br as $,gd as x,zS as X,a0c as Nt,cL as Bt,cE as wt}from"./zeni-epic-state-CxdZGPla.js";import{ao as xt,c as vt,O as Rt,y as Dt,aq as Pt,dI as Gt,p as B,dJ as Ut,w as Mt,dK as Ft,i as $t,a2 as jt}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{u as zt}from"./useTaskManagerAccess-BVyRgvZH.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="e4587881-5996-4727-b331-94277a0a83e6",t._sentryDebugIdIdentifier="sentry-dbid-e4587881-5996-4727-b331-94277a0a83e6")}catch{}})();const Lt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((s=>{l(c),s()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=St((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,s=b(t),f=H(t),{currentTab:I}=s;return{notificationView:s,isNotificationSettingsVisible:h.userEmail!=null&&At(n.notificationSettings,h.userEmail,g,f,c),isDisabled:s.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:s,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:R}=l;return{onNotificationClick:(a,o,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${o}`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,o,d)=>{const r=o.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(F([a],$())));let i=`/${h}/${r[1]}`;const T=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,o)=>{t(E(a,o))},onUpdateNotificationTabState:(a,o)=>{t(m(a,o))},onUpdateNotificationViewCurrentTabAndSubTab:(a,o)=>{t(Q(a,o));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,o)=>{if(a==="tasks"){const d=[];o==="all"?d.push("read","unread"):o!=="mentions"&&d.push(o),t(j("task_manager","dashboard",d))}else R?.()},onUpdateNotificationStatus:(a,o,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(F([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Lt(s,I).then((()=>{t(F(s,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((o=>{t(m({markAsAllReadState:{fetchState:"Error",error:o}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=jt(n.state?.pathnameStackToGoBack),o=a.poppedPathname??"../../dashboard";f(o,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt(Ft)),Ot=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),s=gt(),f=vt(),[I,R]=k.useState(!1),a=S((e=>Y(e))),o=S((e=>H(e))),{useFeatureGate:d}=Rt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Pt({isDataReady:!0});const Z=Tt(o.userRole);if(o==null||n==null||o.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),z=S((e=>b(e).currentTab)),D=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),P=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),ot=Gt().allUsers,{inboxNotifications:w,isLoading:A,hasFetchedAll:C,isFetchingMore:G,fetchMore:st}=mt(),{threads:L,isLoading:q,fetchMore:O,isFetchingMore:J,hasFetchedAll:K}=lt({query:{metadata:{companyId:o.companyId,application:"dashboard"}}});k.useEffect((()=>{if(z!==c&&c!=null&&s(Q(c)),c==null){const e=`../${z}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&s(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(A===!1&&C===!0&&o?.companyId!=null&&w!=null){const e=`dashboard_${o.companyId}`,p=w.filter((y=>y.roomId===e&&y.readAt==null)).length;s(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),s(E({unreadCount:p},"comments"))}}),[A,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&s(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>st?.()),0);return()=>clearTimeout(e)}));const U=A||G===!0||C!==!0||A||G===!0||C!==!0;k.useEffect((()=>{U&&P!=="In-Progress"?s(m({fetchState:"In-Progress",error:void 0},"comments")):U||P!=="In-Progress"||s(m({fetchState:"Completed",error:void 0},"comments"))}),[U,P]),k.useEffect((()=>{s(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(R(!0),s(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(A===!1&&q===!1&&w!=null&&L!=null){const e=`dashboard_${o.companyId}`,p=w.filter((u=>u.roomId===e)).filter((u=>Ut(u.kind))),y=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=L.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(J||K===!0||O==null||O(),null)})).filter((u=>u!=null));s(m({allNotificationsIds:_},"comments")),s(E({totalCount:_.length,unreadCount:y.length},"comments")),s(yt(ct))}}),[A,G,J,C,K,q,w?.length]);const nt={events:o.userRoleId!=null?[`private-encrypted-${o.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if($t(p)){const y=Et(p.mode);if(y==="dashboard"&&s(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),s(j("task_manager",y,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=zt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:ot,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(W,{path:"/:selectedTab",element:N.jsx(Ot,{})}),N.jsx(W,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{j as f}from"./liveblocks-BeSMR7a1.js";import{a as r}from"./sentry-Uj7AWjah.js";import{u as A,g as P,j as o,N as j}from"./core-BL7rYGUF.js";import{TO as x,fB as C,gi as R,TP as z,TQ as D,TR as M,TS as L,pO as k,Sx as N}from"./zeni-epic-state-CxdZGPla.js";import{z as h,af as I}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="16dd0a8e-1340-4daa-9641-635e37c9391a",n._sentryDebugIdIdentifier="sentry-dbid-16dd0a8e-1340-4daa-9641-635e37c9391a")}catch{}})();function ee(){const n=A(),a=P(),{params:t,error:i}=r.useMemo((()=>x(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),p=h.isSignedIn(),s=h.getSignedInUser(),m=o((e=>C(e))),l=o((e=>R(e))),d=o((e=>e.tenantState.fetchState)),y=o(z),S=o(D),u=o(M),[v,T]=r.useState(null),[E,b]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((U=>U.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=v??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:T,approveError:E??S,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(N(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{b("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(j,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
@@ -1 +0,0 @@
1
- import{j as n}from"./liveblocks-BeSMR7a1.js";import{h as J,u as K,g as Q,i as X,j as d,l as Z,n as ee,o as C}from"./core-BL7rYGUF.js";import{fB as M,zu as R,us as ae,UF as w,un as y,bq as te,b_ as se,uo as oe,UG as re,Un as S,e8 as ne,Dg as ce,UH as ie,DE as le,dV as de,dU as me}from"./zeni-epic-state-CxdZGPla.js";import{ag as fe,z as pe,ao as ue,aq as he,V as ge,O as q,y as B,a6 as Fe,h as _,aB as be,p as Ie}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import Ce from"./NotFoundScreen-C2tiSpQ7.js";import{F as Se}from"./FeaturePreviewScreen-07vQ7ieK.js";import{a as g}from"./sentry-Uj7AWjah.js";import{u as ye}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{u as Te}from"./useInitialThreadRequest-DifgMaO6.js";import{t as De}from"./routePaths-Cf2E-_nR.js";import{M as Ae}from"./MobileAppDrawer-CjyikhYJ.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="bcab5081-9e6f-40ee-ad70-3f86b739c710",s._sentryDebugIdIdentifier="sentry-dbid-bcab5081-9e6f-40ee-ad70-3f86b739c710")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=Z((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:_}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(y(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=De(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function v(){const s=fe(),e=J(),a=K(),o=Q(),{forecastId:r,tenantEmailDomain:c}=X(),[p,u]=g.useState(!1),[m,D]=g.useState(!1),F=pe.getSignedInUser(),A=d((t=>M(t))),G=A.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),x=d((t=>t.profitAndLossState)),j=d((t=>t.reportUIOptionsState.selectedForecast)),E=t=>x.pandLByForecastID[t]!=null&&oe(t,x).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=ye({mobileExploreReferrer:"Forecast"});g.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){D(!0);const t=((f,P,O)=>P!=null?f.forecasts.findIndex((I=>I.id===P)):O!=null?f.forecasts.findIndex((I=>I.id===O)):f.forecasts.length>0?0:-1)(i,r,j?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=j?.index?(a(w(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!E(i.forecasts[t].id)&&b&&a(y(i.forecasts[t].id))}}),[p,u,a,l,i,m,D,R,y,b]);const U=ge(),$=U?.loggedInUserRole!=null&&te(U.loggedInUserRole),{useFeatureGate:W}=q(),{isFeatureEnabled:k}=W(B.isReportsCommentingEnabled),Y=Te(k?A?.companyId:void 0,{clearParams:l&&m}),[z,H]=g.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",F?.firstName??""),h.searchParams.set("lastname",F?.lastName??""),h.searchParams.set("email",F?.userEmail??"");const L=t=>{H(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(Fe,{analytics:_,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Ae,{isAppContentDrawerOpen:z,handleDrawerToggle:L}),n.jsx(xe,{firstMonthOfFY:G,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:E,meetingUrl:se(h.toString()),hasTransactionAccess:$,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,isReportsCommentingEnabled:k,initialOpenThreadRequest:Y,onClickMenuIcon:()=>{L(!0)}})]})}function Ke(){const s=d((c=>M(c))),{useFeatureGate:e}=q(),{isFeatureEnabled:a}=e(B.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{Ke as default};
@@ -1,22 +0,0 @@
1
- import{j as a}from"./liveblocks-BeSMR7a1.js";import{UB as re,fB as X,lX as G,dV as Y,dU as le,Rx as J,T_ as de,Cd as Pe,UC as N,C2 as je,Cn as Le,Ch as ce,C6 as pe,Cl as Te,Ci as ve,UD as ue,rI as Ae,g2 as Re,gA as Ve,UE as _,Ca as me,C9 as ge,Cq as Fe,c7 as Oe}from"./zeni-epic-state-CxdZGPla.js";import{$ as fe,O as Q,y as H,z as K,f as Ce,I as he,ad as ye,ax as be,ay as Ue,a9 as Se,F,ae as we,G as q,az as Be,ao as Ze,aq as $e,a6 as ze,h as xe,N as _e,p as He,aA as Ge,V as Ke}from"./index-E1NwyJIP.js";import{D as De,n as M,S as Ie}from"./mui-CPSuUssr.js";import ae from"./NotFoundScreen-C2tiSpQ7.js";import{a as d}from"./sentry-Uj7AWjah.js";import{u as ee,i as qe,j as g,h as Me,g as We,l as Ne,n as se,o as z}from"./core-BL7rYGUF.js";import{u as Xe}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{M as Ye}from"./MobileAppDrawer-CjyikhYJ.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a19994de-6c45-4bf8-b715-b45f0ba944fd",e._sentryDebugIdIdentifier="sentry-dbid-a19994de-6c45-4bf8-b715-b45f0ba944fd")}catch{}})();const Je={overlayWidth:new Se(100,100,48)},te=q.getLocalizedStrings().peoplePage.invitePage,ne=q.getLocalizedStrings().common,Qe=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),{userId:w}=qe(),r=g((l=>re(l))),p=g((l=>X(l))),E=g((l=>G(l))),{useFeatureGate:D}=Q(),{isFeatureEnabled:I}=D(H.isDebitCardFeatureEnabled),P=Y(I,p),T=le(p),v=J(p),B=de(p),Z=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,x=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(N()),b()},A=()=>{O===!0?S(!0):h()},$=c.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=D(H.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:R}=he(p?.tenantId),y=!L||R,V=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,isAccountingClassesEnabled:E,isReimbursementDisabled:Z===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isLiteRoleDisabled:B===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:T,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(ce({peopleLocalData:l})),U(!0)},onSaveClick:()=>{m(f==="zeni_only"?je(e):Le(v))},onCloseClick:A,isLoading:x||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return d.useEffect((()=>{x===!1&&w!=null&&m(Pe(w))}),[x,w]),d.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:Je.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:A,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Ee,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Ue,{...s})]})})},ea=M(Ie)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,ke=M(we.H6Regular)`
6
- margin-top: ${F.sp7};
7
- padding-left: ${F.sp8};
8
- padding-right: ${F.sp8};
9
- color: ${e=>e.theme.colors.primary};
10
- word-break: break-word;
11
- `,Ee=M(we.LargeRegularSp)`
12
- color: ${e=>e.theme.colors.hero};
13
- padding-left: ${F.sp8};
14
- padding-right: ${F.sp8};
15
- margin-bottom: 30px;
16
- margin-top: ${F.sp4};
17
- white-space: pre-line;
18
- `,aa={overlayWidth:new Se(100,100,48)},oe=q.getLocalizedStrings().peoplePage.invitePage,ie=q.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),w=g((o=>re(o))),r=g((o=>X(o))),p=g((o=>G(o))),{useFeatureGate:E}=Q(),{isFeatureEnabled:D}=E(H.isDebitCardFeatureEnabled),I=Y(D,r),P=le(r),T=J(r),v=de(r),B=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,Z=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const x=()=>{b(),m(N())},h=()=>{O===!0?S(!0):x()},A={onOkClick:()=>{S(!1),x()},onCancelClick:()=>{S(!1)}},$=c.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(H.isChargeCardFeatureEnabled),L=Ce(r,j,D),{isCardsHidden:R}=he(r?.tenantId),y=!L||R,V=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,onPeopleLocalDataUpdated:o=>{m(ce({peopleLocalData:o})),U(!0)},onResetClick:x,onSaveClick:()=>{m(f==="zeni_only"?Te(e):ve())},onCloseClick:h,peopleDetails:w,isAccountingClassesEnabled:p,isReimbursementDisabled:B===!1,isLiteRoleDisabled:v===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:Z};return d.useEffect((()=>{w.invitePersonState.fetchState==="Completed"&&(b(),m(N()))}),[w.invitePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:oe.discardTitle}),descriptionComponent:a.jsx(Ee,{children:oe.discardDescription}),primaryButtonText:ie.yes,secondaryButtonText:ie.no,action:A}):null,a.jsx(Be,{...s})]})})},ta=M(Ie)`
19
- display: flex;
20
- min-height: 100%;
21
- flex-direction: column;
22
- `,na=Ne((function(e,t){const c=ue(e),n=K.getSignedInUser();return{data:c,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(e),analytics:xe}}),(function(e,t){const{navigate:c,companyId:n,shouldFetchClasses:f}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Fe(i))},onReloadPeople:()=>{e(me()),e(ge(n,f))},onBackClick:()=>{c("../../")},onModeChange:i=>{e(_({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(_({searchText:i}))}}}}))(Ge);function W({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=Me(),n=ee(),f=We(),{areTenantIdsInSync:i}=Ze(),b=K.getSignedInUser(),C=g((s=>X(s))),{useFeatureGate:m}=Q(),{isFeatureEnabled:O}=m(H.isDebitCardFeatureEnabled),U=g((s=>G(s))),k=!Y(O,C)&&U,S=J(C),w=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=d.useState(!1),[D,I]=d.useState(!1),[P,T]=d.useState(!1),[v,B]=d.useState("off"),[Z,x]=d.useState(!1),h=s=>{x(s)},{isAiCfoAccessEnabled:A,onAskAiCfoClick:$}=Xe({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ae(s.classState,s.classListState))),L=g((s=>Re(s.userState,s.userRoleState,s.userListViewState,"manager"))),R=g((s=>Ve(s))),y=C?.companyId;d.useEffect((()=>{p&&v===u.uiState.mode||!i||(n(_({searchText:"",sortKey:"name",sortOrder:"ascending"})),B(u.uiState.mode),E(!0),n(me()))}),[p,b,w,n,u.uiState.mode,i]),d.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),d.useEffect((()=>{I(e!=null&&e===!0),T(t!=null&&t===!0&&t)}),[e,t]),d.useEffect((()=>{n(_({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const V=()=>{I(!1),T(!1),c("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:xe,onLoad:s=>s.trackPageLoaded(_e.Event.members)}):null,D===!0?a.jsx(sa,{closeDrawerHandler:V,isInvitePeopleDrawerOpen:D,managersListView:L,companyPassportView:R,classListView:j,companyId:y,mode:u.uiState.mode}):null,P===!0?a.jsx(Qe,{closeDrawerHandler:V,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:R,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ye,{isAppContentDrawerOpen:Z,handleDrawerToggle:h}),a.jsx(na,{navigate:c,signedInUser:b,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{c("./new")},onColumnSortConfigChanged:(s,o)=>{n(_({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=He(f.state?.pathnameStackToGoBack,f.pathname);c(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:A,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(W,{})}),a.jsx(z,{path:"new",element:a.jsx(W,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(W,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-BeSMR7a1.js";import E from"./NotFoundScreen-C2tiSpQ7.js";import{a as r}from"./sentry-Uj7AWjah.js";import{h as _,g as U,j as p,i as v,u as M,N as P,l as z,n as B,o as b}from"./core-BL7rYGUF.js";import{fB as O,a0d as h,bo as F,bn as N,iI as V,gd as q}from"./zeni-epic-state-CxdZGPla.js";import{U as L,z as I,aq as $,dL as G}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-CC7G-KyB.js";import{M as J}from"./MobileAppDrawer-CjyikhYJ.js";import"./recharts-BP8J0UHA.js";import"./analytics-DZ6cwnOO.js";import"./plaid-DMXel13h.js";import"./dnd-BsiKGZTJ.js";import"./stripe-cKAAJElX.js";import"./lottie-joMwFamf.js";import"./lexical-BSRawlvX.js";import"./pdf-CcTg_U5O.js";import"./utils-Dn95OB7n.js";import"./InboxNotificationsProvider-BH2D62uC.js";import"./useTaskManagerAccess-BVyRgvZH.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b4099699-8193-4a3b-9b20-ff94008f9899",e._sentryDebugIdIdentifier="sentry-dbid-b4099699-8193-4a3b-9b20-ff94008f9899")}catch{}})();const K=z((function(e){const t=I.getSignedInUser(),d=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:d??""},{aggregatedReportViewState:n}=h(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=U(),d=L(),o=p((a=>O(a))),{aggregatedReportViewState:n}=p((a=>h(a))),{tenantEmailDomain:m}=v(),u=M(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const f=r.useRef(!1),[w,S]=r.useState(!1),C=F(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(l),y=C||k||x,c=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&f.current&&(u(q({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),f.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||c(a,i,!0),f.current=!0}),[n?.fetchState,c]),j=r.useCallback(((a,i)=>{c(a,i,!1)}),[c]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return $({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:d,currentTenant:o,signedInUser:l,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(P,{to:`/${m}/dashboard`,replace:!0})};function be(){return s.jsxs(B,{children:[s.jsx(b,{path:"*",element:s.jsx(Q,{})}),s.jsx(b,{path:"*",element:s.jsx(E,{})})]})}export{be as default};
@@ -1 +0,0 @@
1
- import{j as r}from"./liveblocks-BeSMR7a1.js";import W from"./NotFoundScreen-C2tiSpQ7.js";import{a as p}from"./sentry-Uj7AWjah.js";import{h as C,g as D,u as V,j as u,N as k,l as U,n as Y,o as g}from"./core-BL7rYGUF.js";import{fB as E,Yh as h,Yy as R,MY as N,MU as B,MX as f,MN as L,YX as M,MR as X,M_ as z}from"./zeni-epic-state-CxdZGPla.js";import{z as T,w as $,c7 as K,l as _,bQ as Q,c8 as q}from"./index-E1NwyJIP.js";import"./mui-CPSuUssr.js";import{u as F,R as x}from"./ReimbursementApprovalRuleDetailScreen-D7_1V-ZV.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b9167535-79e7-453b-8234-6e937df608da",e._sentryDebugIdIdentifier="sentry-dbid-b9167535-79e7-453b-8234-6e937df608da")}catch{}})();const A="reimbursement-approval-rule-update",G=U((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:R(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e(M(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))($(K)),H=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),b=u((o=>R(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{b?.updateStatus.fetchState==="Completed"&&a(N())}),[b]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!1)))}),[t,S,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(w(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${A}`]:[],eventCallback:(o,y,j)=>{o.endsWith(A)&&j.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(G,{currentTenant:c,location:n,navigate:s,...m})},I="reimbursement-approval-rule-update",J=U((function(e){const s=h(e),n=R(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(I)&&e(M(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(z(t,!0))}}}))($(q)),P=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=Q(e?.tenantId);return s?r.jsx(Z,{isLoading:n}):r.jsx(H,{isLoading:n})},Z=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),b=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));F();const y=u((i=>R(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(N())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||b!=="Not-Started"||e||(w(!0),a(X(!1,!0)))}),[v,b,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const j={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${I}`]:[],eventCallback:(i,ee,O)=>{i.endsWith(I)&&O.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(J,{currentTenant:m,location:n,navigate:s,isLoading:e,...j})};function le(){return r.jsxs(Y,{children:[r.jsx(g,{path:"/",element:r.jsx(P,{})}),r.jsx(g,{path:"/new",element:r.jsx(x,{})}),r.jsx(g,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(g,{path:"*",element:r.jsx(W,{})})]})}export{le as R};