@zeniai/web-app-ui 5.3.73-qa → 5.3.74-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 (149) hide show
  1. package/dist/assets/{AccountMappingScreen-BE1tvCY-.js → AccountMappingScreen-bgBnbWdy.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-JIrVAnYO.js → ActualMatchingMatchDetailScreen-CafaM5XY.js} +1 -1
  3. package/dist/assets/AddressRoutes-B0qCwALn.js +1 -0
  4. package/dist/assets/AddressScreen-DeduQWQ4.js +9 -0
  5. package/dist/assets/AiCfoScreen-B7J9RT9C.js +22 -0
  6. package/dist/assets/{AppDrawer-BtvyICbv.js → AppDrawer-BW6P-wV8.js} +2 -2
  7. package/dist/assets/{BillPayApprovalRoutes-BeNlUYtP.js → BillPayApprovalRoutes-D2bN_nnZ.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-NNo26FTU.js → BillPayRoutes-CgW1erGg.js} +18 -18
  9. package/dist/assets/BusinessVerificationPageScreen-DcKUi-lt.js +9 -0
  10. package/dist/assets/CardsAiCfoScreen-C1dyyMbI.js +14 -0
  11. package/dist/assets/{ChargeCardRoutes-Czud_dft.js → ChargeCardRoutes-BWzbRtxf.js} +6 -6
  12. package/dist/assets/{CompanyPassportScreen-CUrmIaoV.js → CompanyPassportScreen-xleu1jTV.js} +1 -1
  13. package/dist/assets/ConnectionAuthScreen-B5EFa-_C.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-BrgGs5TS.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-nYzTX44l.js → CustomerOnboardingRoutes-B7MWRMYz.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-DhAARK1y.js → DashboardRoutes-h3cnLeE8.js} +3 -3
  17. package/dist/assets/{DefaultTenantHome-BnU9SlLP.js → DefaultTenantHome-B6pMA7H4.js} +1 -1
  18. package/dist/assets/{DomesticWireDetailScreen-CXWbzXGO.js → DomesticWireDetailScreen-zZKn41az.js} +4 -4
  19. package/dist/assets/{DrawerScreen-KU4gAeGs.js → DrawerScreen-DMtHjlqA.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-D_ufO2eZ.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-CLNre9XZ.js → ExpenseAutomationRoutes-jgAFt30Z.js} +3 -3
  22. package/dist/assets/FeaturePreviewScreen-zypoS_dA.js +1 -0
  23. package/dist/assets/HubSpotOAuthCallbackScreen-DbtL26-p.js +1 -0
  24. package/dist/assets/{InboxNotificationsProvider-DNSMQBKV.js → InboxNotificationsProvider-CrlYLYr4.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-Cy4ZHmk0.js +2 -0
  26. package/dist/assets/{MagicLinkRoutes-DPv2J5Oz.js → MagicLinkRoutes-DzAI89ll.js} +8 -8
  27. package/dist/assets/MagicLinkSignInScreen-BgTist7Q.js +12 -0
  28. package/dist/assets/MobileAppDrawer-DqkcDASf.js +1 -0
  29. package/dist/assets/NotFoundScreen-CNN7HdXS.js +1 -0
  30. package/dist/assets/NotificationRoutes-C2jjWnl-.js +1 -0
  31. package/dist/assets/OAuthConsentScreen-BPAw8v-M.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-CBKGWsoX.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-eihuemvD.js → PaymentLinkScreen-B6TgBvUT.js} +1 -1
  34. package/dist/assets/PeopleRoutes-DypFbuli.js +22 -0
  35. package/dist/assets/PerformanceRoutes-C2kXP11r.js +1 -0
  36. package/dist/assets/{Preview-Csnu6hhv.js → Preview-B36YgZlJ.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-D1I_iW5h.js → QBOConnectionScreen--H698GzB.js} +1 -1
  38. package/dist/assets/ReimbursementApprovalRoutes-D4ojMFTf.js +1 -0
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BIyPBmgD.js → ReimbursementApprovalRuleDetailScreen-DegiBelw.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-LP6xm98z.js → ReimbursementRoutes-Yr2nE-d0.js} +7 -7
  41. package/dist/assets/{ReportsRoutes-DITYNMuX.js → ReportsRoutes-DjFQNpll.js} +1 -1
  42. package/dist/assets/RewardsRoutes-Dtxx5k0B.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BcgBt7ic.js → ScheduleDetailsPrepaidExpensesScreen-BRIu0n7K.js} +5 -5
  44. package/dist/assets/ScreenRoutes-kKJ3YpZH.js +2 -0
  45. package/dist/assets/{SettingsRoutes-Da6bbYYR.js → SettingsRoutes-BZmYgJtK.js} +6 -6
  46. package/dist/assets/SetupPagesScreen-lPaGXTgS.js +29 -0
  47. package/dist/assets/SignInScreen-DTadPYrT.js +1 -0
  48. package/dist/assets/SignOutScreen-BHkTJ-yD.js +9 -0
  49. package/dist/assets/TaskListScreen-D3GsptEL.js +9 -0
  50. package/dist/assets/TaskRoutes-fGbGk9KK.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-ViQ3OgVr.js +1 -0
  52. package/dist/assets/{TransactionDetailScreen-bF7tC5BL.js → TransactionDetailScreen-Be7gHGgU.js} +2 -2
  53. package/dist/assets/TransactionListRoutes-CDGe1Ogo.js +1 -0
  54. package/dist/assets/{TreasuryRoutes-ZY5ec2rr.js → TreasuryRoutes-Dbi6qnAw.js} +6 -6
  55. package/dist/assets/{VendorsRoutes-g-bxxUNg.js → VendorsRoutes-DIJ1qy90.js} +13 -13
  56. package/dist/assets/WiseConfirmationScreen-CVfxBgou.js +12 -0
  57. package/dist/assets/{ZeniAccountRoutes-p4oJntrm.js → ZeniAccountRoutes-RSARM6Ba.js} +11 -11
  58. package/dist/assets/{ZeniAccountStatementScreen-BLhbe-0Z.js → ZeniAccountStatementScreen-BfUClG3a.js} +2 -2
  59. package/dist/assets/{accountMappingHelper-B03ntuMF.js → accountMappingHelper-CBNvvMfn.js} +1 -1
  60. package/dist/assets/{analytics-BFbgqgMT.js → analytics-DYPKn651.js} +1 -1
  61. package/dist/assets/{analyticsHelper-CR4O3yZF.js → analyticsHelper-BvcLZ--H.js} +1 -1
  62. package/dist/assets/{core-BTxe1IJ4.js → core-CJWbgnFM.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-CLAUpL82.js → decodeURIComponentSafe-BCm_uqSw.js} +1 -1
  64. package/dist/assets/{dnd-CH048ZLo.js → dnd-hHoSpesG.js} +1 -1
  65. package/dist/assets/{empty-CAFZs_Ce.js → empty-CGblm06Y.js} +1 -1
  66. package/dist/assets/{empty-BlDbR96Q.js → empty-DUMrvwO9.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-C3V_Mh-h.js → emptyVideoElement-D2KJ78rZ.js} +1 -1
  68. package/dist/assets/epic-n7HybIEr.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-Bra4tyPR.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-AQFwGK3G.js → getLocaleForTenant-DDk9eOPJ.js} +1 -1
  71. package/dist/assets/{index-5MqCU60P.js → index-BWgG5UXp.js} +2 -2
  72. package/dist/assets/{index-9ZQLuzDm.js → index-BfkcPaMK.js} +1 -1
  73. package/dist/assets/{index-lUU_agnk.js → index-C8z0vmNu.js} +1 -1
  74. package/dist/assets/{index-Bk3SeEYR.js → index-CdkOnd47.js} +1 -1
  75. package/dist/assets/{index-BBiUi3gN.js → index-ColbwDzi.js} +1 -1
  76. package/dist/assets/{index-D-UPM8nK.js → index-D9-rtXik.js} +1 -1
  77. package/dist/assets/{index-t_YINWfi.js → index-DvSod3qd.js} +16657 -16580
  78. package/dist/assets/{index-JPLpjCnh.js → index-EziXfial.js} +1 -1
  79. package/dist/assets/{lexical-tyxOdseK.js → lexical-CAwA0n9Q.js} +1 -1
  80. package/dist/assets/{liveblocks-BOLtmXrt.js → liveblocks-Du6nrW5U.js} +1 -1
  81. package/dist/assets/{lottie-DLo-RGW2.js → lottie-BBf_aMXD.js} +1 -1
  82. package/dist/assets/{mui-CoXsq-BK.js → mui-dbvYX-CF.js} +1 -1
  83. package/dist/assets/{pathToGoBack-Bch85fkl.js → pathToGoBack-CI7vJZ39.js} +1 -1
  84. package/dist/assets/{pdf-DVvA7lFh.js → pdf-C7M7XqWN.js} +3 -3
  85. package/dist/assets/{pdf-lib-CTa71n8-.js → pdf-lib-ArqLJwp-.js} +1 -1
  86. package/dist/assets/{plaid-aFRwvwGe.js → plaid-BrZReSCz.js} +1 -1
  87. package/dist/assets/{pusher-kon0XfSK.js → pusher-B8VDNFKS.js} +1 -1
  88. package/dist/assets/{react-BukI8JJo.js → react-B8eW8M54.js} +1 -1
  89. package/dist/assets/{react-CnAe8nlJ.js → react-C7HcxS4Y.js} +1 -1
  90. package/dist/assets/{react-CuayOuaV.js → react-CmsG3ktk.js} +1 -1
  91. package/dist/assets/{react-CgA-IPTs.js → react-DCRvz-4Y.js} +1 -1
  92. package/dist/assets/{react-Bugty8Ja.js → react-Rk6uPjYN.js} +1 -1
  93. package/dist/assets/{react-BlW33xsQ.js → react-rIttatCG.js} +1 -1
  94. package/dist/assets/{recharts-4iB4lKv8.js → recharts-qq-VgjqX.js} +1 -1
  95. package/dist/assets/{routePaths-ByVgDZC2.js → routePaths-5zdijNTw.js} +1 -1
  96. package/dist/assets/{sentry-CXDuPEuw.js → sentry-DlU3V0QD.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-Ph0joKsY.js → stripSplatSuffix-D3txeaXa.js} +1 -1
  98. package/dist/assets/{url-gwgPp82g.js → url-BjQv6zlz.js} +1 -1
  99. package/dist/assets/{url-b7gVrWYV.js → url-U6gN5rx7.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-DYWJx87C.js +1 -0
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-BAsCzUuV.js → useAiCfoDashboardSuggestedQuestionsChips-CQIzuErz.js} +1 -1
  102. package/dist/assets/useAskAiCfoHostNavButtonProps-DDS1YL8l.js +1 -0
  103. package/dist/assets/{useChargeCardPusherEvents-Babpz4Cl.js → useChargeCardPusherEvents-BEZEnt6s.js} +1 -1
  104. package/dist/assets/{useDeviceId-Bb0qVsLr.js → useDeviceId-CDXz5n2o.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-DYtoHOCU.js +1 -0
  106. package/dist/assets/{useInitialThreadRequest-AuBsHZ1k.js → useInitialThreadRequest-CWExIS9V.js} +1 -1
  107. package/dist/assets/useTaskManagerAccess-OslA3wOO.js +1 -0
  108. package/dist/assets/{useTaskManagerPusherEvents-Ct21DG4i.js → useTaskManagerPusherEvents-D9C1zIb_.js} +1 -1
  109. package/dist/assets/{utils-Dq3SJj6J.js → utils-C-x5CNgO.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-DxjwZ9FM.js → withTransactionSidePanel-bpiv3Wfp.js} +4 -4
  111. package/dist/assets/{zeni-epic-state-EEoBiaeS.js → zeni-epic-state-DUCBgtEU.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +4 -46
  114. package/dist/assets/AddressRoutes-D9zk0sYw.js +0 -1
  115. package/dist/assets/AddressScreen-DX07-zau.js +0 -9
  116. package/dist/assets/AiCfoScreen-tIUREuwh.js +0 -22
  117. package/dist/assets/BusinessVerificationPageScreen-DUnn3sZ3.js +0 -9
  118. package/dist/assets/CardsAiCfoScreen-DgW1pdhN.js +0 -14
  119. package/dist/assets/ConnectionAuthScreen-DBBWNSFG.js +0 -11
  120. package/dist/assets/CustomerOnboardingAuthScreen-BkD1xkwc.js +0 -1
  121. package/dist/assets/EntityDetailRoutes-D_N1d5ZQ.js +0 -1
  122. package/dist/assets/FeaturePreviewScreen-CSQdoVFf.js +0 -1
  123. package/dist/assets/HubSpotOAuthCallbackScreen-CdA2Kn-0.js +0 -1
  124. package/dist/assets/InvoicingRoutes-BHf-XoEl.js +0 -2
  125. package/dist/assets/MagicLinkSignInScreen-DSrgS8kC.js +0 -12
  126. package/dist/assets/MobileAppDrawer-5FBCjy6b.js +0 -1
  127. package/dist/assets/NotFoundScreen-CT9mXoPL.js +0 -1
  128. package/dist/assets/NotificationRoutes-qO4Y_dYL.js +0 -1
  129. package/dist/assets/OAuthConsentScreen-SaWEQNl9.js +0 -1
  130. package/dist/assets/PandLWithForecastRoutes-By9t5qFG.js +0 -1
  131. package/dist/assets/PeopleRoutes-Dqp41TZY.js +0 -22
  132. package/dist/assets/PerformanceRoutes-C-s_fkZE.js +0 -1
  133. package/dist/assets/ReimbursementApprovalRoutes-D09rn5qB.js +0 -1
  134. package/dist/assets/RewardsRoutes-B40r6YTa.js +0 -1
  135. package/dist/assets/ScreenRoutes-D1Kn71pi.js +0 -2
  136. package/dist/assets/SetupPagesScreen-BEg9WOWC.js +0 -29
  137. package/dist/assets/SignInScreen-CGyR8HV0.js +0 -1
  138. package/dist/assets/SignOutScreen-rgwnFp37.js +0 -9
  139. package/dist/assets/TaskListScreen-BSIpi4t5.js +0 -9
  140. package/dist/assets/TaskRoutes-C4ENdbyX.js +0 -9
  141. package/dist/assets/TransactionDetailRoutes-CpfJculb.js +0 -1
  142. package/dist/assets/TransactionListRoutes-C_ZQyWLJ.js +0 -1
  143. package/dist/assets/WiseConfirmationScreen-Hu2tm7rB.js +0 -12
  144. package/dist/assets/epic-Cs9GTJNL.js +0 -2
  145. package/dist/assets/expenseAutomationHelper-DayJ0nIv.js +0 -1
  146. package/dist/assets/useActualMatchingMatchDetail-wQ6Oyy0y.js +0 -1
  147. package/dist/assets/useAskAiCfoHostNavButtonProps-CGeN7NSS.js +0 -1
  148. package/dist/assets/useEmailConnectResultRefresh-EO4XFjwp.js +0 -1
  149. package/dist/assets/useTaskManagerAccess-21llCh7a.js +0 -1
@@ -0,0 +1,2 @@
1
+ import{j as c}from"./liveblocks-Du6nrW5U.js";import{a as r}from"./sentry-DlU3V0QD.js";import{u as L,h as _,i as $,j as k,t as W,l as O,s as q,g as Y,N as V,n as oe,o as x}from"./core-CJWbgnFM.js";import{a8 as Xn,k as g,aq as R,U as d,cc as Zn,cd as et,ce as nt,cf as tt,cg as it,ch as ot,ci as at,cj as ct,ck as st,cl as rt,cm as dt,cn as lt,p as X,co as ut,cp as gt,z as J,ae as se,cq as vt,cr as mt,cs as pt,ct as St,cu as ft,cv as It,cw as ht,cx as Ct,cy as kt,cz as Et,Q as yt,ai as rn,cA as bt,cB as xt,cC as At,cD as Dt,cE as jt,cF as Lt,cG as _t,cH as Pt,cI as wt,cJ as $t,cK as Ft,t as He,j as _e,cL as Rt,cM as Tt,cN as Ot,cO as Mt,cP as Nt,cQ as Ut,cR as Bt}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import{A as K}from"./AddressScreen-DeduQWQ4.js";import M from"./NotFoundScreen-CNN7HdXS.js";import{Z$ as Vt,_0 as Ht,vv as qe,_1 as G,v_ as re,_2 as Pe,_3 as de,wB as be,wI as qt,wM as dn,_4 as we,wF as Qt,ye as Qe,vZ as ze,_5 as ln,wX as xe,_6 as le,w$ as zt,_7 as Kt,_8 as un,x2 as gn,z9 as Gt,_9 as Se,_a as Ke,_b as vn,vX as Jt,_c as Wt,vP as Yt,_d as Xt,yr as Zt,_e as mn,yA as Ge,_f as ei,yx as ni,_g as $e,gk as Fe,_h as te,_i as ie,xh as ti,w3 as Je,w8 as pn,w6 as ii,w0 as oi,xa as ai,wa as ci,xj as si,_j as Ae,xs as Sn,xq as fe,xo as ue,xn as ri,_k as fn,yG as We,_l as di,vY as In,_m as Re,fI as Ie,wj as De,wg as je,wt as hn,ws as Te,wd as li,wm as Cn,wv as ae,VM as kn,v$ as Oe,wq as ui,wr as gi,wp as vi,_n as mi,x0 as pi,wY as En,_o as yn,vJ as Ye,_p as Si,vF as fi,_q as Ii,yM as hi,yQ as Q,yL as Ci,xU as he,_r as ki,_s as bn,yZ as Xe,_t as Ei,yW as yi,_u as xn,xX as bi,xY as H,x$ as xi,_v as An,y9 as Ee,_w as Ai,xi as Dn,Ui as jn,_x as Di,yj as ji,_y as Ln,_z as Li,_A as _i,_B as Pi,zO as wi,_C as $i,_D as _n,z4 as Pn,_E as wn,zM as ye,_F as Fi,zJ as Ri,_G as Ti,_H as Oi,_I as Mi,_J as Ni,_K as Ui,_L as Ze,_M as Bi,ei as Vi,zS as Hi,_N as Me,xC as qi,xx as Qi,_O as ge,xN as $n,xF as ve,xE as zi,xI as Fn,_P as Ki,xD as Gi,_Q as Rn,za as Tn,zB as en,zw as Ji,_R as Wi,zb as Yi,_S as Xi,zC as Zi,zG as eo,_T as Ne,wD as On,zn as no,wE as to,_U as io,_V as Mn,c9 as oo,mv as ao,mw as co,_W as nn,wC as me,go as so,mC as ro,zt as Nn,A2 as lo,zq as Un,v1 as uo,uR as go,hV as vo,UL as tn,UM as mo,Go as Bn,z$ as po,hN as So,zY as fo,_X as Io,_Y as ho,A8 as Co,A7 as ko,_Z as Eo,__ as Vn,A5 as yo,_$ as bo,$0 as xo,yn as Ao,$1 as Do}from"./zeni-epic-state-DUCBgtEU.js";import{M as jo}from"./MobileAppDrawer-DqkcDASf.js";import{q as pe}from"./QBOConnectionScreen--H698GzB.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";import"./InboxNotificationsProvider-CrlYLYr4.js";import"./useTaskManagerAccess-OslA3wOO.js";import"./empty-DUMrvwO9.js";import"./pdf-lib-ArqLJwp-.js";import"./index-BfkcPaMK.js";import"./url-U6gN5rx7.js";import"./index-ColbwDzi.js";import"./decodeURIComponentSafe-BCm_uqSw.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]="8b5e1d51-ad21-4d39-8597-b8cc38c54726",t._sentryDebugIdIdentifier="sentry-dbid-8b5e1d51-ad21-4d39-8597-b8cc38c54726")}catch{}})();const w=({event:t,isReady:e=!0})=>e?c.jsx(Xn,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function Lo(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:p,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(Vt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((F,U)=>{const T=Ht(D,F,U,E);T!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{entity:F,entityId:U,fromScreen:"audit_log",toScreen:F}),e(T))}),[E,e,D]);r.useEffect((()=>{const F=setTimeout((()=>u(a)),300);return()=>clearTimeout(F)}),[a]),r.useEffect((()=>{i&&t(qe({filters:y,keepExistingListItems:!1,sort:v}))}),[i,y,v,t]);const A=m==="Not-Started"||m==="In-Progress"&&f.length===0,C=m==="In-Progress"&&f.length>0,j=m==="Completed";return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingAuditLogPage,isReady:j}),c.jsx(Zn,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:p,isLoading:A,isLoadingMore:C,searchValue:a,sortState:l,onEntityLinkClick:b,onLoadMore:()=>{p&&I!=null&&t(qe({cursor:I,filters:y,keepExistingListItems:!0,sort:v}))},onSearchChange:o,onSortChange:S})]})}function Ce(t,e=!1){const n=L(),i=k((s=>G(s).productNextCursor!=null)),a=k((s=>G(s).productNextCursor)),o=k((s=>G(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(re({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(re({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function Z(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const S=l.current==="In-Progress";l.current=t,t==="Completed"&&S&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((S=>S+1)))}),[s,e]),a}const _o=new Set(["plan"]),Po=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!==""?a=>{i!==""&&(g.trackInvoicingActionClick(d.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(Qt({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(we({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemEdited,{itemId:i}),t(dn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(qt({action:o,id:a,parentItemId:i}))}}}))(et);function wo(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=$(),[a]=W(),{areTenantIdsInSync:o}=R(),s=(u=a.get("kind"))!=null&&_o.has(u)?u:"plan";var u;const l=k((y=>Pe(y,n))),{pageFetchState:S}=l,v=S.fetchState;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(be({id:n,kind:s}))}),[o,n,s,t]);const m=r.useCallback((y=>t(be({cacheOverride:!0,id:y,kind:s}))),[t,s]),p=Z(l.fetchState,l.isFormLoading,n,m),f=v==="Completed"&&!l.isFormLoading;Ce(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(v==="Not-Started"||v==="In-Progress"||l.isFormLoading);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(Po,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:l},p)]})}const $o=new Set(["addon","charge","plan"]),Fo=new Set(["plan"]),Ro=O((function(t,e){const n=Pe(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:a}=e,o=a!=null?`${n}/catalog/${encodeURIComponent(a)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemFormCancelled),t(de({id:a})),e.navigate(`${n}/catalog`)},onChange:s=>{t(we({id:a,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemSaved,{mode:i}),t(dn({id:a}))}}}))(nt);function To(){const t=L(),e=_(),{item_id:n,tenantEmailDomain:i}=$(),[a]=W(),{areTenantIdsInSync:o}=R(),s=n!=null,u=a.get("type"),l=u!=null&&$o.has(u)?u:void 0,S=(v=a.get("kind"))!=null&&Fo.has(v)?v:"plan";var v;const m=k((p=>Pe(p,n)));return Ce(o,!0),r.useEffect((()=>{o&&t(be({id:n,kind:S}))}),[o,n,S,t]),r.useEffect((()=>{s||l==null||m.localData.catalogType===l||t(we({localData:{...m.localData,catalogType:l}}))}),[s,l,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const p=m.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(de({id:n}))}}),[m.fetchState,m.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCatalogItemFormPage}),c.jsx(Ro,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:s,itemId:n})]})}const Oo={addons:"addon",all:"item",charges:"charge",plans:"plan"},Mo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="In-Progress"&&o.length>0,planRows:n.planRows,productRows:n.productRows}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Oo[e.activeTab];g.trackInvoicingActionClick(d.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(d.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onLoadMore:()=>{if(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(ze({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(re({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}):re({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(tt);function No(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[l,S]=r.useState(""),[v,m]=r.useState(null),p=r.useMemo((()=>v!=null?{dir:v.direction,field:v.columnKey}:void 0),[v]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((j=>G(j))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed";return r.useEffect((()=>{const j=setTimeout((()=>S(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(Qe({cacheOverride:!1,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[i,t,I,E,p]),r.useEffect((()=>{i&&(f!==y||p?.field!==D?.field||p?.dir!==D?.dir)&&t(Qe({cacheOverride:!0,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[y,D,i,t,I,E,f,p]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCatalogPage,isReady:C}),c.jsx(Mo,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:v,planFilters:I,productFilters:E,sort:p,planNextCursor:b,productNextCursor:A,onSearchChange:o,onTabChange:u,onSortChange:m})]})}const Uo=O((function(t,e){const n=ln(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingCouponFormCancelled),t(le({id:i})),e.navigate(`${n}/discounts`)},onChange:s=>{t(Kt({id:i,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCouponSaved,{mode:a}),t(zt({id:i}))}}}))(it);function Bo(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),{fetchState:o,savedCouponId:s}=k((u=>ln(u,n)));return r.useEffect((()=>{a&&t(xe({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,l=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(l),t(le({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCouponFormPage}),c.jsx(Uo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Vo=O((function(t){const e=un(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:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(vn(a))},onSubmit:()=>{const a=Wt(t.localData);g.trackInvoicingActionClick(d.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(Yt(a))}}}))(at);function Ho(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),[i]=W(),{areTenantIdsInSync:a}=R(),o=i.get("customerId"),s=k((b=>un(b))),u=s.fetchState,l=s.localData,S=s.savedInvoiceId,v=k(gn),m=k((b=>Gt(b))),p=k(Se),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&v==null,I=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,E=f||I,h=m.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(Ke()),()=>{t(Ke())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||l.customerId!==""||(y.current=!0,t(vn({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{a&&t(Jt({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=S!=null?`/${n}/invoicing/invoices/${encodeURIComponent(S)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,S,e,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(ot,{}):c.jsx(Vo,{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=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(ct);function Qo(){const t=L(),e=_(),{credit_note_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),o=k((u=>Xt(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(Zt({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(qo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const zo=O((function(t){const e=mn(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:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ni({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(st);function Ko(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=mn(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Ge({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ge({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCreditsListPage,isReady:y}),c.jsx(zo,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ei(D)),onSortChange:S})]})}const Hn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Go=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:a=>{t(Ae({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`)},onDiscardEdit:()=>{t(fe(ue)),t(ri({id:i}))},onOpenAddress:()=>{const a=Hn(e.tenantEmailDomain??"",ue,i),o=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerEdited,{customerId:i}),t(Ae({id:i,localData:a})),t(Sn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(si({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(ci({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(lt);function Jo(){const t=L(),e=_(),n=Y(),{customer_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=R(),s=k((T=>$e(T,i))),u=s.pageFetchState.fetchState,l=u==="Completed"&&!s.isFormLoading,[S,v]=r.useState(!1),[m,p]=r.useState(!1),[f,I]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&I(i)}),[i,l]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;C.current!=="Error"&&T==="Error"&&t(Fe({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=T}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(te()),t(ie()),()=>{t(te()),t(ie())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(p(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(ti({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(Je({customerId:i}))}),[o,i,t,A]);const F=r.useCallback((T=>t(pn({id:T}))),[t]),U=Z(s.fetchState,s.isFormLoading,i,F);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCustomerDetailPage,isReady:l}),c.jsx(Go,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(te()),i!=null&&A&&t(Je({customerId:i})),v(!0)},onCreatePromotionalCredits:()=>{t(ie()),p(!0)}},U),c.jsx(rt,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:S,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(oi({customerId:i}))},onClose:()=>{v(!1),t(te())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(d.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(ii({customerId:i,data:T})))}}),c.jsx(dt,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:m,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ie())},onSubmit:({amount:T,description:ne})=>{i!=null&&(g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(ai({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:ne})))}})]})}const Wo=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,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerFormCancelled),t(fn({id:i})),t(fe(ue)),e.navigate(`${n}/customers`)},onChange:s=>{t(Ae({id:i,localData:s}))},onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const s=Hn(e.tenantEmailDomain??"",ue,i),u=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerSaved,{mode:a}),t(Sn({id:i}))}}}))(ut);function Yo(){const t=L(),e=_(),n=Y(),{customer_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCustomerId:u}=k((l=>$e(l,i)));return r.useEffect((()=>{o&&i!=null&&t(pn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const l=u??i,S=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(S),t(fn({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCustomerFormPage}),c.jsx(Wo,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const Xo=O((function(t){const e=Se(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:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(d.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(d.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(In({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(gt);function Zo(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=Se(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(We({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(We({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingCustomersListPage,isReady:y}),c.jsx(Xo,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(di(D)),onSortChange:S})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ea=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],l=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:l==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:l==="Not-Started"||l==="In-Progress",isLoadingMore:l==="In-Progress"&&(u?.items.length??0)>0,session:Le(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],l=Le(s,a),S=s.actionStateByKind.retry?.fetchState==="In-Progress",v=s.actionStateByKind.rollback?.fetchState==="In-Progress",m=l?.status==="done"&&l.rollback_available_until!=null&&new Date(l.rollback_available_until).getTime()>Date.now()&&!v;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Fe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(je({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:l?.status!=="failed"||S?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Te(a)))},onRollback:m?()=>{a!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(hn(a)))}:void 0}}))(vt);function na(){const t=L(),e=_(),{sessionId:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),[o,s]=r.useState({}),u=k(Re),l=k(Ie),S=r.useMemo((()=>{const E=J.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:l.tenantId}}),[l.tenantId]),v=Le(u,n),m=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(De(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(je({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const p=v?.status==="scanning"||v?.status==="importing";r.useEffect((()=>{if(!a||n==null||!p)return;const E=setInterval((()=>{t(De(n)),t(je({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,p,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=m?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDataImportDetailPage,isReady:v!=null&&I!=="Not-Started"}),c.jsx(ea,{authParams:S,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const qn=t=>`invoicing_active_migration:${t}`,ce=(t,e)=>{if(t!=null&&t!=="")try{const n=qn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ta=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const s=o??null;t(ae(s)),ce(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(d.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Te(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(hn(o))},onViewSession:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(mt);function ia(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),a=k(Re);r.useEffect((()=>{i&&(t(li()),t(Cn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ta,{navigate:e,tenantEmailDomain:n,view:a})]})}const oa=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:l,sessionDetail:S,sessions:v}=u,m=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),p=n!=null?S[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(m?.isValid??!1),chargebeeConnectorAvailable:m!=null,chargebeeSite:o?.chargebee_site,connectError:l.connect?.error?.message,connecting:l.connect?.fetchState==="In-Progress",retrying:l.retry?.fetchState==="In-Progress",session:p??v.find((f=>f.id===n)),starting:l.start?.fetchState==="In-Progress",uploading:l.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Fe({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(d.Event.invoicingChargebeeConnectClicked),t(vi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(d.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(Te(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportStarted),n!=null&&t(gi(n))},onUpload:o=>{g.trackInvoicingActionClick(d.Event.invoicingImportFileUploaded),t(ui({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(pt);function aa(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),a=k(gn),o=k(Ie),s=r.useMemo((()=>{const h=J.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,l=o.companyId??J.getSignedInUserTenant(n??"")?.companyId,S=k((h=>kn(h,l))),v=k(Re),{activeMigrationSessionId:m}=v,p=m??void 0,f=p!=null?v.sessionDetail[p]??v.sessions.find((h=>h.id===p)):void 0;r.useEffect((()=>{i&&(t(Oe()),t(Cn()))}),[i,t]),r.useEffect((()=>{if(m!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(qn(y))}catch{return null}})(n);h!=null&&t(ae(h))}),[m,t,n]),r.useEffect((()=>{ce(n,m)}),[m,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||p==null||!E)return;const h=setInterval((()=>{t(De(p))}),3e3);return()=>clearInterval(h)}),[i,p,E,t]),r.useEffect((()=>{I==="done"&&(t(ae(null)),ce(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDataImportMigratePage}),c.jsx(oa,{activeId:p,authParams:s,integrationsView:S,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:v,onBack:()=>{t(ae(null)),ce(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ca=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{g.trackInvoicingActionClick(d.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(En({action:a,id:i}))},onSaveEdit:a=>{g.trackInvoicingActionClick(d.Event.invoicingCouponEdited,{couponId:i}),t(pi({data:a,id:i}))}}}))(St);function sa(){const t=L(),e=_(),{coupon_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),o=k((I=>mi(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,l=u==="Completed",[S,v]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&v(n)}),[n,l]);const m=S===n;r.useEffect((()=>(t(le({id:n})),()=>{t(le({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(xe({id:n}))}),[a,n,t]);const p=r.useCallback((I=>t(xe({cacheOverride:!0,id:I}))),[t]),f=Z(o.fetchState,o.isFormLoading,n,p);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDiscountDetailPage,isReady:l}),c.jsx(ca,{hasLoadedRecord:m,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const ra=O((function(t){const e=yn(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=>{g.trackInvoicingActionClick(d.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(d.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(En({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(ft);function da(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=yn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ye({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(ra,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(Si(b)),onSortChange:S})]})}const la=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(Q({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(Q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(Q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(Q({action:"retry",id:i}))}:void 0}}))(ht);function ua(){const t=L(),e=_(),{case_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),o=k((C=>Ii(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[l,S]=r.useState("idle"),[v,m]=r.useState(!1),[p,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{S("idle"),m(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(hi({id:n})),S("idle"),m(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&l!=="pending"&&(m(!1),S("pending"),g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(Q({action:"send-email",body:C,id:n})))}),[n,t,l,o.dunningCase]),b=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(Ci({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(he({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{S("idle"),m(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(S("idle"),m(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&p==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,p,I]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?v&&o.actionState.fetchState==="Completed"?(n!=null&&t(ki({id:n})),h()):v&&o.actionState.fetchState==="Error"&&S("failed"):m(!0))}),[n,h,t,l,v,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(la,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(It,{initialDraft:p,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const ga=O((function(t){const e=bn(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`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};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:a=>{g.trackInvoicingActionClick(d.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(d.Event.invoicingDunningAction,{...i(a),action:o}),t(Q({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(yi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ct);function va(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=bn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDunningListPage,isReady:D}),c.jsx(ga,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(Ei(b)),onSortChange:S})]})}const ma=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,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(d.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(H({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail"}),t(xi({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
2
+ `).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(H({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(H({action:"void",invoiceId:i,body:s}))}}}))(kt);function pa(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),o=k((f=>xn(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[l,S]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&S(n)}),[n,u]);const v=l===n;r.useEffect((()=>{a&&n!=null&&t(bi({invoiceId:n}))}),[a,n,t]);const m=r.useCallback((f=>t(he({invoiceId:f}))),[t]),p=Z(o.actionState.fetchState,o.fetchState==="In-Progress",n,m);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(ma,{invoiceId:n??"",hasLoadedRecord:v,navigate:e,tenantEmailDomain:i,view:o},p)]})}const Sa=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`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(d.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(d.Event.invoicingInvoiceReminderSent,i(a)),t(H({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(d.Event.invoicingInvoiceRegenerated,i(a)),t(H({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,i(a)),t(H({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(d.Event.invoicingInvoiceVoided,i(a)),t(H({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(Dn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Et);function fa(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=An(A);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:C.nextCursor,invoiceListFetchState:C.fetchState,voidingInvoiceId:C.runningActionId,invoices:C.invoices}}),q),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(Ee({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Sa,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(Ai(A)),t(Ee({cacheOverride:!1,filters:m,sort:v}))},onSortChange:S})]})}function on(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),i=yt(),a=rn(),[o,s]=r.useState(!1),{acceptTermsState:u,status:l}=k(jn),S=Di(i?.loggedInUserRoleMap),v=`/${n}/invoicing`,m=p=>{s(p)};return l==="completed"?c.jsx(V,{to:`${v}/overview`,replace:!0}):l==="settings"&&S?c.jsx(V,{to:`${v}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingPromoPage}),c.jsx(jo,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),c.jsx(bt,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!S,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(d.Event.invoicingTermsAccepted),t(ji())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Ia=O((function(t,e){const n=Ln(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t($i({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(wi())}}}))(xt);function ha(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:l,submitState:S}=k((f=>Ln(f,n??""))),v=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(Li()),m.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(he({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&m.current!==n&&(m.current=n,t(_i({localData:Pi(s)})))}),[t,o,s,n]);const p=r.useRef(S.fetchState);return r.useEffect((()=>{const f=p.current;p.current=S.fetchState,f!=="Completed"&&S.fetchState==="Completed"&&l!=null&&e(`${v}/credits/${encodeURIComponent(l)}`)}),[l,e,S.fetchState,v]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(Ia,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Ca=O((function(t){return{invoicingOverview:_n(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(d.Event.invoicingOverviewRefreshed),t(Pn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(d.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(d.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(At);function ka(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>_n(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Pn(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingOverviewPage,isReady:o}),c.jsx(Ca,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const Ea=O((function(t){const e=wn(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:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Ri({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Dt);function ya(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:p,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const F=wn(j);return{activeType:F.activeTab,appliedSearch:F.filters.search,appliedSort:F.sort,nextCursor:F.nextCursor,transactionListFetchState:F.fetchState,transactions:F.transactions}}),q),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const F=y.find((T=>T.id===j)),U=F?.linkedInvoices?.[0]?.invoiceID??F?.invoiceID;U!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const F=y.find((U=>U.id===j))?.customerID;F!=null&&(g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:F,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(F)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeType:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(Fi(j)),t(ye({cacheOverride:!1,filters:m,sort:v}))},onSortChange:S,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const ba=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 an(){const t=L(),e=_(),{invoice_id:n,tenantEmailDomain:i}=$(),{areTenantIdsInSync:a}=R(),o=n!=null&&n!=="",s=k(Se),u=k((C=>Ti(C))),l=k(Oi),S=k((C=>xn(C,n??""))),v=S.invoice,m=`/${i}/invoicing`,p=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Mi()),p.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?he({invoiceId:n}):In({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&v!=null&&n!=null&&S.fetchState==="Completed"&&p.current!==n&&(p.current=n,t(Ni({contextInvoiceId:n,localData:Ui(v)})))}),[t,v,n,S.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Dn({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(Ze({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=l.fetchState,C!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:ba(C)})))),[s.customers]),h=k((C=>Bi(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,F=Vi.currencySymbol,_t("0,0.00",j,F)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,F}))),[h]),D=r.useMemo((()=>{if(!o||v==null)return;const C=v.currencyCode??"USD",j=v.amountDue?.amount??0;return{amountDue:jt("0,0.00",v.amountDue),amountDueValue:j,currencyCode:C,customerName:v.customerName??v.customerID,invoiceId:v.id,invoiceNumber:v.invoiceNumber??v.id}}),[v,o]),b=o?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,A=!o||S.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(Lt,{customers:E,fieldHelp:u.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:l.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(Ze({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Hi(o?n??void 0:void 0))}})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},xa=O((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.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,a=i!=="",o=(s,u)=>{const{subscription:l}=e.editView;g.trackInvoicingActionClick(d.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:l?.mrr?.amount,customerId:l?.customerID,fromScreen:"subscription_detail",status:l?.status,subscriptionId:i}),t(Fn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(ge({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(fe(ve)),t(zi({id:i}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",ve,i),u=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onSaveEdit:s=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ge({id:i,localData:s})),t($n({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))(Pt);function Aa(){const t=L(),e=_(),n=Y(),{subscription_id:i,tenantEmailDomain:a}=$(),{areTenantIdsInSync:o}=R(),s=k((y=>Me(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:S}=s,v=s.pageFetchState.fetchState,m=v==="Completed"&&!s.isFormLoading,[p,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=p===i;Ce(o),r.useEffect((()=>{o&&i!=null&&t(qi({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(Qi({id:y}))),[t]),h=Z(s.fetchState,s.isFormLoading,i,E);return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingSubscriptionDetailPage,isReady:m}),c.jsx(xa,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:S,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const Da=O((function(t,e){const n=Me(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,a=i!=null?"edit":"create";return{onCancel:()=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionFormCancelled),t(Rn({id:i})),t(fe(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(ge({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const o=Qn(e.tenantEmailDomain??"",ve,i),s=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionSaved,{mode:a}),t($n({id:i}))}}}))(wt);function ja(){const t=L(),e=_(),n=Y(),{subscription_id:i,tenantEmailDomain:a}=$(),[o]=W(),{areTenantIdsInSync:s}=R(),u=o.get("customerId"),{fetchState:l,savedSubscriptionId:S}=k((p=>Ki(p,i))),v=k((p=>Me(p,i).localData));Ce(s),r.useEffect((()=>{s&&t(Gi({subscriptionId:i}))}),[s,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||u==null||u===""||v.customerId!==""||(m.current=!0,t(ge({id:i,localData:{...v,customerId:u}})))}),[u,i,v,t]),r.useEffect((()=>{if(l==="Completed"){const p=S??i,f=p!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(p)}`:`/${a}/invoicing/subscriptions`;e(f),t(Rn({id:i}))}}),[l,S,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingSubscriptionFormPage}),c.jsx(Da,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const La=O((function(t){const e=Tn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,s)=>{const u=e.subscriptions.find((l=>l.id===a));g.trackInvoicingActionClick(d.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Fn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(d.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(d.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(Yi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))($t);function _a(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[l,S]=r.useState(null),v=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Tn(C);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),q),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||v?.field!==I?.field||v?.dir!==I?.dir)&&t(en({cacheOverride:!0,filters:m,sort:v}))}),[i,t,m,v,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(Ji())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(La,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:l,filters:m,sort:v,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(Wi(C)),onSortChange:S})]})}const Pa=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(d.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(d.Event.invoicingTransactionCaptured,{transactionId:i}),t(eo({action:"capture",id:i}))}:void 0}}))(Ft);function wa(){const t=L(),e=_(),{tenantEmailDomain:n,transaction_id:i}=$(),{areTenantIdsInSync:a}=R(),o=k((u=>Xi(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(Zi({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(Pa,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function zn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=R(),u=k(Ne),l=u.connection?.connected===!0,S=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&S!=="Not-Started"||o(On()),n&&o(no()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&l&&i&&o(to())}),[s,o,e,l,i]),{isQboConnected:l,qboView:u}}const $a={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ee(t){const e=L(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=$(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:l,stripeConnectState:S}=k(io),{configError:v,configFetchState:m,dunningScheduleActionOptions:p,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Mn),h=k(Ne);zn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(Ie),D=t==="dunning"||t==="quickbooks",b=y.companyId??J.getSignedInUserTenant(i??"")?.companyId,A=k((P=>kn(P,b))),C=oo(y.userRole??[]),j=y.tenantId??"",F=J.getSignedInUser(),U={userId:F?.userId??"",sessionId:F?.zeniSessionId??"",tenantId:j},T=s?.fileId,ne=k((P=>T!=null&&T!==""?ao(P,T):void 0)),Ue=k((P=>T!=null&&T!==""?co(P,T):void 0)),Kn=T!=null&&T!==""&&ne!=null?{[T]:ne}:{},Gn=T!=null&&T!==""&&Ue!=null?{[T]:Ue}:{};r.useEffect((()=>(e(nn()),()=>{e(nn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Oe()))}),[n,e,a]),r.useEffect((()=>{n&&D&&m==="Not-Started"&&e(me())}),[n,e,m,D]),r.useEffect((()=>{if(!n)return;const P=F?.userId;P!=null&&P!==""&&j!==""&&He.shouldFetchActiveTenant(j)&&(He.markActiveTenantFetchStarted(j),e(so(P,j,F?.zeniSessionId)))}),[n,e,F?.userId,F?.zeniSessionId,j]);const Jn=p.length>0||f.length>0,Wn=a==="Not-Started"||a==="In-Progress"&&l==null||D&&!Jn&&(m==="Not-Started"||m==="In-Progress"),Yn=a==="Completed"&&(!D||m==="Completed"),Be=A.externalConnections?.revenue?.find((P=>P.connectionName==="chargebee"))?.connectionId,ke=se?.invoicingMicroServiceBaseUrl,Ve=ke!=null&&ke.length>0?`${ke}/1.0/webhooks/stripe`:"",z={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:S.fetchState==="In-Progress",onConnectStripe:P=>{g.trackInvoicingActionClick(d.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(fo(P))},onDisconnect:(P,B)=>{j!==""&&(g.trackInvoicingActionClick(d.Event.invoicingIntegrationDisconnected,{entity:B,entityId:P,fromScreen:t??"hub"}),e(So(j,P,tn(B))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(d.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(po())},onReconnectQBO:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const P=y.tenantEmailDomain??i??"";pe.init("/connection/auth",P),pe.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Bn()))},onSaveChargeBeeCredentials:(P,B)=>{Be!=null&&j!==""&&(g.trackInvoicingActionClick(d.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(vo(j,Be,tn("revenue"),mo("chargebee"),{api_key:P,site:B})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve};return{authParams:U,deleteFileStatusById:Kn,fieldHelp:o,dunningScheduleActionOptions:p,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:z,isInvoicingPageReady:Yn,isLoading:Wn,isSaving:u.fetchState==="In-Progress",isStripeBusy:S.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&m==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ve,updateFileStatusById:Gn,onConnectStripe:z.onConnectStripe,onDeleteFile:P=>{g.trackInvoicingActionClick(d.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(go(P,j))},onDisconnectStripe:z.onDisconnectStripe,onEditFileName:(P,B)=>{g.trackInvoicingActionClick(d.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(uo(P,B.split(".")[0],j))},onReconnectQBO:z.onReconnectQBO,onRefreshQBO:z.onRefreshQBO,onRetryQboSyncTask:P=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"retry_task",entityId:P,fromScreen:t??"hub"}),e(Un(P))},onSave:P=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{fieldsChanged:Object.keys(P).filter((B=>JSON.stringify(P[B])!==JSON.stringify(l?.[B]))),tab:t??"hub"}),e(lo({settings:P,snackbarSection:$a[t??""]}))},onStartQboBackfill:P=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Nn(P))},updateFilesEntity:P=>{g.trackInvoicingActionClick(d.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(ro({files:P}))}}}function cn({appContent:t}){const e=_(),n=Y(),i=L(),{tenantEmailDomain:a}=$(),o=ee("branding"),s=k((l=>Io(l)));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&i(ho())}),[s.saveState.fetchState,i]);const u=_e(s.saveState.fetchState);return r.useEffect((()=>{u==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[u,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Rt,{address:s.address,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:l=>{i(Eo({localData:l}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(d.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const l=`/${a}/invoicing/settings/branding/${ko}/`,S=X(n.state?.pathnameStackToGoBack,n.pathname);e(l,{state:{pathnameStackToGoBack:S}})},onSubmit:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{tab:"branding"}),i(Co())},updateFilesEntity:o.updateFilesEntity})]})}function Fa(){const t=_(),e=ee("dunning");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Tt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Ra(){const t=_(),e=ee("integrations");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Ot,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ta(){const t=_(),e=ee("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Mt,{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 Oa=["autoCreateItems","closedPeriodVoidAsCreditMemo","customerMatching","isSyncEnabled","syncStartDate","trackingCategoriesEnabled"],Ma=O((function(t){const e=Vn(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(xo({localData:e}))},onReset:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(bo())},onRetryTask:e=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Un(e))},onStartBackfill:e=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Nn(e))}}}))(Nt);function Na(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),i=k(Ie),{configFetchState:a,localData:o,savedLocalData:s,saveState:u,settingsFetchState:l}=k(Vn),S=r.useMemo((()=>{return m=o,p=s,[...[...new Set([...Object.keys(m.accountIdByMappingCode),...Object.keys(p.accountIdByMappingCode)])].some((f=>(m.accountIdByMappingCode[f]??"")!==(p.accountIdByMappingCode[f]??"")))?["account_mappings"]:[],...Oa.filter((f=>m[f]!==p[f]))];var m,p}),[o,s]),v=_e(u.fetchState);return r.useEffect((()=>{v==="In-Progress"&&u.fetchState==="Completed"&&e("..")}),[e,v,u.fetchState]),r.useEffect((()=>{l!=="Not-Started"&&l!=="Error"||t(Oe())}),[t,l]),r.useEffect((()=>{a==="Not-Started"&&t(me())}),[a,t]),zn({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingQboSettingsPage}),c.jsx(Ma,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),pe.init("/connection/auth",i.tenantEmailDomain??n??""),pe.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(d.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Bn())},onSave:()=>{g.trackInvoicingActionClick(d.Event.invoicingSettingsSaved,{fieldsChanged:S,tab:"quickbooks"}),t(yo())}})]})}const Ua={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Ba(){const t=rn(),e=L(),n=_(),[i,a]=W(),o=ee(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:l,isQboConfigured:S,isStripeConnected:v}=k(Mn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const p=Ua[m];a({},{replace:!0}),p!=null&&n(p,{replace:!0})}),[m,n,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:d.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ut,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:S,isStripePaymentsReady:v,onEnableInvoicingClick:l?void 0:()=>{g.trackInvoicingActionClick(d.Event.invoicingEnableClicked),e(Ao())}})]})}function sn(){return c.jsxs(oe,{children:[c.jsx(x,{index:!0,element:c.jsx(Ba,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Ta,{})}),c.jsx(x,{path:"branding",element:c.jsx(cn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(cn,{appContent:c.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Ra,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Fa,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Na,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:"..",replace:!0})})]})}function pc(){const t=L(),e=_(),{tenantEmailDomain:n}=$(),{areTenantIdsInSync:i}=R(),{enableState:a,fetchState:o,status:s}=k(jn),u=_e(a.fetchState),l=`/${n}/invoicing`,S=r.useRef(!1),v=k((m=>Ne(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||S.current||(S.current=!0,t(me({cacheOverride:!1}))):t(me({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&v==="Not-Started"&&t(On())}),[i,t,v]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),t(Do()))}),[u,a.fetchState,l,t,e]),s==null&&o!=="Error"?c.jsx(Bt,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(oe,{children:[c.jsx(x,{path:"promo",element:c.jsx(on,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:`${l}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(oe,{children:[c.jsx(x,{path:"promo",element:c.jsx(on,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(sn,{})}),c.jsx(x,{path:"*",element:c.jsx(V,{to:`${l}/settings`,replace:!0})})]}):c.jsxs(oe,{children:[c.jsx(x,{path:"/",element:c.jsx(V,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(ka,{})}),c.jsx(x,{path:"promo",element:c.jsx(V,{to:`${l}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(Zo,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(Yo,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(Jo,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(_a,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(ja,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(Aa,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"invoices",element:c.jsx(fa,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Ho,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(pa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(an,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(ha,{})}),c.jsx(x,{path:"payments",element:c.jsx(ya,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(an,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(wa,{})}),c.jsx(x,{path:"credits",element:c.jsx(Ko,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(Qo,{})}),c.jsx(x,{path:"discounts",element:c.jsx(da,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Bo,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(sa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(va,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ua,{})}),c.jsx(x,{path:"catalog",element:c.jsx(No,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(To,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(wo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(sn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(Lo,{})}),c.jsx(x,{path:"data_import",element:c.jsx(ia,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(aa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(na,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{pc as default};
@@ -1,4 +1,4 @@
1
- import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as L,N as te,n as ne,o as p}from"./core-BTxe1IJ4.js";import{UA as k,UB as v,UC as T,JE as B,Jq as U,UD as D,UE as oe,UF as ie,Ju as se,gl as $,JB as le,Jy as re}from"./zeni-epic-state-EEoBiaeS.js";import{a1 as x,M as r,a2 as de,k as j,Y as G,a3 as ce,a4 as me,a5 as pe,p as J,_ as ue,f as he,a6 as ge,c as xe,E as fe,g as be,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as ve,ab as je,ac as $e}from"./index-t_YINWfi.js";import{n as m}from"./mui-CoXsq-BK.js";import f from"./NotFoundScreen-CT9mXoPL.js";import{a as I}from"./sentry-CXDuPEuw.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.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]="66a9dbcb-a4a8-440f-8c83-59f06f2318aa",e._sentryDebugIdIdentifier="sentry-dbid-66a9dbcb-a4a8-440f-8c83-59f06f2318aa")}catch{}})();const Ie=m.div`
1
+ import{j as a}from"./liveblocks-Du6nrW5U.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as L,N as te,n as ne,o as p}from"./core-CJWbgnFM.js";import{UE as k,UF as v,UG as T,JF as D,Jr as U,UH as B,UI as oe,UJ as ie,Jv as se,gl as $,JC as le,Jz as re}from"./zeni-epic-state-DUCBgtEU.js";import{a1 as x,M as r,a2 as de,k as j,Z as G,a3 as ce,a4 as me,a5 as pe,p as M,W as ue,y as he,a6 as ge,D as xe,E as be,f as fe,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as ve,ab as je,ac as $e}from"./index-DvSod3qd.js";import{n as m}from"./mui-dbvYX-CF.js";import b from"./NotFoundScreen-CNN7HdXS.js";import{a as I}from"./sentry-DlU3V0QD.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.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]="6d41a82d-fcb2-4abb-8edb-6baa9a4663ee",e._sentryDebugIdIdentifier="sentry-dbid-6d41a82d-fcb2-4abb-8edb-6baa9a4663ee")}catch{}})();const Ie=m.div`
2
2
  display: flex;
3
3
  height: 100%;
4
4
  width: 100%;
@@ -7,7 +7,7 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
7
7
  align-items: center;
8
8
  background-color: ${e=>e.theme.colors.grey4};
9
9
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
- `,Ce=g((function(e){const t=k(e),n=v(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(B(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:t,billId:n}=S();return t==null||n==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Ie,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const Be=m.div`
10
+ `,Ce=g((function(e){const t=k(e),n=v(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;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:t,billId:n}=S();return t==null||n==null?a.jsx(b,{}):a.jsx(a.Fragment,{children:a.jsx(Ie,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const De=m.div`
11
11
  display: flex;
12
12
  height: 100vh;
13
13
  width: 100%;
@@ -16,7 +16,7 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
16
16
  align-items: center;
17
17
  background-color: ${e=>e.theme.colors.grey4};
18
18
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,De=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:D(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=Ee(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(Be,{windowSize:o,children:a.jsx(De,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},Ee=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}),ze=m.div`
19
+ `,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(De,{windowSize:o,children:a.jsx(Be,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ee=m.div`
20
20
  display: flex;
21
21
  height: 100%;
22
22
  width: 100%;
@@ -25,7 +25,7 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
25
25
  align-items: center;
26
26
  background-color: ${e=>e.theme.colors.grey4};
27
27
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ne=g((function(e){const t=k(e),n=v(e),o=D(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(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 Le(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(ze,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
28
+ `,Ne=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(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=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Le(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(b,{}):a.jsx(a.Fragment,{children:a.jsx(Ee,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
29
  display: flex;
30
30
  height: 100%;
31
31
  width: 100%;
@@ -34,7 +34,7 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
34
34
  align-items: center;
35
35
  background-color: ${e=>e.theme.colors.grey4};
36
36
  box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Te=g((function(e){const t=k(e),n=v(e),o=D(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(B(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Fe,{windowSize:n,children:a.jsx(Te,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Je=m(ke)`
37
+ `,Te=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(b,{}):a.jsx(Fe,{windowSize:n,children:a.jsx(Te,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Me=m(ke)`
38
38
  width: ${r.sp4};
39
39
  height: ${r.sp4};
40
40
  margin-bottom: ${r.sp3};
@@ -43,14 +43,14 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
43
43
  cursor: pointer;
44
44
  position: absolute;
45
45
  color: ${e=>e.theme.colors.brandColorJade};
46
- `,Me=m.div`
46
+ `,He=m.div`
47
47
  display: flex;
48
48
  height: 100vh;
49
49
  flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
50
  width: 100vw;
51
51
  overflow-y: scroll;
52
52
  background-color: ${e=>e.theme.colors.grey4};
53
- `,He=m.div`
53
+ `,Je=m.div`
54
54
  display: flex;
55
55
  flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
56
  flex-direction: column;
@@ -69,4 +69,4 @@ import{j as a}from"./liveblocks-BOLtmXrt.js";import{i as S,l as g,h as C,g as y,
69
69
  width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
70
  background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
71
  margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,_e=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),M=n.pathname.includes("address"),b=x(),H=xe(),A=fe(),w=be(),V=()=>{H.toggle()},_=L((u=>k(u))),K=L((u=>v(u))),{authParams:W,fetchState:c,billAttachment:O,billFetchState:P,companyName:Y,currencySymbol:q,amount:Q}=_,{tenantId:E,userId:z,sessionId:N}=W,{fetchState:R,internationalBankAccountCreateStatus:X}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[w,c,i,o,d,t]),I.useEffect((()=>{w&&c==="Completed"&&($(z,N,E),l!=null&&t(re(l)))}),[c,w,z,N,E,l,t]),c==="Error"?a.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?($(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",Y,l??"",Ke(n.pathname),q,Q))(u)}),a.jsxs(Me,{windowSize:b,children:[b!=="small"?a.jsx(Je,{onClick:V}):null,a.jsx(Ve,{windowSize:b,isAddressPage:M,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(_e,{file:O,type:"bill"})}),a.jsx(He,{windowSize:b,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return a.jsx($e,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(We,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Le,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ue,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{da as default};
72
+ `,We=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),H=n.pathname.includes("address"),f=x(),J=xe(),A=be(),w=fe(),V=()=>{J.toggle()},W=L((u=>k(u))),_=L((u=>v(u))),{authParams:K,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:Z}=W,{tenantId:z,userId:E,sessionId:N}=K,{fetchState:R,internationalBankAccountCreateStatus:X}=_;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[w,c,i,o,d,t]),I.useEffect((()=>{w&&c==="Completed"&&($(E,N,z),l!=null&&t(re(l)))}),[c,w,E,N,z,l,t]),c==="Error"?a.jsx(b,{}):R==="Completed"||X.fetchState==="Completed"?($(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:j,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",_e(n.pathname),Q,Z))(u)}),a.jsxs(He,{windowSize:f,children:[f!=="small"?a.jsx(Me,{onClick:V}):null,a.jsx(Ve,{windowSize:f,isAddressPage:H,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(We,{file:q,type:"bill"})}),a.jsx(Je,{windowSize:f,children:e})]})]})}const _e=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ke(){return a.jsx($e,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Ke,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Le,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ue,{})})}),a.jsx(p,{path:"*",element:a.jsx(b,{})})]})}export{da as default};
@@ -0,0 +1,12 @@
1
+ import{j as u}from"./liveblocks-Du6nrW5U.js";import{a as f}from"./sentry-DlU3V0QD.js";import{u as O,g as _,h as w,t as A,j as l,N as L}from"./core-CJWbgnFM.js";import{z as r,E as M,G as P,T as V,k as N,U as X,_ as $,$ as B,X as G}from"./index-DvSod3qd.js";import{fI as R,U7 as W,UA as q,Ur as H,gl as J,gn as K,Uw as Q,gX as Y,dk as Z,UB as ee,UC as te}from"./zeni-epic-state-DUCBgtEU.js";import{n as ne}from"./mui-dbvYX-CF.js";import{u as se}from"./useDeviceId-CDXz5n2o.js";import{f as ie}from"./analyticsHelper-BvcLZ--H.js";import{t as ae}from"./getLocaleForTenant-DDk9eOPJ.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="384996f5-5624-4470-974d-63f32ceff989",t._sentryDebugIdIdentifier="sentry-dbid-384996f5-5624-4470-974d-63f32ceff989")}catch{}})();const T=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function Te(){const t=O(),i=_(),m=w(),[y]=A(),n=y.get("token"),p=y.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),a=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>R(e))),k=l((e=>W(e))),D=r.getSignedInUser(),v=M().mode;f.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&a!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(q(n,a,g)))}),[n,p,t,a,g,s?.zeniSessionId]),f.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(k.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=G();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(X.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,i.state,t]);const E=f.useCallback((()=>{m("/signin/auth")}),[m]),j=f.useCallback((()=>{a!=null&&d!=null&&c!=null&&t(ee(a,c,d))}),[a,d,t,c]),F=f.useCallback((e=>{a!=null&&n!=null&&c!=null&&d!=null&&t(te(e,a,c,d))}),[a,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx($,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=i.state?.origin??"/";return u.jsx(L,{to:e,state:{...i.state,origin:""}})}if(!T(n,p)||g==null||h==="Error"){const e=i.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(B,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ z-index: 9999;
11
+ background-color: ${t=>t.theme.colors.background};
12
+ `;export{Te as default};
@@ -0,0 +1 @@
1
+ import{j as B}from"./liveblocks-Du6nrW5U.js";import{a as m}from"./sentry-DlU3V0QD.js";import{u as te,j as t,i as $e,g as Ge,h as Ue,q as F}from"./core-CJWbgnFM.js";import{fI as ne,U8 as Me,U9 as se,gc as Ne,fH as xe,Ui as Pe,Ub as Re,Uc as Ve,q2 as Le,gp as Oe,Uf as h,Uk as je,Ul as Q,gq as qe,Um as He,Ei as Ze,h4 as ze,cW as We,Un as Ye,gb as Je,gr as Ke}from"./zeni-epic-state-DUCBgtEU.js";import{w as Qe,i as Xe,D as ea,W as aa,c as ta,f as na,u as sa,y as c,g as oa,e as ia,z as ra,d as da,l as ca,n as la,v as ua,o as ma,q as X,L as fa,I as ba,J as ha,p as S,k as ee,B as pa,N as ae,F as ga,H as Sa}from"./index-DvSod3qd.js";import{D as ka}from"./mui-dbvYX-CF.js";import{u as Ea}from"./InboxNotificationsProvider-CrlYLYr4.js";import{u as Ca}from"./useTaskManagerAccess-OslA3wOO.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]="c316b44a-1cb6-42af-8cc3-a21eca8b3096",l._sentryDebugIdIdentifier="sentry-dbid-c316b44a-1cb6-42af-8cc3-a21eca8b3096")}catch{}})();const Ta=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),k=ea(),n=Ue(),D=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>xe(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,U]=m.useState(void 0),v=F("/:tenantEmailDomain/dashboard")!==null,M=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,N),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),x=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),A=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&A.fetchState==="Not-Started"&&r(Le(!0))}),[C,T,A.fetchState,f]);const _=t((e=>e.tenantState)),me=t((e=>_.fetchState==="Completed"?Oe(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:be}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:he}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),ke=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=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)),L=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:j,isFetchingMore:q,hasFetchedAll:H,fetchMore:Te}=Ea();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(j===!1&&q===!1&&H===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;U(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else U(0)}),[j,q,H]),m.useEffect((()=>{C&&E&&!f&&L.fetchState==="Not-Started"&&D.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,E,f,L.fetchState,D.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:Ee},Z=s!=null?ra.getSignedInUserTenant(s):null,z=t((e=>Z?.tenantId!=null?qe(e,Z.tenantId):void 0)),b=[];fe===!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 W=t((e=>He(e,b).fetchState)),Y=t((e=>Ze(e).fetchState)),ye=v&&(W==="Completed"||W==="Error")||M&&(Y==="Completed"||Y==="Error")||!v&&!M?void 0:"disabled",we=m.useMemo((()=>ze(o.userRole)),[o.userRole]),ve=We(we),Ae=o?.rewardsLastViewedTime==null,_e=p?.userEmail!=null&&x.fetchState==="Completed"&&Ye(x.notificationSettings,p.userEmail,N,o,E),J=da(),Fe=J&&ca(a);return B.jsx(ka,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:B.jsx(la,{signedInUser:p,currentTenantId:_.currentTenantId??"",tenants:_.fetchState==="Completed"?me:z!=null?[z]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:ve,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:ke,isNotificationsTabVisible:_e,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:Ae,rewardsPlan:A.rewardsPlan},isAiCfoAccessEnabled:J,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=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:S(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),K=e.type,Be=ae(K)&&K!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),Be&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const De=ga(e.type);Sa(e.type)?(G!=null&&r(Ke()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${De}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ba({dispatch:r,navigate:n,pathToNavigate:ha(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{k.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:v,updateCurrentChatSessionId:e=>{r(Je({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Da=l=>{const i=te(),s=t((k=>ne(k))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(k,n)=>{Xe(n)&&Me(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return B.jsx(Ta,{...l,...a})};export{Da as M};
@@ -0,0 +1 @@
1
+ import{j as e}from"./liveblocks-Du6nrW5U.js";import{h as r,l as i}from"./core-CJWbgnFM.js";import{am as n}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import"./sentry-DlU3V0QD.js";import"./zeni-epic-state-DUCBgtEU.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
@@ -0,0 +1 @@
1
+ import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-Du6nrW5U.js";import ut from"./NotFoundScreen-CNN7HdXS.js";import{a as k}from"./sentry-DlU3V0QD.js";import{h as ht,g as pt,i as kt,u as gt,j as b,l as bt,n as St,o as O}from"./core-CJWbgnFM.js";import{cB as It,Ub as Y,fI as J,h4 as Tt,Uf as S,a19 as Q,Ul as m,U9 as y,Ay as F,Gf as Ct,a1a as At,U8 as yt,Un as Et,AD as _t,a1b as $,br as j,gk as x,AH as X,a1c as Nt,cN as Bt,cG as wt}from"./zeni-epic-state-DUCBgtEU.js";import{aq as xt,c as Ut,W as vt,y as Dt,as as Gt,dK as Rt,p as B,dL as Pt,w as Mt,dM as $t,i as jt,a4 as Ft}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-DDS1YL8l.js";import{u as Wt}from"./useTaskManagerAccess-OslA3wOO.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.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]="930883b8-b49f-4494-8924-c032b817060d",t._sentryDebugIdIdentifier="sentry-dbid-930883b8-b49f-4494-8924-c032b817060d")}catch{}})();const qt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),Lt=bt((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=S(t),f=J(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=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t($([a],j())));let i=`/${h}/${r[1]}`;const T=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(Q(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(F("task_manager","dashboard",d))}else v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t($([i],j())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),qt(o,I).then((()=>{t($(o,j())),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=Ft(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt($t)),zt=()=>{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=b((e=>Y(e))),s=b((e=>J(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Gt({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=b((e=>S(e).notificationDetailsByTab.tasks.fetchState)),W=b((e=>S(e).currentTab)),D=b((e=>S(e).currentSubTab)),tt=b((e=>S(e).notificationDetailsByTab.comments.fetchCountState)),G=b((e=>S(e).notificationDetailsByTab.comments.fetchState)),et=b((e=>S(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=b((e=>S(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:w,isLoading:E,hasFetchedAll:C,isFetchingMore:R,fetchMore:ot}=mt(),{threads:q,isLoading:L,fetchMore:z,isFetchingMore:H,hasFetchedAll:K}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(W!==c&&c!=null&&o(Q(c)),c==null){const e=`../${W}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&w!=null){const e=`dashboard_${s.companyId}`,p=w.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(F("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=E||R===!0||C!==!0||E||R===!0||C!==!0;k.useEffect((()=>{P&&G!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||G!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,G]),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&&L===!1&&w!=null&&q!=null){const e=`dashboard_${s.companyId}`,p=w.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=q.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}:(H||K===!0||z==null||z(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,R,H,C,K,L,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(jt(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(F("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Wt(f);return N.jsx(Lt,{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(St,{children:[N.jsx(O,{path:"/:selectedTab",element:N.jsx(zt,{})}),N.jsx(O,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
@@ -0,0 +1 @@
1
+ import{j as m}from"./liveblocks-Du6nrW5U.js";import{a as r}from"./sentry-DlU3V0QD.js";import{u as A,g as P,j as o,N as j}from"./core-CJWbgnFM.js";import{UO as C,fI as R,gp as x,UP as z,UQ as D,UR as M,US as L,pV as k,Tt as N}from"./zeni-epic-state-DUCBgtEU.js";import{z as h,ah as I}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="c7e15d0f-8386-4c7a-8877-066d040fdca4",n._sentryDebugIdIdentifier="sentry-dbid-c7e15d0f-8386-4c7a-8877-066d040fdca4")}catch{}})();function ee(){const n=A(),s=P(),{params:t,error:i}=r.useMemo((()=>C(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),p=h.isSignedIn(),a=h.getSignedInUser(),f=o((e=>R(e))),l=o((e=>x(e))),d=o((e=>e.tenantState.fetchState)),y=o(z),S=o(D),c=o(M),[U,v]=r.useState(null),[E,b]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&a!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[p,a,d,n]),r.useEffect((()=>{c!=null&&c!==""&&(window.location.href=c)}),[c]);const _=r.useMemo((()=>{if(f?.tenantId!=null)return f.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[f?.tenantId,l]),u=U??_;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):p?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:v,approveError:E??S,isApproving:y==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&a!=null&&u!=null&&n(N(a.userId,a.zeniSessionId??void 0,u,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{b("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(j,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
@@ -0,0 +1 @@
1
+ import{j as n}from"./liveblocks-Du6nrW5U.js";import{h as W,u as Y,g as z,i as H,j as d,l as Q,n as J,o as S}from"./core-CJWbgnFM.js";import{fI as v,Aj as R,vb as K,VG as M,v6 as C,bq as X,c0 as Z,v7 as ee,VH as ae,Vo as y,ek as te,E7 as se,VI as oe,Ev as re,e0 as ne,d$ as ce}from"./zeni-epic-state-DUCBgtEU.js";import{ai as ie,z as le,aq as de,as as me,Q as fe,a8 as pe,k as w,aD as ue,p as he,W as Fe,y as ge}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import Ie from"./NotFoundScreen-CNN7HdXS.js";import{F as be}from"./FeaturePreviewScreen-zypoS_dA.js";import{a as F}from"./sentry-DlU3V0QD.js";import{u as Se}from"./useAskAiCfoHostNavButtonProps-DDS1YL8l.js";import{u as ye}from"./useInitialThreadRequest-CWExIS9V.js";import{t as Ce}from"./routePaths-5zdijNTw.js";import{M as Te}from"./MobileAppDrawer-DqkcDASf.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";import"./InboxNotificationsProvider-CrlYLYr4.js";import"./useTaskManagerAccess-OslA3wOO.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]="1dcea4ca-e2d7-4c7e-910a-5419214b9c89",s._sentryDebugIdIdentifier="sentry-dbid-1dcea4ca-e2d7-4c7e-910a-5419214b9c89")}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})}},Ae=Q((function(s){const e=ae(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:w}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(M(a,o)),e.isPandLReportFetched(a)||s(C(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(re(a))},onForecastVsActualsCompareToggle:a=>{s(oe(a)),s(y({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(se(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=te(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=Ce(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=he(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(y({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(y({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(ue);function U(){const s=ie(),e=W(),a=Y(),o=z(),{forecastId:r,tenantEmailDomain:c}=H(),[p,u]=F.useState(!1),[m,A]=F.useState(!1),g=le.getSignedInUser(),D=d((t=>v(t))),q=D.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),k=d((t=>t.profitAndLossState)),x=d((t=>t.reportUIOptionsState.selectedForecast)),j=t=>k.pandLByForecastID[t]!=null&&ee(t,k).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:I}=de();me({isDataReady:l});const{isAiCfoAccessEnabled:V,onAskAiCfoClick:$}=Se({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&I)u(!0),l||a(K());else if(l&&!m){A(!0);const t=((f,P,O)=>P!=null?f.forecasts.findIndex((b=>b.id===P)):O!=null?f.forecasts.findIndex((b=>b.id===O)):f.forecasts.length>0?0:-1)(i,r,x?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=x?.index?(a(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)&&I&&a(C(i.forecasts[t].id))}}),[p,u,a,l,i,m,A,R,C,I]);const E=fe(),_=E?.loggedInUserRole!=null&&X(E.loggedInUserRole),B=ye(D?.companyId,{clearParams:l&&m}),[N,G]=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 L=t=>{G(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(pe,{analytics:w,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Te,{isAppContentDrawerOpen:N,handleDrawerToggle:L}),n.jsx(Ae,{firstMonthOfFY:q,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:j,meetingUrl:Z(h.toString()),hasTransactionAccess:_,isAiCfoAccessEnabled:V,onAskAiCfoClick:$,initialOpenThreadRequest:B,onClickMenuIcon:()=>{L(!0)}})]})}function He(){const s=d((c=>v(c))),{useFeatureGate:e}=Fe(),{isFeatureEnabled:a}=e(ge.isDebitCardFeatureEnabled),o=ne(a,s),r=ce(s);return o===!0||r===!0?n.jsx(be,{}):n.jsxs(J,{children:[n.jsx(S,{path:"/",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId/*",element:n.jsx(Ie,{})})]})}export{He as default};
@@ -1,4 +1,4 @@
1
- import{j as r}from"./liveblocks-BOLtmXrt.js";import{a as p}from"./sentry-CXDuPEuw.js";import{K as d,M as a,a9 as m,ad as f,ae as h}from"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import{i as y}from"./core-BTxe1IJ4.js";import"./zeni-epic-state-EEoBiaeS.js";import"./recharts-4iB4lKv8.js";import"./analytics-BFbgqgMT.js";import"./plaid-aFRwvwGe.js";import"./dnd-CH048ZLo.js";import"./stripe-cKAAJElX.js";import"./lottie-DLo-RGW2.js";import"./lexical-tyxOdseK.js";import"./pdf-DVvA7lFh.js";import"./utils-Dq3SJj6J.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-Du6nrW5U.js";import{a as p}from"./sentry-DlU3V0QD.js";import{K as d,M as a,a9 as m,ad as f,ae as h}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import{i as y}from"./core-CJWbgnFM.js";import"./zeni-epic-state-DUCBgtEU.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.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")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -0,0 +1,22 @@
1
+ import{j as a}from"./liveblocks-Du6nrW5U.js";import{VC as re,fI as Y,m2 as H,e0 as N,d$ as le,St as X,U$ as ce,D2 as Pe,VD as Q,CT as je,Dc as Le,D6 as de,CX as pe,Da as Te,D7 as ve,VE as ue,sw as Ve,g9 as Ae,gG as Fe,VF as _,C$ as me,C_ as ge,Df as Re,c9 as Oe}from"./zeni-epic-state-DUCBgtEU.js";import{a1 as fe,W as J,y as G,z as W,g as Ce,P as he,af as ye,az as be,aA as Be,ab as Se,M as R,ag as De,G as K,aB as Ue,aq as Ze,as as $e,a8 as ze,k as we,U as _e,p as Ge,aC as He,Q as We}from"./index-DvSod3qd.js";import{D as xe,n as M,S as Ie}from"./mui-dbvYX-CF.js";import ae from"./NotFoundScreen-CNN7HdXS.js";import{a as c}from"./sentry-DlU3V0QD.js";import{u as ee,i as Ke,j as g,h as Me,g as qe,l as Qe,n as se,o as z}from"./core-CJWbgnFM.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-DDS1YL8l.js";import{M as Ne}from"./MobileAppDrawer-DqkcDASf.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";import"./InboxNotificationsProvider-CrlYLYr4.js";import"./useTaskManagerAccess-OslA3wOO.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]="ad5a1711-6b10-4cf6-9a31-a20b5322f735",e._sentryDebugIdIdentifier="sentry-dbid-ad5a1711-6b10-4cf6-9a31-a20b5322f735")}catch{}})();const Xe={overlayWidth:new Se(100,100,48)},te=K.getLocalizedStrings().peoplePage.invitePage,ne=K.getLocalizedStrings().common,Je=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,B]=c.useState(!1),[k,S]=c.useState(!1),{userId:D}=Ke(),r=g((l=>re(l))),p=g((l=>Y(l))),E=g((l=>H(l))),{useFeatureGate:x}=J(),{isFeatureEnabled:I}=x(G.isDebitCardFeatureEnabled),P=N(I,p),T=le(p),v=X(p),U=ce(p),Z=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,w=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(W.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(Q()),b()},V=()=>{O===!0?S(!0):h()},$=d.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=x(G.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:A}=he(p?.tenantId),y=!L||A,F=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,isAccountingClassesEnabled:E,isReimbursementDisabled:Z===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isLiteRoleDisabled:U===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:T,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(de({peopleLocalData:l})),B(!0)},onSaveClick:()=>{m(f==="zeni_only"?je(e):Le(v))},onCloseClick:V,isLoading:w||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return c.useEffect((()=>{w===!1&&D!=null&&m(Pe(D))}),[w,D]),c.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:Xe.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:V,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Ee,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Be,{...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=K.getLocalizedStrings().peoplePage.invitePage,ie=K.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,B]=c.useState(!1),[k,S]=c.useState(!1),D=g((o=>re(o))),r=g((o=>Y(o))),p=g((o=>H(o))),{useFeatureGate:E}=J(),{isFeatureEnabled:x}=E(G.isDebitCardFeatureEnabled),I=N(x,r),P=le(r),T=X(r),v=ce(r),U=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,Z=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(W.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)}},$=d.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(G.isChargeCardFeatureEnabled),L=Ce(r,j,x),{isCardsHidden:A}=he(r?.tenantId),y=!L||A,F=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,onPeopleLocalDataUpdated:o=>{m(de({peopleLocalData:o})),B(!0)},onResetClick:w,onSaveClick:()=>{m(f==="zeni_only"?Te(e):ve())},onCloseClick:h,peopleDetails:D,isAccountingClassesEnabled:p,isReimbursementDisabled:U===!1,isLiteRoleDisabled:v===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:Z};return c.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 d=ue(e),n=W.getSignedInUser();return{data:d,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:H(e),analytics:we}}),(function(e,t){const{navigate:d,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:()=>{d("../../")},onModeChange:i=>{e(_({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(_({searchText:i}))}}}}))(He);function q({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const d=Me(),n=ee(),f=qe(),{areTenantIdsInSync:i}=Ze(),b=W.getSignedInUser(),C=g((s=>Y(s))),{useFeatureGate:m}=J(),{isFeatureEnabled:O}=m(G.isDebitCardFeatureEnabled),B=g((s=>H(s))),k=!N(O,C)&&B,S=X(C),D=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=c.useState(!1),[x,I]=c.useState(!1),[P,T]=c.useState(!1),[v,U]=c.useState("off"),[Z,w]=c.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;c.useEffect((()=>{p&&v===u.uiState.mode||!i||(n(_({searchText:"",sortKey:"name",sortOrder:"ascending"})),U(u.uiState.mode),E(!0),n(me()))}),[p,b,D,n,u.uiState.mode,i]),c.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),c.useEffect((()=>{I(e!=null&&e===!0),T(t!=null&&t===!0&&t)}),[e,t]),c.useEffect((()=>{n(_({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const F=()=>{I(!1),T(!1),d("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:we,onLoad:s=>s.trackPageLoaded(_e.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:Z,handleDrawerToggle:h}),a.jsx(na,{navigate:d,signedInUser:b,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{d("./new")},onColumnSortConfigChanged:(s,o)=>{n(_({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=Ge(f.state?.pathnameStackToGoBack,f.pathname);d(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:V,onAskAiCfoClick:$})]})}function ka(){const e=We();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(q,{})}),a.jsx(z,{path:"new",element:a.jsx(q,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(q,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
@@ -0,0 +1 @@
1
+ import{j as s}from"./liveblocks-Du6nrW5U.js";import E from"./NotFoundScreen-CNN7HdXS.js";import{a as r}from"./sentry-DlU3V0QD.js";import{h as _,g as v,j as p,i as M,u as U,N as O,l as P,n as z,o as h}from"./core-CJWbgnFM.js";import{fI as N,a1d as b,bo as B,bn as F,iO as V,gk as $}from"./zeni-epic-state-DUCBgtEU.js";import{D as q,z as I,as as G,dN as H}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import{u as J}from"./useAskAiCfoHostNavButtonProps-DDS1YL8l.js";import{M as K}from"./MobileAppDrawer-DqkcDASf.js";import"./recharts-qq-VgjqX.js";import"./analytics-DYPKn651.js";import"./plaid-BrZReSCz.js";import"./dnd-hHoSpesG.js";import"./stripe-cKAAJElX.js";import"./lottie-BBf_aMXD.js";import"./lexical-CAwA0n9Q.js";import"./pdf-C7M7XqWN.js";import"./utils-C-x5CNgO.js";import"./InboxNotificationsProvider-CrlYLYr4.js";import"./useTaskManagerAccess-OslA3wOO.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]="6510d896-9dd2-406c-9019-77fb791a2424",e._sentryDebugIdIdentifier="sentry-dbid-6510d896-9dd2-406c-9019-77fb791a2424")}catch{}})();const L=P((function(e){const t=I.getSignedInUser(),d=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:d??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(H),Q=()=>{const e=_(),t=v(),d=q(),o=p((a=>N(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:f}=M(),u=U(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const m=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,D=F(l),x=C||k||D,c=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&m.current&&(u($({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),m.current=!1)}),[n?.fetchState]);const y=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||c(a,i,!0),m.current=!0}),[n?.fetchState,c]),j=r.useCallback(((a,i)=>{c(a,i,!1)}),[c]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=J({mobileExploreReferrer:"Performance"});return G({isDataReady:n?.fetchState==="Completed"}),x?s.jsxs(s.Fragment,{children:[s.jsx(K,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(L,{navigate:e,location:t,themeState:d,currentTenant:o,signedInUser:l,tenantEmailDomain:f,onReload:y,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(O,{to:`/${f}/dashboard`,replace:!0})};function he(){return s.jsxs(z,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
@@ -1 +1 @@
1
- import{a as h,R as a}from"./sentry-CXDuPEuw.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-DlU3V0QD.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-BOLtmXrt.js";import{p as te,d as jc,c as an,g as Sl,a as Ol}from"./sentry-CXDuPEuw.js";import{L as ge,c0 as xc,fI as kc,U3 as Tc,UV as jl,c9 as xl}from"./zeni-epic-state-EEoBiaeS.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-Dq3SJj6J.js";import{r as cn}from"./empty-BlDbR96Q.js";import{r as $l,a as Ml,b as Cl,c as Dl}from"./pdf-lib-CTa71n8-.js";import{a as Ye,r as Fl}from"./index-9ZQLuzDm.js";import{r as Ul}from"./index-BBiUi3gN.js";import{h as Bl,g as ql,u as Gl,j as _n,l as zl}from"./core-BTxe1IJ4.js";import{u as Zl,z as Rc,L as Hl,ak as Vl,al as Yl,Y as Wl,I as Kl}from"./index-t_YINWfi.js";import"./mui-CoXsq-BK.js";import{d as It}from"./decodeURIComponentSafe-CLAUpL82.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]="69fca273-6099-4131-ae78-54b16d05e660",e._sentryDebugIdIdentifier="sentry-dbid-69fca273-6099-4131-ae78-54b16d05e660")}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-Du6nrW5U.js";import{p as te,d as jc,c as an,g as Sl,a as Ol}from"./sentry-DlU3V0QD.js";import{L as ge,c0 as xc,fI as kc,U7 as Tc,UZ as jl,c9 as xl}from"./zeni-epic-state-DUCBgtEU.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-C-x5CNgO.js";import{r as cn}from"./empty-DUMrvwO9.js";import{r as $l,a as Ml,b as Cl,c as Dl}from"./pdf-lib-ArqLJwp-.js";import{a as Ye,r as Fl}from"./index-BfkcPaMK.js";import{r as Ul}from"./index-ColbwDzi.js";import{h as Bl,g as ql,u as Gl,j as _n,l as zl}from"./core-CJWbgnFM.js";import{u as Zl,z as Rc,L as Hl,ak as Vl,al as Yl,Z as Wl,I as Kl}from"./index-DvSod3qd.js";import"./mui-dbvYX-CF.js";import{d as It}from"./decodeURIComponentSafe-BCm_uqSw.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]="aecd48a3-4ec2-40ab-832c-6ee8145dda97",e._sentryDebugIdIdentifier="sentry-dbid-aecd48a3-4ec2-40ab-832c-6ee8145dda97")}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