@zeniai/web-app-ui 5.3.58-qa → 5.3.59-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 (142) hide show
  1. package/dist/assets/{AccountMappingScreen-CHe5ZDGP.js → AccountMappingScreen-DTTeREwj.js} +2 -2
  2. package/dist/assets/{ActualMatchingMatchDetailScreen-C-SpCliN.js → ActualMatchingMatchDetailScreen--9Q2zWrD.js} +1 -1
  3. package/dist/assets/AddressRoutes-CpjgVbMa.js +1 -0
  4. package/dist/assets/AddressScreen-I8Rs-MIn.js +9 -0
  5. package/dist/assets/AiCfoScreen-xXGezaaX.js +22 -0
  6. package/dist/assets/{AppDrawer-DOUxHB1n.js → AppDrawer-B74W93Dx.js} +1 -1
  7. package/dist/assets/{BillPayApprovalRoutes-B0Nta3_I.js → BillPayApprovalRoutes-DCL_JI3v.js} +1 -1
  8. package/dist/assets/{BillPayRoutes-B9TIHh4P.js → BillPayRoutes-4uVHGBny.js} +10 -10
  9. package/dist/assets/{BusinessVerificationPageScreen-DrcWW1y2.js → BusinessVerificationPageScreen-Cp54FFZH.js} +2 -2
  10. package/dist/assets/{CardsAiCfoScreen-DlYyRzr9.js → CardsAiCfoScreen-6wFZ3h7n.js} +1 -1
  11. package/dist/assets/ChargeCardRoutes-kaYLfF_G.js +71 -0
  12. package/dist/assets/CompanyPassportScreen-CpTbm6Sc.js +1 -0
  13. package/dist/assets/ConnectionAuthScreen-BPhkvgwP.js +11 -0
  14. package/dist/assets/CustomerOnboardingAuthScreen-vcuV_rLb.js +1 -0
  15. package/dist/assets/{CustomerOnboardingRoutes-CV-zX-f3.js → CustomerOnboardingRoutes-C2BUPvve.js} +3 -3
  16. package/dist/assets/{DashboardRoutes-B4rPAFsp.js → DashboardRoutes-i732ENnt.js} +4 -4
  17. package/dist/assets/{DefaultTenantHome-D2yS26zu.js → DefaultTenantHome-Fr9STTcy.js} +1 -1
  18. package/dist/assets/DomesticWireDetailScreen-DldCKkMe.js +18 -0
  19. package/dist/assets/{DrawerScreen-DcAKkP88.js → DrawerScreen-DKrIxc45.js} +1 -1
  20. package/dist/assets/EntityDetailRoutes-Ci3OHQmT.js +1 -0
  21. package/dist/assets/{ExpenseAutomationRoutes-2l3STf0l.js → ExpenseAutomationRoutes-D2Y0HhSl.js} +4 -4
  22. package/dist/assets/FeaturePreviewScreen-SWdUfPQt.js +1 -0
  23. package/dist/assets/{HubSpotOAuthCallbackScreen-Doqpd6l9.js → HubSpotOAuthCallbackScreen-DDiR98eZ.js} +1 -1
  24. package/dist/assets/{InboxNotificationsProvider-zG7x1gLM.js → InboxNotificationsProvider-Cqk-hq7Y.js} +1 -1
  25. package/dist/assets/InvoicingRoutes-BIKlKPOH.js +2 -0
  26. package/dist/assets/MagicLinkRoutes-BjSYWVoE.js +72 -0
  27. package/dist/assets/MagicLinkSignInScreen-CVVN5hX7.js +12 -0
  28. package/dist/assets/MobileAppDrawer-7ZhbRmu1.js +1 -0
  29. package/dist/assets/NotFoundScreen-DcVbM1H7.js +1 -0
  30. package/dist/assets/{NotificationRoutes-hJV6UzGh.js → NotificationRoutes-CjrMrdzi.js} +1 -1
  31. package/dist/assets/OAuthConsentScreen-DhHm1x32.js +1 -0
  32. package/dist/assets/PandLWithForecastRoutes-fBT0Sc9A.js +1 -0
  33. package/dist/assets/{PaymentLinkScreen-DDprDsoQ.js → PaymentLinkScreen-CgUBBSzR.js} +9 -9
  34. package/dist/assets/{PeopleRoutes-BlO3KG08.js → PeopleRoutes-CwPbD29F.js} +5 -5
  35. package/dist/assets/{PerformanceRoutes-6Ca4X1Bq.js → PerformanceRoutes-DJaLpKq7.js} +1 -1
  36. package/dist/assets/{Preview-Crvq2j5W.js → Preview-DZpsneMy.js} +1 -1
  37. package/dist/assets/{QBOConnectionScreen-ByT4Lz_O.js → QBOConnectionScreen-B-S6pmPF.js} +1 -1
  38. package/dist/assets/{ReimbursementApprovalRoutes-BVIa8SJX.js → ReimbursementApprovalRoutes-NW-WKLny.js} +1 -1
  39. package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BmA4MWUa.js → ReimbursementApprovalRuleDetailScreen-D61HNZbO.js} +1 -1
  40. package/dist/assets/{ReimbursementRoutes-CRFGQISM.js → ReimbursementRoutes-Df6Tud5L.js} +12 -12
  41. package/dist/assets/{ReportsRoutes-s6sDyTPD.js → ReportsRoutes-CuktTqMX.js} +1 -1
  42. package/dist/assets/RewardsRoutes-5Gqy0mIy.js +1 -0
  43. package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CDMS-Kyu.js → ScheduleDetailsPrepaidExpensesScreen-DazVitQy.js} +5 -5
  44. package/dist/assets/{ScreenRoutes-DGSfHb9l.js → ScreenRoutes-BuhEV3h0.js} +2 -2
  45. package/dist/assets/{SettingsRoutes-C_k-hnnr.js → SettingsRoutes-CEmnHqG6.js} +5 -5
  46. package/dist/assets/{SetupPagesScreen-DAfX5Gik.js → SetupPagesScreen-DdTVcR2_.js} +5 -5
  47. package/dist/assets/{SignInScreen-C5hV08WY.js → SignInScreen-BITRkzSC.js} +1 -1
  48. package/dist/assets/SignOutScreen-C5iuWq-z.js +9 -0
  49. package/dist/assets/{TaskListScreen-DKWXa0Uv.js → TaskListScreen-CwUzHwaA.js} +2 -2
  50. package/dist/assets/TaskRoutes-CFl1X2SM.js +9 -0
  51. package/dist/assets/TransactionDetailRoutes-DK4lWWF0.js +1 -0
  52. package/dist/assets/TransactionDetailScreen-iW49SNvH.js +5 -0
  53. package/dist/assets/{TransactionListRoutes-CiDmnLCE.js → TransactionListRoutes-BsHwubWD.js} +1 -1
  54. package/dist/assets/{TreasuryRoutes-3zDhHaKN.js → TreasuryRoutes-CN9ZH5Gy.js} +5 -5
  55. package/dist/assets/{VendorsRoutes-BkvgN-45.js → VendorsRoutes-B3QNi1in.js} +10 -10
  56. package/dist/assets/WiseConfirmationScreen-adPXoaAz.js +12 -0
  57. package/dist/assets/ZeniAccountRoutes-CFTwFem2.js +57 -0
  58. package/dist/assets/ZeniAccountStatementScreen-D7D_AloB.js +9 -0
  59. package/dist/assets/{accountMappingHelper-Dr9MEF3a.js → accountMappingHelper-DPpfSFuE.js} +1 -1
  60. package/dist/assets/{analytics-Ckbn2qr2.js → analytics-VM2TTd1t.js} +1 -1
  61. package/dist/assets/{analyticsHelper-vNgRVJkc.js → analyticsHelper-DRQlG4Yk.js} +1 -1
  62. package/dist/assets/{core-C1MQ75FC.js → core-DuhHfvEc.js} +1 -1
  63. package/dist/assets/{decodeURIComponentSafe-BkSrHWOz.js → decodeURIComponentSafe-BuuGDiIq.js} +1 -1
  64. package/dist/assets/{dnd-64pfrglk.js → dnd-pjIs22E1.js} +1 -1
  65. package/dist/assets/{empty-CPYiU0XG.js → empty-CJJq6lBE.js} +1 -1
  66. package/dist/assets/{empty-DTjUxrNn.js → empty-DH6a4LIS.js} +1 -1
  67. package/dist/assets/{emptyVideoElement-lIBGY-aq.js → emptyVideoElement-Buo10ELC.js} +1 -1
  68. package/dist/assets/epic-BrvjVRdN.js +2 -0
  69. package/dist/assets/expenseAutomationHelper-B5_HDAxt.js +1 -0
  70. package/dist/assets/{getLocaleForTenant-BAgQLN5V.js → getLocaleForTenant-pGR9Sol9.js} +1 -1
  71. package/dist/assets/{index-DheSTGi7.js → index-BSR6syxs.js} +12365 -12358
  72. package/dist/assets/{index-Dl0S4JM9.js → index-BnTSo1tz.js} +1 -1
  73. package/dist/assets/{index-BgIX2Tk5.js → index-CKIs26-I.js} +2 -2
  74. package/dist/assets/{index-RA90NjT0.js → index-DLhjtHx_.js} +1 -1
  75. package/dist/assets/{index-Dcy8EwAy.js → index-Da30M-mt.js} +1 -1
  76. package/dist/assets/{index-fx_VKS0e.js → index-DhX5ECiu.js} +1 -1
  77. package/dist/assets/{index-DBaQwW7d.js → index-iYJnyyes.js} +1 -1
  78. package/dist/assets/{index-DuTsLjcS.js → index-sDU_TgqD.js} +1 -1
  79. package/dist/assets/{lexical-TkcJlpM_.js → lexical-Db4_RNT4.js} +1 -1
  80. package/dist/assets/{liveblocks-BF-IiX2V.js → liveblocks-Bnd7TfEn.js} +1 -1
  81. package/dist/assets/{lottie-CWNAcXJv.js → lottie-DnzLxz4m.js} +1 -1
  82. package/dist/assets/{mui-D4JyxRuO.js → mui-CAtYecwm.js} +1 -1
  83. package/dist/assets/{pathToGoBack-wJzek_Cz.js → pathToGoBack-DaQqgjO2.js} +1 -1
  84. package/dist/assets/{pdf-Cj_veg-U.js → pdf-C4y-9f6g.js} +3 -3
  85. package/dist/assets/{pdf-lib-LgS50teK.js → pdf-lib-BWugleNz.js} +1 -1
  86. package/dist/assets/{plaid-CD2DDkpy.js → plaid-DQqtphHb.js} +1 -1
  87. package/dist/assets/{pusher-CgyD-8gi.js → pusher-HpTlXf8Y.js} +1 -1
  88. package/dist/assets/{react-DylygKQb.js → react-C6LG84CA.js} +1 -1
  89. package/dist/assets/{react-DW9umh8L.js → react-C6rP9W0h.js} +1 -1
  90. package/dist/assets/{react-LQ8ewR7F.js → react-Ci7GXtnj.js} +1 -1
  91. package/dist/assets/{react-BhEAmIaW.js → react-DxnB6A_E.js} +1 -1
  92. package/dist/assets/{react-BPkYL230.js → react-RcSRKvz2.js} +1 -1
  93. package/dist/assets/{react-CBd5YUO5.js → react-Zn4z9FkL.js} +1 -1
  94. package/dist/assets/{recharts-BEOxWuh3.js → recharts-Ax0XVvbk.js} +1 -1
  95. package/dist/assets/{routePaths-DrHt4RCx.js → routePaths-DY-fUoNb.js} +1 -1
  96. package/dist/assets/{sentry-DQv7eTqs.js → sentry-C4tTgPRE.js} +1 -1
  97. package/dist/assets/{stripSplatSuffix-CF6NUsXZ.js → stripSplatSuffix-C2h79EC3.js} +1 -1
  98. package/dist/assets/{url-Eifk29FQ.js → url-Cf1wHOjT.js} +1 -1
  99. package/dist/assets/{url-BQJem0W5.js → url-oIafCeJQ.js} +1 -1
  100. package/dist/assets/useActualMatchingMatchDetail-BS7hRXcn.js +1 -0
  101. package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DRaJ3Gwb.js → useAiCfoDashboardSuggestedQuestionsChips-DS5PLjzx.js} +1 -1
  102. package/dist/assets/{useAskAiCfoHostNavButtonProps-DhY9V91R.js → useAskAiCfoHostNavButtonProps-BmrnfhUQ.js} +1 -1
  103. package/dist/assets/{useChargeCardPusherEvents-Cwq1bouz.js → useChargeCardPusherEvents-BgJc6X4f.js} +1 -1
  104. package/dist/assets/{useDeviceId-BrccfFDF.js → useDeviceId-D-PGNAnc.js} +1 -1
  105. package/dist/assets/useEmailConnectResultRefresh-BiJOFAYU.js +1 -0
  106. package/dist/assets/{useInitialThreadRequest-Fj77Qh1B.js → useInitialThreadRequest-B6RfidGO.js} +1 -1
  107. package/dist/assets/{useTaskManagerAccess-BOnqrzjJ.js → useTaskManagerAccess-CSigDKkg.js} +1 -1
  108. package/dist/assets/{useTaskManagerPusherEvents-jr7UAjj6.js → useTaskManagerPusherEvents-7vpYlql3.js} +1 -1
  109. package/dist/assets/{utils-G6VVxCSd.js → utils-BtDnAqMA.js} +1 -1
  110. package/dist/assets/{withTransactionSidePanel-DdbBVvXc.js → withTransactionSidePanel-C37C2_tY.js} +4 -4
  111. package/dist/assets/{zeni-epic-state-Dmop9tB7.js → zeni-epic-state-B5FlPsWC.js} +6 -6
  112. package/dist/index.html +1 -1
  113. package/package.json +3 -3
  114. package/dist/assets/AddressRoutes-D1soVd7h.js +0 -1
  115. package/dist/assets/AddressScreen-Dsruahz2.js +0 -9
  116. package/dist/assets/AiCfoScreen-3zzxXdtv.js +0 -22
  117. package/dist/assets/ChargeCardRoutes-DZRPdI1Z.js +0 -71
  118. package/dist/assets/CompanyPassportScreen-DAYszi2A.js +0 -1
  119. package/dist/assets/ConnectionAuthScreen-BBBGS4jz.js +0 -11
  120. package/dist/assets/CustomerOnboardingAuthScreen-CZDOwYAs.js +0 -1
  121. package/dist/assets/DomesticWireDetailScreen-C3OQdqoM.js +0 -18
  122. package/dist/assets/EntityDetailRoutes-Cf2odala.js +0 -1
  123. package/dist/assets/FeaturePreviewScreen-B1Ivzvw1.js +0 -1
  124. package/dist/assets/InvoicingRoutes-CQVQ-Y38.js +0 -2
  125. package/dist/assets/MagicLinkRoutes-DcyXYSMX.js +0 -72
  126. package/dist/assets/MagicLinkSignInScreen-DSwu3x1a.js +0 -12
  127. package/dist/assets/MobileAppDrawer-CdDtqWOO.js +0 -1
  128. package/dist/assets/NotFoundScreen-ujna2tN5.js +0 -1
  129. package/dist/assets/OAuthConsentScreen-CC7ydiAB.js +0 -1
  130. package/dist/assets/PandLWithForecastRoutes-BlHGiHRN.js +0 -1
  131. package/dist/assets/RewardsRoutes-D_CDp-DT.js +0 -1
  132. package/dist/assets/SignOutScreen-BW3JHrQP.js +0 -9
  133. package/dist/assets/TaskRoutes-uwwC8_Az.js +0 -9
  134. package/dist/assets/TransactionDetailRoutes-9VQeLVZi.js +0 -1
  135. package/dist/assets/TransactionDetailScreen-D87lkTI9.js +0 -5
  136. package/dist/assets/WiseConfirmationScreen-Ca5i9ss6.js +0 -12
  137. package/dist/assets/ZeniAccountRoutes-BDqvTfgU.js +0 -57
  138. package/dist/assets/ZeniAccountStatementScreen-iAxQqIlV.js +0 -9
  139. package/dist/assets/epic-Sk9LU7p7.js +0 -2
  140. package/dist/assets/expenseAutomationHelper-VfFbXlTC.js +0 -1
  141. package/dist/assets/useActualMatchingMatchDetail-DXOytDvG.js +0 -1
  142. package/dist/assets/useEmailConnectResultRefresh-2DUe5mQi.js +0 -1
@@ -1,2 +0,0 @@
1
- import{j as s}from"./liveblocks-BF-IiX2V.js";import{a as r}from"./sentry-DQv7eTqs.js";import{u as D,h as A,i as R,j as C,t as Z,l as O,s as H,g as G,N as B,n as te,o as x}from"./core-C1MQ75FC.js";import{a9 as st,l as p,ar as _,V as m,cd as ct,ce as rt,cf as lt,cg as dt,ch as ut,ci as gt,cj as mt,ck as vt,cl as pt,cm as ft,cn as St,co as ht,p as W,cp as It,cq as Ct,af as ae,cr as Et,cs as kt,z as xe,ct as yt,cu as xt,cv as bt,cw as jt,cx as Pt,cy as Dt,cz as At,cA as Lt,Q as $t,aj as vn,cB as Ft,cC as wt,cD as Rt,cE as _t,cF as we,cG as Tt,cH as Ot,cI as Mt,cJ as Nt,cK as Ut,cL as Bt,t as Ke,h as pn,cM as Vt,cN as Ht,cO as qt,cP as zt,cQ as Qt,cR as Kt,cS as Zt}from"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import{A as Q}from"./AddressScreen-Dsruahz2.js";import M from"./NotFoundScreen-ujna2tN5.js";import{ZN as Gt,ZO as Wt,vp as Ze,ZP as K,vS as se,ZQ as Re,ZR as ce,wt as be,wA as Xt,wF as fn,ZS as _e,wx as Sn,y7 as Ge,vR as We,ZT as Jt,ZU as hn,wQ as je,ZV as re,wU as Yt,ZW as ei,ZX as In,wX as Cn,z2 as ni,ZY as ve,ZZ as Xe,Z_ as En,vP as ti,Z$ as ii,vJ as oi,_0 as ai,yk as si,_1 as kn,yt as Je,_2 as ci,yq as ri,_3 as Te,gh as li,_4 as ee,_5 as ne,xa as di,vX as Ye,w0 as yn,v_ as ui,vU as gi,x3 as mi,w2 as vi,xc as pi,_6 as Pe,xl as xn,xj as X,xh as le,xg as fi,_7 as bn,yz as en,_8 as Si,vQ as jn,_9 as Oe,wb as De,w8 as Ae,wl as Pn,wk as Me,w5 as hi,we as Dn,wn as ie,fF as Ne,VA as An,vT as Ue,wi as Ii,wj as Ci,wh as Ei,_a as ki,wV as yi,wR as Ln,_b as $n,vD as nn,_c as xi,vz as bi,_d as ji,yF as Pi,yJ as q,yE as Di,xN as Be,_e as Ai,_f as Fn,yS as tn,_g as Li,yP as $i,_h as wn,xQ as Fi,xR as V,xU as wi,_i as Rn,y2 as Ie,_j as Ri,xb as _n,U6 as Tn,_k as _i,yc as Ti,_l as On,_m as Oi,_n as Mi,_o as Ni,zH as Ui,_p as Bi,_q as Mn,yZ as Nn,_r as Un,zF as Ce,_s as Vi,zC as Hi,_t as qi,_u as zi,_v as Qi,_w as Ki,_x as Zi,_y as on,_z as Gi,eg as Wi,zL as Xi,_A as Ve,xv as Ji,xq as Yi,_B as de,xG as Bn,xy as ue,xx as eo,xB as Vn,_C as no,xw as to,_D as Hn,z3 as qn,zu as an,zp as io,_E as oo,z4 as ao,_F as so,zv as co,zz as ro,_G as He,wv as zn,zg as lo,ww as uo,_H as go,_I as Qn,c8 as mo,ms as vo,mt as po,_J as sn,wu as ge,gl as fo,mz as So,zm as Kn,zX as ho,zj as Zn,uX as Io,zU as cn,uL as Co,zR as rn,hS as Eo,Uz as ln,UA as ko,Gf as Gn,hK as yo,_K as xo,Vp as bo,_L as jo,A0 as Ee,A1 as Po,_M as Do,_N as Wn,z_ as Ao,_O as Lo,_P as $o,yg as Fo,_Q as wo}from"./zeni-epic-state-Dmop9tB7.js";import{M as Ro}from"./MobileAppDrawer-CdDtqWOO.js";import{q as me}from"./QBOConnectionScreen-ByT4Lz_O.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";import"./InboxNotificationsProvider-zG7x1gLM.js";import"./useTaskManagerAccess-BOnqrzjJ.js";import"./empty-DTjUxrNn.js";import"./pdf-lib-LgS50teK.js";import"./index-DBaQwW7d.js";import"./url-Eifk29FQ.js";import"./index-RA90NjT0.js";import"./decodeURIComponentSafe-BkSrHWOz.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]="e9a214af-d726-463a-99bf-12e8f90d1eeb",t._sentryDebugIdIdentifier="sentry-dbid-e9a214af-d726-463a-99bf-12e8f90d1eeb")}catch{}})();const $=({event:t,isReady:e=!0})=>e?s.jsx(st,{analytics:p,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function _o(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b}=C(Gt),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${n??""}/invoicing`,I=r.useCallback(((L,U)=>{const T=Wt(y,L,U,P);T!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:L,entityId:U,fromScreen:"audit_log"}),e(T))}),[P,e,y]);r.useEffect((()=>{const L=setTimeout((()=>d(a)),300);return()=>clearTimeout(L)}),[a]),r.useEffect((()=>{i&&t(Ze({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,t]);const j=g==="Not-Started"||g==="In-Progress"&&f.length===0,E=g==="In-Progress"&&f.length>0,F=g==="Completed";return N(g)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:F}),s.jsx(ct,{auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b,entries:f,hasMore:S,isLoading:j,isLoadingMore:E,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&h!=null&&t(Ze({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function pe(t,e=!1){const n=D(),i=C((c=>K(c).productNextCursor!=null)),a=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(se({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(se({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function fe(t,e,n,i){const[a,o]=r.useState(0),[c,d]=r.useState(!1),l=r.useRef(t);return r.useEffect((()=>{const v=l.current==="In-Progress";l.current=t,t==="Completed"&&v&&n!=null&&(d(!0),i(n))}),[t,n,i]),r.useEffect((()=>{c&&!e&&(d(!1),o((v=>v+1)))}),[c,e]),a}const To=new Set(["plan"]),Oo=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!==""&&t(Sn({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&t(_e({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),t(fn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(Xt({action:o,id:a,parentItemId:i}))}}}))(rt);function Mo(){const t=D(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[a]=Z(),{areTenantIdsInSync:o}=_(),c=(d=a.get("kind"))!=null&&To.has(d)?d:"plan";var d;const l=C((k=>Re(k,n))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(t(ce({id:n})),()=>{t(ce({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(be({id:n,kind:c}))}),[o,n,c,t]);const g=r.useCallback((k=>t(be({cacheOverride:!0,id:k,kind:c}))),[t,c]),S=fe(l.fetchState,l.isFormLoading,n,g),f=u==="Completed"&&!l.isFormLoading;pe(o,!0);const[h,P]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&P(n)}),[n,f]);const b=h!==n&&(u==="Not-Started"||u==="In-Progress"||l.isFormLoading);return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Oo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:b,view:l},S)]})}const No=new Set(["addon","charge","plan"]),Uo=new Set(["plan"]),Bo=O((function(t,e){const n=Re(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:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),t(ce({id:a})),e.navigate(`${n}/catalog`)},onChange:c=>{t(_e({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),t(fn({id:a}))}}}))(lt);function Vo(){const t=D(),e=A(),{item_id:n,tenantEmailDomain:i}=R(),[a]=Z(),{areTenantIdsInSync:o}=_(),c=n!=null,d=a.get("type"),l=d!=null&&No.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Uo.has(u)?u:"plan";var u;const g=C((S=>Re(S,n)));return pe(o,!0),r.useEffect((()=>{o&&t(be({id:n,kind:v}))}),[o,n,v,t]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||t(_e({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,t]),r.useEffect((()=>{if(g.fetchState==="Completed"){const S=g.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(ce({id:n}))}}),[g.fetchState,g.savedItemId,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),s.jsx(Bo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const Ho={addons:"addon",all:"item",charges:"charge",plans:"plan"},qo=O((function(t,e){const n=K(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,c=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=Ho[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(Sn({action:Jt(d),id:c}))},onLoadMore:()=>{if(a)return e.planNextCursor!=null&&t(We({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(se({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?We({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):se({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(dt);function zo(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),P=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),b=C((L=>K(L))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",F=b.runningActionId??null;return r.useEffect((()=>{const L=setTimeout((()=>v(a)),300);return()=>clearTimeout(L)}),[a]),r.useEffect((()=>{i&&t(Ge({cacheOverride:!1,planFilters:h,productFilters:P,planSort:S,productSort:S}))}),[i,t,h,P,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==y?.field||S?.dir!==y?.dir)&&t(Ge({cacheOverride:!0,planFilters:h,productFilters:P,planSort:S,productSort:S}))}),[k,y,i,t,h,P,f,S]),N(b.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),s.jsx(qo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:a,sortState:u,planFilters:h,productFilters:P,sort:S,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:F,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Qo=O((function(t,e){const n=hn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),t(re({id:i})),e.navigate(`${n}/discounts`)},onChange:c=>{t(ei({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:a}),t(Yt({id:i}))}}}))(ut);function Ko(){const t=D(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),{fetchState:o,savedCouponId:c}=C((d=>hn(d,n)));return r.useEffect((()=>{a&&t(je({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(re({id:n}))}}),[o,c,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCouponFormPage}),s.jsx(Qo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Zo=O((function(t){const e=In(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(En(a))},onSubmit:()=>{const a=ii(t.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(oi(a))}}}))(mt);function Go(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),[i]=Z(),{areTenantIdsInSync:a}=_(),o=i.get("customerId"),c=C((I=>In(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(Cn),g=C((I=>ni(I))),S=C(ve),f=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,P=f||h,b=g.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Xe()),()=>{t(Xe())})),[t]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,t(En({...l,customerId:o})))}),[o,l,t]),r.useEffect((()=>{a&&t(ti({cacheOverride:!1}))}),[a,t]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(j)}}),[d,v,e,n]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),P?s.jsx(gt,{}):s.jsx(Zo,{navigate:e,tenantEmailDomain:n})]})}const Wo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(vt);function Xo(){const t=D(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=C((d=>ai(d,n??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(si({id:n}))}),[a,n,t]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Wo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Jo=O((function(t){const e=kn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(ri({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function Yo(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,creditNoteListFetchState:b}=C((y=>{const I=kn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Je({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),s.jsx(Jo,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>t(ci(y)),onSortChange:v})]})}const Xn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},ea=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(Pe({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onDiscardEdit:()=>{t(X(le)),t(fi({id:i}))},onOpenAddress:()=>{const a=Xn(e.tenantEmailDomain??"",le,i),o=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),t(Pe({id:i,localData:a})),t(xn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(pi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>t(vi({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(ht);function na(){const t=D(),e=A(),n=G(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),c=C((T=>Te(T,i))),d=c.pageFetchState.fetchState,l=d==="Completed"&&!c.isFormLoading,[v,u]=r.useState(!1),[g,S]=r.useState(!1),[f,h]=r.useState(l?i:void 0);r.useEffect((()=>{i!=null&&l&&h(i)}),[i,l]);const P=f===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const T=c.record.sendLinkState.fetchState;E.current!=="Error"&&T==="Error"&&t(li({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=T}),[t,c.record.sendLinkState.fetchState]);const F=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ee()),t(ne()),()=>{t(ee()),t(ne())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(di({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&j&&t(Ye({customerId:i}))}),[o,i,t,j]);const L=r.useCallback((T=>t(yn({id:T}))),[t]),U=fe(c.fetchState,c.isFormLoading,i,L);return N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ea,{customerId:i??"",editView:c,hasLoadedRecord:P,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{t(ee()),i!=null&&j&&t(Ye({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ne()),S(!0)}},U),s.jsx(ft,{errorMessage:F,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&t(gi({customerId:i}))},onClose:()=>{u(!1),t(ee())},onSavePaymentMethod:T=>{i!=null&&t(ui({customerId:i,data:T}))}}),s.jsx(St,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),t(ne())},onSubmit:({amount:T,description:Y})=>{i!=null&&t(mi({amount:T,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:Y}))}})]})}const ta=O((function(t,e){const n=Te(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),t(bn({id:i})),t(X(le)),e.navigate(`${n}/customers`)},onChange:c=>{t(Pe({id:i,localData:c}))},onOpenAddress:()=>{const c=Xn(e.tenantEmailDomain??"",le,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:a}),t(xn({id:i}))}}}))(It);function ia(){const t=D(),e=A(),n=G(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),{fetchState:c,savedCustomerId:d}=C((l=>Te(l,i)));return r.useEffect((()=>{o&&i!=null&&t(yn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),t(bn({id:i}))}}),[c,d,i,t,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerFormPage}),s.jsx(ta,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const oa=O((function(t){const e=ve(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(jn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ct);function aa(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,customerListFetchState:b}=C((y=>{const I=ve(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(en({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(en({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),s.jsx(oa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>t(Si(y)),onSortChange:v})]})}const Le=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),sa=O((function(t,e){const{filters:n,sessionId:i,view:a}=e,o=i==null?void 0:a.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:n,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Le(a,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Le(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>a(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&t(Ae({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&t(Me(o))},onRollback:S?()=>{o!=null&&t(Pn(o))}:void 0}}))(Et);function ca(){const t=D(),e=A(),{sessionId:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),[o,c]=r.useState({}),d=C(Oe),l=Le(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(De(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const f=setTimeout((()=>{t(Ae({...o,sessionId:n}))}),300);return()=>clearTimeout(f)}),[a,t,o,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||n==null||!u)return;const f=setInterval((()=>{t(De(n)),t(Ae({...o,sessionId:n}))}),3e3);return()=>clearInterval(f)}),[a,t,o,u,n]);const g=r.useMemo((()=>{if(n==null)return;const f=new URLSearchParams;o.moduleId!=null&&f.set("module_id",o.moduleId),o.level!=null&&f.set("level",o.level),o.outcome!=null&&f.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&f.set("search",o.search.trim());const h=f.toString();return`${ae?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),S=v?.fetch.fetchState??"Not-Started";return N(S)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(sa,{downloadUrl:g,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Jn=t=>`invoicing_active_migration:${t}`,oe=(t,e)=>{if(t!=null&&t!=="")try{const n=Jn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ra=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const c=o??null;t(ie(c)),oe(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Me(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(Pn(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(kt);function la(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),a=C(Oe);r.useEffect((()=>{i&&(t(hi()),t(Dn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(ra,{navigate:e,tenantEmailDomain:n,view:a})]})}const da=O((function(t,e){const{activeId:n,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:a?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:a?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=ae?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),t(Ei())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{n!=null&&t(Me(n))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),n!=null&&t(Ci(n))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),t(Ii({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(yt);function ua(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),a=C(Cn),o=C(Ne).companyId??xe.getSignedInUserTenant(n??"")?.companyId,c=C((f=>An(f,o))),d=C(Oe),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(t(Ue()),t(Dn()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const f=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Jn(h))}catch{return null}})(n);f!=null&&t(ie(f))}),[l,t,n]),r.useEffect((()=>{oe(n,l)}),[l,n]);const g=u?.status,S=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{t(De(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,t]),r.useEffect((()=>{g==="done"&&(t(ie(null)),oe(n,null))}),[t,g,n]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportMigratePage}),s.jsx(da,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:n,view:d,onBack:()=>{t(ie(null)),oe(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ga=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{t(Ln({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),t(yi({data:a,id:i}))}}}))(xt);function ma(){const t=D(),e=A(),{coupon_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=C((h=>ki(h,n))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?n:void 0);r.useEffect((()=>{n!=null&&l&&u(n)}),[n,l]);const g=v===n;r.useEffect((()=>(t(re({id:n})),()=>{t(re({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(je({id:n}))}),[a,n,t]);const S=r.useCallback((h=>t(je({cacheOverride:!0,id:h}))),[t]),f=fe(o.fetchState,o.isFormLoading,n,S);return N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(ga,{hasLoadedRecord:g,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const va=O((function(t){const e=$n(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{t(Ln({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(bi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function pa(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=$n(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(nn({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),s.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>t(xi(I)),onSortChange:v})]})}const fa=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>t(q({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(q({action:"retry",id:i}))}:void 0}}))(Pt);function Sa(){const t=D(),e=A(),{case_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=C((E=>ji(E,n??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[S,f]=r.useState(),[h,P]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),f(void 0),P(!1)}),[]),k=r.useCallback((()=>{if(n==null)return;t(Pi({id:n})),v("idle"),g(!1);const E=o.emailPreview.preview;f(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),P(!0)}),[n,t,o.emailPreview.preview]),y=r.useCallback((E=>{n!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(q({action:"send-email",body:E,id:n})))}),[n,t,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(Di({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&d!=null&&t(Be({invoiceId:d}))}),[a,d,t]),r.useEffect((()=>{v("idle"),g(!1),f(void 0),P(!1)}),[n]),r.useEffect((()=>{a||(v("idle"),g(!1),f(void 0),P(!1))}),[a]),r.useEffect((()=>{h&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(n!=null&&t(Ai({id:n})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[n,b,t,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(fa,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:j,onSendEmail:k}),s.jsx(jt,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const ha=O((function(t){const e=Fn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||t(q({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t($i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Dt);function Ia(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,dunningCaseListFetchState:b}=C((y=>{const I=Fn(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&t(tn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(tn({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),s.jsx(ha,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>t(Li(y)),onSortChange:v})]})}const Ca=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),t(wi({data:{due_date:a.due_date!==""?a.due_date:void 0,notes:a.notes.trim()!==""?a.notes.split(`
2
- `).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:a.po_number!==""?a.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:a}))}}}))(At);function Ea(){const t=D(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=C((g=>wn(g,n??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&v(n)}),[n,d]);const u=l===n;return r.useEffect((()=>{a&&n!=null&&t(Fi({invoiceId:n}))}),[a,n,t]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Ca,{invoiceId:n??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const ka=O((function(t){const e=Rn(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,a)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&t(_n({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Lt);function ya(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=Rn(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&t(Ie({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ie({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),s.jsx(ka,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{t(Ri(I)),t(Ie({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function dn(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),i=$t(),a=vn(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C(Tn),v=_i(i?.loggedInUserRoleMap),u=`/${n}/invoicing`,g=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(Ro,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),s.jsx(Ft,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{t(Ti())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{g(!0)}})]})}const xa=O((function(t,e){const n=On(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(Bi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ui())}}}))(wt);function ba(){const t=D(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((f=>On(f,n??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{t(Oi()),g.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(Be({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{c!=null&&n!=null&&o==="Completed"&&g.current!==n&&(g.current=n,t(Mi({localData:Ni(c)})))}),[t,o,c,n]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(xa,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const ja=O((function(t){return{invoicingOverview:Mn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Nn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Rt);function Pa(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>Mn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Nn(a))}),[i,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),s.jsx(ja,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const Da=O((function(t){const e=Un(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(Hi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(_t);function Aa(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:P,transactionListFetchState:b,transactions:k}=C((F=>{const L=Un(F);return{activeType:L.activeTab,appliedSearch:L.filters.search,appliedSort:L.sort,nextCursor:L.nextCursor,transactionListFetchState:L.fetchState,transactions:L.transactions}}),H),y=b==="Completed",I=`/${n}/invoicing`,j=r.useCallback((F=>{const L=k.find((T=>T.id===F)),U=L?.linkedInvoices?.[0]?.invoiceID??L?.invoiceID;U!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((F=>{const L=k.find((U=>U.id===F))?.customerID;L!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:L,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(L)}`))}),[e,I,k]);return r.useEffect((()=>{const F=setTimeout((()=>d(a)),300);return()=>clearTimeout(F)}),[a]),r.useEffect((()=>{i&&t(Ce({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ce({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),s.jsx(Da,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onTypeChange:F=>{t(Vi(F)),t(Ce({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const La=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 un(){const t=D(),e=A(),{invoice_id:n,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=_(),o=n!=null&&n!=="",c=C(ve),d=C((E=>qi(E))),l=C(zi),v=C((E=>wn(E,n??""))),u=v.invoice,g=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Qi()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?Be({invoiceId:n}):jn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&u!=null&&n!=null&&v.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Ki({contextInvoiceId:n,localData:Zi(u)})))}),[t,u,n,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==f.current&&(f.current=E,t(_n({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(on({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[t,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const P=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:La(E)})))),[c.customers]),b=C((E=>Gi(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(F=E.amountDue,L=Wi.currencySymbol,Ot("0,0.00",F,L)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var F,L}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",F=u.amountDue?.amount??0;return{amountDue:we("0,0.00",u.amountDue),amountDueValue:F,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(n??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),s.jsx(Tt,{customers:P,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{t(on({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(Xi(o?n??void 0:void 0))}})]})}const Yn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},$a=(t,e)=>{if(t==null)return;const n=we("0,0",t);return e!=null?`${n}/${e}`:n},$e=(t,e,n)=>{const i=[t,$a(e,n)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},ke=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Fa=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:$e(t.productCode,t.displayPrice??t.price,t.periodUnit),value:t.priceCode}),wa=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Ra=O((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.products.filter((c=>c.itemType==="addon")).filter(ke).map((c=>({label:c.name??c.id,subtitle:$e(c.productCode,c.displayPrice??c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,charges:n.products.filter((c=>c.itemType==="charge")).filter(ke).map((c=>({label:c.name??c.id,subtitle:$e(c.productCode,c.displayPrice??c.price,void 0),value:c.priceCode}))),coupons:n.coupons.map(wa),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.filter(ke).map(Fa),shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Vn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(de({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(X(ue)),t(eo({id:i}))},onOpenAddress:()=>{const c=Yn(e.tenantEmailDomain??"",ue,i),d=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(de({id:i,localData:c})),t(Bn({id:i}))},onCancelSubscription:a?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Mt);function _a(){const t=D(),e=A(),n=G(),{subscription_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=_(),c=C((k=>Ve(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed"&&!c.isFormLoading,[S,f]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&f(i)}),[i,g]);const h=S===i;pe(o),r.useEffect((()=>{o&&i!=null&&t(Ji({id:i}))}),[o,i,t]);const P=r.useCallback((k=>t(Yi({id:k}))),[t]),b=fe(c.fetchState,c.isFormLoading,i,P);return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),s.jsx(Ra,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},b)]})}const Ta=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},Oa=(t,e)=>{if(t==null)return;const n=we("0,0",t);return e!=null?`${n}/${e}`:n},Fe=(t,e,n)=>{const i=[t,Oa(e,n)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Ma=t=>({label:Ta(t),value:t.id}),ye=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Na=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:Fe(t.productCode,t.displayPrice??t.price,t.periodUnit),trialPeriod:t.trialPeriod,trialPeriodUnit:t.trialPeriodUnit,value:t.priceCode}),Ua=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Ba=O((function(t,e){const n=Ve(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.products.filter((i=>i.itemType==="addon")).filter(ye).map((i=>({label:i.name??i.id,subtitle:Fe(i.productCode,i.displayPrice??i.price,i.periodUnit),value:i.priceCode}))),charges:n.products.filter((i=>i.itemType==="charge")).filter(ye).map((i=>({label:i.name??i.id,subtitle:Fe(i.productCode,i.displayPrice??i.price,void 0),value:i.priceCode}))),coupons:n.coupons.map(Ua),customers:n.customers.map(Ma),errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans.filter(ye).map(Na),shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),t(Hn({id:i})),t(X(ue)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(de({id:i,localData:o}))},onOpenAddress:()=>{const o=Yn(e.tenantEmailDomain??"",ue,i),c=W(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:a}),t(Bn({id:i}))}}}))(Nt);function Va(){const t=D(),e=A(),n=G(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=Z(),{areTenantIdsInSync:c}=_(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((S=>no(S,i))),u=C((S=>Ve(S,i).localData));pe(c),r.useEffect((()=>{c&&t(to({subscriptionId:i}))}),[c,i,t]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,t(de({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),t(Hn({id:i}))}}),[l,v,i,t,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),s.jsx(Ba,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Ha=O((function(t){const e=qn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),t(Vn({action:o,id:a,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const c=o?.trim()??"";c!==""&&i(a,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(a,o,c)=>{o!=="pause"?i(a,o):i(a,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(ao({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ut);function qa(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=qn(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),H),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(an({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(an({cacheOverride:!0,filters:g,sort:u}))}),[i,t,g,u,f,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&t(io())}),[k,i,t]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),s.jsx(Ha,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>t(oo(j)),onSortChange:v})]})}const za=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),t(ro({action:"capture",id:i}))}:void 0}}))(Bt);function Qa(){const t=D(),e=A(),{tenantEmailDomain:n,transaction_id:i}=R(),{areTenantIdsInSync:a}=_(),o=C((d=>so(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(co({id:i}))}),[a,i,t]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(za,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function et(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=D(),{areTenantIdsInSync:c}=_(),d=C(He),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(zn()),n&&o(lo()))}),[c,o,e,n,a]),r.useEffect((()=>{e&&c&&l&&i&&o(uo())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Ka={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function J(t){const e=D(),{areTenantIdsInSync:n}=_(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(go),{configError:u,configFetchState:g,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P}=C(Qn),b=C(He);et({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Ne),y=t==="dunning"||t==="quickbooks",I=k.companyId??xe.getSignedInUserTenant(i??"")?.companyId,j=C((w=>An(w,I))),E=mo(k.userRole??[]),F=k.tenantId??"",L=xe.getSignedInUser(),U={userId:L?.userId??"",sessionId:L?.zeniSessionId??"",tenantId:F},T=c?.fileId,Y=C((w=>T!=null&&T!==""?vo(w,T):void 0)),qe=C((w=>T!=null&&T!==""?po(w,T):void 0)),nt=T!=null&&T!==""&&Y!=null?{[T]:Y}:{},tt=T!=null&&T!==""&&qe!=null?{[T]:qe}:{};r.useEffect((()=>(e(sn()),()=>{e(sn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Ue()))}),[n,e,a]),r.useEffect((()=>{n&&y&&g==="Not-Started"&&e(ge())}),[n,e,g,y]),r.useEffect((()=>{if(!n)return;const w=L?.userId;w!=null&&w!==""&&F!==""&&Ke.shouldFetchActiveTenant(F)&&(Ke.markActiveTenantFetchStarted(F),e(fo(w,F,L?.zeniSessionId)))}),[n,e,L?.userId,L?.zeniSessionId,F]);const it=S.length>0||f.length>0,ot=a==="Not-Started"||a==="In-Progress"&&l==null||y&&!it&&(g==="Not-Started"||g==="In-Progress"),at=a==="Completed"&&(!y||g==="Completed"),ze=j.externalConnections?.revenue?.find((w=>w.connectionName==="chargebee"))?.connectionId,Se=ae?.invoicingMicroServiceBaseUrl,Qe=Se!=null&&Se.length>0?`${Se}/1.0/webhooks/stripe`:"",he={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:w=>e(rn(w)),onDisconnect:(w,z)=>{F!==""&&e(yo(F,w,ln(z)))},onDisconnectStripe:()=>e(cn()),onReconnectQBO:()=>{const w=k.tenantEmailDomain??i??"";me.init("/connection/auth",w),me.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Gn())},onSaveChargeBeeCredentials:(w,z)=>{ze!=null&&F!==""&&e(Eo(F,ze,ln("revenue"),ko("chargebee"),{api_key:w,site:z}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Qe};return{authParams:U,deleteFileStatusById:nt,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:ae?.fileMicroServiceBaseUrl??"",integrationsSectionProps:he,isInvoicingPageReady:at,isLoading:ot,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Qe,updateFileStatusById:tt,onConnectStripe:w=>e(rn(w)),onDeleteFile:w=>e(Co(w,F)),onDisconnectStripe:()=>e(cn()),onEditFileName:(w,z)=>e(Io(w,z.split(".")[0],F)),onReconnectQBO:he.onReconnectQBO,onRefreshQBO:he.onRefreshQBO,onRetryQboSyncTask:w=>e(Zn(w)),onSave:w=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(ho({settings:w,snackbarSection:Ka[t??""]}))},onStartQboBackfill:w=>e(Kn(w)),updateFilesEntity:w=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(So({files:w}))}}}function gn({appContent:t}){const e=A(),n=G(),i=D(),{tenantEmailDomain:a}=R(),o=J("branding"),c=C((v=>xo(v))),d=C((v=>bo(Ee,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(jo()),i(X(Ee)))}),[c.saveState.fetchState,i]);const l=pn(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Vt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Do({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${Ee}/`,u=W(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:o.updateFilesEntity})]})}function Za(){const t=A(),e=J("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Ht,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Ga(){const t=A(),e=J("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(qt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Wa(){const t=A(),e=J("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zt,{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 Xa=O((function(t){const e=Wn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t($o({localData:e}))},onReset:()=>{t(Lo())},onRetryTask:e=>{t(Zn(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(Ao())},onStartBackfill:e=>{t(Kn(e))}}}))(Qt);function Ja(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),i=C(Ne),{configFetchState:a,settingsFetchState:o}=C(Wn);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||t(Ue())}),[t,o]),r.useEffect((()=>{a==="Not-Started"&&t(ge())}),[a,t]),et({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage}),s.jsx(Xa,{onBackClick:()=>e(".."),onReconnect:()=>{me.init("/connection/auth",i.tenantEmailDomain??n??""),me.handleClick()},onRefresh:()=>t(Gn())})]})}const Ya={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function es(){const t=vn(),e=D(),n=A(),[i,a]=Z(),o=J(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Qn),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const S=Ya[g];a({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[g,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Kt,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function mn(){return s.jsxs(te,{children:[s.jsx(x,{index:!0,element:s.jsx(es,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Wa,{})}),s.jsx(x,{path:"branding",element:s.jsx(gn,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(gn,{appContent:s.jsx(Q,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Ga,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Za,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(Ja,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function Ds(){const t=D(),e=A(),{tenantEmailDomain:n}=R(),{areTenantIdsInSync:i}=_(),{enableState:a,fetchState:o,status:c}=C(Tn),d=pn(a.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=C((g=>He(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,t(ge({cacheOverride:!1}))):t(ge({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&u==="Not-Started"&&t(zn())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),t(wo()))}),[d,a.fetchState,l,t,e]),c==null&&o!=="Error"?s.jsx(Zt,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(te,{children:[s.jsx(x,{path:"promo",element:s.jsx(dn,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(te,{children:[s.jsx(x,{path:"promo",element:s.jsx(dn,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mn,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(te,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Pa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(aa,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(ia,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(Q,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(na,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(Q,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(Va,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(Q,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(_a,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(Q,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ya,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Go,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(Ea,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(un,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(ba,{})}),s.jsx(x,{path:"payments",element:s.jsx(Aa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(un,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Qa,{})}),s.jsx(x,{path:"credits",element:s.jsx(Yo,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(Xo,{})}),s.jsx(x,{path:"discounts",element:s.jsx(pa,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Ko,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(ma,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ia,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Sa,{})}),s.jsx(x,{path:"catalog",element:s.jsx(zo,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(Vo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Mo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mn,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(_o,{})}),s.jsx(x,{path:"data_import",element:s.jsx(la,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(ua,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(ca,{})}),s.jsx(x,{path:"*",element:s.jsx(M,{})})]})}export{Ds as default};
@@ -1,72 +0,0 @@
1
- import{j as a}from"./liveblocks-BF-IiX2V.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-C1MQ75FC.js";import{Us as k,Ut as v,Uu as T,Jw as D,Ji as U,Uv as B,Uw as oe,Ux as ie,Jm as se,gi as $,Jt as le,Jq as re}from"./zeni-epic-state-Dmop9tB7.js";import{a2 as x,J as r,a3 as de,l as j,_ as G,a4 as ce,a5 as me,a6 as pe,p as J,o as ue,S as he,a7 as ge,O as xe,E as fe,f as we,a8 as be,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-DheSTGi7.js";import{n as m}from"./mui-D4JyxRuO.js";import f from"./NotFoundScreen-ujna2tN5.js";import{a as I}from"./sentry-DQv7eTqs.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.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]="3daf38a7-4517-4bbc-89cc-8c8d8e2a79e1",e._sentryDebugIdIdentifier="sentry-dbid-3daf38a7-4517-4bbc-89cc-8c8d8e2a79e1")}catch{}})();const Ie=m.div`
2
- display: flex;
3
- height: 100%;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
10
- `,Ce=g((function(e){const 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(f,{}):a.jsx(a.Fragment,{children:a.jsx(Ie,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const De=m.div`
11
- display: flex;
12
- height: 100vh;
13
- width: 100%;
14
- flex: 1 1 auto;
15
- flex-direction: column;
16
- align-items: center;
17
- background-color: ${e=>e.theme.colors.grey4};
18
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
19
- `,Be=g((function(e,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}),Le=m.div`
20
- display: flex;
21
- height: 100%;
22
- width: 100%;
23
- flex: 1 1 auto;
24
- flex-direction: column;
25
- align-items: center;
26
- background-color: ${e=>e.theme.colors.grey4};
27
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
28
- `,Ne=g((function(e){const 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=J(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Le,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
29
- display: flex;
30
- height: 100%;
31
- width: 100%;
32
- flex: 1 1 auto;
33
- flex-direction: column;
34
- align-items: center;
35
- background-color: ${e=>e.theme.colors.grey4};
36
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
37
- `,Te=g((function(e){const 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=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)`
38
- width: ${r.sp4};
39
- height: ${r.sp4};
40
- margin-bottom: ${r.sp3};
41
- margin-top: ${r.sp3};
42
- margin-left: ${r.sp8};
43
- cursor: pointer;
44
- position: absolute;
45
- color: ${e=>e.theme.colors.brandColorJade};
46
- `,Me=m.div`
47
- display: flex;
48
- height: 100vh;
49
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
50
- width: 100vw;
51
- overflow-y: scroll;
52
- background-color: ${e=>e.theme.colors.grey4};
53
- `,He=m.div`
54
- display: flex;
55
- flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
56
- flex-direction: column;
57
- width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
58
- ${e=>e.windowSize!=="small"?"overflow: auto;":""}
59
- box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
60
- padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
61
- `,Ve=m.div`
62
- display: flex;
63
- flex-direction: column;
64
- align-items: center;
65
- justify-content: center;
66
- padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
67
- height: ${e=>e.windowSize==="small"?"490px":"auto"};
68
- overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
69
- width: ${e=>e.windowSize=="small"?"auto":"42%"};
70
- background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
71
- margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
72
- `,_e=g((function(e,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"),w=x(),H=xe(),A=fe(),b=we(),V=()=>{H.toggle()},_=E((u=>k(u))),K=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:R}=_,{tenantId:z,userId:L,sessionId:N}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{b&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[b,c,i,o,d,t]),I.useEffect((()=>{b&&c==="Completed"&&($(L,N,z),l!=null&&t(re(l)))}),[c,b,L,N,z,l,t]),c==="Error"?a.jsx(f,{}):X==="Completed"||Y.fetchState==="Completed"?($(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,R))(u)}),a.jsxs(Me,{windowSize:w,children:[w!=="small"?a.jsx(Je,{onClick:V}):null,a.jsx(Ve,{windowSize:w,isAddressPage:M,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(_e,{file:q,type:"bill"})}),a.jsx(He,{windowSize:w,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(Ee,{})})}),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};
@@ -1,12 +0,0 @@
1
- import{j as f}from"./liveblocks-BF-IiX2V.js";import{a as u}from"./sentry-DQv7eTqs.js";import{u as O,g as _,h as w,t as V,j as l,N as L}from"./core-C1MQ75FC.js";import{z as r,E as M,G as P,U as A,l as N,V as X,$,a0 as q,X as G}from"./index-DheSTGi7.js";import{fF as R,TX as W,Uo as B,Uf as H,gi as J,gk as K,Uk as Q,gU as Y,dj as Z,Up as ee,Uq as te}from"./zeni-epic-state-Dmop9tB7.js";import{n as ne}from"./mui-D4JyxRuO.js";import{u as ae}from"./useDeviceId-BrccfFDF.js";import{f as se}from"./analyticsHelper-vNgRVJkc.js";import{t as ie}from"./getLocaleForTenant-BAgQLN5V.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="5fd1021f-aef7-4043-af35-a0246b6d5706",t._sentryDebugIdIdentifier="sentry-dbid-5fd1021f-aef7-4043-af35-a0246b6d5706")}catch{}})();const T=(t,s)=>t!=null&&t.length>0&&s==="magic_links";function Te(){const t=O(),s=_(),m=w(),[y]=V(),n=y.get("token"),p=y.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),i=ae(),{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)),a=l((e=>e.tenantState.loggedInUser)),o=l((e=>R(e))),k=l((e=>W(e))),D=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{a?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(B(n,i,g)))}),[n,p,t,i,g,a?.zeniSessionId]),u.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||a?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(a,a.zeniSessionId),r.saveSignedInUserTenants(H(k.tenantsInOrder),a.zeniSessionId),J(a.userId,a.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ie(o)),se(a,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=G();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin(X.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,b,a,o,k,v,s.state,t]);const E=u.useCallback((()=>{m("/signin/auth")}),[m]),j=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return f.jsx($,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&a?.zeniSessionId!=null&&o!=null||D!=null){const e=s.state?.origin??"/";return f.jsx(L,{to:e,state:{...s.state,origin:""}})}if(!T(n,p)||g==null||h==="Error"){const e=s.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return f.jsx(L,{to:e,state:{...s.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&a?.zeniSessionId==null)}})}return f.jsx(oe,{"data-testid":"smooth-loader",children:f.jsx(q,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- right: 0;
6
- bottom: 0;
7
- display: flex;
8
- align-items: center;
9
- justify-content: center;
10
- z-index: 9999;
11
- background-color: ${t=>t.theme.colors.background};
12
- `;export{Te as default};
@@ -1 +0,0 @@
1
- import{j as D}from"./liveblocks-BF-IiX2V.js";import{a as m}from"./sentry-DQv7eTqs.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-C1MQ75FC.js";import{fF as ne,TY as xe,TZ as se,g9 as Ue,fE as Ne,U6 as Pe,T$ as Re,U0 as Ve,p$ as Oe,gm as Le,U3 as b,U8 as je,U9 as Q,gn as Ze,Ua as ze,E9 as He,h1 as Ye,cV as qe,Ub as We,g8 as Je,go as Ke}from"./zeni-epic-state-Dmop9tB7.js";import{w as Qe,i as Xe,O as ea,o as aa,c as ta,f as na,u as sa,S as c,g as oa,e as ia,z as ra,d as da,n as ca,D as la,s as ua,q as ma,r as X,L as fa,F as ha,H as ba,p as S,l as ee,x as pa,P as ae,A as ga,C as Sa}from"./index-DheSTGi7.js";import{D as Ea}from"./mui-D4JyxRuO.js";import{u as ka}from"./InboxNotificationsProvider-zG7x1gLM.js";import{u as Ca}from"./useTaskManagerAccess-BOnqrzjJ.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]="5b9bcb15-0f42-4810-9571-50ca60f491d8",l._sentryDebugIdIdentifier="sentry-dbid-5b9bcb15-0f42-4810-9571-50ca60f491d8")}catch{}})();const Ta=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=Ue(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Ne(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,x=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:U}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,U),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),N=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),v=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[C,T,v.fetchState,f]);const _=t((e=>e.tenantState)),me=t((e=>_.fetchState==="Completed"?Le(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>b(e).totalUnreadCount)),Ce=t((e=>b(e).reducedFetchCountState)),R=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),O=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:j,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(j===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;M(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[j,Z,z]),m.useEffect((()=>{C&&k&&!f&&O.fetchState==="Not-Started"&&B.tenantId!=null&&r(je("task_manager","dashboard"))}),[C,k,f,O.fetchState,B.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:ke},H=s!=null?ra.getSignedInUserTenant(s):null,Y=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&h.push("rewards_card"),P===!1&&h.push("expense_automation_card");const q=t((e=>ze(e,h).fetchState)),W=t((e=>He(e).fetchState)),ye=A&&(q==="Completed"||q==="Error")||x&&(W==="Completed"||W==="Error")||!A&&!x?void 0:"disabled",we=m.useMemo((()=>Ye(o.userRole)),[o.userRole]),Ae=qe(we),ve=o?.rewardsLastViewedTime==null,_e=p?.userEmail!=null&&N.fetchState==="Completed"&&We(N.notificationSettings,p.userEmail,U,o,k),J=da(),Fe=J&&ca(a);return D.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:D.jsx(la,{signedInUser:p,currentTenantId:_.currentTenantId??"",tenants:_.fetchState==="Completed"?me:Y!=null?[Y]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:_e,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.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,De=ae(K)&&K!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),De&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(Ke()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Je({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Xe(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return D.jsx(Ta,{...l,...a})};export{Ba as M};
@@ -1 +0,0 @@
1
- import{j as e}from"./liveblocks-BF-IiX2V.js";import{h as r,l as n}from"./core-C1MQ75FC.js";import{an as i}from"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import"./sentry-DQv7eTqs.js";import"./zeni-epic-state-Dmop9tB7.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="3be885cb-07f5-4896-9ae7-ddcb5a1e09f4",o._sentryDebugIdIdentifier="sentry-dbid-3be885cb-07f5-4896-9ae7-ddcb5a1e09f4")}catch{}})();const a=n(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(i);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
@@ -1 +0,0 @@
1
- import{j as m}from"./liveblocks-BF-IiX2V.js";import{a as r}from"./sentry-DQv7eTqs.js";import{u as A,g as C,j as o,N as j}from"./core-C1MQ75FC.js";import{UC as D,fF as P,gm as x,UD as z,UE as M,UF as R,UG as F,pS as k,Th as L}from"./zeni-epic-state-Dmop9tB7.js";import{z as h,ai as I}from"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="3724efc3-4fda-4390-93e0-9ae4a539d6c6",n._sentryDebugIdIdentifier="sentry-dbid-3724efc3-4fda-4390-93e0-9ae4a539d6c6")}catch{}})();function ee(){const n=A(),a=C(),{params:t,error:i}=r.useMemo((()=>D(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),p=h.isSignedIn(),s=h.getSignedInUser(),f=o((e=>P(e))),l=o((e=>x(e))),d=o((e=>e.tenantState.fetchState)),y=o(z),S=o(M),c=o(R),[U,v]=r.useState(null),[E,b]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(F())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{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:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:v,approveError:E??S,isApproving:y==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&s!=null&&u!=null&&n(L(s.userId,s.zeniSessionId??void 0,u,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{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:a.pathname+a.search},replace:!0})}export{ee as default};
@@ -1 +0,0 @@
1
- import{j as n}from"./liveblocks-BF-IiX2V.js";import{h as Z,u as H,g as J,i as K,j as d,l as X,n as ee,o as C}from"./core-C1MQ75FC.js";import{fF as w,Ac as O,v5 as ae,Vu as M,v0 as T,bq as te,b$ as se,v1 as oe,Vv as re,Vc as S,ei as ne,D_ as ce,Vw as ie,Em as le,d_ as de,dZ as me}from"./zeni-epic-state-Dmop9tB7.js";import{aj as fe,z as pe,ar as ue,at as he,Q as Fe,o as _,S as V,a9 as ge,l as B,aE as be,p as Ie}from"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import Ce from"./NotFoundScreen-ujna2tN5.js";import{F as Se}from"./FeaturePreviewScreen-B1Ivzvw1.js";import{a as F}from"./sentry-DQv7eTqs.js";import{u as Te}from"./useAskAiCfoHostNavButtonProps-DhY9V91R.js";import{u as ye}from"./useInitialThreadRequest-Fj77Qh1B.js";import{t as Ae}from"./routePaths-DrHt4RCx.js";import{M as De}from"./MobileAppDrawer-CdDtqWOO.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";import"./InboxNotificationsProvider-zG7x1gLM.js";import"./useTaskManagerAccess-BOnqrzjJ.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]="cca3b659-e035-4cc7-932a-c7d9520f5e66",s._sentryDebugIdIdentifier="sentry-dbid-cca3b659-e035-4cc7-932a-c7d9520f5e66")}catch{}})();const y=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=X((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:B}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(M(a,o)),e.isPandLReportFetched(a)||s(T(a)),y(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=Ae(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function U(){const s=fe(),e=Z(),a=H(),o=J(),{forecastId:r,tenantEmailDomain:c}=K(),[p,u]=F.useState(!1),[m,A]=F.useState(!1),g=pe.getSignedInUser(),D=d((t=>w(t))),N=D.company?.companyInfo.firstMonthOfFY??1,i=d((t=>O(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),x=d((t=>t.profitAndLossState)),E=d((t=>t.reportUIOptionsState.selectedForecast)),j=t=>x.pandLByForecastID[t]!=null&&oe(t,x).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:$,onAskAiCfoClick:q}=Te({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){A(!0);const t=((f,R,v)=>R!=null?f.forecasts.findIndex((I=>I.id===R)):v!=null?f.forecasts.findIndex((I=>I.id===v)):f.forecasts.length>0?0:-1)(i,r,E?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=E?.index?(a(M(i.forecasts[t].id,t)),y(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&y(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!j(i.forecasts[t].id)&&b&&a(T(i.forecasts[t].id))}}),[p,u,a,l,i,m,A,O,T,b]);const k=Fe(),G=k?.loggedInUserRole!=null&&te(k.loggedInUserRole),{useFeatureGate:W}=_(),{isFeatureEnabled:L}=W(V.isReportsCommentingEnabled),Y=ye(L?D?.companyId:void 0,{clearParams:l&&m}),[z,Q]=F.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",g?.firstName??""),h.searchParams.set("lastname",g?.lastName??""),h.searchParams.set("email",g?.userEmail??"");const P=t=>{Q(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(ge,{analytics:B,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(De,{isAppContentDrawerOpen:z,handleDrawerToggle:P}),n.jsx(xe,{firstMonthOfFY:N,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:j,meetingUrl:se(h.toString()),hasTransactionAccess:G,isAiCfoAccessEnabled:$,onAskAiCfoClick:q,isReportsCommentingEnabled:L,initialOpenThreadRequest:Y,onClickMenuIcon:()=>{P(!0)}})]})}function He(){const s=d((c=>w(c))),{useFeatureGate:e}=_(),{isFeatureEnabled:a}=e(V.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(U,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(U,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{He as default};
@@ -1 +0,0 @@
1
- import{j as a}from"./liveblocks-BF-IiX2V.js";import{z as b,a9 as N,l as f,V as D,e3 as E,o as k,S as I}from"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import g from"./NotFoundScreen-ujna2tN5.js";import{a as c}from"./sentry-DQv7eTqs.js";import{u as C,j as h,h as F,g as L,l as _,n as T,o as d,N as y}from"./core-C1MQ75FC.js";import{fF as U,a1Y as w,a1Z as p,DQ as V,p$ as P,a1_ as z,DO as G}from"./zeni-epic-state-Dmop9tB7.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.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]="b4d6b381-2942-4275-89a8-07e0b9ac8d24",e._sentryDebugIdIdentifier="sentry-dbid-b4d6b381-2942-4275-89a8-07e0b9ac8d24")}catch{}})();const O=_((function(e,t){const n=w(e);return{inviteFormView:n.localData,submitStatus:n.saveStatus,userName:t.userName,rewardsPlan:n.rewardsPlan,companyLegalName:t.companyName}}),(function(e,t){const{navigate:n}=t,i=b.getSignedInUser();return{onDismissClick:()=>{e(p()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((l=>{s.push(l.companyName),r.push(l.emailIds[0])})),f.trackInviteEmailClicked("send",s,r,s.length)}e(G())},onUpdateInviteFormLocalData:s=>{e(z({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&f.trackInviteEmailClicked("cancel")}}}))(E),Q=()=>{const e=C(),[t,n]=c.useState(!1),[i,s]=c.useState(!1),r=h((o=>U(o))),l=F(),j=L(),u=b.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const m=h((o=>w(o))),x=u?.firstName!=null?u.firstName:"User";c.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(V()),s(!0))}),[]),c.useEffect((()=>{t||m.fetchState!=="Not-Started"||(n(!0),e(P(!0)))}),[m.fetchState,e]);const S=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[m.fetchState==="Completed"?a.jsx(N,{analytics:f,onLoad:o=>(v=>v.trackPageLoaded(D.Event.inviteEmailViewed))(o)}):null,a.jsx(O,{navigate:l,location:j,currentTenant:r,companyName:S,userName:x,inviteFormCompayData:m.localData})]})};function ne(){const{useFeatureGate:e}=k(),{isFeatureEnabled:t}=e(I.isReferralFeatureEnabled);return a.jsxs(T,{children:[a.jsx(d,{path:"/",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"refer/*",element:t?a.jsx(Q,{}):a.jsx(g,{})}),a.jsx(d,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
@@ -1,9 +0,0 @@
1
- import{j as s}from"./liveblocks-BF-IiX2V.js";import{a as i}from"./sentry-DQv7eTqs.js";import{u as l,g as f,N as u}from"./core-C1MQ75FC.js";import{z as a,l as n,V as m,a8 as p}from"./index-DheSTGi7.js";import{gX as g,UB as y}from"./zeni-epic-state-Dmop9tB7.js";import{n as b}from"./mui-D4JyxRuO.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.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]="ae921a3e-77c0-4ebd-92c2-8f7dcea37a57",e._sentryDebugIdIdentifier="sentry-dbid-ae921a3e-77c0-4ebd-92c2-8f7dcea37a57")}catch{}})();function L(){const e=l(),t=f(),r=i.useRef(!1),c=a.isSignedIn(),o=t.state?.message==="logout"||c;return i.useEffect((()=>{if(o&&!r.current){r.current=!0;try{e(g()),y(),n.trackLogout(m.Event.logoutSuccess),n.resetUserIdentity(),a.clearAll()}catch(d){console.error("Error during sign out:",d)}finally{window.location.replace("/signin/auth")}}}),[o,e]),o?s.jsx(h,{children:s.jsx(p,{fetchState:"In-Progress"})}):s.jsx(u,{to:"../",replace:!0})}const h=b.div`
2
- display: flex;
3
- height: 100vh;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `;export{L as default};
@@ -1,9 +0,0 @@
1
- import{j as r}from"./liveblocks-BF-IiX2V.js";import ue from"./NotFoundScreen-ujna2tN5.js";import{a as k}from"./sentry-DQv7eTqs.js";import{h as Y,u as ee,j as E,g as de,i as ke,N as pe,l as me,n as Se,o as b}from"./core-C1MQ75FC.js";import{Q1 as ae,Q4 as fe,P_ as Te,a1$ as ge,fF as te,a20 as se,Qq as g,Qi as T,PX as he,QW as be,QP as Ee,a21 as ne,gh as oe,a22 as q,PT as Ie,PQ as De,uX as Ce,uL as Ge,mz as _e,Qg as ye,a23 as Re,R7 as Ue,Qc as Be,QB as xe,Qy as ve,Q7 as we,Qv as Pe,Qu as Ae}from"./zeni-epic-state-Dmop9tB7.js";import{z as y,e4 as je,O as Fe,o as Le,S as G,a5 as ie,p as _,a9 as Ke,l as Z,V as Qe,e5 as $e,_ as M,af as Ne}from"./index-DheSTGi7.js";import{n as Oe}from"./mui-D4JyxRuO.js";import{u as ze}from"./useInitialThreadRequest-Fj77Qh1B.js";import{M as Ve}from"./MobileAppDrawer-CdDtqWOO.js";import{b as qe,a as Ze,T as f,t as Me,c as W,d as X,e as We}from"./TaskListScreen-DKWXa0Uv.js";import{u as Xe}from"./useTaskManagerPusherEvents-jr7UAjj6.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";import"./InboxNotificationsProvider-zG7x1gLM.js";import"./useTaskManagerAccess-BOnqrzjJ.js";import"./useAskAiCfoHostNavButtonProps-DhY9V91R.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="ba432aa8-3461-42c3-8423-2d594f119b8b",e._sentryDebugIdIdentifier="sentry-dbid-ba432aa8-3461-42c3-8423-2d594f119b8b")}catch{}})();function He(){const e=Y(),a=ee(),n=y.getSignedInUser(),{cannedResponses:c,fetchState:s,saveFetchState:u}=E((o=>o.cannedResponsesState)),d=k.useCallback((()=>{a(ae())}),[a]),m=k.useCallback(((o,I,D)=>{a(fe({name:o,content:I,cannedResponseId:D}))}),[a]),t=k.useCallback((o=>{a(Te({cannedResponseId:o}))}),[a]);if(n==null)throw Error("Can't access quick responses page without signing in...");return r.jsx(je,{cannedResponses:c,isLoading:s==="In-Progress"||s==="Not-Started",isSaving:u==="In-Progress",onBackClick:()=>e(-1),onDelete:t,onFetch:d,onSave:m})}const L=e=>e?.taskState?.taskByID,j=(e,a)=>{const n=L(e);if(a!=null&&n!=null)return n[a]?.parentTaskId??void 0},Je=ge([j,(e,a)=>{const n=j(e,a),c=L(e);if(n!=null&&c!=null)return c[n]?.name},(e,a)=>{const n=j(e,a),c=L(e);return n!=null&&c!=null&&c[n]!=null}],((e,a,n)=>{if(e!=null&&n===!0)return{id:e,name:a??""}}));let H,J=[];const Ye=me((function(e,a){const{location:n,taskGroupId:c}=a,s=ne(e,a.taskId),u=te(e),d=Je(e,a.taskId),m=s.taskGroupId??c,t=m!=null?q(e.taskGroupState,m):void 0,o=y.getSignedInUser(),I=u.tenantId,D={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:I??""},x=se(e),{tenantEmailDomain:v}=u,R=s.recurringSourceTaskId,w=R!=null?`${M.appUrl}/${v}/tasks/${encodeURIComponent(R)}`:void 0;var h;return{taskDetailSelectorView:s,authParams:D,isZeniUser:y.isZeniUser(),userGroupList:((h=e.userGroupsState.userGroupByUserGroupId)!==H&&(H=h,J=Object.values(h)),J),isNewClicked:n.state?.message==="comingFromTaskListPage",filesEndPoint:Ne.fileMicroServiceBaseUrl,companyName:a.currentTenant.companyName,companyId:a.currentTenant.companyId,currentUrl:`${M.appUrl}${a.location.pathname}`,cannedResponses:e.cannedResponsesState.cannedResponses,isCannedResponsesLoading:e.cannedResponsesState.fetchState==="In-Progress",recurringSourceTaskUrl:w,tagListView:x,taskGroupName:m!=null&&t!=null&&t.isDefault===!1?t.name:void 0,taskGroupList:e.taskGroupViewState.taskGroupsIds.map((S=>q(e.taskGroupState,S))).filter((S=>S!=null&&!S.isDeleted)).map((S=>({id:S.id,name:S.name,isDefault:S.isDefault}))),subtasks:s.subtasks,parentTaskRef:d,subTaskCreateStatus:e.taskDetailState?.subTaskCreateStatus?.fetchState}}),(function(e,a){const{taskId:n,navigate:c,currentTenant:s,location:u,taskGroupId:d}=a,{tenantEmailDomain:m}=s;return{onSaveChangesToLocalStore:t=>{e(Ae({taskDetailLocalData:t,taskId:n}))},onSaveDetailClick:t=>{e(Pe(n,t??d))},onArchiveTaskClick:()=>{a.taskId!=null&&e(we(a.taskId))},onSnoozeTask:(t,o)=>{e(ve(t,o))},onUnsnoozeTask:t=>{e(xe(t))},onCreateSubtask:(t,o)=>{e(Be({...o,parentTaskId:t}))},onSubtaskUpdate:(t,o)=>{e(Ue({task:t,updates:o}))},onShowToast:t=>{e(oe(t))},onSubtaskRowClick:t=>{c(`/${m}/tasks/${t}`,{state:{pathnameStackToGoBack:_(u.state?.pathnameStackToGoBack,u.pathname)}})},onParentBreadcrumbClick:t=>{c(`/${m}/tasks/${t}`,{state:{pathnameStackToGoBack:_(u.state?.pathnameStackToGoBack,u.pathname)}})},onDismissClick:()=>{if(u.state?.message==="triggerBackClick"){const t=ie(u.state?.pathnameStackToGoBack),o=t.poppedPathname??"../../dashboard";c(o,{state:{pathnameStackToGoBack:t.newStack}})}else{const t=B(m),o=_(u.state?.pathnameStackToGoBack,u.pathname);c(t,{state:{pathnameStackToGoBack:o}})}e(Re({taskId:n}))},onDeleteTaskClick:()=>{e(ye(n))},updateFilesEntity:t=>{e(_e({files:t}))},onDeleteFile:t=>{e(Ge(t))},onEditFileName:(t,o)=>{e(Ce(t,o.split(".")[0]))},onReloadTaskDetailPage:()=>{e(g(!1,n))},onCreateTagClick:t=>{e(De(t,n))},onDeleteTagClick:t=>{e(Ie(t,n))},onFetchCannedResponses:()=>{e(ae())},onManageTemplatesClick:()=>{c(`/${s.tenantEmailDomain}/tasks/quick-responses`)}}}))($e);function F(){const e=Y(),a=ee(),n=de(),c=Fe(),{taskId:s,taskGroupId:u}=ke(),d=E((i=>te(i))),m=ze(d?.companyId),{useFeatureGate:t}=Le(),{isFeatureEnabled:o}=t(G.isTaskSnoozeEnabled),{isFeatureEnabled:I}=t(G.isTaskVisibilityEnabled),{isFeatureEnabled:D}=t(G.isTaskCannedResponsesEnabled),{isFeatureEnabled:x}=t(G.isTaskRecurringParentEnabled),{isFeatureEnabled:v}=t(G.isTaskGroupAssigneesEnabled),[R,w]=k.useState(!1),[h,S]=k.useState(!1),[K,re]=k.useState(!1),[Q,P]=k.useState(!1),C=k.useRef(!1),U=E((i=>i.taskListState.updateTasksFetchState.fetchState)),$=E((i=>se(i))),N=E((i=>i.taskGroupViewState.fetchState));k.useEffect((()=>{a(g(!1,s)),s!=null&&a(T(s))}),[a,s]);const O=y.getSignedInUser()?.userId,ce=k.useMemo((()=>{const i=[f.TASK_CREATED,f.TASK_UPDATED,f.TASKS_BULK_UPDATED,f.TASKS_BULK_DELETED],l=[...i,f.TASK_SNOOZE_RESURFACED];return[...qe(d?.companyId,i),...Ze(O,l)]}),[d?.companyId,O]);Xe({events:ce,onSubscribed:()=>{s!=null&&(a(g(!0,s)),a(T(s)))},onEvent:(i,l)=>{if(s!=null)switch(i){case f.TASK_CREATED:{X(l)?.parent_task_id===s&&(a(g(!0,s)),a(T(s)));break}case f.TASK_UPDATED:{const p=X(l);if(p==null)break;p.task_id===s?(a(g(!0,s)),a(T(s))):p.parent_task_id===s&&a(T(s));break}case f.TASKS_BULK_UPDATED:{const p=W(l);if(p==null)break;p.task_ids.includes(s)&&a(g(!0,s)),a(T(s));break}case f.TASKS_BULK_DELETED:{const p=W(l);if(p==null)break;if(p.task_ids.includes(s)){a(oe({messageSection:"delete_task",messageText:"success",type:"success"})),d?.tenantEmailDomain!=null&&e(B(d.tenantEmailDomain));break}a(T(s));break}case f.TASK_SNOOZE_RESURFACED:{Me(l)?.task_id===s&&a(g(!0,s));break}}}}),k.useEffect((()=>{h||$.fetchState==="Completed"||(S(!0),a(he()))}),[h,a,$.fetchState]),k.useEffect((()=>{K||N==="Completed"||(re(!0),a(be()))}),[K,a,N]);const le=k.useCallback((()=>{s!=null&&(C.current=!1,a(Ee([s],null,{isArchived:!1})),P(!0))}),[a,s]);k.useEffect((()=>{if(Q)if(U!=="In-Progress"){if(C.current){if(U==="Error")return P(!1),void(C.current=!1);if(U==="Completed"){P(!1),C.current=!1;const{tenantEmailDomain:i}=d;if(n.state?.message==="triggerBackClick"){const l=ie(n.state?.pathnameStackToGoBack);e(l.poppedPathname??"../../dashboard",{state:{pathnameStackToGoBack:l.newStack}})}else{const l=B(i);e(l,{state:{pathnameStackToGoBack:_(n.state?.pathnameStackToGoBack,n.pathname)}})}}}}else C.current=!0}),[Q,U,d,n,e]);const z=E((i=>ne(i,s))),A=z.fetchState,V=y.getSignedInUser();if(V==null)throw Error("Can't access task detail page without signing in...");if(A==="Error"&&z.error?.code===400){const{tenantEmailDomain:i}=d,l=B(i),p=_(n.state?.pathnameStackToGoBack,n.pathname);return r.jsx(pe,{to:l,state:{pathnameStackToGoBack:p}})}return r.jsxs(r.Fragment,{children:[A==="Completed"?r.jsx(Ke,{analytics:Z,onLoad:i=>(l=>l.trackPageLoaded(Qe.Event.taskDetailPage))(i)}):null,r.jsxs(ea,{children:[r.jsx(Ve,{isAppContentDrawerOpen:R,handleDrawerToggle:i=>{w(i)}}),r.jsx(Ye,{analytics:Z,currentTenant:d,handleZeniLogoClick:()=>{c.toggle()},initialOpenThreadRequest:m,location:n,loggedInUser:V,navigate:e,taskGroupId:u,taskId:s,taskDetailFetchState:A,onUnarchiveTaskClick:le,isTaskSnoozeEnabled:o,isTaskVisibilityEnabled:I,isTaskCannedResponsesEnabled:D,isTaskRecurringParentEnabled:x,isTaskGroupAssigneesEnabled:v})]})]})}const ea=Oe.div`
2
- display: flex;
3
- min-height: 100%;
4
- width: 100%;
5
- flex: 1 1 auto;
6
- flex-direction: column;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey4};
9
- `,B=e=>`/${e}/tasks`;function Ca(){return r.jsxs(Se,{children:[r.jsx(b,{path:"/new",element:r.jsx(F,{})}),r.jsx(b,{path:"/new/:taskGroupId",element:r.jsx(F,{})}),r.jsx(b,{path:"/group/:taskGroupId",element:r.jsx(We,{})}),r.jsx(b,{path:"/quick-responses",element:r.jsx(He,{})}),r.jsx(b,{path:"/:taskId",element:r.jsx(F,{})}),r.jsx(b,{path:"*",element:r.jsx(ue,{})})]})}export{Ca as default};
@@ -1 +0,0 @@
1
- import{j as t}from"./liveblocks-BF-IiX2V.js";import i from"./NotFoundScreen-ujna2tN5.js";import{T as r}from"./TransactionDetailScreen-D87lkTI9.js";import"./sentry-DQv7eTqs.js";import{n as a,o as e}from"./core-C1MQ75FC.js";import"./zeni-epic-state-Dmop9tB7.js";import"./recharts-BEOxWuh3.js";import"./index-DheSTGi7.js";import"./mui-D4JyxRuO.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.js";import"./useAskAiCfoHostNavButtonProps-DhY9V91R.js";import"./decodeURIComponentSafe-BkSrHWOz.js";import"./useInitialThreadRequest-Fj77Qh1B.js";import"./routePaths-DrHt4RCx.js";import"./expenseAutomationHelper-VfFbXlTC.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new o.Error().stack;n&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[n]="bfd19369-9f5a-4875-9ff9-f0a50fe2624d",o._sentryDebugIdIdentifier="sentry-dbid-bfd19369-9f5a-4875-9ff9-f0a50fe2624d")}catch{}})();function z(){return t.jsxs(a,{children:[t.jsx(e,{path:"/:transactionTypeEncoded/:transactionId",element:t.jsx(r,{})}),t.jsx(e,{path:"/:transactionTypeEncoded/:transactionId/page-not-found",element:t.jsx(i,{})}),t.jsx(e,{path:"/:transactionTypeEncoded/:transactionId/vendor/create",element:t.jsx(r,{})}),t.jsx(e,{path:"/*",element:t.jsx(r,{})})]})}export{z as default};
@@ -1,5 +0,0 @@
1
- import{j as C}from"./liveblocks-BF-IiX2V.js";import{a as i}from"./sentry-DQv7eTqs.js";import{u as z,k as sn,j as g,s as ge,g as ke,h as Ce,i as Ae,N as cn,l as rn}from"./core-C1MQ75FC.js";import{pv as Ie,fF as ee,gV as ln,UI as dn,oB as un,ob as mn,DF as se,bn as pn,df as Re,bq as _e,sS as H,VO as Y,WW as we,WX as le,Wc as Pe,ma as Fe,WY as Ue,Wh as de,Wi as ue,m$ as xe,Sd as me,WS as G,m4 as Le,m2 as Be,me as fn,pi as hn,WZ as Sn,W_ as yn,Dw as J,m9 as Ve,Ry as Oe,cm as Tn,dl as bn,W$ as gn,WR as In,X0 as vn,X1 as En,X2 as Dn,X3 as kn,Ds as Cn,X4 as An,X5 as Rn,X6 as _n,X7 as wn,X8 as Pn,md as Fn,X9 as Un,Xa as xn,WT as Ln,Xb as Bn,Xc as Vn,Xd as On,Rs as Nn,Ri as zn,RH as Wn,mf as Mn,Se as ve,pn as jn}from"./zeni-epic-state-Dmop9tB7.js";import{o as Q,S as A,l as $,b3 as Gn,z as Ne,E as $n,a2 as Xn,b4 as qn,ac as Hn,a5 as ce,Q as Yn,b5 as Qn,p as ie,at as Zn,b6 as Jn,b7 as Kn,b8 as et,af as nt,aw as oe}from"./index-DheSTGi7.js";import{n as tt,S as at,D as ot}from"./mui-D4JyxRuO.js";import{u as st}from"./useAskAiCfoHostNavButtonProps-DhY9V91R.js";import{d as ze}from"./decodeURIComponentSafe-BkSrHWOz.js";import{u as ct}from"./useInitialThreadRequest-Fj77Qh1B.js";import{h as We,c as Me,g as it,e as rt}from"./routePaths-DrHt4RCx.js";import{u as lt}from"./expenseAutomationHelper-VfFbXlTC.js";import{A as dt}from"./utils-G6VVxCSd.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="d93f5d23-4648-444f-afc2-ddca37797c73",n._sentryDebugIdIdentifier="sentry-dbid-d93f5d23-4648-444f-afc2-ddca37797c73")}catch{}})();function ut(n=!0){const e=z(),o=sn(),{useFeatureGate:t}=Q(),{isFeatureEnabled:a}=t(A.isCreateTransferEntryFromExpenseEnabled);i.useEffect((()=>{if(!n||a!==!0)return;const s=c=>{const u=o.getState().createTransferEntryState.transferAccountsByType[c].fetchState;return u!=="In-Progress"&&u!=="Completed"};s("transferEntryEligible")&&e(Ie({kind:"transferEntryEligible"})),s("creditCardOnlyEligible")&&e(Ie({kind:"creditCardOnlyEligible"}))}),[n,a,e,o])}function mt(n,e){const o=(function(){const u=z(),[h,y]=i.useState(!1),[f,d]=i.useState(null),[r,S]=i.useState(null),{useDynamicConfig:I}=Q(),{configValue:k,isDynamicConfigLoading:T}=I("transaction_categorization_config"),b=!T&&k?.capitalization_enabled===!0,v=g((l=>ee(l))),R=v.companyId,X=g((l=>ln(l.companyState,v.companyId)?.company.companyLocaleInfo?.currencySymbol??"$")),{capitalizableAccounts:U,capitalizableAccountOverrides:_,dismissedAccounts:w}=g((l=>{const E=l.tenantState.currentTenantId,D=E!=null?l.tenantState.tenantsById[E]:void 0;return{capitalizableAccounts:D?.capitalizableAccounts??null,capitalizableAccountOverrides:D?.capitalizableAccountOverrides??null,dismissedAccounts:D?.capitalizationOnboardingDismissedAccounts??null}}),ge),x=i.useRef(U);x.current=U;const P=i.useRef(_);P.current=_;const L=i.useRef(w);L.current=w;const B=g((l=>dn(l.accountState)),ge),q=i.useMemo((()=>{const l={};for(const E of B)E.accountId!=null&&E.accountName!=null&&(l[E.accountId]=E.accountName);return l}),[B]),W=r!=null?q[r]??null:null,V=i.useCallback((l=>{if(!b)return;const E=x.current;if(E==null)return;const D=E.accounts??[],j=new Set(l),Z=P.current??{},ne=L.current;for(const O of D)if(j.has(O.accountId)&&Z[O.accountId]==null&&ne?.[O.accountId]==null)return d(O.classificationType),S(O.accountId),void y(!0)}),[b]),M=i.useCallback(((l,E)=>{u(un(R,l,E,!0)),y(!1),d(null),S(null)}),[u,R]),p=i.useCallback((()=>{r!=null&&(u(mn(R,r)),y(!1),d(null),S(null))}),[u,R,r]);return{showPopup:h&&b,popupType:f,popupAccountId:r,popupAccountName:W,currencySymbol:X,checkAndShowPopup:V,handleSubmit:M,handleDismiss:p}})(),t=i.useRef(void 0),a=i.useRef([]),s=i.useRef(o.checkAndShowPopup);s.current=o.checkAndShowPopup;const c=i.useRef(e);return c.current=e,i.useEffect((()=>{n==="In-Progress"&&(a.current=c.current()),n==="Completed"&&t.current==="In-Progress"&&a.current.length>0&&(s.current(a.current),a.current=[]),t.current=n}),[n]),o}const N=new Map,Ee=(n,e,o)=>`${n}|${e??""}|${o}`,K=(n,e)=>{const[o,t]=n.shownRecommendations;return{recommendationFor:n.dimension,recommendation:o?.name??"",recommendationSource:o?.engine??null,recommendationConfidencePercentage:o?.confidencePercentage??null,alternativeRecommendation:t?.name??null,alternativeRecommendationSource:t?.engine??null,alternativeRecommendationConfidencePercentage:t?.confidencePercentage??null,selectedValue:n.selected.name,numberOfRecommendations:n.shownRecommendations.length,transactionId:e,lineId:n.lineId??null}},re=(n,e,o)=>({transactionId:e,lineId:n.lineId,dimension:n.dimension,outcome:n.outcome,selected:{name:n.selected.name,id:n.selected.id},matchedSource:n.matchedSource,matchedRank:n.matchedRank,topPickSource:n.topPickSource,shownRecommendations:n.shownRecommendations.map((t=>({source:t.source,rank:t.rank,value:{name:t.name,id:t.id},confidence:t.confidencePercentage!=null?t.confidencePercentage/100:void 0}))),...o}),je=(n,e,o)=>{$.trackRecommendationFeedbackRetracted(K(e,o)),n(se(re(e,o,{outcome:"retracted"})))},Lt=(n,e)=>{const o=new Set(e.map(String));N.forEach(((t,a)=>{o.has(t.transactionId)&&(N.delete(a),je(n,t.feedback,t.transactionId))}))},Bt=n=>{const e=new Set(n.map(String));N.forEach(((o,t)=>{e.has(o.transactionId)&&N.delete(t)}))};function pt(n){const e=z(),[o,t]=i.useState(null),{isEnabled:a,fallbackTransactionId:s}=n,c=i.useCallback((f=>f.transactionId??s??""),[s]),u=i.useCallback((f=>{if(!a)return;const d=c(f);if(d==="")return;if(f.outcome!=="accepted")return void t(f);((S,I,k,T)=>{const b=Ee(I,k,T),v=N.get(b);return v!=null&&(N.delete(b),je(S,v.feedback,v.transactionId),!0)})(e,d,f.lineId,f.dimension)||(((S,I)=>{$.trackRecommendationAccepted(K(S,I))})(f,d),e(se(re(f,d,{}))))}),[a,c,e]),h=i.useCallback((f=>{if(o==null)return;const d=c(o);((r,S,I)=>{$.trackRecommendationFeedbackSubmitted({...K(r,S),feedbackReason:I})})(o,d,f),e(se(re(o,d,{reasonText:f,skipped:!1}))),((r,S)=>{N.set(Ee(S,r.lineId,r.dimension),{feedback:r,transactionId:S})})(o,d),t(null)}),[o,c,e]),y=i.useCallback((()=>{var f,d;o!=null&&(f=o,d=c(o),$.trackRecommendationFeedbackSkipped(K(f,d)),t(null))}),[o,c]);return{onRecommendationSelection:u,popup:o!=null?C.jsx(Gn,{feedback:o,onSubmit:h,onSkip:y}):null}}const pe=()=>{const n=Ne.getSignedInUser(),{useFeatureGate:e}=Q(),{isFeatureEnabled:o}=e(A.isChainOfThoughtEnabled);return i.useMemo((()=>pn(n)&&o),[n,o])};function Ge(n){if(n!=null){if("customer"in n&&n.customer!=null){const{customer:e}=n;return{id:e.id,name:e.name,logo:e.logo,type:"customer",zeniId:e.id,qboId:e.id}}if("vendor"in n&&n.vendor!=null){const{vendor:e}=n;return{id:e.id,name:e.name,logo:e.logo,type:"vendor",zeniId:e.id,qboId:e.id}}}}function Vt(n,e){const o=z(),{useFeatureGate:t}=Q(),a=g((p=>ee(p))),s=a.userRole.includes("charge_card_user")||a.userRole.includes("charge_card_admin"),c=a.userRole!=null&&Re(a.userRole),u=a.userRole!=null&&_e(a.userRole),{isFeatureEnabled:h}=t(A.isVendorBulkUpdateOnTransactionEnabled),{isFeatureEnabled:y}=t(A.isExpenseAutomationEnabled),f=pe(),d=i.useMemo((()=>({id:n,type:H(e)})),[n,e]),r=g((p=>Y(p,d))),S=r?.transactionDetailUpdateStatus?.fetchState,I=r?.transactionDetailLocalData?.lineItemById,k=g((p=>{const l=Y(p,d)?.transactionDetailLocalData.vendorUpdates?.id;return l==null?"Not-Started":p.transactionVendorViewState.editVendorStateById[l]?.saveStatus.fetchState??"Not-Started"})),T=i.useMemo((()=>r?.fetchState==="Completed"?Ge(r?.transaction):void 0),[r?.fetchState,r?.transaction]),b=g((p=>{if(T!=null)return we(p.customerIncomeState,p.vendorExpenseState,p.trendState,T,"month")})),v=g((p=>le(p))),R=g((p=>{if(T!=null)return Pe(p.trendWithTransactionsState,T,"TransactionDetail")})),X=a.company?.companyInfo.firstMonthOfFY??1,U=g((p=>Fe(p.accountState,p.accountListState,"accountList"))),[_,w]=i.useState(!1),[x,P]=i.useState(!1),[L,B]=i.useState(!1);i.useEffect((()=>{w(!1),P(!1),B(!1)}),[n,e]);const q=i.useCallback((()=>{w(!1),P(!1)}),[]),[W,V]=i.useState(!1),M=R?.selectedPeriod?.timePeriod;return i.useEffect((()=>{L||r==null||r.transaction==null||(o(Ue({id:r.transaction.id,type:r.transaction.type})),B(!0)),T!=null&&(!s||c&&u===!1)&&(_?x||b==null||(P(!0),o(me(T,"TransactionDetail",{timeframe:"month",timePeriod:M??b}))):(o(de()),o(ue()),w(!0),o(xe(T))))}),[o,L,r?.fetchState,r?.transaction,T,s,c,u,_,x,b,M]),i.useEffect((()=>{v.newVendorState?.vendorDetailLocalData?.vendorName!=null?V(!0):V(!1)}),[v.newVendorState?.vendorDetailLocalData?.vendorName]),i.useEffect((()=>()=>{o(G("common"))}),[o]),{currentTenant:a,loggedInUserHasCardUserOrAdminRole:s,isUserHasDashboardAccess:c,isUserHasInvestorOrBankerAccess:u,isVendorBulkUpdateOnTransactionEnabled:h,isExpenseAutomationEnabled:y,isChainOfThoughtEnabled:f,selectedTransaction:d,transactionDetail:r,rawDetailSaveStatus:S,rawDetailLineItemById:I,vendorSaveStatus:k,tranEntity:T,defaultTrendTransactionTimePeriod:b,vendorViewDetails:v,uiState:R,firstMonthOfFY:X,uncategorizedAccounts:U,resetTrendIsFetchedStates:q,isCreateVendorDrawerOpen:W,setIsCreateVendorDrawerOpen:V}}const ft={overlayWidth:new Hn(100,100,58)},ht=({isOpen:n,onSaveVendor:e,onSaveSuccess:o,onCancel:t,vendorViewDetails:a})=>{const s=$n(),c=Xn(),u=z(),h=g((d=>le(d))),y=()=>{t()},f={vendorDetailView:a??h,onSaveSuccess:()=>{u(Be()),u(fn("Not-Started")),o()},onSaveVendor:e,onCancelClick:y,saveVendorDetailLocalData:d=>{u(Le({vendorId:void 0,localData:d}))}};return C.jsx(ot,{anchor:"right",open:n,PaperProps:{style:{width:ft.overlayWidth.valuePercentage(c),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:s.colors.black,opacity:.4,cursor:"pointer"}}},onClose:y,children:C.jsx(St,{onClick:d=>d.stopPropagation(),children:C.jsx(qn,{...f})})})},St=tt(at)`
2
- display: flex;
3
- min-height: 100%;
4
- flex-direction: column;
5
- `;function yt(n,e){n(hn({transactionId:e.transactionId,creditAccountIntegrationId:e.creditAccountIntegrationId,debitAccountIntegrationId:e.debitAccountIntegrationId,memo:e.memo,transactionType:H(e.transactionType),sourceTransactionType:H(e.sourceTransactionType)}))}function Tt({currentTransactionId:n,enabled:e=!0,buildPath:o,beforeNavigate:t,navigate:a,navigateState:s}){const c=g((h=>h.createTransferEntryState.lastTransferEntryReplacement)),u=i.useRef(null);i.useEffect((()=>{if(!e||c==null||n==null||u.current===c)return;const{previousTransactionId:h,newTransactionId:y}=c;n.id===h.id&&n.type===h.type&&(u.current=c,t?.(),a(o(y),{replace:!0,state:s}))}),[e,c,n,o,t,a,s])}const bt=({closeDrawerHandler:n,overrideTransactionId:e,overrideTransactionType:o})=>{const t=ke(),a=Ce(),s=z(),c=pe(),{transactionTypeEncoded:u,transactionId:h}=Ae(),y=e??h,f=o??ze(u??"");let d;We(y,f)&&(d={id:y,type:H(f)});const r=d!=null?g((I=>Y(I,d))):void 0,S=()=>{const I=ce(t.state?.pathnameStackToGoBack),k=I.poppedPathname??((T=2)=>{let b="../";for(let v=0;v<T;v++)b=`${b}../`;return b})(1);a(k,{state:{pathnameStackToGoBack:I.newStack}})};return{transactionId:d,onSaveVendor:()=>{s(Ve(d,void 0))},onSaveSuccess:()=>{if(r!=null&&r?.transaction&&r?.transactionDetailLocalData.vendorUpdates?.qboId!=null&&r?.transactionDetailLocalData.vendorUpdates?.id!=null){const I=r?.transactionDetailLocalData.vendorUpdates,k={id:r?.transactionDetailLocalData.vendorUpdates?.qboId,zeniId:r?.transactionDetailLocalData.vendorUpdates?.id,type:"vendor",name:I?.name,qboId:r?.transactionDetailLocalData.vendorUpdates?.qboId??""},T={transactionId:{id:r?.transaction?.id,type:r?.transaction?.type},transaction:r?.transaction,lineIds:r?.transaction?.lines?.map((b=>b.id))??[]};s(J({entity:k,amount:r?.transaction?.amount.amount,transactionDetails:T,flowType:"detail",isFetchCOT:c}))}S()},onCancel:()=>{d!=null&&s(Sn({transactionId:d})),s(Be()),s(yn()),n(!0),S()}}},gt=rn((function(n,e){const o=Y(n,e.selectedTransaction);let t;o==null&&console.warn("Check if the you've selected the transaction before getting the details");const a=Ne.getSignedInUser(),s=n.tenantState.currentTenantId,c={userId:a?.userId??"",sessionId:a?.zeniSessionId??"",tenantId:s??""};o!=null&&o.fetchState==="Completed"&&o.transaction!=null&&e.entity!=null&&(t=gn(n,e.entity,"TransactionDetail"));const u=n.entityAutoCompleteState.autoCompleteText.common,h=In(n,"common"),y=ee(n);return{transactionDetail:o,transactionAttachmentEndpointToDownload:`${oe}/transaction_attachment`,transactionAttachmentsEndpointToFetch:y.externalConnections?.accounting[0]?.connectionName==="netsuite"?`${oe}/transaction_attachments_accounting_provider`:`${oe}/transaction_attachments`,attachmentUploadEndpoint:`${nt.accountMicroServiceBaseUrl}`,isCOTEnabled:e.isCOTEnabled,authParams:c,trendReport:t,analytics:$,uncategorizedAccounts:e.uncategorizedAccounts,autoCompleteData:{autoCompleteText:u,entityAutoCompleteView:h},isVendorBulkUpdateOnTransactionEnabled:e.isVendorBulkUpdateOnTransactionEnabled,isExpenseAutomationEnabled:e.isExpenseAutomationEnabled,enableBackClickOnSave:e.location.state?.message?.startsWith("comingFromScheduleDetails"),isTransactionSplitEditMode:o?.transactionDetailLocalData?.editMode??!1}}),(function(n,e){const{isCOTEnabled:o}=e;return{onBackClick:()=>{if(n(G("common")),e.onBackClick!=null)return void e.onBackClick();const t=ce(e.location.state?.pathnameStackToGoBack),a=t.poppedPathname??$e(2);e.navigate(a,{state:{pathnameStackToGoBack:t.newStack,message:"comingFromTransactionDetail"}})},discardTransactionDetailLocalData:(t,a)=>{e.transaction!=null&&n(jn({transactionId:{id:e.transaction.id,type:e.transaction.type},vendorId:t,customerId:a}))},onTransactionClick:t=>{e.resetTrendIsFetchedStates(),n(de()),n(ue());const a=ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(Me(t,e.tenantEmailDomain),{state:{pathnameStackToGoBack:a}})},onTrendSelectedPeriodChange:t=>{if(t==null)e.defaultTrendTransactionTimePeriod!=null&&n(ve(e.entity,"TransactionDetail",{timeframe:"month",timePeriod:e.defaultTrendTransactionTimePeriod}));else{const a=t.currentTimePeriod==null?t.addTimePeriod:{startDate:t.addTimePeriod.startDate,endDate:t.currentTimePeriod.endDate};n(me(e.entity,"TransactionDetail",{timeframe:t.timeframe,timePeriod:t.addTimePeriod})),n(ve(e.entity,"TransactionDetail",{timeframe:t.timeframe,timePeriod:a}))}},onSaveUpdates:(t,a,s,c)=>{n(c===!0&&s!=null?Ve(t,s,!0,e.isExpenseAutomationEnabled):Mn({transactionId:t,isExpenseAutomationEnabled:e.isExpenseAutomationEnabled,cotTransactionTracking:a})),n(G("common"))},onUploadAttachmentAttachment:t=>{n(Wn(t))},onDeleteAttachment:t=>{e.transaction!=null&&n(zn(t,{id:e.transaction.id,type:e.transaction.type}))},onSaveTransactionDetailLocalData:(t,a)=>{n(Nn({transactionId:t,transactionLocalData:a}))},onUpdateAllChecked:(t,a,s,c)=>{e.transaction!=null&&n(On(e.selectedTransaction,e.transaction,t,a,s,c))},onResetLineItemsCategoryClassInLocalData:(t,a,s,c,u,h)=>{n(Vn(t,a,s,c,u,h))},onChangeCategoryClassWhenUpdateAllIsChecked:(t,a)=>{e.transaction!=null&&n(Bn({id:e.transaction.id,type:e.transaction.type},e.transaction,t,a))},onSaveSuccess:()=>{const t=ce(e.location.state?.pathnameStackToGoBack);if(t.poppedPathname!=null){const a=dt(t.poppedPathname,"/").split("/"),s=a[a.length-1];if(["uncategorized-income","uncategorized-expense","missing-receipts"].includes(s)&&e.navigate(t.poppedPathname,{state:{pathnameStackToGoBack:t.newStack}}),e.location.state?.message==="comingFromScheduleDetails"){const c=`${it(e.tenantEmailDomain)}`;e.navigate(c)}else if(e.location.state?.message==="comingFromScheduleDetailsFixedAssets"){const c=`${rt(e.tenantEmailDomain)}`;e.navigate(c)}}},onPageRefresh:()=>{n(Oe(e.selectedTransaction,!0))},autoCompleteActions:{onAutoCompleteInputChange:(t,a)=>{t.trim().length>=2?n(Ln({searchString:t,entityType:a,searchOrigin:"common"})):t.trim().length===0&&n(G("common"))},onCancelAutoComplete:()=>{n(G("common"))}},onFetchRecommendationsForEntity:(t,a,s,c)=>{n(J({entity:t,amount:a,transactionDetails:s,flowType:"detail",isBulkFetch:c,isFetchCOT:o}))},clearRecommendationForLineId:t=>{const{transactionId:a,transaction:s,lineId:c}=t;n(xn(a,s,c))},resetUpdateErrorState:()=>{const t={id:e.selectedTransaction.id,type:e.selectedTransaction.type};n(Un(t))},onSaveVendorInLocalData:(t,a,s,c,u)=>{if(n(Fn({transactionId:t,vendorUpdates:a,entity:s})),a.id!=null&&s!=null&&c!=null&&u!=null&&n(J({entity:s,amount:c,transactionDetails:u,flowType:"detail",isFetchCOT:o})),n(Le({vendorId:a.id?a.id:void 0,localData:{vendorName:a.name,vendorId:a.id?a.id:void 0}})),!a.id&&e.transaction!=null){const h=e.transaction,y=ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(`/${e.tenantEmailDomain}/transaction/${encodeURIComponent(h.type??"")}/${h.id}/vendor/create`,{state:{pathnameStackToGoBack:y}})}},onSaveCustomerInLocalData:(t,a,s,c,u)=>{n(Pn({transactionId:t,customerUpdates:a,entity:s})),a.id!=null&&s!=null&&c!=null&&u!=null&&n(J({entity:s,amount:c,transactionDetails:u,flowType:"detail",isFetchCOT:o}))},onUpdateAllTranactionsWithCurrentVendorChecked:t=>{n(wn({transactionId:{id:e.selectedTransaction.id,type:e.selectedTransaction.type},isUpdateEnabled:t}))},onClickUpdateVendorToAllLineItems:(t,a,s)=>{n(_n(t,a,s))},onResetVendorToAllLineItems:(t,a,s)=>{n(Rn(t,a,s))},saveLatestSelectedEntity:(t,a,s)=>{n(An({transactionId:t,lineId:a,entity:s}))},updateVendorBulkRecommendationsFetchStatus:(t,a)=>{n(Cn(t,a))},setIsVendorUpdateAllChecked:(t,a,s)=>{n(kn(t,a,s))},onCreateTransferEntry:e.isCreateTransferEntryFromExpenseEnabled===!0?t=>yt(n,t):void 0,onLineAdd:()=>{if(e.transaction==null)return;const t={id:e.transaction.id,type:e.transaction.type},a=e.transaction.type==="journal_entry",s=e.transaction.amount?.currencyCode??"",c=e.transaction.amount?.currencySymbol??"",u=a?{amount:{amount:0,currencyCode:s,currencySymbol:c},id:crypto.randomUUID(),isCategoryMiscategorized:!1,isClassMiscategorized:!1,lineDescription:"",platformLineDetailType:"journal_entry_line_detail",type:"journal_entry_transaction_line",postingType:void 0,postingTypeName:"",lineTransactionType:"journal_entry"}:{amount:{amount:0,currencyCode:s,currencySymbol:c},id:crypto.randomUUID(),isCategoryMiscategorized:!1,isClassMiscategorized:!1,lineDescription:"",platformLineDetailType:"account_based_expense_line_detail",type:"transaction_with_account_and_class_line"};n(Dn(t,u))},onLineDelete:t=>{if(e.transaction==null)return;const a={id:e.transaction.id,type:e.transaction.type};n(En(a,t))},onToggleSplitEditMode:t=>{if(e.transaction==null)return;const a={id:e.transaction.id,type:e.transaction.type};n(vn(a,t))}}}))(et);function Ot(){const n=Ce(),e=z(),o=ke(),{useFeatureGate:t}=Q(),a=Yn(),s=g((m=>ee(m))),c=s.userRole.includes("charge_card_user")||s.userRole.includes("charge_card_admin"),u=s.userRole!=null&&Re(s.userRole),h=s.userRole!=null&&_e(s.userRole),{isFeatureEnabled:y}=t(A.isVendorBulkUpdateOnTransactionEnabled),{isFeatureEnabled:f}=t(A.isExpenseAutomationEnabled),{tenantEmailDomain:d,transactionTypeEncoded:r,transactionId:S}=Ae(),[I,k]=i.useState(!1),T=ze(r??""),b=We(S,T),v=g((m=>m.transactionVendorViewState)),R=pe(),{isFeatureEnabled:X}=t(A.isRecommendationFeedbackEnabled),U=Qn(),{onRecommendationSelection:_,popup:w}=pt({isEnabled:X,fallbackTransactionId:S}),x=i.useMemo((()=>({...U,onRecommendationSelection:_})),[U,_]),{isFeatureEnabled:P}=t(A.isTransactionCommentingEnabled),{isFeatureEnabled:L}=t(A.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:B}=t(A.isProjectsTransactionsEnabled),{isFeatureEnabled:q}=t(A.isTransactionSplitEnabled),W=a?.currentTenant?.companyId,V=a?.currentTenant?.companyName,M=ct(W),p=i.useMemo((()=>{if(b)return{id:S,type:H(T)}}),[b,S,T]),l=p!=null?g((m=>Y(m,p))):void 0,E=l?.transactionDetailLocalData.vendorUpdates?.id!=null?v.editVendorStateById[l?.transactionDetailLocalData.vendorUpdates.id]?.saveStatus.fetchState:"Not-Started",D=l?.fetchState==="Completed"?Ge(l?.transaction):void 0,j=g((m=>D!=null?we(m.customerIncomeState,m.vendorExpenseState,m.trendState,D,"month"):void 0)),Z=g((m=>le(m))),ne=g((m=>D!=null?Pe(m.trendWithTransactionsState,D,"TransactionDetail"):void 0)),O=s.company?.companyInfo.firstMonthOfFY??1,Xe=g((m=>Fe(m.accountState,m.accountListState,"accountList"))),[qe,fe]=i.useState(!1),[He,he]=i.useState(!1),[Ye,Se]=i.useState(!1),Qe=i.useCallback((m=>Me(m,d??"")+o.search),[d,o.search]),Ze=i.useCallback((()=>{Se(!1)}),[]);Tt({currentTransactionId:p,enabled:d!=null&&d!=="",buildPath:Qe,beforeNavigate:Ze,navigate:n,navigateState:o.state});const ye=()=>{fe(!1),he(!1)},Te=lt();ut();const te=i.useRef(l?.transaction);te.current=l?.transaction;const Je=l?.transactionDetailUpdateStatus?.fetchState,F=mt(Je,(()=>{const m=[];if(te.current!=null)for(const ae of te.current.lines??[])"account"in ae&&ae.account?.accountId!=null&&m.push(ae.account.accountId);return m}));i.useEffect((()=>{p!=null&&l!=null&&l.fetchState==="Not-Started"&&(e(Oe(p,!1)),ye())}),[e,p,l?.fetchState]),i.useEffect((()=>{if(p!=null&&l?.fetchState==="Error"){const m=ie(o.state?.pathnameStackToGoBack,o.pathname);n("page-not-found",{replace:!0,state:Te?{pathnameStackToGoBack:m,message:"expenseAutomation",origin:"transaction_categorization"}:{pathnameStackToGoBack:m,message:"pageNotFound",origin:"transaction_detail"}})}}),[p,l?.fetchState,n,o.state,o.pathname,Te]),i.useEffect((()=>{Ye||l==null||l.transaction==null||(e(Ue({id:l.transaction.id,type:l.transaction.type})),Se(!0));const m=o.state?.searchContext;D==null&&l?.fetchState==="Completed"&&De(l?.transaction,m),D!=null&&(!c||u&&h===!1)&&(qe?He||j==null||(he(!0),e(me(D,"TransactionDetail",{timeframe:"month",timePeriod:ne?.selectedPeriod?.timePeriod??j}))):(e(de()),e(ue()),De(l?.transaction,m),fe(!0),e(xe(D))))}),[l?.fetchState,l?.transaction,j,c]),i.useEffect((()=>{Z.newVendorState?.vendorDetailLocalData?.vendorName!=null?k(!0):k(!1)}),[Z.newVendorState?.vendorDetailLocalData?.vendorName]),i.useEffect((()=>()=>{e(G("common"))}),[]);const Ke=[r,S].filter((m=>m!=null)),{transactionId:be,onSaveVendor:en,onSaveSuccess:nn,onCancel:tn}=bt({closeDrawerHandler:m=>{k(!1),n(m?"../":"../..")}}),{isAiCfoAccessEnabled:an,onAskAiCfoClick:on}=st({mobileExploreReferrer:"Transaction Details"});return Zn({isDataReady:l?.fetchState==="Completed"}),b?C.jsxs(C.Fragment,{children:[be!=null&&I&&C.jsx(ht,{isOpen:I,transactionId:be,onSaveVendor:en,onSaveSuccess:nn,onCancel:tn}),C.jsx(Jn,{toolkit:x,children:C.jsx(gt,{hideDeleteAttachment:!0,firstMonthOfFY:O,isDisabled:l?.transaction?.type==="transfer"&&a?.connectionName==="netsuite"?"readonly":void 0,tenantEmailDomain:d,location:o,navigate:n,selectedTransaction:p,entity:D,isCOTEnabled:R,defaultTrendTransactionTimePeriod:j,resetTrendIsFetchedStates:ye,transaction:l?.transaction,uncategorizedAccounts:Xe,vendorSaveStatus:E,isVendorBulkUpdateOnTransactionEnabled:y,isCreateTransferEntryFromExpenseEnabled:L,isExpenseAutomationEnabled:f,isAiCfoAccessEnabled:an,onAskAiCfoClick:on,isTransactionCommentingEnabled:P,isProjectsTransactionsEnabled:B,isTransactionSplitEnabled:q,companyId:W,companyName:V,initialOpenThreadRequest:M})}),w,F.showPopup&&F.popupType!=null&&C.jsx(Kn,{popupType:F.popupType,currencySymbol:F.currencySymbol,accountId:F.popupAccountId??"",accountName:F.popupAccountName??"",onSubmit:F.handleSubmit,onDismiss:F.handleDismiss})]}):C.jsx(cn,{to:$e(Ke.length)})}const $e=(n=2)=>{let e="../";for(let o=0;o<n;o++)e=`${e}../`;return e},De=(n,e)=>{if(n!=null){const{transactionCategory:o,transactionClass:t}=It(n),a=vt(n);$.trackTransactionDetails(n.account?.accountId,n.account?.accountName,n.id,a,o.length>0?o:void 0,t.length>0?t:void 0,n.type,n.amount,n.memo,n.lines?.length??0,n.attachments?.map((s=>s.fileName)),e!=null?"Search":void 0,e?.searchTerm,e?.resultPosition,e?.resultsCount)}},It=n=>{const e=[],o=[];return n.lines?.forEach((t=>{switch(t.type){case"transaction_with_account_and_class_line":case"transaction_with_product_or_service_line":case"journal_entry_transaction_line":case"linked_transaction_line":{const a=t;a!=null&&a.account!=null&&a.account.accountName?.length>0&&e.push(a.account.accountName),a.class!=null&&a.class.className?.length>0&&o.push(a.class.className);break}}})),{transactionCategory:e,transactionClass:o}},vt=n=>Tn(n)===!0?n.customer?.name??"":bn(n)===!0?n.vendor?.name??"":n.memo!=null?n.memo:n.type;export{ht as C,Ot as T,pt as a,ut as b,mt as c,bt as d,gt as e,Tt as f,pe as g,yt as h,Bt as i,De as l,Lt as r,Vt as u};
@@ -1,12 +0,0 @@
1
- import{j as o}from"./liveblocks-BF-IiX2V.js";import{a as f}from"./sentry-DQv7eTqs.js";import{t as u,u as h,j as y,N as b}from"./core-C1MQ75FC.js";import{Uy as I,gi as w,JB as j}from"./zeni-epic-state-Dmop9tB7.js";import{z as l,a8 as x,ag as S,ah as D}from"./index-DheSTGi7.js";import{n as c}from"./mui-D4JyxRuO.js";import"./recharts-BEOxWuh3.js";import"./analytics-Ckbn2qr2.js";import"./plaid-CD2DDkpy.js";import"./dnd-64pfrglk.js";import"./stripe-cKAAJElX.js";import"./lottie-CWNAcXJv.js";import"./lexical-TkcJlpM_.js";import"./pdf-Cj_veg-U.js";import"./utils-G6VVxCSd.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]="97a11225-f3ab-4423-958e-3be5ccd6d9ce",e._sentryDebugIdIdentifier="sentry-dbid-97a11225-f3ab-4423-958e-3be5ccd6d9ce")}catch{}})();const A=()=>{const[e]=u(),t=e.get("code")??"",i=e.get("state")??"",g=e.get("profileId")??"",[n,p]=f.useState(!1),a=h(),s=y((m=>I(m))),r=l.getSignedInUser(),d=l.getSignedInUserTenantWithId(i);if(r==null||d==null)return o.jsx(b,{to:"/signin/auth",replace:!0});if(r==null)throw Error("Can't access this page without signing in...");return w(r.userId,r.zeniSessionId,d?.tenantId),f.useEffect((()=>{n||(p(!0),a(j(t,g,i)))}),[n,a]),s.fetchState==="Error"?o.jsx(E,{children:o.jsx(_,{children:s.error?.message??""})}):(s.fetchState==="Completed"&&window.close(),o.jsx(x,{fetchState:"In-Progress"}))},E=c.div`
2
- display: flex;
3
- width: 100%;
4
- height: 100vh;
5
- flex-direction: row;
6
- justify-content: center;
7
- align-items: center;
8
- background-color: ${e=>e.theme.colors.grey5};
9
- `,_=c(D.LargeRegular)`
10
- display: flex;
11
- color: ${S.important};
12
- `;export{A as default};