@zeniai/web-app-ui 5.3.48-prod → 5.3.49-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/assets/AccountMappingScreen-CiRabt-E.js +9 -0
  2. package/dist/assets/ActualMatchingMatchDetailScreen-CrIjNeef.js +1 -0
  3. package/dist/assets/AddressRoutes-B4RpxW72.js +1 -0
  4. package/dist/assets/AddressScreen-CPQlppZ3.js +9 -0
  5. package/dist/assets/{AiCfoScreen-C9Bg0rc2.js → AiCfoScreen-DcV74Vwb.js} +3 -3
  6. package/dist/assets/{AppDrawer-mVJiMIum.js → AppDrawer-DEmhHxBl.js} +3 -3
  7. package/dist/assets/{BillPayApprovalRoutes-LpF3ZsUF.js → BillPayApprovalRoutes-DRDBSjZr.js} +1 -1
  8. package/dist/assets/BillPayRoutes-BVerU8xr.js +119 -0
  9. package/dist/assets/BusinessVerificationPageScreen-R4BiNdXk.js +9 -0
  10. package/dist/assets/CardsAiCfoScreen-SCqXPmm9.js +14 -0
  11. package/dist/assets/ChargeCardRoutes-Dxl-Fr5T.js +71 -0
  12. package/dist/assets/CompanyPassportScreen-CHE321d6.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-if4-dQ5X.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-qafzPnCc.js +1 -0
  15. package/dist/assets/CustomerOnboardingRoutes-BjVLhsMv.js +30 -0
  16. package/dist/assets/{DashboardRoutes-BfA8WmEc.js → DashboardRoutes-Def0G9RV.js} +4 -4
  17. package/dist/assets/DefaultTenantHome-DrLH_DYg.js +1 -0
  18. package/dist/assets/DomesticWireDetailScreen-DnnWI2yA.js +18 -0
  19. package/dist/assets/DrawerScreen-CEC7Mn0M.js +1 -0
  20. package/dist/assets/EntityDetailRoutes-CJi5JMBH.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-DjNAjdBg.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-DTAcqRMm.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-BKVqVZzZ.js +1 -0
  24. package/dist/assets/InboxNotificationsProvider-Dwt_tkdC.js +1 -0
  25. package/dist/assets/InvoicingRoutes-CDGhZRcq.js +2 -0
  26. package/dist/assets/MagicLinkRoutes-DJrPTlpH.js +72 -0
  27. package/dist/assets/MagicLinkSignInScreen-tE33HPhZ.js +12 -0
  28. package/dist/assets/MobileAppDrawer-CCUOxU5h.js +1 -0
  29. package/dist/assets/NotFoundScreen-CaUndFTs.js +1 -0
  30. package/dist/assets/NotificationRoutes-D_aWgIj_.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-XzMLC3jd.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-G1iTHjWf.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-YNYH1WFu.js → PaymentLinkScreen-CTXKytOV.js} +1 -1
  34. package/dist/assets/PeopleRoutes-BCTJIMEm.js +22 -0
  35. package/dist/assets/PerformanceRoutes-VB7l7YHB.js +1 -0
  36. package/dist/assets/{Preview-aKYFA87T.js → Preview-qQlP44Bb.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-BbQ0Hnnf.js → QBOConnectionScreen-B613NNPN.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-Oot7vjoE.js +1 -0
  39. package/dist/assets/ReimbursementApprovalRuleDetailScreen-BbbYw1r6.js +1 -0
  40. package/dist/assets/ReimbursementRoutes-fet7iW_N.js +68 -0
  41. package/dist/assets/{ReportsRoutes-D-VPBQAr.js → ReportsRoutes-BiU3IfXy.js} +1 -1
  42. package/dist/assets/RewardsRoutes-KyVRs2V6.js +1 -0
  43. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BeylIkiO.js +33 -0
  44. package/dist/assets/ScreenRoutes-p1iqGjnv.js +2 -0
  45. package/dist/assets/{SettingsRoutes-Rso1IOsm.js → SettingsRoutes-DgAnzCiw.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-LKt8HYp6.js → SetupPagesScreen-C3gLfyZJ.js} +5 -5
  47. package/dist/assets/SignInScreen-C1PbWtoo.js +1 -0
  48. package/dist/assets/SignOutScreen-BBj0h9la.js +9 -0
  49. package/dist/assets/TaskListScreen-bZId4AF3.js +9 -0
  50. package/dist/assets/TaskRoutes-DCL22vAl.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-BAFfn1JT.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-DaJqMIrN.js +5 -0
  53. package/dist/assets/TransactionListRoutes-CbPBDWZp.js +1 -0
  54. package/dist/assets/TreasuryRoutes-CGBE-vV8.js +37 -0
  55. package/dist/assets/{VendorsRoutes-DJl_Bw4p.js → VendorsRoutes-D_EkjlrJ.js} +17 -17
  56. package/dist/assets/{WiseConfirmationScreen-CSAINH6m.js → WiseConfirmationScreen-BNDdfueF.js} +2 -2
  57. package/dist/assets/{ZeniAccountRoutes-B6oE8Yh9.js → ZeniAccountRoutes-Cf1eI0DS.js} +11 -11
  58. package/dist/assets/ZeniAccountStatementScreen-BN-JxJMw.js +9 -0
  59. package/dist/assets/{accountMappingHelper-CxxPvdp5.js → accountMappingHelper-ZA3eE2RB.js} +1 -1
  60. package/dist/assets/{analytics-Bc0tpVvR.js → analytics-EJdRN0EM.js} +1 -1
  61. package/dist/assets/analyticsHelper-yYV2XYgm.js +1 -0
  62. package/dist/assets/{core-DXy8qYxx.js → core-DrG65cn7.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-i_WbC8Eq.js → decodeURIComponentSafe-Cq-VPmfw.js} +1 -1
  64. package/dist/assets/{dnd-BudWE9Kd.js → dnd-ySxwrcGd.js} +1 -1
  65. package/dist/assets/{empty-BIBfJ7bs.js → empty-HkstFjkG.js} +1 -1
  66. package/dist/assets/{empty-BjaVp8vL.js → empty-hypZVcyj.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-ChBB9GKO.js → emptyVideoElement-hQo6iMam.js} +1 -1
  68. package/dist/assets/epic-BPI4oO0H.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-BhQOMrvk.js +1 -0
  70. package/dist/assets/getLocaleForTenant-DB6O4KHG.js +1 -0
  71. package/dist/assets/{index-B_nFXyZV.js → index-BRSI70wf.js} +31522 -30719
  72. package/dist/assets/index-CItropkZ.js +1 -0
  73. package/dist/assets/{index-DJ_v-eLQ.js → index-CNxuKyrU.js} +1 -1
  74. package/dist/assets/{index-Cu__FEuv.js → index-CdqEwb4U.js} +1 -1
  75. package/dist/assets/{index-B6ay0m0-.js → index-Cju_tsP9.js} +1 -1
  76. package/dist/assets/{index-BCli66Nd.js → index-Csgz6JKS.js} +2 -2
  77. package/dist/assets/{index-BskN_1C2.js → index-D2y8Uf4E.js} +1 -1
  78. package/dist/assets/{index-UkUJrppQ.js → index-DWaMzRgO.js} +1 -1
  79. package/dist/assets/{lexical-Bc65Y22S.js → lexical-DsG4GgCt.js} +1 -1
  80. package/dist/assets/{liveblocks-CkaMgIPV.js → liveblocks-DJozFz1F.js} +2 -2
  81. package/dist/assets/{lottie-BsZINv8t.js → lottie-B54UhbRD.js} +1 -1
  82. package/dist/assets/{mui-CAWQsNKw.js → mui-DqsEgFea.js} +1 -1
  83. package/dist/assets/{pathToGoBack-DVU4AZHu.js → pathToGoBack-Cvep4Zpb.js} +1 -1
  84. package/dist/assets/{pdf-9wBTCpn0.js → pdf-0ccxH7eS.js} +3 -3
  85. package/dist/assets/{pdf-lib-C76zLWzx.js → pdf-lib-CYVFTJz1.js} +1 -1
  86. package/dist/assets/{plaid-BG5uwLog.js → plaid-KeCmRFX0.js} +1 -1
  87. package/dist/assets/{pusher-CrcJUCra.js → pusher-63t06gfb.js} +1 -1
  88. package/dist/assets/{react-Dm9xpZ6w.js → react-BNSYzriL.js} +1 -1
  89. package/dist/assets/{react-CGdADwhF.js → react-CAoDTuLJ.js} +1 -1
  90. package/dist/assets/{react-Dr4moq0v.js → react-Ca5GapOf.js} +1 -1
  91. package/dist/assets/{react-MJO7kkDf.js → react-CjVnH7Ak.js} +1 -1
  92. package/dist/assets/{react-xQUZFk6h.js → react-DoOX0jE5.js} +1 -1
  93. package/dist/assets/{react-El9aXEmK.js → react-xEeg46_z.js} +1 -1
  94. package/dist/assets/{recharts-CAIrfNJf.js → recharts-Bmrae78L.js} +1 -1
  95. package/dist/assets/{routePaths-D06QlT-0.js → routePaths-C_2IfGnd.js} +1 -1
  96. package/dist/assets/{sentry-FXaA5ZQP.js → sentry-C1W0cBeR.js} +1 -1
  97. package/dist/assets/stripSplatSuffix-Dk3dK5Wm.js +1 -0
  98. package/dist/assets/{url-Cc0HhTeH.js → url-BrtuL5Mk.js} +1 -1
  99. package/dist/assets/{url-CkocCMQo.js → url-C0aMyBCn.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CQ1E-c6g.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B4wwXC6_.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-DgHBW0CH.js +1 -0
  103. package/dist/assets/useChargeCardPusherEvents-B1YNDwMw.js +1 -0
  104. package/dist/assets/{useDeviceId-DCoG-oVS.js → useDeviceId-BQkxGsaf.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-ezN2mPba.js +1 -0
  106. package/dist/assets/useInitialThreadRequest-CIOY8QiT.js +1 -0
  107. package/dist/assets/useTaskManagerAccess-CeXMA9mP.js +1 -0
  108. package/dist/assets/{utils-DgNeUN4L.js → utils-BYrZSa_o.js} +1 -1
  109. package/dist/assets/withTransactionSidePanel-M6DARYy7.js +25 -0
  110. package/dist/assets/{zeni-epic-state-CAhHL5dL.js → zeni-epic-state-1I_oueWp.js} +6 -6
  111. package/dist/index.html +1 -1
  112. package/package.json +6 -6
  113. package/dist/assets/AccountMappingScreen-B06EpRbR.js +0 -9
  114. package/dist/assets/AddressRoutes-BF55QQYD.js +0 -1
  115. package/dist/assets/AddressScreen-CpoDm3PV.js +0 -9
  116. package/dist/assets/BillPayRoutes-Sfb9gCxs.js +0 -119
  117. package/dist/assets/BusinessVerificationPageScreen--NfL1EkU.js +0 -9
  118. package/dist/assets/CardsAiCfoScreen-DFx68se-.js +0 -14
  119. package/dist/assets/ChargeCardRoutes-BPKaW2_S.js +0 -71
  120. package/dist/assets/CompanyPassportScreen-BJxOkfhd.js +0 -1
  121. package/dist/assets/ConnectionAuthScreen-B3kapXjM.js +0 -11
  122. package/dist/assets/CustomerOnboardingAuthScreen-DJfKwP3x.js +0 -1
  123. package/dist/assets/CustomerOnboardingRoutes-dWPH9jl0.js +0 -30
  124. package/dist/assets/DefaultTenantHome-CYdeNw_i.js +0 -1
  125. package/dist/assets/DomesticWireDetailScreen-BunkSxqk.js +0 -18
  126. package/dist/assets/DrawerScreen-fToso3cB.js +0 -1
  127. package/dist/assets/EntityDetailRoutes-MkBmVGVd.js +0 -1
  128. package/dist/assets/ExpenseAutomationRoutes-BqUs9R1V.js +0 -38
  129. package/dist/assets/FeaturePreviewScreen-aUVFZ3iq.js +0 -1
  130. package/dist/assets/HubSpotOAuthCallbackScreen-16B1Uahk.js +0 -1
  131. package/dist/assets/InboxNotificationsProvider-DJp6pjjP.js +0 -1
  132. package/dist/assets/InvoicingRoutes-BSmyglZ4.js +0 -2
  133. package/dist/assets/MagicLinkRoutes-BYCZg5zW.js +0 -72
  134. package/dist/assets/MagicLinkSignInScreen-9jvM9QWH.js +0 -12
  135. package/dist/assets/MobileAppDrawer-DpgQmBN2.js +0 -1
  136. package/dist/assets/NotFoundScreen-BVgwFimi.js +0 -1
  137. package/dist/assets/NotificationRoutes-JoNRJC6_.js +0 -1
  138. package/dist/assets/OAuthConsentScreen-9R-LR9-2.js +0 -1
  139. package/dist/assets/PandLWithForecastRoutes-DT_vZtto.js +0 -1
  140. package/dist/assets/PeopleRoutes-Cj8neNpT.js +0 -22
  141. package/dist/assets/PerformanceRoutes-CkWbPW9G.js +0 -1
  142. package/dist/assets/ReimbursementApprovalRoutes-CAO6ua6C.js +0 -1
  143. package/dist/assets/ReimbursementApprovalRuleDetailScreen-Fq6GGnj1.js +0 -1
  144. package/dist/assets/ReimbursementRoutes-C8641LUP.js +0 -68
  145. package/dist/assets/RewardsRoutes-C8RVCaxF.js +0 -1
  146. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BkSa25TV.js +0 -25
  147. package/dist/assets/ScreenRoutes-CyTUQPjF.js +0 -2
  148. package/dist/assets/SignInScreen-Cv8cagXO.js +0 -1
  149. package/dist/assets/SignOutScreen-mk1yLH0e.js +0 -9
  150. package/dist/assets/TaskListScreen-CZMSQm9F.js +0 -9
  151. package/dist/assets/TaskRoutes-C5eP6C-m.js +0 -9
  152. package/dist/assets/TransactionDetailRoutes-CVfL5bGM.js +0 -1
  153. package/dist/assets/TransactionDetailScreen-Dnj1nFNo.js +0 -5
  154. package/dist/assets/TransactionListRoutes-BgmPqG4c.js +0 -1
  155. package/dist/assets/TreasuryRoutes-BJhqMuTe.js +0 -37
  156. package/dist/assets/ZeniAccountStatementScreen-Ag5m-2GQ.js +0 -9
  157. package/dist/assets/analyticsHelper-CXn_eNMS.js +0 -1
  158. package/dist/assets/epic-Bvd2KeDi.js +0 -2
  159. package/dist/assets/expenseAutomationHelper-DI7vaQ4W.js +0 -1
  160. package/dist/assets/getLocaleForTenant-_Y7RIpao.js +0 -1
  161. package/dist/assets/index-BqbRbYFl.js +0 -1
  162. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BsMxhXzK.js +0 -1
  163. package/dist/assets/useAskAiCfoHostNavButtonProps-CzTJhOoN.js +0 -1
  164. package/dist/assets/useChargeCardPusherEvents-Crzo5EYT.js +0 -1
  165. package/dist/assets/useEmailConnectResultRefresh-wgM5Bz2X.js +0 -1
  166. package/dist/assets/useInitialThreadRequest-xYrFECCf.js +0 -1
  167. package/dist/assets/useTaskManagerAccess-B9H1fkY9.js +0 -1
  168. package/dist/assets/withTransactionSidePanel-BV-TPFVx.js +0 -25
@@ -0,0 +1,38 @@
1
+ import{j as b}from"./liveblocks-DJozFz1F.js";import{u as he,h as nt,g as be,j as _,i as Ue,t as Yn,l as Hn,n as Kn,o as He,N as Qn}from"./core-DrG65cn7.js";import{fF as ke,a0V as Zn,q0 as _e,U3 as Xn,z$ as es,a0W as ts,a0X as as,a0Y as ns,a0Z as gt,a0_ as Qe,gh as bt,a0$ as ca,eW as ss,g0 as os,a10 as ia,a11 as Ze,qT as cs,uN as is,gS as ls,gQ as rs,a12 as ds,r4 as us,rd as ms,qb as ps,qp as wa,gP as re,gR as hs,a13 as Ss,qL as Ra,re as gs,qm as Cs,qh as fs,uT as Is,gO as Me,a14 as tt,C9 as Da,Mp as Fa,a15 as _a,Fs as Ma,a16 as ks,eZ as bs,e$ as Ts,sP as Tt,WO as la,WQ as Ps,m2 as ys,WR as vs,m9 as Es,dl as As,Ds as Pt,a17 as xs,a18 as ws,fm as yt,sD as ra,WI as Rs,a19 as Ds,a1a as Fs,mb as _s,a1b as Ms,R5 as Os,ma as Us,l$ as Bs,qE as Oa,rj as at,tp as Ua,tL as Vs,TV as Ba,ri as da,rl as Va,rn as js,bE as zs,ny as $s,nv as Ls,rm as Xe,rk as pe,a1c as Gs,rE as ua,a1d as Ns,a1e as qs,sH as Js,sI as Ws,WE as Ys,VK as Hs,a0n as Ks,a1f as Qs,WK as ma,WJ as Ke,a1g as pa,mq as Zs,a1h as Xs,a1i as eo,a1j as to,a1k as ao,qz as no,a1l as so,a1m as oo,a1n as co,ru as io,md as lo,m4 as ro,a1o as uo,mc as ha,W$ as mo,a1p as po,a1q as ho,uo as So,t$ as go,t_ as Ct,a1r as Co,a1s as fo,a1t as Io,a1u as ko,nJ as bo,br as To,nE as Sa,nq as Po,a1v as yo,g$ as vo,nB as Eo,sR as Ao,sT as xo,sA as wo,VN as Ro,VO as Do,EW as Fo,EV as _o,Fa as Mo,a1w as ga,sG as Oo,a1x as Uo,rU as Bo,r_ as Vo,s9 as jo,rX as zo,a1y as $o,s8 as Lo,sM as Go,a1z as No,sZ as qo,su as Jo,t2 as Wo,sz as Yo,rF as Ho,a1A as Ko,qX as Qo,qv as Zo,qC as Ca,rp as Xo,a1B as ec,a1C as tc,a1D as ac,a1E as nc,a1F as sc,a1G as oc,t6 as cc,a1H as ic,a1I as lc,a1J as fa,uz as rc,tS as dc,tH as Ia,tF as uc,a1K as mc,tu as pc,t9 as hc,tI as Sc,a1L as gc,a1M as Cc,tf as fc,a1N as Ic,ta as kc,te as bc,tc as Tc,tO as Pc}from"./zeni-epic-state-1I_oueWp.js";import ja from"./NotFoundScreen-CaUndFTs.js";import{a as s,R as za}from"./sentry-C1W0cBeR.js";import{n as Te,S as yc}from"./mui-DqsEgFea.js";import{c as Be,A as H,k as Z,p as te,ar as $a,at as La,dR as vc,dS as Ec,J as Ga,z as st,dT as Ac,dU as xc,dV as wc,af as Oe,dW as Rc,dX as ka,bb as ba,dY as Dc,a8 as Na,dZ as Fc,j as et,a as _c,d_ as Mc,d$ as Oc,M as Uc,Q as Bc,e0 as Vc,e1 as jc,e2 as zc,b5 as $c,bs as Lc,ac as Gc,b6 as Nc,b7 as qc,G as Jc,w as Wc,e3 as Yc,aw as Ta,e4 as Hc}from"./index-BRSI70wf.js";import{u as qa}from"./useAskAiCfoHostNavButtonProps-DgHBW0CH.js";import{g as Pa,b as Kc,c as Qc,h as Zc,a as Xc,i as ei,r as ti,C as ai}from"./TransactionDetailScreen-DaJqMIrN.js";import{u as ni}from"./useActualMatchingMatchDetail-CQ1E-c6g.js";import{d as si}from"./decodeURIComponentSafe-Cq-VPmfw.js";import{m as Ja,a as Wa}from"./expenseAutomationHelper-BhQOMrvk.js";import{u as Ya,a as Ha,w as oi}from"./withTransactionSidePanel-M6DARYy7.js";import{b as ci,S as ii,a as li,J as ri}from"./ScheduleDetailsPrepaidExpensesScreen-BeylIkiO.js";import{s as ya,i as Ka,h as di,v as ui,c as mi}from"./routePaths-C_2IfGnd.js";import{a as ft}from"./accountMappingHelper-ZA3eE2RB.js";import{D as pi}from"./DrawerScreen-CEC7Mn0M.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.js";import"./useInitialThreadRequest-CIOY8QiT.js";import"./stripSplatSuffix-Dk3dK5Wm.js";import"./pathToGoBack-Cvep4Zpb.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="3ec4f87d-0301-448c-aa28-24747b67f484",t._sentryDebugIdIdentifier="sentry-dbid-3ec4f87d-0301-448c-aa28-24747b67f484")}catch{}})();const hi=()=>{const t=he(),n=nt(),f=be(),I=_((C=>ke(C))),{useFeatureGate:k}=Be(),{isFeatureEnabled:o}=k(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=k(H.aiAuditScorePercentage),E=_((C=>C.expenseAutomationViewState.selectedPeriodByTenantId)),l=_((C=>Zn(C,I.tenantId))),{isAiCfoAccessEnabled:S,onAskAiCfoClick:R}=qa({mobileExploreReferrer:"Month-End Close Overview"}),x=s.useCallback(((C,h,z=!1)=>{t(_e({tenantId:h,period:{month:C.month,year:C.year},refreshViewInBackground:z}))}),[]),m=s.useCallback((C=>{const h=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Z.trackMonthCloseAuditPage(C.month,C.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null),t(Xn(I.tenantId,C))}),[I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),g=E[I.tenantId],u=s.useCallback((()=>{const C=f.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Z.trackMonthCloseAuditPage(g.month,g.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,C??null),x(g,I.tenantId,!0)}),[x,g,I.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),F=te(f.state?.pathnameStackToGoBack,f.pathname),A=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&g!=null){const C=l.monthEndCloseChecks.monthEndCloseCheckList.find((h=>h.progress<100));if(C!=null)return void n(`./${C.id}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}});n(`./month_end_insights/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,g]),{areTenantIdsInSync:p}=$a();return La({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{g!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&x(g,I.tenantId)}),[x,g,l.fetchState,I.tenantId,p]),s.useEffect((()=>{g!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(es(g))}),[g,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const C=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(C)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const C=f.state?.referrer;Z.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,C??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),b.jsx(Si,{children:b.jsx(vc,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:o,onMonthEndCheckClick:C=>{n(`./${C}/${g.month}-${g.year}`,{state:{pathnameStackToGoBack:F,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:m,handleReviewButtonClick:A,onBackClick:()=>{n("../../dashboard")},onReload:u,isAiCfoAccessEnabled:S,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},Si=Te.div`
2
+ display: flex;
3
+ height: 100vh;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ background-color: ${t=>t.theme.colors.grey4};
8
+ `;function gi({isFullView:t,matchId:n,onClose:f}){const{match:I,detailFetchState:k,handleOpenBill:o,handleContinueMatch:r,handleRefresh:E,handleUndoReversal:l,lastMatchResults:S,lastUndoResults:R,refreshStatus:x,undoReversalStatus:m}=ni(n);return b.jsx(Ec,{match:I,detailFetchState:k.fetchState,isRenderedInPanel:!t,isUndoInFlight:m.fetchState==="In-Progress",refreshStatus:x.fetchState,onNavigateBack:f,onOpenBill:o,onContinueMatch:r,onRefresh:E,onUndoReversal:l,lastMatchResults:S,lastUndoResults:R})}const Ci=/^match\/([^/?]+)$/,fi=Ha({displayNamePrefix:"withActualMatchingSidePanel",usePanelSetup:function(t){const{useFeatureGate:n}=Be(),{isFeatureEnabled:f}=n(H.isTransactionDetailSplitViewEnabled),{isFeatureEnabled:I}=n(H.isAccrualEnabled),k=Ga(),o=(function(E=!0){const l=nt(),S=be(),R=Ue(),x=Ja(R),m=Ya({childPathPattern:Ci,enabled:E,listPath:x}),g=m.matchGroups[0]!=null&&m.matchGroups[0]!==""?si(m.matchGroups[0]):void 0,u=R.tenantEmailDomain??S.pathname.split("/").find(Boolean)??"",F=s.useRef({isOpen:m.isOpen,matchId:g});F.current={isOpen:m.isOpen,matchId:g};const A=s.useCallback((h=>{!m.isMobile&&E?F.current.isOpen&&F.current.matchId===h?m.closePanel():m.navigateToChild(`match/${encodeURIComponent(h)}`,{replace:F.current.isOpen}):l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(h)}`)}),[l,m.isMobile,m.navigateToChild,m.closePanel,E,u]),p=s.useCallback((()=>{if(g==null)return;const h=te(S.state?.pathnameStackToGoBack,`${S.pathname}${S.search}`);l(`/${u}/expense-automation/actual-matching/${encodeURIComponent(g)}`,{state:{pathnameStackToGoBack:h}})}),[S.pathname,S.search,S.state,g,l,u]),C=m.isOpen&&g!=null;return{closePanel:m.closePanel,isOpen:C,maximize:p,matchId:E&&C?g:void 0,openPanel:A}})(t&&I===!0&&k===!0&&f===!0),r=s.useMemo((()=>{if(o.isOpen&&o.matchId!=null)return b.jsx(gi,{isFullView:!1,matchId:o.matchId,onClose:o.closePanel},o.matchId)}),[o.closePanel,o.isOpen,o.matchId]);return{injectedProps:s.useMemo((()=>({closeMatchSidePanel:o.closePanel,isMatchPanelOpen:o.isOpen,matchPanelContent:r,matchPanelMatchId:o.matchId,openMatchPanel:o.openPanel})),[r,o.closePanel,o.isOpen,o.matchId,o.openPanel]),selectedItemId:o.matchId,sidePanel:{closePanel:o.closePanel,maximize:o.maximize}}}}),Ii=za.memo((({reconciliation:t,selectedDrawerAccountId:n,onClose:f,onFetchLinkTokenClick:I,onEstablishConnectionClick:k})=>{const o=he(),{useFeatureGate:r}=Be(),{isFeatureEnabled:E}=r(H.isReconV3Enabled),{isFeatureEnabled:l}=r(H.isReconciliationCombinedStatementEnabled),S=st.getSignedInUser(),R=_((y=>ke(y))),x=s.useMemo((()=>({userId:S?.userId??"",sessionId:S?.zeniSessionId??"",tenantId:R?.tenantId??""})),[S?.userId,S?.zeniSessionId,R?.tenantId]),{accountReconciliationsByAccountID:m,excludedAccountIDs:g,monthYearPeriod:u,statementUploadChosen:F}=t,A=m[n],p=s.useMemo((()=>ts(m,n)),[m,n]),C=s.useMemo((()=>as(m)),[m]),h=s.useMemo((()=>ns(m,n)),[m,n]),z=s.useRef(!1),G=s.useCallback((y=>{z.current=y,ka(n,y)}),[n]),q=s.useCallback((y=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:y.completedSteps,startedAtMs:y.startedAtMs,totalDurationSeconds:y.totalDurationSeconds})),y.accountMappings!=null&&o(Qe({accountId:n,selectedPeriod:u,localData:{combinedStatementAccountMappings:y.accountMappings}})),A!=null&&requestAnimationFrame((()=>{z.current||o(bt({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:Ac(A)}]}))}))}),[o,u,A,n]),T=s.useCallback((()=>{o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,n,u]),J=s.useCallback((y=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:y}))}),[o,u,n]),N=s.useCallback((()=>{o(ca({accountId:n,selectedPeriod:u,backgroundCompletedSteps:0})),o(gt({accountId:n,selectedPeriod:u,dismissedToBackground:!1}))}),[o,u,n]);s.useEffect((()=>()=>{ka(null,!1)}),[]);const e=A?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??A?.accountReconEntity.statementMetaData?.statementUploadId,a=A?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,i=_((y=>a!=null&&a!==""?ss(os(y.userState,a)):"")),d=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u}))}),[o,n,u]),v=s.useCallback((()=>{o(ia({accountId:n,selectedPeriod:u})),o(Ze({statementUploadChosen:!0}))}),[o,n,u]),P=(y,$)=>{o(Is(y,$.split(".")[0]))},D=(y,$)=>{if($===!0){const Q=A?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??A?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(Q!=null&&Q!=="")return void o(Cs({accountId:n,selectedPeriod:u,combinedStatementGroupId:Q,fileId:y}))}e!=null&&o(fs({accountId:n,selectedPeriod:u,fileId:y,statementUploadId:e}))},M=()=>{o(Ze({statementUploadChosen:!1}))},W=y=>{o(gs({accountId:n,selectedPeriod:u,payload:y,statementAccountScope:l===!0?A?.localData?.statementAccountScope??"single_account":"single_account"}))},Y=s.useCallback(((y,$,Q)=>{o(cs({accountId:y,selectedPeriod:$,statementUploadId:Q}))}),[o]),se=s.useCallback(((y,$,Q,X,ge)=>{ge!=null&&ge!==""&&o(is(ge)),o(X==null||X===""?rs({accountId:y,selectedPeriod:$,statementUploadId:Q}):ls({accountId:y,selectedPeriod:$,statementUploadId:Q,combinedStatementGroupId:X}))}),[o]),ce=s.useCallback(((y,$)=>{$!==""&&o(ds({accountId:n,selectedPeriod:u,statementUpdateLocalData:y,statementUploadId:$}))}),[o,n,u]),Pe=s.useCallback((()=>{e!=null&&o(A?.localData?.statementAccountScope!=="multi_account"?ms({accountId:n,selectedPeriod:u,statementUploadId:e}):us({accountId:n,selectedPeriod:u,statementUploadId:e}))}),[o,A?.localData?.statementAccountScope,n,u,e]),ye=s.useCallback((y=>{e!=null&&o(ps({accountId:n,selectedPeriod:u,statementUploadId:e,accountMappings:y}))}),[o,u,n,e]),ve=s.useCallback((()=>{o(Ze({statementUploadChosen:!0}))}),[o]),K=y=>{o(Qe({accountId:n,selectedPeriod:u,localData:{accountSource:y}}))},B=y=>{o(Qe({accountId:n,selectedPeriod:u,localData:{statementAccountScope:y}}))},Ve=s.useCallback((()=>{o(wa({accountId:n}))}),[o,n]),Ee=s.useCallback((y=>{o(re(u,y,!0)),f()}),[o,u,f]),ot=s.useCallback((()=>{o(hs({accountId:n,selectedPeriod:u,statementProcessingFailed:!1})),o(Ss({accountId:n,selectedPeriod:u}))}),[o,n,u]),Se=s.useCallback((()=>{o(Ra({accountId:n}))}),[o,n]),je=g.includes(n)?t.excludedAccountReconciliationByAccountID[n]:void 0;if(je!=null)return b.jsx(va,{children:b.jsx(Ea,{$isV3:E===!0,children:b.jsx(xc,{excludedAccountReconciliation:je,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:E,onDismissClick:f,onIncludeIntoReconciliation:Se})})});if(A!=null){const y=E===!0?b.jsx(wc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,onSelectStatementAccountScope:B,isReconciliationCombinedStatementEnabled:l===!0,ledgerAccounts:p,statementOverrideWarningAccountIds:h,unavailableLedgerAccountIds:C,onConfirmStatementMapping:ye,filesEndPoint:Oe.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve,onRetryParsing:Y,onFetchStatementParseInfo:se,onReviewClicked:Ee,statementProcessingFailed:A.statementProcessingFailed,statementProcessingDismissedToBackground:A.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ot,onContinueInBackground:q,onClearStatementProcessingDismissedToBackground:T,onResetStatementProcessingProgress:N,onStatementProcessingProgressChange:J,onStatementFlowVisibilityChange:G,onReuploadStatement:ve,onStatementFormDataChange:ce,onStatementConfirmSave:Pe,reconciledByName:i,onDismissDateConflict:d,onReuploadAfterDateConflict:v,isReconV3Enabled:E}):b.jsx(Rc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:A,monthYearPeriod:u,onDismissClick:f,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:I,onEstablishConnectionClick:k,onEditFileName:P,onDeleteFile:D,onSelectSourceType:K,filesEndPoint:Oe.fileMicroServiceBaseUrl,authParams:x,openFilePicker:F,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:M,onExcludeFromReconciliation:Ve});return b.jsx(va,{children:b.jsx(Ea,{$isV3:E===!0,children:y})})}return null})),va=Te.div`
9
+ display: flex;
10
+ flex-direction: column;
11
+ height: 100%;
12
+ `,Ea=Te.div`
13
+ flex: 1;
14
+ min-height: 0;
15
+ display: flex;
16
+ flex-direction: column;
17
+ box-sizing: border-box;
18
+ min-width: 0;
19
+ overflow-x: hidden;
20
+ overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
21
+ `;function ki({panelType:t,scheduleId:n,onClose:f,onCloseAfterDecision:I}){return b.jsx(Ti,{children:b.jsx(Pi,{children:bi(t,n,f,I)})})}function bi(t,n,f,I){switch(t){case"one_time_accrual":return b.jsx(ri,{isRenderedInPanel:!0,accrualIdOverride:n,onPanelNavigateBack:f});case"accrued_expenses":return b.jsx(li,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"fixed_assets":return b.jsx(ii,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,onPanelNavigateBack:f,onPanelCloseAfterDecision:I});case"prepaid_expenses":return b.jsx(ci,{isRenderedInPanel:!0,scheduleDetailIdOverride:n,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:f,onPanelCloseAfterDecision:I})}}const Ti=Te.div`
22
+ display: flex;
23
+ flex-direction: column;
24
+ height: 100%;
25
+ `,Pi=Te.div`
26
+ flex: 1;
27
+ min-height: 0;
28
+ display: flex;
29
+ flex-direction: column;
30
+ box-sizing: border-box;
31
+ min-width: 0;
32
+ overflow-x: hidden;
33
+ overflow-y: auto;
34
+ `,yi=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,vi=Ha({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const n=(function(m=!0){const g=nt(),u=be(),F=he(),A=Ue(),p=Ya({childPathPattern:yi,enabled:m}),C=p.matchGroups[0],h=Ka(C)?C:void 0,z=p.matchGroups[1]!=null&&p.matchGroups[1]!==""?p.matchGroups[1]:void 0,G=p.isOpen&&h!=null&&z!=null,q=A.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",T=s.useRef({isOpen:G,scheduleId:z});T.current={isOpen:G,scheduleId:z};const J=s.useCallback(((e,a,i)=>{i!=null&&(a==="prepaid_expenses"||a==="fixed_assets")&&F(Ma({selectedJEScheduleKey:i})),!p.isMobile&&m?T.current.isOpen&&T.current.scheduleId===e?p.closePanel():p.navigateToChild(`schedule/${a}/${e}`,{replace:T.current.isOpen}):g(ya(a,e,q),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[F,g,p.isMobile,p.navigateToChild,p.closePanel,m,q]),N=s.useCallback((()=>{if(h==null||z==null)return;const e=te(u.state?.pathnameStackToGoBack,u.pathname);g(ya(h,z,q),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[g,h,z,q,u.pathname,u.state]);return{closePanel:p.closePanel,isOpen:G,maximize:N,openPanel:J,panelType:G?h:void 0,scheduleId:G?z:void 0}})(t),f=s.useRef(null),[I,k]=s.useState(null),o=s.useMemo((()=>({registerPanelDirtyGuard:m=>{f.current=m}})),[]),r=s.useCallback((m=>{f.current?.isDirty()===!0?k((()=>m)):m()}),[]),E=s.useCallback((()=>{r(n.closePanel)}),[r,n.closePanel]),l=s.useCallback((()=>{r(n.maximize)}),[r,n.maximize]),S=s.useCallback(((m,g,u)=>{r((()=>n.openPanel(m,g,u)))}),[r,n.openPanel]),R=s.useMemo((()=>{if(I!=null)return{onCancel:()=>k(null),onDiscard:()=>{f.current=null,k(null),I()}}}),[I]),x=s.useMemo((()=>{if(n.isOpen&&n.panelType!=null&&n.scheduleId!=null)return b.jsx(Dc.Provider,{value:o,children:b.jsx(ki,{panelType:n.panelType,scheduleId:n.scheduleId,onClose:E,onCloseAfterDecision:()=>{f.current=null,n.closePanel()}},`${n.panelType}:${n.scheduleId}`)})}),[n.isOpen,n.panelType,n.scheduleId,n.closePanel,E,o]);return{injectedProps:s.useMemo((()=>({closeSchedulePanel:E,isSchedulePanelOpen:n.isOpen,openSchedulePanel:S,schedulePanelContent:x,schedulePendingDiscardConfirmation:R})),[E,S,x,R,n.isOpen]),selectedItemId:n.scheduleId,sidePanel:{closePanel:E,maximize:l}}}});function Ei({companyId:t,closeCustomerRequestDrawer:n,addCustomerRequest:f,resetCustomerRequest:I}){const k=st.getSignedInUser();if(k==null)throw Error("Can't access Customer Request page without signing in...");const o=_((r=>ks(r,t,k)));return s.useEffect((()=>{I()}),[]),b.jsx(b.Fragment,{children:o.fetchState==="In-Progress"||o.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?b.jsx(Na,{fetchState:"In-Progress"}):b.jsx(Fc,{onCloseClick:n,addCustomerRequest:f,snippets:o.companyMonthEndReportTemplatesData,bulletPoints:o.zeniRequestsData??[]})})}const Ai={schedules:"Review Schedules",actual_matching:"Actual Matching",existing_schedules:"Existing Schedules"},xi=()=>{const t=_((R=>Me(R))),n=be(),{currentSelectedViewFetchState:f,currentSelectedView:I,selectedPeriod:k}=t,o=et(I),r=et(f.fetchState),E=t.jeSchedules.uiState.selectedPageTab??"schedules",l=et(E),S=s.useCallback((R=>{const x=n.state?.referrer;I==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?Z.trackTransactionsReviewPage(k.month,k.year,t.transactionView.totalCountByTab.review,0,R,x??null):Z.trackTransactionsAutoCategorisedPage(k.month,k.year,t.transactionView.totalCountByTab.autoCategorized,0,R,x??null)),I==="missing_receipts"&&Z.trackMissingReceiptsPage(k.month,k.year,R,t.missingReceipts.transactions.length,x??null),I==="je_schedules"&&Z.trackMonthCloseScheduleListPage(k.month,k.year,R,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(m=>{const g={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return m.forEach((u=>{if(bs(u))g.oneTimeAccrualCount+=1;else switch(Ts(u)){case"prepaid_expenses":g.prepaidCount+=1;break;case"fixed_assets":g.fixedAssetsCount+=1;break;case"accrued_expenses":g.accruedCount+=1}})),g})(t.jeSchedules.pendingReviewSchedules),Ai[E],x??null),I==="flux_analysis"&&Z.trackFluxAnalysisPage(k.month,k.year,R,wi(t.fluxAnalysis),x??null),I==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&Z.trackInsightsEmailPage(k.month,k.year,R,"draft",t.auditSummary.auditScorePercentage,null,x??null)}),[k,t,E]);return s.useEffect((()=>{(r!==f.fetchState||I!==o||I==="je_schedules"&&l!=null&&E!==l)&&f.fetchState==="Completed"&&S(!1)}),[I,f.fetchState,o,E,l]),S},wi=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:Ri,comma:Aa,space:Di}},dateFormat:Qa}=Jc.getLocalizedStrings(),xa=Pc,Fi=Hn((function(t,n){const{uncategorizedAccounts:f,vendorSearchAutoCompleteData:I,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,companyId:r,isMissingReceiptsBulkUploadEnabled:E,isTransactionActivityEnabled:l,newScheduleActiveType:S}=n,R=st.getSignedInUser(),x=t.tenantState.currentTenantId,m={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:x??""},g=Me(t),{selectedTransactionCategorizationTab:u}=g,{searchTransactionsResults:F,searchTransactionsFetchState:A}=Ns(t),p=S==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:C,classListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:z,newScheduleLocalData:G,saveStatus:q}=qs(t,p);return{expenseAutomationViewSelector:g,accountListNestedAccountHierarchy:C,allDepreciationAccountListNestedAccountHierarchy:z,baseTransactionSearchFetchState:A,baseTransactionSearchResults:F,classListNestedAccountHierarchy:h,newScheduleLocalData:G,initialSelectedBaseTransaction:G.selectedBaseTransactionId!=null?Js(t.transactionState,Ws(G.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Ys(t),newScheduleSaveStatus:q,bulkUploadSelector:E===!0?g.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:I,authParams:m,receiptUploadEndpoint:`${Oe.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${Ta}/transaction_attachments`,bulkUploadEndpoint:E===!0?`${Oe.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:g.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:k,monthEndInsightsPreviewMode:o,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:R,uncategorizedAccounts:f,companyId:r,isTransactionActivityEnabled:l,receiptsEmail:Ks(t.tenantState,x),downloadParams:{authParams:m,jeScheduleEndPoint:`${Ta}/jeScheduleReports`,timezone:Hs(),companyName:ke(t).companyName}}}),(function(t,n){const{themeState:f,isAccountingClassesEnabled:I,isCOTEnabled:k,isMissingReceiptsBulkUploadEnabled:o,location:r,vendorSearchAutoCompleteData:E,expenseAutomationViewSelector:l,currentTenant:S,newScheduleActiveType:R,uncategorizedAccounts:x,navigate:m,onClickCustomerRequest:g,handleEditClick:u,closeSchedulePanel:F,isSchedulePanelOpen:A,openSchedulePanel:p,setActivityLogTransactionId:C}=n,{selectedPeriod:h,currentSelectedView:z,reconciliation:{selectedAccountId:G}}=l,{accountSettingsView:q}=l.jeSchedules,T=Oa(h),J=at(T.start),N=at(T.end);return{onZeniLogoClick:()=>{f.toggle()},onUploadReceiptAttachment:e=>{Z.trackMissingReceiptAttached(h.month,h.year),t(dc(e))},onUploadTransactionReceipt:(e,a,i,d,v,P)=>{t(fa(e,a,{fetchState:"In-Progress"}));const D=()=>t(fa(e,a,{fetchState:"Error"}));Hc(`${Oe.accountMicroServiceBaseUrl}/1.0/transactions/${a}/attachments`,P,a,i,d,v).then((M=>{M!=null?t(rc(e,M)):D()})).catch(D)},onMissingReceiptsRowClick:(e,a)=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,a);const i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,a)=>{t(lc(e,a)),S!=null&&t(_e({tenantId:S.tenantId,period:a,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,a,i,d)=>{t(ic(e,{fetchState:a,error:i})),i!=null&&t(bt({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:d!=null?Di+Ri+d+Aa:Aa}]}))},onUpdateJESchedulesUIState:e=>{const a=l.jeSchedules.uiState,i=e.selectedPageTab!=null&&e.selectedPageTab!==a.selectedPageTab,d=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==a.selectedJETypeFilter;i&&n.closeMatchSidePanel?.(),A===!0&&(i||d)&&F?.(),e.createdGroupCollapsed!=null?t(nc()):e.pendingGroupCollapsed!=null?t(sc()):e.selectedJETypeFilter!==void 0?t(oc(e.selectedJETypeFilter)):t(cc(e))},onUpdateMissingReceiptsUIState:e=>{t(ac(e))},onFetchMissingReceiptsList:()=>{N!=null&&J!=null&&t(Va({start:J,end:N},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...o===!0?{onBulkUploadFiles:e=>{t(Tc(e))},onBulkUploadProgress:e=>{t(bc(e))},onBulkUploadSuccess:e=>{t(kc({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Ic(e))},onConfirmBulkUploadMatch:(e,a,i,d,v)=>{t(fc(e,a,i,d,v))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Cc())},onSetBulkUploadResultsTab:e=>{t(gc(e))},onSetBulkUploadCompletedSubTab:e=>{t(Sc(e))},onSetBulkUploadSortConfig:(e,a)=>{t(Ia({sortKey:e,sortOrder:a}))},onClearBulkUpload:()=>{t(hc())},onSearchTransactionsForManualMatch:(e,a)=>{t(xa(e,a??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=l.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(xa(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,a)=>{t(pc(e,a))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(mc())},onFetchBulkUploadBatches:e=>{t(Ua(e))},onFetchMoreBatchDetails:()=>{t(uc())},onResetBulkUploadSort:()=>{t(Ia({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(tc())},onSearchTextChanged:e=>{const a=l.currentSelectedView,i=l.selectedTransactionCategorizationTab;a==="transaction_categorization"&&(t(Ct({selectedTab:i,uiState:{searchString:e}})),N!=null&&J!=null&&t(pe(i,{start:J,end:N},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const a=l.selectedTransactionCategorizationTab;t(ec({filters:e,selectedTab:a}))},onRefresh:()=>{n.trackExpenseAutomationTabAnalytics(!0),t(Xo())},onClose:()=>{z==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0})),m("../")},onBack:()=>{z==="reconciliation"&&G!=null&&t(Ca({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(Zo(e))},onSaveReconciliationReview:e=>{t(Qo(e))},onUpdateStep:e=>{const{selectedPeriod:a}=l,i=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../${e}/${a.month}-${a.year}`,{state:{pathnameStackToGoBack:i,referrer:l.currentSelectedView}}),t(Ba(e))},handleLogOutClick:()=>{const e=te(r.state?.pathnameStackToGoBack,r.pathname);m("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:a}=e,{prepaidExpensesAccount:i,fixedAssetsAccount:d,accruedExpensesAccount:v}=a,P=ft(q.prepaidExpensesAccountList,i.selectedOptions),D=ft(q.fixedAssetsAccountList,d.selectedOptions),M=ft(q.accruedExpensesAccountList,v.selectedOptions),W={selectedPrepaidExpensesAccountIds:P.map((Y=>Y.accountId)),selectedFixedAssetsAccountIds:D.map((Y=>Y.accountId)),selectedAccruedExpensesAccountIds:M.map((Y=>Y.accountId))};t(Ko({data:W}))},onSaveJeAccountSettingsClick:()=>{t(Ho())},onJESchedulesFormDataChange(e,a){const{jeScheduleID:i,accumulatedDepreciationCategory:d,scheduleClass:v,scheduleExpenseCategory:P,vendor:D}=a,{allAccountList:M,allClassList:W,allDepreciationAccountList:Y}=l.jeSchedules,se=E.entityAutoCompleteView.vendor.length>0?E.entityAutoCompleteView.vendor.find((K=>K.id===D?.selectedOption)):void 0,ce={id:se?.zeniId??D?.selectedOption??"",name:se?.name??D?.defaultOptions.find((K=>K.value===D?.selectedOption))?.label??"",logo:se?.logo},Pe=P?.selectedOption!=null?M.find((K=>K.qboId===P.selectedOption)):void 0,ye=v?.selectedOption!=null?W.find((K=>K.classId===v.selectedOption)):void 0,ve=d?.selectedOption!=null?Y.find((K=>K.qboId===d.selectedOption)):void 0;t(Yo({scheduledJournalEntryID:e,localData:{jeScheduleID:i,scheduledJournalEntryID:e,updatedCategoryId:Pe?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:ve?.accountId,updatedVendor:{id:ce.id,name:ce.name}}}))},onRevertJeSchedule(e,a,i,d,v){t(Wo(e,a,i,d,v))},ignoreRecommendedJeSchedule(e,a,i,d){t(Jo(e,a,i,d))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,a)=>{e.trim().length>=2?t(ma({searchString:e,entityType:a,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onCancelAutoComplete:()=>{t(Ke("common"))}},onPostJESchedule(e,a){t(qo({scheduledJournalEntryID:e,jeScheduleTransactionKey:a}))},clearJeScheduleLocalData(){t(No())},onViewTransaction(e){if(n.tenantEmailDomain==null)return;const a=mi(e,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,`${n.location.pathname}${n.location.search}`);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(Go({query:e,scheduleType:R==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,a){const i=yt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(ga({scheduleType:i,localData:a}))},onOpenMatchNewModal(e){t(Lo(e))},onCloseMatchNewModal(){t($o())},onClearMatchNewModal(){t(zo())},onSearchMatchTransactions(e,a){t(jo(e,a))},onSearchMatchAccruals(e,a){t(Vo(e,a))},onMatchAndReverse(e){t(Bo(e.transactionId,e.transactionIntegrationId,e.transactionType,e.lineIds,e.transactionSyncToken,e.accrualIds))},onUpdateActualMatchingUIState(e){t(Uo(e))},onSaveSchedule(e,a){const i=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:d,allDepreciationAccountList:v}=l.jeSchedules,P=a.selectedAccount!=null?d.find((M=>M.qboId===a.selectedAccount)):void 0,D=a.selectedAccumulatedDepreciationCategory!=null?v.find((M=>M.qboId===a.selectedAccumulatedDepreciationCategory)):void 0;t(ga({scheduleType:i,localData:{...a,selectedAccount:P?.accountId,selectedAccumulatedDepreciationCategory:D?.accountId}})),t(Oo({scheduleType:i}))},onCreateAccruedSchedule(e){const a="accrued_expenses";t(Ro()),t(Do()),t(Fo({scheduleType:a,localData:e,selectedJeScheduleDetailId:void 0})),t(_o({scheduleType:a})),t(Mo(a,void 0))},onCreateOneTimeAccrual(e){t(wo(e))},handleJeScheduleClick:(e,a,i)=>{if((function(v,P){return P!=="accrued_expenses"})(0,i)&&t(Ma({selectedJEScheduleKey:a})),p!=null&&Ka(i))return void p(e,i,a);const d=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/${i}/details/${e}`,{state:{pathnameStackToGoBack:d,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,a,i,d)=>{t(a!=="revert"?xo(e,i,d):Ao(e,i,d))},onOneTimeAccrualClick:e=>{if(p!=null)return void p(e,"one_time_accrual");const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"je_schedules"}})},onOpenMatch:e=>{n.openMatchPanel?.(e)},improveMonthEndInsightsUsingZeniGPTClick:e=>{S!=null&&t(Eo(e,S.companyId,S.tenantId))},onClickCustomerRequest:g,setActivityLogTransactionId:C,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(vo())},onOpenFileAttachmentSnackBar:()=>{t(bt({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(yo(e))},onUpdateFileAttachment:e=>{t(Po({files:e}))},previewMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(Sa(e,S.companyId,a,!0,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},saveMonthEndReport:(e,a,i,d,v)=>{S!=null&&t(Sa(e,S.companyId,a,!1,i,d,{agentInsightEdits:v,tenantId:S.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const a=r.state?.referrer,{selectedPeriod:i,auditSummary:d}=l;S!=null&&d?.auditScorePercentage!=null&&(t(bo(S.companyId,e,S.tenantId)),Z.trackInsightsEmailPage(i.month,i.year,!1,"draft",d.auditScorePercentage,To().format(Qa.analytics.MMMDDCommaYYYYformat),a??null))},onTransactionCategorizationRowClick:(e,a)=>{const i=l.transactionView.uiState.searchString??"",d=l.transactionView.transactions,v=d.findIndex((M=>M.id===e)),P=i.length>0?{resultPosition:v>=0?v+1:void 0,resultsCount:d.length,searchTerm:i}:void 0;if(n.openTransactionPanel)return void n.openTransactionPanel(e,a,P);const D=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/${a}/${e}`,{state:{pathnameStackToGoBack:D,message:"expenseAutomation",origin:"transaction_categorization",searchContext:P}})},setLocalDataForCategoryAndClass:(e,a,i,d,v,P,D,M,W,Y,se,ce)=>{t(ko(e,a,i,d,x,v,P,D,M,W,Y,se,ce))},onCancelAutoComplete:()=>{t(Ke("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(pa({scrollPosition:e}))},onUpdateTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(pe(e,{start:J,end:N},!1,!1)),t(Io(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(fo(e)),t(pe("autoCategorized",{start:J,end:N},!1,!1)))},onTransactionGroupChange:e=>{n.closeSidePanel?.(),N!=null&&J!=null&&(t(Co(e)),t(pe(n.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:J,end:N},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a})),N!=null&&J!=null&&t(pe(e,{start:J,end:N},!1,!1,a.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,a)=>{t(Ct({selectedTab:e,uiState:a}))},onFetchTransactionCategorizationList:(e,a,i,d,v,P)=>{N!=null&&J!=null&&t(pe(e,{start:J,end:N},!0,i,a,d,v,P))},resetTransactionCategorizationLocalData:(e,a,i,d,v,P,D)=>{t(go(e,a,i,d,D??null,v,P,!1)),ti(t,a.map(String))},updateSelectedVendorForTransaction:(e,a,i,d,v)=>{t(ha({selectedTab:e,transactionId:a,lineId:i,selectedTransaction:d,uncategorizedAccounts:x,updatedVendor:v,isAccountingClassesEnabled:I}))},onSaveUpdateTransactionCategorization:(e,a,i)=>{const d=r.state?.referrer;e==="autoCategorized"?Z.trackTransactionsAutoCategorisedPage(h.month,h.year,l.transactionView.totalCountByTab.autoCategorized,a.length,!1,d??null):Z.trackTransactionsReviewPage(h.month,h.year,l.transactionView.totalCountByTab.review,a.length,!1,d??null),t(So(e,a,i)),ei(a.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,a)=>{t(ho({selectedTab:e,transactionIds:a}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&t(mo({transactionId:D,customerUpdates:P})),t(po({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedCustomer:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))},onFetchRecommendationsForEntityCategorization:(e,a,i,d,v,P)=>{const{transactionId:D,transaction:M,lineIds:W}=a;P!=null&&(t(lo({transactionId:D,vendorUpdates:{name:P.name,id:P.id?P.id:void 0}})),t(ro({vendorId:P.id?P.id:void 0,localData:{vendorName:P.name,vendorId:P.id?P.id:void 0}}))),P?.id?(t(ha({selectedTab:d,transactionId:D.id,lineId:W[0],selectedTransaction:M,uncategorizedAccounts:x,updatedVendor:P,selectedEntity:v,isAccountingClassesEnabled:I})),v!=null&&t(Pt({entity:v,amount:e,transactionDetails:a,flowType:"categorization",selectedTab:d,isFetchCOT:k}))):t(uo({selectedTab:d,transactionId:D.id,lineId:W[0]}))},fetchFluxViewOnScroll:(e,a)=>{t(Xe(e,!0,!1,a,!1,!0))},onFetchFluxViewList:()=>{t(Xe(h,!0,!1,null,!1,!1))},markAsReview:(e,a,i,d)=>{Z.trackFluxAnalysisReviewed(i.month,i.year,d??!1,e),t(io(a,e,i,d??!1))},onUpdateFluxAnalysisUIState:e=>{t(co(e))},updateOperatingExpensesIdsForReview:e=>{t(oo({operatingExpenseIds:e,selectedPeriod:h}))},redirectToVendorDetailPage:e=>{if(n.tenantEmailDomain!=null){const a=ui(e.id,e.qboId,n.tenantEmailDomain),i=te(n.location.state?.pathnameStackToGoBack,n.location.pathname);n.navigate(a,{state:{pathnameStackToGoBack:i,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(so({sectionId:e,selectedPeriod:h}))},onFetchReimbursementView:(e,a,i)=>{t(Xe(e,!0,!1,a,!0,i))},onReviewClicked:e=>{t(re(h,e))},setOpenDrawerClicked:e=>{t(tt({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,a)=>{t(Da("expense_automation_reconcile",e,a))},onEstablishConnectionClick:(e,a)=>{const i=S?.companyId;i!=null&&(t(Fa(e,i,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",a)),t(_a({accountId:a,connectionInProgress:!0})))},onAddStatementClick:e=>{t(tt({selectedDrawerAccountId:e})),t(Qe({accountId:e,selectedPeriod:h,localData:{accountSource:"bank_statement"}})),t(Ze({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(re(h,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(no({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,a)=>{t(ao({sortKey:e,sortOrder:a}))},onReconReviewTabColumnSortConfigChanged:(e,a)=>{t(to({sortKey:e,sortOrder:a}))},onReconTabUpdate:e=>{n.closeSidePanel?.(),t(eo({selectedTab:e}))},updateReconReviewTabLocalData:(e,a,i)=>{const d=e.vendor?.id;i&&d!=null&&t(Zs(d)),t(Xs({data:e,transactionId:a}))},onReconMatchedTransactionClick:e=>{if(n.openTransactionPanel)return void n.openTransactionPanel(e,Tt("bill"));const a=te(r.state?.pathnameStackToGoBack,r.pathname);m(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:a,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{m(-1)},onReconListPageScroll:e=>{t(pa({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(ma({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ke("common"))},onReconNodeCollapseToggled:(e,a)=>{t(Qs({nodeId:e,collapsed:a}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(wa({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(Ra({accountId:e}))}}}),((t,n,f)=>{const{isMissingReceiptsBulkUploadEnabled:I,...k}=f;return(function(o,r,E){return{...o,...r,...E,onUploadTransactionReceipt:(l,S,R,x,m)=>{r.onUploadTransactionReceipt(l,S,R,x,m,o.authParams)}}})(t,n,k)}))(Wc(Yc)),It="newScheduleMode",kt="newScheduleType",_i=vi(oi((function(t){const n=t.displayName??t.name??"Component",f=za.memo(t),I=k=>{const o=he(),r=(function(){const p=he(),C=_((h=>Me(h).reconciliation.selectedDrawerAccountId));return{isOpen:C!=null,selectedAccountId:C,openPanel:s.useCallback((h=>{p(tt({selectedDrawerAccountId:h}))}),[p]),closePanel:s.useCallback((()=>{p(tt({selectedDrawerAccountId:void 0}))}),[p])}})(),E=_((p=>Me(p).reconciliation)),l=_((p=>ke(p))),S=s.useCallback(((p,C)=>{o(Da("expense_automation_reconcile",p,C))}),[o]),R=s.useCallback(((p,C)=>{const h=l?.companyId;h!=null&&(o(Fa(p,h,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",C)),o(_a({accountId:C,connectionInProgress:!0})))}),[o,l?.companyId]),x=s.useMemo((()=>{if(r.isOpen&&r.selectedAccountId!=null)return b.jsx(Ii,{reconciliation:E,selectedDrawerAccountId:r.selectedAccountId,onClose:r.closePanel,onFetchLinkTokenClick:S,onEstablishConnectionClick:R})}),[r.isOpen,r.selectedAccountId,r.closePanel,E,S,R]),m=s.useMemo((()=>({reconPanelContent:x,reconSidePanelIsOpen:r.isOpen,closeReconSidePanel:r.closePanel})),[x,r.isOpen,r.closePanel]),{useFeatureGate:g}=Be(),{isFeatureEnabled:u}=g(H.isReconV3Enabled),F=s.useContext(ba),A=s.useMemo((()=>r.isOpen?u===!0?{selectedItemId:r.selectedAccountId}:{closePanel:r.closePanel,selectedItemId:r.selectedAccountId}:F),[r.isOpen,r.closePanel,r.selectedAccountId,F,u]);return b.jsx(ba.Provider,{value:A,children:b.jsx(f,{...k,...m})})};return I.displayName=`withReconSidePanel(${n})`,I})(fi((({closeMatchSidePanel:t,closeReconSidePanel:n,closeSidePanel:f,matchPanelContent:I,isMatchPanelOpen:k,openMatchPanel:o,openTransactionPanel:r,panelContent:E,reconPanelContent:l,reconSidePanelIsOpen:S,isSchedulePanelOpen:R,closeSchedulePanel:x,openSchedulePanel:m,schedulePanelContent:g,schedulePendingDiscardConfirmation:u,sidePanelIsFullView:F,sidePanelIsOpen:A})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:C}=_c(),h=Mc(),{isOpen:z}=Oc(),G=nt(),q=be(),T=he(),{isAiCfoAccessEnabled:J,onAskAiCfoClick:N}=qa({mobileExploreReferrer:"Transaction categorization"}),e=s.useCallback((()=>{k===!0&&t?.(),A===!0&&F!==!0&&f?.()}),[t,f,k,F,A]),a=_(xs);s.useEffect((()=>{a===!0&&(e(),T(ws()))}),[a,e,T]);const{areTenantIdsInSync:i}=$a(),d=xi(),v=Uc(),[P,D]=s.useState(!1),[M,W]=Yn(),Y=s.useCallback((c=>{W((w=>{const L=new URLSearchParams(w);return c==null?(L.delete(It),L.delete(kt),L):(L.set(It,c.scheduleDetailsMode),L.set(kt,c.scheduleType),L)}),{replace:!0})}),[W]),[se,ce]=s.useState(void 0),Pe=s.useCallback(((c,w,L)=>{const j=yt(c);ce(j),Y({scheduleDetailsMode:w,scheduleType:c}),T(ra({scheduleType:j==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:L}))}),[T,Y]),ye=s.useMemo((()=>{const c=M.get(It),w=M.get(kt);return c!=null&&w!=null?{scheduleDetailsMode:c,scheduleType:w}:void 0}),[M]),ve=s.useCallback((c=>{Y(c),c!=null&&T(ra({scheduleType:yt(c.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[T,Y]),K=_((c=>la(c))),B=_((c=>ke(c))),[Ve,Ee]=s.useState(!1),[ot,Se]=s.useState(!1),[je,y]=s.useState([]),[$,Q]=s.useState(null),X=s.useCallback((()=>{Q(null)}),[]),ge=$?.contentType==="activity"?$.detail.transactionId:void 0,ct=s.useCallback((c=>{c!=null?(p&&C(!1),h(),e(),Q({contentType:"activity",detail:{transactionId:c}})):Q((w=>w?.contentType==="activity"?null:w))}),[e,p,h,C]),Za=s.useCallback((c=>{p&&C(!1),h(),e(),Q({contentType:"transfer",detail:c})}),[e,p,h,C]),Xa=s.useCallback((()=>{h(),X(),e(),N()}),[e,X,N,h]),vt=s.useRef(p);s.useEffect((()=>{p===!0&&vt.current===!1&&(h(),X(),e()),vt.current=p}),[e,X,p,h]);const Et=s.useRef(z);s.useEffect((()=>{z===!0&&Et.current===!1&&(p&&C(!1),X(),k===!0&&t?.(),A===!0&&F!==!0&&f?.()),Et.current=z}),[X,t,f,z,p,k,C,F,A]);const ze=A===!0&&F!==!0||k===!0,At=s.useRef(ze);s.useEffect((()=>{ze&&!At.current&&(p&&C(!1),h(),X()),At.current=ze}),[X,p,ze,h,C]);const[xt,en]=s.useState(!1),wt=s.useRef(!1),{selectedTab:tn}=Ue(),{tenantEmailDomain:it}=Ue(),[lt,Rt]=s.useState(q.state?.message==="comingFromTransactionDetail"),Dt=q.state?.message==="comingFromOverview",an=Bc(),rt=st.getSignedInUser(),{useFeatureGate:oe}=Be(),{isFeatureEnabled:Ft}=oe(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:Ae}=oe(H.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:dt}=oe(H.isTransactionActivityEnabled),{isFeatureEnabled:_t}=oe(H.isAccrualEnabled),nn=Ga(),de=_t===!0&&nn===!0,{isFeatureEnabled:Mt}=oe(H.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:sn}=oe(H.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:on}=oe(H.isProjectsTransactionsEnabled),{isFeatureEnabled:cn}=oe(H.isReconV3Enabled),ln=s.useCallback((c=>{const w=Tt(c.transactionType??(c.view==="reconciliation"?"bill":"expense")),L=te(q.state?.pathnameStackToGoBack,q.pathname),j=new URLSearchParams({view:"full"});c.threadId!=null&&j.set("thread_id",c.threadId),c.entityType!=null&&j.set("entity_type",c.entityType),G(`/${it}/transaction/${encodeURIComponent(w)}/${c.transactionId??c.entityId}?${j.toString()}`,{state:{pathnameStackToGoBack:L,message:"expenseAutomation"}})}),[G,it,q.state,q.pathname]),rn=_((c=>Rs(c,"common"))),V=_((c=>Me(c))),{categoryOptions:dn,paymentAccountNames:un}=_((c=>Ds(c.accountState))),mn=_((c=>Fs(c.classState))),{monthEndCloseChecksView:ee,currentSelectedView:O,selectedPeriod:U,selectedTransactionCategorizationTab:ut,currentSelectedViewBackgroundRefreshFetchState:pn,currentSelectedViewFetchState:ie,jeSchedules:mt,reconciliation:Ot}=V;Kc(O==="transaction_categorization");const hn=V.transactionView.saveStatus.fetchState,$e=V.transactionView.transactions,Ut=s.useRef($e);Ut.current=$e;const Bt=_((c=>c.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Vt=_((c=>c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),jt=s.useRef(Bt);jt.current=Bt;const zt=s.useRef(Vt);zt.current=Vt;const Le=_((c=>{const w=c.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return w!=null?c.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[w]?.filters:void 0})),$t=s.useRef("");s.useEffect((()=>{if(O!=="transaction_categorization")return;const c=V.transactionView.uiState.searchString??"";if(ie.fetchState!=="Completed"||c.length===0||c===$t.current)return;$t.current=c;const w=Le!=null?Vc(Le):0,L=Le?.categories.filter((j=>j.values.length>0&&String(j.values[0]??"").trim()!=="")).map((j=>`${j.field}:${j.values.join(",")}`))??[];Z.trackAiCloseTransactionSearch({filtersApplied:L,hasResults:$e.length>0,isFiltered:w>0,resultsCount:$e.length,searchTerm:c,searchType:"free_text"})}),[O,ie.fetchState,V.transactionView.uiState.searchString,V.transactionView.transactions,Le]);const le=Qc(hn,(()=>{const c=[],w=zt.current,L=jt.current,j=L!=null&&w!=null?L[w]:void 0;if(j?.transactionReviewLocalDataById!=null)for(const fe of Object.values(j.transactionReviewLocalDataById)){const ae=fe?.transactionReviewLocalData?.lineItemById;if(ae!=null)for(const pt of Object.values(ae)){const Fe=pt?.account;Fe?.accountId!=null&&c.push(Fe.accountId)}}const Ce=Ut.current;for(const fe of Ce)for(const ae of fe.lines??[])"account"in ae&&ae.account?.accountId!=null&&c.push(ae.account.accountId);return c}));s.useEffect((()=>{O==="transaction_categorization"&&A!==!0||ct(void 0)}),[O,ct,A]),s.useEffect((()=>{S===!0&&n?.()}),[O,Ot.selectedAccountId]);const Sn=V.transactionView.selectedTransactionCategorizationCompletedSubTab,gn=V.transactionView.selectedTransactionGroup,Ge=`${ut}|${Sn}|${gn}`,Ne=s.useRef(null),Lt=s.useRef(null);s.useEffect((()=>{Ne.current!==null?Ne.current!==Ge&&(Ne.current=Ge,O==="transaction_categorization"&&X()):Ne.current=Ge}),[X,O,Ge]);const Cn=_((c=>ge==null?void 0:_s(c.transactionState,ge))),ue=Cn?.qboId,Gt=_((c=>ue==null?void 0:Ms(c,ue)));s.useEffect((()=>{ue!=null&&T(Os(ue))}),[T,ue]);const{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transferAccounts:Jt}=V.transactionView,Wt=s.useCallback((c=>Zc(T,c)),[T]),Yt=s.useMemo((()=>O!=="transaction_categorization"||$==null?null:$.contentType==="activity"?dt===!0?b.jsx(jc,{activityLogView:Gt,qboId:ue,onClose:()=>Q(null),selectedTransactionId:$.detail.transactionId,isQuickViewCardStyle:!0},String($.detail.transactionId)):null:$.contentType==="transfer"?b.jsx(zc,{createTransferEntryStatus:Nt,creditCardTransferAccountsList:qt,transaction:$.detail,transferAccounts:Jt,onClose:()=>Q(null),onCreateTransfer:Wt,isQuickViewCardStyle:!0},String($.detail.transactionId)):null),[O,$,dt,Gt,ue,Nt,qt,Jt,Wt]),fn=Yt!=null,{selectedAccountId:xe}=Ot,Ht=et(mt.accountSettingsView.saveState.fetchState),In=_((c=>Us(c.accountState,c.accountListState,"accountList"))),kn=_((c=>Bs(c))),we=Wa(tn)??O,bn=_((c=>c.entityAutoCompleteState.autoCompleteText.common));if(La({isDataReady:ie.fetchState==="Completed"}),rt==null)throw Error("Can't access expense automation screen without signing in...");const Kt=Oa(U),Re=at(Kt.start),De=at(Kt.end);if(Re==null||De==null)throw Error(`Invalid start - ${Re} and end - ${De} period from given ${U}`);const Tn=s.useCallback((()=>{Ee(!1)}),[]),Pn=s.useCallback((()=>{Se(!0)}),[]),yn=s.useCallback((c=>{y(c),Se(!1)}),[]),vn=s.useCallback((()=>{y([])}),[]),qe=V.missingReceipts.bulkUpload.phase,Qt=V.missingReceipts.bulkUpload.currentBatchId;s.useEffect((()=>{Ae===!0&&O==="missing_receipts"&&qe==="matching"&&Qt!=null&&T(Ua({cacheOverride:!0}))}),[Ae,O,qe,Qt,T]);const Zt=rt?.userId,En=U.month,An=U.year,Xt=B?.tenantId;s.useEffect((()=>{O==="missing_receipts"&&Ae!==!1&&qe==="idle"&&Zt!=null&&Xt!=null&&T(Vs())}),[O,Ae,qe,Zt,Xt,En,An,T]),s.useEffect((()=>{K.newVendorState?.vendorDetailLocalData?.vendorName!=null?D(!0):D(!1)}),[K.newVendorState?.vendorDetailLocalData?.vendorName]),s.useEffect((()=>{we!=null&&O!==we&&T(Ba(we))}),[we]),s.useEffect((()=>{xt===!1&&ie.fetchState==="Completed"&&i&&(en(!0),T(da(!1,!1,de)))}),[xt,ie,i,de]),s.useEffect((()=>{const c={month:U.month,year:U.year},w=Lt.current;Lt.current=c,w===null||w.month===c.month&&w.year===c.year||!Dt&&i&&(T(da(!1,!1,de)),T(re(U,xe,!1,!1)))}),[U.month,U.year,i,de]);const Je=s.useCallback(((c=!1,w=!1)=>{const L={start:Re,end:De};switch(O){case"transaction_categorization":T(pe(ut,L,c,!lt,void 0,void 0,w)),Rt(!1);break;case"flux_analysis":T(Xe(U,c,w,null));break;case"month_end_insights":if(w===!1){const j=new Date(U.year,U.month,0),Ce=zs(j.toDateString()).format(Qa.analytics.YYYYDashMMDashDDFormat);T($s(!0,B.companyId,B.tenantId,Ce)),T(Ls(B.companyId,B.tenantId))}break;case"je_schedules":T(js(L,w,de));break;case"missing_receipts":T(Va(L,{amount:75,currencyCode:"USD",currencySymbol:"$"},c,w));break;default:T(re(U,xe,c,w))}}),[O,Re,De,B.companyId,B.tenantId,ut,U,xe,lt,Rt,de]),xn=s.useCallback((()=>{Je(!0,!0)}),[Je]);s.useEffect((()=>{O===we&&ie.fetchState==="Not-Started"&&i&&Je(!0)}),[ie,Re,De,B.companyId,B.tenantId,i]),s.useEffect((()=>{Dt||lt||wt.current||pn.fetchState==="In-Progress"||ie.fetchState!=="Completed"||(wt.current=!0,Je(!0,!0))}),[]),s.useEffect((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState!=="Completed"&&ee.fetchState!=="Error"&&B?.tenantId!=null&&T(_e({tenantId:B.tenantId,period:U,refreshViewInBackground:!1}))}),[ee.fetchState,B?.tenantId]),s.useEffect((()=>{ee.fetchState!=="Completed"||!i||(ee.monthEndCloseChecks?.monthEndCloseCheckList.some((c=>c.id==="reconciliation"))??!1)&&V.reconciliation.fetchStatus.fetchState==="Not-Started"&&T(re(U,void 0,!1,!1))}),[ee.fetchState,i,U.month,U.year,V.reconciliation.fetchStatus.fetchState,T]),s.useEffect((()=>{V.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?Ee(!0):Ee(!1)}),[V.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),s.useEffect((()=>{V.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&i&&(T(_e({tenantId:B.tenantId,period:U,refreshViewInBackground:!0})),T(Gs({companyId:B.companyId})),G("../"))}),[V.monthEndInsights?.sendMonthEndReportStatus?.fetchState,B.tenantId,U,B.companyId,i]),s.useEffect((()=>{const c=setInterval((()=>{ee.fetchState!=="In-Progress"&&ee.fetchState==="Completed"&&T(_e({tenantId:B.tenantId,period:U,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(c)}),[ee.fetchState,B.tenantId,U,T]),s.useEffect((()=>{const c=setInterval((()=>{O==="reconciliation"&&xe==null&&V.reconciliation.fetchStatus.fetchState==="Completed"&&V.reconciliation.refreshStatus.fetchState!=="In-Progress"&&T(re(U,void 0,!0,!0))}),3e5);return()=>clearInterval(c)}),[O,T,V.reconciliation.fetchStatus.fetchState,V.reconciliation.refreshStatus.fetchState,re,xe,U]);const wn=Pa(),{isFeatureEnabled:Rn}=oe(H.isRecommendationFeedbackEnabled),ea=$c(),{onRecommendationSelection:ta,popup:Dn}=Xc({isEnabled:Rn}),Fn=s.useMemo((()=>({...ea,onRecommendationSelection:ta})),[ea,ta]);s.useEffect((()=>{const c=(ee.monthEndCloseChecks?.monthEndCloseCheckList.find((w=>w.id==="month_end_insights"))?.isDisabled??!1)&&!Ft;O!=="month_end_insights"||!c&&ee.monthEndCloseChecks?.reportEmailSentDate==null||G("../")}),[O,ee.monthEndCloseChecks]);const _n=S===!0?l:E,Mn=S===!0||A===!0,On=S===!0?n:f,Un=S!==!0&&F;s.useEffect((()=>{Ht==="In-Progress"&&mt.accountSettingsView.saveState.fetchState==="Completed"&&T(ua())}),[Ht,mt.accountSettingsView.saveState.fetchState,ua]);const{transactionId:aa,onSaveVendor:Bn,onSaveSuccess:Vn,onCancel:jn,vendorViewDetails:zn}=(({expenseAutomationViewSelector:c,closeDrawerHandler:w,currentSelectedView:L})=>{const j=he();let Ce,fe,ae;const pt=Pa(),Fe=c.transactionView;let na=()=>{};const{transactions:$n,selectedTransactionId:Ie,selectedTransactionLineId:We,transactionLocalData:Ln}=Fe;if(L==="transaction_categorization"){const ht=Ln.find((me=>me.transactionId===Ie)),ne=$n.find((me=>me.id===Ie)),sa=We!=null?ht?.transactionReviewLocalData?.lineItemById[We]:void 0,oa=sa?.account;fe=sa?.class?.classId,Ce=["Uncategorized Income","Uncategorized Expense"].includes(oa?.accountName??"")?void 0:oa?.accountId;const Nn=di(Ie,ne?.typeOfTransaction);ne!=null&&Nn&&(ae={id:Ie,type:Tt(ne.typeOfTransaction)}),na=()=>{if(Ie!=null&&We!=null&&ne!=null){const me=Fe.transactionLocalData.find((Ye=>Ye.transactionId===Ie))?.transactionReviewLocalData;if(me!=null&&ne.lines!=null&&ne.lines.length>0){const Ye=me.lineItemById[We];let St=me.selectedEntity;if(As(ne)||(St=Ye.selectedEntityLine),St!=null){const qn=St,Jn={transactionId:{id:ne.id,type:ne.type},transaction:ne,lineIds:ne.lines.map((Wn=>Wn.id))??[]};j(Pt({entity:qn,amount:Ye.amount.amount,transactionDetails:Jn,flowType:"categorization",selectedTab:c.selectedTransactionCategorizationTab,isFetchCOT:pt}))}}}}}const Gn=_((ht=>la(ht,void 0,Ce,fe)));return{transactionId:ae,onSaveVendor:()=>{j(Es(ae,void 0,!1,!0))},onSaveSuccess:na,onCancel:()=>{ae!=null&&j(Ps({transactionId:ae})),j(ys()),j(vs()),w()},vendorViewDetails:Gn}})({expenseAutomationViewSelector:V,closeDrawerHandler:()=>{D(!1)},currentSelectedView:O});return an?.loggedInUserRoleMap==null?ee.fetchState==="Error"?b.jsx(Lc,{onGoHome:()=>G("../",{replace:!0}),onReload:()=>window.location.reload()}):b.jsx(Na,{fetchState:"In-Progress"}):b.jsxs(b.Fragment,{children:[b.jsx(pi,{isOpen:ot,drawerLeftMargin:new Gc(0,0,300,650),onClose:()=>{Se(!1)},children:b.jsx(Mi,{onClick:c=>c.stopPropagation(),children:b.jsx(Ei,{companyId:B.companyId,closeCustomerRequestDrawer:()=>Se(!1),addCustomerRequest:yn,resetCustomerRequest:vn})})}),aa!=null&&P&&b.jsx(ai,{isOpen:P,transactionId:aa,onSaveVendor:Bn,onSaveSuccess:Vn,onCancel:jn,vendorViewDetails:zn}),b.jsx(Nc,{toolkit:Fn,children:b.jsx(Fi,{events:[],eventCallback:(c,w,L)=>{},navigate:G,location:q,themeState:v,categoryOptions:dn,classesForFilters:mn,accountsForFilters:un,vendorSearchAutoCompleteData:{autoCompleteText:bn,entityAutoCompleteView:rn},expenseAutomationViewSelector:V,isMissingReceiptsBulkUploadEnabled:Ae,monthEndInsightsPreviewMode:Ve,monthEndInsightsCustomerRequestData:je,isRealtimeInsightsFeatureEnabled:Ft,isCreateTransferEntryFromExpenseEnabled:Mt,isAccountingClassesEnabled:kn,isProjectsTransactionsEnabled:on,isCOTEnabled:wn,currentTenant:B,companyId:B.companyId,signedInUser:rt,isTransactionActivityEnabled:dt,isRightPanelOpen:fn,rightSidePanel:Yt,onOpenTransferRightPanel:Mt===!0?Za:void 0,uncategorizedAccounts:In,newScheduleActiveType:se,isAccrualEnabled:_t,isActualMatchingEnabled:de,newScheduleSelection:ye,onNewScheduleSelectionChange:ve,onScheduleTypeChange:Pe,onNewScheduleSaved:xn,onClickCustomerRequest:Pn,handleEditClick:Tn,tenantEmailDomain:it,trackExpenseAutomationTabAnalytics:d,setActivityLogTransactionId:ct,closeMatchSidePanel:t,closeSidePanel:On,openTransactionPanel:r,closeSchedulePanel:x,openSchedulePanel:m,openMatchPanel:o,sidePanelIsOpen:Mn,sidePanelIsFullView:Un,panelContent:_n,isAiCfoAccessEnabled:J,onAskAiCfoClick:Xa,isExpenseAutomationCommentingEnabled:sn,isReconV3Enabled:cn,onExpenseAutomationCommentingThreadClick:ln,sidePanelListPercent:S===!0?66:void 0,isMatchPanelOpen:k,isSchedulePanelOpen:R,matchPanelContent:I,schedulePanelContent:g,schedulePendingDiscardConfirmation:u})}),Dn,le.showPopup&&le.popupType!=null&&b.jsx(qc,{popupType:le.popupType,currencySymbol:le.currencySymbol,accountId:le.popupAccountId??"",accountName:le.popupAccountName??"",onSubmit:le.handleSubmit,onDismiss:le.handleDismiss})]})}))))),Mi=Te(yc)`
35
+ display: flex;
36
+ min-height: 100%;
37
+ flex-direction: column;
38
+ `;function Oi(){const t=be(),{selectedTab:n,tenantEmailDomain:f}=Ue(),I=_((r=>ke(r))),k=_((r=>r.expenseAutomationViewState.selectedPeriodByTenantId[I.tenantId]));if(Wa(n)==null)return b.jsx(ja,{});const o=Ja({tenantEmailDomain:f,selectedTab:n,selectedPeriod:k!=null?`${k.month}-${k.year}`:void 0});return o==null?null:b.jsx(Qn,{to:o,replace:!0,state:t.state})}function ul(){return b.jsxs(Kn,{children:[b.jsx(He,{index:!0,element:b.jsx(hi,{})}),b.jsx(He,{path:"/:selectedTab/:selectedPeriod/*",element:b.jsx(_i,{})}),b.jsx(He,{path:"/:selectedTab",element:b.jsx(Oi,{})}),b.jsx(He,{path:"*",element:b.jsx(ja,{})})]})}export{ul as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-DJozFz1F.js";import{a as r}from"./sentry-C1W0cBeR.js";import{ax as l,ay as p,W as f,a5 as m}from"./index-BRSI70wf.js";import"./mui-DqsEgFea.js";import c from"./NotFoundScreen-CaUndFTs.js";import{h as u,g as b}from"./core-DrG65cn7.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="47d12613-0e32-45ea-a185-3bfe94200392",e._sentryDebugIdIdentifier="sentry-dbid-47d12613-0e32-45ea-a185-3bfe94200392")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=m(a.state?.pathnameStackToGoBack),d=n.poppedPathname??k();e(d,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=l(a.pathname);return o!=null?s.jsx(p,{menuItem:f(o),onDemoClick:t,onGoBack:i}):s.jsx(c,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
@@ -0,0 +1 @@
1
+ import{a as r}from"./sentry-C1W0cBeR.js";import{u as l,h as f,g as m}from"./core-DrG65cn7.js";import{hY as p,Uq as g,Ur as _}from"./zeni-epic-state-1I_oueWp.js";import{u as b,L as h,z as y}from"./index-BRSI70wf.js";import"./liveblocks-DJozFz1F.js";import"./recharts-Bmrae78L.js";import"./mui-DqsEgFea.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.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]="77204d44-70b9-4fc1-8ae7-6c28d778ce03",e._sentryDebugIdIdentifier="sentry-dbid-77204d44-70b9-4fc1-8ae7-6c28d778ce03")}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"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}u();const d=y.getActiveTenantForUser();n(d?.tenantEmailDomain!=null?`/${d.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
@@ -0,0 +1 @@
1
+ import{n as s}from"./liveblocks-DJozFz1F.js";import{j as d}from"./core-DrG65cn7.js";import{fF as a}from"./zeni-epic-state-1I_oueWp.js";import"./sentry-C1W0cBeR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -0,0 +1,2 @@
1
+ import{j as s}from"./liveblocks-DJozFz1F.js";import{a as r}from"./sentry-C1W0cBeR.js";import{u as P,h as L,i as R,j as C,t as K,l as O,s as H,g as G,N as B,n as te,o as x}from"./core-DrG65cn7.js";import{a9 as rt,k as p,ar as T,S as m,cc as lt,cd as dt,ce as ut,cf as gt,cg as mt,ch as vt,ci as pt,cj as ft,ck as St,cl as ht,cm as It,cn as Ct,co as Et,cp as kt,p as W,cq as yt,cr as xt,af as ae,cs as bt,ct as jt,z as ye,cu as Dt,cv as Pt,cw as Lt,cx as At,cy as $t,cz as wt,cA as Ft,cB as Rt,Q as Tt,aj as mn,cC as _t,cD as Ot,cE as Mt,cF as Nt,cG as $e,cH as Ut,cI as Bt,cJ as Vt,cK as Ht,cL as qt,cM as zt,t as ze,j as vn,cN as Zt,cO as Qt,cP as Kt,cQ as Gt,cR as Wt,cS as Yt,cT as Jt}from"./index-BRSI70wf.js";import"./mui-DqsEgFea.js";import{A as Z}from"./AddressScreen-CPQlppZ3.js";import M from"./NotFoundScreen-CaUndFTs.js";import{ZE as Xt,ZF as ei,vl as Ze,ZG as Q,vO as se,ZH as we,ZI as ce,wp as xe,ww as ni,wB as pn,ZJ as Fe,ZK as fn,wt as Sn,y3 as Qe,vN as Ke,ZL as ti,ZM as hn,wM as be,ZN as re,wQ as ii,ZO as oi,ZP as In,wT as Cn,y_ as ai,ZQ as ve,ZR as Ge,ZS as En,vL as si,ZT as ci,vF as ri,ZU as li,yg as di,ZV as kn,yp as We,ZW as ui,ym as gi,ZX as Re,gh as mi,ZY as ee,ZZ as ne,x6 as vi,vT as Ye,vY as yn,vW as pi,vQ as fi,w$ as Si,v_ as hi,x8 as Ii,Z_ as je,xh as xn,xf as Y,xd as le,xc as Ci,Z$ as bn,yv as Je,_0 as Ei,vM as jn,_1 as Te,w7 as De,w4 as Pe,wh as Dn,wg as _e,w1 as ki,wa as Pn,wj as ie,fF as Oe,Vr as Ln,vP as Me,we as yi,wf as xi,wd as bi,_2 as ji,wR as Di,wN as An,_3 as $n,vz as Xe,_4 as Pi,vv as Li,_5 as Ai,yB as $i,yF as q,yA as wi,xJ as Ne,_6 as Fi,_7 as wn,yO as en,_8 as Ri,yL as Ti,_9 as Fn,xM as _i,xN as V,xQ as Oi,_a as Rn,x_ as Ie,_b as Mi,x7 as Tn,TZ as _n,_c as Ni,y8 as Ui,_d as On,_e as Bi,_f as Vi,_g as Hi,zD as qi,_h as zi,_i as Mn,yV as Nn,_j as Un,zB as Ce,_k as Zi,zy as Qi,_l as Ki,_m as Gi,_n as Wi,_o as Yi,_p as Ji,_q as nn,_r as Xi,eg as eo,zH as no,_s as Ue,xr as to,xm as io,_t as de,xC as Bn,xu as ue,xt as oo,xx as Vn,_u as ao,xs as so,_v as Hn,y$ as qn,zq as tn,zl as co,_w as ro,z0 as lo,_x as uo,zr as go,zv as mo,_y as Be,wr as zn,zc as vo,ws as po,_z as fo,_A as Zn,c8 as So,ms as ho,mt as Io,_B as on,wq as ge,gl as Co,mz as Eo,zi as Qn,zT as ko,zf as Kn,uT as yo,zQ as an,uH as xo,zN as sn,hS as bo,Uq as cn,Ur as jo,Gb as Gn,hK as Do,_C as Po,Vg as Lo,_D as Ao,zY as Ee,zZ as $o,_E as wo,_F as Wn,zW as Fo,_G as Ro,_H as To,yc as _o,_I as Oo}from"./zeni-epic-state-1I_oueWp.js";import{M as Mo}from"./MobileAppDrawer-CCUOxU5h.js";import{q as me}from"./QBOConnectionScreen-B613NNPN.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.js";import"./InboxNotificationsProvider-Dwt_tkdC.js";import"./useTaskManagerAccess-CeXMA9mP.js";import"./empty-hypZVcyj.js";import"./pdf-lib-CYVFTJz1.js";import"./index-DWaMzRgO.js";import"./url-BrtuL5Mk.js";import"./index-CItropkZ.js";import"./decodeURIComponentSafe-Cq-VPmfw.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]="a9a9c0df-e9f9-4d6a-b970-8f78a0d5e515",t._sentryDebugIdIdentifier="sentry-dbid-a9a9c0df-e9f9-4d6a-b970-8f78a0d5e515")}catch{}})();const $=({event:t,isReady:e=!0})=>e?s.jsx(rt,{analytics:p,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function No(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b}=C(Xt),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${n??""}/invoicing`,I=r.useCallback(((A,U)=>{const _=ei(y,A,U,D);_!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:A,entityId:U,fromScreen:"audit_log"}),e(_))}),[D,e,y]);r.useEffect((()=>{const A=setTimeout((()=>d(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Ze({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,t]);const j=g==="Not-Started"||g==="In-Progress"&&f.length===0,E=g==="In-Progress"&&f.length>0,w=g==="Completed";return N(g)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:w}),s.jsx(lt,{auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b,entries:f,hasMore:S,isLoading:j,isLoadingMore:E,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&h!=null&&t(Ze({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function pe(t,e=!1){const n=P(),i=C((c=>Q(c).productNextCursor!=null)),a=C((c=>Q(c).productNextCursor)),o=C((c=>Q(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(se({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(se({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function fe(t,e,n,i){const[a,o]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),o((v=>v+1)))}),[c,e]),a}const Uo=new Set(["plan"]),Yn=[],Bo=fn((t=>t.length>0?t:Yn),gt),Vo=fn((t=>t.length>0?t:Yn),ut),Ho=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,groupedAccountOptions:Bo(n.qboAccountHierarchy),groupedClassOptions:Vo(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!==""?a=>{i!==""&&t(Sn({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&t(Fe({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(pn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(ni({action:o,id:a,parentItemId:i}))}}}))(dt);function qo(){const t=P(),e=L(),{item_id:n,tenantEmailDomain:i}=R(),[a]=K(),{areTenantIdsInSync:o}=T(),c=(d=a.get("kind"))!=null&&Uo.has(d)?d:"plan";var d;const l=C((k=>we(k,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(ce({id:n})),()=>{t(ce({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:c}))}),[o,n,c,t]);const g=r.useCallback((k=>t(xe({cacheOverride:!0,id:k,kind:c}))),[t,c]),S=fe(l.fetchState,l.isFormLoading,n,g),f=u==="Completed";pe(o,!0);const[h,D]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&D(n)}),[n,f]);const b=h!==n&&(u==="Not-Started"||u==="In-Progress");return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:b,view:l},S)]})}const zo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Qo=O((function(t,e){const n=we(t,e.itemId);return{fieldHelp:n.fieldHelp,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",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${n}/catalog/${encodeURIComponent(a)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(ce({id:a})),e.navigate(`${n}/catalog`)},onChange:c=>{t(Fe({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(pn({id:a}))}}}))(mt);function Ko(){const t=P(),e=L(),{item_id:n,tenantEmailDomain:i}=R(),[a]=K(),{areTenantIdsInSync:o}=T(),c=n!=null,d=a.get("type"),l=d!=null&&zo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const g=C((S=>we(S,n)));return pe(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:v}))}),[o,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(Fe({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const S=g.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(ce({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),s.jsx(Qo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const Go={addons:"addon",all:"item",charges:"charge",plans:"plan"},Wo=O((function(t,e){const n=Q(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,c=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=Go[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(Sn({action:ti(d),id:c}))},onLoadMore:()=>{if(a)return e.planNextCursor!=null&&t(Ke({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})));o!=null&&t(i?Ke({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):se({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(vt);function Yo(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=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]),D=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),b=C((A=>Q(A))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",w=b.runningActionId??null;return r.useEffect((()=>{const A=setTimeout((()=>v(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Qe({cacheOverride:!1,planFilters:h,productFilters:D,planSort:S,productSort:S}))}),[i,t,h,D,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==y?.field||S?.dir!==y?.dir)&&t(Qe({cacheOverride:!0,planFilters:h,productFilters:D,planSort:S,productSort:S}))}),[k,y,i,t,h,D,f,S]),N(b.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),s.jsx(Wo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:a,sortState:u,planFilters:h,productFilters:D,sort:S,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:w,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Jo=O((function(t,e){const n=hn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(re({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(oi({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:a}),t(ii({id:i}))}}}))(pt);function Xo(){const t=P(),e=L(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,savedCouponId:c}=C((d=>hn(d,n)));return r.useEffect((()=>{a&&t(be({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(re({id:n}))}}),[o,c,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCouponFormPage}),s.jsx(Jo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const ea=O((function(t){const e=In(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(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(En(a))},onSubmit:()=>{const a=ci(t.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(ri(a))}}}))(St);function na(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),[i]=K(),{areTenantIdsInSync:a}=T(),o=i.get("customerId"),c=C((I=>In(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(Cn),g=C((I=>ai(I))),S=C(ve),f=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,D=f||h,b=g.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,t(En({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{a&&t(si({cacheOverride:!1}))}),[a,t]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(j)}}),[d,v,e,n]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),D?s.jsx(ft,{}):s.jsx(ea,{navigate:e,tenantEmailDomain:n})]})}const ta=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(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(ht);function ia(){const t=P(),e=L(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>li(d,n??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(di({id:n}))}),[a,n,t]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(ta,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const oa=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",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(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(It);function aa(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,creditNoteListFetchState:b}=C((y=>{const I=kn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(We({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),s.jsx(oa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ui(y)),onSortChange:v})]})}const Jn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},sa=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t(je({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(Y(le)),t(Ci({id:i}))},onOpenAddress:()=>{const a=Jn(e.tenantEmailDomain??"",le,i),o=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(je({id:i,localData:a})),t(xn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(Ii({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>t(hi({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(kt);function ca(){const t=P(),e=L(),n=G(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((_=>Re(_,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[g,S]=r.useState(!1),[f,h]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&h(i)}),[i,c.record.fetchState]);const D=f===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const _=c.record.sendLinkState.fetchState;E.current!=="Error"&&_==="Error"&&t(mi({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=_}),[t,c.record.sendLinkState.fetchState]);const w=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(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((()=>{o&&i!=null&&t(vi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&j&&t(Ye({customerId:i}))}),[o,i,t,j]);const A=r.useCallback((_=>t(yn({id:_}))),[t]),U=fe(c.fetchState,c.isFormLoading,i,A);return N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(sa,{customerId:i??"",editView:c,hasLoadedRecord:D,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{t(ee()),i!=null&&j&&t(Ye({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ne()),S(!0)}},U),s.jsx(Ct,{errorMessage:w,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&t(fi({customerId:i}))},onClose:()=>{u(!1),t(ee())},onSavePaymentMethod:_=>{i!=null&&t(pi({customerId:i,data:_}))}}),s.jsx(Et,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),t(ne())},onSubmit:({amount:_,description:X})=>{i!=null&&t(Si({amount:_,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:X}))}})]})}const ra=O((function(t,e){const n=Re(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(bn({id:i})),t(Y(le)),e.navigate(`${n}/customers`)},onChange:c=>{t(je({id:i,localData:c}))},onOpenAddress:()=>{const c=Jn(e.tenantEmailDomain??"",le,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:a}),t(xn({id:i}))}}}))(yt);function la(){const t=P(),e=L(),n=G(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),{fetchState:c,savedCustomerId:d}=C((l=>Re(l,i)));return r.useEffect((()=>{o&&i!=null&&t(yn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),t(bn({id:i}))}}),[c,d,i,t,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerFormPage}),s.jsx(ra,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const da=O((function(t){const e=ve(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(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){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(jn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(xt);function ua(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,customerListFetchState:b}=C((y=>{const I=ve(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),s.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(Ei(y)),onSortChange:v})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ga=O((function(t,e){const{filters:n,sessionId:i,view:a}=e,o=i==null?void 0:a.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:n,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Le(a,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Le(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>a(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&t(Pe({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&t(_e(o))},onRollback:S?()=>{o!=null&&t(Dn(o))}:void 0}}))(bt);function ma(){const t=P(),e=L(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),[o,c]=r.useState({}),d=C(Te),l=Le(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(De(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const f=setTimeout((()=>{t(Pe({...o,sessionId:n}))}),300);return()=>clearTimeout(f)}),[a,t,o,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||n==null||!u)return;const f=setInterval((()=>{t(De(n)),t(Pe({...o,sessionId:n}))}),3e3);return()=>clearInterval(f)}),[a,t,o,u,n]);const g=r.useMemo((()=>{if(n==null)return;const f=new URLSearchParams;o.moduleId!=null&&f.set("module_id",o.moduleId),o.level!=null&&f.set("level",o.level),o.outcome!=null&&f.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&f.set("search",o.search.trim());const h=f.toString();return`${ae?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),S=v?.fetch.fetchState??"Not-Started";return N(S)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(ga,{downloadUrl:g,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Xn=t=>`invoicing_active_migration:${t}`,oe=(t,e)=>{if(t!=null&&t!=="")try{const n=Xn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},va=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const c=o??null;t(ie(c)),oe(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(_e(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(Dn(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(jt);function pa(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),a=C(Te);r.useEffect((()=>{i&&(t(ki()),t(Pn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(va,{navigate:e,tenantEmailDomain:n,view:a})]})}const fa=O((function(t,e){const{activeId:n,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:a?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:a?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=ae?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(bi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{n!=null&&t(_e(n))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(xi(n))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(yi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(Dt);function Sa(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),a=C(Cn),o=C(Oe).companyId??ye.getSignedInUserTenant(n??"")?.companyId,c=C((f=>Ln(f,o))),d=C(Te),{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(Me()),t(Pn()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const f=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Xn(h))}catch{return null}})(n);f!=null&&t(ie(f))}),[l,t,n]),r.useEffect((()=>{oe(n,l)}),[l,n]);const g=u?.status,S=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{t(De(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,t]),r.useEffect((()=>{g==="done"&&(t(ie(null)),oe(n,null))}),[t,g,n]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportMigratePage}),s.jsx(fa,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:n,view:d,onBack:()=>{t(ie(null)),oe(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ha=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{t(An({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(Di({data:a,id:i}))}}}))(Pt);function Ia(){const t=P(),e=L(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((h=>ji(h,n))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(re({id:n})),()=>{t(re({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(be({id:n}))}),[a,n,t]);const S=r.useCallback((h=>t(be({cacheOverride:!0,id:h}))),[t]),f=fe(o.fetchState,o.isFormLoading,n,S);return N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(ha,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const Ca=O((function(t){const e=$n(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(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{t(An({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Li({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Lt);function Ea(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=$n(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),s.jsx(Ca,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>t(Pi(I)),onSortChange:v})]})}const ka=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>t(q({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))($t);function ya(){const t=P(),e=L(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((E=>Ai(E,n??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[S,f]=r.useState(),[h,D]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),f(void 0),D(!1)}),[]),k=r.useCallback((()=>{if(n==null)return;t($i({id:n})),v("idle"),g(!1);const E=o.emailPreview.preview;f(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),D(!0)}),[n,t,o.emailPreview.preview]),y=r.useCallback((E=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:E,id:n})))}),[n,t,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(wi({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&d!=null&&t(Ne({invoiceId:d}))}),[a,d,t]),r.useEffect((()=>{v("idle"),g(!1),f(void 0),D(!1)}),[n]),r.useEffect((()=>{a||(v("idle"),g(!1),f(void 0),D(!1))}),[a]),r.useEffect((()=>{h&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(n!=null&&t(Fi({id:n})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,b,t,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(ka,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:j,onSendEmail:k}),s.jsx(At,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const xa=O((function(t){const e=wn(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(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||t(q({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Ti({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(wt);function ba(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,dunningCaseListFetchState:b}=C((y=>{const I=wn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(en({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),s.jsx(xa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(Ri(y)),onSortChange:v})]})}const ja=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Oi({data:{due_date:a.due_date!==""?a.due_date:void 0,notes:a.notes.trim()!==""?a.notes.split(`
2
+ `).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:a.po_number!==""?a.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:a}))}}}))(Ft);function Da(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((g=>Fn(g,n??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;return r.useEffect((()=>{a&&n!=null&&t(_i({invoiceId:n}))}),[a,n,t]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ja,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const Pa=O((function(t){const e=Rn(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(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){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,a)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&t(Tn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Rt);function La(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=Rn(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&t(Ie({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ie({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),s.jsx(Pa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{t(Mi(I)),t(Ie({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function rn(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),i=Tt(),a=mn(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C(_n),v=Ni(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=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(Mo,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),s.jsx(_t,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{t(Ui())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Aa=O((function(t,e){const n=On(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(zi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(qi())}}}))(Ot);function $a(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((f=>On(f,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(Bi()),g.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(Ne({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{c!=null&&n!=null&&o==="Completed"&&g.current!==n&&(g.current=n,t(Vi({localData:Hi(c)})))}),[t,o,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($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Aa,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const wa=O((function(t){return{invoicingOverview:Mn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Nn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Mt);function Fa(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>Mn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Nn(a))}),[i,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),s.jsx(wa,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const Ra=O((function(t){const e=Un(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(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Qi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Nt);function Ta(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:D,transactionListFetchState:b,transactions:k}=C((w=>{const A=Un(w);return{activeType:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,transactionListFetchState:A.fetchState,transactions:A.transactions}}),H),y=b==="Completed",I=`/${n}/invoicing`,j=r.useCallback((w=>{const A=k.find((_=>_.id===w)),U=A?.linkedInvoices?.[0]?.invoiceID??A?.invoiceID;U!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((w=>{const A=k.find((U=>U.id===w))?.customerID;A!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:A,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(A)}`))}),[e,I,k]);return r.useEffect((()=>{const w=setTimeout((()=>d(a)),300);return()=>clearTimeout(w)}),[a]),r.useEffect((()=>{i&&t(Ce({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ce({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),s.jsx(Ra,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onTypeChange:w=>{t(Zi(w)),t(Ce({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const _a=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function ln(){const t=P(),e=L(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=n!=null&&n!=="",c=C(ve),d=C((E=>Ki(E))),l=C(Gi),v=C((E=>Fn(E,n??""))),u=v.invoice,g=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Wi()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?Ne({invoiceId:n}):jn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&u!=null&&n!=null&&v.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Yi({contextInvoiceId:n,localData:Ji(u)})))}),[t,u,n,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==f.current&&(f.current=E,t(Tn({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(nn({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[t,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const D=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:_a(E)})))),[c.customers]),b=C((E=>Xi(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(w=E.amountDue,A=eo.currencySymbol,Bt("0,0.00",w,A)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var w,A}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",w=u.amountDue?.amount??0;return{amountDue:$e("0,0.00",u.amountDue),amountDueValue:w,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),s.jsx(Ut,{customers:D,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{t(nn({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(no(o?n??void 0:void 0))}})]})}const et=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Oa=(t,e)=>{if(t==null)return;const n=$e("0,0",t);return e!=null?`${n}/${e}`:n},nt=(t,e,n)=>{const i=[t,Oa(e,n)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},dn=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Ma=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:nt(t.productCode,t.price,t.periodUnit),value:t.priceCode}),Na=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Ua=O((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.products.filter((c=>c.itemType==="addon")).filter(dn).map((c=>({label:c.name??c.id,subtitle:nt(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,coupons:n.coupons.map(Na),isLoading:!e.hasLoadedRecord&&(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(dn).map(Ma),shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Vn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(de({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Y(ue)),t(oo({id:i}))},onOpenAddress:()=>{const c=et(e.tenantEmailDomain??"",ue,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(de({id:i,localData:c})),t(Bn({id:i}))},onCancelSubscription:a?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vt);function Ba(){const t=P(),e=L(),n=G(),{subscription_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((k=>Ue(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed",[S,f]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&f(i)}),[i,g]);const h=S===i;pe(o),r.useEffect((()=>{o&&i!=null&&t(to({id:i}))}),[o,i,t]);const D=r.useCallback((k=>t(io({id:k}))),[t]),b=fe(c.fetchState,c.isFormLoading,i,D);return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),s.jsx(Ua,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},b)]})}const Va=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},Ha=(t,e)=>{if(t==null)return;const n=$e("0,0",t);return e!=null?`${n}/${e}`:n},Ae=(t,e,n)=>{const i=[t,Ha(e,n)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},qa=t=>({label:Va(t),value:t.id}),ke=t=>t.priceCode!=null&&t.priceCode.trim()!=="",za=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:Ae(t.productCode,t.price,t.periodUnit),trialPeriod:t.trialPeriod,trialPeriodUnit:t.trialPeriodUnit,value:t.priceCode}),Za=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Qa=O((function(t,e){const n=Ue(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.products.filter((i=>i.itemType==="addon")).filter(ke).map((i=>({label:i.name??i.id,subtitle:Ae(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:n.products.filter((i=>i.itemType==="charge")).filter(ke).map((i=>({label:i.name??i.id,subtitle:Ae(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:n.coupons.map(Za),customers:n.customers.map(qa),errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans.filter(ke).map(za),shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Hn({id:i})),t(Y(ue)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(de({id:i,localData:o}))},onOpenAddress:()=>{const o=et(e.tenantEmailDomain??"",ue,i),c=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:a}),t(Bn({id:i}))}}}))(Ht);function Ka(){const t=P(),e=L(),n=G(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=K(),{areTenantIdsInSync:c}=T(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((S=>ao(S,i))),u=C((S=>Ue(S,i).localData));pe(c),r.useEffect((()=>{c&&t(so({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(de({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),t(Hn({id:i}))}}),[l,v,i,t,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),s.jsx(Qa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Ga=O((function(t){const e=qn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),t(Vn({action:o,id:a,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const c=o?.trim()??"";c!==""&&i(a,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(a,o,c)=>{o!=="pause"?i(a,o):i(a,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(lo({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(qt);function Wa(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:D,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=qn(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),H),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(tn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(tn({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&t(co())}),[k,i,t]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),s.jsx(Ga,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:D,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>t(ro(j)),onSortChange:v})]})}const Ya=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(mo({action:"capture",id:i}))}:void 0}}))(zt);function Ja(){const t=P(),e=L(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>uo(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(go({id:i}))}),[a,i,t]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ya,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function tt(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=P(),{areTenantIdsInSync:c}=T(),d=C(Be),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(zn()),n&&o(vo()))}),[c,o,e,n,a]),r.useEffect((()=>{e&&c&&l&&i&&o(po())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Xa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function J(t){const e=P(),{areTenantIdsInSync:n}=T(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(fo),{configError:u,configFetchState:g,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D}=C(Zn),b=C(Be);tt({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Oe),y=t==="dunning"||t==="quickbooks",I=k.companyId??ye.getSignedInUserTenant(i??"")?.companyId,j=C((F=>Ln(F,I))),E=So(k.userRole??[]),w=k.tenantId??"",A=ye.getSignedInUser(),U={userId:A?.userId??"",sessionId:A?.zeniSessionId??"",tenantId:w},_=c?.fileId,X=C((F=>_!=null&&_!==""?ho(F,_):void 0)),Ve=C((F=>_!=null&&_!==""?Io(F,_):void 0)),it=_!=null&&_!==""&&X!=null?{[_]:X}:{},ot=_!=null&&_!==""&&Ve!=null?{[_]:Ve}:{};r.useEffect((()=>(e(on()),()=>{e(on())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[n,e,a]),r.useEffect((()=>{n&&y&&g==="Not-Started"&&e(ge())}),[n,e,g,y]),r.useEffect((()=>{if(!n)return;const F=A?.userId;F!=null&&F!==""&&w!==""&&ze.shouldFetchActiveTenant(w)&&(ze.markActiveTenantFetchStarted(w),e(Co(F,w,A?.zeniSessionId)))}),[n,e,A?.userId,A?.zeniSessionId,w]);const at=S.length>0||f.length>0,st=a==="Not-Started"||a==="In-Progress"&&l==null||y&&!at&&(g==="Not-Started"||g==="In-Progress"),ct=a==="Completed"&&(!y||g==="Completed"),He=j.externalConnections?.revenue?.find((F=>F.connectionName==="chargebee"))?.connectionId,Se=ae?.invoicingMicroServiceBaseUrl,qe=Se!=null&&Se.length>0?`${Se}/1.0/webhooks/stripe`:"",he={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:F=>e(sn(F)),onDisconnect:(F,z)=>{w!==""&&e(Do(w,F,cn(z)))},onDisconnectStripe:()=>e(an()),onReconnectQBO:()=>{const F=k.tenantEmailDomain??i??"";me.init("/connection/auth",F),me.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Gn())},onSaveChargeBeeCredentials:(F,z)=>{He!=null&&w!==""&&e(bo(w,He,cn("revenue"),jo("chargebee"),{api_key:F,site:z}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:U,deleteFileStatusById:it,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:ae?.fileMicroServiceBaseUrl??"",integrationsSectionProps:he,isInvoicingPageReady:ct,isLoading:st,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:ot,onConnectStripe:F=>e(sn(F)),onDeleteFile:F=>e(xo(F,w)),onDisconnectStripe:()=>e(an()),onEditFileName:(F,z)=>e(yo(F,z,w)),onReconnectQBO:he.onReconnectQBO,onRefreshQBO:he.onRefreshQBO,onRetryQboSyncTask:F=>e(Kn(F)),onSave:F=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(ko({settings:F,snackbarSection:Xa[t??""]}))},onStartQboBackfill:F=>e(Qn(F)),updateFilesEntity:F=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(Eo({files:F}))}}}function un({appContent:t}){const e=L(),n=G(),i=P(),{tenantEmailDomain:a}=R(),o=J("branding"),c=C((v=>Po(v))),d=C((v=>Lo(Ee,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Ao()),i(Y(Ee)))}),[c.saveState.fetchState,i]);const l=vn(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($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Zt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(wo({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${Ee}/`,u=W(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i($o()),updateFilesEntity:o.updateFilesEntity})]})}function es(){const t=L(),e=J("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function ns(){const t=L(),e=J("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Kt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function ts(){const t=L(),e=J("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.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 is=O((function(t){const e=Wn(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(To({localData:e}))},onReset:()=>{t(Ro())},onRetryTask:e=>{t(Kn(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(Fo())},onStartBackfill:e=>{t(Qn(e))}}}))(Wt);function os(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),i=C(Oe),{configFetchState:a,settingsFetchState:o}=C(Wn);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||t(Me())}),[t,o]),r.useEffect((()=>{a==="Not-Started"&&t(ge())}),[a,t]),tt({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage}),s.jsx(is,{onBackClick:()=>e(".."),onReconnect:()=>{me.init("/connection/auth",i.tenantEmailDomain??n??""),me.handleClick()},onRefresh:()=>t(Gn())})]})}const as={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function ss(){const t=mn(),e=P(),n=L(),[i,a]=K(),o=J(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Zn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const S=as[g];a({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[g,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Yt,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(_o())}})]})}function gn(){return s.jsxs(te,{children:[s.jsx(x,{index:!0,element:s.jsx(ss,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(ts,{})}),s.jsx(x,{path:"branding",element:s.jsx(un,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(un,{appContent:s.jsx(Z,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(ns,{})}),s.jsx(x,{path:"dunning",element:s.jsx(es,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(os,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function Rs(){const t=P(),e=L(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=T(),{enableState:a,fetchState:o,status:c}=C(_n),d=vn(a.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=C((g=>Be(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,t(ge({cacheOverride:!1}))):t(ge({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&u==="Not-Started"&&t(zn())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),t(Oo()))}),[d,a.fetchState,l,t,e]),c==null&&o!=="Error"?s.jsx(Jt,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(te,{children:[s.jsx(x,{path:"promo",element:s.jsx(rn,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(te,{children:[s.jsx(x,{path:"promo",element:s.jsx(rn,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(gn,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(te,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Fa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ua,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(la,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(Z,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(ca,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(Z,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Wa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(Ka,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(Z,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ba,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(Z,{})}),s.jsx(x,{path:"invoices",element:s.jsx(La,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(na,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(Da,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(ln,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx($a,{})}),s.jsx(x,{path:"payments",element:s.jsx(Ta,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(ln,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Ja,{})}),s.jsx(x,{path:"credits",element:s.jsx(aa,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ia,{})}),s.jsx(x,{path:"discounts",element:s.jsx(Ea,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Xo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ba,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(ya,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Yo,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(Ko,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(qo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(gn,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(No,{})}),s.jsx(x,{path:"data_import",element:s.jsx(pa,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(Sa,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(ma,{})}),s.jsx(x,{path:"*",element:s.jsx(M,{})})]})}export{Rs as default};
@@ -0,0 +1,72 @@
1
+ import{j as t}from"./liveblocks-DJozFz1F.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-DrG65cn7.js";import{Uj as k,Uk as v,Ul as T,Jn as D,J9 as U,Um as A,Un as oe,Uo as ie,Jd as se,gi as $,Jk as le,Jh as re}from"./zeni-epic-state-1I_oueWp.js";import{a2 as x,F as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,c as ue,A as he,a7 as ge,M as xe,E as fe,f as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-BRSI70wf.js";import{n as m}from"./mui-DqsEgFea.js";import f from"./NotFoundScreen-CaUndFTs.js";import{a as I}from"./sentry-C1W0cBeR.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="215308ec-6645-4dc0-9906-fb5fe8c62704",e._sentryDebugIdIdentifier="sentry-dbid-215308ec-6645-4dc0-9906-fb5fe8c62704")}catch{}})();const Ie=m.div`
2
+ display: flex;
3
+ height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
+ `,Ce=g((function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
11
+ display: flex;
12
+ height: 100vh;
13
+ width: 100%;
14
+ flex: 1 1 auto;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ background-color: ${e=>e.theme.colors.grey4};
18
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
+ `,Ae=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:A(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Be({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Ae,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
20
+ display: flex;
21
+ height: 100%;
22
+ width: 100%;
23
+ flex: 1 1 auto;
24
+ flex-direction: column;
25
+ align-items: center;
26
+ background-color: ${e=>e.theme.colors.grey4};
27
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
+ `,Ne=g((function(e){const a=k(e),n=v(e),o=A(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Le,{windowSize:n,children:t.jsx(Ne,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
+ display: flex;
30
+ height: 100%;
31
+ width: 100%;
32
+ flex: 1 1 auto;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ background-color: ${e=>e.theme.colors.grey4};
36
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
+ `,Te=g((function(e){const a=k(e),n=v(e),o=A(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Je=m(ke)`
38
+ width: ${r.sp4};
39
+ height: ${r.sp4};
40
+ margin-bottom: ${r.sp3};
41
+ margin-top: ${r.sp3};
42
+ margin-left: ${r.sp8};
43
+ cursor: pointer;
44
+ position: absolute;
45
+ color: ${e=>e.theme.colors.brandColorJade};
46
+ `,Me=m.div`
47
+ display: flex;
48
+ height: 100vh;
49
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
+ width: 100vw;
51
+ overflow-y: scroll;
52
+ background-color: ${e=>e.theme.colors.grey4};
53
+ `,He=m.div`
54
+ display: flex;
55
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
+ flex-direction: column;
57
+ width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
+ padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
61
+ `,Ve=m.div`
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
67
+ height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
+ overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
+ width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
+ background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
+ margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
+ `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),M=n.pathname.includes("address"),w=x(),H=xe(),B=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:L,sessionId:N}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[b,c,i,o,d,a]),I.useEffect((()=>{b&&c==="Completed"&&($(L,N,z),l!=null&&a(re(l)))}),[c,b,L,N,z,l,a]),c==="Error"?t.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:B.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${B.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,R))(u)}),t.jsxs(Me,{windowSize:w,children:[w!=="small"?t.jsx(Je,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(He,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Be,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -0,0 +1,12 @@
1
+ import{j as g}from"./liveblocks-DJozFz1F.js";import{a as u}from"./sentry-C1W0cBeR.js";import{u as O,g as _,h as w,t as V,j as l,N as U}from"./core-DrG65cn7.js";import{z as r,E as M,G as P,O as A,k as N,S as $,$ as G,a0 as R,V as W}from"./index-BRSI70wf.js";import{fF as q,TO as B,Uf as H,U6 as J,gi as K,gk as Q,Ub as X,gU as Y,dj as Z,Ug as ee,Uh as te}from"./zeni-epic-state-1I_oueWp.js";import{n as ne}from"./mui-DqsEgFea.js";import{u as se}from"./useDeviceId-BQkxGsaf.js";import{f as ae}from"./analyticsHelper-yYV2XYgm.js";import{t as ie}from"./getLocaleForTenant-DB6O4KHG.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.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]="e7345052-c2c5-4fc0-bcc6-a8332d93deec",t._sentryDebugIdIdentifier="sentry-dbid-e7345052-c2c5-4fc0-bcc6-a8332d93deec")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[b]=V(),n=b.get("token"),p=b.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:c,twoFAPhoneNumber:D,magicLinkEmail:d,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>q(e))),k=l((e=>B(e))),C=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(H(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),u.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(J(k.tenantsInOrder),s.zeniSessionId),K(s.userId,s.zeniSessionId,o.tenantId),t(Q(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=W();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[h,S,y,s,o,k,v,a.state,t]);const E=u.useCallback((()=>{m("/signin/auth")}),[m]),j=u.useCallback((()=>{i!=null&&c!=null&&d!=null&&t(ee(i,d,c))}),[i,c,t,d]),F=u.useCallback((e=>{i!=null&&n!=null&&d!=null&&c!=null&&t(te(e,i,d,c))}),[i,n,t,d,c]);if(I==="Completed"&&c!=null)return g.jsx(G,{phoneNumber:D,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||C!=null){const e=a.state?.origin??"/";return g.jsx(U,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(U,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(R,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ z-index: 9999;
11
+ background-color: ${t=>t.theme.colors.background};
12
+ `;export{Te as default};
@@ -0,0 +1 @@
1
+ import{j as B}from"./liveblocks-DJozFz1F.js";import{a as f}from"./sentry-C1W0cBeR.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-DrG65cn7.js";import{fF as ne,TP as xe,TQ as se,g9 as Ne,fE as Pe,TZ as Re,TS as Ue,TT as Ve,p$ as Le,gm as Oe,TW as b,T$ as je,U0 as J,gn as Ze,U1 as ze,E5 as Ye,h1 as qe,cV as He,U2 as We,g8 as Qe,go as Xe}from"./zeni-epic-state-1I_oueWp.js";import{w as Je,i as Ke,M as ea,c as aa,d as ta,f as na,u as sa,A as c,g as oa,X as ia,z as ra,e as da,l as ca,Y as la,q as ua,n as fa,o as K,L as ma,B as ha,C as ba,p as S,k as ee,s as pa,U as ae,x as ga,y as Sa}from"./index-BRSI70wf.js";import{D as Ea}from"./mui-DqsEgFea.js";import{u as ka}from"./InboxNotificationsProvider-Dwt_tkdC.js";import{u as Ta}from"./useTaskManagerAccess-CeXMA9mP.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]="d47863ff-9ac4-4c8c-ba4f-f6445f513f09",l._sentryDebugIdIdentifier="sentry-dbid-d47863ff-9ac4-4c8c-ba4f-f6445f513f09")}catch{}})();const Ca=Je((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),_=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=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=>Ue(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(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):[])),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),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>b(e).totalUnreadCount)),Te=t((e=>b(e).reducedFetchCountState)),U=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=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:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=ka();f.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),f.useEffect((()=>{T&&k&&!m&&L.fetchState==="Not-Started"&&_.tenantId!=null&&r(je("task_manager","dashboard"))}),[T,k,m,L.fetchState,_.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:Te,count:ke},Y=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>Y?.tenantId!=null?Ze(e,Y.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 H=t((e=>ze(e,h).fetchState)),W=t((e=>Ye(e).fetchState)),ye=A&&(H==="Completed"||H==="Error")||x&&(W==="Completed"||W==="Error")||!A&&!x?void 0:"disabled",we=f.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=He(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&We(P.notificationSettings,p.userEmail,N,o,k),Q=da(),Fe=Q&&ca(a);return B.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:B.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:K(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:Q,onNotificationIconClick:()=>{i(!1);let e=U===0&&V>0?"notifications/comments":"notifications/tasks";K(a)&&(e=U===0&&V>0?"../../notifications/comments":"../../notifications/tasks");const u=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:S(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),X=e.type,Be=ae(X)&&X!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),Be&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const _e=ga(e.type);Sa(e.type)?(G!=null&&r(Xe()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${_e}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(ma.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Qe({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),_a=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Ke(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return B.jsx(Ca,{...l,...a})};export{_a as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DJozFz1F.js";import{h as r,l as n}from"./core-DrG65cn7.js";import{an as i}from"./index-BRSI70wf.js";import"./mui-DqsEgFea.js";import"./sentry-C1W0cBeR.js";import"./zeni-epic-state-1I_oueWp.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-DJozFz1F.js";import ut from"./NotFoundScreen-CaUndFTs.js";import{a as k}from"./sentry-C1W0cBeR.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 O}from"./core-DrG65cn7.js";import{cA as It,TS as Y,fF as H,h1 as Tt,TW as b,a0Q as K,U0 as m,TQ as y,An as j,G2 as Ct,a0R as At,TP as yt,U2 as Et,As as _t,a0S as F,br as $,gh as x,Aw as X,a0T as Nt,cM as wt,cF as Bt}from"./zeni-epic-state-1I_oueWp.js";import{ar as xt,d as Rt,c as vt,A as Pt,at as Dt,dN as Ut,p as w,dO as Gt,w as Mt,dP as Ft,i as $t,a5 as jt}from"./index-BRSI70wf.js";import"./mui-DqsEgFea.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-DgHBW0CH.js";import{u as Lt}from"./useTaskManagerAccess-CeXMA9mP.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.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]="b4c46897-9fe5-4427-8eae-b49883b91025",t._sentryDebugIdIdentifier="sentry-dbid-b4c46897-9fe5-4427-8eae-b49883b91025")}catch{}})();const Qt=(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=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=H(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:v}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(F([a],$())));let i=`/${h}/${r[1]}`;const T=w(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!wt(g)&&(i="not-found"),r[1].startsWith("bill")&&!Bt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(K(a,s));const d=`../${a}`,r=w(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 v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(F([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({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")),Qt(o,I).then((()=>{t(F(o,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({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=w(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt(Ft)),qt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=Rt(),[I,v]=k.useState(!1),a=S((e=>Y(e))),s=S((e=>H(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Pt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Dt({isDataReady:!0});const Z=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)),L=S((e=>b(e).currentTab)),P=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),D=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Ut().allUsers,{inboxNotifications:B,isLoading:E,hasFetchedAll:C,isFetchingMore:U,fetchMore:ot}=mt(),{threads:Q,isLoading:W,fetchMore:q,isFetchingMore:z,hasFetchedAll:J}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(K(c)),c==null){const e=`../${L}`,p=w(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&B!=null){const e=`dashboard_${s.companyId}`,p=B.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(y({unreadCount:p},"comments"))}}),[E,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 G=E||U===!0||C!==!0||E||U===!0||C!==!0;k.useEffect((()=>{G&&D!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):G||D!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[G,D]),k.useEffect((()=>{o(y({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(v(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&W===!1&&B!=null&&Q!=null){const e=`dashboard_${s.companyId}`,p=B.filter((u=>u.roomId===e)).filter((u=>Gt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=Q.find((dt=>{return dt.id===((R=u).kind==="thread"?R.threadId:"subjectId"in R?R.subjectId:void 0);var R}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(z||J===!0||q==null||q(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,U,z,C,J,W,B?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if($t(p)){const A=yt(p.mode);if(A==="dashboard"&&o(y({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];P==="all"?_.push("read","unread"):P!=="mentions"&&_.push(P),o(j("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return N.jsx(Wt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(O,{path:"/:selectedTab",element:N.jsx(qt,{})}),N.jsx(O,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
@@ -0,0 +1 @@
1
+ import{j as f}from"./liveblocks-DJozFz1F.js";import{a as r}from"./sentry-C1W0cBeR.js";import{u as A,g as j,j as o,N as x}from"./core-DrG65cn7.js";import{Ut as C,fF as P,gm as z,Uu as D,Uv as M,Uw as R,Ux as L,pS as k,T8 as N}from"./zeni-epic-state-1I_oueWp.js";import{z as h,ai as I}from"./index-BRSI70wf.js";import"./mui-DqsEgFea.js";import"./recharts-Bmrae78L.js";import"./analytics-EJdRN0EM.js";import"./plaid-KeCmRFX0.js";import"./dnd-ySxwrcGd.js";import"./stripe-cKAAJElX.js";import"./lottie-B54UhbRD.js";import"./lexical-DsG4GgCt.js";import"./pdf-0ccxH7eS.js";import"./utils-BYrZSa_o.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="15e001c5-e587-4a3b-8930-2ad56812c915",n._sentryDebugIdIdentifier="sentry-dbid-15e001c5-e587-4a3b-8930-2ad56812c915")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>C(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),p=h.isSignedIn(),a=h.getSignedInUser(),m=o((e=>P(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),v=o(M),c=o(R),[S,U]=r.useState(null),[b,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&a!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[p,a,d,n]),r.useEffect((()=>{c!=null&&c!==""&&(window.location.href=c)}),[c]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),u=S??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:U,approveError:b??v,isApproving:y==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&a!=null&&u!=null&&n(N(a.userId,a.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.")}}}):f.jsx(x,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};