@zeniai/web-app-ui 5.3.47-dev → 5.3.48-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 (159) hide show
  1. package/dist/assets/AccountMappingScreen-DeHsC__B.js +9 -0
  2. package/dist/assets/AddressRoutes-Bh2vRJBa.js +1 -0
  3. package/dist/assets/AddressScreen-C9Fk_Z55.js +9 -0
  4. package/dist/assets/AiCfoScreen-DB41E0VN.js +22 -0
  5. package/dist/assets/{AppDrawer-D4O6tn5i.js → AppDrawer-XdZKck2N.js} +3 -3
  6. package/dist/assets/{BillPayApprovalRoutes-BY4P9AKu.js → BillPayApprovalRoutes-Dyxgp6fW.js} +1 -1
  7. package/dist/assets/BillPayRoutes-Bp82WT-5.js +119 -0
  8. package/dist/assets/BusinessVerificationPageScreen-BT5PhS2R.js +9 -0
  9. package/dist/assets/CardsAiCfoScreen-CgeqAvem.js +14 -0
  10. package/dist/assets/ChargeCardRoutes-Ds9toMfJ.js +71 -0
  11. package/dist/assets/CompanyPassportScreen-B2k7aWUB.js +1 -0
  12. package/dist/assets/ConnectionAuthScreen-DrhuD992.js +11 -0
  13. package/dist/assets/CustomerOnboardingAuthScreen-CpbSTPlS.js +1 -0
  14. package/dist/assets/{CustomerOnboardingRoutes-DV3rYEiJ.js → CustomerOnboardingRoutes-RIeFd0Jj.js} +3 -3
  15. package/dist/assets/{DashboardRoutes-D5hdkebN.js → DashboardRoutes-DqcCIUfr.js} +4 -4
  16. package/dist/assets/{DefaultTenantHome-DCPi_wXC.js → DefaultTenantHome-DhG1xEfc.js} +1 -1
  17. package/dist/assets/DomesticWireDetailScreen-BKq5jjLx.js +18 -0
  18. package/dist/assets/{DrawerScreen-BihZ_PpN.js → DrawerScreen-DsFB_53j.js} +1 -1
  19. package/dist/assets/EntityDetailRoutes-mt1xcJ7j.js +1 -0
  20. package/dist/assets/ExpenseAutomationRoutes-lC_JLdAl.js +38 -0
  21. package/dist/assets/FeaturePreviewScreen-BFU7MG_7.js +1 -0
  22. package/dist/assets/HubSpotOAuthCallbackScreen-sKmwa_VW.js +1 -0
  23. package/dist/assets/InboxNotificationsProvider-CLtB_fgp.js +1 -0
  24. package/dist/assets/InvoicingRoutes-9v2-NT7u.js +2 -0
  25. package/dist/assets/MagicLinkRoutes-CXFrKDZN.js +72 -0
  26. package/dist/assets/MagicLinkSignInScreen-dmwIRx3p.js +12 -0
  27. package/dist/assets/MobileAppDrawer-cBt39NZW.js +1 -0
  28. package/dist/assets/NotFoundScreen-DFQDCCRn.js +1 -0
  29. package/dist/assets/NotificationRoutes-DBx2Hpze.js +1 -0
  30. package/dist/assets/OAuthConsentScreen-Y007Isid.js +1 -0
  31. package/dist/assets/PandLWithForecastRoutes-C51wwulq.js +1 -0
  32. package/dist/assets/{PaymentLinkScreen-B8bPleIr.js → PaymentLinkScreen-DJghRBso.js} +7 -7
  33. package/dist/assets/PeopleRoutes-Bm7sOBGu.js +22 -0
  34. package/dist/assets/PerformanceRoutes-BqAferL2.js +1 -0
  35. package/dist/assets/{Preview-DMLQokX_.js → Preview-BTwrFAaN.js} +1 -1
  36. package/dist/assets/{QBOConnectionScreen-CWU6DFJl.js → QBOConnectionScreen-UblfZAiA.js} +1 -1
  37. package/dist/assets/ReimbursementApprovalRoutes-DEDn1IHB.js +1 -0
  38. package/dist/assets/ReimbursementApprovalRuleDetailScreen-QDei_Fzl.js +1 -0
  39. package/dist/assets/{ReimbursementRoutes-BdJ3oqBf.js → ReimbursementRoutes-BHG-L5Ik.js} +9 -9
  40. package/dist/assets/ReportsRoutes-1SHXwblc.js +1 -0
  41. package/dist/assets/RewardsRoutes-bKzfn6ay.js +1 -0
  42. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CdJ2LE-G.js +25 -0
  43. package/dist/assets/ScreenRoutes-Bz0Iu7E_.js +2 -0
  44. package/dist/assets/{SettingsRoutes-BGCz0_nd.js → SettingsRoutes-pgiyjQKt.js} +6 -6
  45. package/dist/assets/{SetupPagesScreen-DzNRL7Y-.js → SetupPagesScreen-Dzk7fHhk.js} +5 -5
  46. package/dist/assets/SignInScreen-Rmz1EJ3i.js +1 -0
  47. package/dist/assets/SignOutScreen-BgL1D0p9.js +9 -0
  48. package/dist/assets/{TaskListScreen-Br-mxkKM.js → TaskListScreen-BjJ59grh.js} +2 -2
  49. package/dist/assets/TaskRoutes-cixN3J6B.js +9 -0
  50. package/dist/assets/TransactionDetailRoutes-B_IKz98q.js +1 -0
  51. package/dist/assets/{TransactionDetailScreen-Bp7IFDK0.js → TransactionDetailScreen-BzVEfQec.js} +2 -2
  52. package/dist/assets/TransactionListRoutes-DiO8Bs9p.js +1 -0
  53. package/dist/assets/{TreasuryRoutes-BvvMozYl.js → TreasuryRoutes-DMo68xKo.js} +6 -6
  54. package/dist/assets/{VendorsRoutes-DsJ_lcDO.js → VendorsRoutes-DcubMsnX.js} +17 -17
  55. package/dist/assets/WiseConfirmationScreen-C40X1D6g.js +12 -0
  56. package/dist/assets/ZeniAccountRoutes-B2XcNL7K.js +57 -0
  57. package/dist/assets/ZeniAccountStatementScreen-B4EqmylS.js +9 -0
  58. package/dist/assets/{accountMappingHelper-DqBiQF6x.js → accountMappingHelper-C7mDOec7.js} +1 -1
  59. package/dist/assets/{analytics-D6GpUSOP.js → analytics-D1aMnBue.js} +1 -1
  60. package/dist/assets/{analyticsHelper-CwB3kQvw.js → analyticsHelper-BefphWIe.js} +1 -1
  61. package/dist/assets/{core-B5mDy9pu.js → core-DA_GbUVO.js} +1 -1
  62. package/dist/assets/{decodeURIComponentSafe-DANuhXnG.js → decodeURIComponentSafe-BeWrvHuJ.js} +1 -1
  63. package/dist/assets/{dnd-CGWe1ZMP.js → dnd-BVDuXkBA.js} +1 -1
  64. package/dist/assets/{empty-D0y6rZ_X.js → empty-DkYQEFBR.js} +1 -1
  65. package/dist/assets/{empty-Dj4ZMRNZ.js → empty-kmkuoqGV.js} +1 -1
  66. package/dist/assets/{emptyVideoElement-BbYSqu6F.js → emptyVideoElement-Dr5ohcS7.js} +1 -1
  67. package/dist/assets/epic-DZfUNOLM.js +2 -0
  68. package/dist/assets/expenseAutomationHelper-4Qy8IF7o.js +1 -0
  69. package/dist/assets/{getLocaleForTenant-DH5Avx3x.js → getLocaleForTenant-BYa6QBcb.js} +1 -1
  70. package/dist/assets/{index-BQBXaLiB.js → index-B02Uvg0e.js} +1 -1
  71. package/dist/assets/{index-8s12XWuB.js → index-BVMI-pAw.js} +1 -1
  72. package/dist/assets/{index-k1-Pd2Ki.js → index-BqUvSiTi.js} +1 -1
  73. package/dist/assets/{index-fq0DUtem.js → index-BsYcIz8M.js} +1 -1
  74. package/dist/assets/{index-CI8tXM3D.js → index-C4n_QrNU.js} +1 -1
  75. package/dist/assets/{index-G6Wb7pfX.js → index-C5j9ulaE.js} +2 -2
  76. package/dist/assets/index-CY-CsK5V.js +1 -0
  77. package/dist/assets/{index-6nH5LMe4.js → index-CsnAk3jU.js} +30661 -31464
  78. package/dist/assets/{lexical-DW4lC8Zx.js → lexical-Czsku2z1.js} +1 -1
  79. package/dist/assets/{liveblocks-UOzcPsHa.js → liveblocks-DTaiayIC.js} +2 -2
  80. package/dist/assets/{lottie-C5eNvt0I.js → lottie-CkYI8upo.js} +1 -1
  81. package/dist/assets/{mui-Do6nLzGb.js → mui-yMDYeeMr.js} +1 -1
  82. package/dist/assets/{pathToGoBack-DP_bGWF-.js → pathToGoBack-nmNIndUw.js} +1 -1
  83. package/dist/assets/{pdf-DjwvAC2g.js → pdf-BIYA0Nfl.js} +3 -3
  84. package/dist/assets/{pdf-lib-CZXOqgb4.js → pdf-lib-DZGnWz6X.js} +1 -1
  85. package/dist/assets/{plaid-0g_vwjSd.js → plaid-BtwBxM-6.js} +1 -1
  86. package/dist/assets/{pusher-BwlPp2s7.js → pusher-8BUSKGPT.js} +1 -1
  87. package/dist/assets/{react-BsXfT48C.js → react-Bs3cqIIe.js} +1 -1
  88. package/dist/assets/{react-CU01hiuh.js → react-C6ZyRyfn.js} +1 -1
  89. package/dist/assets/{react-Bja4MeVO.js → react-CxBgzLVF.js} +1 -1
  90. package/dist/assets/{react-Dex3foBA.js → react-a48nQACt.js} +1 -1
  91. package/dist/assets/{react-RZilWHYG.js → react-bpjj59R_.js} +1 -1
  92. package/dist/assets/{react-DkYBVdJJ.js → react-uoYsSJ7d.js} +1 -1
  93. package/dist/assets/{recharts-uFX1dZS-.js → recharts-D3wE7yHJ.js} +1 -1
  94. package/dist/assets/{routePaths-uBvxqlLY.js → routePaths-DeWRBZpS.js} +1 -1
  95. package/dist/assets/{sentry-DHDsO12F.js → sentry-BRmieicQ.js} +1 -1
  96. package/dist/assets/{url-CLCy7GPP.js → url-BAbGMJa_.js} +1 -1
  97. package/dist/assets/{url-BxiN6LKq.js → url-DXDQoAPC.js} +1 -1
  98. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-D8KJqvT7.js → useAiCfoDashboardSuggestedQuestionsChips-SoHaFZ4W.js} +1 -1
  99. package/dist/assets/useAskAiCfoHostNavButtonProps-BOgWSkqa.js +1 -0
  100. package/dist/assets/{useChargeCardPusherEvents-BnH8_thb.js → useChargeCardPusherEvents-C1Fc6NgG.js} +1 -1
  101. package/dist/assets/{useDeviceId-Bi38IJl0.js → useDeviceId-CZzjV8tQ.js} +1 -1
  102. package/dist/assets/{useEmailConnectResultRefresh-Ba8t-BuL.js → useEmailConnectResultRefresh-DtruKk0s.js} +1 -1
  103. package/dist/assets/{useInitialThreadRequest-7Q8HJAH2.js → useInitialThreadRequest-BJ6-q-Ev.js} +1 -1
  104. package/dist/assets/useTaskManagerAccess-Bm40mz18.js +1 -0
  105. package/dist/assets/{utils-BsODCDYR.js → utils-UMm0RYR6.js} +1 -1
  106. package/dist/assets/withTransactionSidePanel-aokrUwcT.js +25 -0
  107. package/dist/assets/{zeni-epic-state-7eY0g-Bc.js → zeni-epic-state-cafsD4rZ.js} +6 -6
  108. package/dist/index.html +1 -1
  109. package/package.json +6 -6
  110. package/dist/assets/AccountMappingScreen-Euit4Ttk.js +0 -9
  111. package/dist/assets/ActualMatchingMatchDetailScreen-BBYzjOqh.js +0 -1
  112. package/dist/assets/AddressRoutes-PvYGzHCA.js +0 -1
  113. package/dist/assets/AddressScreen-DsGvV3N8.js +0 -9
  114. package/dist/assets/AiCfoScreen-DAEPn0_B.js +0 -22
  115. package/dist/assets/BillPayRoutes-CWc4tAqm.js +0 -119
  116. package/dist/assets/BusinessVerificationPageScreen-CSruI1nV.js +0 -9
  117. package/dist/assets/CardsAiCfoScreen-COoYscKz.js +0 -14
  118. package/dist/assets/ChargeCardRoutes-BU6-pfJv.js +0 -71
  119. package/dist/assets/CompanyPassportScreen-BxoatMVb.js +0 -1
  120. package/dist/assets/ConnectionAuthScreen-zbcvhPbz.js +0 -11
  121. package/dist/assets/CustomerOnboardingAuthScreen-8IwDeKdF.js +0 -1
  122. package/dist/assets/DomesticWireDetailScreen-DgE28aJN.js +0 -18
  123. package/dist/assets/EntityDetailRoutes-BqX-J3vM.js +0 -1
  124. package/dist/assets/ExpenseAutomationRoutes-DK-U-YTd.js +0 -38
  125. package/dist/assets/FeaturePreviewScreen-5SleVFKv.js +0 -1
  126. package/dist/assets/HubSpotOAuthCallbackScreen-2RxbRDTZ.js +0 -1
  127. package/dist/assets/InboxNotificationsProvider-BmF5-_KA.js +0 -1
  128. package/dist/assets/InvoicingRoutes-D0S6fDxY.js +0 -2
  129. package/dist/assets/MagicLinkRoutes-C22EnpRm.js +0 -72
  130. package/dist/assets/MagicLinkSignInScreen-BVf-rLEH.js +0 -12
  131. package/dist/assets/MobileAppDrawer-0YtWXA3B.js +0 -1
  132. package/dist/assets/NotFoundScreen-BkYIKPgh.js +0 -1
  133. package/dist/assets/NotificationRoutes-CZQRvVbE.js +0 -1
  134. package/dist/assets/OAuthConsentScreen-Q7ZDvc1F.js +0 -1
  135. package/dist/assets/PandLWithForecastRoutes-BzO_OgSq.js +0 -1
  136. package/dist/assets/PeopleRoutes-D_nqmuPM.js +0 -22
  137. package/dist/assets/PerformanceRoutes-BW6dixVF.js +0 -1
  138. package/dist/assets/ReimbursementApprovalRoutes-DAusugdf.js +0 -1
  139. package/dist/assets/ReimbursementApprovalRuleDetailScreen-phJuB98f.js +0 -1
  140. package/dist/assets/ReportsRoutes-CDSCG28G.js +0 -1
  141. package/dist/assets/RewardsRoutes-CHkOPz1g.js +0 -1
  142. package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-DnVEpQsK.js +0 -33
  143. package/dist/assets/ScreenRoutes-BYAPWka6.js +0 -2
  144. package/dist/assets/SignInScreen-BREpWd6T.js +0 -1
  145. package/dist/assets/SignOutScreen-BNCpbut8.js +0 -9
  146. package/dist/assets/TaskRoutes-CDuiJExM.js +0 -9
  147. package/dist/assets/TransactionDetailRoutes-CYb-4jKQ.js +0 -1
  148. package/dist/assets/TransactionListRoutes-B6NIJUWk.js +0 -1
  149. package/dist/assets/WiseConfirmationScreen-Bg5_g49N.js +0 -12
  150. package/dist/assets/ZeniAccountRoutes-C3fDjuMG.js +0 -57
  151. package/dist/assets/ZeniAccountStatementScreen-CbdRQI0p.js +0 -9
  152. package/dist/assets/epic-mSW644GG.js +0 -2
  153. package/dist/assets/expenseAutomationHelper-DBDpSggk.js +0 -1
  154. package/dist/assets/index-6yt3BfRL.js +0 -1
  155. package/dist/assets/stripSplatSuffix-CQQXAy0N.js +0 -1
  156. package/dist/assets/useActualMatchingMatchDetail-OCZsPxr6.js +0 -1
  157. package/dist/assets/useAskAiCfoHostNavButtonProps-BsP5fVhq.js +0 -1
  158. package/dist/assets/useTaskManagerAccess-BG0Fkj9k.js +0 -1
  159. package/dist/assets/withTransactionSidePanel-DK-Ex27L.js +0 -25
@@ -1 +0,0 @@
1
- import{n as s}from"./liveblocks-UOzcPsHa.js";import{j as d}from"./core-B5mDy9pu.js";import{fF as a}from"./zeni-epic-state-7eY0g-Bc.js";import"./sentry-DHDsO12F.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
@@ -1,2 +0,0 @@
1
- import{j as s}from"./liveblocks-UOzcPsHa.js";import{a as r}from"./sentry-DHDsO12F.js";import{u as D,h as L,i as R,j as C,t as W,l as O,s as H,g as Y,N as B,n as ie,o as x}from"./core-B5mDy9pu.js";import{a8 as rn,j as p,aq as T,S as m,cb as ln,cc as dn,cd as un,ce as gn,cf as mn,cg as vn,ch as pn,ci as Sn,cj as fn,ck as hn,cl as In,cm as Cn,cn as En,co as kn,p as J,cp as yn,cq as xn,ae as se,cr as bn,cs as jn,z as Ie,ct as Pn,cu as Dn,cv as Ln,cw as An,cx as $n,cy as wn,cz as Fn,cA as Rn,U as Tn,ai as vt,cB as _n,cC as On,cD as Mn,cE as Nn,cF as Le,cG as Un,cH as Bn,cI as Vn,cJ as Hn,cK as qn,cL as Zn,t as ze,h as pt,cM as zn,cN as Kn,cO as Qn,cP as Gn,cQ as Wn,cR as Yn,cS as Jn}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{A as z}from"./AddressScreen-DsGvV3N8.js";import M from"./NotFoundScreen-BkYIKPgh.js";import{ZB as Xn,ZC as ei,vl as Ke,ZD as K,vO as ce,ZE as Ae,ZF as Q,wp as Ce,ww as ti,wB as St,ZG as $e,ZH as ft,wt as ht,x$ as Qe,vN as Ge,ZI as ni,ZJ as It,wL as Ee,ZK as G,wP as ii,ZL as oi,ZM as Ct,wS as Et,yW as ai,ZN as ue,ZO as We,ZP as kt,vL as si,ZQ as ci,vF as ri,ZR as li,yc as di,ZS as yt,yl as Ye,ZT as ui,yi as gi,ZU as we,gh as mi,ZV as te,ZW as ne,x5 as vi,vT as Je,ZX as Fe,vY as xt,vW as pi,vQ as Si,w_ as fi,v_ as hi,x7 as Ii,ZY as ke,xe as bt,xc as ye,FY as Re,yr as Xe,ZZ as Ci,vM as jt,Z_ as Te,w7 as xe,w4 as be,wh as Pt,wg as _e,w1 as Ei,wa as Dt,wj as oe,fF as Oe,Vo as Lt,vP as Me,we as ki,wf as yi,wd as xi,Z$ as bi,wQ as ji,wM as At,_0 as $t,vz as et,_1 as Pi,vv as Di,_2 as Li,yx as Ai,yB as q,yw as $i,xF as Ne,_3 as wi,_4 as wt,yK as tt,_5 as Fi,yH as Ri,_6 as Ft,xI as Ti,xJ as V,xM as _i,_7 as Rt,xW as pe,_8 as Oi,x6 as Tt,TW as _t,_9 as Mi,y4 as Ni,_a as Ot,_b as Ui,_c as Bi,_d as Vi,zz as Hi,_e as qi,_f as Mt,yR as Nt,_g as Ut,zx as Se,_h as Zi,zu as zi,_i as Ki,_j as Qi,_k as Gi,_l as Wi,_m as Yi,_n as nt,_o as Ji,eg as Xi,zD as eo,_p as Ue,xo as it,_q as Be,_r as re,xy as Bt,xt as Vt,xr as je,_s as to,xp as no,yX as Ht,zm as ot,zh as io,_t as oo,yY as ao,_u as so,zn as co,zr as ro,_v as Ve,wr as qt,z8 as lo,ws as uo,_w as go,_x as Zt,c8 as mo,ms as vo,mt as po,_y as at,wq as le,gl as So,mz as fo,ze as zt,zP as ho,zb as Kt,uT as Io,zM as st,uH as Co,zJ as ct,hS as Eo,Un as rt,Uo as ko,G8 as Qt,hK as yo,_z as xo,Vd as bo,_A as jo,zU as fe,zV as Po,_B as Do,_C as Gt,zS as Lo,_D as Ao,_E as $o,y8 as wo,_F as Fo}from"./zeni-epic-state-7eY0g-Bc.js";import{M as Ro}from"./MobileAppDrawer-0YtWXA3B.js";import{q as de}from"./QBOConnectionScreen-CWU6DFJl.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.js";import"./empty-Dj4ZMRNZ.js";import"./pdf-lib-CZXOqgb4.js";import"./index-k1-Pd2Ki.js";import"./url-BxiN6LKq.js";import"./index-6yt3BfRL.js";import"./decodeURIComponentSafe-DANuhXnG.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="452509ab-c13b-4d50-bbcb-112c250a8bd5",n._sentryDebugIdIdentifier="sentry-dbid-452509ab-c13b-4d50-bbcb-112c250a8bd5")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(rn,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function N(...n){return n.some((e=>e==="Error"))}function To(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,items:S,nextCursor:h,auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b}=C(Xn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${t??""}/invoicing`,I=r.useCallback(((A,U)=>{const _=ei(y,A,U,P);_!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:A,entityId:U,fromScreen:"audit_log"}),e(_))}),[P,e,y]);r.useEffect((()=>{const A=setTimeout((()=>d(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&n(Ke({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const j=g==="Not-Started"||g==="In-Progress"&&S.length===0,E=g==="In-Progress"&&S.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(ln,{auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b,entries:S,hasMore:f,isLoading:j,isLoadingMore:E,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{f&&h!=null&&n(Ke({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function ge(n,e=!1){const t=D(),i=C((c=>K(c).productNextCursor!=null)),a=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&o!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&o!=="In-Progress"&&i&&a!=null&&t(ce({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,o,i,a])}const _o=new Set(["plan"]),Wt=[],Oo=ft((n=>n.length>0?n:Wt),gn),Mo=ft((n=>n.length>0?n:Wt),un),No=O((function(n,e){const{view:t}=e;return{applicableItemOptions:t.applicableItemOptions,groupedAccountOptions:Oo(t.qboAccountHierarchy),groupedClassOptions:Mo(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&n(ht({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&n($e({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),n(St({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&n(ti({action:o,id:a,parentItemId:i}))}}}))(dn);function Uo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=(d=a.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=C((k=>Ae(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(Q({id:t})),()=>{n(Q({id:t}))})),[n,t]),r.useEffect((()=>{o&&n(Ce({id:t,kind:c}))}),[o,t,c,n]);const[g,f]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(Q({id:t})),n(Ce({cacheOverride:!0,id:t,kind:c})),f((k=>k+1)))}),[l.fetchState,n,t,c]);const S=u==="Completed";ge(o,!0);const[h,P]=r.useState(S?t:void 0);r.useEffect((()=>{t!=null&&S&&P(t)}),[t,S]);const b=h!==t&&(u==="Not-Started"||u==="In-Progress");return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:S}),s.jsx(No,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:b,view:l},g)]})}const Bo=new Set(["addon","charge","plan"]),Vo=new Set(["plan"]),Ho=O((function(n,e){const t=Ae(n,e.itemId);return{fieldHelp:t.fieldHelp,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${t}/catalog/${encodeURIComponent(a)}`:`${t}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),n(Q({id:a})),e.navigate(`${t}/catalog`)},onChange:c=>{n($e({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),n(St({id:a}))}}}))(mn);function qo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=t!=null,d=a.get("type"),l=d!=null&&Bo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Vo.has(u)?u:"plan";var u;const g=C((f=>Ae(f,t)));return ge(o,!0),r.useEffect((()=>{o&&n(Ce({id:t,kind:v}))}),[o,t,v,n]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||n($e({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,n]),r.useEffect((()=>{if(g.fetchState==="Completed"){const f=g.savedItemId??t,S=f!=null?`/${i}/invoicing/catalog/${encodeURIComponent(f)}`:`/${i}/invoicing/catalog`;e(S),n(Q({id:t}))}}),[g.fetchState,g.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Zo={addons:"addon",all:"item",charges:"charge",plans:"plan"},zo=O((function(n,e){const t=K(n),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?t.plans:a?[...t.plans,...t.products]:t.products,c=i||a&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:a&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${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(`${t}/data_import`)},onAddItem:()=>{const c=Zo[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(ht({action:ni(d),id:c}))},onLoadMore:()=>{if(a)return e.planNextCursor!=null&&n(Ge({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&n(i?Ge({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(vn);function Ko(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),f=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),S=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:S,type:"plan"})),[S]),P=r.useMemo((()=>({search:S,type:"addon|charge"})),[S]),b=C((A=>K(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&&n(Qe({cacheOverride:!1,planFilters:h,productFilters:P,planSort:f,productSort:f}))}),[i,n,h,P,f]),r.useEffect((()=>{i&&(S!==k||f?.field!==y?.field||f?.dir!==y?.dir)&&n(Qe({cacheOverride:!0,planFilters:h,productFilters:P,planSort:f,productSort:f}))}),[k,y,i,n,h,P,S,f]),N(b.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),s.jsx(zo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:a,sortState:u,planFilters:h,productFilters:P,sort:f,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:w,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Qo=O((function(n,e){const t=It(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isQboConnected:t.isQboConnected,isQboPickerDataLoading:t.isQboPickerDataLoading,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions,qboAccountHierarchy:t.qboAccountHierarchy,qboIncomeAccountIds:t.qboIncomeAccountIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),n(G({id:i})),e.navigate(`${t}/discounts`)},onChange:c=>{n(oi({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:a}),n(ii({id:i}))}}}))(pn);function Go(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,savedCouponId:c}=C((d=>It(d,t)));return r.useEffect((()=>{a&&n(Ee({id:t}))}),[a,t,n]),r.useEffect((()=>{if(o==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(G({id:t}))}}),[o,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCouponFormPage}),s.jsx(Qo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Wo=O((function(n){const e=Ct(n);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(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:a=>{e(kt(a))},onSubmit:()=>{const a=ci(n.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(ri(a))}}}))(fn);function Yo(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),[i]=W(),{areTenantIdsInSync:a}=T(),o=i.get("customerId"),c=C((I=>Ct(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(Et),g=C((I=>ai(I))),f=C(ue),S=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,P=S||h,b=g.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,n(kt({...l,customerId:o})))}),[o,l,n]),r.useEffect((()=>{a&&n(si({cacheOverride:!1}))}),[a,n]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(j)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),P?s.jsx(Sn,{}):s.jsx(Wo,{navigate:e,tenantEmailDomain:t})]})}const Jo=O((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(hn);function Xo(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>li(d,t??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&t!=null&&n(di({id:t}))}),[a,t,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Jo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:o})]})}const ea=O((function(n){const e=yt(n),{fetchState:t}=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:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${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(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function ta(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,creditNoteListFetchState:b}=C((y=>{const I=yt(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&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Ye({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ea,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(ui(y)),onSortChange:v})]})}const Yt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},na=O((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:a=>{n(ke({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const a=Yt(e.tenantEmailDomain??"",ye,i),o=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),n(ke({id:i,localData:a})),n(bt({id:i}))},onFetchPaymentLinkEmailPreview:a=>n(Ii({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>n(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(`${t}/subscriptions/${encodeURIComponent(a)}`)}}}))(kn);function ia(){const n=D(),e=L(),t=Y(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((_=>we(_,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[g,f]=r.useState(!1),[S,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 P=S===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"&&n(mi({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=_}),[n,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((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{o&&i!=null&&n(vi({id:i}))}),[o,i,n]),r.useEffect((()=>{o&&i!=null&&j&&n(Je({customerId:i}))}),[o,i,n,j]);const[A,U]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Fe({id:i})),i!=null&&n(xt({id:i})),U((_=>_+1)))}),[c.fetchState,n,i]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(na,{customerId:i??"",editView:c,hasLoadedRecord:P,location:t,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{n(te()),i!=null&&j&&n(Je({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),f(!0)}},A),s.jsx(Cn,{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&&n(Si({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:_=>{i!=null&&n(pi({customerId:i,data:_}))}}),s.jsx(En,{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:()=>{f(!1),n(ne())},onSubmit:({amount:_,description:ee})=>{i!=null&&n(fi({amount:_,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const oa=O((function(n,e){const t=we(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),n(Fe({id:i})),n(Re(ye)),e.navigate(`${t}/customers`)},onChange:c=>{n(ke({id:i,localData:c}))},onOpenAddress:()=>{const c=Yt(e.tenantEmailDomain??"",ye,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:a}),n(bt({id:i}))}}}))(yn);function aa(){const n=D(),e=L(),t=Y(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),{fetchState:c,savedCustomerId:d}=C((l=>we(l,i)));return r.useEffect((()=>{o&&i!=null&&n(xt({id:i}))}),[o,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),n(Fe({id:i}))}}),[c,d,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerFormPage}),s.jsx(oa,{customerId:i,location:t,navigate:e,tenantEmailDomain:a})]})}const sa=O((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.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:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${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(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(jt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(xn);function ca(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,customerListFetchState:b}=C((y=>{const I=ue(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&&n(Xe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),s.jsx(sa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(Ci(y)),onSortChange:v})]})}const Pe=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),ra=O((function(n,e){const{filters:t,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:t,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Pe(a,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Pe(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",f=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:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&n(be({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&n(_e(o))},onRollback:f?()=>{o!=null&&n(Pt(o))}:void 0}}))(bn);function la(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),[o,c]=r.useState({}),d=C(Te),l=Pe(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{a&&t!=null&&n(xe(t))}),[a,n,t]),r.useEffect((()=>{if(!a||t==null)return;const S=setTimeout((()=>{n(be({...o,sessionId:t}))}),300);return()=>clearTimeout(S)}),[a,n,o,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||t==null||!u)return;const S=setInterval((()=>{n(xe(t)),n(be({...o,sessionId:t}))}),3e3);return()=>clearInterval(S)}),[a,n,o,u,t]);const g=r.useMemo((()=>{if(t==null)return;const S=new URLSearchParams;o.moduleId!=null&&S.set("module_id",o.moduleId),o.level!=null&&S.set("level",o.level),o.outcome!=null&&S.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&S.set("search",o.search.trim());const h=S.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${h===""?"":`?${h}`}`}),[o,t]),f=v?.fetch.fetchState??"Not-Started";return N(f)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&f!=="Not-Started"}),s.jsx(ra,{downloadUrl:g,filters:o,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Jt=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=Jt(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},da=O((function(n,e){const{sessions:t,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:t,statusRows:o}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,a=o=>{const c=o??null;n(oe(c)),ae(i,c),t(`/${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}),n(_e(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),n(Pt(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),t(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(jn);function ua(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(Te);r.useEffect((()=>{i&&(n(Ei()),n(Dt()))}),[i,n]);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(da,{navigate:e,tenantEmailDomain:t,view:a})]})}const ga=O((function(n,e){const{activeId:t,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=t!=null?d[t]: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===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),n(xi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{t!=null&&n(_e(t))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),t!=null&&n(yi(t))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),n(ki({files:o}))},onViewDetails:t==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Pn);function ma(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(Et),o=C(Oe).companyId??Ie.getSignedInUserTenant(t??"")?.companyId,c=C((S=>Lt(S,o))),d=C(Te),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((S=>S.id===v)):void 0;r.useEffect((()=>{i&&(n(Me()),n(Dt()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const S=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Jt(h))}catch{return null}})(t);S!=null&&n(oe(S))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const g=u?.status,f=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!f)return;const S=setInterval((()=>{n(xe(v))}),3e3);return()=>clearInterval(S)}),[i,v,f,n]),r.useEffect((()=>{g==="done"&&(n(oe(null)),ae(t,null))}),[n,g,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportMigratePage}),s.jsx(ga,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const va=O((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:t.discountsAccountName,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:a=>{n(At({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),n(ji({data:a,id:i}))}}}))(Dn);function pa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((h=>bi(h,t))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const g=v===t;r.useEffect((()=>(n(G({id:t})),()=>{n(G({id:t}))})),[t,n]),r.useEffect((()=>{a&&n(Ee({id:t}))}),[a,t,n]);const[f,S]=r.useState(0);return r.useEffect((()=>{o.fetchState==="Completed"&&(n(G({id:t})),n(Ee({cacheOverride:!0,id:t})),S((h=>h+1)))}),[o.fetchState,n,t]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(va,{hasLoadedRecord:g,couponId:t??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const Sa=O((function(n){const e=$t(n),{fetchState:t}=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:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${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(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,a)=>{n(At({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ln);function fa(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=$t(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&&n(et({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(et({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>n(Pi(I)),onSortChange:v})]})}const ha=O((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>n(q({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(q({action:"retry",id:i}))}:void 0}}))($n);function Ia(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((E=>Li(E,t??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[f,S]=r.useState(),[h,P]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),S(void 0),P(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Ai({id:t})),v("idle"),g(!1);const E=o.emailPreview.preview;S(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),P(!0)}),[t,n,o.emailPreview.preview]),y=r.useCallback((E=>{t!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(q({action:"send-email",body:E,id:t})))}),[t,n,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&&t!=null&&n($i({id:t}))}),[a,t,n]),r.useEffect((()=>{a&&d!=null&&n(Ne({invoiceId:d}))}),[a,d,n]),r.useEffect((()=>{v("idle"),g(!1),S(void 0),P(!1)}),[t]),r.useEffect((()=>{a||(v("idle"),g(!1),S(void 0),P(!1))}),[a]),r.useEffect((()=>{h&&f==null&&o.emailPreview.preview!=null&&S({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,f,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(t!=null&&n(wi({id:t})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[t,b,n,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(ha,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:o,dunningAttempts:j,onSendEmail:k}),s.jsx(An,{initialDraft:f,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 Ca=O((function(n){const e=wt(n),{fetchState:t}=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:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${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(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||n(q({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Ri({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(wn);function Ea(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,dunningCaseListFetchState:b}=C((y=>{const I=wt(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&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(tt({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ca,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(Fi(y)),onSortChange:v})]})}const ka=O((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),n(_i({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}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))}}}))(Fn);function ya(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((g=>Ft(g,t??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{a&&t!=null&&n(Ti({invoiceId:t}))}),[a,t,n]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ka,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const xa=O((function(n){const e=Rt(n),{fetchState:t}=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:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="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(n,e){const t=`/${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(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,a)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&n(Tt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Rn);function ba(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=Rt(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&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(pe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),s.jsx(xa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{n(Oi(I)),n(pe({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function lt(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=Tn(),a=vt(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C(_t),v=Mi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,g=f=>{c(f)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(Ro,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{n(Ni())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{g(!0)}})]})}const ja=O((function(n,e){const t=Ot(n,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=t;return{fieldHelp:t.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(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:a=>{n(qi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Hi())}}}))(On);function Pa(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((S=>Ot(S,t??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{n(Ui()),g.current=null}),[n,t]),r.useEffect((()=>{a&&t!=null&&n(Ne({invoiceId:t}))}),[a,n,t]),r.useEffect((()=>{c!=null&&t!=null&&o==="Completed"&&g.current!==t&&(g.current=t,n(Bi({localData:Vi(c)})))}),[n,o,c,t]);const f=r.useRef(v.fetchState);return r.useEffect((()=>{const S=f.current;f.current=v.fetchState,S!=="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(ja,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const Da=O((function(n){return{invoicingOverview:Mt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Nt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Mn);function La(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>Mt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Nt(a))}),[i,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),s.jsx(Da,{navigate:e,selectedPeriod:a,tenantEmailDomain:t})]})}const Aa=O((function(n){const e=Ut(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${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(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Nn);function $a(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,transactionListFetchState:b,transactions:k}=C((w=>{const A=Ut(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=`/${t}/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&&n(Se({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Se({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),s.jsx(Aa,{navigate:e,tenantEmailDomain:t,activeType:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onTypeChange:w=>{n(Zi(w)),n(Se({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const wa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id};function dt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=t!=null&&t!=="",c=C(ue),d=C((E=>Ki(E))),l=C(Qi),v=C((E=>Ft(E,t??""))),u=v.invoice,g=`/${i}/invoicing`,f=r.useRef(null),S=r.useRef("");r.useEffect((()=>{n(Gi()),f.current=null,S.current=""}),[n,t]),r.useEffect((()=>{a&&n(o&&t!=null?Ne({invoiceId:t}):jt({filters:{},keepExistingListItems:!1}))}),[a,n,t,o]),r.useEffect((()=>{o&&u!=null&&t!=null&&v.fetchState==="Completed"&&f.current!==t&&(f.current=t,n(Wi({contextInvoiceId:t,localData:Yi(u)})))}),[n,u,t,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==S.current&&(S.current=E,n(Tt({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(nt({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[n,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 P=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:wa(E)})))),[c.customers]),b=C((E=>Ji(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(w=E.amountDue,A=Xi.currencySymbol,Bn("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:Le("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(t??"")}`:`${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(Un,{customers:P,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=>{n(nt({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(eo(o?t??void 0:void 0))}})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Fa=(n,e)=>{if(n==null)return;const t=Le("0,0",n);return e!=null?`${t}/${e}`:t},en=(n,e,t)=>{const i=[n,Fa(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},ut=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ra=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:en(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Ta=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=O((function(n,e){const{editView:t}=e,i=t.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(ut).map((c=>({label:c.name??c.id,subtitle:en(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,coupons:t.coupons.map(Ta),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(ut).map(Ra),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(Vt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({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(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=Xt(e.tenantEmailDomain??"",je,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Bt({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}}))(Vn);function Oa(){const n=D(),e=L(),t=Y(),{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",[f,S]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&S(i)}),[i,g]);const h=f===i;ge(o),r.useEffect((()=>{o&&i!=null&&n(it({id:i}))}),[o,i,n]);const[P,b]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Be({id:i})),n(it({cacheOverride:!0,id:i})),b((k=>k+1)))}),[c.fetchState,n,i]),N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),s.jsx(_a,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},P)]})}const Ma=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Na=(n,e)=>{if(n==null)return;const t=Le("0,0",n);return e!=null?`${t}/${e}`:t},De=(n,e,t)=>{const i=[n,Na(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Ua=n=>({label:Ma(n),value:n.id}),he=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ba=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:De(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Va=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=O((function(n,e){const t=Ue(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Va),customers:t.customers.map(Ua),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,plans:t.plans.filter(he).map(Ba),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),n(Be({id:i})),n(Re(je)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{n(re({id:i,localData:o}))},onOpenAddress:()=>{const o=Xt(e.tenantEmailDomain??"",je,i),c=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:a}),n(Bt({id:i}))}}}))(Hn);function qa(){const n=D(),e=L(),t=Y(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=W(),{areTenantIdsInSync:c}=T(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((f=>to(f,i))),u=C((f=>Ue(f,i).localData));ge(c),r.useEffect((()=>{c&&n(no({subscriptionId:i}))}),[c,i,n]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const f=v??i,S=f!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(f)}`:`/${a}/invoicing/subscriptions`;e(S),n(Be({id:i}))}}),[l,v,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Za=O((function(n){const e=Ht(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),n(Vt({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(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/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(`${t}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(ao({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t}=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:f,appliedSearch:S,appliedSort:h,nextCursor:P,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Ht(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&&n(ot({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(ot({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&n(io())}),[k,i,n]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),s.jsx(Za,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>n(oo(j)),onSortChange:v})]})}const Ka=O((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),n(ro({action:"capture",id:i}))}:void 0}}))(Zn);function Qa(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>so(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&n(co({id:i}))}),[a,i,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:o})]})}function tn(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=n,o=D(),{areTenantIdsInSync:c}=T(),d=C(Ve),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(qt()),t&&o(lo()))}),[c,o,e,t,a]),r.useEffect((()=>{e&&c&&l&&i&&o(uo())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Ga={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=D(),{areTenantIdsInSync:t}=T(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(go),{configError:u,configFetchState:g,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P}=C(Zt),b=C(Ve);tn({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Oe),y=n==="dunning"||n==="quickbooks",I=k.companyId??Ie.getSignedInUserTenant(i??"")?.companyId,j=C((F=>Lt(F,I))),E=mo(k.userRole??[]),w=k.tenantId??"",A=Ie.getSignedInUser(),U={userId:A?.userId??"",sessionId:A?.zeniSessionId??"",tenantId:w},_=c?.fileId,ee=C((F=>_!=null&&_!==""?vo(F,_):void 0)),He=C((F=>_!=null&&_!==""?po(F,_):void 0)),nn=_!=null&&_!==""&&ee!=null?{[_]:ee}:{},on=_!=null&&_!==""&&He!=null?{[_]:He}:{};r.useEffect((()=>(e(at()),()=>{e(at())})),[e]),r.useEffect((()=>{t&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[t,e,a]),r.useEffect((()=>{t&&y&&g==="Not-Started"&&e(le())}),[t,e,g,y]),r.useEffect((()=>{if(!t)return;const F=A?.userId;F!=null&&F!==""&&w!==""&&ze.shouldFetchActiveTenant(w)&&(ze.markActiveTenantFetchStarted(w),e(So(F,w,A?.zeniSessionId)))}),[t,e,A?.userId,A?.zeniSessionId,w]);const an=f.length>0||S.length>0,sn=a==="Not-Started"||a==="In-Progress"&&l==null||y&&!an&&(g==="Not-Started"||g==="In-Progress"),cn=a==="Completed"&&(!y||g==="Completed"),qe=j.externalConnections?.revenue?.find((F=>F.connectionName==="chargebee"))?.connectionId,me=se?.invoicingMicroServiceBaseUrl,Ze=me!=null&&me.length>0?`${me}/1.0/webhooks/stripe`:"",ve={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:F=>e(ct(F)),onDisconnect:(F,Z)=>{w!==""&&e(yo(w,F,rt(Z)))},onDisconnectStripe:()=>e(st()),onReconnectQBO:()=>{const F=k.tenantEmailDomain??i??"";de.init("/connection/auth",F),de.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Qt())},onSaveChargeBeeCredentials:(F,Z)=>{qe!=null&&w!==""&&e(Eo(w,qe,rt("revenue"),ko("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:Ze};return{authParams:U,deleteFileStatusById:nn,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ve,isInvoicingPageReady:cn,isLoading:sn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P,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:Ze,updateFileStatusById:on,onConnectStripe:F=>e(ct(F)),onDeleteFile:F=>e(Co(F,w)),onDisconnectStripe:()=>e(st()),onEditFileName:(F,Z)=>e(Io(F,Z,w)),onReconnectQBO:ve.onReconnectQBO,onRefreshQBO:ve.onRefreshQBO,onRetryQboSyncTask:F=>e(Kt(F)),onSave:F=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(ho({settings:F,snackbarSection:Ga[n??""]}))},onStartQboBackfill:F=>e(zt(F)),updateFilesEntity:F=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(fo({files:F}))}}}function gt({appContent:n}){const e=L(),t=Y(),i=D(),{tenantEmailDomain:a}=R(),o=X("branding"),c=C((v=>xo(v))),d=C((v=>bo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(jo()),i(Re(fe)))}),[c.saveState.fetchState,i]);const l=pt(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(zn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,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(Do({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${fe}/`,u=J(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:o.updateFilesEntity})]})}function Wa(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Kn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Ya(){const n=L(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Ja(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const Xa=O((function(n){const e=Gt(n);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(n){return{onChange:e=>{n($o({localData:e}))},onReset:()=>{n(Ao())},onRetryTask:e=>{n(Kt(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Lo())},onStartBackfill:e=>{n(zt(e))}}}))(Wn);function es(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=C(Oe),{configFetchState:a,settingsFetchState:o}=C(Gt);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||n(Me())}),[n,o]),r.useEffect((()=>{a==="Not-Started"&&n(le())}),[a,n]),tn({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage}),s.jsx(Xa,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Qt())})]})}const ts={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function ns(){const n=vt(),e=D(),t=L(),[i,a]=W(),o=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Zt),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const f=ts[g];a({},{replace:!0}),f!=null&&t(f,{replace:!0})}),[g,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Yn,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:n("invoicing_settings"),settings:o.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(wo())}})]})}function mt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(ns,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Ja,{})}),s.jsx(x,{path:"branding",element:s.jsx(gt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(gt,{appContent:s.jsx(z,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Ya,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Wa,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(es,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function As(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),{enableState:a,fetchState:o,status:c}=C(_t),d=pt(a.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=C((g=>Ve(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,o]),r.useEffect((()=>{i&&u==="Not-Started"&&n(qt())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),n(Fo()))}),[d,a.fetchState,l,n,e]),c==null&&o!=="Error"?s.jsx(Jn,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(lt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(lt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(La,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ca,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(aa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(ia,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(za,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Oa,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ba,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Yo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(ya,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(dt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(x,{path:"payments",element:s.jsx($a,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(dt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Qa,{})}),s.jsx(x,{path:"credits",element:s.jsx(ta,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(Xo,{})}),s.jsx(x,{path:"discounts",element:s.jsx(fa,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Go,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(pa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ea,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Ko,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Uo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(To,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ua,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(ma,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(la,{})}),s.jsx(x,{path:"*",element:s.jsx(M,{})})]})}export{As as default};
@@ -1,72 +0,0 @@
1
- import{j as t}from"./liveblocks-UOzcPsHa.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-B5mDy9pu.js";import{Ug as k,Uh as j,Ui as T,Jk as D,J6 as U,Uj as B,Uk as oe,Ul as ie,Ja as se,gi as $,Jh as le,Je as re}from"./zeni-epic-state-7eY0g-Bc.js";import{a1 as x,H as r,a2 as de,j as v,Z as G,a3 as ce,a4 as me,a5 as pe,p as H,N as ue,c as he,a6 as ge,M as xe,E as fe,f as be,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as je,ab as ve,ac as $e}from"./index-6nH5LMe4.js";import{n as m}from"./mui-Do6nLzGb.js";import f from"./NotFoundScreen-BkYIKPgh.js";import{a as I}from"./sentry-DHDsO12F.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.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]="914d6284-46fa-4c52-8b5f-6eb507bf39c2",e._sentryDebugIdIdentifier="sentry-dbid-914d6284-46fa-4c52-8b5f-6eb507bf39c2")}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=j(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=>{v.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
- `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ne=m.div`
20
- 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
- `,Le=g((function(e){const a=k(e),n=j(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{v.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=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Le,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
- 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=j(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{v.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=H(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 ve(100,58)},He=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
- `,Je=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
- `,Me=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}}))(je);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),J=n.pathname.includes("address"),b=x(),M=xe(),A=fe(),w=be(),V=()=>{M.toggle()},_=E((u=>k(u))),K=E((u=>j(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:Z}=_,{tenantId:z,userId:N,sessionId:L}=W,{fetchState:R,internationalBankAccountCreateStatus:X}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[w,c,i,o,d,a]),I.useEffect((()=>{w&&c==="Completed"&&($(N,L,z),l!=null&&a(re(l)))}),[c,w,N,L,z,l,a]),c==="Error"?t.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:v,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,Z))(u)}),t.jsxs(Je,{windowSize:b,children:[b!=="small"?t.jsx(He,{onClick:V}):null,t.jsx(Ve,{windowSize:b,isAddressPage:J,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(Me,{windowSize:b,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -1,12 +0,0 @@
1
- import{j as u}from"./liveblocks-UOzcPsHa.js";import{a as g}from"./sentry-DHDsO12F.js";import{u as O,g as _,h as w,t as M,j as l,N as U}from"./core-B5mDy9pu.js";import{z as r,E as P,G as V,Q as A,j as N,S as $,_ as G,$ as Q,X as R}from"./index-6nH5LMe4.js";import{fF as W,TL as X,Uc as q,U3 as B,gi as H,gk as J,U8 as K,gU as Y,dj as Z,Ud as ee,Ue as te}from"./zeni-epic-state-7eY0g-Bc.js";import{n as ne}from"./mui-Do6nLzGb.js";import{u as se}from"./useDeviceId-Bi38IJl0.js";import{f as ae}from"./analyticsHelper-CwB3kQvw.js";import{t as ie}from"./getLocaleForTenant-DH5Avx3x.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.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]="4dae7e98-40db-4eec-877a-f148c9581cc4",t._sentryDebugIdIdentifier="sentry-dbid-4dae7e98-40db-4eec-877a-f148c9581cc4")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),f=w(),[y]=M(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>X(e))),D=r.getSignedInUser(),v=P().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),g.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{f("/signin/auth")}),[f]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(G,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(U,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(U,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(Q,{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};
@@ -1 +0,0 @@
1
- import{j as _}from"./liveblocks-UOzcPsHa.js";import{a as m}from"./sentry-DHDsO12F.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-B5mDy9pu.js";import{fF as ne,TM as Ne,TN as se,g9 as xe,fE as Pe,TW as Ve,TP as Re,TQ as je,p$ as Le,gm as Oe,TT as b,TY as Ue,TZ as K,gn as Ze,T_ as ze,E1 as We,h1 as Ye,cV as qe,T$ as He,g8 as Qe,go as Je}from"./zeni-epic-state-7eY0g-Bc.js";import{w as Ke,i as Xe,M as ea,N as aa,d as ta,f as na,u as sa,c,g as oa,q as ia,z as ra,e as da,k as ca,V as la,r as ua,l as ma,n as X,L as fa,C as ha,D as ba,p as S,j as ee,x as pa,W as ae,A as ga,B as Sa}from"./index-6nH5LMe4.js";import{D as Ta}from"./mui-Do6nLzGb.js";import{u as Ea}from"./InboxNotificationsProvider-BmF5-_KA.js";import{u as ka}from"./useTaskManagerAccess-BG0Fkj9k.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]="b28c04ac-a839-4cc1-9152-cadd77891e43",l._sentryDebugIdIdentifier="sentry-dbid-b28c04ac-a839-4cc1-9152-cadd77891e43")}catch{}})();const Ca=Ke((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),T=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=ka(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Ve),G=$.uiState.currentChatSessionId,k=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,N=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),P=t((e=>Re(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>je(e)));m.useEffect((()=>{k&&C&&!f&&v.fetchState==="Not-Started"&&r(Le(!0))}),[k,C,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Oe(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),V=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Te=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),ke=t((e=>b(e).reducedFetchCountState)),R=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ea();m.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),m.useEffect((()=>{k&&E&&!f&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[k,E,f,L.fetchState,B.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(K({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(K({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:ke,count:Ee},W=s!=null?ra.getSignedInUserTenant(s):null,Y=t((e=>W?.tenantId!=null?Ze(e,W.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),V===!1&&h.push("expense_automation_card");const q=t((e=>ze(e,h).fetchState)),H=t((e=>We(e).fetchState)),ye=A&&(q==="Completed"||q==="Error")||N&&(H==="Completed"||H==="Error")||!A&&!N?void 0:"disabled",we=m.useMemo((()=>Ye(o.userRole)),[o.userRole]),Ae=qe(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&He(P.notificationSettings,p.userEmail,x,o,E),Q=da(),Fe=Q&&ca(a);return _.jsx(Ta,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:Y!=null?[Y]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Te,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:V,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:Q,onNotificationIconClick:()=>{i(!1);let e=R===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=R===0&&j>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),J=e.type,_e=ae(J)&&J!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{T.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:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((T=>ne(T))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(T,n)=>{Xe(n)&&Ne(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-UOzcPsHa.js";import{h as r,l as i}from"./core-B5mDy9pu.js";import{am as n}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import"./sentry-DHDsO12F.js";import"./zeni-epic-state-7eY0g-Bc.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
@@ -1 +0,0 @@
1
- import{n as mt,b as lt,o as ft,j as _}from"./liveblocks-UOzcPsHa.js";import ut from"./NotFoundScreen-BkYIKPgh.js";import{a as k}from"./sentry-DHDsO12F.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 K}from"./core-B5mDy9pu.js";import{cA as Tt,TP as X,fF as H,h1 as It,TT as b,a0N as J,TZ as m,TN as E,Aj as j,F$ as Ct,a0O as At,TM as Et,T$ as yt,Ao as Nt,a0P as F,br as $,gh as x,As as Q,a0Q as _t,cM as Bt,cF as wt}from"./zeni-epic-state-7eY0g-Bc.js";import{aq as xt,d as vt,N as Pt,c as Dt,as as Mt,dM as Rt,p as B,dN as Gt,w as Ut,dO as Ft,i as $t,a4 as jt}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{u as Lt}from"./useTaskManagerAccess-BG0Fkj9k.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.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]="0d53ba19-1ad1-4e26-a888-8de98236992b",t._sentryDebugIdIdentifier="sentry-dbid-0d53ba19-1ad1-4e26-a888-8de98236992b")}catch{}})();const Ot=(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)}))})),qt=St((function(t,l){const n=X(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=H(t),{currentTab:T}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&yt(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[T].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:T,fetchMoreCommentsNotifications:P}=l;return{onNotificationClick:(e,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}d==="unread"&&t(Q("task_manager","read",[e],!1))},onCommentNotificationClick:(e,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(T(e),t(F([e],$())));let i=`/${h}/${r[1]}`;const I=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(e,s)=>{t(E(e,s))},onUpdateNotificationTabState:(e,s)=>{t(m(e,s))},onUpdateNotificationViewCurrentTabAndSubTab:(e,s)=>{t(J(e,s));const d=`../${e}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:e=>{t(_t(e))},onFetchMoreNotifications:(e,s)=>{if(e==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(j("task_manager","dashboard",d))}else P?.()},onUpdateNotificationStatus:(e,s,d,r)=>{e==="tasks"?t(Q("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(T(i),t(F([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:e=>{e==="tasks"?t(Nt("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Ot(o,T).then((()=>{t(F(o,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const e=jt(n.state?.pathnameStackToGoBack),s=e.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:e.newStack}})},onSettingsClick:()=>{const e=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:e}})}}}))(Ut(Ft)),Wt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=Tt(h??""),o=gt(),f=vt(),[T,P]=k.useState(!1),e=S((a=>X(a))),s=S((a=>H(a))),{useFeatureGate:d}=Pt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:I}=Vt({mobileExploreReferrer:"Notifications"});Mt({isDataReady:!0});const Y=It(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((a=>b(a).notificationDetailsByTab.tasks.fetchState)),L=S((a=>b(a).currentTab)),D=S((a=>b(a).currentSubTab)),tt=S((a=>b(a).notificationDetailsByTab.comments.fetchCountState)),M=S((a=>b(a).notificationDetailsByTab.comments.fetchState)),at=S((a=>b(a).notificationDetailsByTab.comments.uiState.unreadCount)),et=S((a=>b(a).allExternalNotifications)).filter((a=>a.inboxNotification.readAt==null)).map((a=>a.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:w,isLoading:y,hasFetchedAll:C,isFetchingMore:R,fetchMore:ot}=mt(),{threads:O,isLoading:q,fetchMore:W,isFetchingMore:Z,hasFetchedAll:z}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(J(c)),c==null){const a=`../${L}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(a,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(y===!1&&C===!0&&s?.companyId!=null&&w!=null){const a=`dashboard_${s.companyId}`,p=w.filter((A=>A.roomId===a&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(E({unreadCount:p},"comments"))}}),[y,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const a=setTimeout((()=>ot?.()),0);return()=>clearTimeout(a)}));const G=y||R===!0||C!==!0||y||R===!0||C!==!0;k.useEffect((()=>{G&&M!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):G||M!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[G,M]),k.useEffect((()=>{o(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{e.fetchState!=="In-Progress"&&e.fetchState!=="Completed"&&T===!1&&(P(!0),o(Ct()))}),[e.fetchState]),k.useEffect((()=>{if(y===!1&&q===!1&&w!=null&&O!=null){const a=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===a)).filter((u=>Gt(u.kind))),A=p.filter((u=>u.readAt==null)),N=p.map((u=>u.id)),ct=p.map((u=>{const U=O.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return U!=null?{inboxNotification:{...u,threadId:U.id},thread:U}:(Z||z===!0||W==null||W(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:N},"comments")),o(E({totalCount:N.length,unreadCount:A.length},"comments")),o(At(ct))}}),[y,R,Z,C,z,q,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(a,p)=>{if($t(p)){const A=Et(p.mode);if(A==="dashboard"&&o(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const N=[];D==="all"?N.push("read","unread"):D!=="mentions"&&N.push(D),o(j("task_manager",A,N,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return _.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Y,signedInUser:f,externalNotificationsUnreadCount:at,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:et,isAiCfoAccessEnabled:i,onAskAiCfoClick:I,...nt})};function ma(){return _.jsxs(bt,{children:[_.jsx(K,{path:"/:selectedTab",element:_.jsx(Wt,{})}),_.jsx(K,{path:"*",element:_.jsx(ut,{})})]})}export{ma as default};
@@ -1 +0,0 @@
1
- import{j as f}from"./liveblocks-UOzcPsHa.js";import{a as r}from"./sentry-DHDsO12F.js";import{u as A,g as j,j as o,N as C}from"./core-B5mDy9pu.js";import{Uq as P,fF as x,gm as z,Ur as D,Us as M,Ut as R,Uu as q,pS as k,T5 as L}from"./zeni-epic-state-7eY0g-Bc.js";import{z as h,ah as I}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.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]="338f0360-45c2-4936-9963-db6197550231",n._sentryDebugIdIdentifier="sentry-dbid-338f0360-45c2-4936-9963-db6197550231")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>P(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=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),S=o(M),u=o(R),[U,v]=r.useState(null),[b,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(q())}),[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((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=U??_;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:c,onSelectTenant:v,approveError:b??S,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&a!=null&&c!=null&&n(L(a.userId,a.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(C,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
@@ -1 +0,0 @@
1
- import{j as n}from"./liveblocks-UOzcPsHa.js";import{h as H,u as J,g as K,i as Q,j as d,l as X,n as ee,o as C}from"./core-B5mDy9pu.js";import{fF as M,A4 as O,v1 as ae,Vi as w,uY as T,bq as te,b$ as se,uZ as oe,Vj as re,V0 as S,ei as ne,DS as ce,Vk as ie,Ee as le,d_ as de,dZ as me}from"./zeni-epic-state-7eY0g-Bc.js";import{ai as fe,z as pe,aq as ue,as as he,U as Fe,N as _,c as N,a8 as ge,j as V,aD as be,p as Ie}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import Ce from"./NotFoundScreen-BkYIKPgh.js";import{F as Se}from"./FeaturePreviewScreen-5SleVFKv.js";import{a as F}from"./sentry-DHDsO12F.js";import{u as Te}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{u as ye}from"./useInitialThreadRequest-7Q8HJAH2.js";import{t as Ae}from"./routePaths-uBvxqlLY.js";import{M as De}from"./MobileAppDrawer-0YtWXA3B.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="ea553612-3a41-4de0-a7e8-ab0c0b75e35b",s._sentryDebugIdIdentifier="sentry-dbid-ea553612-3a41-4de0-a7e8-ab0c0b75e35b")}catch{}})();const y=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},je=X((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:V}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(T(a)),y(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=Ae(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function v(){const s=fe(),e=H(),a=J(),o=K(),{forecastId:r,tenantEmailDomain:c}=Q(),[p,u]=F.useState(!1),[m,A]=F.useState(!1),g=pe.getSignedInUser(),D=d((t=>M(t))),$=D.company?.companyInfo.firstMonthOfFY??1,i=d((t=>O(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),j=d((t=>t.profitAndLossState)),x=d((t=>t.reportUIOptionsState.selectedForecast)),k=t=>j.pandLByForecastID[t]!=null&&oe(t,j).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:q,onAskAiCfoClick:B}=Te({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){A(!0);const t=((f,R,U)=>R!=null?f.forecasts.findIndex((I=>I.id===R)):U!=null?f.forecasts.findIndex((I=>I.id===U)):f.forecasts.length>0?0:-1)(i,r,x?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=x?.index?(a(w(i.forecasts[t].id,t)),y(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&y(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!k(i.forecasts[t].id)&&b&&a(T(i.forecasts[t].id))}}),[p,u,a,l,i,m,A,O,T,b]);const E=Fe(),G=E?.loggedInUserRole!=null&&te(E.loggedInUserRole),{useFeatureGate:W}=_(),{isFeatureEnabled:L}=W(N.isReportsCommentingEnabled),Y=ye(L?D?.companyId:void 0,{clearParams:l&&m}),[Z,z]=F.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",g?.firstName??""),h.searchParams.set("lastname",g?.lastName??""),h.searchParams.set("email",g?.userEmail??"");const P=t=>{z(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(ge,{analytics:V,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(De,{isAppContentDrawerOpen:Z,handleDrawerToggle:P}),n.jsx(je,{firstMonthOfFY:$,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:k,meetingUrl:se(h.toString()),hasTransactionAccess:G,isAiCfoAccessEnabled:q,onAskAiCfoClick:B,isReportsCommentingEnabled:L,initialOpenThreadRequest:Y,onClickMenuIcon:()=>{P(!0)}})]})}function Je(){const s=d((c=>M(c))),{useFeatureGate:e}=_(),{isFeatureEnabled:a}=e(N.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{Je as default};
@@ -1,22 +0,0 @@
1
- import{j as a}from"./liveblocks-UOzcPsHa.js";import{Ve as re,fF as N,l$ as G,d_ as Y,dZ as le,S5 as X,UD as de,CP as Pe,Vf as J,CE as je,CZ as Le,CT as ce,CI as pe,CX as Te,CU as ve,Vg as ue,sl as Ve,g6 as Ae,gD as Fe,Vh as H,CM as me,CL as ge,D0 as Re,c8 as Oe}from"./zeni-epic-state-7eY0g-Bc.js";import{a1 as fe,N as Q,c as _,z as K,g as Ce,J as he,af as ye,az as be,aA as Ze,ab as Se,H as R,ag as we,G as M,aB as Ue,aq as Be,as as $e,a8 as ze,j as De,S as He,p as _e,aC as Ge,U as Ke}from"./index-6nH5LMe4.js";import{D as xe,n as W,S as Ie}from"./mui-Do6nLzGb.js";import ae from"./NotFoundScreen-BkYIKPgh.js";import{a as d}from"./sentry-DHDsO12F.js";import{u as ee,i as Me,j as g,h as We,g as qe,l as Je,n as se,o as z}from"./core-B5mDy9pu.js";import{u as Ne}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{M as Ye}from"./MobileAppDrawer-0YtWXA3B.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="6af8fbdf-2ca3-4d6a-a3ae-6df76ef33904",e._sentryDebugIdIdentifier="sentry-dbid-6af8fbdf-2ca3-4d6a-a3ae-6df76ef33904")}catch{}})();const Xe={overlayWidth:new Se(100,100,48)},te=M.getLocalizedStrings().peoplePage.invitePage,ne=M.getLocalizedStrings().common,Qe=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,Z]=d.useState(!1),[k,S]=d.useState(!1),{userId:w}=Me(),r=g((l=>re(l))),p=g((l=>N(l))),E=g((l=>G(l))),{useFeatureGate:x}=Q(),{isFeatureEnabled:I}=x(_.isDebitCardFeatureEnabled),P=Y(I,p),T=le(p),v=X(p),U=de(p),B=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,D=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(J()),b()},V=()=>{O===!0?S(!0):h()},$=c.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=x(_.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:A}=he(p?.tenantId),y=!L||A,F=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,isAccountingClassesEnabled:E,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isLiteRoleDisabled:U===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:T,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(ce({peopleLocalData:l})),Z(!0)},onSaveClick:()=>{m(f==="zeni_only"?je(e):Le(v))},onCloseClick:V,isLoading:D||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return d.useEffect((()=>{D===!1&&w!=null&&m(Pe(w))}),[D,w]),d.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:Xe.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:V,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Ee,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Ze,{...s})]})})},ea=W(Ie)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `,ke=W(we.H6Regular)`
6
- margin-top: ${R.sp7};
7
- padding-left: ${R.sp8};
8
- padding-right: ${R.sp8};
9
- color: ${e=>e.theme.colors.primary};
10
- word-break: break-word;
11
- `,Ee=W(we.LargeRegularSp)`
12
- color: ${e=>e.theme.colors.hero};
13
- padding-left: ${R.sp8};
14
- padding-right: ${R.sp8};
15
- margin-bottom: 30px;
16
- margin-top: ${R.sp4};
17
- white-space: pre-line;
18
- `,aa={overlayWidth:new Se(100,100,48)},oe=M.getLocalizedStrings().peoplePage.invitePage,ie=M.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,Z]=d.useState(!1),[k,S]=d.useState(!1),w=g((o=>re(o))),r=g((o=>N(o))),p=g((o=>G(o))),{useFeatureGate:E}=Q(),{isFeatureEnabled:x}=E(_.isDebitCardFeatureEnabled),I=Y(x,r),P=le(r),T=X(r),v=de(r),U=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,B=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const D=()=>{b(),m(J())},h=()=>{O===!0?S(!0):D()},V={onOkClick:()=>{S(!1),D()},onCancelClick:()=>{S(!1)}},$=c.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(_.isChargeCardFeatureEnabled),L=Ce(r,j,x),{isCardsHidden:A}=he(r?.tenantId),y=!L||A,F=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,onPeopleLocalDataUpdated:o=>{m(ce({peopleLocalData:o})),Z(!0)},onResetClick:D,onSaveClick:()=>{m(f==="zeni_only"?Te(e):ve())},onCloseClick:h,peopleDetails:w,isAccountingClassesEnabled:p,isReimbursementDisabled:U===!1,isLiteRoleDisabled:v===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:B};return d.useEffect((()=>{w.invitePersonState.fetchState==="Completed"&&(b(),m(J()))}),[w.invitePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:oe.discardTitle}),descriptionComponent:a.jsx(Ee,{children:oe.discardDescription}),primaryButtonText:ie.yes,secondaryButtonText:ie.no,action:V}):null,a.jsx(Ue,{...s})]})})},ta=W(Ie)`
19
- display: flex;
20
- min-height: 100%;
21
- flex-direction: column;
22
- `,na=Je((function(e,t){const c=ue(e),n=K.getSignedInUser();return{data:c,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(e),analytics:De}}),(function(e,t){const{navigate:c,companyId:n,shouldFetchClasses:f}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Re(i))},onReloadPeople:()=>{e(me()),e(ge(n,f))},onBackClick:()=>{c("../../")},onModeChange:i=>{e(H({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(H({searchText:i}))}}}}))(Ge);function q({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=We(),n=ee(),f=qe(),{areTenantIdsInSync:i}=Be(),b=K.getSignedInUser(),C=g((s=>N(s))),{useFeatureGate:m}=Q(),{isFeatureEnabled:O}=m(_.isDebitCardFeatureEnabled),Z=g((s=>G(s))),k=!Y(O,C)&&Z,S=X(C),w=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=d.useState(!1),[x,I]=d.useState(!1),[P,T]=d.useState(!1),[v,U]=d.useState("off"),[B,D]=d.useState(!1),h=s=>{D(s)},{isAiCfoAccessEnabled:V,onAskAiCfoClick:$}=Ne({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ve(s.classState,s.classListState))),L=g((s=>Ae(s.userState,s.userRoleState,s.userListViewState,"manager"))),A=g((s=>Fe(s))),y=C?.companyId;d.useEffect((()=>{p&&v===u.uiState.mode||!i||(n(H({searchText:"",sortKey:"name",sortOrder:"ascending"})),U(u.uiState.mode),E(!0),n(me()))}),[p,b,w,n,u.uiState.mode,i]),d.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),d.useEffect((()=>{I(e!=null&&e===!0),T(t!=null&&t===!0&&t)}),[e,t]),d.useEffect((()=>{n(H({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const F=()=>{I(!1),T(!1),c("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:De,onLoad:s=>s.trackPageLoaded(He.Event.members)}):null,x===!0?a.jsx(sa,{closeDrawerHandler:F,isInvitePeopleDrawerOpen:x,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,P===!0?a.jsx(Qe,{closeDrawerHandler:F,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ye,{isAppContentDrawerOpen:B,handleDrawerToggle:h}),a.jsx(na,{navigate:c,signedInUser:b,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{c("./new")},onColumnSortConfigChanged:(s,o)=>{n(H({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=_e(f.state?.pathnameStackToGoBack,f.pathname);c(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:V,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(q,{})}),a.jsx(z,{path:"new",element:a.jsx(q,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(q,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
@@ -1 +0,0 @@
1
- import{j as s}from"./liveblocks-UOzcPsHa.js";import E from"./NotFoundScreen-BkYIKPgh.js";import{a as r}from"./sentry-DHDsO12F.js";import{h as _,g as M,j as p,i as v,u as P,N as U,l as z,n as F,o as h}from"./core-B5mDy9pu.js";import{fF as O,a0R as b,bo as B,bn as N,iL as V,gh as L}from"./zeni-epic-state-7eY0g-Bc.js";import{M as $,z as I,as as q,dP as G}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{M as J}from"./MobileAppDrawer-0YtWXA3B.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="ac31c028-1c4f-4264-a4df-59b0dc391a96",e._sentryDebugIdIdentifier="sentry-dbid-ac31c028-1c4f-4264-a4df-59b0dc391a96")}catch{}})();const K=z((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=M(),c=$(),o=p((a=>O(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:f}=v(),u=P(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const m=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(l),y=C||k||x,d=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&m.current&&(u(L({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),m.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||d(a,i,!0),m.current=!0}),[n?.fetchState,d]),R=r.useCallback(((a,i)=>{d(a,i,!1)}),[d]),g=a=>{S(a)},{isAiCfoAccessEnabled:j,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return q({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:c,currentTenant:o,signedInUser:l,tenantEmailDomain:f,onReload:D,onTimeRangeSelect:R,handleDrawerToggle:g,isAiCfoAccessEnabled:j,onAskAiCfoClick:A})]}):s.jsx(U,{to:`/${f}/dashboard`,replace:!0})};function he(){return s.jsxs(F,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
@@ -1 +0,0 @@
1
- import{j as r}from"./liveblocks-UOzcPsHa.js";import Z from"./NotFoundScreen-BkYIKPgh.js";import{a as p}from"./sentry-DHDsO12F.js";import{h as C,g as N,u as D,j as u,N as V,l as k,n as z,o as g}from"./core-B5mDy9pu.js";import{fF as E,YW as w,Zb as h,Nw as U,Ns as L,Nv as f,Nl as B,ZA as $,Np as F,Ny as K}from"./zeni-epic-state-7eY0g-Bc.js";import{z as T,w as W,c9 as Y,n as O,bS as q,ca as G}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{u as H,R as x}from"./ReimbursementApprovalRuleDetailScreen-phJuB98f.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="ab90c930-1b70-42d7-afe3-19de305f8c6f",e._sentryDebugIdIdentifier="sentry-dbid-ab90c930-1b70-42d7-afe3-19de305f8c6f")}catch{}})();const A="reimbursement-approval-rule-update",J=k((function(e){return{approvalView:w(e),remiSetupApproverViewUpdateData:h(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e($(!1))},onBackClick:()=>{O(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))(W(Y)),M=({isLoading:e})=>{const s=C(),n=N(),a=D(),[t,l]=p.useState(!1),[v,y]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>w(o))),b=u((o=>h(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{b?.updateStatus.fetchState==="Completed"&&a(U())}),[b]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!1)))}),[t,S,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(y(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${A}`]:[],eventCallback:(o,R,j)=>{o.endsWith(A)&&j.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(J,{currentTenant:c,location:n,navigate:s,...m})},I="reimbursement-approval-rule-update",P=k((function(e){const s=w(e),n=h(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(I)&&e($(!1))},onBackClick:()=>{O(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(K(t,!0))}}}))(W(G)),Q=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=q(e?.tenantId);return s?r.jsx(X,{isLoading:n}):r.jsx(M,{isLoading:n})},X=({isLoading:e})=>{const s=C(),n=N(),a=D(),[t,l]=p.useState(!1),[v,y]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),b=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>w(i)));H();const R=u((i=>h(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{R?.updateStatus.fetchState==="Completed"&&a(U())}),[R]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||b!=="Not-Started"||e||(y(!0),a(F(!1,!0)))}),[v,b,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const j={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${I}`]:[],eventCallback:(i,ee,_)=>{i.endsWith(I)&&_.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(P,{currentTenant:m,location:n,navigate:s,isLoading:e,...j})};function le(){return r.jsxs(z,{children:[r.jsx(g,{path:"/",element:r.jsx(Q,{})}),r.jsx(g,{path:"/new",element:r.jsx(x,{})}),r.jsx(g,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(g,{path:"*",element:r.jsx(Z,{})})]})}export{le as R};
@@ -1 +0,0 @@
1
- import{j as h}from"./liveblocks-UOzcPsHa.js";import{a as f}from"./sentry-DHDsO12F.js";import{u as U,j as g,h as _,g as O,i as V,l as N}from"./core-B5mDy9pu.js";import{mr as W,Zb as w,YW as x,No as k,NB as B,Nw as A,Nx as E,Zc as j,fF as Z,Nv as z}from"./zeni-epic-state-7eY0g-Bc.js";import{z as F,E as P,a7 as $,c0 as K,n as q,bS as Y,c1 as G}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b7c91cbd-8473-417f-bb17-e82f919e82a3",e._sentryDebugIdIdentifier="sentry-dbid-b7c91cbd-8473-417f-bb17-e82f919e82a3")}catch{}})();function H(){const e=U(),s=f.useRef(!1),t=g((o=>o.vendorListState.fetchStateBillsTab.fetchState??"Not-Started")),p=g((o=>o.vendorListState.allVendorIdsBillsTab.length>0));f.useEffect((()=>{s.current||p||t==="Completed"||t==="In-Progress"||(s.current=!0,e(W({})))}),[p,t,e])}const J=N((function(e,s){const t=w(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",o=p==="approval_create"&&t.allApprovalRules.length!==0;let i=t.allApprovalRules.length===0;return s.approvalRuleId&&(i=t.allApprovalRules.findIndex((r=>r.approvalRuleId===s.approvalRuleId))===0),{localData:t,hideUpperBoundField:o,isLowerBoundDisabled:i,approvalUpdateActionType:p}}),(function(e,s){const{navigate:t,approvalUpdateDataView:p,approverViewData:o,approvalRuleId:i}=s,r=p.remiSetupApproverViewUpdateData?.type,l=q(s.location);return{onApprovalRuleDataUpdated:a=>{const d=v=>{const S=[];return v.forEach((u=>{const I=u.actors.selectedUsers.map((m=>({type:"user",subType:void 0,userId:m.userId,idType:"user",isImplicitActor:!1}))),R=u.actors.selectedNonUsers.map((m=>{const y=(b=m.value,j(b)==null);var b;return{type:y?"attribute":"role",subType:m.value,userId:void 0,idType:void 0,isImplicitActor:!y}})),c=I.concat(R);S.push({action:u.stepType.selectedOption,actors:c,operator:c.length>1?u.stepType.selectedOption==="require_approval"?"or":"and":"is"})})),S},n={amount:{type:"amount",comparator:"range",min:{amount:a.lowerBound,currencyCode:"USD",currencySymbol:"$"},max:{amount:a.upperBound,currencyCode:"USD",currencySymbol:"$"}}};if(r==="approval_create"){const v={criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}else{const v={approvalRuleId:i,criteria:n,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(v))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!1))},onSaveRuleSuccess:()=>{t("../")}}}))(K);function M(){const e=_(),s=U(),t=O(),{approvalRuleId:p}=V(),o=F.getSignedInUser(),i=P(),r=g((n=>w(n))),l=g((n=>x(n))),[a,d]=f.useState(!1);if(f.useEffect((()=>{a||(d(!0),s(k(!0)))})),f.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),o==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?h.jsx($,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):h.jsx(J,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t})}function pe(e){return j(e)==null}const Q=N((function(e,s){const t=w(e),p=t.remiSetupApproverViewUpdateData?.type??"approval_create",o=[],i={};for(const r of Object.values(e.vendorState.vendorByID))r?.id!=null&&(o.push(r.id),i[r.id]=r.name);return{localData:t,approvalUpdateActionType:p,allVendorIds:o,vendorNamesById:i,editingRuleId:p==="approval_update"?s.approvalRuleId:void 0,allApprovalRulesWithUser:x(e).allApprovalRules}}),(function(e,s){const{navigate:t,approvalUpdateDataView:p,approverViewData:o,approvalRuleId:i}=s,r=p.remiSetupApproverViewUpdateData?.type,l=q(s.location);return{onApprovalRuleDataUpdated:a=>{const d=c=>{const m=[];return c.forEach((y=>{const b=y.actorKind?.selectedOption,L=y.selectedRole?.selectedNonUsers??[];let D=[];b==="role"?D=L.map((T=>({type:"attribute",subType:T.value,userId:void 0,idType:void 0,isImplicitActor:!1}))):b==="specific_person"&&(D=(y.persons?.selectedUsers??[]).map((T=>({type:"user",subType:void 0,userId:T.userId,idType:"user",isImplicitActor:!1}))));const C=y.action??"require_approval";m.push({action:C,actors:D,operator:D.length>1?C==="require_approval"?"or":"and":"is"})})),m},n=a.amountCriteria,v=a.vendorCriteria,S=a.departmentCriteria,u={};if(n!=null&&n.comparator.selectedOption!=null){const c=n.comparator.selectedOption;u.amount={type:"amount",comparator:c,min:c==="less_than"?void 0:n.min,max:c==="greater_than"?void 0:n.max}}const I=v?.selection.selectedOptions??[];I.length>0&&(u.vendor={type:"vendor",operator:v?.operator.selectedOption??"is",vendorIds:I});const R=S?.selection.selectedOptions??[];if(R.length>0&&(u.department={type:"department",operator:S?.operator.selectedOption??"is",departmentIds:R}),r==="approval_create"){const c={name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}else{const c={approvalRuleId:i,name:a.name,description:a.description,separationOfDuties:a.separationOfDuties,criteria:u,steps:d(a.steps),isApplicableOnPendingApprovalEntity:a.applyToExistingReimbursements.includes("applyToExistingReimbursements")};e(E(c))}},onResetClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onBackClick:()=>{e(A()),r==="approval_update"||l?t("../"):o.allApprovalRules.length===0&&o.fetchState==="Completed"?t("../../setup"):t("../")},onSaveRuleClick:()=>{e(B(!0))},onSaveRuleSuccess:()=>{t("../")},onEditExistingRule:a=>{e(z(a)),t(r==="approval_update"?`../../${a}/edit`:`../${a}/edit`)}}}))(G);function ne(){const e=g((t=>Z(t))),{isApprovalRulesV3Enabled:s}=Y(e?.tenantId);return s?h.jsx(X,{}):h.jsx(M,{})}function X(){const e=_(),s=U(),t=O(),{approvalRuleId:p}=V(),o=F.getSignedInUser(),i=P(),r=g((n=>w(n))),l=g((n=>x(n))),[a,d]=f.useState(!1);if(H(),f.useEffect((()=>{a||(d(!0),s(k(!1)))})),f.useEffect((()=>{l.fetchState==="Not-Started"&&e(p!=null?"../../":"../")}),[l,p]),o==null)throw Error("Can't access address page without signing in...");return r.approversDetailsFetchStatus.fetchState=="Not-Started"||r.approversDetailsFetchStatus.fetchState==="In-Progress"?h.jsx($,{fetchState:r.approversDetailsFetchStatus.fetchState,style:{backgroundColor:i.colors.grey5}}):h.jsx(Q,{navigate:e,approvalUpdateDataView:r,approvalRuleId:p,approverViewData:l,location:t},p??"new")}export{ne as R,pe as i,H as u};
@@ -1 +0,0 @@
1
- import{j as p}from"./liveblocks-UOzcPsHa.js";import{g as J,h as Oe,u as De,i as Ue,j as d,l as Ae,n as Pe,o as ee}from"./core-B5mDy9pu.js";import{fF as q,E1 as R,UC as Ee,l$ as le,u6 as ce,uX as U,lG as Ve,lP as A,lH as P,kK as E,kB as V,kA as Le,Db as ie,v0 as Me,bq as Be,UD as ve,bn as xe,Eo as ze,UE as Ge,UF as He,ci as g,D4 as Ye,UG as ae,UH as Ne,UI as $e,UJ as qe,UK as Ze,UL as Ke,UM as Qe,UN as We,UO as Xe,UP as Je,UQ as ea,UR as aa,US as sa,UT as j,UU as L,UV as M,UW as B,UX as v,UY as x,UZ as z,U_ as G,U$ as H,V0 as Y,ei as ta,E2 as oa,DR as se,DS as te,E8 as na,DW as oe,Ee as ra,V1 as la,V2 as ca,V3 as ia,V4 as da,V5 as pa,V6 as _a,V7 as fa,V8 as ma,V9 as ba,Va as ua,d_ as ha,dZ as ya}from"./zeni-epic-state-7eY0g-Bc.js";import{an as Ca,ao as wa,ap as Sa,a as ga,a1 as Ia,N as de,c as N,z as pe,aq as Ra,U as Ta,e as ja,ar as ka,as as Fa,a8 as Oa,j as $,S as Da,x as Ua,p as _e,at as Aa,au as Pa,av as Ea}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import Va from"./NotFoundScreen-BkYIKPgh.js";import{F as La}from"./FeaturePreviewScreen-5SleVFKv.js";import{a as b}from"./sentry-DHDsO12F.js";import{u as Ma}from"./useInitialThreadRequest-7Q8HJAH2.js";import{t as ne,a as re,b as Ba}from"./routePaths-uBvxqlLY.js";import{M as va}from"./MobileAppDrawer-0YtWXA3B.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.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]="fe07b0ad-0eec-4694-9267-4bba7c91e3eb",e._sentryDebugIdIdentifier="sentry-dbid-fe07b0ad-0eec-4694-9267-4bba7c91e3eb")}catch{}})();const xa=["profit_loss","balance_sheet","cash_flow"],I=e=>e==="balance_sheet"||e==="balance_sheet_by_classes"||e==="balance_sheet_by_projects",y=e=>{e(Y({resetLeftScroll:!0})),e(H({resetLeftScroll:!0})),e(G({resetLeftScroll:!0})),e(z({resetLeftScroll:!0})),e(x({resetLeftScroll:!0})),e(v({resetLeftScroll:!0})),e(L({resetLeftScroll:!0})),e(B({resetLeftScroll:!0})),e(M({resetLeftScroll:!0}))},za=e=>{e(ca()),e(ia()),e(da()),e(pa()),e(_a()),e(fa()),e(ma()),e(ba()),e(ua())},Ga=Ae((function(e){const o=pe.getSignedInUser(),_=e.tenantState.currentTenantId,m=q(e),a=m?.companyName??"",s={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:_??""},t=R(e),r=ve(m);return{fetchState:t.fetchState,selectedTimeframe:t.filter.timeframe,selectedReport:t.selectedReportId,displayOrder:t.displayOrder,reportFormat:t.reportFormat,dataAvailable:t.dataAvailable,balancesInTimeframe:t.balancesInTimeframe,allTimeframeTicks:t.allTimeframeTicks,selectedCOABalancesRange:t.filter.balancesRange,isCompareMode:t.isCompareModeOn,profitAndLossReport:t.profitAndLossReport,profitAndLossClassesViewReport:t.profitAndLossByClassReport,profitAndLossProjectViewReport:t.profitAndLossByProjectReport,profitAndLossByClassHorizontalReport:t.profitAndLossByClassHorizontalReport,balanceSheetReport:t.balanceSheetReport,balanceSheetClassesViewReport:t.balanceSheetByClassReport,cashFlowClassesViewReport:t.cashFlowByClassReport,cashFlowProjectViewReport:t.cashFlowByProjectReport,balanceSheetProjectViewReport:t.balanceSheetByProjectReport,cashFlowReport:t.cashFlowReport,downloadState:t.downloadState,analytics:$,isZeniUser:xe(o),showAccountGroups:r===!0,isAccountingClassesEnabled:le(e),isAccountingProjectsEnabled:ce(e),currentTenantCompanyName:a,statementEndPoint:`${Ea}/statement`,authParams:s,isZeniCOAUsed:r}}),(function(e,o){const{navigate:_,handleDrawerToggle:m}=o;return{onReloadReport:()=>{o.signedInUser!=null&&e(U(o.signedInUser.userId,!0,!1))},updateDownloadStateHandler:a=>{e(la(a))},onTimeframeSelectionChanged:(a,s,t)=>{if(e(ra(a)),s){const{isCompareModeOn:r,filter:l}=o,{additionalBalances:f,balancesRange:i}=l;let c=[...f];a==="year"&&(c=c.filter((C=>C!=="this_period_vs_same_period_last_year"&&C!=="this_period_vs_same_period_last_year_percent"&&C!=="same_period_last_year"))),e(se(o.firstMonthOfFY,r,i.numberOfPeriods<1?1:i.numberOfPeriods,c)),f.length>0&&e(te(o.firstMonthOfFY,c.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",i.numberOfPeriods<1?1:i.numberOfPeriods,c))}t!==!0&&setTimeout((()=>y(e)),50)},onReportSelectionChanged:a=>{const s=o.selectedReportID;if(a===s)return;const t=o.classViewLayout;e(j(a)),(I(a)||g(a))&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(oe({numberOfPeriods:1,orderBy:"ascending_date"})),a!=="profit_and_loss"&&a!=="profit_and_loss_by_classes"&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(ae({classViewLayout:"vertical"})),y(e)},onCOABalancesRangeChanged:(a,s)=>{e(oe(a,s)),y(e)},onThisPeriodChanged:(a,s,t)=>{e(na(o.firstMonthOfFY,a,s<1?1:s)),t!==!0&&y(e)},onAdditionalBalanceSelectionChanged:(a,s,t,r)=>{e(se(o.firstMonthOfFY,a,t<1?1:t,s)),s.length>0&&e(te(o.firstMonthOfFY,s.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",t<1?1:t,s)),r!==!0&&o.isCompareModeOn===a||setTimeout((()=>y(e)),50)},onUpdateHighlightedNumberOfPeriods:(a,s,t,r)=>{e(oa({firstMonthOfFY:o.firstMonthOfFY,isCompareModeOn:s,additionalBalances:a,maxNumOfPeriodsToHighlight:t<1?1:t,coaBalances:r}))},onAccountBalanceClick:o.hasTransactionAccess!==!0?void 0:(a,s,t)=>{let r,l;if(s.balanceTimeFrame==="month"||s.balanceTimeFrame==="quarter"?(r=s.balanceTimeFrame,l=ta(s)):s.balanceTimeFrame==="year"?(r="quarter",l={startDate:s.endDate.startOf("quarter"),endDate:s.endDate}):console.error(`timeframe ${s.balanceTimeFrame} is not supported`),l!=null&&r!=null){const f=a.accountName===""?a.accountDescription:a.accountName,i=(()=>{if(o.selectedReportID==="profit_and_loss_by_classes"&&o.classViewLayout==="horizontal"&&a.accountType!=null){if(t?.isHorizontalClassTotalColumn===!0)return ne(o.tenantEmailDomain,a.accountId,a.accountType,f,r,l);if(t?.isHorizontalClassColumn===!0&&s.id!=null)return re(o.tenantEmailDomain,a.accountId,a.accountType,s.id,f,r,l)}return a.projectsViewParentId?.projectId!=null&&a.accountType!=null?Ba(o.tenantEmailDomain,a.accountId,a.accountType,a.projectsViewParentId.projectId,f,r,l):a.classesViewParentId!=null&&a.classesViewParentId.parentClassId!=null&&a.accountType!=null?re(o.tenantEmailDomain,a.accountId,a.accountType,a.classesViewParentId.parentClassId[0],f,r,l):a.accountType!=null?ne(o.tenantEmailDomain,a.accountId,a.accountType,f,r,l):void 0})();if(i!=null){const c=_e(o.location.state?.pathnameStackToGoBack,o.location.pathname);_(i,{state:{pathnameStackToGoBack:c,referrer:k(o.selectedReportID)}})}}},onTableScroll:(a,s)=>{switch(a){case"profit_and_loss":e(Y({scrollPosition:s}));break;case"profit_and_loss_by_classes":e(H({scrollPosition:s}));break;case"profit_and_loss_by_projects":e(G({scrollPosition:s}));break;case"balance_sheet":e(z({scrollPosition:s}));break;case"balance_sheet_by_classes":e(x({scrollPosition:s}));break;case"balance_sheet_by_projects":e(v({scrollPosition:s}));break;case"cash_flow_by_classes":e(B({scrollPosition:s}));break;case"cash_flow_by_projects":e(M({scrollPosition:s}));break;case"cash_flow":e(L({scrollPosition:s}));break;default:console.log(`Table Scroll state for ${a} is not handled`)}},onElementCollapseStateChanged:(a,s,t)=>{switch(a){case"profit_and_loss":e(Y({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_classes":e(H({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_projects":e(G({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet":e(z({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_classes":e(x({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_projects":e(v({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_classes":e(B({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_projects":e(M({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow":e(L({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;default:console.log(`Collapse state toggle for ${a} is not handled`)}},onBackClick:()=>{_("../../")},onUpdateAccountViewMode:(a,s)=>{const t=s??o.selectedReportID,r=I(t),l=g(t);l?(e(We({viewMode:a})),e(Xe({viewMode:a}))):r?(e(Je({viewMode:a})),e(ea({viewMode:a}))):(e(aa({viewMode:a})),e(sa({viewMode:a}))),a==="classes"?(o.analytics?.trackGroupBySwitch("Classes",k(t)),e(j(l?"cash_flow_by_classes":r?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",k(t)),e(j(l?"cash_flow_by_projects":r?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",k(t)),e(j(l?"cash_flow":r?"balance_sheet":"profit_and_loss"))),y(e)},onUpdateClassesToFilterOut:a=>{g(o.selectedReportID)?e(Ze({classesToFilterOut:a})):I(o.selectedReportID)?e(Ke({classesToFilterOut:a})):e(Qe({classesToFilterOut:a}))},onUpdateProjectsToFilterOut:a=>{g(o.selectedReportID)?e(Ne({projectsToFilterOut:a})):I(o.selectedReportID)?e($e({projectsToFilterOut:a})):e(qe({projectsToFilterOut:a}))},onUpdateClassViewLayout:a=>{e(ae({classViewLayout:a}))},onOpenAccountViewMode:()=>{const a=I(o.selectedReportID),s=g(o.selectedReportID);o.isAccountingClassesEnabled&&e(s?P():a?V():Ye()),o.isAccountingProjectsEnabled&&e(s?A():a?E():ie())},onUpdateDisplayOrder:a=>{e(He(a))},onUpdateReportFormat:a=>{za(e),e(Ge(a))},onClickMenuIcon:()=>{m(!0)},onResyncReports:()=>{const a=o.selectedReportID;e(a!=="balance_sheet_by_classes"?a!=="balance_sheet_by_projects"?a!=="cash_flow_by_classes"?a!=="cash_flow_by_projects"?ze(a==="profit_and_loss_by_projects"?"profit_and_loss_by_projects":"profit_and_loss_by_classes"):A(!0):P(!0):E(!0):V(!0))}}}))(Aa);function Ha(){const{isAiCfoOpen:e,setIsAiCfoOpen:o}=ga(),_=Ia(),m=Pa(_),a=Oe(),s=De(),t=J(),{tenantEmailDomain:r}=Ue(),{useFeatureGate:l}=de(),{isFeatureEnabled:f}=l(N.isReportsHorizontalClassLayoutSwitchEnabled),i=pe.getSignedInUser(),[c,C]=b.useState(!1),[Z,fe]=b.useState(!1),{isFeatureEnabled:K}=l(N.isReportsCommentingEnabled);if(i==null)throw Error("Can't access reports page without signing in...");const F=d((n=>q(n))),me=F.masterTOSInfo?.isMasterTOSAccepted??!1,be=F.company?.companyInfo.firstMonthOfFY??1,ue=Ma(K?F?.companyId:void 0),w=d((n=>R(n).fetchState)),he=d((n=>Ee(n))),{areTenantIdsInSync:u}=Ra(),O=d((n=>n.financeStatementState.selectedReportId)),T=d((n=>le(n))),S=d((n=>ce(n))),ye=d((n=>R(n).isCompareModeOn)),h=d((n=>R(n).filter)),D=d((n=>R(n).selectedReportAndTimeframeFetchState)),Ce=d((n=>n.profitAndLossClassesViewState.uiState.classViewLayout));b.useEffect((()=>{!c&&u&&(C(!0),s(U(i.userId,!0,!0,!1)))}),[c,i,s,u]),b.useEffect((()=>{c&&!Z&&w==="Completed"&&u&&(s(U(i.userId,!1,!0,!1)),fe(!0))}),[c,Z,w,u]),b.useEffect((()=>{if(c&&D.fetchState==="Not-Started"&&h.timeframe!=="free_range"&&h.timeframe!=="week"&&u)switch(O){case"profit_and_loss":case"profit_and_loss_by_classes":s(Me(h.timeframe));break;case"profit_and_loss_by_projects":S&&s(ie());break;case"balance_sheet":s(Le(h.timeframe));break;case"balance_sheet_by_classes":T&&s(V());break;case"balance_sheet_by_projects":S&&s(E());break;case"cash_flow_by_classes":T&&s(P());break;case"cash_flow_by_projects":S&&s(A());break;case"cash_flow":s(Ve(h.timeframe))}}),[c,O,D,u,T,S]);const Q=Ta(),we=Q?.loggedInUserRole!=null&&Be(Q?.loggedInUserRole)!==!0,[Se,ge]=b.useState(!1),W=n=>{ge(n)},Ie=ja(),Re=ka();return(function(n){const{isDataReady:Te}=n,{pathname:je}=J(),X=Ca(je??"")==="reports",ke=wa(Te),Fe=b.useMemo((()=>X?xa:void 0),[X]);Sa({canFetchSuggestedQuestions:ke,pageContexts:Fe})})({isDataReady:w==="Completed"}),Fa({isDataReady:w==="Completed"}),p.jsxs(p.Fragment,{children:[w==="Completed"?p.jsx(Oa,{analytics:$,onLoad:n=>n.trackPageLoaded(Da.Event.reports)}):null,p.jsx(va,{isAppContentDrawerOpen:Se,handleDrawerToggle:W}),p.jsx(Ga,{firstMonthOfFY:be,tenantEmailDomain:r,location:t,navigate:a,windowSize:_,classViewLayout:Ce,selectedReportID:O,analytics:$,filter:h,isAccountingClassesEnabled:T,isAccountingProjectsEnabled:S,isCompareModeOn:ye,hasTransactionAccess:we,signedInUser:i,selectedReportAndTimeframeFetchState:D,handleDrawerToggle:W,reportsResyncFetchState:he.reportsResyncFetchState,isAiCfoAccessEnabled:Re&&Ie&&!e,onAskAiCfoClick:()=>{if(me)if(m){const n=_e(t.state?.pathnameStackToGoBack,t.pathname);a(`/${r}/ai-cfo/explore`,{state:{pathnameStackToGoBack:n,referrer:"Reports"}})}else o(!0);else Ua({location:t,navigate:a,mergeState:{referrer:"Reports"}})},isHorizontalClassReportSwitchEnabled:f,isReportsCommentingEnabled:K,initialOpenThreadRequest:ue})]})}const k=e=>{switch(e){case"profit_and_loss":case"profit_and_loss_by_classes":case"profit_and_loss_by_projects":return"Profit & Loss";case"balance_sheet":case"balance_sheet_by_classes":case"balance_sheet_by_projects":return"Balance Sheet";case"cash_flow":case"cash_flow_by_classes":case"cash_flow_by_projects":return"Cash Flow";default:return"Reports"}};function _s(){const e=d((s=>q(s))),{useFeatureGate:o}=de(),{isFeatureEnabled:_}=o(N.isDebitCardFeatureEnabled),m=ha(_,e),a=ya(e);return m===!0||a===!0?p.jsx(La,{}):p.jsxs(Pe,{children:[p.jsx(ee,{path:"/",element:p.jsx(Ha,{})}),p.jsx(ee,{path:"*",element:p.jsx(Va,{})})]})}export{_s as default};
@@ -1 +0,0 @@
1
- import{j as a}from"./liveblocks-UOzcPsHa.js";import{z as b,a8 as v,j as d,S as D,e4 as E,N as I,c as k}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import g from"./NotFoundScreen-BkYIKPgh.js";import{a as m}from"./sentry-DHDsO12F.js";import{u as C,j as h,h as F,g as L,l as T,n as U,o as f,N as y}from"./core-B5mDy9pu.js";import{fF as _,a1M as j,a1N as p,DI as P,p$ as V,a1O as G,DG as z}from"./zeni-epic-state-7eY0g-Bc.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="21a32a39-9741-48cf-9d99-1c63b5ba6c2b",e._sentryDebugIdIdentifier="sentry-dbid-21a32a39-9741-48cf-9d99-1c63b5ba6c2b")}catch{}})();const M=T((function(e,t){const n=j(e);return{inviteFormView:n.localData,submitStatus:n.saveStatus,userName:t.userName,rewardsPlan:n.rewardsPlan,companyLegalName:t.companyName}}),(function(e,t){const{navigate:n}=t,i=b.getSignedInUser();return{onDismissClick:()=>{e(p()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((c=>{s.push(c.companyName),r.push(c.emailIds[0])})),d.trackInviteEmailClicked("send",s,r,s.length)}e(z())},onUpdateInviteFormLocalData:s=>{e(G({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&d.trackInviteEmailClicked("cancel")}}}))(E),O=()=>{const e=C(),[t,n]=m.useState(!1),[i,s]=m.useState(!1),r=h((o=>_(o))),c=F(),w=L(),u=b.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const l=h((o=>j(o))),x=u?.firstName!=null?u.firstName:"User";m.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),m.useEffect((()=>{t||l.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[l.fetchState,e]);const N=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[l.fetchState==="Completed"?a.jsx(v,{analytics:d,onLoad:o=>(S=>S.trackPageLoaded(D.Event.inviteEmailViewed))(o)}):null,a.jsx(M,{navigate:c,location:w,currentTenant:r,companyName:N,userName:x,inviteFormCompayData:l.localData})]})};function ne(){const{useFeatureGate:e}=I(),{isFeatureEnabled:t}=e(k.isReferralFeatureEnabled);return a.jsxs(U,{children:[a.jsx(f,{path:"/",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(f,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(f,{path:"refer/*",element:t?a.jsx(O,{}):a.jsx(g,{})}),a.jsx(f,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};