@zeniai/web-app-ui 5.3.28-qa → 5.3.29-next

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 (159) hide show
  1. package/dist/assets/AccountMappingScreen-DLqsZAiC.js +9 -0
  2. package/dist/assets/AddressRoutes-D_wB5jsM.js +1 -0
  3. package/dist/assets/{AddressScreen-pJKlDi3q.js → AddressScreen-JumAvrZ3.js} +2 -2
  4. package/dist/assets/AiCfoScreen-CC9jm17A.js +22 -0
  5. package/dist/assets/AppDrawer-D7aI_YKO.js +10 -0
  6. package/dist/assets/{BillPayApprovalRoutes-BLyF1vsz.js → BillPayApprovalRoutes-yBVcG2oD.js} +1 -1
  7. package/dist/assets/{BillPayRoutes-C-gdP6KL.js → BillPayRoutes-rWwWriZX.js} +18 -18
  8. package/dist/assets/BusinessVerificationPageScreen-Beiv2wWt.js +9 -0
  9. package/dist/assets/{CardsAiCfoScreen-BBJBV1b_.js → CardsAiCfoScreen-DxtgAXt5.js} +1 -1
  10. package/dist/assets/{ChargeCardRoutes-CYP3hEhW.js → ChargeCardRoutes-CrAMoNqm.js} +7 -7
  11. package/dist/assets/CompanyPassportScreen-Dh6ISdGa.js +1 -0
  12. package/dist/assets/{ConnectionAuthScreen-C8yz1QVT.js → ConnectionAuthScreen-CxF4cvt_.js} +2 -2
  13. package/dist/assets/CustomerOnboardingAuthScreen-Dyga76yH.js +1 -0
  14. package/dist/assets/CustomerOnboardingRoutes-BNr6zX1e.js +30 -0
  15. package/dist/assets/{DashboardRoutes-CiwFfaic.js → DashboardRoutes-Ct18dV3E.js} +4 -4
  16. package/dist/assets/{DefaultTenantHome-B0-M7I8X.js → DefaultTenantHome-B9KqwUsn.js} +1 -1
  17. package/dist/assets/DomesticWireDetailScreen-CYu196qX.js +18 -0
  18. package/dist/assets/DrawerScreen-Dp0jZCG0.js +1 -0
  19. package/dist/assets/EntityDetailRoutes-DIC7oWh0.js +1 -0
  20. package/dist/assets/ExpenseAutomationRoutes-CxRO__bU.js +25 -0
  21. package/dist/assets/FeaturePreviewScreen-2119k0r-.js +1 -0
  22. package/dist/assets/HubSpotOAuthCallbackScreen--fF6ku_7.js +1 -0
  23. package/dist/assets/{InboxNotificationsProvider-B9BL9-5c.js → InboxNotificationsProvider-CP3zxjLQ.js} +1 -1
  24. package/dist/assets/InvoicingRoutes-BZcNn-tl.js +2 -0
  25. package/dist/assets/{MagicLinkRoutes-DDMQyFLn.js → MagicLinkRoutes-BpaEqGXh.js} +6 -6
  26. package/dist/assets/MagicLinkSignInScreen-B-_ZbplW.js +12 -0
  27. package/dist/assets/{MobileAppDrawer-DCgsEnVh.js → MobileAppDrawer-gXWJpapq.js} +1 -1
  28. package/dist/assets/NotFoundScreen-CGJyt_LJ.js +1 -0
  29. package/dist/assets/NotificationRoutes-CBkN1Ya_.js +1 -0
  30. package/dist/assets/OAuthConsentScreen-CtTUNPZo.js +1 -0
  31. package/dist/assets/PandLWithForecastRoutes-BeN00ZXg.js +1 -0
  32. package/dist/assets/{PaymentLinkScreen-eNhR9FUM.js → PaymentLinkScreen-CfVHnFpP.js} +3 -3
  33. package/dist/assets/PeopleRoutes-B8szeAgH.js +22 -0
  34. package/dist/assets/PerformanceRoutes-CE-jrSuh.js +1 -0
  35. package/dist/assets/{Preview-slW2Ixf-.js → Preview-D6qXIKMp.js} +1 -1
  36. package/dist/assets/QBOConnectionScreen-Bo0_X0MI.js +100 -0
  37. package/dist/assets/ReimbursementApprovalRoutes-BoD0vQUM.js +1 -0
  38. package/dist/assets/ReimbursementApprovalRuleDetailScreen-Dv9XBlq2.js +1 -0
  39. package/dist/assets/ReimbursementRoutes-DEhXwY_S.js +68 -0
  40. package/dist/assets/ReportsRoutes-eETmTdJv.js +1 -0
  41. package/dist/assets/RewardsRoutes-BzPF7ESQ.js +1 -0
  42. package/dist/assets/ScreenRoutes-Bx6TZEsJ.js +2 -0
  43. package/dist/assets/{SettingsRoutes-Cl1VWOb0.js → SettingsRoutes-HYTJzq8P.js} +7 -7
  44. package/dist/assets/{SetupPagesScreen-DAbhBEAF.js → SetupPagesScreen-DLQcLLtM.js} +5 -5
  45. package/dist/assets/SignInScreen-B0jkyn82.js +1 -0
  46. package/dist/assets/SignOutScreen-BtTjPRmW.js +9 -0
  47. package/dist/assets/TaskListScreen-Bi0mVkIS.js +9 -0
  48. package/dist/assets/TaskRoutes-CjSDqIWx.js +9 -0
  49. package/dist/assets/TransactionDetailRoutes-S39SXRtu.js +1 -0
  50. package/dist/assets/TransactionDetailScreen-Bptg87Ad.js +5 -0
  51. package/dist/assets/{TransactionListRoutes-DwAAMpvf.js → TransactionListRoutes-smEeg3HS.js} +1 -1
  52. package/dist/assets/TreasuryRoutes-CHPkeS5P.js +37 -0
  53. package/dist/assets/VendorsRoutes-Bhty5IJn.js +112 -0
  54. package/dist/assets/{WiseConfirmationScreen-BWYKTltN.js → WiseConfirmationScreen-B5ZRnOvD.js} +2 -2
  55. package/dist/assets/{ZeniAccountRoutes-361LPKCn.js → ZeniAccountRoutes-B9xhn1Bk.js} +9 -9
  56. package/dist/assets/ZeniAccountStatementScreen-LrjmuO5T.js +9 -0
  57. package/dist/assets/{accountMappingHelper-BgNXnMXC.js → accountMappingHelper-hg3790bD.js} +1 -1
  58. package/dist/assets/{analytics-Cuu7a7XR.js → analytics-nbGnR8yw.js} +1 -1
  59. package/dist/assets/{analyticsHelper-CGHyb6cb.js → analyticsHelper-CTQJAyGI.js} +1 -1
  60. package/dist/assets/{core-D5xlmXJj.js → core-BGTqSI0U.js} +1 -1
  61. package/dist/assets/{decodeURIComponentSafe-N0xRs_hS.js → decodeURIComponentSafe-Ddo_DmUd.js} +1 -1
  62. package/dist/assets/{dnd-DN-HQej8.js → dnd-SEGszg0m.js} +1 -1
  63. package/dist/assets/{empty-O3WXjhlr.js → empty-CAvd4Dif.js} +1 -1
  64. package/dist/assets/{empty-C81l0a_D.js → empty-u_z2Liw4.js} +1 -1
  65. package/dist/assets/{emptyVideoElement-DNB4w3eI.js → emptyVideoElement-Du1VNFWi.js} +1 -1
  66. package/dist/assets/epic-Cg0rGj9v.js +2 -0
  67. package/dist/assets/{expenseAutomationHelper-BchoKsfU.js → expenseAutomationHelper-D7bKnox3.js} +1 -1
  68. package/dist/assets/getLocaleForTenant-C9hGHLTR.js +1 -0
  69. package/dist/assets/{index-waurk8Yr.js → index-Bkd2suv7.js} +27690 -28604
  70. package/dist/assets/{index-BZhSlJBy.js → index-C7BClp-h.js} +1 -1
  71. package/dist/assets/{index-CojIsciJ.js → index-C_JFSB_S.js} +1 -1
  72. package/dist/assets/{index-CcXiIb6r.js → index-Clep-E8B.js} +1 -1
  73. package/dist/assets/{index-B4N0qOBD.js → index-DG8fRlZf.js} +2 -2
  74. package/dist/assets/{index-L6DNygfO.js → index-Dk7GKkvt.js} +1 -1
  75. package/dist/assets/{index-ChKsFe22.js → index-DpEDhaMK.js} +1 -1
  76. package/dist/assets/{index-B2tEu4AE.js → index-DqOzvxxV.js} +1 -1
  77. package/dist/assets/{lexical-DDQ51-Oa.js → lexical-DtJP5Abm.js} +1 -1
  78. package/dist/assets/{liveblocks-DOBkg1D1.js → liveblocks-BohEqL-M.js} +1 -1
  79. package/dist/assets/{lottie-o0tP_TXQ.js → lottie-3kdnx6OO.js} +1 -1
  80. package/dist/assets/{mui-DpenkF9f.js → mui-Bm9pLHsq.js} +1 -1
  81. package/dist/assets/{pathToGoBack-Cjq5n9wd.js → pathToGoBack-CDhhO2GE.js} +1 -1
  82. package/dist/assets/{pdf-DIMTd5ya.js → pdf-CSx-lDs_.js} +3 -3
  83. package/dist/assets/{pdf-lib-DU5YZRdD.js → pdf-lib-DDkyZRb6.js} +1 -1
  84. package/dist/assets/{plaid-D5L6VoNT.js → plaid-DdB4B-ZM.js} +1 -1
  85. package/dist/assets/{pusher-oX4CN6zb.js → pusher-B3Hk1ZP3.js} +1 -1
  86. package/dist/assets/{react-966-QmHM.js → react-6J5OT8WE.js} +1 -1
  87. package/dist/assets/{react-a6JNjSit.js → react-BTJ6vybO.js} +1 -1
  88. package/dist/assets/{react-nXpxox7I.js → react-DM5Ga2d6.js} +1 -1
  89. package/dist/assets/{react-Cj8ClW-m.js → react-HajlVskC.js} +1 -1
  90. package/dist/assets/{react-Dq7Fy1Mm.js → react-evJyB8hR.js} +1 -1
  91. package/dist/assets/{react-C-oQLK1P.js → react-t6NipQhp.js} +1 -1
  92. package/dist/assets/{recharts-CcOTx_Jj.js → recharts-DZSO8gqO.js} +1 -1
  93. package/dist/assets/routePaths-DkfFbFdK.js +1 -0
  94. package/dist/assets/{sentry-B0nIwgR6.js → sentry-DZasNYxC.js} +1 -1
  95. package/dist/assets/url-CIyGuAwg.js +6 -0
  96. package/dist/assets/{url-VkrE7aAr.js → url-ir6tVPow.js} +1 -1
  97. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BKnqg0kj.js +1 -0
  98. package/dist/assets/useAskAiCfoHostNavButtonProps-DNmjed6f.js +1 -0
  99. package/dist/assets/useChargeCardPusherEvents-C5ybq--A.js +1 -0
  100. package/dist/assets/{useDeviceId-ChTv1tr4.js → useDeviceId-C5wTdvqD.js} +1 -1
  101. package/dist/assets/useEmailConnectResultRefresh-BSYV58Ci.js +1 -0
  102. package/dist/assets/useInitialThreadRequest-C-FNgRyS.js +1 -0
  103. package/dist/assets/useTaskManagerAccess-DoD7gL98.js +1 -0
  104. package/dist/assets/utils-CgRt4NQh.js +36 -0
  105. package/dist/assets/withTransactionSidePanel-pLmAxMeA.js +25 -0
  106. package/dist/assets/{zeni-epic-state-DVQQo6UD.js → zeni-epic-state-BD9w4cbh.js} +5 -5
  107. package/dist/index.html +1 -1
  108. package/package.json +4 -4
  109. package/dist/assets/AccountMappingScreen-B8Z5Jukp.js +0 -9
  110. package/dist/assets/AddressRoutes-AB7f2rQK.js +0 -1
  111. package/dist/assets/AiCfoScreen-bXnwas9y.js +0 -22
  112. package/dist/assets/AppDrawer-Bc0CsVN9.js +0 -10
  113. package/dist/assets/BusinessVerificationPageScreen-Boe3kgD5.js +0 -9
  114. package/dist/assets/CompanyPassportScreen-wR6Twi6v.js +0 -1
  115. package/dist/assets/CustomerOnboardingAuthScreen-Cp-54_Na.js +0 -1
  116. package/dist/assets/CustomerOnboardingRoutes-CHW2qzKd.js +0 -30
  117. package/dist/assets/DomesticWireDetailScreen-CI14rSQG.js +0 -18
  118. package/dist/assets/DrawerScreen-D4sZ0x81.js +0 -1
  119. package/dist/assets/EntityDetailRoutes-iu3nvuUO.js +0 -1
  120. package/dist/assets/ExpenseAutomationRoutes-BcV9yLxC.js +0 -38
  121. package/dist/assets/FeaturePreviewScreen-BRYywZxe.js +0 -1
  122. package/dist/assets/HubSpotOAuthCallbackScreen-fyIv5A_N.js +0 -1
  123. package/dist/assets/InvoicingRoutes-Dcjbiv_o.js +0 -2
  124. package/dist/assets/MagicLinkSignInScreen-D0umlmyl.js +0 -12
  125. package/dist/assets/NotFoundScreen-BZ7M6wRY.js +0 -1
  126. package/dist/assets/NotificationRoutes-P9DoW6gN.js +0 -1
  127. package/dist/assets/OAuthConsentScreen-BKn6Nxeb.js +0 -1
  128. package/dist/assets/PandLWithForecastRoutes-BsegyO1D.js +0 -1
  129. package/dist/assets/PeopleRoutes-D6QzTTon.js +0 -22
  130. package/dist/assets/PerformanceRoutes-JzQ8nQOx.js +0 -1
  131. package/dist/assets/QBOConnectionScreen-BYc3DqHZ.js +0 -100
  132. package/dist/assets/ReimbursementApprovalRoutes-DNX741Rs.js +0 -1
  133. package/dist/assets/ReimbursementApprovalRuleDetailScreen-2ORMbxwr.js +0 -1
  134. package/dist/assets/ReimbursementRoutes-BN8vNYWi.js +0 -68
  135. package/dist/assets/ReportsRoutes-Cq8Nmx-s.js +0 -1
  136. package/dist/assets/RewardsRoutes-D5AiHAwp.js +0 -1
  137. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BWl6soT-.js +0 -25
  138. package/dist/assets/ScreenRoutes-DcyDHL-V.js +0 -2
  139. package/dist/assets/SignInScreen-7BmIPffr.js +0 -1
  140. package/dist/assets/SignOutScreen-CkhaclxF.js +0 -9
  141. package/dist/assets/TaskListScreen-DBk5pNZk.js +0 -9
  142. package/dist/assets/TaskRoutes-BPceEuj1.js +0 -9
  143. package/dist/assets/TransactionDetailRoutes-BL6LPgyb.js +0 -1
  144. package/dist/assets/TransactionDetailScreen-CsnmL0BT.js +0 -5
  145. package/dist/assets/TreasuryRoutes-CW1AM8Em.js +0 -37
  146. package/dist/assets/VendorsRoutes-BkMbhAF5.js +0 -88
  147. package/dist/assets/ZeniAccountStatementScreen-DSVS1O6h.js +0 -9
  148. package/dist/assets/epic-BSdQyFUw.js +0 -2
  149. package/dist/assets/getLocaleForTenant-CyZtaI04.js +0 -1
  150. package/dist/assets/routePaths-D2W1iWQZ.js +0 -1
  151. package/dist/assets/url-kBT6SwtU.js +0 -6
  152. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BrGfKrOJ.js +0 -1
  153. package/dist/assets/useAskAiCfoHostNavButtonProps-buoAy4Wo.js +0 -1
  154. package/dist/assets/useChargeCardPusherEvents-29AHMbXs.js +0 -1
  155. package/dist/assets/useEmailConnectResultRefresh-a5BahjbB.js +0 -1
  156. package/dist/assets/useInitialThreadRequest-BmsCi-c4.js +0 -1
  157. package/dist/assets/useTaskManagerAccess-Boniioo_.js +0 -1
  158. package/dist/assets/utils-DQ0YEP-f.js +0 -36
  159. package/dist/assets/withTransactionSidePanel-Bd8MYkO_.js +0 -25
@@ -0,0 +1,25 @@
1
+ import{j as T}from"./liveblocks-BohEqL-M.js";import An from"./NotFoundScreen-CGJyt_LJ.js";import{a as n,R as ka}from"./sentry-DZasNYxC.js";import{n as Qe,S as vn}from"./mui-Bm9pLHsq.js";import{u as Ce,h as Ta,g as It,j as D,l as wn,t as Pn,i as Wt,n as Rn,o as rt}from"./core-BGTqSI0U.js";import{fB as De,$_ as xn,pG as Pe,T9 as Dn,z5 as Fn,$$ as Un,a00 as _n,a01 as Vn,a02 as dt,a03 as Ge,gd as St,a04 as Zt,eJ as Bn,fY as Mn,a05 as Xt,a06 as qe,qy as On,tX as Ln,gP as jn,gN as zn,a07 as $n,qL as Gn,qU as qn,pR as Nn,q4 as ya,gM as le,gO as Jn,a08 as Yn,qq as ba,qV as Hn,q1 as Kn,pY as Qn,u1 as Wn,gL as Re,a09 as Ye,Bf as Ea,Ly as Aa,a0a as va,a0b as Zn,fh as Xn,fj as eo,rY as gt,VS as ea,VU as to,lI as ao,VV as no,lP as oo,dh as so,Cy as Ct,a0c as co,a0d as io,rO as lo,rP as ro,UH as uo,UY as mo,$s as po,qj as wa,q_ as He,a0e as ho,UO as ta,UN as $e,a0f as aa,m4 as So,a0g as go,a0h as Co,a0i as fo,a0j as Io,qe as ko,r1 as Ne,a0k as To,a0l as yo,a0m as bo,r9 as Eo,lT as Ao,lK as vo,a0n as wo,lS as na,W3 as Po,a0o as Ro,a0p as xo,ty as Do,t9 as Fo,q$ as ue,t8 as ut,a0q as Uo,a0r as _o,a0s as Vo,a0t as Bo,nn as Mo,br as Oo,ni as oa,n4 as Lo,a0u as jo,gY as zo,nf as $o,r_ as Go,s0 as qo,Ey as No,rH as Jo,U$ as Yo,V0 as Ho,E0 as Ko,D$ as Qo,Eg as Wo,a0v as sa,rN as Zo,fg as ft,rT as Xo,a0w as es,s7 as ts,rB as as,sc as ns,rG as os,rk as ss,a0x as cs,T1 as Pa,qC as is,qa as ls,qh as ca,r4 as rs,a0y as ds,a0z as us,r0 as Ra,a0A as ms,a0B as ps,a0C as hs,a0D as Ss,sg as gs,a0E as Cs,a0F as fs,a0G as ia,tJ as Is,t0 as ks,rK as la,UM as Ts,a0H as ys,a0I as bs,lR as Es,a0J as As,Qe as vs,lQ as ws,lF as Ps,T0 as Rs,sz as xa,sV as xs,qZ as ra,r2 as Ds,bE as Fs,nc as Us,n9 as _s,a0K as Vs,rj as da,sR as ua,sP as Bs,a0L as Ms,sE as Os,sj as Ls,sS as js,a0M as zs,a0N as $s,sp as Gs,a0O as qs,sk as Ns,so as Js,sm as Ys,sY as Hs}from"./zeni-epic-state-BD9w4cbh.js";import{I as Ke,d as H,k as G,p as te,ao as Da,aq as Fa,dM as Ks,z as We,dN as Qs,dO as Ws,dP as Zs,ac as xe,dQ as Xs,dR as ma,b8 as pa,a5 as Ua,dS as ec,j as Je,G as tc,w as ac,dT as nc,at as ha,dU as oc,a as sc,dV as cc,dW as ic,c as lc,U as rc,dX as dc,dY as uc,dZ as mc,b2 as pc,bp as hc,a9 as Sc,b3 as gc,b4 as Cc}from"./index-Bkd2suv7.js";import{u as _a}from"./useAskAiCfoHostNavButtonProps-DNmjed6f.js";import{g as Sa,h as fc,r as Ic,b as kc,c as Tc,i as yc,a as bc,C as Ec}from"./TransactionDetailScreen-Bptg87Ad.js";import{w as Ac}from"./withTransactionSidePanel-pLmAxMeA.js";import{h as vc,v as wc,c as Pc}from"./routePaths-DkfFbFdK.js";import{a as mt}from"./accountMappingHelper-hg3790bD.js";import{D as Rc}from"./DrawerScreen-Dp0jZCG0.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.js";import"./decodeURIComponentSafe-Ddo_DmUd.js";import"./useInitialThreadRequest-C-FNgRyS.js";import"./expenseAutomationHelper-D7bKnox3.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="9e33b5e4-654a-4232-95d1-ea19b3a66e8c",t._sentryDebugIdIdentifier="sentry-dbid-9e33b5e4-654a-4232-95d1-ea19b3a66e8c")}catch{}})();const xc=()=>{const t=Ce(),s=Ta(),P=It(),C=D((m=>De(m))),{useFeatureGate:f}=Ke(),{isFeatureEnabled:r}=f(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:u}=f(H.aiAuditScorePercentage),x=D((m=>m.expenseAutomationViewState.selectedPeriodByTenantId)),i=D((m=>xn(m,C.tenantId))),{isAiCfoAccessEnabled:g,onAskAiCfoClick:y}=_a({mobileExploreReferrer:"Month-End Close Overview"}),w=n.useCallback(((m,M,W=!1)=>{t(Pe({tenantId:M,period:{month:m.month,year:m.year},refreshViewInBackground:W}))}),[]),b=n.useCallback((m=>{const M=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(m.month,m.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,M??null),t(Dn(C.tenantId,m))}),[C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),p=x[C.tenantId],c=n.useCallback((()=>{const m=P.state?.referrer;i.monthEndCloseChecks?.auditSummary!=null&&G.trackMonthCloseAuditPage(p.month,p.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,m??null),w(p,C.tenantId,!0)}),[w,p,C.tenantId,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),$=te(P.state?.pathnameStackToGoBack,P.pathname),I=n.useCallback((()=>{if(i.monthEndCloseChecks!=null&&p!=null){const m=i.monthEndCloseChecks.monthEndCloseCheckList.find((M=>M.progress<100));if(m!=null)return void s(`./${m.id}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}});s(`./month_end_insights/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview"}})}}),[i.monthEndCloseChecks,p]),{areTenantIdsInSync:v}=Da();return Fa({isDataReady:i.fetchState==="Completed"}),n.useEffect((()=>{p!=null&&i.fetchState!=="In-Progress"&&i.fetchState!=="Completed"&&v&&w(p,C.tenantId)}),[w,p,i.fetchState,C.tenantId,v]),n.useEffect((()=>{p!=null&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&i.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&v&&t(Fn(p))}),[p,i.monthClosePerformanceTrendFetchStatus.fetchState,v]),n.useEffect((()=>{const m=setInterval((()=>{i.fetchState!=="In-Progress"&&i.fetchState==="Completed"&&c()}),3e5);return()=>clearInterval(m)}),[i.fetchState]),n.useEffect((()=>{if(i.fetchState==="Completed"&&i.monthEndCloseChecks?.auditSummary!=null){const m=P.state?.referrer;G.trackMonthCloseAuditPage(i.selectedPeriod.month,i.selectedPeriod.year,i.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",i.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,m??null)}}),[i.fetchState,i.selectedPeriod,i.monthEndCloseChecks?.auditSummary,i.monthEndCloseChecks?.reportEmailSentDate]),T.jsx(Dc,{children:T.jsx(Ks,{monthEndCloseChecksView:i,isRealtimeInsightsFeatureEnabled:r,onMonthEndCheckClick:m=>{s(`./${m}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:$,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:b,handleReviewButtonClick:I,onBackClick:()=>{s("../../dashboard")},onReload:c,isAiCfoAccessEnabled:g,onAskAiCfoClick:y,aiAuditScorePercentageEnabled:u})})},Dc=Qe.div`
2
+ 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
+ `,Fc=ka.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:P,onFetchLinkTokenClick:C,onEstablishConnectionClick:f})=>{const r=Ce(),{useFeatureGate:u}=Ke(),{isFeatureEnabled:x}=u(H.isReconV3Enabled),{isFeatureEnabled:i}=u(H.isReconciliationCombinedStatementEnabled),g=We.getSignedInUser(),y=D((h=>De(h))),w=n.useMemo((()=>({userId:g?.userId??"",sessionId:g?.zeniSessionId??"",tenantId:y?.tenantId??""})),[g?.userId,g?.zeniSessionId,y?.tenantId]),{accountReconciliationsByAccountID:b,excludedAccountIDs:p,monthYearPeriod:c,statementUploadChosen:$}=t,I=b[s],v=n.useMemo((()=>Un(b,s)),[b,s]),m=n.useMemo((()=>_n(b)),[b]),M=n.useMemo((()=>Vn(b,s)),[b,s]),W=n.useRef(!1),_=n.useCallback((h=>{W.current=h,ma(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((()=>{W.current||r(St({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Qs(I)}]}))}))}),[r,c,I,s]),e=n.useCallback((()=>{r(dt({accountId:s,selectedPeriod:c,dismissedToBackground:!1}))}),[r,s,c]),a=n.useCallback((h=>{r(Zt({accountId:s,selectedPeriod:c,backgroundCompletedSteps:h}))}),[r,c,s]),l=n.useCallback((()=>{r(Zt({accountId:s,selectedPeriod:c,backgroundCompletedSteps:0})),r(dt({accountId:s,selectedPeriod:c,dismissedToBackground:!1}))}),[r,c,s]);n.useEffect((()=>()=>{ma(null,!1)}),[]);const d=I?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??I?.accountReconEntity.statementMetaData?.statementUploadId,S=I?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,k=D((h=>S!=null&&S!==""?Bn(Mn(h.userState,S)):"")),R=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(Wn(h,N.split(".")[0]))},A=(h,N)=>{if(N===!0){const X=I?.combinedStatementGroupId??I?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??I?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(X!=null&&X!=="")return void r(Kn({accountId:s,selectedPeriod:c,combinedStatementGroupId:X,fileId:h}))}d!=null&&r(Qn({accountId:s,selectedPeriod:c,fileId:h,statementUploadId:d}))},ae=()=>{r(qe({statementUploadChosen:!1}))},Z=h=>{r(Hn({accountId:s,selectedPeriod:c,payload:h,statementAccountScope:i===!0?I?.localData?.statementAccountScope??"single_account":"single_account"}))},fe=n.useCallback(((h,N,X)=>{r(On({accountId:h,selectedPeriod:N,statementUploadId:X}))}),[r]),ne=n.useCallback(((h,N,X,Te,pe)=>{pe!=null&&pe!==""&&r(Ln(pe)),r(Te==null||Te===""?zn({accountId:h,selectedPeriod:N,statementUploadId:X}):jn({accountId:h,selectedPeriod:N,statementUploadId:X,combinedStatementGroupId:Te}))}),[r]),Ie=n.useCallback(((h,N)=>{N!==""&&r($n({accountId:s,selectedPeriod:c,statementUpdateLocalData:h,statementUploadId:N}))}),[r,s,c]),q=n.useCallback((()=>{d!=null&&r(I?.localData?.statementAccountScope!=="multi_account"?qn({accountId:s,selectedPeriod:c,statementUploadId:d}):Gn({accountId:s,selectedPeriod:c,statementUploadId:d}))}),[r,I?.localData?.statementAccountScope,s,c,d]),K=n.useCallback((h=>{d!=null&&r(Nn({accountId:s,selectedPeriod:c,statementUploadId:d,accountMappings:h}))}),[r,c,s,d]),oe=n.useCallback((()=>{r(qe({statementUploadChosen:!0}))}),[r]),Y=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(ya({accountId:s}))}),[r,s]),Ze=n.useCallback((h=>{r(le(c,h,!0)),P()}),[r,c,P]),Xe=n.useCallback((()=>{r(Jn({accountId:s,selectedPeriod:c,statementProcessingFailed:!1})),r(Yn({accountId:s,selectedPeriod:c}))}),[r,s,c]),Ue=n.useCallback((()=>{r(ba({accountId:s}))}),[r,s]),ke=p.includes(s)?t.excludedAccountReconciliationByAccountID[s]:void 0;if(ke!=null)return T.jsx(ga,{children:T.jsx(Ca,{$isV3:x===!0,children:T.jsx(Ws,{excludedAccountReconciliation:ke,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:x,onDismissClick:P,onIncludeIntoReconciliation:Ue})})});if(I!=null){const h=x===!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:Y,onSelectStatementAccountScope:Fe,isReconciliationCombinedStatementEnabled:i===!0,ledgerAccounts:v,statementOverrideWarningAccountIds:M,unavailableLedgerAccountIds:m,onConfirmStatementMapping:K,filesEndPoint:xe.fileMicroServiceBaseUrl,authParams:w,openFilePicker:$,onStatementUploadSuccess:Z,onUploadWindowOpenedOnce:ae,onExcludeFromReconciliation:me,onRetryParsing:fe,onFetchStatementParseInfo:ne,onReviewClicked:Ze,statementProcessingFailed:I.statementProcessingFailed,statementProcessingDismissedToBackground:I.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:Xe,onContinueInBackground:O,onClearStatementProcessingDismissedToBackground:e,onResetStatementProcessingProgress:l,onStatementProcessingProgressChange:a,onStatementFlowVisibilityChange:_,onReuploadStatement:oe,onStatementFormDataChange:Ie,onStatementConfirmSave:q,reconciledByName:k,onDismissDateConflict:R,onReuploadAfterDateConflict:L,isReconV3Enabled:x}):T.jsx(Xs,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:I,monthYearPeriod:c,onDismissClick:P,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:C,onEstablishConnectionClick:f,onEditFileName:z,onDeleteFile:A,onSelectSourceType:Y,filesEndPoint:xe.fileMicroServiceBaseUrl,authParams:w,openFilePicker:$,onStatementUploadSuccess:Z,onUploadWindowOpenedOnce:ae,onExcludeFromReconciliation:me});return T.jsx(ga,{children:T.jsx(Ca,{$isV3:x===!0,children:h})})}return null})),ga=Qe.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
12
+ `,Ca=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=We.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(Ua,{fetchState:"In-Progress"}):T.jsx(ec,{onCloseClick:s,addCustomerRequest:P,snippets:r.companyMonthEndReportTemplatesData,bulletPoints:r.zeniRequestsData??[]})})}const _c={schedules:"Review Schedules",existing_schedules:"Existing Schedules"},Vc=()=>{const t=D((y=>Re(y))),s=It(),{currentSelectedViewFetchState:P,currentSelectedView:C,selectedPeriod:f}=t,r=Je(C),u=Je(P.fetchState),x=t.jeSchedules.uiState.selectedPageTab??"schedules",i=Je(x),g=n.useCallback((y=>{const w=s.state?.referrer;C==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?G.trackTransactionsReviewPage(f.month,f.year,t.transactionView.totalCountByTab.review,0,y,w??null):G.trackTransactionsAutoCategorisedPage(f.month,f.year,t.transactionView.totalCountByTab.autoCategorized,0,y,w??null)),C==="missing_receipts"&&G.trackMissingReceiptsPage(f.month,f.year,y,t.missingReceipts.transactions.length,w??null),C==="je_schedules"&&G.trackMonthCloseScheduleListPage(f.month,f.year,y,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(b=>{const p={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return b.forEach((c=>{if(Xn(c))p.oneTimeAccrualCount+=1;else switch(eo(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),_c[x],w??null),C==="flux_analysis"&&G.trackFluxAnalysisPage(f.month,f.year,y,Bc(t.fluxAnalysis),w??null),C==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&G.trackInsightsEmailPage(f.month,f.year,y,"draft",t.auditSummary.auditScorePercentage,null,w??null)}),[f,t,x]);return n.useEffect((()=>{(u!==P.fetchState||C!==r||C==="je_schedules"&&i!=null&&x!==i)&&P.fetchState==="Completed"&&g(!1)}),[C,P.fetchState,r,x,i]),g},Bc=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Mc,comma:fa,space:Oc}},dateFormat:Va}=tc.getLocalizedStrings(),Ia=Hs,Lc=wn((function(t,s){const{uncategorizedAccounts:P,vendorSearchAutoCompleteData:C,monthEndInsightsCustomerRequestData:f,monthEndInsightsPreviewMode:r,companyId:u,isMissingReceiptsBulkUploadEnabled:x,isTransactionActivityEnabled:i,newScheduleActiveType:g}=s,y=We.getSignedInUser(),w=t.tenantState.currentTenantId,b={userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:w??""},p=Re(t),{selectedTransactionCategorizationTab:c}=p,{searchTransactionsResults:$,searchTransactionsFetchState:I}=co(t),v=g==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:m,classListNestedAccountHierarchy:M,allDepreciationAccountListNestedAccountHierarchy:W,newScheduleLocalData:_,saveStatus:O}=io(t,v);return{expenseAutomationViewSelector:p,accountListNestedAccountHierarchy:m,allDepreciationAccountListNestedAccountHierarchy:W,baseTransactionSearchFetchState:I,baseTransactionSearchResults:$,classListNestedAccountHierarchy:M,newScheduleLocalData:_,initialSelectedBaseTransaction:_.selectedBaseTransactionId!=null?lo(t.transactionState,ro(_.selectedBaseTransactionId)):void 0,newAccrualAccountsView:uo(t),newScheduleSaveStatus:O,bulkUploadSelector:x===!0?p.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:C,authParams:b,receiptUploadEndpoint:`${xe.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${ha}/transaction_attachments`,bulkUploadEndpoint:x===!0?`${xe.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:y,uncategorizedAccounts:P,companyId:u,isTransactionActivityEnabled:i,receiptsEmail:po(t.tenantState,w),downloadParams:{authParams:b,jeScheduleEndPoint:`${ha}/jeScheduleReports`,timezone:mo(),companyName:De(t).companyName}}}),(function(t,s){const{themeState:P,isAccountingClassesEnabled:C,isCOTEnabled:f,isMissingReceiptsBulkUploadEnabled:r,location:u,vendorSearchAutoCompleteData:x,expenseAutomationViewSelector:i,currentTenant:g,newScheduleActiveType:y,uncategorizedAccounts:w,navigate:b,onClickCustomerRequest:p,handleEditClick:c,setActivityLogTransactionId:$}=s,{selectedPeriod:I,currentSelectedView:v,reconciliation:{selectedAccountId:m}}=i,{accountSettingsView:M}=i.jeSchedules,W=wa(I),_=He(W.start),O=He(W.end);return{onZeniLogoClick:()=>{P.toggle()},onUploadReceiptAttachment:e=>{G.trackMissingReceiptAttached(I.month,I.year),t(ks(e))},onUploadTransactionReceipt:(e,a,l,d,S,k)=>{t(ia(e,a,{fetchState:"In-Progress"}));const R=()=>t(ia(e,a,{fetchState:"Error"}));oc(`${xe.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,k,a,l,d,S).then((L=>{L!=null?t(Is(e,L)):R()})).catch(R)},onMissingReceiptsRowClick:(e,a)=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,a);const l=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:l,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(fs(e,a)),g!=null&&t(Pe({tenantId:g.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,l,d)=>{t(Cs(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?Oc+Mc+d+fa:fa}]}))},onUpdateJESchedulesUIState:e=>{e.createdGroupCollapsed!=null?t(ps()):e.pendingGroupCollapsed!=null?t(hs()):e.selectedJETypeFilter!==void 0?t(Ss(e.selectedJETypeFilter)):t(gs(e))},onUpdateMissingReceiptsUIState:e=>{t(ms(e))},onFetchMissingReceiptsList:()=>{O!=null&&_!=null&&t(Ra({start:_,end:O},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...r===!0?{onBulkUploadFiles:e=>{t(Ys(e))},onBulkUploadProgress:e=>{t(Js(e))},onBulkUploadSuccess:e=>{t(Ns({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(qs(e))},onConfirmBulkUploadMatch:(e,a,l,d,S)=>{t(Gs(e,a,l,d,S))},onBulkUploadConfirmMatchAcknowledged:()=>{t($s())},onSetBulkUploadResultsTab:e=>{t(zs(e))},onSetBulkUploadCompletedSubTab:e=>{t(js(e))},onSetBulkUploadSortConfig:(e,a)=>{t(ua({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(Ls())},onSearchTransactionsForManualMatch:(e,a)=>{t(Ia(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=i.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(Ia(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(Os(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(Ms())},onFetchBulkUploadBatches:e=>{t(xa(e))},onFetchMoreBatchDetails:()=>{t(Bs())},onResetBulkUploadSort:()=>{t(ua({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(us())},onSearchTextChanged:e=>{const a=i.currentSelectedView,l=i.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(ut({selectedTab:l,uiState:{searchString:e}})),O!=null&&_!=null&&t(ue(l,{start:_,end:O},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=i.selectedTransactionCategorizationTab;t(ds({filters:e,selectedTab:a}))},onRefresh:()=>{s.trackExpenseAutomationTabAnalytics(!0),t(rs())},onClose:()=>{v==="reconciliation"&&m!=null&&t(ca({selectedAccountId:void 0})),b("../")},onBack:()=>{v==="reconciliation"&&m!=null&&t(ca({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(ls(e))},onSaveReconciliationReview:e=>{t(is(e))},onUpdateStep:e=>{const{selectedPeriod:a}=i,l=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:l,referrer:i.currentSelectedView}}),t(Pa(e))},handleLogOutClick:()=>{const e=te(u.state?.pathnameStackToGoBack,u.pathname);b("/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),R=mt(M.fixedAssetsAccountList,d.selectedOptions),L=mt(M.accruedExpensesAccountList,S.selectedOptions),z={selectedPrepaidExpensesAccountIds:k.map((A=>A.accountId)),selectedFixedAssetsAccountIds:R.map((A=>A.accountId)),selectedAccruedExpensesAccountIds:L.map((A=>A.accountId))};t(cs({data:z}))},onSaveJeAccountSettingsClick:()=>{t(ss())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:l,accumulatedDepreciationCategory:d,scheduleClass:S,scheduleExpenseCategory:k,vendor:R}=a,{allAccountList:L,allClassList:z,allDepreciationAccountList:A}=i.jeSchedules,ae=x.entityAutoCompleteView.vendor.length>0?x.entityAutoCompleteView.vendor.find((q=>q.id===R?.selectedOption)):void 0,Z={id:ae?.zeniId??R?.selectedOption??"",name:ae?.name??R?.defaultOptions.find((q=>q.value===R?.selectedOption))?.label??"",logo:ae?.logo},fe=k?.selectedOption!=null?L.find((q=>q.qboId===k.selectedOption)):void 0,ne=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(os({scheduledJournalEntryID:e,localData:{jeScheduleID:l,scheduledJournalEntryID:e,updatedCategoryId:fe?.accountId,updatedClassId:ne?.classId,updatedAccumulatedDepreciationCategoryID:Ie?.accountId,updatedVendor:{id:Z.id,name:Z.name}}}))},onRevertJeSchedule(e,a,l,d,S){t(ns(e,a,l,d,S))},ignoreRecommendedJeSchedule(e,a,l,d){t(as(e,a,l,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(ta({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t($e("common"))},onCancelAutoComplete:()=>{t($e("common"))}},onPostJESchedule(e,a){t(ts({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(es())},onViewTransaction(e){if(s.tenantEmailDomain==null)return;const a=Pc(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(Xo({query:e,scheduleType:y==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const l=ft(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(sa({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,R=a.selectedAccumulatedDepreciationCategory!=null?S.find((L=>L.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(sa({scheduleType:l,localData:{...a,selectedAccount:k?.accountId,selectedAccumulatedDepreciationCategory:R?.accountId}})),t(Zo({scheduleType:l}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Yo()),t(Ho()),t(Ko({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(Qo({scheduleType:a})),t(Wo(a,void 0))},onCreateOneTimeAccrual(e){t(Jo(e))},handleJeScheduleClick:(e,a,l)=>{(function(S,k){return k!=="accrued_expenses"})(0,l)&&t(No({selectedJEScheduleKey:a}));const d=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../../vendors/schedules/${l}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,l,d)=>{t(a!=="revert"?qo(e,l,d):Go(e,l,d))},onOneTimeAccrualClick:e=>{const a=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{g!=null&&t($o(e,g.companyId,g.tenantId))},onClickCustomerRequest:p,setActivityLogTransactionId:$,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(zo())},onOpenFileAttachmentSnackBar:()=>{t(St({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(jo(e))},onUpdateFileAttachment:e=>{t(Lo({files:e}))},previewMonthEndReport:(e,a,l,d,S)=>{g!=null&&t(oa(e,g.companyId,a,!0,l,d,{agentInsightEdits:S,tenantId:g.tenantId}))},saveMonthEndReport:(e,a,l,d,S)=>{g!=null&&t(oa(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(Mo(g.companyId,e,g.tenantId)),G.trackInsightsEmailPage(l.month,l.year,!1,"draft",d.auditScorePercentage,Oo().format(Va.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 R=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:R,message:"expenseAutomation",origin:"transaction_categorization",searchContext:k}})},setLocalDataForCategoryAndClass:(e,a,l,d,S,k,R,L,z,A,ae,Z)=>{t(Bo(e,a,l,d,w,S,k,R,L,z,A,ae,Z))},onCancelAutoComplete:()=>{t($e("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(aa({scrollPosition:e}))},onUpdateTab:e=>{s.closeSidePanel?.(),O!=null&&_!=null&&(t(ue(e,{start:_,end:O},!1,!1)),t(Vo(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{s.closeSidePanel?.(),O!=null&&_!=null&&(t(_o(e)),t(ue("autoCategorized",{start:_,end:O},!1,!1)))},onTransactionGroupChange:e=>{s.closeSidePanel?.(),O!=null&&_!=null&&(t(Uo(e)),t(ue(s.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:_,end:O},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(ut({selectedTab:e,uiState:a})),O!=null&&_!=null&&t(ue(e,{start:_,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&&_!=null&&t(ue(e,{start:_,end:O},!0,l,a,d,S,k))},resetTransactionCategorizationLocalData:(e,a,l,d,S,k,R)=>{t(Fo(e,a,l,d,R??null,S,k,!1)),Ic(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,l,d,S)=>{t(na({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(Do(e,a,l)),fc(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(xo({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,l,d,S,k)=>{const{transactionId:R,transaction:L,lineIds:z}=a;k!=null&&t(Po({transactionId:R,customerUpdates:k})),t(Ro({selectedTab:d,transactionId:R.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:R,transaction:L,lineIds:z}=a;k!=null&&(t(Ao({transactionId:R,vendorUpdates:{name:k.name,id:k.id?k.id:void 0}})),t(vo({vendorId:k.id?k.id:void 0,localData:{vendorName:k.name,vendorId:k.id?k.id:void 0}}))),k?.id?(t(na({selectedTab:d,transactionId:R.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(wo({selectedTab:d,transactionId:R.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(Eo(a,e,l,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(bo(e))},updateOperatingExpensesIdsForReview:e=>{t(yo({operatingExpenseIds:e,selectedPeriod:I}))},redirectToVendorDetailPage:e=>{if(s.tenantEmailDomain!=null){const a=wc(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(To({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(Ea("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const l=g?.companyId;l!=null&&(t(Aa(e,l,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(va({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(ko({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(Io({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(fo({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{s.closeSidePanel?.(),t(Co({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,l)=>{const d=e.vendor?.id;l&&d!=null&&t(So(d)),t(go({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,gt("bill"));const a=te(u.state?.pathnameStackToGoBack,u.pathname);b(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{b(-1)},onReconListPageScroll:e=>{t(aa({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ta({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t($e("common"))},onReconNodeCollapseToggled:(e,a)=>{t(ho({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(ya({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(ba({accountId:e}))}}}),((t,s,P)=>{const{isMissingReceiptsBulkUploadEnabled:C,...f}=P;return(function(r,u,x){return{...r,...u,...x,onUploadTransactionReceipt:(i,g,y,w,b)=>{u.onUploadTransactionReceipt(i,g,y,w,b,r.authParams)}}})(t,s,f)}))(ac(nc)),pt="newScheduleMode",ht="newScheduleType",jc=Ac((function(t){const s=t.displayName??t.name??"Component",P=ka.memo(t),C=f=>{const r=Ce(),u=(function(){const v=Ce(),m=D((M=>Re(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])}})(),x=D((v=>Re(v).reconciliation)),i=D((v=>De(v))),g=n.useCallback(((v,m)=>{r(Ea("expense_automation_reconcile",v,m))}),[r]),y=n.useCallback(((v,m)=>{const M=i?.companyId;M!=null&&(r(Aa(v,M,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",m)),r(va({accountId:m,connectionInProgress:!0})))}),[r,i?.companyId]),w=n.useMemo((()=>{if(u.isOpen&&u.selectedAccountId!=null)return T.jsx(Fc,{reconciliation:x,selectedDrawerAccountId:u.selectedAccountId,onClose:u.closePanel,onFetchLinkTokenClick:g,onEstablishConnectionClick:y})}),[u.isOpen,u.selectedAccountId,u.closePanel,x,g,y]),b=n.useMemo((()=>({reconPanelContent:w,reconSidePanelIsOpen:u.isOpen,closeReconSidePanel:u.closePanel})),[w,u.isOpen,u.closePanel]),{useFeatureGate:p}=Ke(),{isFeatureEnabled:c}=p(H.isReconV3Enabled),$=n.useContext(pa),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(pa.Provider,{value:I,children:T.jsx(P,{...f,...b})})};return C.displayName=`withReconSidePanel(${s})`,C})((({closeSidePanel:t,openTransactionPanel:s,panelContent:P,sidePanelIsFullView:C,sidePanelIsOpen:f,reconPanelContent:r,reconSidePanelIsOpen:u,closeReconSidePanel:x})=>{const{isAiCfoOpen:i,setIsAiCfoOpen:g}=sc(),y=cc(),{isOpen:w}=ic(),b=Ta(),p=It(),c=Ce(),{isAiCfoAccessEnabled:$,onAskAiCfoClick:I}=_a({mobileExploreReferrer:"Transaction categorization"}),v=n.useCallback((()=>{f===!0&&C!==!0&&t?.()}),[t,f,C]),{areTenantIdsInSync:m}=Da(),M=Vc(),W=lc(),[_,O]=n.useState(!1),[e,a]=Pn(),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(la({scheduleType:B==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:j}))}),[c,l]),R=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(la({scheduleType:ft(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[c,l]),z=D((o=>ea(o))),A=D((o=>De(o))),[ae,Z]=n.useState(!1),[fe,ne]=n.useState(!1),[Ie,q]=n.useState([]),[K,oe]=n.useState(null),Y=n.useCallback((()=>{oe(null)}),[]),Fe=K?.contentType==="activity"?K.detail.transactionId:void 0,me=n.useCallback((o=>{o!=null?(i&&g(!1),y(),v(),oe({contentType:"activity",detail:{transactionId:o}})):oe((E=>E?.contentType==="activity"?null:E))}),[v,i,y,g]),Ze=n.useCallback((o=>{i&&g(!1),y(),v(),oe({contentType:"transfer",detail:o})}),[v,i,y,g]),Xe=n.useCallback((()=>{y(),Y(),v(),I()}),[v,Y,I,y]),Ue=n.useRef(i);n.useEffect((()=>{i===!0&&Ue.current===!1&&(y(),Y(),v()),Ue.current=i}),[v,Y,i,y]);const ke=n.useRef(w);n.useEffect((()=>{w===!0&&ke.current===!1&&(i&&g(!1),Y(),f===!0&&C!==!0&&t?.()),ke.current=w}),[Y,t,w,i,g,C,f]);const h=f===!0&&C!==!0,N=n.useRef(h);n.useEffect((()=>{h&&!N.current&&(i&&g(!1),y(),Y()),N.current=h}),[Y,i,h,y,g]);const[X,Te]=n.useState(!1),pe=n.useRef(!1),{selectedTab:kt}=Wt(),{tenantEmailDomain:et}=Wt(),[tt,Tt]=n.useState(p.state?.message==="comingFromTransactionDetail"),yt=p.state?.message==="comingFromOverview",Ba=rc(),at=We.getSignedInUser(),{useFeatureGate:se}=Ke(),{isFeatureEnabled:bt}=se(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:ye}=se(H.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:nt}=se(H.isTransactionActivityEnabled),{isFeatureEnabled:Ma}=se(H.isAccrualEnabled),{isFeatureEnabled:Et}=se(H.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:Oa}=se(H.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:La}=se(H.isProjectsTransactionsEnabled),{isFeatureEnabled:ja}=se(H.isReconV3Enabled),za=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),b(`/${et}/transaction/${encodeURIComponent(E)}/${o.transactionId??o.entityId}?${B.toString()}`,{state:{pathnameStackToGoBack:j,message:"expenseAutomation"}})}),[b,et,p.state,p.pathname]),$a=D((o=>Ts(o,"common"))),V=D((o=>Re(o))),{categoryOptions:Ga,paymentAccountNames:qa}=D((o=>ys(o.accountState))),Na=D((o=>bs(o.classState))),{monthEndCloseChecksView:J,currentSelectedView:F,selectedPeriod:U,selectedTransactionCategorizationTab:ot,currentSelectedViewBackgroundRefreshFetchState:Ja,currentSelectedViewFetchState:ce,jeSchedules:st,reconciliation:At}=V;kc(F==="transaction_categorization");const Ya=V.transactionView.saveStatus.fetchState,_e=V.transactionView.transactions,vt=n.useRef(_e);vt.current=_e;const wt=D((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Pt=D((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Rt=n.useRef(wt);Rt.current=wt;const xt=n.useRef(Pt);xt.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?dc(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:_e.length>0,isFiltered:E>0,resultsCount:_e.length,searchTerm:o,searchType:"free_text"})}),[F,ce.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,Ve]);const ie=Tc(Ya,(()=>{const o=[],E=xt.current,j=Rt.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&&x?.()}),[F,At.selectedAccountId]);const Ha=V.transactionView.selectedTransactionCategorizationCompletedSubTab,Ka=V.transactionView.selectedTransactionGroup,Be=`${ot}|${Ha}|${Ka}`,Me=n.useRef(null),Ft=n.useRef(null);n.useEffect((()=>{Me.current!==null?Me.current!==Be&&(Me.current=Be,F==="transaction_categorization"&&Y()):Me.current=Be}),[Y,F,Be]);const Qa=D((o=>Fe==null?void 0:Es(o.transactionState,Fe))),re=Qa?.qboId,Ut=D((o=>re==null?void 0:As(o,re)));n.useEffect((()=>{re!=null&&c(vs(re))}),[c,re]);const{createTransferEntryStatus:_t,creditCardTransferAccountsList:Vt,transferAccounts:Bt}=V.transactionView,Mt=n.useCallback((o=>yc(c,o)),[c]),Ot=n.useMemo((()=>F!=="transaction_categorization"||K==null?null:K.contentType==="activity"?nt===!0?T.jsx(uc,{activityLogView:Ut,qboId:re,onClose:()=>oe(null),selectedTransactionId:K.detail.transactionId,isQuickViewCardStyle:!0},String(K.detail.transactionId)):null:K.contentType==="transfer"?T.jsx(mc,{createTransferEntryStatus:_t,creditCardTransferAccountsList:Vt,transaction:K.detail,transferAccounts:Bt,onClose:()=>oe(null),onCreateTransfer:Mt,isQuickViewCardStyle:!0},String(K.detail.transactionId)):null),[F,K,nt,Ut,re,_t,Vt,Bt,Mt]),Wa=Ot!=null,{selectedAccountId:be}=At,Lt=Je(st.accountSettingsView.saveState.fetchState),Za=D((o=>ws(o.accountState,o.accountListState,"accountList"))),Xa=D((o=>Ps(o))),Ee=kt!=null?Rs(kt):F,en=D((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Fa({isDataReady:ce.fetchState==="Completed"}),at==null)throw Error("Can't access expense automation screen without signing in...");const jt=wa(U),Ae=He(jt.start),ve=He(jt.end);if(Ae==null||ve==null)throw Error(`Invalid start - ${Ae} and end - ${ve} period from given ${U}`);const tn=n.useCallback((()=>{Z(!1)}),[]),an=n.useCallback((()=>{ne(!0)}),[]),nn=n.useCallback((o=>{q(o),ne(!1)}),[]),on=n.useCallback((()=>{q([])}),[]),Oe=V.missingReceipts.bulkUpload.phase,zt=V.missingReceipts.bulkUpload.currentBatchId;n.useEffect((()=>{ye===!0&&F==="missing_receipts"&&Oe==="matching"&&zt!=null&&c(xa({cacheOverride:!0}))}),[ye,F,Oe,zt,c]);const $t=at?.userId,sn=U.month,cn=U.year,Gt=A?.tenantId;n.useEffect((()=>{F==="missing_receipts"&&ye!==!1&&Oe==="idle"&&$t!=null&&Gt!=null&&c(xs())}),[F,ye,Oe,$t,Gt,sn,cn,c]),n.useEffect((()=>{z.newVendorState?.vendorDetailLocalData?.vendorName!=null?O(!0):O(!1)}),[z.newVendorState?.vendorDetailLocalData?.vendorName]),n.useEffect((()=>{Ee!=null&&F!==Ee&&c(Pa(Ee))}),[Ee]),n.useEffect((()=>{X===!1&&ce.fetchState==="Completed"&&m&&(Te(!0),c(ra(!1,!1)))}),[X,ce,m]),n.useEffect((()=>{const o={month:U.month,year:U.year},E=Ft.current;Ft.current=o,E===null||E.month===o.month&&E.year===o.year||!yt&&m&&(c(ra(!1,!1)),c(le(U,be,!1,!1)))}),[U.month,U.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(U,o,E,null));break;case"month_end_insights":if(E===!1){const B=new Date(U.year,U.month,0),he=Fs(B.toDateString()).format(Va.analytics.YYYYDashMMDashDDFormat);c(Us(!0,A.companyId,A.tenantId,he)),c(_s(A.companyId,A.tenantId))}break;case"je_schedules":c(Ds(j,E));break;case"missing_receipts":c(Ra(j,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,E));break;default:c(le(U,be,o,E))}}),[F,Ae,ve,A.companyId,A.tenantId,ot,U,be,tt,Tt]),ln=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((()=>{yt||tt||pe.current||Ja.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:U,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(U,void 0,!1,!1))}),[J.fetchState,m,U.month,U.year,V.reconciliation.fetchStatus.fetchState,c]),n.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?Z(!0):Z(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),n.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&m&&(c(Pe({tenantId:A.tenantId,period:U,refreshViewInBackground:!0})),c(Vs({companyId:A.companyId})),b("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,A.tenantId,U,A.companyId,m]),n.useEffect((()=>{const o=setInterval((()=>{J.fetchState!=="In-Progress"&&J.fetchState==="Completed"&&c(Pe({tenantId:A.tenantId,period:U,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[J.fetchState,A.tenantId,U,c]),n.useEffect((()=>{const o=setInterval((()=>{F==="reconciliation"&&be==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&c(le(U,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[F,c,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,le,be,U]);const qt=Sa(),Nt=pc(),{onRecommendationSelection:Jt,popup:rn}=bc({isEnabled:qt}),dn=n.useMemo((()=>({...Nt,onRecommendationSelection:Jt})),[Nt,Jt]);n.useEffect((()=>{const o=(J.monthEndCloseChecks?.monthEndCloseCheckList.find((E=>E.id==="month_end_insights"))?.isDisabled??!1)&&!bt;F!=="month_end_insights"||!o&&J.monthEndCloseChecks?.reportEmailSentDate==null||b("../")}),[F,J.monthEndCloseChecks]);const un=u===!0?r:P,mn=u===!0||f===!0,pn=u===!0?x:t;n.useEffect((()=>{Lt==="In-Progress"&&st.accountSettingsView.saveState.fetchState==="Completed"&&c(da())}),[Lt,st.accountSettingsView.saveState.fetchState,da]);const{transactionId:Yt,onSaveVendor:hn,onSaveSuccess:Sn,onCancel:gn,vendorViewDetails:Cn}=(({expenseAutomationViewSelector:o,closeDrawerHandler:E,currentSelectedView:j})=>{const B=Ce();let he,Se,Q;const ct=Sa(),we=o.transactionView;let Ht=()=>{};const{transactions:fn,selectedTransactionId:ge,selectedTransactionLineId:je,transactionLocalData:In}=we;if(j==="transaction_categorization"){const it=In.find((de=>de.transactionId===ge)),ee=fn.find((de=>de.id===ge)),Kt=je!=null?it?.transactionReviewLocalData?.lineItemById[je]:void 0,Qt=Kt?.account;Se=Kt?.class?.classId,he=["Uncategorized Income","Uncategorized Expense"].includes(Qt?.accountName??"")?void 0:Qt?.accountId;const Tn=vc(ge,ee?.typeOfTransaction);ee!=null&&Tn&&(Q={id:ge,type:gt(ee.typeOfTransaction)}),Ht=()=>{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(so(ee)||(lt=ze.selectedEntityLine),lt!=null){const yn=lt,bn={transactionId:{id:ee.id,type:ee.type},transaction:ee,lineIds:ee.lines.map((En=>En.id))??[]};B(Ct({entity:yn,amount:ze.amount.amount,transactionDetails:bn,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:ct}))}}}}}const kn=D((it=>ea(it,void 0,he,Se)));return{transactionId:Q,onSaveVendor:()=>{B(oo(Q,void 0,!1,!0))},onSaveSuccess:Ht,onCancel:()=>{Q!=null&&B(to({transactionId:Q})),B(ao()),B(no()),E()},vendorViewDetails:kn}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{O(!1)},currentSelectedView:F});return Ba?.loggedInUserRoleMap==null?J.fetchState==="Error"?T.jsx(hc,{onGoHome:()=>b("../",{replace:!0}),onReload:()=>window.location.reload()}):T.jsx(Ua,{fetchState:"In-Progress"}):T.jsxs(T.Fragment,{children:[T.jsx(Rc,{isOpen:fe,drawerLeftMargin:new Sc(0,0,300,650),onClose:()=>{ne(!1)},children:T.jsx(zc,{onClick:o=>o.stopPropagation(),children:T.jsx(Uc,{companyId:A.companyId,closeCustomerRequestDrawer:()=>ne(!1),addCustomerRequest:nn,resetCustomerRequest:on})})}),Yt!=null&&_&&T.jsx(Ec,{isOpen:_,transactionId:Yt,onSaveVendor:hn,onSaveSuccess:Sn,onCancel:gn,vendorViewDetails:Cn}),T.jsx(gc,{toolkit:dn,children:T.jsx(Lc,{events:[],eventCallback:(o,E,j)=>{},navigate:b,location:p,themeState:W,categoryOptions:Ga,classesForFilters:Na,accountsForFilters:qa,vendorSearchAutoCompleteData:{autoCompleteText:en,entityAutoCompleteView:$a},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:ye,monthEndInsightsPreviewMode:ae,monthEndInsightsCustomerRequestData:Ie,isRealtimeInsightsFeatureEnabled:bt,isCreateTransferEntryFromExpenseEnabled:Et,isAccountingClassesEnabled:Xa,isProjectsTransactionsEnabled:La,isCOTEnabled:qt,currentTenant:A,companyId:A.companyId,signedInUser:at,isTransactionActivityEnabled:nt,isRightPanelOpen:Wa,rightSidePanel:Ot,onOpenTransferRightPanel:Et===!0?Ze:void 0,uncategorizedAccounts:Za,newScheduleActiveType:d,isAccrualEnabled:Ma,newScheduleSelection:R,onNewScheduleSelectionChange:L,onScheduleTypeChange:k,onNewScheduleSaved:ln,onClickCustomerRequest:an,handleEditClick:tn,tenantEmailDomain:et,trackExpenseAutomationTabAnalytics:M,setActivityLogTransactionId:me,closeSidePanel:pn,openTransactionPanel:s,sidePanelIsOpen:mn,sidePanelIsFullView:u!==!0&&C,panelContent:un,isAiCfoAccessEnabled:$,onAskAiCfoClick:Xe,isExpenseAutomationCommentingEnabled:Oa,isReconV3Enabled:ja,onExpenseAutomationCommentingThreadClick:za,sidePanelListPercent:u===!0?66:void 0})}),rn,ie.showPopup&&ie.popupType!=null&&T.jsx(Cc,{popupType:ie.popupType,currencySymbol:ie.currencySymbol,accountId:ie.popupAccountId??"",accountName:ie.popupAccountName??"",onSubmit:ie.handleSubmit,onDismiss:ie.handleDismiss})]})}))),zc=Qe(vn)`
22
+ display: flex;
23
+ min-height: 100%;
24
+ flex-direction: column;
25
+ `;function pi(){return T.jsxs(Rn,{children:[T.jsx(rt,{path:"*",element:T.jsx(xc,{})}),T.jsx(rt,{path:"/:selectedTab/:selectedPeriod/*",element:T.jsx(jc,{})}),T.jsx(rt,{path:"*",element:T.jsx(An,{})})]})}export{pi as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-BohEqL-M.js";import{a as r}from"./sentry-DZasNYxC.js";import{au as i,av as b,r as f,a2 as l}from"./index-Bkd2suv7.js";import"./mui-Bm9pLHsq.js";import p from"./NotFoundScreen-CGJyt_LJ.js";import{h as m,g as u}from"./core-BGTqSI0U.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3e0b62bd-24c2-4dc7-beeb-ffec556cb516",e._sentryDebugIdIdentifier="sentry-dbid-3e0b62bd-24c2-4dc7-beeb-ffec556cb516")}catch{}})();const _=()=>{const e=m(),t=u(),a=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),c=r.useCallback((()=>{(()=>{const n=l(t.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=i(t.pathname);return o!=null?s.jsx(b,{menuItem:f(o),onDemoClick:a,onGoBack:c}):s.jsx(p,{})},k=(e=2)=>{let t="../";for(let a=0;a<e;a++)t=`${t}../`;return t};export{_ as F};
@@ -0,0 +1 @@
1
+ import{a as r}from"./sentry-DZasNYxC.js";import{u as l,h as f,g as m}from"./core-BGTqSI0U.js";import{hV as p,Tv as g,Tw as _}from"./zeni-epic-state-BD9w4cbh.js";import{u as b,L as h,z as y}from"./index-Bkd2suv7.js";import"./liveblocks-BohEqL-M.js";import"./recharts-DZSO8gqO.js";import"./mui-Bm9pLHsq.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c4d32c4d-de76-41fa-b7d5-e5b16e46ad70",e._sentryDebugIdIdentifier="sentry-dbid-c4d32c4d-de76-41fa-b7d5-e5b16e46ad70")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:u}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -1 +1 @@
1
- import{m as s}from"./liveblocks-DOBkg1D1.js";import{j as r}from"./core-D5xlmXJj.js";import{fB as d}from"./zeni-epic-state-DVQQo6UD.js";import"./sentry-B0nIwgR6.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
1
+ import{m as s}from"./liveblocks-BohEqL-M.js";import{j as r}from"./core-BGTqSI0U.js";import{fB as d}from"./zeni-epic-state-BD9w4cbh.js";import"./sentry-DZasNYxC.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -0,0 +1,2 @@
1
+ import{j as s}from"./liveblocks-BohEqL-M.js";import{a as r}from"./sentry-DZasNYxC.js";import{u as P,h as A,i as F,j as E,t as z,l as O,s as H,g as W,N as B,n as te,o as y}from"./core-BGTqSI0U.js";import{a6 as lt,k as p,ao as T,S 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,U 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 Ht,cG as Zt,cH as qt,t as Ye,j as hn,cI as Yt,cJ as Kt,cK as Qt,cL as Gt,cM as zt,cN as Wt,cO as Jt}from"./index-Bkd2suv7.js";import"./mui-Bm9pLHsq.js";import{A as Y}from"./AddressScreen-JumAvrZ3.js";import M from"./NotFoundScreen-CGJyt_LJ.js";import{YI as Xt,YJ as ei,uv as Ke,YK as je,YL as K,vz as Qe,vG as ni,vL as Cn,YM as De,YN as In,vD as En,YO as Pe,vB as kn,yg as ti,vC as ii,YP as Q,uY as se,vv as oi,x7 as Ge,uX as he,YQ as ai,YR as yn,vS as si,YS as G,vZ as ci,YT as ri,YU as xn,YV as bn,y2 as li,YW as de,YX as ze,YY as jn,uV as di,YZ as ui,uP as gi,Y_ as mi,xk as vi,Y$ as Dn,xt as We,Z0 as pi,xq as fi,Z1 as Ae,gd as Si,Z2 as ee,Z3 as ne,wc as hi,v1 as Je,Z4 as Le,v6 as Pn,v4 as Ci,u_ as Ii,w5 as Ei,v8 as ki,we as yi,Z5 as Ce,wm as An,wk as Ie,F6 as $e,xz as Xe,Z6 as xi,uW as we,Z7 as Fe,vh as Ee,ve as ke,vr as Ln,vq as Te,vb as bi,vk as $n,vt as ie,fB as Re,Uv as wn,uZ as Oe,vo as ji,vp as Di,vn as Pi,Z8 as Ai,vV as en,v_ as Li,vW as Fn,Z9 as Tn,uJ as nn,Za as $i,uF as Rn,Zb as wi,xF as Fi,xJ as Z,xE as Ti,wN as _e,Zc as Ri,Zd as On,xS as tn,Ze as Oi,xP as _i,Zf as _n,wQ as Mi,wR as V,wU as Ni,Zg as Mn,x2 as me,Zh as Ui,wd as Nn,T3 as Un,Zi as Bi,xc as Vi,Zj as Bn,Zk as Hi,Zl as Zi,Zm as qi,yH as Yi,Zn as Ki,Zo as Vn,xZ as Hn,Zp as Zn,yF as ve,Zq as Qi,yC as Gi,Zr as zi,Zs as Wi,Zt as Ji,Zu as Xi,Zv as eo,Zw as on,Zx as no,yL as to,Zy as Me,ww as an,Zz as Ne,ZA as ce,wG as qn,wB as Yn,wz as ye,ZB as io,wr as oo,y3 as Kn,yu as sn,yp as ao,ZC as so,y4 as co,ZD as ro,yv as lo,yz as uo,ZE as go,ZF as Qn,c7 as mo,m6 as vo,m7 as po,ZG as cn,vA as re,gh as fo,tX as So,md as ho,ym as Gn,yX as Co,yj as zn,u1 as Io,yU as rn,tR as Eo,yR as ln,hP as ko,Tv as dn,Tw as yo,Fi as Wn,hH as xo,ZH as bo,Uk as jo,ZI as Do,z1 as pe,z2 as Po,ZJ as Ao,ZK as Jn,y_ as Lo,ZL as $o,ZM as wo,xg as Fo,ZN as To}from"./zeni-epic-state-BD9w4cbh.js";import{M as Ro}from"./MobileAppDrawer-gXWJpapq.js";import{q as le}from"./QBOConnectionScreen-Bo0_X0MI.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.js";import"./InboxNotificationsProvider-CP3zxjLQ.js";import"./useTaskManagerAccess-DoD7gL98.js";import"./empty-u_z2Liw4.js";import"./pdf-lib-DDkyZRb6.js";import"./index-Clep-E8B.js";import"./url-CIyGuAwg.js";import"./index-DqOzvxxV.js";import"./decodeURIComponentSafe-Ddo_DmUd.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]="f34218f9-b2ae-4728-a169-c0e4e2a820a1",t._sentryDebugIdIdentifier="sentry-dbid-f34218f9-b2ae-4728-a169-c0e4e2a820a1")}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(Ke({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(Ke({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]=z(),{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(K()),()=>{t(K())})),[t]),r.useEffect((()=>{a&&t(Qe({id:n,kind:c}))}),[a,n,c,t]);const[S,f]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(t(K()),t(Qe({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=>Q(c).productNextCursor!=null)),o=E((c=>Q(c).productNextCursor)),a=E((c=>Q(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"]),Ho=new Set(["plan"]),Zo=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(K()),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]=z(),{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&&Ho.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(K())}}),[m.fetchState,m.savedItemId,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Zo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const Yo={addons:"addon",all:"item",charges:"charge",plans:"plan"},Ko=O((function(t,e){const n=Q(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=Yo[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 Qo(){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((_=>Q(_))),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(Ge({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(Ge({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(Ko,{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 Go=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(G()),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 zo(){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(G())}}),[a,c,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCouponFormPage}),s.jsx(Go,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Wo=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]=z(),{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(ze()),()=>{t(ze())})),[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(Wo,{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}}),H),x=k==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(We({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=W(),{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=W(),{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}}),H),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(G()),()=>{t(G())})),[t]),r.useEffect((()=>{o&&t(en({id:n}))}),[o,n,t]);const[v,u]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(t(G()),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}}),H),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(Z({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(Z({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(Z({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(Z({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(Z({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(Z({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}}),H),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}}),H),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(Ki({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Yi())}}}))(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(Hi()),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(Zi({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(Hn(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(Hn(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=Zn(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(Gi({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 _=Zn(L);return{activeType:_.activeTab,appliedSearch:_.filters.search,appliedSort:_.sort,nextCursor:_.nextCursor,transactionListFetchState:_.fetchState,transactions:_.transactions}}),H),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(Qi(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=>zi(C))),l=E(Wi),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(Yn({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=W(),{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}),Ha=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Za=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(Ha),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}))}}}))(Ht);function qa(){const t=P(),e=A(),n=W(),{subscription_id:i,tenantEmailDomain:o}=F(),[a]=z(),{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(Za,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ya=O((function(t){const e=Kn(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(Yn({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}))}}}))(Zt);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,subscriptionListFetchState:k,runningActionSubscriptionId:x}=E((D=>{const C=Kn(D);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,subscriptionListFetchState:C.fetchState,runningActionSubscriptionId:C.runningActionId??null}}),H),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(Ya,{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 Qa=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 Ga(){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(Qa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:a})]})}const za={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(Qn),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)),He=E(($=>R!=null&&R!==""?po($,R):void 0)),ot=R!=null&&R!==""&&Ve!=null?{[R]:Ve}:{},at=R!=null&&R!==""&&He!=null?{[R]:He}:{};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!==""&&Ye.shouldFetchActiveTenant(C)&&(Ye.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"),Ze=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(Wn())},onSaveChargeBeeCredentials:($,q)=>{Ze!=null&&C!==""&&e(ko(C,Ze,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(zn($)),onSave:$=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(Co({settings:$,snackbarSection:za[t??""]}))},onStartQboBackfill:$=>e(Gn($)),updateFilesEntity:$=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:$}))}}}function pn({appContent:t}){const e=A(),n=W(),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(Yt,{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 Wa(){const t=A(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Kt,{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(Qt,{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(Gt,{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(zn(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(Lo())},onStartBackfill:e=>{t(Gn(e))}}}))(zt);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(Wn())})]})}const ts={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const t=Sn(),e=P(),n=A(),[i,o]=z(),a=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qn),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(Wt,{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(Y,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(y,{path:"integrations",element:s.jsx(Ja,{})}),s.jsx(y,{path:"dunning",element:s.jsx(Wa,{})}),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(Y,{})}),s.jsx(y,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(y,{path:"customers/:customer_id/:addressType",element:s.jsx(Y,{})}),s.jsx(y,{path:"subscriptions",element:s.jsx(Ka,{})}),s.jsx(y,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(y,{path:"subscriptions/new/:addressType",element:s.jsx(Y,{})}),s.jsx(y,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(y,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(Y,{})}),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(Ga,{})}),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(zo,{})}),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(Qo,{})}),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,4 +1,4 @@
1
- import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-D5xlmXJj.js";import{TI as k,TJ as v,TK as F,IM as D,Iy as G,TL as B,TM as oe,TN as ie,IC as se,ge as j,IJ as le,IG as re}from"./zeni-epic-state-DVQQo6UD.js";import{a1 as x,J as r,a2 as de,j as I,Y as M,a3 as ce,a4 as me,a5 as pe,p as K,O as ue,y as he,a6 as ge,_ as xe,E as fe,e as be,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as ve,ab as Ie,ac as je}from"./index-waurk8Yr.js";import{n as m}from"./mui-DpenkF9f.js";import f from"./NotFoundScreen-BZ7M6wRY.js";import{a as $}from"./sentry-B0nIwgR6.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="3aafc98e-42d8-4ea0-b795-7f616286b913",e._sentryDebugIdIdentifier="sentry-dbid-3aafc98e-42d8-4ea0-b795-7f616286b913")}catch{}})();const $e=m.div`
1
+ import{j as a}from"./liveblocks-BohEqL-M.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-BGTqSI0U.js";import{To as k,Tp as v,Tq as F,Iw as D,Ii as G,Tr as B,Ts as oe,Tt as ie,Im as se,ge as j,It as le,Iq as re}from"./zeni-epic-state-BD9w4cbh.js";import{$ as x,K as r,a0 as de,k as I,X as K,a1 as ce,a2 as me,a3 as pe,p as M,I as ue,d as he,a4 as ge,c as xe,E as fe,g as we,a5 as be,a6 as Se,Z as ye,a7 as ke,a8 as ve,a9 as Ie,aa as je}from"./index-Bkd2suv7.js";import{n as m}from"./mui-Bm9pLHsq.js";import f from"./NotFoundScreen-CGJyt_LJ.js";import{a as $}from"./sentry-DZasNYxC.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.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]="2f129131-be74-49d7-92b4-e350f8ff18d5",e._sentryDebugIdIdentifier="sentry-dbid-2f129131-be74-49d7-92b4-e350f8ff18d5")}catch{}})();const $e=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -16,7 +16,7 @@ import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,
16
16
  align-items: center;
17
17
  background-color: ${e=>e.theme.colors.grey4};
18
18
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:M.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(De,{windowSize:o,children:a.jsx(Be,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:M.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
19
+ `,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:K.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(De,{windowSize:o,children:a.jsx(Be,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:K.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
20
20
  display: flex;
21
21
  height: 100%;
22
22
  width: 100%;
@@ -25,7 +25,7 @@ import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,
25
25
  align-items: center;
26
26
  background-color: ${e=>e.theme.colors.grey4};
27
27
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ne=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(F({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Le,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Te=m.div`
28
+ `,Ne=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(F({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Le,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Te=m.div`
29
29
  display: flex;
30
30
  height: 100%;
31
31
  width: 100%;
@@ -34,7 +34,7 @@ import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,
34
34
  align-items: center;
35
35
  background-color: ${e=>e.theme.colors.grey4};
36
36
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Fe=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ge(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Te,{windowSize:n,children:a.jsx(Fe,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Me={containerWidth:new Ie(100,58)},Ke=m(ke)`
37
+ `,Fe=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ge(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Te,{windowSize:n,children:a.jsx(Fe,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ke={containerWidth:new Ie(100,58)},Me=m(ke)`
38
38
  width: ${r.sp4};
39
39
  height: ${r.sp4};
40
40
  margin-bottom: ${r.sp3};
@@ -54,7 +54,7 @@ import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,
54
54
  display: flex;
55
55
  flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
56
  flex-direction: column;
57
- width: ${e=>`${Me.containerWidth.value(e.windowSize)}%`};
57
+ width: ${e=>`${Ke.containerWidth.value(e.windowSize)}%`};
58
58
  ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
59
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
60
  padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
@@ -69,4 +69,4 @@ import{j as a}from"./liveblocks-DOBkg1D1.js";import{i as S,l as g,h as C,g as y,
69
69
  width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
70
  background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
71
  margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,Je=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),V=n.pathname.includes("address"),b=x(),_=xe(),A=fe(),w=be(),H=()=>{_.toggle()},J=E((u=>k(u))),W=E((u=>v(u))),{authParams:U,fetchState:c,billAttachment:O,billFetchState:P,companyName:Y,currencySymbol:q,amount:Q}=J,{tenantId:z,userId:L,sessionId:N}=U,{fetchState:R,internationalBankAccountCreateStatus:X}=W;return $.useEffect((()=>{j()}),[]),$.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[w,c,i,o,d,t]),$.useEffect((()=>{w&&c==="Completed"&&(j(L,N,z),l!=null&&t(re(l)))}),[c,w,L,N,z,l,t]),c==="Error"?a.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?(j(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:I,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",Y,l??"",We(n.pathname),q,Q))(u)}),a.jsxs(Ve,{windowSize:b,children:[b!=="small"?a.jsx(Ke,{onClick:H}):null,a.jsx(He,{windowSize:b,isAddressPage:V,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(Je,{file:O,type:"bill"})}),a.jsx(_e,{windowSize:b,children:e})]})]})}const We=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ue(){return a.jsx(je,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Ue,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Ee,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ge,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{da as default};
72
+ `,We=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),V=n.pathname.includes("address"),w=x(),_=xe(),A=fe(),b=we(),H=()=>{_.toggle()},W=E((u=>k(u))),U=E((u=>v(u))),{authParams:q,fetchState:c,billAttachment:X,billFetchState:P,companyName:Z,currencySymbol:J,amount:O}=W,{tenantId:z,userId:L,sessionId:N}=q,{fetchState:Q,internationalBankAccountCreateStatus:R}=U;return $.useEffect((()=>{j()}),[]),$.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[b,c,i,o,d,t]),$.useEffect((()=>{b&&c==="Completed"&&(j(L,N,z),l!=null&&t(re(l)))}),[c,b,L,N,z,l,t]),c==="Error"?a.jsx(f,{}):Q==="Completed"||R.fetchState==="Completed"?(j(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:I,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",Z,l??"",Ue(n.pathname),J,O))(u)}),a.jsxs(Ve,{windowSize:w,children:[w!=="small"?a.jsx(Me,{onClick:H}):null,a.jsx(He,{windowSize:w,isAddressPage:V,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(We,{file:X,type:"bill"})}),a.jsx(_e,{windowSize:w,children:e})]})]})}const Ue=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function qe(){return a.jsx(je,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(qe,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Ee,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ge,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{da as default};
@@ -0,0 +1,12 @@
1
+ import{j as g}from"./liveblocks-BohEqL-M.js";import{a as u}from"./sentry-DZasNYxC.js";import{u as U,g as _,h as w,t as V,j as l,N as L}from"./core-BGTqSI0U.js";import{z as r,E as M,G as P,R as A,k as N,S as R,Y as B,Z as G,V as W}from"./index-Bkd2suv7.js";import{fB as X,SX as Y,Tk as Z,Tb as $,ge as q,gg as H,Tg as J,gR as K,df as Q,Tl as ee,Tm as te}from"./zeni-epic-state-BD9w4cbh.js";import{n as ne}from"./mui-Bm9pLHsq.js";import{u as se}from"./useDeviceId-C5wTdvqD.js";import{f as ae}from"./analyticsHelper-CTQJAyGI.js";import{t as ie}from"./getLocaleForTenant-C9hGHLTR.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="2d72e980-59c4-43cb-9933-6d6ca74de767",t._sentryDebugIdIdentifier="sentry-dbid-2d72e980-59c4-43cb-9933-6d6ca74de767")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=_(),f=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:D}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>X(e))),k=l((e=>Y(e))),E=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),u.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants($(k.tenantsInOrder),s.zeniSessionId),q(s.userId,s.zeniSessionId,o.tenantId),t(H(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(J("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),K().then((()=>{const e=W();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Q(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,a.state,t]);const j=u.useCallback((()=>{f("/signin/auth")}),[f]),F=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return g.jsx(B,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
+ 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 +1 @@
1
- import{j as _}from"./liveblocks-DOBkg1D1.js";import{a as f}from"./sentry-B0nIwgR6.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-D5xlmXJj.js";import{fB as ne,Tc as xe,Td as se,g5 as Ne,fA as Pe,Tm as Re,Tf as je,Tg as Ve,pX as Oe,gi as Le,Tj as b,To as Ue,Tp as J,gj as Ze,Tq as ze,Dr as He,g_ as qe,cS as We,Tr as Ye,g4 as Ke,gk as Xe}from"./zeni-epic-state-DVQQo6UD.js";import{w as Je,i as Qe,_ as ea,O as aa,c as ta,e as na,u as sa,y as c,f as oa,W as ia,z as ra,d as da,k as ca,F as la,o as ua,l as fa,n as Q,L as ma,C as ha,H as ba,p as S,j as ee,s as pa,K as ae,x as ga,A as Sa}from"./index-waurk8Yr.js";import{D as ka}from"./mui-DpenkF9f.js";import{u as Ta}from"./InboxNotificationsProvider-B9BL9-5c.js";import{u as Ea}from"./useTaskManagerAccess-Boniioo_.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]="7b9423f8-e906-4a1e-8c50-8f6b5ade7a61",l._sentryDebugIdIdentifier="sentry-dbid-7b9423f8-e906-4a1e-8c50-8f6b5ade7a61")}catch{}})();const Ca=Je((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Me(),B=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]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,x=F("/:tenantEmailDomain/reports")!==null,m=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)));f.useEffect((()=>{E&&C&&!m&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[E,C,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Le(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled: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();f.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),f.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]),f.useEffect((()=>{E&&T&&!m&&O.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[E,T,m,O.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(J({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.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,q=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];me===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const W=t((e=>ze(e,h).fetchState)),Y=t((e=>He(e).fetchState)),ye=A&&(W==="Completed"||W==="Error")||x&&(Y==="Completed"||Y==="Error")||!A&&!x?void 0:"disabled",we=f.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=We(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&Ye(P.notificationSettings,p.userEmail,N,o,T),K=da(),Fe=K&&ca(a);return _.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:Q(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:K,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,_e=ae(X)&&X!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(Xe()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(ma.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Ke({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:T,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Qe(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
1
+ import{j as _}from"./liveblocks-BohEqL-M.js";import{a as f}from"./sentry-DZasNYxC.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-BGTqSI0U.js";import{fB as ne,SY as xe,SZ as se,g5 as Ne,fA as Pe,T3 as Re,S_ as Ve,S$ as je,pF as Le,gi as Oe,T2 as b,T5 as Ue,T6 as Q,gj as Ze,T7 as ze,Db as He,g_ as Ye,cS as qe,T8 as We,g4 as Je,gk as Ke}from"./zeni-epic-state-BD9w4cbh.js";import{w as Qe,i as Xe,c as ea,I as aa,e as ta,g as na,u as sa,d as c,h as oa,F as ia,z as ra,f as da,l as ca,n as la,s as ua,o as fa,q as X,L as ma,D as ha,H as ba,p as g,k as ee,y as pa,M as ae,B as Sa,C as ga}from"./index-Bkd2suv7.js";import{D as ka}from"./mui-Bm9pLHsq.js";import{u as Ea}from"./InboxNotificationsProvider-CP3zxjLQ.js";import{u as Ta}from"./useTaskManagerAccess-DoD7gL98.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]="5c703fca-141e-4ffc-84c2-8eb38d30f615",l._sentryDebugIdIdentifier="sentry-dbid-5c703fca-141e-4ffc-84c2-8eb38d30f615")}catch{}})();const Ca=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Me(),B=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=Ta(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Re),G=$.uiState.currentChatSessionId,T=na(),{setLoading:re}=sa(),[w,M]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,x=F("/:tenantEmailDomain/reports")!==null,m=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=>Ve(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>je(e)));f.useEffect((()=>{T&&C&&!m&&v.fetchState==="Not-Started"&&r(Le(!0))}),[T,C,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Oe(e):[])),S=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),Te=t((e=>b(e).reducedFetchCountState)),V=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ea();f.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),f.useEffect((()=>{T&&E&&!m&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[T,E,m,L.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Te,count:Ee},H=s!=null?ra.getSignedInUserTenant(s):null,Y=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];me===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const q=t((e=>ze(e,h).fetchState)),W=t((e=>He(e).fetchState)),ye=A&&(q==="Completed"||q==="Error")||x&&(W==="Completed"||W==="Error")||!A&&!x?void 0:"disabled",we=f.useMemo((()=>Ye(o.userRole)),[o.userRole]),Ae=qe(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&We(P.notificationSettings,p.userEmail,N,o,E),J=da(),Fe=J&&ca(a);return _.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:Y!=null?[Y]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:J,onNotificationIconClick:()=>{i(!1);let e=V===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=V===0&&j>0?"../../notifications/comments":"../../notifications/tasks");const u=g(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=g(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:g(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=g(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=g(a.state?.pathnameStackToGoBack,a.pathname),K=e.type,_e=ae(K)&&K!=="command_center";if(ae(e.type)&&S[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(S[o.tenantId].month,S[o.tenantId].year,"Sidebar"),_e&&S[o.tenantId]!=null){const y=S[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=Sa(e.type);ga(e.type)?(G!=null&&r(Ke()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(ma.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Je({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:Se,newYearAnimationEnabled:ge})})})),Ba=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Xe(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-BohEqL-M.js";import{h as r,l as i}from"./core-BGTqSI0U.js";import{ak as n}from"./index-Bkd2suv7.js";import"./mui-Bm9pLHsq.js";import"./sentry-DZasNYxC.js";import"./zeni-epic-state-BD9w4cbh.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.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};
@@ -0,0 +1 @@
1
+ import{m as mt,a as lt,n as ft,j as N}from"./liveblocks-BohEqL-M.js";import ut from"./NotFoundScreen-CGJyt_LJ.js";import{a as k}from"./sentry-DZasNYxC.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 Z}from"./core-BGTqSI0U.js";import{cz as It,S_ as O,fB as X,g_ as Tt,T2 as b,$V as H,T6 as m,SZ as E,zt as j,F9 as Ct,$W as yt,SY as Et,T8 as At,zy as _t,$X as M,br as F,gd as x,zC as J,$Y as Nt,cL as Bt,cE as wt}from"./zeni-epic-state-BD9w4cbh.js";import{ao as xt,e as vt,I as Rt,d as Dt,aq as Pt,dI as Gt,p as B,dJ as Ut,w as $t,dK as Mt,i as Ft,a2 as jt}from"./index-Bkd2suv7.js";import"./mui-Bm9pLHsq.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-DNmjed6f.js";import{u as zt}from"./useTaskManagerAccess-DoD7gL98.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.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]="b43d38ef-41d5-41a5-96e5-d8b7092fe39e",t._sentryDebugIdIdentifier="sentry-dbid-b43d38ef-41d5-41a5-96e5-d8b7092fe39e")}catch{}})();const Lt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),Wt=St((function(t,l){const n=O(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=X(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&At(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:R}=l;return{onNotificationClick:(a,s,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/${s}`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(J("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(M([a],F())));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,s)=>{t(E(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(H(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(j("task_manager","dashboard",d))}else R?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(J("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(M([i],F())))}))).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(o,I).then((()=>{t(M(o,F())),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((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=jt(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))($t(Mt)),Yt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=vt(),[I,R]=k.useState(!1),a=S((e=>O(e))),s=S((e=>X(e))),{useFeatureGate:d}=Rt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Pt({isDataReady:!0});const Q=Tt(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),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)),st=Gt().allUsers,{inboxNotifications:w,isLoading:A,hasFetchedAll:C,isFetchingMore:G,fetchMore:ot}=mt(),{threads:L,isLoading:W,fetchMore:Y,isFetchingMore:q,hasFetchedAll:K}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(z!==c&&c!=null&&o(H(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"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(A===!1&&C===!0&&s?.companyId!=null&&w!=null){const e=`dashboard_${s.companyId}`,p=w.filter((y=>y.roomId===e&&y.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(E({unreadCount:p},"comments"))}}),[A,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const U=A||G===!0||C!==!0||A||G===!0||C!==!0;k.useEffect((()=>{U&&P!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):U||P!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[U,P]),k.useEffect((()=>{o(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(R(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(A===!1&&W===!1&&w!=null&&L!=null){const e=`dashboard_${s.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 $=L.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return $!=null?{inboxNotification:{...u,threadId:$.id},thread:$}:(q||K===!0||Y==null||Y(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(E({totalCount:_.length,unreadCount:y.length},"comments")),o(yt(ct))}}),[A,G,q,C,K,W,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(Ft(p)){const y=Et(p.mode);if(y==="dashboard"&&o(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),o(j("task_manager",y,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=zt(f);return N.jsx(Wt,{tenantEmailDomain:n,loggedInUserRoleMap:Q,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(Z,{path:"/:selectedTab",element:N.jsx(Yt,{})}),N.jsx(Z,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-BohEqL-M.js";import{a as r}from"./sentry-DZasNYxC.js";import{u as A,g as C,j as o,N as j}from"./core-BGTqSI0U.js";import{Ty as z,fB as P,gi as x,Tz as D,TA as M,TB as R,TC as B,pw as k,Sh as L}from"./zeni-epic-state-BD9w4cbh.js";import{z as h,af as I}from"./index-Bkd2suv7.js";import"./mui-Bm9pLHsq.js";import"./recharts-DZSO8gqO.js";import"./analytics-nbGnR8yw.js";import"./plaid-DdB4B-ZM.js";import"./dnd-SEGszg0m.js";import"./stripe-cKAAJElX.js";import"./lottie-3kdnx6OO.js";import"./lexical-DtJP5Abm.js";import"./pdf-CSx-lDs_.js";import"./utils-CgRt4NQh.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]="cc779f62-37dc-4c1a-acfa-672e1c6f32db",n._sentryDebugIdIdentifier="sentry-dbid-cc779f62-37dc-4c1a-acfa-672e1c6f32db")}catch{}})();function ee(){const n=A(),a=C(),{params:t,error:i}=r.useMemo((()=>z(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),f=h.isSignedIn(),s=h.getSignedInUser(),p=o((e=>P(e))),l=o((e=>x(e))),c=o((e=>e.tenantState.fetchState)),y=o(D),S=o(M),d=o(R),[v,b]=r.useState(null),[T,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(B())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{f&&s!=null&&!g.current&&(c!=="Not-Started"&&c!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[f,s,c,n]),r.useEffect((()=>{d!=null&&d!==""&&(window.location.href=d)}),[d]);const _=r.useMemo((()=>{if(p?.tenantId!=null)return p.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((U=>U.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[p?.tenantId,l]),u=v??_;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):f?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:c!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:b,approveError:T??S,isApproving:y==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&s!=null&&u!=null&&n(L(s.userId,s.zeniSessionId??void 0,u,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{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(j,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};