@zeniai/web-app-ui 5.3.65-dev → 5.3.66-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 (172) hide show
  1. package/dist/assets/AccountMappingScreen-qzaB7mmI.js +9 -0
  2. package/dist/assets/ActualMatchingMatchDetailScreen-DqHcloug.js +1 -0
  3. package/dist/assets/AddressRoutes-CSHbftqG.js +1 -0
  4. package/dist/assets/AddressScreen-C6LJsN0I.js +9 -0
  5. package/dist/assets/{AiCfoScreen-HIFRX9qy.js → AiCfoScreen-69iCdaWe.js} +5 -5
  6. package/dist/assets/AppDrawer-BetwU_4-.js +10 -0
  7. package/dist/assets/{BillPayApprovalRoutes-CJFVAxhN.js → BillPayApprovalRoutes-DzANWOc3.js} +1 -1
  8. package/dist/assets/BillPayRoutes-D2aY2x5B.js +119 -0
  9. package/dist/assets/{BusinessVerificationPageScreen-ClHDLcIn.js → BusinessVerificationPageScreen-BgP8jWXu.js} +2 -2
  10. package/dist/assets/CardsAiCfoScreen-B0vefglp.js +14 -0
  11. package/dist/assets/ChargeCardRoutes-giQdoPks.js +71 -0
  12. package/dist/assets/CompanyPassportScreen-B-V7cvQm.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-BXN_6nzp.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-DU6fAlNg.js +1 -0
  15. package/dist/assets/CustomerOnboardingRoutes-BxjXFm9y.js +30 -0
  16. package/dist/assets/DashboardRoutes-B8Is8VU8.js +20 -0
  17. package/dist/assets/DefaultTenantHome-DeP5rQNd.js +1 -0
  18. package/dist/assets/DomesticWireDetailScreen-BQJTKZiM.js +18 -0
  19. package/dist/assets/DrawerScreen-BUdO6BQE.js +1 -0
  20. package/dist/assets/EntityDetailRoutes-DUH9-vmY.js +1 -0
  21. package/dist/assets/ExpenseAutomationRoutes-CoKP5vlI.js +38 -0
  22. package/dist/assets/FeaturePreviewScreen-DLzs5A8g.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-Zi2fxuEj.js +1 -0
  24. package/dist/assets/InboxNotificationsProvider-C8gkRzEM.js +1 -0
  25. package/dist/assets/InvoicingRoutes-Bl5-2g9q.js +2 -0
  26. package/dist/assets/MagicLinkRoutes-BkB3vELP.js +72 -0
  27. package/dist/assets/MagicLinkSignInScreen-BQa7bOA3.js +12 -0
  28. package/dist/assets/MobileAppDrawer-BdOhYCo5.js +1 -0
  29. package/dist/assets/NotFoundScreen-D_hX2Dzv.js +1 -0
  30. package/dist/assets/NotificationRoutes-BlXrAcVL.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-DV9AMjuQ.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-DQr_dvG9.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-CAg7Uc1V.js → PaymentLinkScreen-BU0e_SRM.js} +5 -5
  34. package/dist/assets/PeopleRoutes-BGMNmycG.js +22 -0
  35. package/dist/assets/PerformanceRoutes-Bx4cQFIn.js +1 -0
  36. package/dist/assets/{Preview-DB5CbRio.js → Preview-CdZ2j2v9.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-CRdIfjOg.js → QBOConnectionScreen-DPCQAZIh.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-BNnc3IUS.js +1 -0
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-ChXGgpkg.js → ReimbursementApprovalRuleDetailScreen-DZMnuINe.js} +1 -1
  40. package/dist/assets/ReimbursementRoutes-CzK-ajwk.js +68 -0
  41. package/dist/assets/ReportsRoutes-FipSeC9E.js +1 -0
  42. package/dist/assets/RewardsRoutes-BXICRfw-.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CuQHddsr.js → ScheduleDetailsPrepaidExpensesScreen-BF-khYnD.js} +5 -5
  44. package/dist/assets/ScreenRoutes-6gUtsuNq.js +2 -0
  45. package/dist/assets/{SettingsRoutes-B7gRIVJU.js → SettingsRoutes-ZSOCIcz1.js} +6 -6
  46. package/dist/assets/{SetupPagesScreen-CabDNVlS.js → SetupPagesScreen-DLgnlxEs.js} +5 -5
  47. package/dist/assets/SignInScreen-C1w5fnGW.js +1 -0
  48. package/dist/assets/SignOutScreen-DCUrMwdu.js +9 -0
  49. package/dist/assets/{TaskListScreen-d8rT1QCC.js → TaskListScreen-DJlJsvJO.js} +2 -2
  50. package/dist/assets/TaskRoutes-Bwnv9rhn.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-Dw-xx0H2.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-BH-OIB8S.js +5 -0
  53. package/dist/assets/TransactionListRoutes-DcrtQayK.js +1 -0
  54. package/dist/assets/TreasuryRoutes-BNsP_RFF.js +37 -0
  55. package/dist/assets/{VendorsRoutes-Dd9qfBZi.js → VendorsRoutes-Bzdw0VNh.js} +10 -10
  56. package/dist/assets/WiseConfirmationScreen-Cs6ZZr7W.js +12 -0
  57. package/dist/assets/ZeniAccountRoutes-CbW2U8iU.js +57 -0
  58. package/dist/assets/ZeniAccountStatementScreen-Dbn9Qd0C.js +9 -0
  59. package/dist/assets/{accountMappingHelper-mjWJVrZb.js → accountMappingHelper-BBlKWvqF.js} +1 -1
  60. package/dist/assets/analytics-Cd5J-GpX.js +68 -0
  61. package/dist/assets/{analyticsHelper-DoCIxX19.js → analyticsHelper-1gGrcOYN.js} +1 -1
  62. package/dist/assets/{core-BBG4mxvC.js → core-vR5k5yHJ.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-DgKmvHaP.js → decodeURIComponentSafe-dlx9EsSm.js} +1 -1
  64. package/dist/assets/{dnd-oIrpOltC.js → dnd-CNeE6eVY.js} +1 -1
  65. package/dist/assets/{empty-zUa_Ywzm.js → empty-BCyx7s6I.js} +1 -1
  66. package/dist/assets/{empty-BVUnugO_.js → empty-BaVMrwvd.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-WG4m8gNp.js → emptyVideoElement-BsSkwvra.js} +1 -1
  68. package/dist/assets/epic-BY4nSR9p.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-DhbRqzrb.js +1 -0
  70. package/dist/assets/getLocaleForTenant-DlNsSiyY.js +1 -0
  71. package/dist/assets/{index-De2R2YuA.js → index-1ujiYIu0.js} +29082 -29221
  72. package/dist/assets/{index-CD8RychW.js → index-B8gT7z4T.js} +1 -1
  73. package/dist/assets/{index-lbu92FYh.js → index-BNIWZiV_.js} +1 -1
  74. package/dist/assets/{index-BlZF-J3g.js → index-C-u59Z-A.js} +1 -1
  75. package/dist/assets/{index-DlbH0-p0.js → index-DC9buFXh.js} +1 -1
  76. package/dist/assets/{index-Bgwcwudg.js → index-DT7mcNKS.js} +1 -1
  77. package/dist/assets/{index-B9QH_oKn.js → index-DglCggLh.js} +2 -2
  78. package/dist/assets/{index-CyCQjJen.js → index-bBDyOWrB.js} +1 -1
  79. package/dist/assets/{lexical-BRrdO5Cu.js → lexical-DgMW3HzT.js} +1 -1
  80. package/dist/assets/{liveblocks-CzCs-qU3.js → liveblocks-DVkNRe2z.js} +1 -1
  81. package/dist/assets/{lottie-ULJlrwjP.js → lottie-w9LOAwHI.js} +1 -1
  82. package/dist/assets/{mui-B2F_PvWe.js → mui-Bf4yQzNc.js} +1 -1
  83. package/dist/assets/{pathToGoBack-e0pJACvC.js → pathToGoBack-C6FxxwA3.js} +1 -1
  84. package/dist/assets/{pdf-CeVn9A9c.js → pdf-HKvehc9b.js} +4 -4
  85. package/dist/assets/{pdf-lib-DiMa7ymi.js → pdf-lib-1kn73-Ho.js} +1 -1
  86. package/dist/assets/{plaid-BWZxX3Bn.js → plaid-TFLEc35h.js} +1 -1
  87. package/dist/assets/{pusher-wcP4-1ih.js → pusher-tJC8UB03.js} +1 -1
  88. package/dist/assets/{react-D7hd8riP.js → react-BKyIT5tt.js} +1 -1
  89. package/dist/assets/{react-CGMaXwI-.js → react-BtmyM_-m.js} +1 -1
  90. package/dist/assets/{react-Chuw6ptT.js → react-CiN9hWuS.js} +1 -1
  91. package/dist/assets/{react-3Jh1nOTX.js → react-DLVu_DIJ.js} +1 -1
  92. package/dist/assets/{react-Dv-IwMT5.js → react-DrY897mF.js} +1 -1
  93. package/dist/assets/{react-BrDYknqm.js → react-YQhQ1aSJ.js} +1 -1
  94. package/dist/assets/{recharts-CzGMTm3v.js → recharts-BajLe7QJ.js} +1 -1
  95. package/dist/assets/{routePaths-BRju88LA.js → routePaths-Du4I9ue1.js} +1 -1
  96. package/dist/assets/{sentry-CWp8Ph3h.js → sentry-BcU4ynZK.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-BWJSV6oD.js → stripSplatSuffix-CGuqfZ54.js} +1 -1
  98. package/dist/assets/{url-CnTmKJO0.js → url-ee1pOdF5.js} +1 -1
  99. package/dist/assets/{url-DV6CtKQ5.js → url-l4mUxam0.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-CNkjnN75.js +1 -0
  101. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CB15Xjw5.js +1 -0
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-Daw0Xdbp.js +1 -0
  103. package/dist/assets/useChargeCardPusherEvents-B1XaK23y.js +1 -0
  104. package/dist/assets/{useDeviceId-Bzw6IkAe.js → useDeviceId-D80AOehv.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DxMN-FLO.js +1 -0
  106. package/dist/assets/useInitialThreadRequest-CujqTgMw.js +1 -0
  107. package/dist/assets/useTaskManagerAccess-DmtbEonm.js +1 -0
  108. package/dist/assets/useTaskManagerPusherEvents-Cieei3Tg.js +1 -0
  109. package/dist/assets/{utils-u0mlLj2I.js → utils-BJrHoU4M.js} +1 -1
  110. package/dist/assets/withTransactionSidePanel-D7CS7WiP.js +25 -0
  111. package/dist/assets/{zeni-epic-state-FRanwwFO.js → zeni-epic-state-BmF1nplD.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -4
  114. package/dist/assets/AccountMappingScreen-6_GKC9vx.js +0 -9
  115. package/dist/assets/ActualMatchingMatchDetailScreen-BtJ1PRf_.js +0 -1
  116. package/dist/assets/AddressRoutes-BGo6E_l0.js +0 -1
  117. package/dist/assets/AddressScreen-BYfgTsTg.js +0 -9
  118. package/dist/assets/AppDrawer-HGV6a9mb.js +0 -10
  119. package/dist/assets/BillPayRoutes-9qxDDuw-.js +0 -119
  120. package/dist/assets/CardsAiCfoScreen-HQpPf571.js +0 -14
  121. package/dist/assets/ChargeCardRoutes-D5HxBR-m.js +0 -71
  122. package/dist/assets/CompanyPassportScreen-NKCcjvTx.js +0 -1
  123. package/dist/assets/ConnectionAuthScreen-5_efBSJK.js +0 -11
  124. package/dist/assets/CustomerOnboardingAuthScreen-LnGpx7c7.js +0 -1
  125. package/dist/assets/CustomerOnboardingRoutes-DvA4xflo.js +0 -30
  126. package/dist/assets/DashboardRoutes-BrD8wr4t.js +0 -20
  127. package/dist/assets/DefaultTenantHome-UgTfgsWU.js +0 -1
  128. package/dist/assets/DomesticWireDetailScreen-CnA3RoGS.js +0 -18
  129. package/dist/assets/DrawerScreen-Uxjfm6D_.js +0 -1
  130. package/dist/assets/EntityDetailRoutes-DtNSByJA.js +0 -1
  131. package/dist/assets/ExpenseAutomationRoutes-CyGyQy2q.js +0 -38
  132. package/dist/assets/FeaturePreviewScreen-C1hVuos1.js +0 -1
  133. package/dist/assets/HubSpotOAuthCallbackScreen-BZRaCcdu.js +0 -1
  134. package/dist/assets/InboxNotificationsProvider-J2K-16R3.js +0 -1
  135. package/dist/assets/InvoicingRoutes-BER5-vbp.js +0 -2
  136. package/dist/assets/MagicLinkRoutes-BGZcWo6O.js +0 -72
  137. package/dist/assets/MagicLinkSignInScreen-BclRPUfZ.js +0 -12
  138. package/dist/assets/MobileAppDrawer-B_zpLZqx.js +0 -1
  139. package/dist/assets/NotFoundScreen-BXryZNID.js +0 -1
  140. package/dist/assets/NotificationRoutes-CQasJ3IU.js +0 -1
  141. package/dist/assets/OAuthConsentScreen-Bo-ewMPc.js +0 -1
  142. package/dist/assets/PandLWithForecastRoutes-DdmupK5y.js +0 -1
  143. package/dist/assets/PeopleRoutes-CYUsZeQt.js +0 -22
  144. package/dist/assets/PerformanceRoutes-DqTbj0rB.js +0 -1
  145. package/dist/assets/ReimbursementApprovalRoutes-CgCsp1OP.js +0 -1
  146. package/dist/assets/ReimbursementRoutes-DKUCzczr.js +0 -68
  147. package/dist/assets/ReportsRoutes-CSUm6Emn.js +0 -1
  148. package/dist/assets/RewardsRoutes-DWpcmti-.js +0 -1
  149. package/dist/assets/ScreenRoutes-evald5rF.js +0 -2
  150. package/dist/assets/SignInScreen-DfTwbUKW.js +0 -1
  151. package/dist/assets/SignOutScreen-CH6sLo8r.js +0 -9
  152. package/dist/assets/TaskRoutes-DVZrk18e.js +0 -9
  153. package/dist/assets/TransactionDetailRoutes-CkeAEzHU.js +0 -1
  154. package/dist/assets/TransactionDetailScreen-hIkUAVjY.js +0 -5
  155. package/dist/assets/TransactionListRoutes-BVLahxTu.js +0 -1
  156. package/dist/assets/TreasuryRoutes-D4vqz1Fs.js +0 -37
  157. package/dist/assets/WiseConfirmationScreen-B9ReE25J.js +0 -12
  158. package/dist/assets/ZeniAccountRoutes-BtAMcoNj.js +0 -57
  159. package/dist/assets/ZeniAccountStatementScreen-B3egvFmp.js +0 -9
  160. package/dist/assets/analytics-cC2XJoxx.js +0 -68
  161. package/dist/assets/epic-Du6qCFYI.js +0 -2
  162. package/dist/assets/expenseAutomationHelper-BkZxz0F-.js +0 -1
  163. package/dist/assets/getLocaleForTenant-BYuz_wJa.js +0 -1
  164. package/dist/assets/useActualMatchingMatchDetail-lnPRleqr.js +0 -1
  165. package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-DuZAl-a1.js +0 -1
  166. package/dist/assets/useAskAiCfoHostNavButtonProps-Bq-fQXG8.js +0 -1
  167. package/dist/assets/useChargeCardPusherEvents-CrB7Excu.js +0 -1
  168. package/dist/assets/useEmailConnectResultRefresh-x1GFiNhw.js +0 -1
  169. package/dist/assets/useInitialThreadRequest-C1rKRZSH.js +0 -1
  170. package/dist/assets/useTaskManagerAccess-CoE1FF6T.js +0 -1
  171. package/dist/assets/useTaskManagerPusherEvents-CgOrop-a.js +0 -1
  172. package/dist/assets/withTransactionSidePanel-CbnU34fe.js +0 -25
@@ -0,0 +1,2 @@
1
+ import{j as a}from"./liveblocks-DVkNRe2z.js";import{a as r}from"./sentry-BcU4ynZK.js";import{u as L,h as A,i as R,j as C,t as G,l as O,s as H,g as Z,N as B,n as te,o as x}from"./core-vR5k5yHJ.js";import{a9 as nt,k as p,ar as _,V as m,cd as tt,ce as it,cf as ot,cg as at,ch as st,ci as ct,cj as rt,ck as lt,cl as dt,cm as ut,cn as gt,co as mt,p as W,cp as vt,cq as pt,af as ae,cr as St,cs as ft,z as ke,ct as ht,cu as It,cv as Ct,cw as Et,cx as kt,cy as yt,cz as xt,cA as bt,K as jt,aj as ln,cB as Dt,cC as Lt,cD as At,cE as Pt,cF as $t,cG as Ft,cH as wt,cI as Rt,cJ as _t,cK as Tt,cL as Ot,t as Ve,j as dn,cM as Mt,cN as Nt,cO as Ut,cP as Bt,cQ as Vt,cR as Ht,cS as qt}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{A as Q}from"./AddressScreen-C6LJsN0I.js";import M from"./NotFoundScreen-D_hX2Dzv.js";import{ZQ as zt,ZR as Qt,vp as He,ZS as K,vS as se,ZT as Ae,ZU as ce,wt as ye,wA as Kt,wF as un,ZV as Pe,wx as gn,y7 as qe,vR as ze,ZW as Gt,ZX as mn,wQ as xe,ZY as re,wU as Zt,ZZ as Wt,Z_ as vn,wX as pn,z2 as Xt,Z$ as ve,_0 as Qe,_1 as Sn,vP as Jt,_2 as Yt,vJ as ei,_3 as ni,yk as ti,_4 as fn,yt as Ke,_5 as ii,yq as oi,_6 as $e,gh as ai,_7 as ee,_8 as ne,xa as si,vX as Ge,w0 as hn,v_ as ci,vU as ri,x3 as li,w2 as di,xc as ui,_9 as be,xl as In,xj as X,xh as le,xg as gi,_a as Cn,yz as Ze,_b as mi,vQ as En,_c as Fe,wb as je,w8 as De,wl as kn,wk as we,w5 as vi,we as yn,wn as ie,fF as Re,VC as xn,vT as _e,wi as pi,wj as Si,wh as fi,_d as hi,wV as Ii,wR as bn,_e as jn,vD as We,_f as Ci,vz as Ei,_g as ki,yF as yi,yJ as q,yE as xi,xN as Te,_h as bi,_i as Dn,yS as Xe,_j as ji,yP as Di,_k as Ln,xQ as Li,xR as V,xU as Ai,_l as An,y2 as Ie,_m as Pi,xb as Pn,U8 as $n,_n as $i,yc as Fi,_o as Fn,_p as wi,_q as Ri,_r as _i,zH as Ti,_s as Oi,_t as wn,yZ as Rn,_u as _n,zF as Ce,_v as Mi,zC as Ni,_w as Ui,_x as Bi,_y as Vi,_z as Hi,_A as qi,_B as Je,_C as zi,eg as Qi,zL as Ki,_D as Oe,xv as Gi,xq as Zi,_E as de,xG as Tn,xy as ue,xx as Wi,xB as On,_F as Xi,xw as Ji,_G as Mn,z3 as Nn,zu as Ye,zp as Yi,_H as eo,z4 as no,_I as to,zv as io,zz as oo,_J as Me,wv as Un,zg as ao,ww as so,_K as co,_L as Bn,c8 as ro,ms as lo,mt as uo,_M as en,wu as ge,gl as go,mz as mo,zm as Vn,zX as vo,zj as Hn,uX as po,zU as nn,uL as So,zR as tn,hS as fo,UB as on,UC as ho,Gh as qn,hK as Io,_N as Co,Vr as Eo,_O as ko,A0 as Ee,A1 as yo,_P as xo,_Q as zn,z_ as bo,_R as jo,_S as Do,yg as Lo,_T as Ao}from"./zeni-epic-state-BmF1nplD.js";import{M as Po}from"./MobileAppDrawer-BdOhYCo5.js";import{q as me}from"./QBOConnectionScreen-DPCQAZIh.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./InboxNotificationsProvider-C8gkRzEM.js";import"./useTaskManagerAccess-DmtbEonm.js";import"./empty-BCyx7s6I.js";import"./pdf-lib-1kn73-Ho.js";import"./index-BNIWZiV_.js";import"./url-l4mUxam0.js";import"./index-B8gT7z4T.js";import"./decodeURIComponentSafe-dlx9EsSm.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="fdd16e8d-e4d1-4d89-9266-7259722e3c69",t._sentryDebugIdIdentifier="sentry-dbid-fdd16e8d-e4d1-4d89-9266-7259722e3c69")}catch{}})();const $=({event:t,isReady:e=!0})=>e?a.jsx(nt,{analytics:p,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function $o(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,auditLogListSortFieldOptions:b}=C(zt),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${n??""}/invoicing`,I=r.useCallback(((P,U)=>{const T=Qt(y,P,U,D);T!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:P,entityId:U,fromScreen:"audit_log"}),e(T))}),[D,e,y]);r.useEffect((()=>{const P=setTimeout((()=>d(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(He({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,t]);const j=g==="Not-Started"||g==="In-Progress"&&S.length===0,E=g==="In-Progress"&&S.length>0,F=g==="Completed";return N(g)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:F}),a.jsx(tt,{auditLogEntityRouteOptions:D,auditLogListSortFieldOptions:b,entries:S,hasMore:f,isLoading:j,isLoadingMore:E,searchValue:s,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{f&&h!=null&&t(He({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function pe(t,e=!1){const n=L(),i=C((c=>K(c).productNextCursor!=null)),s=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(se({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&s!=null&&n(se({cursor:s,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,s])}function Se(t,e,n,i){const[s,o]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),o((v=>v+1)))}),[c,e]),s}const Fo=new Set(["plan"]),wo=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?s=>{i!==""&&t(gn({action:s,id:i}))}:void 0,onEditChange:s=>{i!==""&&t(Pe({id:i,localData:s}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(un({id:i}))},onSubFamilyLifecycleAction:(s,o)=>{i!==""&&t(Kt({action:o,id:s,parentItemId:i}))}}}))(it);function Ro(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=(d=s.get("kind"))!=null&&Fo.has(d)?d:"plan";var d;const l=C((k=>Ae(k,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(ce({id:n})),()=>{t(ce({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(ye({id:n,kind:c}))}),[o,n,c,t]);const g=r.useCallback((k=>t(ye({cacheOverride:!0,id:k,kind:c}))),[t,c]),f=Se(l.fetchState,l.isFormLoading,n,g),S=u==="Completed"&&!l.isFormLoading;pe(o,!0);const[h,D]=r.useState(S?n:void 0);r.useEffect((()=>{n!=null&&S&&D(n)}),[n,S]);const b=h!==n&&(u==="Not-Started"||u==="In-Progress"||l.isFormLoading);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:S}),a.jsx(wo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:b,view:l},f)]})}const _o=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=Ae(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:s}=e,o=s!=null?`${n}/catalog/${encodeURIComponent(s)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(ce({id:s})),e.navigate(`${n}/catalog`)},onChange:c=>{t(Pe({id:s,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(un({id:s}))}}}))(ot);function Mo(){const t=L(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[s]=G(),{areTenantIdsInSync:o}=_(),c=n!=null,d=s.get("type"),l=d!=null&&_o.has(d)?d:void 0,v=(u=s.get("kind"))!=null&&To.has(u)?u:"plan";var u;const g=C((f=>Ae(f,n)));return pe(o,!0),r.useEffect((()=>{o&&t(ye({id:n,kind:v}))}),[o,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(Pe({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const f=g.savedItemId??n,S=f!=null?`/${i}/invoicing/catalog/${encodeURIComponent(f)}`:`/${i}/invoicing/catalog`;e(S),t(ce({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),a.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",s=e.activeTab==="all",o=i?n.plans:s?[...n.plans,...n.products]:n.products,c=i||s&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:s&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",s=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=No[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(gn({action:Gt(d),id:c}))},onLoadMore:()=>{if(s)return e.planNextCursor!=null&&t(ze({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(se({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?ze({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):se({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(at);function Bo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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]),D=r.useMemo((()=>({search:S,type:"addon|charge"})),[S]),b=C((P=>K(P))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",F=b.runningActionId??null;return r.useEffect((()=>{const P=setTimeout((()=>v(s)),300);return()=>clearTimeout(P)}),[s]),r.useEffect((()=>{i&&t(qe({cacheOverride:!1,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[i,t,h,D,f]),r.useEffect((()=>{i&&(S!==k||f?.field!==y?.field||f?.dir!==y?.dir)&&t(qe({cacheOverride:!0,planFilters:h,productFilters:D,planSort:f,productSort:f}))}),[k,y,i,t,h,D,S,f]),N(b.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),a.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:s,sortState:u,planFilters:h,productFilters:D,sort:f,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:F,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Vo=O((function(t,e){const n=mn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(re({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(Wt({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:s}),t(Zt({id:i}))}}}))(st);function Ho(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,savedCouponId:c}=C((d=>mn(d,n)));return r.useEffect((()=>{s&&t(xe({id:n}))}),[s,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(re({id:n}))}}),[o,c,n,t,e,i]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCouponFormPage}),a.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=vn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:s=>{e(Sn(s))},onSubmit:()=>{const s=Yt(t.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:s.customer_id,lineItemCount:s.line_items?.length}),e(ei(s))}}}))(rt);function zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),[i]=G(),{areTenantIdsInSync:s}=_(),o=i.get("customerId"),c=C((I=>vn(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(pn),g=C((I=>Xt(I))),f=C(ve),S=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,D=S||h,b=g.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(t(Qe()),()=>{t(Qe())})),[t]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,t(Sn({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{s&&t(Jt({cacheOverride:!1}))}),[s,t]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(j)}}),[d,v,e,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),D?a.jsx(ct,{}):a.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const Qo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(lt);function Ko(){const t=L(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>ni(d,n??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&n!=null&&t(ti({id:n}))}),[s,n,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),a.jsx(Qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=fn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(dt);function Zo(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,creditNoteListFetchState:b}=C((y=>{const I=fn(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(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Ke({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ke({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),a.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ii(y)),onSortChange:v})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:s=>{t(be({id:i,localData:s}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(X(le)),t(gi({id:i}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",le,i),o=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:s=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(be({id:i,localData:s})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:s=>t(ui({cacheOverride:s,customerId:i})),onSendPaymentLink:(s,o,c)=>t(di({body:c,customerId:i,email:s,subject:o})),onSubscriptionClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)}}}))(mt);function Xo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((T=>$e(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[v,u]=r.useState(!1),[g,f]=r.useState(!1),[S,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const D=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 T=c.record.sendLinkState.fetchState;E.current!=="Error"&&T==="Error"&&t(ai({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=T}),[t,c.record.sendLinkState.fetchState]);const F=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ee()),t(ne()),()=>{t(ee()),t(ne())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(si({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&j&&t(Ge({customerId:i}))}),[o,i,t,j]);const P=r.useCallback((T=>t(hn({id:T}))),[t]),U=Se(c.fetchState,c.isFormLoading,i,P);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),a.jsx(Wo,{customerId:i??"",editView:c,hasLoadedRecord:D,location:n,navigate:e,tenantEmailDomain:s,onAddPaymentMethod:()=>{t(ee()),i!=null&&j&&t(Ge({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ne()),f(!0)}},U),a.jsx(ut,{errorMessage:F,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&t(ri({customerId:i}))},onClose:()=>{u(!1),t(ee())},onSavePaymentMethod:T=>{i!=null&&t(ci({customerId:i,data:T}))}}),a.jsx(gt,{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),t(ne())},onSubmit:({amount:T,description:Y})=>{i!=null&&t(li({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:Y}))}})]})}const Jo=O((function(t,e){const n=$e(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,s=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(Cn({id:i})),t(X(le)),e.navigate(`${n}/customers`)},onChange:c=>{t(be({id:i,localData:c}))},onOpenAddress:()=>{const c=Qn(e.tenantEmailDomain??"",le,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:s}),t(In({id:i}))}}}))(vt);function Yo(){const t=L(),e=A(),n=Z(),{customer_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),{fetchState:c,savedCustomerId:d}=C((l=>$e(l,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${s}/invoicing/customers/${encodeURIComponent(l)}`:`/${s}/invoicing/customers`;e(v),t(Cn({id:i}))}}),[c,d,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomerFormPage}),a.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:s})]})}const ea=O((function(t){const e=ve(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,s)=>{switch(s){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(En({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function na(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,customerListFetchState:b}=C((y=>{const I=ve(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ze({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),a.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(mi(y)),onSortChange:v})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{filters:n,sessionId:i,view:s}=e,o=i==null?void 0:s.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:n,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Le(s,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:s,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Le(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",f=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>s(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&t(De({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&t(we(o))},onRollback:f?()=>{o!=null&&t(kn(o))}:void 0}}))(St);function ia(){const t=L(),e=A(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),[o,c]=r.useState({}),d=C(Fe),l=Le(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{s&&n!=null&&t(je(n))}),[s,t,n]),r.useEffect((()=>{if(!s||n==null)return;const S=setTimeout((()=>{t(De({...o,sessionId:n}))}),300);return()=>clearTimeout(S)}),[s,t,o,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!s||n==null||!u)return;const S=setInterval((()=>{t(je(n)),t(De({...o,sessionId:n}))}),3e3);return()=>clearInterval(S)}),[s,t,o,u,n]);const g=r.useMemo((()=>{if(n==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`${ae?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),f=v?.fetch.fetchState??"Not-Started";return N(f)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&f!=="Not-Started"}),a.jsx(ta,{downloadUrl:g,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Kn=t=>`invoicing_active_migration:${t}`,oe=(t,e)=>{if(t!=null&&t!=="")try{const n=Kn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:s,statusRows:o}=e.view;return{isLoading:!(s.fetchState!=="Not-Started"&&s.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,s=o=>{const c=o??null;t(ie(c)),oe(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),s(o)},onNewImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),s()},onRetrySession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(we(o)),s(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(ft);function aa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(Fe);r.useEffect((()=>{i&&(t(vi()),t(yn()))}),[i,t]);const o=s.statusFetch.fetchState==="Completed"&&s.sessionsFetch.fetchState==="Completed";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),a.jsx(oa,{navigate:e,tenantEmailDomain:n,view:s})]})}const sa=O((function(t,e){const{activeId:n,integrationsView:i,settings:s,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:s?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:s?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:s}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=ae?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(fi())},onGoToIntegrations:()=>{i(`/${s}/invoicing/settings`)},onGoToOverview:()=>i(`/${s}/invoicing/overview`),onRetry:()=>{n!=null&&t(we(n))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(Si(n))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(pi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${s}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ht);function ca(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),s=C(pn),o=C(Re).companyId??ke.getSignedInUserTenant(n??"")?.companyId,c=C((S=>xn(S,o))),d=C(Fe),{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&&(t(_e()),t(yn()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const S=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Kn(h))}catch{return null}})(n);S!=null&&t(ie(S))}),[l,t,n]),r.useEffect((()=>{oe(n,l)}),[l,n]);const g=u?.status,f=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!f)return;const S=setInterval((()=>{t(je(v))}),3e3);return()=>clearInterval(S)}),[i,v,f,t]),r.useEffect((()=>{g==="done"&&(t(ie(null)),oe(n,null))}),[t,g,n]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDataImportMigratePage}),a.jsx(sa,{activeId:v,integrationsView:c,navigate:e,settings:s,tenantEmailDomain:n,view:d,onBack:()=>{t(ie(null)),oe(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ra=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:s=>{t(bn({action:s,id:i}))},onSaveEdit:s=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(Ii({data:s,id:i}))}}}))(It);function la(){const t=L(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((h=>hi(h,n))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(re({id:n})),()=>{t(re({id:n}))})),[n,t]),r.useEffect((()=>{s&&t(xe({id:n}))}),[s,n,t]);const f=r.useCallback((h=>t(xe({cacheOverride:!0,id:h}))),[t]),S=Se(o.fetchState,o.isFormLoading,n,f);return N(d)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),a.jsx(ra,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const da=O((function(t){const e=jn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,s)=>{t(bn({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Ei({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ct);function ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=jn(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(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(We({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),a.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>t(Ci(I)),onSortChange:v})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,s=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCancel:s?()=>t(q({action:"cancel",id:i})):void 0,onResolve:s?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:s?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:s?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(kt);function ma(){const t=L(),e=A(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((E=>ki(E,n??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[f,S]=r.useState(),[h,D]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),S(void 0),D(!1)}),[]),k=r.useCallback((()=>{if(n==null)return;t(yi({id:n})),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}),D(!0)}),[n,t,o.emailPreview.preview]),y=r.useCallback((E=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:E,id:n})))}),[n,t,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{s&&n!=null&&t(xi({id:n}))}),[s,n,t]),r.useEffect((()=>{s&&d!=null&&t(Te({invoiceId:d}))}),[s,d,t]),r.useEffect((()=>{v("idle"),g(!1),S(void 0),D(!1)}),[n]),r.useEffect((()=>{s||(v("idle"),g(!1),S(void 0),D(!1))}),[s]),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"?(n!=null&&t(bi({id:n})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,b,t,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),a.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:j,onSendEmail:k}),a.jsx(Et,{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 va=O((function(t){const e=Dn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{s!=="retry"&&s!=="resume"&&s!=="resolve"&&s!=="cancel"||t(q({action:s,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(yt);function pa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,dunningCaseListFetchState:b}=C((y=>{const I=Dn(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(s)),300);return()=>clearTimeout(y)}),[s]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),a.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onStatusChange:y=>t(ji(y)),onSortChange:v})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Ai({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
+ `).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))}}}))(xt);function fa(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=C((g=>Ln(g,n??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;return r.useEffect((()=>{s&&n!=null&&t(Li({invoiceId:n}))}),[s,n,t]),N(c)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const ha=O((function(t){const e=An(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,s)=>{switch(s){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,s)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:s}))},onLoadMore:()=>{e.nextCursor!=null&&t(Pn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function Ia(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=An(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(s)),300);return()=>clearTimeout(I)}),[s]),r.useEffect((()=>{i&&t(Ie({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ie({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),a.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{t(Pi(I)),t(Ie({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function an(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=jt(),s=ln(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C($n),v=$i(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=f=>{c(f)};return l==="completed"?a.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?a.jsx(B,{to:`${u}/settings`,replace:!0}):a.jsxs(a.Fragment,{children:[a.jsx(Po,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),a.jsx(Dt,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:s("invoicing_promo"),onAcceptClick:()=>{t(Fi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Ca=O((function(t,e){const n=Fn(t,e.invoiceId),{invoice:i,localData:s,reasonCodeOptions:o,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:s,reasonCodeOptions:o,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:s=>{t(Oi({localData:s}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ti())}}}))(Lt);function Ea(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((S=>Fn(S,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(wi()),g.current=null}),[t,n]),r.useEffect((()=>{s&&n!=null&&t(Te({invoiceId:n}))}),[s,t,n]),r.useEffect((()=>{c!=null&&n!=null&&o==="Completed"&&g.current!==n&&(g.current=n,t(Ri({localData:_i(c)})))}),[t,o,c,n]);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]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),a.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ka=O((function(t){return{invoicingOverview:wn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Rn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(At);function ya(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>wn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Rn(s))}),[i,t,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),a.jsx(ka,{navigate:e,selectedPeriod:s,tenantEmailDomain:n})]})}const xa=O((function(t){const e=_n(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Pt);function ba(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,transactionListFetchState:b,transactions:k}=C((F=>{const P=_n(F);return{activeType:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,transactionListFetchState:P.fetchState,transactions:P.transactions}}),H),y=b==="Completed",I=`/${n}/invoicing`,j=r.useCallback((F=>{const P=k.find((T=>T.id===F)),U=P?.linkedInvoices?.[0]?.invoiceID??P?.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((F=>{const P=k.find((U=>U.id===F))?.customerID;P!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:P,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(P)}`))}),[e,I,k]);return r.useEffect((()=>{const F=setTimeout((()=>d(s)),300);return()=>clearTimeout(F)}),[s]),r.useEffect((()=>{i&&t(Ce({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ce({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),a.jsx(xa,{navigate:e,tenantEmailDomain:n,activeType:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,onSearchChange:o,onTypeChange:F=>{t(Mi(F)),t(Ce({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const ja=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function sn(){const t=L(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:s}=_(),o=n!=null&&n!=="",c=C(ve),d=C((E=>Ui(E))),l=C(Bi),v=C((E=>Ln(E,n??""))),u=v.invoice,g=`/${i}/invoicing`,f=r.useRef(null),S=r.useRef("");r.useEffect((()=>{t(Vi()),f.current=null,S.current=""}),[t,n]),r.useEffect((()=>{s&&t(o&&n!=null?Te({invoiceId:n}):En({filters:{},keepExistingListItems:!1}))}),[s,t,n,o]),r.useEffect((()=>{o&&u!=null&&n!=null&&v.fetchState==="Completed"&&f.current!==n&&(f.current=n,t(Hi({contextInvoiceId:n,localData:qi(u)})))}),[t,u,n,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==S.current&&(S.current=E,t(Pn({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(Je({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[t,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const D=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:ja(E)})))),[c.customers]),b=C((E=>zi(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(F=E.amountDue,P=Qi.currencySymbol,wt("0,0.00",F,P)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var F,P}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",F=u.amountDue?.amount??0;return{amountDue:$t("0,0.00",u.amountDue),amountDueValue:F,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),a.jsx(Ft,{customers:D,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{t(Je({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Ki(o?n??void 0:void 0))}})]})}const Gn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Da=O((function(t,e){const{editView:n}=e,i=n.subscription,s=i?.status,o=s!=null&&e.commercialEditAllowedFromStatuses.includes(s);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(On({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(de({id:i,localData:c}))},onChangeTermEnd:s?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(X(ue)),t(Wi({id:i}))},onOpenAddress:()=>{const c=Gn(e.tenantEmailDomain??"",ue,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(de({id:i,localData:c})),t(Tn({id:i}))},onCancelSubscription:s?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:s?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Rt);function La(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),{areTenantIdsInSync:o}=_(),c=C((k=>Oe(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed"&&!c.isFormLoading,[f,S]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&S(i)}),[i,g]);const h=f===i;pe(o),r.useEffect((()=>{o&&i!=null&&t(Gi({id:i}))}),[o,i,t]);const D=r.useCallback((k=>t(Zi({id:k}))),[t]),b=Se(c.fetchState,c.isFormLoading,i,D);return N(u)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),a.jsx(Da,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:s},b)]})}const Aa=O((function(t,e){const n=Oe(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,s=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Mn({id:i})),t(X(ue)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(de({id:i,localData:o}))},onOpenAddress:()=>{const o=Gn(e.tenantEmailDomain??"",ue,i),c=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:s}),t(Tn({id:i}))}}}))(_t);function Pa(){const t=L(),e=A(),n=Z(),{subscription_id:i,tenantEmailDomain:s}=R(),[o]=G(),{areTenantIdsInSync:c}=_(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((f=>Xi(f,i))),u=C((f=>Oe(f,i).localData));pe(c),r.useEffect((()=>{c&&t(Ji({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(de({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const f=v??i,S=f!=null?`/${s}/invoicing/subscriptions/${encodeURIComponent(f)}`:`/${s}/invoicing/subscriptions`;e(S),t(Mn({id:i}))}}),[l,v,i,t,e,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),a.jsx(Aa,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:s})]})}const $a=O((function(t){const e=Nn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(s,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:s}),t(On({action:o,id:s,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(s,o)=>{const c=o?.trim()??"";c!==""&&i(s,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(s,o,c)=>{o!=="pause"?i(s,o):i(s,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(s,o)=>{i(s,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:s}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(no({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tt);function Fa(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[s,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:D,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Nn(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(s)),300);return()=>clearTimeout(j)}),[s]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ye({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,S,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&t(Yi())}),[k,i,t]),N(b)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),a.jsx($a,{navigate:e,tenantEmailDomain:n,activeStatus:f,searchValue:s,sortState:l,filters:g,sort:u,nextCursor:D,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>t(eo(j)),onSortChange:v})]})}const wa=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onInvoiceClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:s,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(s)}`)},onSubscriptionClick:s=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(oo({action:"capture",id:i}))}:void 0}}))(Ot);function Ra(){const t=L(),e=A(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:s}=_(),o=C((d=>to(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{s&&i!=null&&t(io({id:i}))}),[s,i,t]),N(o.fetchState)?a.jsx(M,{}):a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),a.jsx(wa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Zn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:s=!1}=t,o=L(),{areTenantIdsInSync:c}=_(),d=C(Me),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(s&&v!=="Not-Started"||o(Un()),n&&o(ao()))}),[c,o,e,n,s]),r.useEffect((()=>{e&&c&&l&&i&&o(so())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const _a={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function J(t){const e=L(),{areTenantIdsInSync:n}=_(),{tenantEmailDomain:i}=R(),{fetchState:s,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(co),{configError:u,configFetchState:g,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D}=C(Bn),b=C(Me);Zn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Re),y=t==="dunning"||t==="quickbooks",I=k.companyId??ke.getSignedInUserTenant(i??"")?.companyId,j=C((w=>xn(w,I))),E=ro(k.userRole??[]),F=k.tenantId??"",P=ke.getSignedInUser(),U={userId:P?.userId??"",sessionId:P?.zeniSessionId??"",tenantId:F},T=c?.fileId,Y=C((w=>T!=null&&T!==""?lo(w,T):void 0)),Ne=C((w=>T!=null&&T!==""?uo(w,T):void 0)),Wn=T!=null&&T!==""&&Y!=null?{[T]:Y}:{},Xn=T!=null&&T!==""&&Ne!=null?{[T]:Ne}:{};r.useEffect((()=>(e(en()),()=>{e(en())})),[e]),r.useEffect((()=>{n&&(s!=="Not-Started"&&s!=="Error"||e(_e()))}),[n,e,s]),r.useEffect((()=>{n&&y&&g==="Not-Started"&&e(ge())}),[n,e,g,y]),r.useEffect((()=>{if(!n)return;const w=P?.userId;w!=null&&w!==""&&F!==""&&Ve.shouldFetchActiveTenant(F)&&(Ve.markActiveTenantFetchStarted(F),e(go(w,F,P?.zeniSessionId)))}),[n,e,P?.userId,P?.zeniSessionId,F]);const Jn=f.length>0||S.length>0,Yn=s==="Not-Started"||s==="In-Progress"&&l==null||y&&!Jn&&(g==="Not-Started"||g==="In-Progress"),et=s==="Completed"&&(!y||g==="Completed"),Ue=j.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,fe=ae?.invoicingMicroServiceBaseUrl,Be=fe!=null&&fe.length>0?`${fe}/1.0/webhooks/stripe`:"",he={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:w=>e(tn(w)),onDisconnect:(w,z)=>{F!==""&&e(Io(F,w,on(z)))},onDisconnectStripe:()=>e(nn()),onReconnectQBO:()=>{const w=k.tenantEmailDomain??i??"";me.init("/connection/auth",w),me.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(qn())},onSaveChargeBeeCredentials:(w,z)=>{Ue!=null&&F!==""&&e(fo(F,Ue,on("revenue"),ho("chargebee"),{api_key:w,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:Be};return{authParams:U,deleteFileStatusById:Wn,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:ae?.fileMicroServiceBaseUrl??"",integrationsSectionProps:he,isInvoicingPageReady:et,isLoading:Yn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:D,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Be,updateFileStatusById:Xn,onConnectStripe:w=>e(tn(w)),onDeleteFile:w=>e(So(w,F)),onDisconnectStripe:()=>e(nn()),onEditFileName:(w,z)=>e(po(w,z.split(".")[0],F)),onReconnectQBO:he.onReconnectQBO,onRefreshQBO:he.onRefreshQBO,onRetryQboSyncTask:w=>e(Hn(w)),onSave:w=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(vo({settings:w,snackbarSection:_a[t??""]}))},onStartQboBackfill:w=>e(Vn(w)),updateFilesEntity:w=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(mo({files:w}))}}}function cn({appContent:t}){const e=A(),n=Z(),i=L(),{tenantEmailDomain:s}=R(),o=J("branding"),c=C((v=>Co(v))),d=C((v=>Eo(Ee,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(ko()),i(X(Ee)))}),[c.saveState.fetchState,i]);const l=dn(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Mt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(xo({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${s}/invoicing/settings/branding/${Ee}/`,u=W(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(yo()),updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=A(),e=J("dunning");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Nt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=A(),e=J("integrations");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Ut,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=A(),e=J("payment-destination");return a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),a.jsx(Bt,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const Na=O((function(t){const e=zn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(Do({localData:e}))},onReset:()=>{t(jo())},onRetryTask:e=>{t(Hn(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(bo())},onStartBackfill:e=>{t(Vn(e))}}}))(Vt);function Ua(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),i=C(Re),{configFetchState:s,settingsFetchState:o}=C(zn);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||t(_e())}),[t,o]),r.useEffect((()=>{s==="Not-Started"&&t(ge())}),[s,t]),Zn({fetchSyncHealth:!0,loadAccountingPickers:!0}),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage}),a.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{me.init("/connection/auth",i.tenantEmailDomain??n??""),me.handleClick()},onRefresh:()=>t(qn())})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=ln(),e=L(),n=A(),[i,s]=G(),o=J(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Bn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const f=Ba[g];s({},{replace:!0}),f!=null&&n(f,{replace:!0})}),[g,n,s]),a.jsxs(a.Fragment,{children:[a.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),a.jsx(Ht,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Lo())}})]})}function rn(){return a.jsxs(te,{children:[a.jsx(x,{index:!0,element:a.jsx(Va,{})}),a.jsx(x,{path:"payment-destination",element:a.jsx(Ma,{})}),a.jsx(x,{path:"branding",element:a.jsx(cn,{})}),a.jsx(x,{path:"branding/:addressType",element:a.jsx(cn,{appContent:a.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),a.jsx(x,{path:"integrations",element:a.jsx(Oa,{})}),a.jsx(x,{path:"dunning",element:a.jsx(Ta,{})}),a.jsx(x,{path:"quickbooks",element:a.jsx(Ua,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:"..",replace:!0})})]})}function Ss(){const t=L(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),{enableState:s,fetchState:o,status:c}=C($n),d=dn(s.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=C((g=>Me(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,t(ge({cacheOverride:!1}))):t(ge({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&u==="Not-Started"&&t(Un())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&s.fetchState==="Completed"&&(e(`${l}/catalog`),t(Ao()))}),[d,s.fetchState,l,t,e]),c==null&&o!=="Error"?a.jsx(qt,{fetchState:"In-Progress"}):c==="not_started"?a.jsxs(te,{children:[a.jsx(x,{path:"promo",element:a.jsx(an,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?a.jsxs(te,{children:[a.jsx(x,{path:"promo",element:a.jsx(an,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(rn,{})}),a.jsx(x,{path:"*",element:a.jsx(B,{to:`${l}/settings`,replace:!0})})]}):a.jsxs(te,{children:[a.jsx(x,{path:"/",element:a.jsx(B,{to:"overview",replace:!0})}),a.jsx(x,{path:"overview",element:a.jsx(ya,{})}),a.jsx(x,{path:"promo",element:a.jsx(B,{to:`${l}/overview`,replace:!0})}),a.jsx(x,{path:"customers",element:a.jsx(na,{})}),a.jsx(x,{path:"customers/new",element:a.jsx(Yo,{})}),a.jsx(x,{path:"customers/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"customers/:customer_id",element:a.jsx(Xo,{})}),a.jsx(x,{path:"customers/:customer_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions",element:a.jsx(Fa,{})}),a.jsx(x,{path:"subscriptions/new",element:a.jsx(Pa,{})}),a.jsx(x,{path:"subscriptions/new/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"subscriptions/:subscription_id",element:a.jsx(La,{})}),a.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:a.jsx(Q,{})}),a.jsx(x,{path:"invoices",element:a.jsx(Ia,{})}),a.jsx(x,{path:"invoices/create",element:a.jsx(zo,{})}),a.jsx(x,{path:"invoices/:invoice_id",element:a.jsx(fa,{})}),a.jsx(x,{path:"invoices/:invoice_id/record-payment",element:a.jsx(sn,{})}),a.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:a.jsx(Ea,{})}),a.jsx(x,{path:"payments",element:a.jsx(ba,{})}),a.jsx(x,{path:"payments/record",element:a.jsx(sn,{})}),a.jsx(x,{path:"payments/:transaction_id",element:a.jsx(Ra,{})}),a.jsx(x,{path:"credits",element:a.jsx(Zo,{})}),a.jsx(x,{path:"credits/:credit_note_id",element:a.jsx(Ko,{})}),a.jsx(x,{path:"discounts",element:a.jsx(ua,{})}),a.jsx(x,{path:"discounts/new",element:a.jsx(Ho,{})}),a.jsx(x,{path:"discounts/:coupon_id",element:a.jsx(la,{})}),a.jsx(x,{path:"dunning",element:a.jsx(pa,{})}),a.jsx(x,{path:"dunning/:case_id",element:a.jsx(ma,{})}),a.jsx(x,{path:"catalog",element:a.jsx(Bo,{})}),a.jsx(x,{path:"catalog/new",element:a.jsx(Mo,{})}),a.jsx(x,{path:"catalog/:item_id",element:a.jsx(Ro,{})}),a.jsx(x,{path:"settings/*",element:a.jsx(rn,{})}),a.jsx(x,{path:"audit_log",element:a.jsx($o,{})}),a.jsx(x,{path:"data_import",element:a.jsx(aa,{})}),a.jsx(x,{path:"data_import/migrate",element:a.jsx(ca,{})}),a.jsx(x,{path:"data_import/:sessionId",element:a.jsx(ia,{})}),a.jsx(x,{path:"*",element:a.jsx(M,{})})]})}export{Ss as default};
@@ -0,0 +1,72 @@
1
+ import{j as t}from"./liveblocks-DVkNRe2z.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-vR5k5yHJ.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-BmF1nplD.js";import{a2 as x,H as r,a3 as de,k as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,o as ue,S as he,a7 as ge,O as xe,E as fe,e as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-1ujiYIu0.js";import{n as m}from"./mui-Bf4yQzNc.js";import f from"./NotFoundScreen-D_hX2Dzv.js";import{a as I}from"./sentry-BcU4ynZK.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b542e5ff-f569-4c94-ab05-47235204c79f",e._sentryDebugIdIdentifier="sentry-dbid-b542e5ff-f569-4c94-ab05-47235204c79f")}catch{}})();const Ie=m.div`
2
+ display: flex;
3
+ height: 100%;
4
+ width: 100%;
5
+ flex: 1 1 auto;
6
+ flex-direction: column;
7
+ align-items: center;
8
+ background-color: ${e=>e.theme.colors.grey4};
9
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
+ `,Ce=g((function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
11
+ display: flex;
12
+ height: 100vh;
13
+ width: 100%;
14
+ flex: 1 1 auto;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ background-color: ${e=>e.theme.colors.grey4};
18
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
+ `,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
20
+ display: flex;
21
+ height: 100%;
22
+ width: 100%;
23
+ flex: 1 1 auto;
24
+ flex-direction: column;
25
+ align-items: center;
26
+ background-color: ${e=>e.theme.colors.grey4};
27
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
+ `,Ne=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Le,{windowSize:n,children:t.jsx(Ne,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
+ display: flex;
30
+ height: 100%;
31
+ width: 100%;
32
+ flex: 1 1 auto;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ background-color: ${e=>e.theme.colors.grey4};
36
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
+ `,Te=g((function(e){const a=k(e),n=v(e),o=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=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Je=m(ke)`
38
+ width: ${r.sp4};
39
+ height: ${r.sp4};
40
+ margin-bottom: ${r.sp3};
41
+ margin-top: ${r.sp3};
42
+ margin-left: ${r.sp8};
43
+ cursor: pointer;
44
+ position: absolute;
45
+ color: ${e=>e.theme.colors.brandColorJade};
46
+ `,Me=m.div`
47
+ display: flex;
48
+ height: 100vh;
49
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
+ width: 100vw;
51
+ overflow-y: scroll;
52
+ background-color: ${e=>e.theme.colors.grey4};
53
+ `,He=m.div`
54
+ display: flex;
55
+ flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
+ flex-direction: column;
57
+ width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
+ ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
+ box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
+ padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
61
+ `,Ve=m.div`
62
+ display: flex;
63
+ flex-direction: column;
64
+ align-items: center;
65
+ justify-content: center;
66
+ padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
67
+ height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
+ overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
+ width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
+ background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
+ margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
+ `,_e=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),M=n.pathname.includes("address"),w=x(),H=xe(),A=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:O,billFetchState:P,companyName:q,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:L,sessionId:N}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[b,c,i,o,d,a]),I.useEffect((()=>{b&&c==="Completed"&&($(L,N,z),l!=null&&a(re(l)))}),[c,b,L,N,z,l,a]),c==="Error"?t.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",q,l??"",Ke(n.pathname),Q,R))(u)}),t.jsxs(Me,{windowSize:w,children:[w!=="small"?t.jsx(Je,{onClick:V}):null,t.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:O,type:"bill"})}),t.jsx(He,{windowSize:w,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
@@ -0,0 +1,12 @@
1
+ import{j as u}from"./liveblocks-DVkNRe2z.js";import{a as g}from"./sentry-BcU4ynZK.js";import{u as O,g as _,h as w,t as V,j as l,N as L}from"./core-vR5k5yHJ.js";import{z as r,E as M,G as P,U as A,k as N,V as $,$ as q,a0 as G,Y as R}from"./index-1ujiYIu0.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-BmF1nplD.js";import{n as ne}from"./mui-Bf4yQzNc.js";import{u as se}from"./useDeviceId-D80AOehv.js";import{f as ae}from"./analyticsHelper-1gGrcOYN.js";import{t as ie}from"./getLocaleForTenant-DlNsSiyY.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="61d49e01-f580-4606-8e7e-75decca31fbc",t._sentryDebugIdIdentifier="sentry-dbid-61d49e01-f580-4606-8e7e-75decca31fbc")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),m=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>Y(e))),D=r.getSignedInUser(),v=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{m("/signin/auth")}),[m]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ z-index: 9999;
11
+ background-color: ${t=>t.theme.colors.background};
12
+ `;export{Te as default};
@@ -0,0 +1 @@
1
+ import{j as _}from"./liveblocks-DVkNRe2z.js";import{a as f}from"./sentry-BcU4ynZK.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-vR5k5yHJ.js";import{fF as ne,T_ as Ue,T$ as se,g9 as xe,fE as Ne,U8 as Pe,U1 as Re,U2 as Ve,p$ as Oe,gm as Le,U5 as h,Ua as je,Ub as K,gn as Ze,Uc as ze,Eb as qe,h1 as He,cV as Ye,Ud as Qe,g8 as We,go as Je}from"./zeni-epic-state-BmF1nplD.js";import{w as Ke,i as Xe,O as ea,o as aa,c as ta,e as na,u as sa,S as c,f as oa,Q as ia,z as ra,d as da,l as ca,N as la,r as ua,n as fa,q as X,L as ma,C as ba,D as ha,p as g,k as ee,x as pa,I as ae,A as Sa,B as ga}from"./index-1ujiYIu0.js";import{D as Ea}from"./mui-Bf4yQzNc.js";import{u as ka}from"./InboxNotificationsProvider-C8gkRzEM.js";import{u as Ca}from"./useTaskManagerAccess-DmtbEonm.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]="994bf8b4-2edc-472f-b29c-86d4a830f60a",l._sentryDebugIdIdentifier="sentry-dbid-994bf8b4-2edc-472f-b29c-86d4a830f60a")}catch{}})();const Ta=Ke((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Ne(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,M]=f.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,U=F("/:tenantEmailDomain/reports")!==null,m=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),N=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(e)));f.useEffect((()=>{C&&T&&!m&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[C,T,v.fetchState,m]);const D=t((e=>e.tenantState)),fe=t((e=>D.fetchState==="Completed"?Le(e):[])),S=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:me}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:be}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:he}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>h(e).totalUnreadCount)),Ce=t((e=>h(e).reducedFetchCountState)),R=t((e=>h(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>h(e).notificationDetailsByTab.comments.uiState.unreadCount)),O=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();f.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),f.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;M(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),f.useEffect((()=>{C&&k&&!m&&O.fetchState==="Not-Started"&&B.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,k,m,O.fetchState,B.tenantId,r]),f.useEffect((()=>{m||I.fetchState!=="Not-Started"||r(K({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[m,I.fetchState,r]),f.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:Ce,count:ke},q=s!=null?ra.getSignedInUserTenant(s):null,H=t((e=>q?.tenantId!=null?Ze(e,q.tenantId):void 0)),b=[];me===!1&&b.push("accounts_payable_aging"),be===!1&&b.push("accounts_receivable_aging"),b.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&b.push("rewards_card"),P===!1&&b.push("expense_automation_card");const Y=t((e=>ze(e,b).fetchState)),Q=t((e=>qe(e).fetchState)),ye=A&&(Y==="Completed"||Y==="Error")||U&&(Q==="Completed"||Q==="Error")||!A&&!U?void 0:"disabled",we=f.useMemo((()=>He(o.userRole)),[o.userRole]),Ae=Ye(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&N.fetchState==="Completed"&&Qe(N.notificationSettings,p.userEmail,x,o,k),W=da(),Fe=W&&ca(a);return _.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?fe:H!=null?[H]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:fa(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=R===0&&V>0?"notifications/comments":"notifications/tasks";X(a)&&(e=R===0&&V>0?"../../notifications/comments":"../../notifications/tasks");const u=g(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=g(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:g(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=g(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=g(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,_e=ae(J)&&J!=="command_center";if(ae(e.type)&&S[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(S[o.tenantId].month,S[o.tenantId].year,"Sidebar"),_e&&S[o.tenantId]!=null){const y=S[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=Sa(e.type);ga(e.type)?(G!=null&&r(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(ma.TENANT_SWITCHING),i(!1),ba({dispatch:r,navigate:n,pathToNavigate:ha(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:Se,newYearAnimationEnabled:ge})})})),Ba=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Xe(n)&&Ue(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-DVkNRe2z.js";import{h as r,l as n}from"./core-vR5k5yHJ.js";import{an as i}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import"./sentry-BcU4ynZK.js";import"./zeni-epic-state-BmF1nplD.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-DVkNRe2z.js";import ut from"./NotFoundScreen-D_hX2Dzv.js";import{a as k}from"./sentry-BcU4ynZK.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 Y}from"./core-vR5k5yHJ.js";import{cA as It,U1 as J,fF as K,h1 as Tt,U5 as b,a0$ as Q,Ub as m,T$ as y,Ar as j,G8 as Ct,a10 as At,T_ as yt,Ud as Et,Aw as _t,a11 as $,br as F,gh as x,AA as z,a12 as Nt,cM as wt,cF as Bt}from"./zeni-epic-state-BmF1nplD.js";import{ar as xt,c as Ut,o as vt,S as Dt,at as Rt,dL as Gt,p as w,dM as Pt,w as Mt,dN as $t,i as Ft,a5 as jt}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-Daw0Xdbp.js";import{u as Lt}from"./useTaskManagerAccess-DmtbEonm.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.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]="1ab247ee-68d3-4701-961a-8c2e39630cf9",t._sentryDebugIdIdentifier="sentry-dbid-1ab247ee-68d3-4701-961a-8c2e39630cf9")}catch{}})();const Wt=(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=J(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=K(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:v}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(z("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t($([a],F())));let i=`/${h}/${r[1]}`;const T=w(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!wt(g)&&(i="not-found"),r[1].startsWith("bill")&&!Bt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(Q(a,s));const d=`../${a}`,r=w(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(j("task_manager","dashboard",d))}else v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(z("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t($([i],F())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Wt(o,I).then((()=>{t($(o,F())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=jt(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=w(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt($t)),Ht=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=Ut(),[I,v]=k.useState(!1),a=S((e=>J(e))),s=S((e=>K(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Rt({isDataReady:!0});const Z=Tt(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),L=S((e=>b(e).currentTab)),D=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),R=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Gt().allUsers,{inboxNotifications:B,isLoading:E,hasFetchedAll:C,isFetchingMore:G,fetchMore:ot}=mt(),{threads:W,isLoading:q,fetchMore:H,isFetchingMore:O,hasFetchedAll:X}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(Q(c)),c==null){const e=`../${L}`,p=w(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&B!=null){const e=`dashboard_${s.companyId}`,p=B.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(y({unreadCount:p},"comments"))}}),[E,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=E||G===!0||C!==!0||E||G===!0||C!==!0;k.useEffect((()=>{P&&R!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||R!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,R]),k.useEffect((()=>{o(y({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(v(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&q===!1&&B!=null&&W!=null){const e=`dashboard_${s.companyId}`,p=B.filter((u=>u.roomId===e)).filter((u=>Pt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=W.find((dt=>{return dt.id===((U=u).kind==="thread"?U.threadId:"subjectId"in U?U.subjectId:void 0);var U}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(O||X===!0||H==null||H(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,G,O,C,X,q,B?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(Ft(p)){const A=yt(p.mode);if(A==="dashboard"&&o(y({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),o(j("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(Y,{path:"/:selectedTab",element:N.jsx(Ht,{})}),N.jsx(Y,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
@@ -0,0 +1 @@
1
+ import{j as f}from"./liveblocks-DVkNRe2z.js";import{a as r}from"./sentry-BcU4ynZK.js";import{u as j,g as A,j as o,N as C}from"./core-vR5k5yHJ.js";import{UE as P,fF as x,gm as z,UF as D,UG as M,UH as R,UI as F,pS as k,Tj as L}from"./zeni-epic-state-BmF1nplD.js";import{z as h,ai as I}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="e3455a42-91d2-4bba-97a0-8d29f99e4003",n._sentryDebugIdIdentifier="sentry-dbid-e3455a42-91d2-4bba-97a0-8d29f99e4003")}catch{}})();function ee(){const n=j(),a=A(),{params:t,error:i}=r.useMemo((()=>P(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),p=h.isSignedIn(),s=h.getSignedInUser(),m=o((e=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),b=o(M),u=o(R),[S,U]=r.useState(null),[v,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(F())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=S??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:U,approveError:v??b,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(L(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{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:a.pathname+a.search},replace:!0})}export{ee as default};
@@ -0,0 +1 @@
1
+ import{j as n}from"./liveblocks-DVkNRe2z.js";import{h as Z,u as H,g as J,i as Q,j as d,l as X,n as ee,o as C}from"./core-vR5k5yHJ.js";import{fF as w,Ac as U,v5 as ae,Vw as M,v0 as y,bq as te,b$ as se,v1 as oe,Vx as re,Ve as S,ei as ne,E0 as ce,Vy as ie,Eo as le,d_ as de,dZ as me}from"./zeni-epic-state-BmF1nplD.js";import{aj as fe,z as pe,ar as ue,at as he,K as Fe,o as _,S as V,a9 as ge,k as B,aE as be,p as Ie}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import Ce from"./NotFoundScreen-D_hX2Dzv.js";import{F as Se}from"./FeaturePreviewScreen-DLzs5A8g.js";import{a as F}from"./sentry-BcU4ynZK.js";import{u as ye}from"./useAskAiCfoHostNavButtonProps-Daw0Xdbp.js";import{u as Te}from"./useInitialThreadRequest-CujqTgMw.js";import{t as Ae}from"./routePaths-Du4I9ue1.js";import{M as xe}from"./MobileAppDrawer-BdOhYCo5.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./InboxNotificationsProvider-C8gkRzEM.js";import"./useTaskManagerAccess-DmtbEonm.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]="c0448635-f5ba-42ed-a87a-7b75fa49f4be",s._sentryDebugIdIdentifier="sentry-dbid-c0448635-f5ba-42ed-a87a-7b75fa49f4be")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},Ee=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:B}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(M(a,o)),e.isPandLReportFetched(a)||s(y(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=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=Z(),a=H(),o=J(),{forecastId:r,tenantEmailDomain:c}=Q(),[p,u]=F.useState(!1),[m,A]=F.useState(!1),g=pe.getSignedInUser(),x=d((t=>w(t))),N=x.company?.companyInfo.firstMonthOfFY??1,i=d((t=>U(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),E=d((t=>t.profitAndLossState)),D=d((t=>t.reportUIOptionsState.selectedForecast)),j=t=>E.pandLByForecastID[t]!=null&&oe(t,E).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:$,onAskAiCfoClick:q}=ye({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){A(!0);const t=((f,R,O)=>R!=null?f.forecasts.findIndex((I=>I.id===R)):O!=null?f.forecasts.findIndex((I=>I.id===O)):f.forecasts.length>0?0:-1)(i,r,D?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=D?.index?(a(M(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!j(i.forecasts[t].id)&&b&&a(y(i.forecasts[t].id))}}),[p,u,a,l,i,m,A,U,y,b]);const k=Fe(),G=k?.loggedInUserRole!=null&&te(k.loggedInUserRole),{useFeatureGate:Y}=_(),{isFeatureEnabled:L}=Y(V.isReportsCommentingEnabled),W=Te(L?x?.companyId:void 0,{clearParams:l&&m}),[z,K]=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=>{K(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(ge,{analytics:B,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(xe,{isAppContentDrawerOpen:z,handleDrawerToggle:P}),n.jsx(Ee,{firstMonthOfFY:N,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:j,meetingUrl:se(h.toString()),hasTransactionAccess:G,isAiCfoAccessEnabled:$,onAskAiCfoClick:q,isReportsCommentingEnabled:L,initialOpenThreadRequest:W,onClickMenuIcon:()=>{P(!0)}})]})}function He(){const s=d((c=>w(c))),{useFeatureGate:e}=_(),{isFeatureEnabled:a}=e(V.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{He as default};
@@ -1,21 +1,21 @@
1
- import{j as r}from"./liveblocks-CzCs-qU3.js";import{a as p}from"./sentry-CWp8Ph3h.js";import{K as d,M as a,a9 as m,ad as f,ae as h}from"./index-De2R2YuA.js";import"./mui-B2F_PvWe.js";import{i as y}from"./core-BBG4mxvC.js";import"./zeni-epic-state-FRanwwFO.js";import"./recharts-CzGMTm3v.js";import"./analytics-cC2XJoxx.js";import"./plaid-BWZxX3Bn.js";import"./dnd-oIrpOltC.js";import"./stripe-cKAAJElX.js";import"./lottie-ULJlrwjP.js";import"./lexical-BRrdO5Cu.js";import"./pdf-CeVn9A9c.js";import"./utils-u0mlLj2I.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]="494643e4-d3d3-47b9-adb9-bda555527506",e._sentryDebugIdIdentifier="sentry-dbid-494643e4-d3d3-47b9-adb9-bda555527506")}catch{}})();const g=d("div")`
1
+ import{j as r}from"./liveblocks-DVkNRe2z.js";import{a as p}from"./sentry-BcU4ynZK.js";import{F as c,H as a,aa as m,ae as f,af as h}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{i as y}from"./core-vR5k5yHJ.js";import"./zeni-epic-state-BmF1nplD.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.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]="a629afc2-cb2d-4239-93c8-c48b807e180b",e._sentryDebugIdIdentifier="sentry-dbid-a629afc2-cb2d-4239-93c8-c48b807e180b")}catch{}})();const g=c("div")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
5
5
  min-height: 100vh;
6
6
  background-color: ${e=>e.theme.colors.grey4};
7
- `,b=d("header")`
7
+ `,b=c("header")`
8
8
  flex-shrink: 0;
9
9
  padding: ${a.sp3} ${a.sp4};
10
- `,k=d(m)`
10
+ `,k=c(m)`
11
11
  width: ${a.sp4};
12
12
  height: ${a.sp4};
13
13
  color: ${e=>e.theme.colors.brandColorJade};
14
- `,x=d("main")`
14
+ `,x=c("main")`
15
15
  display: flex;
16
16
  flex: 1 1 auto;
17
17
  flex-direction: column;
18
18
  align-items: center;
19
19
  justify-content: center;
20
20
  padding: ${a.sp4};
21
- `;function j({children:e}){return r.jsxs(g,{"data-testid":"invoicing-collect-payment-layout",children:[r.jsx(b,{children:r.jsx(k,{"aria-label":"Zeni",role:"img"})}),r.jsx(x,{children:e})]})}class w extends Error{statusCode;constructor(t,o){super(t),this.name="PortalRequestError",this.statusCode=o}}function $(e,t){const o=(function(){const n=h?.invoicingMicroServiceBaseUrl;return`${n!=null&&n.length>0?n:""}/1.0`})(),s={namespace:e,token:t};async function i(n,u){const l=await fetch(`${o}${n}`,{body:JSON.stringify(u),headers:{"Content-Type":"application/json"},method:"POST"}),c=await l.json();if(!l.ok)throw new w(c.status?.message??`Request failed (${l.status}).`,l.status);return c.data}return{checkoutSession:()=>i("/portal/payment-link/checkout-session",s),plaidLinkToken:()=>i("/portal/payment-link/plaid-link-token",s),requestAccess:()=>i("/portal/payment-link/request-access",s),savePaymentMethod:n=>i("/portal/payment-link/payment-methods",{...s,...n}),session:()=>i("/portal/payment-link/session",s),setupIntent:()=>i("/portal/payment-link/setup-intent",s)}}function B(){const{namespace:e="",token:t=""}=y();p.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]);const o=p.useMemo((()=>$(e,t)),[e,t]);return r.jsx(j,{children:r.jsx(f,{portal:o})})}export{B as default};
21
+ `;function j({children:e}){return r.jsxs(g,{"data-testid":"invoicing-collect-payment-layout",children:[r.jsx(b,{children:r.jsx(k,{"aria-label":"Zeni",role:"img"})}),r.jsx(x,{children:e})]})}class w extends Error{statusCode;constructor(t,o){super(t),this.name="PortalRequestError",this.statusCode=o}}function $(e,t){const o=(function(){const n=h?.invoicingMicroServiceBaseUrl;return`${n!=null&&n.length>0?n:""}/1.0`})(),s={namespace:e,token:t};async function i(n,u){const l=await fetch(`${o}${n}`,{body:JSON.stringify(u),headers:{"Content-Type":"application/json"},method:"POST"}),d=await l.json();if(!l.ok)throw new w(d.status?.message??`Request failed (${l.status}).`,l.status);return d.data}return{checkoutSession:()=>i("/portal/payment-link/checkout-session",s),plaidLinkToken:()=>i("/portal/payment-link/plaid-link-token",s),requestAccess:()=>i("/portal/payment-link/request-access",s),savePaymentMethod:n=>i("/portal/payment-link/payment-methods",{...s,...n}),session:()=>i("/portal/payment-link/session",s),setupIntent:()=>i("/portal/payment-link/setup-intent",s)}}function B(){const{namespace:e="",token:t=""}=y();p.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]);const o=p.useMemo((()=>$(e,t)),[e,t]);return r.jsx(j,{children:r.jsx(f,{portal:o})})}export{B as default};
@@ -0,0 +1,22 @@
1
+ import{j as a}from"./liveblocks-DVkNRe2z.js";import{Vs as re,fF as Y,l$ as G,d_ as N,dZ as le,Sj as Q,UR as de,CX as Pe,Vt as q,CM as je,D5 as Le,C$ as ce,CQ as pe,D3 as ve,D0 as Te,Vu as ue,sq as Ve,g6 as Ae,gD as Fe,Vv as H,CU as me,CT as ge,D8 as Re,c8 as Oe}from"./zeni-epic-state-BmF1nplD.js";import{a2 as fe,o as J,S as _,z as K,f as Ce,X as he,ag as ye,aA as be,aB as Ze,ac as Se,H as R,ah as De,G as W,aC as Ue,ar as Be,at as $e,a9 as ze,k as we,V as He,p as _e,aD as Ge,K as Ke}from"./index-1ujiYIu0.js";import{D as xe,n as M,S as Ie}from"./mui-Bf4yQzNc.js";import ae from"./NotFoundScreen-D_hX2Dzv.js";import{a as d}from"./sentry-BcU4ynZK.js";import{u as ee,i as We,j as g,h as Me,g as Xe,l as qe,n as se,o as z}from"./core-vR5k5yHJ.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Daw0Xdbp.js";import{M as Ne}from"./MobileAppDrawer-BdOhYCo5.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./InboxNotificationsProvider-C8gkRzEM.js";import"./useTaskManagerAccess-DmtbEonm.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]="abdeb8c9-ee05-46f0-8ad9-7e0618979de5",e._sentryDebugIdIdentifier="sentry-dbid-abdeb8c9-ee05-46f0-8ad9-7e0618979de5")}catch{}})();const Qe={overlayWidth:new Se(100,100,48)},te=W.getLocalizedStrings().peoplePage.invitePage,ne=W.getLocalizedStrings().common,Je=({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:D}=We(),r=g((l=>re(l))),p=g((l=>Y(l))),E=g((l=>G(l))),{useFeatureGate:x}=J(),{isFeatureEnabled:I}=x(_.isDebitCardFeatureEnabled),P=N(I,p),v=le(p),T=Q(p),U=de(p),B=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,w=!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(q()),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:T,isAccountingClassesEnabled:E,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isLiteRoleDisabled:U===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:v,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(T))},onCloseClick:V,isLoading:w||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return d.useEffect((()=>{w===!1&&D!=null&&m(Pe(D))}),[w,D]),d.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:Qe.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=M(Ie)`
2
+ display: flex;
3
+ min-height: 100%;
4
+ flex-direction: column;
5
+ `,ke=M(De.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=M(De.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=W.getLocalizedStrings().peoplePage.invitePage,ie=W.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),D=g((o=>re(o))),r=g((o=>Y(o))),p=g((o=>G(o))),{useFeatureGate:E}=J(),{isFeatureEnabled:x}=E(_.isDebitCardFeatureEnabled),I=N(x,r),P=le(r),v=Q(r),T=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 w=()=>{b(),m(q())},h=()=>{O===!0?S(!0):w()},V={onOkClick:()=>{S(!1),w()},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:v,onPeopleLocalDataUpdated:o=>{m(ce({peopleLocalData:o})),Z(!0)},onResetClick:w,onSaveClick:()=>{m(f==="zeni_only"?ve(e):Te())},onCloseClick:h,peopleDetails:D,isAccountingClassesEnabled:p,isReimbursementDisabled:U===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:B};return d.useEffect((()=>{D.invitePersonState.fetchState==="Completed"&&(b(),m(q()))}),[D.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=M(Ie)`
19
+ display: flex;
20
+ min-height: 100%;
21
+ flex-direction: column;
22
+ `,na=qe((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:we}}),(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 X({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=Me(),n=ee(),f=Xe(),{areTenantIdsInSync:i}=Be(),b=K.getSignedInUser(),C=g((s=>Y(s))),{useFeatureGate:m}=J(),{isFeatureEnabled:O}=m(_.isDebitCardFeatureEnabled),Z=g((s=>G(s))),k=!N(O,C)&&Z,S=Q(C),D=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=d.useState(!1),[x,I]=d.useState(!1),[P,v]=d.useState(!1),[T,U]=d.useState("off"),[B,w]=d.useState(!1),h=s=>{w(s)},{isAiCfoAccessEnabled:V,onAskAiCfoClick:$}=Ye({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&&T===u.uiState.mode||!i||(n(H({searchText:"",sortKey:"name",sortOrder:"ascending"})),U(u.uiState.mode),E(!0),n(me()))}),[p,b,D,n,u.uiState.mode,i]),d.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),d.useEffect((()=>{I(e!=null&&e===!0),v(t!=null&&t===!0&&t)}),[e,t]),d.useEffect((()=>{n(H({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const F=()=>{I(!1),v(!1),c("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:we,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(Je,{closeDrawerHandler:F,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ne,{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(X,{})}),a.jsx(z,{path:"new",element:a.jsx(X,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(X,{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};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-DVkNRe2z.js";import E from"./NotFoundScreen-D_hX2Dzv.js";import{a as r}from"./sentry-BcU4ynZK.js";import{h as _,g as v,j as p,i as M,u as O,N as U,l as P,n as z,o as b}from"./core-vR5k5yHJ.js";import{fF as F,a13 as h,bo as B,bn as N,iL as V,gh as L}from"./zeni-epic-state-BmF1nplD.js";import{O as $,z as I,at as q,dO as G}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-Daw0Xdbp.js";import{M as J}from"./MobileAppDrawer-BdOhYCo5.js";import"./recharts-BajLe7QJ.js";import"./analytics-Cd5J-GpX.js";import"./plaid-TFLEc35h.js";import"./dnd-CNeE6eVY.js";import"./stripe-cKAAJElX.js";import"./lottie-w9LOAwHI.js";import"./lexical-DgMW3HzT.js";import"./pdf-HKvehc9b.js";import"./utils-BJrHoU4M.js";import"./InboxNotificationsProvider-C8gkRzEM.js";import"./useTaskManagerAccess-DmtbEonm.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]="c4374ca6-3afb-4331-b911-9152fb1df22b",e._sentryDebugIdIdentifier="sentry-dbid-c4374ca6-3afb-4331-b911-9152fb1df22b")}catch{}})();const K=P((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=h(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),c=$(),o=p((a=>F(a))),{aggregatedReportViewState:n}=p((a=>h(a))),{tenantEmailDomain:m}=M(),u=O(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const f=r.useRef(!1),[w,S]=r.useState(!1),C=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"&&f.current&&(u(L({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),f.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||d(a,i,!0),f.current=!0}),[n?.fetchState,d]),j=r.useCallback(((a,i)=>{d(a,i,!1)}),[d]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,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:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(U,{to:`/${m}/dashboard`,replace:!0})};function be(){return s.jsxs(z,{children:[s.jsx(b,{path:"*",element:s.jsx(Q,{})}),s.jsx(b,{path:"*",element:s.jsx(E,{})})]})}export{be as default};
@@ -1 +1 @@
1
- import{a as h,R as a}from"./sentry-CWp8Ph3h.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="1e16de4c-304f-4e91-a86b-dc86bcc8d8a2",r._sentryDebugIdIdentifier="sentry-dbid-1e16de4c-304f-4e91-a86b-dc86bcc8d8a2")}catch{}})();const c="64px",u={};var k=({src:r,light:t,oEmbedUrl:n,onClickPreview:l,playIcon:w,previewTabIndex:m,previewAriaLabel:b})=>{const[p,i]=h.useState(null);h.useEffect((()=>{r&&t&&n&&v({src:r,light:t,oEmbedUrl:n})}),[r,t,n]);const v=async({src:e,light:s,oEmbedUrl:I})=>{if(a.isValidElement(s))return;if(typeof s=="string")return void i(s);if(u[e])return void i(u[e]);i(null);const E=await fetch(I.replace("{url}",e)),f=await E.json();if(f.thumbnail_url){const g=f.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");i(g),u[e]=g}},d=a.isValidElement(t),y={display:"flex",alignItems:"center",justifyContent:"center"},o={preview:{width:"100%",height:"100%",backgroundImage:p&&!d?`url(${p})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...y},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:c,width:c,height:c,position:d?"absolute":void 0,...y},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},_=a.createElement("div",{style:o.shadow,className:"react-player__shadow"},a.createElement("div",{style:o.playIcon,className:"react-player__play-icon"}));return a.createElement("div",{style:o.preview,className:"react-player__preview",tabIndex:m,onClick:e=>{l?.(e)},onKeyDown:e=>{e.key!=="Enter"&&e.key!==" "||l==null||l(e)},...b?{"aria-label":b}:{}},d?t:null,w||_)};export{k as default};
1
+ import{a as h,R as a}from"./sentry-BcU4ynZK.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new r.Error().stack;t&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[t]="1e16de4c-304f-4e91-a86b-dc86bcc8d8a2",r._sentryDebugIdIdentifier="sentry-dbid-1e16de4c-304f-4e91-a86b-dc86bcc8d8a2")}catch{}})();const c="64px",u={};var k=({src:r,light:t,oEmbedUrl:n,onClickPreview:l,playIcon:w,previewTabIndex:m,previewAriaLabel:b})=>{const[p,i]=h.useState(null);h.useEffect((()=>{r&&t&&n&&v({src:r,light:t,oEmbedUrl:n})}),[r,t,n]);const v=async({src:e,light:s,oEmbedUrl:I})=>{if(a.isValidElement(s))return;if(typeof s=="string")return void i(s);if(u[e])return void i(u[e]);i(null);const E=await fetch(I.replace("{url}",e)),f=await E.json();if(f.thumbnail_url){const g=f.thumbnail_url.replace("height=100","height=480").replace("-d_295x166","-d_640");i(g),u[e]=g}},d=a.isValidElement(t),y={display:"flex",alignItems:"center",justifyContent:"center"},o={preview:{width:"100%",height:"100%",backgroundImage:p&&!d?`url(${p})`:void 0,backgroundSize:"cover",backgroundPosition:"center",cursor:"pointer",...y},shadow:{background:"radial-gradient(rgb(0, 0, 0, 0.3), rgba(0, 0, 0, 0) 60%)",borderRadius:c,width:c,height:c,position:d?"absolute":void 0,...y},playIcon:{borderStyle:"solid",borderWidth:"16px 0 16px 26px",borderColor:"transparent transparent transparent white",marginLeft:"7px"}},_=a.createElement("div",{style:o.shadow,className:"react-player__shadow"},a.createElement("div",{style:o.playIcon,className:"react-player__play-icon"}));return a.createElement("div",{style:o.preview,className:"react-player__preview",tabIndex:m,onClick:e=>{l?.(e)},onKeyDown:e=>{e.key!=="Enter"&&e.key!==" "||l==null||l(e)},...b?{"aria-label":b}:{}},d?t:null,w||_)};export{k as default};
@@ -1,4 +1,4 @@
1
- import{j as _l}from"./liveblocks-CzCs-qU3.js";import{p as te,d as jc,c as an,g as Sl,a as Ol}from"./sentry-CWp8Ph3h.js";import{L as ge,c0 as xc,fI as kc,U3 as Tc,UV as jl,c9 as xl}from"./zeni-epic-state-FRanwwFO.js";import{a as pe,b as kl,c as Tl,d as Al,e as un,f as Rl,g as Pl,h as Il,i as Ve,j as Ac,k as ot,l as xt,m as Ll,o as ct,p as Nl}from"./utils-u0mlLj2I.js";import{r as cn}from"./empty-zUa_Ywzm.js";import{r as $l,a as Ml,b as Cl,c as Dl}from"./pdf-lib-DiMa7ymi.js";import{a as Ye,r as Fl}from"./index-lbu92FYh.js";import{r as Ul}from"./index-CD8RychW.js";import{h as Bl,g as ql,u as Gl,j as _n,l as zl}from"./core-BBG4mxvC.js";import{u as Zl,z as Rc,L as Hl,ak as Vl,al as Yl,W as Wl,I as Kl}from"./index-De2R2YuA.js";import"./mui-B2F_PvWe.js";import{d as It}from"./decodeURIComponentSafe-DgKmvHaP.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]="cfe272c5-c554-41a3-873f-f5009b38e191",e._sentryDebugIdIdentifier="sentry-dbid-cfe272c5-c554-41a3-873f-f5009b38e191")}catch{}})();var Sn,On={exports:{}},jn,xn,kn,Tn,An,Rn,Pn,In,Ln,Lt,Nn,$n,Mn,Cn,Dn,Fn,Un,Bn,qn,Gn,zn,Nt,Zn,Hn,Vn,Yn,Wn,Kn,Jn,$t,Xn,Qn,eo,to,ro,no,oo,Mt={exports:{}},Ct={exports:{}},Dt={};function Pc(){if(jn)return Dt;function e(r){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}function o(r,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,l){return i.__proto__=l,i},o(r,t)}function h(r){var t=(function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}})();return function(){var i,l=n(r);if(t){var u=n(this).constructor;i=Reflect.construct(l,arguments,u)}else i=l.apply(this,arguments);return(function(f,b){if(b&&(e(b)==="object"||typeof b=="function"))return b;if(b!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m})(f)})(this,i)}}function n(r){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(r)}jn=1;var c,p,y={};function g(r,t,i){i||(i=Error);var l=(function(u){(function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),d&&o(a,d)})(m,u);var f,b=h(m);function m(a,d,v){var _;return(function(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")})(this,m),_=b.call(this,(function(w,S,N){return typeof t=="string"?t:t(w,S,N)})(a,d,v)),_.code=r,_}return f=m,Object.defineProperty(f,"prototype",{writable:!1}),f})(i);y[r]=l}function s(r,t){if(Array.isArray(r)){var i=r.length;return r=r.map((function(l){return String(l)})),i>2?"one of ".concat(t," ").concat(r.slice(0,i-1).join(", "),", or ")+r[i-1]:i===2?"one of ".concat(t," ").concat(r[0]," or ").concat(r[1]):"of ".concat(t," ").concat(r[0])}return"of ".concat(t," ").concat(String(r))}return g("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),g("ERR_INVALID_ARG_TYPE",(function(r,t,i){var l,u,f;if(c===void 0&&(c=it()),c(typeof r=="string","'name' must be a string"),typeof t=="string"&&(u="not ",t.substr(0,u.length)===u)?(l="must not be",t=t.replace(/^not /,"")):l="must be",(function(m,a,d){return(d===void 0||d>m.length)&&(d=m.length),m.substring(d-a.length,d)===a})(r," argument"))f="The ".concat(r," ").concat(l," ").concat(s(t,"type"));else{var b=(function(m,a,d){return typeof d!="number"&&(d=0),!(d+a.length>m.length)&&m.indexOf(a,d)!==-1})(r,".")?"property":"argument";f='The "'.concat(r,'" ').concat(b," ").concat(l," ").concat(s(t,"type"))}return f+=". Received type ".concat(e(i))}),TypeError),g("ERR_INVALID_ARG_VALUE",(function(r,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";p===void 0&&(p=pe());var l=p.inspect(t);return l.length>128&&(l="".concat(l.slice(0,128),"...")),"The argument '".concat(r,"' ").concat(i,". Received ").concat(l)}),TypeError),g("ERR_INVALID_RETURN_VALUE",(function(r,t,i){var l;return l=i&&i.constructor&&i.constructor.name?"instance of ".concat(i.constructor.name):"type ".concat(e(i)),"Expected ".concat(r,' to be returned from the "').concat(t,'"')+" function but got ".concat(l,".")}),TypeError),g("ERR_MISSING_ARGS",(function(){for(var r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];c===void 0&&(c=it()),c(t.length>0,"At least one arg needs to be specified");var l="The ",u=t.length;switch(t=t.map((function(f){return'"'.concat(f,'"')})),u){case 1:l+="".concat(t[0]," argument");break;case 2:l+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:l+=t.slice(0,u-1).join(", "),l+=", and ".concat(t[u-1]," arguments")}return"".concat(l," must be specified")}),TypeError),Dt.codes=y,Dt}function Jl(){if(kn)return xn;function e(j,E){var O=Object.keys(j);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(j);E&&(P=P.filter((function(x){return Object.getOwnPropertyDescriptor(j,x).enumerable}))),O.push.apply(O,P)}return O}function o(j){for(var E=1;E<arguments.length;E++){var O=arguments[E]!=null?arguments[E]:{};E%2?e(Object(O),!0).forEach((function(P){h(j,P,O[P])})):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors(O)):e(Object(O)).forEach((function(P){Object.defineProperty(j,P,Object.getOwnPropertyDescriptor(O,P))}))}return j}function h(j,E,O){return(E=c(E))in j?Object.defineProperty(j,E,{value:O,enumerable:!0,configurable:!0,writable:!0}):j[E]=O,j}function n(j,E,O){return E&&(function(P,x){for(var U=0;U<x.length;U++){var L=x[U];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(P,c(L.key),L)}})(j.prototype,E),Object.defineProperty(j,"prototype",{writable:!1}),j}function c(j){var E=(function(O,P){if(l(O)!=="object"||O===null)return O;var x=O[Symbol.toPrimitive];if(x!==void 0){var U=x.call(O,P);if(l(U)!=="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(O)})(j,"string");return l(E)==="symbol"?E:String(E)}function p(j,E){if(E&&(l(E)==="object"||typeof E=="function"))return E;if(E!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(j)}function y(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function g(j){var E=typeof Map=="function"?new Map:void 0;return g=function(O){if(O===null||(P=O,Function.toString.call(P).indexOf("[native code]")===-1))return O;var P;if(typeof O!="function")throw new TypeError("Super expression must either be null or a function");if(E!==void 0){if(E.has(O))return E.get(O);E.set(O,x)}function x(){return s(O,arguments,i(this).constructor)}return x.prototype=Object.create(O.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),t(x,O)},g(j)}function s(j,E,O){return s=r()?Reflect.construct.bind():function(P,x,U){var L=[null];L.push.apply(L,x);var A=new(Function.bind.apply(P,L));return U&&t(A,U.prototype),A},s.apply(null,arguments)}function r(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}}function t(j,E){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(O,P){return O.__proto__=P,O},t(j,E)}function i(j){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(E){return E.__proto__||Object.getPrototypeOf(E)},i(j)}function l(j){return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},l(j)}kn=1;var u=pe().inspect,f=Pc().codes.ERR_INVALID_ARG_TYPE;function b(j,E,O){return(O===void 0||O>j.length)&&(O=j.length),j.substring(O-E.length,O)===E}var m="",a="",d="",v="",_={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function w(j){var E=Object.keys(j),O=Object.create(Object.getPrototypeOf(j));return E.forEach((function(P){O[P]=j[P]})),Object.defineProperty(O,"message",{value:j.message}),O}function S(j){return u(j,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function N(j,E,O){var P="",x="",U=0,L="",A=!1,z=S(j),R=z.split(`
1
+ import{j as _l}from"./liveblocks-DVkNRe2z.js";import{p as te,d as jc,c as an,g as Sl,a as Ol}from"./sentry-BcU4ynZK.js";import{L as ge,b$ as xc,fF as kc,TZ as Tc,UP as jl,c8 as xl}from"./zeni-epic-state-BmF1nplD.js";import{a as pe,b as kl,c as Tl,d as Al,e as un,f as Rl,g as Pl,h as Il,i as Ve,j as Ac,k as ot,l as xt,m as Ll,o as ct,p as Nl}from"./utils-BJrHoU4M.js";import{r as cn}from"./empty-BCyx7s6I.js";import{r as $l,a as Ml,b as Cl,c as Dl}from"./pdf-lib-1kn73-Ho.js";import{a as Ye,r as Fl}from"./index-BNIWZiV_.js";import{r as Ul}from"./index-B8gT7z4T.js";import{h as Bl,g as ql,u as Gl,j as _n,l as zl}from"./core-vR5k5yHJ.js";import{u as Zl,z as Rc,L as Hl,al as Vl,am as Yl,_ as Wl,C as Kl}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{d as It}from"./decodeURIComponentSafe-dlx9EsSm.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]="428062bc-2f34-42af-92a2-059872eb371e",e._sentryDebugIdIdentifier="sentry-dbid-428062bc-2f34-42af-92a2-059872eb371e")}catch{}})();var Sn,On={exports:{}},jn,xn,kn,Tn,An,Rn,Pn,In,Ln,Lt,Nn,$n,Mn,Cn,Dn,Fn,Un,Bn,qn,Gn,zn,Nt,Zn,Hn,Vn,Yn,Wn,Kn,Jn,$t,Xn,Qn,eo,to,ro,no,oo,Mt={exports:{}},Ct={exports:{}},Dt={};function Pc(){if(jn)return Dt;function e(r){return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(r)}function o(r,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,l){return i.__proto__=l,i},o(r,t)}function h(r){var t=(function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}})();return function(){var i,l=n(r);if(t){var u=n(this).constructor;i=Reflect.construct(l,arguments,u)}else i=l.apply(this,arguments);return(function(f,b){if(b&&(e(b)==="object"||typeof b=="function"))return b;if(b!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(m){if(m===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return m})(f)})(this,i)}}function n(r){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(r)}jn=1;var c,p,y={};function g(r,t,i){i||(i=Error);var l=(function(u){(function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),Object.defineProperty(a,"prototype",{writable:!1}),d&&o(a,d)})(m,u);var f,b=h(m);function m(a,d,v){var _;return(function(w,S){if(!(w instanceof S))throw new TypeError("Cannot call a class as a function")})(this,m),_=b.call(this,(function(w,S,N){return typeof t=="string"?t:t(w,S,N)})(a,d,v)),_.code=r,_}return f=m,Object.defineProperty(f,"prototype",{writable:!1}),f})(i);y[r]=l}function s(r,t){if(Array.isArray(r)){var i=r.length;return r=r.map((function(l){return String(l)})),i>2?"one of ".concat(t," ").concat(r.slice(0,i-1).join(", "),", or ")+r[i-1]:i===2?"one of ".concat(t," ").concat(r[0]," or ").concat(r[1]):"of ".concat(t," ").concat(r[0])}return"of ".concat(t," ").concat(String(r))}return g("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),g("ERR_INVALID_ARG_TYPE",(function(r,t,i){var l,u,f;if(c===void 0&&(c=it()),c(typeof r=="string","'name' must be a string"),typeof t=="string"&&(u="not ",t.substr(0,u.length)===u)?(l="must not be",t=t.replace(/^not /,"")):l="must be",(function(m,a,d){return(d===void 0||d>m.length)&&(d=m.length),m.substring(d-a.length,d)===a})(r," argument"))f="The ".concat(r," ").concat(l," ").concat(s(t,"type"));else{var b=(function(m,a,d){return typeof d!="number"&&(d=0),!(d+a.length>m.length)&&m.indexOf(a,d)!==-1})(r,".")?"property":"argument";f='The "'.concat(r,'" ').concat(b," ").concat(l," ").concat(s(t,"type"))}return f+=". Received type ".concat(e(i))}),TypeError),g("ERR_INVALID_ARG_VALUE",(function(r,t){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";p===void 0&&(p=pe());var l=p.inspect(t);return l.length>128&&(l="".concat(l.slice(0,128),"...")),"The argument '".concat(r,"' ").concat(i,". Received ").concat(l)}),TypeError),g("ERR_INVALID_RETURN_VALUE",(function(r,t,i){var l;return l=i&&i.constructor&&i.constructor.name?"instance of ".concat(i.constructor.name):"type ".concat(e(i)),"Expected ".concat(r,' to be returned from the "').concat(t,'"')+" function but got ".concat(l,".")}),TypeError),g("ERR_MISSING_ARGS",(function(){for(var r=arguments.length,t=new Array(r),i=0;i<r;i++)t[i]=arguments[i];c===void 0&&(c=it()),c(t.length>0,"At least one arg needs to be specified");var l="The ",u=t.length;switch(t=t.map((function(f){return'"'.concat(f,'"')})),u){case 1:l+="".concat(t[0]," argument");break;case 2:l+="".concat(t[0]," and ").concat(t[1]," arguments");break;default:l+=t.slice(0,u-1).join(", "),l+=", and ".concat(t[u-1]," arguments")}return"".concat(l," must be specified")}),TypeError),Dt.codes=y,Dt}function Jl(){if(kn)return xn;function e(j,E){var O=Object.keys(j);if(Object.getOwnPropertySymbols){var P=Object.getOwnPropertySymbols(j);E&&(P=P.filter((function(x){return Object.getOwnPropertyDescriptor(j,x).enumerable}))),O.push.apply(O,P)}return O}function o(j){for(var E=1;E<arguments.length;E++){var O=arguments[E]!=null?arguments[E]:{};E%2?e(Object(O),!0).forEach((function(P){h(j,P,O[P])})):Object.getOwnPropertyDescriptors?Object.defineProperties(j,Object.getOwnPropertyDescriptors(O)):e(Object(O)).forEach((function(P){Object.defineProperty(j,P,Object.getOwnPropertyDescriptor(O,P))}))}return j}function h(j,E,O){return(E=c(E))in j?Object.defineProperty(j,E,{value:O,enumerable:!0,configurable:!0,writable:!0}):j[E]=O,j}function n(j,E,O){return E&&(function(P,x){for(var U=0;U<x.length;U++){var L=x[U];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(P,c(L.key),L)}})(j.prototype,E),Object.defineProperty(j,"prototype",{writable:!1}),j}function c(j){var E=(function(O,P){if(l(O)!=="object"||O===null)return O;var x=O[Symbol.toPrimitive];if(x!==void 0){var U=x.call(O,P);if(l(U)!=="object")return U;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(O)})(j,"string");return l(E)==="symbol"?E:String(E)}function p(j,E){if(E&&(l(E)==="object"||typeof E=="function"))return E;if(E!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return y(j)}function y(j){if(j===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return j}function g(j){var E=typeof Map=="function"?new Map:void 0;return g=function(O){if(O===null||(P=O,Function.toString.call(P).indexOf("[native code]")===-1))return O;var P;if(typeof O!="function")throw new TypeError("Super expression must either be null or a function");if(E!==void 0){if(E.has(O))return E.get(O);E.set(O,x)}function x(){return s(O,arguments,i(this).constructor)}return x.prototype=Object.create(O.prototype,{constructor:{value:x,enumerable:!1,writable:!0,configurable:!0}}),t(x,O)},g(j)}function s(j,E,O){return s=r()?Reflect.construct.bind():function(P,x,U){var L=[null];L.push.apply(L,x);var A=new(Function.bind.apply(P,L));return U&&t(A,U.prototype),A},s.apply(null,arguments)}function r(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch{return!1}}function t(j,E){return t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(O,P){return O.__proto__=P,O},t(j,E)}function i(j){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(E){return E.__proto__||Object.getPrototypeOf(E)},i(j)}function l(j){return l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(E){return typeof E}:function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},l(j)}kn=1;var u=pe().inspect,f=Pc().codes.ERR_INVALID_ARG_TYPE;function b(j,E,O){return(O===void 0||O>j.length)&&(O=j.length),j.substring(O-E.length,O)===E}var m="",a="",d="",v="",_={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"};function w(j){var E=Object.keys(j),O=Object.create(Object.getPrototypeOf(j));return E.forEach((function(P){O[P]=j[P]})),Object.defineProperty(O,"message",{value:j.message}),O}function S(j){return u(j,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function N(j,E,O){var P="",x="",U=0,L="",A=!1,z=S(j),R=z.split(`
2
2
  `),I=S(E).split(`
3
3
  `),k=0,C="";if(O==="strictEqual"&&l(j)==="object"&&l(E)==="object"&&j!==null&&E!==null&&(O="strictEqualObject"),R.length===1&&I.length===1&&R[0]!==I[0]){var H=R[0].length+I[0].length;if(H<=10){if(!(l(j)==="object"&&j!==null||l(E)==="object"&&E!==null||j===0&&E===0))return"".concat(_[O],`
4
4
 
@@ -0,0 +1 @@
1
+ import{j as r}from"./liveblocks-DVkNRe2z.js";import Z from"./NotFoundScreen-D_hX2Dzv.js";import{a as p}from"./sentry-BcU4ynZK.js";import{h as C,g as D,u as N,j as u,N as V,l as k,n as q,o as b}from"./core-vR5k5yHJ.js";import{fF as E,Z9 as h,Zq as w,NK as U,NG as L,NJ as f,Nz as B,ZP as $,ND as z,NM as K}from"./zeni-epic-state-BmF1nplD.js";import{z as T,w as O,cb as F,q as W,bU as G,cc as J}from"./index-1ujiYIu0.js";import"./mui-Bf4yQzNc.js";import{u as M,R as x}from"./ReimbursementApprovalRuleDetailScreen-DZMnuINe.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]="36252915-8dd6-47d0-9b7a-3a81c1a66c06",e._sentryDebugIdIdentifier="sentry-dbid-36252915-8dd6-47d0-9b7a-3a81c1a66c06")}catch{}})();const j="reimbursement-approval-rule-update",P=k((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:w(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(j)&&e($(!1))},onBackClick:()=>{W(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"))}}}))(O(F)),H=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),g=u((o=>w(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{g?.updateStatus.fetchState==="Completed"&&a(U())}),[g]),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||(R(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${j}`]:[],eventCallback:(o,y,I)=>{o.endsWith(j)&&I.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(P,{currentTenant:c,location:n,navigate:s,...m})},A="reimbursement-approval-rule-update",Q=k((function(e){const s=h(e),n=w(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(A)&&e($(!1))},onBackClick:()=>{W(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))}}}))(O(J)),X=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=G(e?.tenantId);return s?r.jsx(Y,{isLoading:n}):r.jsx(H,{isLoading:n})},Y=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),g=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));M();const y=u((i=>w(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(U())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||g!=="Not-Started"||e||(R(!0),a(z(!1,!0)))}),[v,g,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 I={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${A}`]:[],eventCallback:(i,ee,_)=>{i.endsWith(A)&&_.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(Q,{currentTenant:m,location:n,navigate:s,isLoading:e,...I})};function le(){return r.jsxs(q,{children:[r.jsx(b,{path:"/",element:r.jsx(X,{})}),r.jsx(b,{path:"/new",element:r.jsx(x,{})}),r.jsx(b,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(b,{path:"*",element:r.jsx(Z,{})})]})}export{le as R};