@zeniai/web-app-ui 5.3.64-dev → 5.3.65-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.
- package/dist/assets/AccountMappingScreen-6_GKC9vx.js +9 -0
- package/dist/assets/ActualMatchingMatchDetailScreen-BtJ1PRf_.js +1 -0
- package/dist/assets/AddressRoutes-BGo6E_l0.js +1 -0
- package/dist/assets/{AddressScreen-CrPViFiu.js → AddressScreen-BYfgTsTg.js} +2 -2
- package/dist/assets/{AiCfoScreen-DXsXYKZU.js → AiCfoScreen-HIFRX9qy.js} +5 -5
- package/dist/assets/AppDrawer-HGV6a9mb.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-CMAUuUUB.js → BillPayApprovalRoutes-CJFVAxhN.js} +1 -1
- package/dist/assets/{BillPayRoutes-Dmusj5HX.js → BillPayRoutes-9qxDDuw-.js} +7 -7
- package/dist/assets/{BusinessVerificationPageScreen-C-aPhqey.js → BusinessVerificationPageScreen-ClHDLcIn.js} +2 -2
- package/dist/assets/CardsAiCfoScreen-HQpPf571.js +14 -0
- package/dist/assets/{ChargeCardRoutes-JBiL4Thy.js → ChargeCardRoutes-D5HxBR-m.js} +6 -6
- package/dist/assets/CompanyPassportScreen-NKCcjvTx.js +1 -0
- package/dist/assets/ConnectionAuthScreen-5_efBSJK.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-LnGpx7c7.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-DvA4xflo.js +30 -0
- package/dist/assets/{DashboardRoutes-B3_TJQND.js → DashboardRoutes-BrD8wr4t.js} +4 -4
- package/dist/assets/DefaultTenantHome-UgTfgsWU.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-CnA3RoGS.js +18 -0
- package/dist/assets/DrawerScreen-Uxjfm6D_.js +1 -0
- package/dist/assets/EntityDetailRoutes-DtNSByJA.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-CyGyQy2q.js +38 -0
- package/dist/assets/FeaturePreviewScreen-C1hVuos1.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-BZRaCcdu.js +1 -0
- package/dist/assets/InboxNotificationsProvider-J2K-16R3.js +1 -0
- package/dist/assets/InvoicingRoutes-BER5-vbp.js +2 -0
- package/dist/assets/MagicLinkRoutes-BGZcWo6O.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-BclRPUfZ.js +12 -0
- package/dist/assets/MobileAppDrawer-B_zpLZqx.js +1 -0
- package/dist/assets/NotFoundScreen-BXryZNID.js +1 -0
- package/dist/assets/NotificationRoutes-CQasJ3IU.js +1 -0
- package/dist/assets/OAuthConsentScreen-Bo-ewMPc.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-DdmupK5y.js +1 -0
- package/dist/assets/{PaymentLinkScreen-Bh4jK9uE.js → PaymentLinkScreen-CAg7Uc1V.js} +5 -5
- package/dist/assets/PeopleRoutes-CYUsZeQt.js +22 -0
- package/dist/assets/PerformanceRoutes-DqTbj0rB.js +1 -0
- package/dist/assets/{Preview-Cqz8sG2s.js → Preview-DB5CbRio.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-DreC-yDW.js → QBOConnectionScreen-CRdIfjOg.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-CgCsp1OP.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-BxglZgWl.js → ReimbursementApprovalRuleDetailScreen-ChXGgpkg.js} +1 -1
- package/dist/assets/ReimbursementRoutes-DKUCzczr.js +68 -0
- package/dist/assets/{ReportsRoutes-BZjyXdiB.js → ReportsRoutes-CSUm6Emn.js} +1 -1
- package/dist/assets/RewardsRoutes-DWpcmti-.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-PbMzJVD9.js → ScheduleDetailsPrepaidExpensesScreen-CuQHddsr.js} +5 -5
- package/dist/assets/ScreenRoutes-evald5rF.js +2 -0
- package/dist/assets/{SettingsRoutes-hveOvbi9.js → SettingsRoutes-B7gRIVJU.js} +6 -6
- package/dist/assets/{SetupPagesScreen-B8kiMdZf.js → SetupPagesScreen-CabDNVlS.js} +5 -5
- package/dist/assets/SignInScreen-DfTwbUKW.js +1 -0
- package/dist/assets/SignOutScreen-CH6sLo8r.js +9 -0
- package/dist/assets/{TaskListScreen-Bi73r_uo.js → TaskListScreen-d8rT1QCC.js} +2 -2
- package/dist/assets/TaskRoutes-DVZrk18e.js +9 -0
- package/dist/assets/TransactionDetailRoutes-CkeAEzHU.js +1 -0
- package/dist/assets/{TransactionDetailScreen-DVFrl6h2.js → TransactionDetailScreen-hIkUAVjY.js} +2 -2
- package/dist/assets/TransactionListRoutes-BVLahxTu.js +1 -0
- package/dist/assets/{TreasuryRoutes-BPVOZ6Bj.js → TreasuryRoutes-D4vqz1Fs.js} +5 -5
- package/dist/assets/{VendorsRoutes-CHDVO5Sr.js → VendorsRoutes-Dd9qfBZi.js} +10 -10
- package/dist/assets/WiseConfirmationScreen-B9ReE25J.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-BzLWpyYJ.js → ZeniAccountRoutes-BtAMcoNj.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-B3egvFmp.js +9 -0
- package/dist/assets/{accountMappingHelper-Gh8rpbjD.js → accountMappingHelper-mjWJVrZb.js} +1 -1
- package/dist/assets/{analytics-S5MhEivL.js → analytics-cC2XJoxx.js} +1 -1
- package/dist/assets/{analyticsHelper-Ch9SsWjb.js → analyticsHelper-DoCIxX19.js} +1 -1
- package/dist/assets/{core-Cc7wW2EM.js → core-BBG4mxvC.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DhqIXi_U.js → decodeURIComponentSafe-DgKmvHaP.js} +1 -1
- package/dist/assets/{dnd-DEyyKSEC.js → dnd-oIrpOltC.js} +1 -1
- package/dist/assets/{empty-CjY9w6q2.js → empty-BVUnugO_.js} +1 -1
- package/dist/assets/{empty-6MFM8UPN.js → empty-zUa_Ywzm.js} +1 -1
- package/dist/assets/{emptyVideoElement-MGXFhhLz.js → emptyVideoElement-WG4m8gNp.js} +1 -1
- package/dist/assets/epic-Du6qCFYI.js +2 -0
- package/dist/assets/expenseAutomationHelper-BkZxz0F-.js +1 -0
- package/dist/assets/getLocaleForTenant-BYuz_wJa.js +1 -0
- package/dist/assets/{index-Cm43WhAF.js → index-B9QH_oKn.js} +2 -2
- package/dist/assets/{index-DpnxiqBj.js → index-Bgwcwudg.js} +1 -1
- package/dist/assets/{index-ldlm2cjp.js → index-BlZF-J3g.js} +1 -1
- package/dist/assets/{index-D2oCZR3F.js → index-CD8RychW.js} +1 -1
- package/dist/assets/{index-gtGWrJ79.js → index-CyCQjJen.js} +1 -1
- package/dist/assets/{index-vIt7RQvO.js → index-De2R2YuA.js} +15538 -15403
- package/dist/assets/{index-BZ6qOKkD.js → index-DlbH0-p0.js} +1 -1
- package/dist/assets/{index-2QCkbhu2.js → index-lbu92FYh.js} +1 -1
- package/dist/assets/{lexical-DXgKWO29.js → lexical-BRrdO5Cu.js} +1 -1
- package/dist/assets/{liveblocks-CgHUgeBY.js → liveblocks-CzCs-qU3.js} +1 -1
- package/dist/assets/{lottie-C1A2hiZE.js → lottie-ULJlrwjP.js} +1 -1
- package/dist/assets/{mui-C4zFSCiU.js → mui-B2F_PvWe.js} +1 -1
- package/dist/assets/{pathToGoBack-C17GqrA7.js → pathToGoBack-e0pJACvC.js} +1 -1
- package/dist/assets/{pdf-rXyPRm1U.js → pdf-CeVn9A9c.js} +3 -3
- package/dist/assets/{pdf-lib-CsM74zBq.js → pdf-lib-DiMa7ymi.js} +1 -1
- package/dist/assets/{plaid-vsHcqLdj.js → plaid-BWZxX3Bn.js} +1 -1
- package/dist/assets/{pusher-C0EhdUPA.js → pusher-wcP4-1ih.js} +1 -1
- package/dist/assets/{react-CzfY0Vx3.js → react-3Jh1nOTX.js} +1 -1
- package/dist/assets/{react-DG8YneWb.js → react-BrDYknqm.js} +1 -1
- package/dist/assets/{react-Yy9ZuxR6.js → react-CGMaXwI-.js} +1 -1
- package/dist/assets/{react-BU_8yW5D.js → react-Chuw6ptT.js} +1 -1
- package/dist/assets/{react-CEepHjWP.js → react-D7hd8riP.js} +1 -1
- package/dist/assets/{react-Gc0eJCMR.js → react-Dv-IwMT5.js} +1 -1
- package/dist/assets/{recharts-DJGeJ2v_.js → recharts-CzGMTm3v.js} +1 -1
- package/dist/assets/{routePaths-C0UIXwMQ.js → routePaths-BRju88LA.js} +1 -1
- package/dist/assets/{sentry-DSWD_gIh.js → sentry-CWp8Ph3h.js} +1 -1
- package/dist/assets/{stripSplatSuffix-kLnY55Qt.js → stripSplatSuffix-BWJSV6oD.js} +1 -1
- package/dist/assets/{url-DCbpXgdk.js → url-CnTmKJO0.js} +1 -1
- package/dist/assets/{url-DUlo21cY.js → url-DV6CtKQ5.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-lnPRleqr.js +1 -0
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-DuZAl-a1.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-Bq-fQXG8.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-CrB7Excu.js +1 -0
- package/dist/assets/{useDeviceId-B5zol9VP.js → useDeviceId-Bzw6IkAe.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-x1GFiNhw.js +1 -0
- package/dist/assets/useInitialThreadRequest-C1rKRZSH.js +1 -0
- package/dist/assets/useTaskManagerAccess-CoE1FF6T.js +1 -0
- package/dist/assets/useTaskManagerPusherEvents-CgOrop-a.js +1 -0
- package/dist/assets/{utils-DiIEQ7_h.js → utils-u0mlLj2I.js} +1 -1
- package/dist/assets/withTransactionSidePanel-CbnU34fe.js +25 -0
- package/dist/assets/{zeni-epic-state-BVJjEVAA.js → zeni-epic-state-FRanwwFO.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AccountMappingScreen-xfXO279W.js +0 -9
- package/dist/assets/ActualMatchingMatchDetailScreen-ByqHVLf7.js +0 -1
- package/dist/assets/AddressRoutes-BWVJyPk8.js +0 -1
- package/dist/assets/AppDrawer-B2rHD8Zo.js +0 -10
- package/dist/assets/CardsAiCfoScreen-CTX5PjYy.js +0 -14
- package/dist/assets/CompanyPassportScreen-Df3GjmsH.js +0 -1
- package/dist/assets/ConnectionAuthScreen-CRXLzdg9.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-DSYY256B.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-C2sAsjXY.js +0 -30
- package/dist/assets/DefaultTenantHome-4mMU5w7G.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-DQXD1NSK.js +0 -18
- package/dist/assets/DrawerScreen-DyQejCID.js +0 -1
- package/dist/assets/EntityDetailRoutes-0npRYuOC.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-SlF4KM3u.js +0 -38
- package/dist/assets/FeaturePreviewScreen-OtBPdCPK.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CtTG0u9D.js +0 -1
- package/dist/assets/InboxNotificationsProvider-CYNlrTK-.js +0 -1
- package/dist/assets/InvoicingRoutes-DBwLj6Ir.js +0 -2
- package/dist/assets/MagicLinkRoutes-D5UwoWcf.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-B_572HKC.js +0 -12
- package/dist/assets/MobileAppDrawer-DLFLa7hS.js +0 -1
- package/dist/assets/NotFoundScreen-DzxbROot.js +0 -1
- package/dist/assets/NotificationRoutes-D7MHUmyT.js +0 -1
- package/dist/assets/OAuthConsentScreen-iNKlAsfd.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-COCZ3G6X.js +0 -1
- package/dist/assets/PeopleRoutes-BkRUXc0D.js +0 -22
- package/dist/assets/PerformanceRoutes-BzDFWREu.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-DPScUcq4.js +0 -1
- package/dist/assets/ReimbursementRoutes-DveTyQyE.js +0 -68
- package/dist/assets/RewardsRoutes-zL93sOaR.js +0 -1
- package/dist/assets/ScreenRoutes-Bl2EONFe.js +0 -2
- package/dist/assets/SignInScreen-CGBu1NjI.js +0 -1
- package/dist/assets/SignOutScreen-D0F6FeVm.js +0 -9
- package/dist/assets/TaskRoutes-DCW1uZnF.js +0 -9
- package/dist/assets/TransactionDetailRoutes-CWMSCIXL.js +0 -1
- package/dist/assets/TransactionListRoutes-B3tJhd_n.js +0 -1
- package/dist/assets/WiseConfirmationScreen-Du3rEKnE.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-DaV7I7ku.js +0 -9
- package/dist/assets/epic-D9Y6xcsI.js +0 -2
- package/dist/assets/expenseAutomationHelper-iXuIUZiF.js +0 -1
- package/dist/assets/getLocaleForTenant-Bgt5rFzV.js +0 -1
- package/dist/assets/useActualMatchingMatchDetail-CwcmHDQ8.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BFr557mr.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-7-6nPEHY.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-BVr00Fos.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-HcMCYvt9.js +0 -1
- package/dist/assets/useInitialThreadRequest-D4Y8xhXu.js +0 -1
- package/dist/assets/useTaskManagerAccess-BeNfkHpZ.js +0 -1
- package/dist/assets/useTaskManagerPusherEvents-X_H33C0C.js +0 -1
- package/dist/assets/withTransactionSidePanel-DkQdwLfY.js +0 -25
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CgHUgeBY.js";import{a as r}from"./sentry-DSWD_gIh.js";import{ax as d,ay as l,D as p,a5 as f}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import m from"./NotFoundScreen-DzxbROot.js";import{h as c,g as u}from"./core-Cc7wW2EM.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]="3ed61bc3-b654-468a-ba56-413bbf881034",e._sentryDebugIdIdentifier="sentry-dbid-3ed61bc3-b654-468a-ba56-413bbf881034")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),i=r.useCallback((()=>{(()=>{const n=f(a.state?.pathnameStackToGoBack),b=n.poppedPathname??k();e(b,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=d(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:i}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./sentry-DSWD_gIh.js";import{u as l,h as f,g as m}from"./core-Cc7wW2EM.js";import{hY as p,UB as g,UC as _}from"./zeni-epic-state-BVJjEVAA.js";import{u as b,L as h,z as y}from"./index-vIt7RQvO.js";import"./liveblocks-CgHUgeBY.js";import"./recharts-DJGeJ2v_.js";import"./mui-C4zFSCiU.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2a93d830-e3af-449b-98b3-7756e027ec7c",e._sentryDebugIdIdentifier="sentry-dbid-2a93d830-e3af-449b-98b3-7756e027ec7c")}catch{}})();function j(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:d}=b(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as s}from"./liveblocks-CgHUgeBY.js";import{j as d}from"./core-Cc7wW2EM.js";import{fF as a}from"./zeni-epic-state-BVJjEVAA.js";import"./sentry-DSWD_gIh.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-CgHUgeBY.js";import{a as r}from"./sentry-DSWD_gIh.js";import{u as L,h as P,i as F,j as k,t as W,l as O,s as H,g as X,N as B,n as ae,o as x}from"./core-Cc7wW2EM.js";import{a9 as et,j as g,ar as R,U as l,cd as nt,ce as tt,cf as it,cg as ot,ch as at,ci as ct,cj as st,ck as rt,cl as lt,cm as dt,cn as ut,co as gt,p as J,cp as mt,cq as vt,z as Z,af as re,cr as pt,cs as St,ct as ft,cu as It,cv as ht,cw as Ct,cx as kt,cy as Et,cz as yt,cA as bt,P as xt,aj as ln,cB as At,cC as Dt,cD as jt,cE as Lt,cF as Pt,cG as _t,cH as wt,cI as $t,cJ as Ft,cK as Rt,cL as Tt,t as qe,l as _e,cM as Ot,cN as Mt,cO as Nt,cP as Ut,cQ as Bt,cR as Vt,cS as Ht}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import{A as K}from"./AddressScreen-CrPViFiu.js";import M from"./NotFoundScreen-DzxbROot.js";import{ZQ as qt,ZR as Qt,vp as Qe,ZS as G,vS as le,ZT as we,ZU as de,wt as xe,wA as zt,wF as dn,ZV as $e,wx as un,y7 as ze,vR as Ke,ZW as Kt,ZX as gn,wQ as Ae,ZY as ue,wU as Gt,ZZ as Zt,Z_ as mn,wX as vn,z2 as Wt,Z$ as fe,_0 as Ge,_1 as pn,vP as Xt,_2 as Jt,vJ as Yt,_3 as ei,yk as ni,_4 as Sn,yt as Ze,_5 as ti,yq as ii,_6 as Fe,gh as Re,_7 as ie,_8 as oe,xa as oi,vX as We,w0 as fn,v_ as ai,vU as ci,x3 as si,w2 as ri,xc as li,_9 as De,xl as In,xj as Y,xh as ge,xg as di,_a as hn,yz as Xe,_b as ui,vQ as Cn,_c as Te,fF as Ie,wb as je,w8 as Le,wl as kn,wk as Oe,w5 as gi,we as En,wn as ce,VC as yn,vT as Me,wi as mi,wj as vi,wh as pi,_d as Si,wV as fi,wR as bn,_e as xn,vD as Je,_f as Ii,vz as hi,_g as Ci,yF as ki,yJ as Q,yE as Ei,xN as he,_h as yi,_i as An,yS as Ye,_j as bi,yP as xi,_k as Dn,xQ as Ai,xR as V,xU as Di,_l as jn,y2 as Ee,_m as ji,xb as Ln,U8 as Pn,_n as Li,yc as Pi,_o as _n,_p as _i,_q as wi,_r as $i,zH as Fi,_s as Ri,_t as wn,yZ as $n,_u as Fn,zF as ye,_v as Ti,zC as Oi,_w as Mi,_x as Ni,_y as Ui,_z as Bi,_A as Vi,_B as en,_C as Hi,eg as qi,zL as Qi,_D as Ne,xv as zi,xq as Ki,_E as me,xG as Rn,xy as ve,xx as Gi,xB as Tn,_F as Zi,xw as Wi,_G as On,z3 as Mn,zu as nn,zp as Xi,_H as Ji,z4 as Yi,_I as eo,zv as no,zz as to,_J as Ue,wv as Nn,zg as io,ww as oo,_K as ao,_L as Un,c8 as co,ms as so,mt as ro,_M as tn,wu as pe,gl as lo,mz as uo,zm as Bn,zX as go,zj as Vn,uX as mo,uL as vo,hS as po,UB as on,UC as So,Gh as Hn,zU as fo,hK as Io,zR as ho,_N as Co,Vr as ko,_O as Eo,A0 as be,A1 as yo,_P as bo,_Q as qn,z_ as xo,_R as Ao,_S as Do,yg as jo,_T as Lo}from"./zeni-epic-state-BVJjEVAA.js";import{M as Po}from"./MobileAppDrawer-DLFLa7hS.js";import{q as Se}from"./QBOConnectionScreen-DreC-yDW.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-BeNfkHpZ.js";import"./empty-6MFM8UPN.js";import"./pdf-lib-CsM74zBq.js";import"./index-2QCkbhu2.js";import"./url-DUlo21cY.js";import"./index-D2oCZR3F.js";import"./decodeURIComponentSafe-DhqIXi_U.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]="038b8369-311a-4047-a2f6-eb64c1685cfc",t._sentryDebugIdIdentifier="sentry-dbid-038b8369-311a-4047-a2f6-eb64c1685cfc")}catch{}})();const w=({event:t,isReady:e=!0})=>e?c.jsx(et,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function _o(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:v,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(qt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((_,U)=>{const T=Qt(D,_,U,E);T!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:_,entityId:U,fromScreen:"audit_log",toScreen:_}),e(T))}),[E,e,D]);r.useEffect((()=>{const _=setTimeout((()=>u(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&t(Qe({filters:y,keepExistingListItems:!1,sort:m}))}),[i,y,m,t]);const A=v==="Not-Started"||v==="In-Progress"&&f.length===0,C=v==="In-Progress"&&f.length>0,j=v==="Completed";return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(nt,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:S,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{S&&I!=null&&t(Qe({cursor:I,filters:y,keepExistingListItems:!0,sort:m}))},onSearchChange:o,onSortChange:p})]})}function Ce(t,e=!1){const n=L(),i=k((s=>G(s).productNextCursor!=null)),a=k((s=>G(s).productNextCursor)),o=k((s=>G(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ee(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const p=d.current==="In-Progress";d.current=t,t==="Completed"&&p&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((p=>p+1)))}),[s,e]),a}const wo=new Set(["plan"]),$o=O((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(un({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t($e({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i}),t(dn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(zt({action:o,id:a,parentItemId:i}))}}}))(tt);function Fo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[a]=W(),{areTenantIdsInSync:o}=R(),s=(u=a.get("kind"))!=null&&wo.has(u)?u:"plan";var u;const d=k((y=>we(y,n))),{pageFetchState:p}=d,m=p.fetchState;r.useEffect((()=>(t(de({id:n})),()=>{t(de({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(xe({id:n,kind:s}))}),[o,n,s,t]);const v=r.useCallback((y=>t(xe({cacheOverride:!0,id:y,kind:s}))),[t,s]),S=ee(d.fetchState,d.isFormLoading,n,v),f=m==="Completed"&&!d.isFormLoading;Ce(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(m==="Not-Started"||m==="In-Progress"||d.isFormLoading);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx($o,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},S)]})}const Ro=new Set(["addon","charge","plan"]),To=new Set(["plan"]),Oo=O((function(t,e){const n=we(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${n}/catalog/${encodeURIComponent(a)}`:`${n}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(de({id:a})),e.navigate(`${n}/catalog`)},onChange:s=>{t($e({id:a,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{mode:i}),t(dn({id:a}))}}}))(it);function Mo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=F(),[a]=W(),{areTenantIdsInSync:o}=R(),s=n!=null,u=a.get("type"),d=u!=null&&Ro.has(u)?u:void 0,p=(m=a.get("kind"))!=null&&To.has(m)?m:"plan";var m;const v=k((S=>we(S,n)));return Ce(o,!0),r.useEffect((()=>{o&&t(xe({id:n,kind:p}))}),[o,n,p,t]),r.useEffect((()=>{s||d==null||v.localData.catalogType===d||t($e({localData:{...v.localData,catalogType:d}}))}),[s,d,v.localData?.catalogType,t]),r.useEffect((()=>{if(v.fetchState==="Completed"){const S=v.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(de({id:n}))}}),[v.fetchState,v.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Oo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const No={addons:"addon",all:"item",charges:"charge",plans:"plan"},Uo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{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:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=No[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onCatalogItemLifecycleAction:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:u,fromScreen:"catalog_list",itemId:s}),t(un({action:Kt(u),id:s}))},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(Ke({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?Ke({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(ot);function Bo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,p]=r.useState(""),[m,v]=r.useState(null),S=r.useMemo((()=>m!=null?{dir:m.direction,field:m.columnKey}:void 0),[m]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((_=>G(_))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed",j=h.runningActionId??null;return r.useEffect((()=>{const _=setTimeout((()=>p(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[i,t,I,E,S]),r.useEffect((()=>{i&&(f!==y||S?.field!==D?.field||S?.dir!==D?.dir)&&t(ze({cacheOverride:!0,planFilters:I,productFilters:E,planSort:S,productSort:S}))}),[y,D,i,t,I,E,f,S]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Uo,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:m,planFilters:I,productFilters:E,sort:S,planNextCursor:b,productNextCursor:A,runningCatalogItemActionId:j,onSearchChange:o,onTabChange:u,onSortChange:v})]})}const Vo=O((function(t,e){const n=gn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ue({id:i})),e.navigate(`${n}/discounts`)},onChange:s=>{t(Zt({id:i,localData:s}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{mode:a}),t(Gt({id:i}))}}}))(at);function Ho(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,savedCouponId:s}=k((u=>gn(u,n)));return r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ue({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCouponFormPage}),c.jsx(Vo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const qo=O((function(t){const e=mn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(pn(a))},onSubmit:()=>{const a=Jt(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(Yt(a))}}}))(st);function Qo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),[i]=W(),{areTenantIdsInSync:a}=R(),o=i.get("customerId"),s=k((b=>mn(b))),u=s.fetchState,d=s.localData,p=s.savedInvoiceId,m=k(vn),v=k((b=>Wt(b))),S=k(fe),f=v.fetchState==="Not-Started"||v.fetchState==="In-Progress"&&m==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,E=f||I,h=v.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(Ge()),()=>{t(Ge())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(pn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(Xt({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=p!=null?`/${n}/invoicing/invoices/${encodeURIComponent(p)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,p,e,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(ct,{}):c.jsx(qo,{navigate:e,tenantEmailDomain:n})]})}const zo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(rt);function Ko(){const t=L(),e=P(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>ei(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(ni({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(zo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const Go=O((function(t){const e=Sn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ii({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(lt);function Zo(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=Sn(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Ze({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ze({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ti(D)),onSortChange:p})]})}const Qn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Wo=O((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t(De({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new`)},onDiscardEdit:()=>{t(Y(ge)),t(di({id:i}))},onOpenAddress:()=>{const a=Qn(e.tenantEmailDomain??"",ge,i),o=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i}),t(De({id:i,localData:a})),t(In({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(li({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(ri({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(gt);function Xo(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((T=>Fe(T,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[p,m]=r.useState(!1),[v,S]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const T=s.record.sendLinkState.fetchState;C.current!=="Error"&&T==="Error"&&t(Re({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=T}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ie()),t(oe()),()=>{t(ie()),t(oe())})),[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(oi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(We({customerId:i}))}),[o,i,t,A]);const _=r.useCallback((T=>t(fn({id:T}))),[t]),U=ee(s.fetchState,s.isFormLoading,i,_);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(Wo,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(ie()),i!=null&&A&&t(We({customerId:i})),m(!0)},onCreatePromotionalCredits:()=>{t(oe()),S(!0)}},U),c.jsx(dt,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:p,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(ci({customerId:i}))},onClose:()=>{m(!1),t(ie())},onSavePaymentMethod:T=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(ai({customerId:i,data:T})))}}),c.jsx(ut,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:v,submitSucceeded:y.fetchState==="Completed",onClose:()=>{S(!1),t(oe())},onSubmit:({amount:T,description:te})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:T,customerId:i,fromScreen:"customer_detail"}),t(si({amount:T,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:te})))}})]})}const Jo=O((function(t,e){const n=Fe(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(hn({id:i})),t(Y(ge)),e.navigate(`${n}/customers`)},onChange:s=>{t(De({id:i,localData:s}))},onOpenAddress:()=>{const s=Qn(e.tenantEmailDomain??"",ge,i),u=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{mode:a}),t(In({id:i}))}}}))(mt);function Yo(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),{fetchState:s,savedCustomerId:u}=k((d=>Fe(d,i)));return r.useEffect((()=>{o&&i!=null&&t(fn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,p=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(p),t(hn({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomerFormPage}),c.jsx(Jo,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ea=O((function(t){const e=fe(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(Cn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(vt);function na(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),H),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Xe({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>t(ui(D)),onSortChange:p})]})}const Pe=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),ta=O((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:Pe(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=Pe(s,a),p=s.actionStateByKind.retry?.fetchState==="In-Progress",m=s.actionStateByKind.rollback?.fetchState==="In-Progress",v=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Le({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||p?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(Oe(a)))},onRollback:v?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(kn(a)))}:void 0}}))(pt);function ia(){const t=L(),e=P(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),[o,s]=r.useState({}),u=k(Te),d=k(Ie),p=r.useMemo((()=>{const E=Z.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),m=Pe(u,n),v=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(je(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Le({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const S=m?.status==="scanning"||m?.status==="importing";r.useEffect((()=>{if(!a||n==null||!S)return;const E=setInterval((()=>{t(je(n)),t(Le({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,S,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=v?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportDetailPage,isReady:m!=null&&I!=="Not-Started"}),c.jsx(ta,{authParams:p,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const zn=t=>`invoicing_active_migration:${t}`,se=(t,e)=>{if(t!=null&&t!=="")try{const n=zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},oa=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const s=o??null;t(ce(s)),se(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(Oe(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(kn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(St);function aa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(Te);r.useEffect((()=>{i&&(t(gi()),t(En()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(oa,{navigate:e,tenantEmailDomain:n,view:a})]})}const ca=O((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:p,sessions:m}=u,v=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),S=n!=null?p[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:S??m.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Re({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(pi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{n!=null&&t(Oe(n))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(vi(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(mi({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(ft);function sa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),a=k(vn),o=k(Ie),s=r.useMemo((()=>{const h=Z.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${re?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??Z.getSignedInUserTenant(n??"")?.companyId,p=k((h=>yn(h,d))),m=k(Te),{activeMigrationSessionId:v}=m,S=v??void 0,f=S!=null?m.sessionDetail[S]??m.sessions.find((h=>h.id===S)):void 0;r.useEffect((()=>{i&&(t(Me()),t(En()))}),[i,t]),r.useEffect((()=>{if(v!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(zn(y))}catch{return null}})(n);h!=null&&t(ce(h))}),[v,t,n]),r.useEffect((()=>{se(n,v)}),[v,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||S==null||!E)return;const h=setInterval((()=>{t(je(S))}),3e3);return()=>clearInterval(h)}),[i,S,E,t]),r.useEffect((()=>{I==="done"&&(t(ce(null)),se(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(ca,{activeId:S,authParams:s,integrationsView:p,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:m,onBack:()=>{t(ce(null)),se(n,null),e(`/${n}/invoicing/data_import`)}})]})}const ra=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(bn({action:a,id:i}))},onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i}),t(fi({data:a,id:i}))}}}))(It);function la(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((I=>Si(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[p,m]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&m(n)}),[n,d]);const v=p===n;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(Ae({id:n}))}),[a,n,t]);const S=r.useCallback((I=>t(Ae({cacheOverride:!0,id:I}))),[t]),f=ee(o.fetchState,o.isFormLoading,n,S);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(ra,{hasLoadedRecord:v,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const da=O((function(t){const e=xn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(bn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(hi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(ht);function ua(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=xn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Je({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(da,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>t(Ii(b)),onSortChange:p})]})}const ga=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(Q({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(Q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(Q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(Q({action:"retry",id:i}))}:void 0}}))(kt);function ma(){const t=L(),e=P(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((C=>Ci(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,p]=r.useState("idle"),[m,v]=r.useState(!1),[S,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{p("idle"),v(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(ki({id:n})),p("idle"),v(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(v(!1),p("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(Q({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&n!=null&&t(Ei({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(he({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{p("idle"),v(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(p("idle"),v(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&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,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?m&&o.actionState.fetchState==="Completed"?(n!=null&&t(yi({id:n})),h()):m&&o.actionState.fetchState==="Error"&&p("failed"):v(!0))}),[n,h,t,d,m,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(ga,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(Ct,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const va=O((function(t){const e=An(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(Q({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(xi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Et);function pa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=An(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),H),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(va,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>t(bi(b)),onSortChange:p})]})}const Sa=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail"}),t(Di({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
|
|
2
|
-
`).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(V({action:"void",invoiceId:i,body:s}))}}}))(yt);function fa(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=k((f=>Dn(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,p]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&p(n)}),[n,u]);const m=d===n;r.useEffect((()=>{a&&n!=null&&t(Ai({invoiceId:n}))}),[a,n,t]);const v=r.useCallback((f=>t(he({invoiceId:f}))),[t]),S=ee(o.actionState.fetchState,o.fetchState==="In-Progress",n,v);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(Sa,{invoiceId:n??"",hasLoadedRecord:m,navigate:e,tenantEmailDomain:i,view:o},S)]})}const Ia=O((function(t){const e=jn(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(V({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(V({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(V({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t(Ln({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(bt);function ha(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=jn(A);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:C.nextCursor,invoiceListFetchState:C.fetchState,voidingInvoiceId:C.runningActionId,invoices:C.invoices}}),H),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(Ee({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ee({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(ji(A)),t(Ee({cacheOverride:!1,filters:v,sort:m}))},onSortChange:p})]})}function an(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),i=xt(),a=ln(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=k(Pn),p=Li(i?.loggedInUserRoleMap),m=`/${n}/invoicing`,v=S=>{s(S)};return d==="completed"?c.jsx(B,{to:`${m}/overview`,replace:!0}):d==="settings"&&p?c.jsx(B,{to:`${m}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPromoPage}),c.jsx(Po,{isAppContentDrawerOpen:o,handleDrawerToggle:v}),c.jsx(At,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!p,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(Pi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{v(!0)}})]})}const Ca=O((function(t,e){const n=_n(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(Ri({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Fi())}}}))(Dt);function ka(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:p}=k((f=>_n(f,n??""))),m=`/${i}/invoicing`,v=r.useRef(null);r.useEffect((()=>{t(_i()),v.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(he({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&v.current!==n&&(v.current=n,t(wi({localData:$i(s)})))}),[t,o,s,n]);const S=r.useRef(p.fetchState);return r.useEffect((()=>{const f=S.current;S.current=p.fetchState,f!=="Completed"&&p.fetchState==="Completed"&&d!=null&&e(`${m}/credits/${encodeURIComponent(d)}`)}),[d,e,p.fetchState,m]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(Ca,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Ea=O((function(t){return{invoicingOverview:wn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t($n(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(jt);function ya(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>wn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t($n(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(Ea,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const ba=O((function(t){const e=Fn(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Oi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Lt);function xa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const _=Fn(j);return{activeType:_.activeTab,appliedSearch:_.filters.search,appliedSort:_.sort,nextCursor:_.nextCursor,transactionListFetchState:_.fetchState,transactions:_.transactions}}),H),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const _=y.find((T=>T.id===j)),U=_?.linkedInvoices?.[0]?.invoiceID??_?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const _=y.find((U=>U.id===j))?.customerID;_!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:_,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(_)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx(ba,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(Ti(j)),t(ye({cacheOverride:!1,filters:v,sort:m}))},onSortChange:p,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const Aa=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 cn(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:a}=R(),o=n!=null&&n!=="",s=k(fe),u=k((C=>Mi(C))),d=k(Ni),p=k((C=>Dn(C,n??""))),m=p.invoice,v=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ui()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?he({invoiceId:n}):Cn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&m!=null&&n!=null&&p.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Bi({contextInvoiceId:n,localData:Vi(m)})))}),[t,m,n,p.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Ln({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(en({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=d.fetchState,C!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${v}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${v}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,v]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:Aa(C)})))),[s.customers]),h=k((C=>Hi(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,_=qi.currencySymbol,wt("0,0.00",j,_)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,_}))),[h]),D=r.useMemo((()=>{if(!o||m==null)return;const C=m.currencyCode??"USD",j=m.amountDue?.amount??0;return{amountDue:Pt("0,0.00",m.amountDue),amountDueValue:j,currencyCode:C,customerName:m.customerName??m.customerID,invoiceId:m.id,invoiceNumber:m.invoiceNumber??m.id}}),[m,o]),b=o?`${v}/invoices/${encodeURIComponent(n??"")}`:`${v}/payments`,A=!o||p.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(_t,{customers:E,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(en({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Qi(o?n??void 0:void 0))}})]})}const Kn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Da=O((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Tn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(me({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Y(ve)),t(Gi({id:i}))},onOpenAddress:()=>{const s=Kn(e.tenantEmailDomain??"",ve,i),u=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(me({id:i,localData:s})),t(Rn({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))($t);function ja(){const t=L(),e=P(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),{areTenantIdsInSync:o}=R(),s=k((y=>Ne(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:p}=s,m=s.pageFetchState.fetchState,v=m==="Completed"&&!s.isFormLoading,[S,f]=r.useState(v?i:void 0);r.useEffect((()=>{i!=null&&v&&f(i)}),[i,v]);const I=S===i;Ce(o),r.useEffect((()=>{o&&i!=null&&t(zi({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(Ki({id:y}))),[t]),h=ee(s.fetchState,s.isFormLoading,i,E);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionDetailPage,isReady:v}),c.jsx(Da,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:p,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const La=O((function(t,e){const n=Ne(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(On({id:i})),t(Y(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{t(me({id:i,localData:o}))},onOpenAddress:()=>{const o=Kn(e.tenantEmailDomain??"",ve,i),s=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,{mode:a}),t(Rn({id:i}))}}}))(Ft);function Pa(){const t=L(),e=P(),n=X(),{subscription_id:i,tenantEmailDomain:a}=F(),[o]=W(),{areTenantIdsInSync:s}=R(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:p}=k((S=>Zi(S,i))),m=k((S=>Ne(S,i).localData));Ce(s),r.useEffect((()=>{s&&t(Wi({subscriptionId:i}))}),[s,i,t]);const v=r.useRef(!1);return r.useEffect((()=>{v.current||i!=null||u==null||u===""||m.customerId!==""||(v.current=!0,t(me({id:i,localData:{...m,customerId:u}})))}),[u,i,m,t]),r.useEffect((()=>{if(d==="Completed"){const S=p??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),t(On({id:i}))}}),[d,p,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(La,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const _a=O((function(t){const e=Mn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Tn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(Yi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Rt);function wa(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,p]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Mn(C);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),H),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(nn({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(Xi())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(_a,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>t(Ji(C)),onSortChange:p})]})}const $a=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(to({action:"capture",id:i}))}:void 0}}))(Tt);function Fa(){const t=L(),e=P(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:a}=R(),o=k((u=>eo(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(no({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx($a,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function Gn(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=R(),u=k(Ue),d=u.connection?.connected===!0,p=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&p!=="Not-Started"||o(Nn()),n&&o(io()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(oo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const Ra={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function ne(t){const e=L(),{areTenantIdsInSync:n}=R(),{tenantEmailDomain:i}=F(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:p}=k(ao),{configError:m,configFetchState:v,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Un),h=k(Ue);Gn({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(Ie),D=t==="dunning"||t==="quickbooks",b=y.companyId??Z.getSignedInUserTenant(i??"")?.companyId,A=k(($=>yn($,b))),C=co(y.userRole??[]),j=y.tenantId??"",_=Z.getSignedInUser(),U={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:j},T=s?.fileId,te=k(($=>T!=null&&T!==""?so($,T):void 0)),Be=k(($=>T!=null&&T!==""?ro($,T):void 0)),Zn=T!=null&&T!==""&&te!=null?{[T]:te}:{},Wn=T!=null&&T!==""&&Be!=null?{[T]:Be}:{};r.useEffect((()=>(e(tn()),()=>{e(tn())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[n,e,a]),r.useEffect((()=>{n&&D&&v==="Not-Started"&&e(pe())}),[n,e,v,D]),r.useEffect((()=>{if(!n)return;const $=_?.userId;$!=null&&$!==""&&j!==""&&qe.shouldFetchActiveTenant(j)&&(qe.markActiveTenantFetchStarted(j),e(lo($,j,_?.zeniSessionId)))}),[n,e,_?.userId,_?.zeniSessionId,j]);const Xn=S.length>0||f.length>0,Jn=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!Xn&&(v==="Not-Started"||v==="In-Progress"),Yn=a==="Completed"&&(!D||v==="Completed"),Ve=A.externalConnections?.revenue?.find(($=>$.connectionName==="chargebee"))?.connectionId,ke=re?.invoicingMicroServiceBaseUrl,He=ke!=null&&ke.length>0?`${ke}/1.0/webhooks/stripe`:"",z={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:p.fetchState==="In-Progress",onConnectStripe:$=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(ho($))},onDisconnect:($,q)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:q,entityId:$,fromScreen:t??"hub"}),e(Io(j,$,on(q))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(fo())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const $=y.tenantEmailDomain??i??"";Se.init("/connection/auth",$),Se.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Hn()))},onSaveChargeBeeCredentials:($,q)=>{Ve!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(po(j,Ve,on("revenue"),So("chargebee"),{api_key:$,site:q})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He};return{authParams:U,deleteFileStatusById:Zn,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:re?.fileMicroServiceBaseUrl??"",integrationsSectionProps:z,isInvoicingPageReady:Yn,isLoading:Jn,isSaving:u.fetchState==="In-Progress",isStripeBusy:p.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&v==="Error"?m?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:p.fetchState==="Error"?p.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:He,updateFileStatusById:Wn,onConnectStripe:z.onConnectStripe,onDeleteFile:$=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(vo($,j))},onDisconnectStripe:z.onDisconnectStripe,onEditFileName:($,q)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(mo($,q.split(".")[0],j))},onReconnectQBO:z.onReconnectQBO,onRefreshQBO:z.onRefreshQBO,onRetryQboSyncTask:$=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:$,fromScreen:t??"hub"}),e(Vn($))},onSave:$=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(go({settings:$,snackbarSection:Ra[t??""]}))},onStartQboBackfill:$=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(Bn($))},updateFilesEntity:$=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(uo({files:$}))}}}function sn({appContent:t}){const e=P(),n=X(),i=L(),{tenantEmailDomain:a}=F(),o=ne("branding"),s=k((p=>Co(p))),u=k((p=>ko(be,p)?.addressToCreate));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&(i(Eo()),i(Y(be)))}),[s.saveState.fetchState,i]);const d=_e(s.saveState.fetchState);return r.useEffect((()=>{d==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[d,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ot,{address:u,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:p=>{i(bo({localData:p}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const p=`/${a}/invoicing/settings/branding/${be}/`,m=J(n.state?.pathnameStackToGoBack,n.pathname);e(p,{state:{pathnameStackToGoBack:m}})},onSubmit:()=>i(yo()),updateFilesEntity:o.updateFilesEntity})]})}function Ta(){const t=P(),e=ne("dunning");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Mt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Oa(){const t=P(),e=ne("integrations");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Nt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Ma(){const t=P(),e=ne("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Ut,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const Na=O((function(t){const e=qn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(Do({localData:e}))},onReset:()=>{t(Ao())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Vn(e))},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(xo())},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(Bn(e))}}}))(Bt);function Ua(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),i=k(Ie),{configFetchState:a,saveState:o,settingsFetchState:s}=k(qn),u=_e(o.fetchState);return r.useEffect((()=>{u==="In-Progress"&&o.fetchState==="Completed"&&e("..")}),[e,u,o.fetchState]),r.useEffect((()=>{s!=="Not-Started"&&s!=="Error"||t(Me())}),[t,s]),r.useEffect((()=>{a==="Not-Started"&&t(pe())}),[a,t]),Gn({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Na,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Se.init("/connection/auth",i.tenantEmailDomain??n??""),Se.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Hn())}})]})}const Ba={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Va(){const t=ln(),e=L(),n=P(),[i,a]=W(),o=ne(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:p,isStripeConnected:m}=k(Un),v=i.get("tab");return r.useEffect((()=>{if(v==null)return;const S=Ba[v];a({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[v,n,a]),c.jsxs(c.Fragment,{children:[c.jsx(w,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Vt,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:p,isStripePaymentsReady:m,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(jo())}})]})}function rn(){return c.jsxs(ae,{children:[c.jsx(x,{index:!0,element:c.jsx(Va,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(Ma,{})}),c.jsx(x,{path:"branding",element:c.jsx(sn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(sn,{appContent:c.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Oa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(Ta,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Ua,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:"..",replace:!0})})]})}function Sc(){const t=L(),e=P(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=R(),{enableState:a,fetchState:o,status:s}=k(Pn),u=_e(a.fetchState),d=`/${n}/invoicing`,p=r.useRef(!1),m=k((v=>Ue(v).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||p.current||(p.current=!0,t(pe({cacheOverride:!1}))):t(pe({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&m==="Not-Started"&&t(Nn())}),[i,t,m]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(Lo()))}),[u,a.fetchState,d,t,e]),s==null&&o!=="Error"?c.jsx(Ht,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ae,{children:[c.jsx(x,{path:"promo",element:c.jsx(an,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"*",element:c.jsx(B,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ae,{children:[c.jsx(x,{path:"/",element:c.jsx(B,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(ya,{})}),c.jsx(x,{path:"promo",element:c.jsx(B,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(na,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(Yo,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(Xo,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(wa,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(Pa,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(ja,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(K,{})}),c.jsx(x,{path:"invoices",element:c.jsx(ha,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Qo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(fa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(cn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(ka,{})}),c.jsx(x,{path:"payments",element:c.jsx(xa,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(cn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Fa,{})}),c.jsx(x,{path:"credits",element:c.jsx(Zo,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(Ko,{})}),c.jsx(x,{path:"discounts",element:c.jsx(ua,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Ho,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(la,{})}),c.jsx(x,{path:"dunning",element:c.jsx(pa,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ma,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Bo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(Mo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Fo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(rn,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(_o,{})}),c.jsx(x,{path:"data_import",element:c.jsx(aa,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(sa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ia,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{Sc as default};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./liveblocks-CgHUgeBY.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-Cc7wW2EM.js";import{Uu as k,Uv as v,Uw as T,Jy as D,Jk as U,Ux as B,Uy as oe,Uz as ie,Jo as se,gi as $,Jv as le,Js as re}from"./zeni-epic-state-BVJjEVAA.js";import{a2 as x,K as r,a3 as de,j,_ as G,a4 as ce,a5 as me,a6 as pe,p as M,N as ue,f as he,a7 as ge,F as xe,E as be,e as fe,a8 as we,a9 as Se,a0 as ye,aa as ke,ab as ve,ac as je,ad as $e}from"./index-vIt7RQvO.js";import{n as m}from"./mui-C4zFSCiU.js";import b from"./NotFoundScreen-DzxbROot.js";import{a as I}from"./sentry-DSWD_gIh.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.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]="b81b6c16-f88c-447d-a339-4a806b0b85b5",e._sentryDebugIdIdentifier="sentry-dbid-b81b6c16-f88c-447d-a339-4a806b0b85b5")}catch{}})();const Ie=m.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
10
|
-
`,Ce=g((function(e){const a=k(e),n=v(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(b,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
|
|
11
|
-
display: flex;
|
|
12
|
-
height: 100vh;
|
|
13
|
-
width: 100%;
|
|
14
|
-
flex: 1 1 auto;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
align-items: center;
|
|
17
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
18
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
19
|
-
`,Be=g((function(e,a){const{isSubPage:n}=a;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,a){const{navigate:n,location:o}=a,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const a=C(),n=y(),o=x();return t.jsx(t.Fragment,{children:t.jsx(De,{windowSize:o,children:t.jsx(Be,{location:n,navigate:a,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let a="../";for(let n=0;n<e;n++)a=`${a}../`;return a},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Ne=m.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
height: 100%;
|
|
22
|
-
width: 100%;
|
|
23
|
-
flex: 1 1 auto;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
align-items: center;
|
|
26
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
27
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
28
|
-
`,Le=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(b,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Le,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
|
|
29
|
-
display: flex;
|
|
30
|
-
height: 100%;
|
|
31
|
-
width: 100%;
|
|
32
|
-
flex: 1 1 auto;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
align-items: center;
|
|
35
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
36
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
37
|
-
`,Te=g((function(e){const a=k(e),n=v(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{j.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=M(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(b,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new je(100,58)},Me=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
|
-
`,He=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
|
-
`,Je=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
|
-
`,Ke=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
|
-
`,Ve=g((function(e,a){return{file:a.file,type:a.type}}))(ve);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),H=n.pathname.includes("address"),f=x(),J=xe(),A=be(),w=fe(),K=()=>{J.toggle()},V=E((u=>k(u))),_=E((u=>v(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:R}=V,{tenantId:z,userId:N,sessionId:L}=W,{fetchState:X,internationalBankAccountCreateStatus:Y}=_;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[w,c,i,o,d,a]),I.useEffect((()=>{w&&c==="Completed"&&($(N,L,z),l!=null&&a(re(l)))}),[c,w,N,L,z,l,a]),c==="Error"?t.jsx(b,{}):X==="Completed"||Y.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:j,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",_e(n.pathname),Q,R))(u)}),t.jsxs(He,{windowSize:f,children:[f!=="small"?t.jsx(Me,{onClick:K}):null,t.jsx(Ke,{windowSize:f,isAddressPage:H,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(Ve,{file:q,type:"bill"})}),t.jsx(Je,{windowSize:f,children:e})]})]})}const _e=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(b,{})})]})}export{dt as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-CgHUgeBY.js";import{a as g}from"./sentry-DSWD_gIh.js";import{u as O,g as _,h as w,t as M,j as l,N as L}from"./core-Cc7wW2EM.js";import{z as r,E as P,G as V,T as A,j as N,U as $,$ as q,a0 as G,Y as R}from"./index-vIt7RQvO.js";import{fF as W,TZ as Y,Uq as Z,Uh as B,gi as H,gk as J,Um as K,gU as Q,dj as X,Ur as ee,Us as te}from"./zeni-epic-state-BVJjEVAA.js";import{n as ne}from"./mui-C4zFSCiU.js";import{u as se}from"./useDeviceId-B5zol9VP.js";import{f as ae}from"./analyticsHelper-Ch9SsWjb.js";import{t as ie}from"./getLocaleForTenant-Bgt5rFzV.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="cab6e249-5182-4955-955d-2e0ea82a8c9e",t._sentryDebugIdIdentifier="sentry-dbid-cab6e249-5182-4955-955d-2e0ea82a8c9e")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),f=w(),[y]=M(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>Y(e))),D=r.getSignedInUser(),v=P().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(Z(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[h,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{f("/signin/auth")}),[f]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(q,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||m==null||I==="Error"){const e=a.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Te as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as _}from"./liveblocks-CgHUgeBY.js";import{a as m}from"./sentry-DSWD_gIh.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-Cc7wW2EM.js";import{fF as ne,T_ as Ue,T$ as se,g9 as xe,fE as Ne,U8 as Ve,U1 as Pe,U2 as Re,p$ as Oe,gm as je,U5 as b,Ua as Le,Ub as Q,gn as Ze,Uc as ze,Eb as He,h1 as qe,cV as Ye,Ud as We,g8 as Je,go as Ke}from"./zeni-epic-state-BVJjEVAA.js";import{w as Qe,i as Xe,F as ea,N as aa,c as ta,e as na,u as sa,f as c,g as oa,V as ia,z as ra,d as da,k as ca,n as la,r as ua,o as ma,q as X,L as fa,H as ha,I as ba,p as S,j as ee,x as pa,O as ae,A as ga,C as Sa}from"./index-vIt7RQvO.js";import{D as Ea}from"./mui-C4zFSCiU.js";import{u as ka}from"./InboxNotificationsProvider-CYNlrTK-.js";import{u as Ca}from"./useTaskManagerAccess-BeNfkHpZ.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]="4aae0ae4-52f9-45cc-8ac8-3cad20bd8379",l._sentryDebugIdIdentifier="sentry-dbid-4aae0ae4-52f9-45cc-8ac8-3cad20bd8379")}catch{}})();const Ta=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Ne(e))),{status:ie}=t(Ve),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,U=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),N=t((e=>Pe(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),v=t((e=>Re(e)));m.useEffect((()=>{C&&T&&!f&&v.fetchState==="Not-Started"&&r(Oe(!0))}),[C,T,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?je(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),V=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>b(e).totalUnreadCount)),Ce=t((e=>b(e).reducedFetchCountState)),P=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),R=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:j,isLoading:L,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Te}=ka();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(L===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&j!=null){const e=`dashboard_${o.companyId}`;M(j.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[L,Z,z]),m.useEffect((()=>{C&&k&&!f&&O.fetchState==="Not-Started"&&B.tenantId!=null&&r(Le("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,q=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"),V===!1&&h.push("expense_automation_card");const Y=t((e=>ze(e,h).fetchState)),W=t((e=>He(e).fetchState)),ye=A&&(Y==="Completed"||Y==="Error")||U&&(W==="Completed"||W==="Error")||!A&&!U?void 0:"disabled",we=m.useMemo((()=>qe(o.userRole)),[o.userRole]),Ae=Ye(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&N.fetchState==="Completed"&&We(N.notificationSettings,p.userEmail,x,o,k),J=da(),Fe=J&&ca(a);return _.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:V,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:J,onNotificationIconClick:()=>{i(!1);let e=P===0&&R>0?"notifications/comments":"notifications/tasks";X(a)&&(e=P===0&&R>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,_e=ae(K)&&K!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(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)&&Ue(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ta,{...l,...a})};export{Ba as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-CgHUgeBY.js";import{h as r,l as n}from"./core-Cc7wW2EM.js";import{an as i}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import"./sentry-DSWD_gIh.js";import"./zeni-epic-state-BVJjEVAA.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.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{n as mt,b as lt,o as ft,j as N}from"./liveblocks-CgHUgeBY.js";import ut from"./NotFoundScreen-DzxbROot.js";import{a as k}from"./sentry-DSWD_gIh.js";import{h as ht,g as pt,i as kt,u as gt,j as b,l as bt,n as St,o as Y}from"./core-Cc7wW2EM.js";import{cA as It,U1 as J,fF as K,h1 as Tt,U5 as S,a0$ as Q,Ub as m,T$ as y,Ar as j,G8 as Ct,a10 as At,T_ as yt,Ud as Et,Aw as _t,a11 as $,br as F,gh as x,AA as z,a12 as Nt,cM as wt,cF as Bt}from"./zeni-epic-state-BVJjEVAA.js";import{ar as xt,c as Ut,N as vt,f as Dt,at as Rt,dL as Gt,p as w,dM as Pt,w as Mt,dN as $t,i as Ft,a5 as jt}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-7-6nPEHY.js";import{u as Lt}from"./useTaskManagerAccess-BeNfkHpZ.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="6ef0b39a-6948-4438-8d28-e0fb0fcfeaf3",t._sentryDebugIdIdentifier="sentry-dbid-6ef0b39a-6948-4438-8d28-e0fb0fcfeaf3")}catch{}})();const Wt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=bt((function(t,l){const n=J(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=S(t),f=K(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:v}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,T=w(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(z("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t($([a],F())));let i=`/${h}/${r[1]}`;const T=w(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!wt(g)&&(i="not-found"),r[1].startsWith("bill")&&!Bt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(y(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(Q(a,s));const d=`../${a}`,r=w(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(j("task_manager","dashboard",d))}else v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(z("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t($([i],F())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(y({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Wt(o,I).then((()=>{t($(o,F())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(y({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=jt(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=w(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt($t)),Ht=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=Ut(),[I,v]=k.useState(!1),a=b((e=>J(e))),s=b((e=>K(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Rt({isDataReady:!0});const Z=Tt(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=b((e=>S(e).notificationDetailsByTab.tasks.fetchState)),L=b((e=>S(e).currentTab)),D=b((e=>S(e).currentSubTab)),tt=b((e=>S(e).notificationDetailsByTab.comments.fetchCountState)),R=b((e=>S(e).notificationDetailsByTab.comments.fetchState)),et=b((e=>S(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=b((e=>S(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Gt().allUsers,{inboxNotifications:B,isLoading:E,hasFetchedAll:C,isFetchingMore:G,fetchMore:ot}=mt(),{threads:W,isLoading:q,fetchMore:H,isFetchingMore:O,hasFetchedAll:X}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(Q(c)),c==null){const e=`../${L}`,p=w(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&B!=null){const e=`dashboard_${s.companyId}`,p=B.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(y({unreadCount:p},"comments"))}}),[E,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=E||G===!0||C!==!0||E||G===!0||C!==!0;k.useEffect((()=>{P&&R!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||R!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,R]),k.useEffect((()=>{o(y({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(v(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&q===!1&&B!=null&&W!=null){const e=`dashboard_${s.companyId}`,p=B.filter((u=>u.roomId===e)).filter((u=>Pt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=W.find((dt=>{return dt.id===((U=u).kind==="thread"?U.threadId:"subjectId"in U?U.subjectId:void 0);var U}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(O||X===!0||H==null||H(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(y({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[E,G,O,C,X,q,B?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(Ft(p)){const A=yt(p.mode);if(A==="dashboard"&&o(y({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),o(j("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(St,{children:[N.jsx(Y,{path:"/:selectedTab",element:N.jsx(Ht,{})}),N.jsx(Y,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-CgHUgeBY.js";import{a as r}from"./sentry-DSWD_gIh.js";import{u as j,g as A,j as o,N as C}from"./core-Cc7wW2EM.js";import{UE as P,fF as x,gm as z,UF as D,UG as M,UH as R,UI as F,pS as k,Tj as L}from"./zeni-epic-state-BVJjEVAA.js";import{z as h,ai as I}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="e3455a42-91d2-4bba-97a0-8d29f99e4003",n._sentryDebugIdIdentifier="sentry-dbid-e3455a42-91d2-4bba-97a0-8d29f99e4003")}catch{}})();function ee(){const n=j(),a=A(),{params:t,error:i}=r.useMemo((()=>P(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),p=h.isSignedIn(),s=h.getSignedInUser(),m=o((e=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),b=o(M),u=o(R),[S,U]=r.useState(null),[v,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(F())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=S??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:U,approveError:v??b,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(L(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(C,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./liveblocks-CgHUgeBY.js";import{h as G,u as W,g as z,i as Z,j as d,l as H,n as J,o as S}from"./core-Cc7wW2EM.js";import{fF as v,Ac as R,v5 as K,Vw as w,v0 as C,bq as Q,b$ as X,v1 as ee,Vx as ae,Ve as y,ei as te,E0 as se,Vy as oe,Eo as re,d_ as ne,dZ as ce}from"./zeni-epic-state-BVJjEVAA.js";import{aj as ie,z as le,ar as de,at as me,P as fe,a9 as pe,j as M,aE as ue,p as he,N as Fe,f as ge}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import Ie from"./NotFoundScreen-DzxbROot.js";import{F as be}from"./FeaturePreviewScreen-OtBPdCPK.js";import{a as F}from"./sentry-DSWD_gIh.js";import{u as Se}from"./useAskAiCfoHostNavButtonProps-7-6nPEHY.js";import{u as ye}from"./useInitialThreadRequest-D4Y8xhXu.js";import{t as Ce}from"./routePaths-C0UIXwMQ.js";import{M as Te}from"./MobileAppDrawer-DLFLa7hS.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-BeNfkHpZ.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]="209478dc-78a2-49b2-8a34-2ed7ecad5961",s._sentryDebugIdIdentifier="sentry-dbid-209478dc-78a2-49b2-8a34-2ed7ecad5961")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=H((function(s){const e=ae(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:M}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(C(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(re(a))},onForecastVsActualsCompareToggle:a=>{s(oe(a)),s(y({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(se(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=te(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=Ce(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=he(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(y({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(y({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(ue);function U(){const s=ie(),e=G(),a=W(),o=z(),{forecastId:r,tenantEmailDomain:c}=Z(),[p,u]=F.useState(!1),[m,x]=F.useState(!1),g=le.getSignedInUser(),A=d((t=>v(t))),_=A.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),j=d((t=>t.profitAndLossState)),D=d((t=>t.reportUIOptionsState.selectedForecast)),E=t=>j.pandLByForecastID[t]!=null&&ee(t,j).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:I}=de();me({isDataReady:l});const{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=Se({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&I)u(!0),l||a(K());else if(l&&!m){x(!0);const t=((f,L,O)=>L!=null?f.forecasts.findIndex((b=>b.id===L)):O!=null?f.forecasts.findIndex((b=>b.id===O)):f.forecasts.length>0?0:-1)(i,r,D?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=D?.index?(a(w(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!E(i.forecasts[t].id)&&I&&a(C(i.forecasts[t].id))}}),[p,u,a,l,i,m,x,R,C,I]);const P=fe(),B=P?.loggedInUserRole!=null&&Q(P.loggedInUserRole),$=ye(A?.companyId,{clearParams:l&&m}),[q,Y]=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 k=t=>{Y(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(pe,{analytics:M,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Te,{isAppContentDrawerOpen:q,handleDrawerToggle:k}),n.jsx(xe,{firstMonthOfFY:_,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:E,meetingUrl:X(h.toString()),hasTransactionAccess:B,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,initialOpenThreadRequest:$,onClickMenuIcon:()=>{k(!0)}})]})}function Ze(){const s=d((c=>v(c))),{useFeatureGate:e}=Fe(),{isFeatureEnabled:a}=e(ge.isDebitCardFeatureEnabled),o=ne(a,s),r=ce(s);return o===!0||r===!0?n.jsx(be,{}):n.jsxs(J,{children:[n.jsx(S,{path:"/",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId/*",element:n.jsx(Ie,{})})]})}export{Ze as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-CgHUgeBY.js";import{Vs as re,fF as N,l$ as G,d_ as Y,dZ as le,Sj as Q,UR as ce,CX as Ee,Vt as q,CM as je,D5 as Le,C$ as de,CQ as pe,D3 as ve,D0 as Te,Vu as ue,sq as Ve,g6 as Ae,gD as Fe,Vv as _,CU as me,CT as ge,D8 as Re,c8 as Oe}from"./zeni-epic-state-BVJjEVAA.js";import{a2 as fe,N as J,f as H,z as K,g as Ce,X as he,ag as ye,aA as be,aB as Ue,ac as Se,K as R,ah as De,G as M,aC as Ze,ar as Be,at as $e,a9 as ze,j as we,U as _e,p as He,aD as Ge,P as Ke}from"./index-vIt7RQvO.js";import{D as xe,n as W,S as Ie}from"./mui-C4zFSCiU.js";import ae from"./NotFoundScreen-DzxbROot.js";import{a as c}from"./sentry-DSWD_gIh.js";import{u as ee,i as Me,j as g,h as We,g as Xe,l as qe,n as se,o as z}from"./core-Cc7wW2EM.js";import{u as Ne}from"./useAskAiCfoHostNavButtonProps-7-6nPEHY.js";import{M as Ye}from"./MobileAppDrawer-DLFLa7hS.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-BeNfkHpZ.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]="7ee0a023-f1d2-4e27-82b3-14fa89c29900",e._sentryDebugIdIdentifier="sentry-dbid-7ee0a023-f1d2-4e27-82b3-14fa89c29900")}catch{}})();const Qe={overlayWidth:new Se(100,100,48)},te=M.getLocalizedStrings().peoplePage.invitePage,ne=M.getLocalizedStrings().common,Je=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=c.useState(!1),[k,S]=c.useState(!1),{userId:D}=Me(),r=g((l=>re(l))),p=g((l=>N(l))),P=g((l=>G(l))),{useFeatureGate:x}=J(),{isFeatureEnabled:I}=x(H.isDebitCardFeatureEnabled),E=Y(I,p),v=le(p),T=Q(p),Z=ce(p),B=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,w=!E&&P&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(q()),b()},V=()=>{O===!0?S(!0):h()},$=d.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=x(H.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:A}=he(p?.tenantId),y=!L||A,F=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,isAccountingClassesEnabled:P,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isLiteRoleDisabled:Z===!1,isBankingOnlyTenant:E,isCardsOnlyTenant:v,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(de({peopleLocalData:l})),U(!0)},onSaveClick:()=>{m(f==="zeni_only"?je(e):Le(T))},onCloseClick:V,isLoading:w||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return c.useEffect((()=>{w===!1&&D!=null&&m(Ee(D))}),[w,D]),c.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:Qe.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:V,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Pe,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Ue,{...s})]})})},ea=W(Ie)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,ke=W(De.H6Regular)`
|
|
6
|
-
margin-top: ${R.sp7};
|
|
7
|
-
padding-left: ${R.sp8};
|
|
8
|
-
padding-right: ${R.sp8};
|
|
9
|
-
color: ${e=>e.theme.colors.primary};
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
`,Pe=W(De.LargeRegularSp)`
|
|
12
|
-
color: ${e=>e.theme.colors.hero};
|
|
13
|
-
padding-left: ${R.sp8};
|
|
14
|
-
padding-right: ${R.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${R.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=M.getLocalizedStrings().peoplePage.invitePage,ie=M.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const C=fe(),m=ee(),[O,U]=c.useState(!1),[k,S]=c.useState(!1),D=g((o=>re(o))),r=g((o=>N(o))),p=g((o=>G(o))),{useFeatureGate:P}=J(),{isFeatureEnabled:x}=P(H.isDebitCardFeatureEnabled),I=Y(x,r),E=le(r),v=Q(r),T=ce(r),Z=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,B=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const w=()=>{b(),m(q())},h=()=>{O===!0?S(!0):w()},V={onOkClick:()=>{S(!1),w()},onCancelClick:()=>{S(!1)}},$=d.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=P(H.isChargeCardFeatureEnabled),L=Ce(r,j,x),{isCardsHidden:A}=he(r?.tenantId),y=!L||A,F=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,onPeopleLocalDataUpdated:o=>{m(de({peopleLocalData:o})),U(!0)},onResetClick:w,onSaveClick:()=>{m(f==="zeni_only"?ve(e):Te())},onCloseClick:h,peopleDetails:D,isAccountingClassesEnabled:p,isReimbursementDisabled:Z===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:E,isLoading:B};return c.useEffect((()=>{D.invitePersonState.fetchState==="Completed"&&(b(),m(q()))}),[D.invitePersonState.fetchState]),a.jsx(xe,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:oe.discardTitle}),descriptionComponent:a.jsx(Pe,{children:oe.discardDescription}),primaryButtonText:ie.yes,secondaryButtonText:ie.no,action:V}):null,a.jsx(Ze,{...s})]})})},ta=W(Ie)`
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 100%;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
`,na=qe((function(e,t){const d=ue(e),n=K.getSignedInUser();return{data:d,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(e),analytics:we}}),(function(e,t){const{navigate:d,companyId:n,shouldFetchClasses:f}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Re(i))},onReloadPeople:()=>{e(me()),e(ge(n,f))},onBackClick:()=>{d("../../")},onModeChange:i=>{e(_({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(_({searchText:i}))}}}}))(Ge);function X({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const d=We(),n=ee(),f=Xe(),{areTenantIdsInSync:i}=Be(),b=K.getSignedInUser(),C=g((s=>N(s))),{useFeatureGate:m}=J(),{isFeatureEnabled:O}=m(H.isDebitCardFeatureEnabled),U=g((s=>G(s))),k=!Y(O,C)&&U,S=Q(C),D=C?.tenantId,{tenantEmailDomain:r}=C,[p,P]=c.useState(!1),[x,I]=c.useState(!1),[E,v]=c.useState(!1),[T,Z]=c.useState("off"),[B,w]=c.useState(!1),h=s=>{w(s)},{isAiCfoAccessEnabled:V,onAskAiCfoClick:$}=Ne({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ve(s.classState,s.classListState))),L=g((s=>Ae(s.userState,s.userRoleState,s.userListViewState,"manager"))),A=g((s=>Fe(s))),y=C?.companyId;c.useEffect((()=>{p&&T===u.uiState.mode||!i||(n(_({searchText:"",sortKey:"name",sortOrder:"ascending"})),Z(u.uiState.mode),P(!0),n(me()))}),[p,b,D,n,u.uiState.mode,i]),c.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),c.useEffect((()=>{I(e!=null&&e===!0),v(t!=null&&t===!0&&t)}),[e,t]),c.useEffect((()=>{n(_({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const F=()=>{I(!1),v(!1),d("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:we,onLoad:s=>s.trackPageLoaded(_e.Event.members)}):null,x===!0?a.jsx(sa,{closeDrawerHandler:F,isInvitePeopleDrawerOpen:x,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,E===!0?a.jsx(Je,{closeDrawerHandler:F,isEditPeopleDrawerOpen:E,managersListView:L,companyPassportView:A,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ye,{isAppContentDrawerOpen:B,handleDrawerToggle:h}),a.jsx(na,{navigate:d,signedInUser:b,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{d("./new")},onColumnSortConfigChanged:(s,o)=>{n(_({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=He(f.state?.pathnameStackToGoBack,f.pathname);d(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:V,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(X,{})}),a.jsx(z,{path:"new",element:a.jsx(X,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(X,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CgHUgeBY.js";import E from"./NotFoundScreen-DzxbROot.js";import{a as r}from"./sentry-DSWD_gIh.js";import{h as _,g as v,j as p,i as M,u as U,N as F,l as O,n as P,o as h}from"./core-Cc7wW2EM.js";import{fF as z,a13 as b,bo as B,bn as N,iL as V,gh as L}from"./zeni-epic-state-BVJjEVAA.js";import{F as $,z as I,at as q,dO as G}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-7-6nPEHY.js";import{M as J}from"./MobileAppDrawer-DLFLa7hS.js";import"./recharts-DJGeJ2v_.js";import"./analytics-S5MhEivL.js";import"./plaid-vsHcqLdj.js";import"./dnd-DEyyKSEC.js";import"./stripe-cKAAJElX.js";import"./lottie-C1A2hiZE.js";import"./lexical-DXgKWO29.js";import"./pdf-rXyPRm1U.js";import"./utils-DiIEQ7_h.js";import"./InboxNotificationsProvider-CYNlrTK-.js";import"./useTaskManagerAccess-BeNfkHpZ.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]="aa4ffff6-daf5-4e24-934a-87cc938f85fb",e._sentryDebugIdIdentifier="sentry-dbid-aa4ffff6-daf5-4e24-934a-87cc938f85fb")}catch{}})();const K=O((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),c=$(),o=p((a=>z(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:m}=M(),u=U(),d=I.getSignedInUser();if(d==null)throw new Error("Can't access this page without signing in...");const l=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(d),y=C||k||x,f=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&l.current&&(u(L({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),l.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||f(a,i,!0),l.current=!0}),[n?.fetchState,f]),j=r.useCallback(((a,i)=>{f(a,i,!1)}),[f]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return q({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:c,currentTenant:o,signedInUser:d,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(F,{to:`/${m}/dashboard`,replace:!0})};function he(){return s.jsxs(P,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-CgHUgeBY.js";import Z from"./NotFoundScreen-DzxbROot.js";import{a as p}from"./sentry-DSWD_gIh.js";import{h as C,g as D,u as N,j as u,N as V,l as k,n as q,o as b}from"./core-Cc7wW2EM.js";import{fF as E,Z9 as h,Zq as w,NK as U,NG as L,NJ as f,Nz as B,ZP as $,ND as z,NM as K}from"./zeni-epic-state-BVJjEVAA.js";import{z as T,w as O,cb as F,q as W,bU as G,cc as J}from"./index-vIt7RQvO.js";import"./mui-C4zFSCiU.js";import{u as M,R as x}from"./ReimbursementApprovalRuleDetailScreen-BxglZgWl.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="36252915-8dd6-47d0-9b7a-3a81c1a66c06",e._sentryDebugIdIdentifier="sentry-dbid-36252915-8dd6-47d0-9b7a-3a81c1a66c06")}catch{}})();const j="reimbursement-approval-rule-update",P=k((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:w(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(j)&&e($(!1))},onBackClick:()=>{W(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))(O(F)),H=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),g=u((o=>w(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{g?.updateStatus.fetchState==="Completed"&&a(U())}),[g]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!1)))}),[t,S,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(R(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${j}`]:[],eventCallback:(o,y,I)=>{o.endsWith(j)&&I.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(P,{currentTenant:c,location:n,navigate:s,...m})},A="reimbursement-approval-rule-update",Q=k((function(e){const s=h(e),n=w(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e($(!1))},onBackClick:()=>{W(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(B(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(K(t,!0))}}}))(O(J)),X=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=G(e?.tenantId);return s?r.jsx(Y,{isLoading:n}):r.jsx(H,{isLoading:n})},Y=({isLoading:e})=>{const s=C(),n=D(),a=N(),[t,l]=p.useState(!1),[v,R]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),g=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));M();const y=u((i=>w(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(U())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||g!=="Not-Started"||e||(R(!0),a(z(!1,!0)))}),[v,g,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const I={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${A}`]:[],eventCallback:(i,ee,_)=>{i.endsWith(A)&&_.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(V,{to:"../../promo"}):r.jsx(Q,{currentTenant:m,location:n,navigate:s,isLoading:e,...I})};function le(){return r.jsxs(q,{children:[r.jsx(b,{path:"/",element:r.jsx(X,{})}),r.jsx(b,{path:"/new",element:r.jsx(x,{})}),r.jsx(b,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(b,{path:"*",element:r.jsx(Z,{})})]})}export{le as R};
|