@zeniai/web-app-ui 5.3.46-dev → 5.3.47-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-CfueHDEF.js → AccountMappingScreen-Euit4Ttk.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-fiSieMf_.js → ActualMatchingMatchDetailScreen-BBYzjOqh.js} +1 -1
- package/dist/assets/AddressRoutes-PvYGzHCA.js +1 -0
- package/dist/assets/AddressScreen-DsGvV3N8.js +9 -0
- package/dist/assets/{AiCfoScreen-V8xy8p4b.js → AiCfoScreen-DAEPn0_B.js} +1 -1
- package/dist/assets/{AppDrawer-CyBGsFud.js → AppDrawer-D4O6tn5i.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-C1N-qtHk.js → BillPayApprovalRoutes-BY4P9AKu.js} +1 -1
- package/dist/assets/BillPayRoutes-CWc4tAqm.js +119 -0
- package/dist/assets/{BusinessVerificationPageScreen-BScFHNdu.js → BusinessVerificationPageScreen-CSruI1nV.js} +2 -2
- package/dist/assets/CardsAiCfoScreen-COoYscKz.js +14 -0
- package/dist/assets/{ChargeCardRoutes-tPmmU_fw.js → ChargeCardRoutes-BU6-pfJv.js} +1 -1
- package/dist/assets/CompanyPassportScreen-BxoatMVb.js +1 -0
- package/dist/assets/ConnectionAuthScreen-zbcvhPbz.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-8IwDeKdF.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-BqAwy1Go.js → CustomerOnboardingRoutes-DV3rYEiJ.js} +3 -3
- package/dist/assets/{DashboardRoutes-C3Q7vlXr.js → DashboardRoutes-D5hdkebN.js} +1 -1
- package/dist/assets/{DefaultTenantHome-CPPof4Nd.js → DefaultTenantHome-DCPi_wXC.js} +1 -1
- package/dist/assets/{DomesticWireDetailScreen-Bo5pk1NL.js → DomesticWireDetailScreen-DgE28aJN.js} +4 -4
- package/dist/assets/{DrawerScreen-DYwMLd1Q.js → DrawerScreen-BihZ_PpN.js} +1 -1
- package/dist/assets/{EntityDetailRoutes-_eEqLjSQ.js → EntityDetailRoutes-BqX-J3vM.js} +1 -1
- package/dist/assets/{ExpenseAutomationRoutes-D17PZLn2.js → ExpenseAutomationRoutes-DK-U-YTd.js} +1 -1
- package/dist/assets/FeaturePreviewScreen-5SleVFKv.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-CDOpB-J7.js → HubSpotOAuthCallbackScreen-2RxbRDTZ.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-gj6fT2eX.js → InboxNotificationsProvider-BmF5-_KA.js} +1 -1
- package/dist/assets/InvoicingRoutes-D0S6fDxY.js +2 -0
- package/dist/assets/{MagicLinkRoutes-D8pvaYpW.js → MagicLinkRoutes-C22EnpRm.js} +8 -8
- package/dist/assets/MagicLinkSignInScreen-BVf-rLEH.js +12 -0
- package/dist/assets/MobileAppDrawer-0YtWXA3B.js +1 -0
- package/dist/assets/NotFoundScreen-BkYIKPgh.js +1 -0
- package/dist/assets/{NotificationRoutes-C0XszwDJ.js → NotificationRoutes-CZQRvVbE.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-CS66Nuk1.js → OAuthConsentScreen-Q7ZDvc1F.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-tEXmnuYa.js → PandLWithForecastRoutes-BzO_OgSq.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-Ba8XuIED.js → PaymentLinkScreen-B8bPleIr.js} +4 -4
- package/dist/assets/{PeopleRoutes-MPpefoB8.js → PeopleRoutes-D_nqmuPM.js} +9 -9
- package/dist/assets/PerformanceRoutes-BW6dixVF.js +1 -0
- package/dist/assets/{Preview-j2_daqeV.js → Preview-DMLQokX_.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-CAoS33ZU.js → QBOConnectionScreen-CWU6DFJl.js} +23 -23
- package/dist/assets/{ReimbursementApprovalRoutes-BqXyuFCU.js → ReimbursementApprovalRoutes-DAusugdf.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-B9f-fas4.js → ReimbursementApprovalRuleDetailScreen-phJuB98f.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-IZQbGrfA.js → ReimbursementRoutes-BdJ3oqBf.js} +1 -1
- package/dist/assets/{ReportsRoutes-R5Ca0XU-.js → ReportsRoutes-CDSCG28G.js} +1 -1
- package/dist/assets/RewardsRoutes-CHkOPz1g.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BMDMlpQa.js → ScheduleDetailsPrepaidExpensesScreen-DnVEpQsK.js} +5 -5
- package/dist/assets/{ScreenRoutes-Cwhq-96H.js → ScreenRoutes-BYAPWka6.js} +2 -2
- package/dist/assets/{SettingsRoutes-CMH4A66d.js → SettingsRoutes-BGCz0_nd.js} +3 -3
- package/dist/assets/{SetupPagesScreen-BzKWg1IS.js → SetupPagesScreen-DzNRL7Y-.js} +1 -1
- package/dist/assets/SignInScreen-BREpWd6T.js +1 -0
- package/dist/assets/SignOutScreen-BNCpbut8.js +9 -0
- package/dist/assets/TaskListScreen-Br-mxkKM.js +9 -0
- package/dist/assets/{TaskRoutes-BLHPB9C2.js → TaskRoutes-CDuiJExM.js} +1 -1
- package/dist/assets/TransactionDetailRoutes-CYb-4jKQ.js +1 -0
- package/dist/assets/{TransactionDetailScreen-Cyr21RUS.js → TransactionDetailScreen-Bp7IFDK0.js} +2 -2
- package/dist/assets/{TransactionListRoutes-DeHnVgrc.js → TransactionListRoutes-B6NIJUWk.js} +1 -1
- package/dist/assets/{TreasuryRoutes-CH1V36gd.js → TreasuryRoutes-BvvMozYl.js} +5 -5
- package/dist/assets/{VendorsRoutes-D5fLbpGk.js → VendorsRoutes-DsJ_lcDO.js} +1 -1
- package/dist/assets/{WiseConfirmationScreen-B4K2TMeC.js → WiseConfirmationScreen-Bg5_g49N.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-B_-Cub3b.js → ZeniAccountRoutes-C3fDjuMG.js} +7 -7
- package/dist/assets/{ZeniAccountStatementScreen-Cg7a4ZMC.js → ZeniAccountStatementScreen-CbdRQI0p.js} +1 -1
- package/dist/assets/{accountMappingHelper-DWzrp9Pr.js → accountMappingHelper-DqBiQF6x.js} +1 -1
- package/dist/assets/{analytics-wktvfErl.js → analytics-D6GpUSOP.js} +1 -1
- package/dist/assets/{analyticsHelper-BZsIqD3O.js → analyticsHelper-CwB3kQvw.js} +1 -1
- package/dist/assets/{core-D6EV-11Y.js → core-B5mDy9pu.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-MQV5aj_5.js → decodeURIComponentSafe-DANuhXnG.js} +1 -1
- package/dist/assets/{dnd-CkchuQYc.js → dnd-CGWe1ZMP.js} +1 -1
- package/dist/assets/{empty-PZV8n_Ql.js → empty-D0y6rZ_X.js} +1 -1
- package/dist/assets/{empty-DQLKD1Hp.js → empty-Dj4ZMRNZ.js} +1 -1
- package/dist/assets/{emptyVideoElement-CnlqukSR.js → emptyVideoElement-BbYSqu6F.js} +1 -1
- package/dist/assets/epic-mSW644GG.js +2 -0
- package/dist/assets/{expenseAutomationHelper-DEOPVtcg.js → expenseAutomationHelper-DBDpSggk.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DffZrhDN.js → getLocaleForTenant-DH5Avx3x.js} +1 -1
- package/dist/assets/{index-lv0eG9-7.js → index-6nH5LMe4.js} +27341 -27341
- package/dist/assets/{index-EnAqWoDC.js → index-6yt3BfRL.js} +1 -1
- package/dist/assets/{index-BlnK23AJ.js → index-8s12XWuB.js} +1 -1
- package/dist/assets/{index-CBlRXIxp.js → index-BQBXaLiB.js} +1 -1
- package/dist/assets/{index-B5kf_qFj.js → index-CI8tXM3D.js} +1 -1
- package/dist/assets/{index-CKDPlCKN.js → index-G6Wb7pfX.js} +2 -2
- package/dist/assets/{index-qI_nnuux.js → index-fq0DUtem.js} +1 -1
- package/dist/assets/{index-8ioAZPP6.js → index-k1-Pd2Ki.js} +1 -1
- package/dist/assets/{lexical-C6tQwGBF.js → lexical-DW4lC8Zx.js} +1 -1
- package/dist/assets/{liveblocks-DKqwsBQp.js → liveblocks-UOzcPsHa.js} +1 -1
- package/dist/assets/{lottie-BwhdO6jl.js → lottie-C5eNvt0I.js} +1 -1
- package/dist/assets/{mui-qouWiIWk.js → mui-Do6nLzGb.js} +1 -1
- package/dist/assets/{pathToGoBack-DMRqTTJ7.js → pathToGoBack-DP_bGWF-.js} +1 -1
- package/dist/assets/{pdf-DcGn_mX8.js → pdf-DjwvAC2g.js} +4 -4
- package/dist/assets/{pdf-lib-DndwkHl6.js → pdf-lib-CZXOqgb4.js} +1 -1
- package/dist/assets/{plaid-deRHM6gT.js → plaid-0g_vwjSd.js} +1 -1
- package/dist/assets/{pusher-BmM2v3Ys.js → pusher-BwlPp2s7.js} +1 -1
- package/dist/assets/{react-DZ82GBCj.js → react-Bja4MeVO.js} +1 -1
- package/dist/assets/{react-DFunsRdI.js → react-BsXfT48C.js} +1 -1
- package/dist/assets/{react-1c5WrJsc.js → react-CU01hiuh.js} +1 -1
- package/dist/assets/{react-D6U1M1pt.js → react-Dex3foBA.js} +1 -1
- package/dist/assets/{react-DiQLb4cq.js → react-DkYBVdJJ.js} +1 -1
- package/dist/assets/{react-QkGRtVkE.js → react-RZilWHYG.js} +1 -1
- package/dist/assets/{recharts-C9zWmt1W.js → recharts-uFX1dZS-.js} +1 -1
- package/dist/assets/{routePaths-BxLZuqJn.js → routePaths-uBvxqlLY.js} +1 -1
- package/dist/assets/{sentry-CxSdF_rC.js → sentry-DHDsO12F.js} +1 -1
- package/dist/assets/{stripSplatSuffix-CYVrHv_0.js → stripSplatSuffix-CQQXAy0N.js} +1 -1
- package/dist/assets/{url-Ej5v3O6d.js → url-BxiN6LKq.js} +1 -1
- package/dist/assets/{url-BSgCM0lM.js → url-CLCy7GPP.js} +1 -1
- package/dist/assets/{useActualMatchingMatchDetail-Bq60hvvx.js → useActualMatchingMatchDetail-OCZsPxr6.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-sigyClkp.js → useAiCfoDashboardSuggestedQuestionsChips-D8KJqvT7.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-BsP5fVhq.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-gKhYa0T8.js → useChargeCardPusherEvents-BnH8_thb.js} +1 -1
- package/dist/assets/{useDeviceId-RToKfM0O.js → useDeviceId-Bi38IJl0.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-DefipxZh.js → useEmailConnectResultRefresh-Ba8t-BuL.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-BXjZ5prE.js → useInitialThreadRequest-7Q8HJAH2.js} +1 -1
- package/dist/assets/useTaskManagerAccess-BG0Fkj9k.js +1 -0
- package/dist/assets/{utils-D8aAQJhF.js → utils-BsODCDYR.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-BY_v_z2c.js → withTransactionSidePanel-DK-Ex27L.js} +2 -2
- package/dist/assets/{zeni-epic-state-CZbm731W.js → zeni-epic-state-7eY0g-Bc.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/AddressRoutes-nZx4HWhJ.js +0 -1
- package/dist/assets/AddressScreen-D06QouT5.js +0 -9
- package/dist/assets/BillPayRoutes-CdYxJOPQ.js +0 -119
- package/dist/assets/CardsAiCfoScreen-BQ4Zn40f.js +0 -14
- package/dist/assets/CompanyPassportScreen-CMIjHc5k.js +0 -1
- package/dist/assets/ConnectionAuthScreen-BdMANdwF.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-BjVB3FB2.js +0 -1
- package/dist/assets/FeaturePreviewScreen-BE9pWqir.js +0 -1
- package/dist/assets/InvoicingRoutes-rYerhkHV.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-CW3gjVTf.js +0 -12
- package/dist/assets/MobileAppDrawer-Dubbrc5R.js +0 -1
- package/dist/assets/NotFoundScreen-r2t5kGnd.js +0 -1
- package/dist/assets/PerformanceRoutes-v3vPCjna.js +0 -1
- package/dist/assets/RewardsRoutes-CRQWx3J1.js +0 -1
- package/dist/assets/SignInScreen-Niy78Kvo.js +0 -1
- package/dist/assets/SignOutScreen-z5R4ARFQ.js +0 -9
- package/dist/assets/TaskListScreen-CQ5GSVtZ.js +0 -9
- package/dist/assets/TransactionDetailRoutes-DWH8l2BY.js +0 -1
- package/dist/assets/epic-CVdAQuh9.js +0 -2
- package/dist/assets/useAskAiCfoHostNavButtonProps-Cgk5vvuH.js +0 -1
- package/dist/assets/useTaskManagerAccess-CncuT8wV.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i}from"./liveblocks-
|
|
1
|
+
import{j as i}from"./liveblocks-UOzcPsHa.js";import{a1 as c,ab as l,E as f}from"./index-6nH5LMe4.js";import{D as p}from"./mui-Do6nLzGb.js";import"./sentry-DHDsO12F.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},r=new e.Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2",e._sentryDebugIdIdentifier="sentry-dbid-c06e3c71-2cdd-4b4c-9d6d-3f270023e5b2")}catch{}})();const b={drawerLeftMargin:new l(0,0,240)};function h(e){const{isOpen:r,drawerLeftMargin:o,children:t,onClose:d}=e,n=c(),s=o?.valuePx(n)??b.drawerLeftMargin.valuePx(n),a=f();return i.jsx(p,{anchor:"right",open:r,PaperProps:{style:{width:`calc(100% - ${s})`}},slotProps:{backdrop:{style:{backgroundColor:a.colors.black,opacity:.8,cursor:"pointer"}}},onClose:d,children:t})}export{h as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-
|
|
1
|
+
import{j as s}from"./liveblocks-UOzcPsHa.js";import{a as d}from"./sentry-DHDsO12F.js";import{h as B,u as F,g as G,i as A,j as l,N as q,l as $,n as N,o as _}from"./core-B5mDy9pu.js";import{WK as O,fF as H,W0 as M,m$ as R,S1 as k,WP as Y,WF as z,l$ as K,S2 as S,W5 as V,W6 as J,WH as L,WG as Q}from"./zeni-epic-state-7eY0g-Bc.js";import{b8 as U,j as X,a4 as Z,p as tt}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{d as b}from"./decodeURIComponentSafe-DANuhXnG.js";import{w as et}from"./withTransactionSidePanel-DK-Ex27L.js";import{f as at,c as nt}from"./routePaths-uBvxqlLY.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import"./TransactionDetailScreen-Bp7IFDK0.js";import"./useInitialThreadRequest-7Q8HJAH2.js";import"./expenseAutomationHelper-DBDpSggk.js";import"./stripSplatSuffix-CQQXAy0N.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new a.Error().stack;t&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[t]="11f1af5d-9526-4fb9-9d3e-7799b2b3153d",a._sentryDebugIdIdentifier="sentry-dbid-11f1af5d-9526-4fb9-9d3e-7799b2b3153d")}catch{}})();const ot=$((function(a,t){const e=t.entity,o=Y(a,t.entity,"EntityDetail");return{selectedEntity:e,autoCompleteData:{autoCompleteText:e.name,entityAutoCompleteView:z(a,"common")},trendWithTransactionsReport:o,analytics:X,isAccountingClassesEnabled:K(a)}}),(function(a,t){return{onTransactionItemClick:e=>{if(t.openTransactionPanel)return void t.openTransactionPanel(e.id,e.type);const o=`${nt(e,t.tenantEmailDomain)}`,c=tt(t.location.state?.pathnameStackToGoBack,t.location.pathname);t.navigate(o,{state:{pathnameStackToGoBack:c}})},autoCompleteActions:{onAutoCompleteInputChange:e=>{e.trim().length>=2?a(L({searchString:e,searchOrigin:"common"})):e.trim().length===0&&a(Q("common"))},onAutoCompleteEntity:e=>{const o=at(e,t.tenantEmailDomain);a(V()),a(J()),t.resetTrendIsFetchedStates(),t.navigate(o,{replace:!0,state:{pathnameStackToGoBack:t.location.state?.pathnameStackToGoBack}})},onCancelAutoComplete:()=>{const e=Z(t.location.state?.pathnameStackToGoBack),o=e.poppedPathname??I();t.navigate(o,{state:{pathnameStackToGoBack:e.newStack}})}},onTrendSelectedPeriodChange:e=>{if(t.closeSidePanel?.(),e==null)t.defaultTransactionTimePeriod!=null&&a(S(t.entity,"EntityDetail",{timeframe:"quarter",timePeriod:t.defaultTransactionTimePeriod}));else{const o=e.currentTimePeriod==null?e.addTimePeriod:{startDate:e.addTimePeriod.startDate,endDate:e.currentTimePeriod.endDate};a(k(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:e.addTimePeriod})),a(S(t.entity,"EntityDetail",{timeframe:e.timeframe,timePeriod:o}))}}}}))(U),it=et((function({entityType:a,...t}){const e=B(),o=F(),c=G(),[m,T]=d.useState(!1),[h,D]=d.useState(!1),{tenantEmailDomain:C,entityIdEncoded:W,entityNameEncoded:w}=A(),r=b(W??""),p=b(w??""),f=rt(r,p),x=[r,p].filter((n=>n!=null)),i={name:p,id:r,type:a,zeniId:r,qboId:r},g=l((n=>O(n.customerIncomeState,n.vendorExpenseState,n.trendState,i,"quarter"))),j=l((n=>H(n).company?.companyInfo.firstMonthOfFY??1)),u=l((n=>M(n.trendWithTransactionsState,i,"EntityDetail")));d.useEffect((()=>{m===!1&&f===!0&&(T(!0),o(R(i)))}),[m,f,i]);const P=l((n=>n.trendState.fetchState)),E=u?.selectedPeriod?.timePeriod??g,v=(function(n,y){return n!=null&&y!=null?{startDate:n.startDate,endDate:y?.endDate}:y})(u?.selectedPeriod?.timePeriod,g);return d.useEffect((()=>{m===!0&&h===!1&&P==="Completed"&&(D(!0),E!=null&&o(k(i,"EntityDetail",{timeframe:u?.selectedPeriod?.timeframe??"quarter",timePeriod:E})))}),[m,h,P]),f?s.jsx(ot,{firstMonthOfFY:j,tenantEmailDomain:C,location:c,navigate:e,entity:i,defaultTransactionTimePeriod:v,resetTrendIsFetchedStates:()=>{T(!1),D(!1)},...t}):s.jsx(q,{to:I(x.length)})})),rt=(a,t)=>t!=null&&t.length>0&&a!=null&&a.length>0,I=(a=2)=>{let t="../";for(let e=0;e<a;e++)t=`${t}../`;return t};function jt({entityType:a}){return s.jsx(N,{children:s.jsx(_,{path:"/:entityIdEncoded/:entityNameEncoded/*",element:s.jsx(it,{entityType:a})})})}export{jt as EntityDetailRoutes,jt as default};
|
package/dist/assets/{ExpenseAutomationRoutes-D17PZLn2.js → ExpenseAutomationRoutes-DK-U-YTd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-
|
|
1
|
+
import{j as f}from"./liveblocks-UOzcPsHa.js";import{u as he,h as nt,g as be,j as F,i as Ue,t as qn,l as Jn,n as Wn,o as He,N as Yn}from"./core-B5mDy9pu.js";import{fF as ke,a0S as Hn,q0 as _e,U0 as Kn,zX as Zn,a0T as Qn,a0U as Xn,a0V as es,a0W as gt,a0X as Ze,gh as bt,a0Y as oa,eW as ts,g0 as as,a0Z as ca,a0_ as Qe,qT as ns,uN as ss,gS as os,gQ as cs,a0$ as is,r4 as ls,rd as rs,qb as ds,qp as xa,gP as re,gR as us,a10 as ms,qL as wa,re as ps,qm as hs,qh as Ss,uT as gs,gO as Me,a11 as tt,C5 as Ra,Mm as Da,a12 as Fa,Fo as _a,a13 as Cs,eZ as fs,e$ as Is,sP as Tt,WL as ia,WN as ks,m2 as bs,WO as Ts,m9 as Ps,dl as ys,Do as Pt,a14 as vs,a15 as Es,fm as yt,sD as la,WF as As,a16 as xs,a17 as ws,mb as Rs,a18 as Ds,R2 as Fs,ma as _s,l$ as Ms,qE as Ma,rj as at,tp as Oa,tL as Os,TS as Ua,ri as ra,rl as Ba,rn as Us,bE as Bs,ny as Vs,nv as js,rm as Xe,rk as pe,a19 as zs,rE as da,a1a as Ls,a1b as $s,sH as Gs,sI as Ns,WB as qs,VH as Js,a0k as Ws,a1c as Ys,WH as ua,WG as Ke,a1d as ma,mq as Hs,a1e as Ks,a1f as Zs,a1g as Qs,a1h as Xs,qz as eo,a1i as to,a1j as ao,a1k as no,ru as so,md as oo,m4 as co,a1l as io,mc as pa,WY as lo,a1m as ro,a1n as uo,uo as mo,t$ as po,t_ as Ct,a1o as ho,a1p as So,a1q as go,a1r as Co,nJ as fo,br as Io,nE as ha,nq as ko,a1s as bo,g$ as To,nB as Po,sR as yo,sT as vo,sA as Eo,VK as Ao,VL as xo,ES as wo,ER as Ro,F6 as Do,a1t as Sa,sG as Fo,a1u as _o,rU as Mo,r_ as Oo,s9 as Uo,rX as Bo,a1v as Vo,s8 as jo,sM as zo,a1w as Lo,sZ as $o,su as Go,t2 as No,sz as qo,rF as Jo,a1x as Wo,qX as Yo,qv as Ho,qC as ga,rp as Ko,a1y as Zo,a1z as Qo,a1A as Xo,a1B as ec,a1C as tc,a1D as ac,t6 as nc,a1E as sc,a1F as oc,a1G as Ca,uz as cc,tS as ic,tH as fa,tF as lc,a1H as rc,tu as dc,t9 as uc,tI as mc,a1I as pc,a1J as hc,tf as Sc,a1K as gc,ta as Cc,te as fc,tc as Ic,tO as kc}from"./zeni-epic-state-7eY0g-Bc.js";import Va from"./NotFoundScreen-BkYIKPgh.js";import{a as s,R as ja}from"./sentry-DHDsO12F.js";import{n as Te,S as bc}from"./mui-Do6nLzGb.js";import{N as Be,c as H,j as Q,p as te,aq as za,as as La,dQ as Tc,dR as Pc,z as st,dS as yc,dT as vc,dU as Ec,ae as Oe,dV as Ac,dW as Ia,ba as ka,dX as xc,a7 as $a,dY as wc,h as et,a as Rc,dZ as Dc,d_ as Fc,M as _c,U as Mc,d$ as Oc,e0 as Uc,e1 as Bc,b4 as Vc,br as jc,ab as zc,b5 as Lc,b6 as $c,G as Gc,w as Nc,e2 as qc,av as ba,e3 as Jc}from"./index-6nH5LMe4.js";import{u as Ga}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{g as Ta,b as Wc,c as Yc,h as Hc,a as Kc,i as Zc,r as Qc,C as Xc}from"./TransactionDetailScreen-Bp7IFDK0.js";import{u as ei}from"./useActualMatchingMatchDetail-OCZsPxr6.js";import{d as ti}from"./decodeURIComponentSafe-DANuhXnG.js";import{m as Na,a as qa}from"./expenseAutomationHelper-DBDpSggk.js";import{u as Ja,a as Wa,w as ai}from"./withTransactionSidePanel-DK-Ex27L.js";import{b as ni,S as si,a as oi,J as ci}from"./ScheduleDetailsPrepaidExpensesScreen-DnVEpQsK.js";import{s as Pa,i as Ya,h as ii,v as li,c as ri}from"./routePaths-uBvxqlLY.js";import{a as ft}from"./accountMappingHelper-DqBiQF6x.js";import{D as di}from"./DrawerScreen-BihZ_PpN.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./useInitialThreadRequest-7Q8HJAH2.js";import"./stripSplatSuffix-CQQXAy0N.js";import"./pathToGoBack-DP_bGWF-.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="f337eab2-8151-42e7-b967-fbe098858f94",t._sentryDebugIdIdentifier="sentry-dbid-f337eab2-8151-42e7-b967-fbe098858f94")}catch{}})();const ui=()=>{const t=he(),n=nt(),S=be(),g=F((h=>ke(h))),{useFeatureGate:d}=Be(),{isFeatureEnabled:i}=d(H.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:r}=d(H.aiAuditScorePercentage),A=F((h=>h.expenseAutomationViewState.selectedPeriodByTenantId)),l=F((h=>Hn(h,g.tenantId))),{isAiCfoAccessEnabled:b,onAskAiCfoClick:R}=Ga({mobileExploreReferrer:"Month-End Close Overview"}),k=s.useCallback(((h,T,z=!1)=>{t(_e({tenantId:T,period:{month:h.month,year:h.year},refreshViewInBackground:z}))}),[]),C=s.useCallback((h=>{const T=S.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(h.month,h.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,T??null),t(Kn(g.tenantId,h))}),[g.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),I=A[g.tenantId],m=s.useCallback((()=>{const h=S.state?.referrer;l.monthEndCloseChecks?.auditSummary!=null&&Q.trackMonthCloseAuditPage(I.month,I.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,h??null),k(I,g.tenantId,!0)}),[k,I,g.tenantId,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),_=te(S.state?.pathnameStackToGoBack,S.pathname),x=s.useCallback((()=>{if(l.monthEndCloseChecks!=null&&I!=null){const h=l.monthEndCloseChecks.monthEndCloseCheckList.find((T=>T.progress<100));if(h!=null)return void n(`./${h.id}/${I.month}-${I.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview"}});n(`./month_end_insights/${I.month}-${I.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview"}})}}),[l.monthEndCloseChecks,I]),{areTenantIdsInSync:p}=za();return La({isDataReady:l.fetchState==="Completed"}),s.useEffect((()=>{I!=null&&l.fetchState!=="In-Progress"&&l.fetchState!=="Completed"&&p&&k(I,g.tenantId)}),[k,I,l.fetchState,g.tenantId,p]),s.useEffect((()=>{I!=null&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&l.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(Zn(I))}),[I,l.monthClosePerformanceTrendFetchStatus.fetchState,p]),s.useEffect((()=>{const h=setInterval((()=>{l.fetchState!=="In-Progress"&&l.fetchState==="Completed"&&m()}),3e5);return()=>clearInterval(h)}),[l.fetchState]),s.useEffect((()=>{if(l.fetchState==="Completed"&&l.monthEndCloseChecks?.auditSummary!=null){const h=S.state?.referrer;Q.trackMonthCloseAuditPage(l.selectedPeriod.month,l.selectedPeriod.year,l.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",l.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null)}}),[l.fetchState,l.selectedPeriod,l.monthEndCloseChecks?.auditSummary,l.monthEndCloseChecks?.reportEmailSentDate]),f.jsx(mi,{children:f.jsx(Tc,{monthEndCloseChecksView:l,isRealtimeInsightsFeatureEnabled:i,onMonthEndCheckClick:h=>{n(`./${h}/${I.month}-${I.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:C,handleReviewButtonClick:x,onBackClick:()=>{n("../../dashboard")},onReload:m,isAiCfoAccessEnabled:b,onAskAiCfoClick:R,aiAuditScorePercentageEnabled:r})})},mi=Te.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-UOzcPsHa.js";import{a as r}from"./sentry-DHDsO12F.js";import{aw as f,ax as l,o as p,a4 as b}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import m from"./NotFoundScreen-BkYIKPgh.js";import{h as c,g as u}from"./core-B5mDy9pu.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]="a4845c9e-9816-4d47-ad6f-7bb2b55829fb",e._sentryDebugIdIdentifier="sentry-dbid-a4845c9e-9816-4d47-ad6f-7bb2b55829fb")}catch{}})();const _=()=>{const e=c(),a=u(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=b(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=f(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:d}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./sentry-
|
|
1
|
+
import{a as o}from"./sentry-DHDsO12F.js";import{u as l,h as f,g as m}from"./core-B5mDy9pu.js";import{hY as p,Un as g,Uo as _}from"./zeni-epic-state-7eY0g-Bc.js";import{u as b,L as h,z as y}from"./index-6nH5LMe4.js";import"./liveblocks-UOzcPsHa.js";import"./recharts-uFX1dZS-.js";import"./mui-Do6nLzGb.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="82557390-56bd-46f8-81c9-de5dca58baf7",e._sentryDebugIdIdentifier="sentry-dbid-82557390-56bd-46f8-81c9-de5dca58baf7")}catch{}})();function j(){const e=l(),n=f(),r=m(),{setLoading:i,clearAllLoading:u}=b(),s=o.useRef(!1);return o.useLayoutEffect((()=>{i(h.CONNECTION_AUTH)}),[i]),o.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(r.search).get("code"),d=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&d!=null){const t=JSON.parse(d);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}))}u();const c=y.getActiveTenantForUser();n(c?.tenantEmailDomain!=null?`/${c.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as s}from"./liveblocks-
|
|
1
|
+
import{n as s}from"./liveblocks-UOzcPsHa.js";import{j as d}from"./core-B5mDy9pu.js";import{fF as a}from"./zeni-epic-state-7eY0g-Bc.js";import"./sentry-DHDsO12F.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new e.Error().stack;o&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[o]="7ecf9165-dd2c-4040-9e65-c840c8a3aad6",e._sentryDebugIdIdentifier="sentry-dbid-7ecf9165-dd2c-4040-9e65-c840c8a3aad6")}catch{}})();const h=()=>d((e=>a(e))).tenantId==null?{inboxNotifications:[],isLoading:!1,isFetchingMore:!1,hasFetchedAll:!0,fetchMore:()=>null}:(()=>{const{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}=s();return{inboxNotifications:e,isLoading:o,isFetchingMore:i,hasFetchedAll:t,fetchMore:n}})();export{h as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-UOzcPsHa.js";import{a as r}from"./sentry-DHDsO12F.js";import{u as D,h as L,i as R,j as C,t as W,l as O,s as H,g as Y,N as B,n as ie,o as x}from"./core-B5mDy9pu.js";import{a8 as rn,j as p,aq as T,S as m,cb as ln,cc as dn,cd as un,ce as gn,cf as mn,cg as vn,ch as pn,ci as Sn,cj as fn,ck as hn,cl as In,cm as Cn,cn as En,co as kn,p as J,cp as yn,cq as xn,ae as se,cr as bn,cs as jn,z as Ie,ct as Pn,cu as Dn,cv as Ln,cw as An,cx as $n,cy as wn,cz as Fn,cA as Rn,U as Tn,ai as vt,cB as _n,cC as On,cD as Mn,cE as Nn,cF as Le,cG as Un,cH as Bn,cI as Vn,cJ as Hn,cK as qn,cL as Zn,t as ze,h as pt,cM as zn,cN as Kn,cO as Qn,cP as Gn,cQ as Wn,cR as Yn,cS as Jn}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{A as z}from"./AddressScreen-DsGvV3N8.js";import M from"./NotFoundScreen-BkYIKPgh.js";import{ZB as Xn,ZC as ei,vl as Ke,ZD as K,vO as ce,ZE as Ae,ZF as Q,wp as Ce,ww as ti,wB as St,ZG as $e,ZH as ft,wt as ht,x$ as Qe,vN as Ge,ZI as ni,ZJ as It,wL as Ee,ZK as G,wP as ii,ZL as oi,ZM as Ct,wS as Et,yW as ai,ZN as ue,ZO as We,ZP as kt,vL as si,ZQ as ci,vF as ri,ZR as li,yc as di,ZS as yt,yl as Ye,ZT as ui,yi as gi,ZU as we,gh as mi,ZV as te,ZW as ne,x5 as vi,vT as Je,ZX as Fe,vY as xt,vW as pi,vQ as Si,w_ as fi,v_ as hi,x7 as Ii,ZY as ke,xe as bt,xc as ye,FY as Re,yr as Xe,ZZ as Ci,vM as jt,Z_ as Te,w7 as xe,w4 as be,wh as Pt,wg as _e,w1 as Ei,wa as Dt,wj as oe,fF as Oe,Vo as Lt,vP as Me,we as ki,wf as yi,wd as xi,Z$ as bi,wQ as ji,wM as At,_0 as $t,vz as et,_1 as Pi,vv as Di,_2 as Li,yx as Ai,yB as q,yw as $i,xF as Ne,_3 as wi,_4 as wt,yK as tt,_5 as Fi,yH as Ri,_6 as Ft,xI as Ti,xJ as V,xM as _i,_7 as Rt,xW as pe,_8 as Oi,x6 as Tt,TW as _t,_9 as Mi,y4 as Ni,_a as Ot,_b as Ui,_c as Bi,_d as Vi,zz as Hi,_e as qi,_f as Mt,yR as Nt,_g as Ut,zx as Se,_h as Zi,zu as zi,_i as Ki,_j as Qi,_k as Gi,_l as Wi,_m as Yi,_n as nt,_o as Ji,eg as Xi,zD as eo,_p as Ue,xo as it,_q as Be,_r as re,xy as Bt,xt as Vt,xr as je,_s as to,xp as no,yX as Ht,zm as ot,zh as io,_t as oo,yY as ao,_u as so,zn as co,zr as ro,_v as Ve,wr as qt,z8 as lo,ws as uo,_w as go,_x as Zt,c8 as mo,ms as vo,mt as po,_y as at,wq as le,gl as So,mz as fo,ze as zt,zP as ho,zb as Kt,uT as Io,zM as st,uH as Co,zJ as ct,hS as Eo,Un as rt,Uo as ko,G8 as Qt,hK as yo,_z as xo,Vd as bo,_A as jo,zU as fe,zV as Po,_B as Do,_C as Gt,zS as Lo,_D as Ao,_E as $o,y8 as wo,_F as Fo}from"./zeni-epic-state-7eY0g-Bc.js";import{M as Ro}from"./MobileAppDrawer-0YtWXA3B.js";import{q as de}from"./QBOConnectionScreen-CWU6DFJl.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";import"./InboxNotificationsProvider-BmF5-_KA.js";import"./useTaskManagerAccess-BG0Fkj9k.js";import"./empty-Dj4ZMRNZ.js";import"./pdf-lib-CZXOqgb4.js";import"./index-k1-Pd2Ki.js";import"./url-BxiN6LKq.js";import"./index-6yt3BfRL.js";import"./decodeURIComponentSafe-DANuhXnG.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="452509ab-c13b-4d50-bbcb-112c250a8bd5",n._sentryDebugIdIdentifier="sentry-dbid-452509ab-c13b-4d50-bbcb-112c250a8bd5")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(rn,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function N(...n){return n.some((e=>e==="Error"))}function To(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:f,items:S,nextCursor:h,auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b}=C(Xn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${t??""}/invoicing`,I=r.useCallback(((A,U)=>{const _=ei(y,A,U,P);_!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:A,entityId:U,fromScreen:"audit_log"}),e(_))}),[P,e,y]);r.useEffect((()=>{const A=setTimeout((()=>d(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&n(Ke({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const j=g==="Not-Started"||g==="In-Progress"&&S.length===0,E=g==="In-Progress"&&S.length>0,w=g==="Completed";return N(g)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:w}),s.jsx(ln,{auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b,entries:S,hasMore:f,isLoading:j,isLoadingMore:E,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{f&&h!=null&&n(Ke({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function ge(n,e=!1){const t=D(),i=C((c=>K(c).productNextCursor!=null)),a=C((c=>K(c).productNextCursor)),o=C((c=>K(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&o!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&o!=="In-Progress"&&i&&a!=null&&t(ce({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,o,i,a])}const _o=new Set(["plan"]),Wt=[],Oo=ft((n=>n.length>0?n:Wt),gn),Mo=ft((n=>n.length>0?n:Wt),un),No=O((function(n,e){const{view:t}=e;return{applicableItemOptions:t.applicableItemOptions,groupedAccountOptions:Oo(t.qboAccountHierarchy),groupedClassOptions:Mo(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&n(ht({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&n($e({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),n(St({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&n(ti({action:o,id:a,parentItemId:i}))}}}))(dn);function Uo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=(d=a.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=C((k=>Ae(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(Q({id:t})),()=>{n(Q({id:t}))})),[n,t]),r.useEffect((()=>{o&&n(Ce({id:t,kind:c}))}),[o,t,c,n]);const[g,f]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(Q({id:t})),n(Ce({cacheOverride:!0,id:t,kind:c})),f((k=>k+1)))}),[l.fetchState,n,t,c]);const S=u==="Completed";ge(o,!0);const[h,P]=r.useState(S?t:void 0);r.useEffect((()=>{t!=null&&S&&P(t)}),[t,S]);const b=h!==t&&(u==="Not-Started"||u==="In-Progress");return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:S}),s.jsx(No,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:b,view:l},g)]})}const Bo=new Set(["addon","charge","plan"]),Vo=new Set(["plan"]),Ho=O((function(n,e){const t=Ae(n,e.itemId);return{fieldHelp:t.fieldHelp,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${t}/catalog/${encodeURIComponent(a)}`:`${t}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),n(Q({id:a})),e.navigate(`${t}/catalog`)},onChange:c=>{n($e({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),n(St({id:a}))}}}))(mn);function qo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=t!=null,d=a.get("type"),l=d!=null&&Bo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Vo.has(u)?u:"plan";var u;const g=C((f=>Ae(f,t)));return ge(o,!0),r.useEffect((()=>{o&&n(Ce({id:t,kind:v}))}),[o,t,v,n]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||n($e({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,n]),r.useEffect((()=>{if(g.fetchState==="Completed"){const f=g.savedItemId??t,S=f!=null?`/${i}/invoicing/catalog/${encodeURIComponent(f)}`:`/${i}/invoicing/catalog`;e(S),n(Q({id:t}))}}),[g.fetchState,g.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Zo={addons:"addon",all:"item",charges:"charge",plans:"plan"},zo=O((function(n,e){const t=K(n),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?t.plans:a?[...t.plans,...t.products]:t.products,c=i||a&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:a&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Zo[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(ht({action:ni(d),id:c}))},onLoadMore:()=>{if(a)return e.planNextCursor!=null&&n(Ge({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&n(i?Ge({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(vn);function Ko(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),f=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),S=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:S,type:"plan"})),[S]),P=r.useMemo((()=>({search:S,type:"addon|charge"})),[S]),b=C((A=>K(A))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",w=b.runningActionId??null;return r.useEffect((()=>{const A=setTimeout((()=>v(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&n(Qe({cacheOverride:!1,planFilters:h,productFilters:P,planSort:f,productSort:f}))}),[i,n,h,P,f]),r.useEffect((()=>{i&&(S!==k||f?.field!==y?.field||f?.dir!==y?.dir)&&n(Qe({cacheOverride:!0,planFilters:h,productFilters:P,planSort:f,productSort:f}))}),[k,y,i,n,h,P,S,f]),N(b.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),s.jsx(zo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:a,sortState:u,planFilters:h,productFilters:P,sort:f,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:w,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Qo=O((function(n,e){const t=It(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isQboConnected:t.isQboConnected,isQboPickerDataLoading:t.isQboPickerDataLoading,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions,qboAccountHierarchy:t.qboAccountHierarchy,qboIncomeAccountIds:t.qboIncomeAccountIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),n(G({id:i})),e.navigate(`${t}/discounts`)},onChange:c=>{n(oi({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:a}),n(ii({id:i}))}}}))(pn);function Go(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,savedCouponId:c}=C((d=>It(d,t)));return r.useEffect((()=>{a&&n(Ee({id:t}))}),[a,t,n]),r.useEffect((()=>{if(o==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(G({id:t}))}}),[o,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCouponFormPage}),s.jsx(Qo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Wo=O((function(n){const e=Ct(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:a=>{e(kt(a))},onSubmit:()=>{const a=ci(n.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(ri(a))}}}))(fn);function Yo(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),[i]=W(),{areTenantIdsInSync:a}=T(),o=i.get("customerId"),c=C((I=>Ct(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(Et),g=C((I=>ai(I))),f=C(ue),S=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=f.fetchState==="Not-Started"||f.fetchState==="In-Progress"&&f.customers.length===0,P=S||h,b=g.fetchState==="Completed"&&f.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,n(kt({...l,customerId:o})))}),[o,l,n]),r.useEffect((()=>{a&&n(si({cacheOverride:!1}))}),[a,n]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(j)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),P?s.jsx(Sn,{}):s.jsx(Wo,{navigate:e,tenantEmailDomain:t})]})}const Jo=O((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(hn);function Xo(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>li(d,t??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&t!=null&&n(di({id:t}))}),[a,t,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Jo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:o})]})}const ea=O((function(n){const e=yt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function ta(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,creditNoteListFetchState:b}=C((y=>{const I=yt(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Ye({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ea,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(ui(y)),onSortChange:v})]})}const Yt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},na=O((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:a=>{n(ke({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const a=Yt(e.tenantEmailDomain??"",ye,i),o=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),n(ke({id:i,localData:a})),n(bt({id:i}))},onFetchPaymentLinkEmailPreview:a=>n(Ii({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>n(hi({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)}}}))(kn);function ia(){const n=D(),e=L(),t=Y(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((_=>we(_,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[g,f]=r.useState(!1),[S,h]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&h(i)}),[i,c.record.fetchState]);const P=S===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const _=c.record.sendLinkState.fetchState;E.current!=="Error"&&_==="Error"&&n(mi({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=_}),[n,c.record.sendLinkState.fetchState]);const w=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(f(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{o&&i!=null&&n(vi({id:i}))}),[o,i,n]),r.useEffect((()=>{o&&i!=null&&j&&n(Je({customerId:i}))}),[o,i,n,j]);const[A,U]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Fe({id:i})),i!=null&&n(xt({id:i})),U((_=>_+1)))}),[c.fetchState,n,i]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(na,{customerId:i??"",editView:c,hasLoadedRecord:P,location:t,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{n(te()),i!=null&&j&&n(Je({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),f(!0)}},A),s.jsx(Cn,{errorMessage:w,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&n(Si({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:_=>{i!=null&&n(pi({customerId:i,data:_}))}}),s.jsx(En,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{f(!1),n(ne())},onSubmit:({amount:_,description:ee})=>{i!=null&&n(fi({amount:_,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const oa=O((function(n,e){const t=we(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),n(Fe({id:i})),n(Re(ye)),e.navigate(`${t}/customers`)},onChange:c=>{n(ke({id:i,localData:c}))},onOpenAddress:()=>{const c=Yt(e.tenantEmailDomain??"",ye,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:a}),n(bt({id:i}))}}}))(yn);function aa(){const n=D(),e=L(),t=Y(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),{fetchState:c,savedCustomerId:d}=C((l=>we(l,i)));return r.useEffect((()=>{o&&i!=null&&n(xt({id:i}))}),[o,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),n(Fe({id:i}))}}),[c,d,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerFormPage}),s.jsx(oa,{customerId:i,location:t,navigate:e,tenantEmailDomain:a})]})}const sa=O((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(jt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(xn);function ca(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,customerListFetchState:b}=C((y=>{const I=ue(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(Xe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Xe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),s.jsx(sa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(Ci(y)),onSortChange:v})]})}const Pe=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),ra=O((function(n,e){const{filters:t,sessionId:i,view:a}=e,o=i==null?void 0:a.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:t,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:Pe(a,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=Pe(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",f=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>a(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&n(be({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&n(_e(o))},onRollback:f?()=>{o!=null&&n(Pt(o))}:void 0}}))(bn);function la(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),[o,c]=r.useState({}),d=C(Te),l=Pe(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{a&&t!=null&&n(xe(t))}),[a,n,t]),r.useEffect((()=>{if(!a||t==null)return;const S=setTimeout((()=>{n(be({...o,sessionId:t}))}),300);return()=>clearTimeout(S)}),[a,n,o,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||t==null||!u)return;const S=setInterval((()=>{n(xe(t)),n(be({...o,sessionId:t}))}),3e3);return()=>clearInterval(S)}),[a,n,o,u,t]);const g=r.useMemo((()=>{if(t==null)return;const S=new URLSearchParams;o.moduleId!=null&&S.set("module_id",o.moduleId),o.level!=null&&S.set("level",o.level),o.outcome!=null&&S.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&S.set("search",o.search.trim());const h=S.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${h===""?"":`?${h}`}`}),[o,t]),f=v?.fetch.fetchState??"Not-Started";return N(f)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&f!=="Not-Started"}),s.jsx(ra,{downloadUrl:g,filters:o,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const Jt=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=Jt(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},da=O((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:o}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,a=o=>{const c=o??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),n(_e(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),n(Pt(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),t(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(jn);function ua(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(Te);r.useEffect((()=>{i&&(n(Ei()),n(Dt()))}),[i,n]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(da,{navigate:e,tenantEmailDomain:t,view:a})]})}const ga=O((function(n,e){const{activeId:t,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:a?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:a?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),n(xi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{t!=null&&n(_e(t))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),t!=null&&n(yi(t))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),n(ki({files:o}))},onViewDetails:t==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Pn);function ma(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(Et),o=C(Oe).companyId??Ie.getSignedInUserTenant(t??"")?.companyId,c=C((S=>Lt(S,o))),d=C(Te),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((S=>S.id===v)):void 0;r.useEffect((()=>{i&&(n(Me()),n(Dt()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const S=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(Jt(h))}catch{return null}})(t);S!=null&&n(oe(S))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const g=u?.status,f=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!f)return;const S=setInterval((()=>{n(xe(v))}),3e3);return()=>clearInterval(S)}),[i,v,f,n]),r.useEffect((()=>{g==="done"&&(n(oe(null)),ae(t,null))}),[n,g,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportMigratePage}),s.jsx(ga,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const va=O((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:t.discountsAccountName,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:a=>{n(At({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),n(ji({data:a,id:i}))}}}))(Dn);function pa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((h=>bi(h,t))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const g=v===t;r.useEffect((()=>(n(G({id:t})),()=>{n(G({id:t}))})),[t,n]),r.useEffect((()=>{a&&n(Ee({id:t}))}),[a,t,n]);const[f,S]=r.useState(0);return r.useEffect((()=>{o.fetchState==="Completed"&&(n(G({id:t})),n(Ee({cacheOverride:!0,id:t})),S((h=>h+1)))}),[o.fetchState,n,t]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(va,{hasLoadedRecord:g,couponId:t??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},f)]})}const Sa=O((function(n){const e=$t(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,a)=>{n(At({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ln);function fa(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=$t(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(et({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(et({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>n(Pi(I)),onSortChange:v})]})}const ha=O((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>n(q({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(q({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(q({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(q({action:"retry",id:i}))}:void 0}}))($n);function Ia(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((E=>Li(E,t??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[f,S]=r.useState(),[h,P]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),S(void 0),P(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Ai({id:t})),v("idle"),g(!1);const E=o.emailPreview.preview;S(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),P(!0)}),[t,n,o.emailPreview.preview]),y=r.useCallback((E=>{t!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(q({action:"send-email",body:E,id:t})))}),[t,n,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&t!=null&&n($i({id:t}))}),[a,t,n]),r.useEffect((()=>{a&&d!=null&&n(Ne({invoiceId:d}))}),[a,d,n]),r.useEffect((()=>{v("idle"),g(!1),S(void 0),P(!1)}),[t]),r.useEffect((()=>{a||(v("idle"),g(!1),S(void 0),P(!1))}),[a]),r.useEffect((()=>{h&&f==null&&o.emailPreview.preview!=null&&S({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,f,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(t!=null&&n(wi({id:t})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[t,b,n,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(ha,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:o,dunningAttempts:j,onSendEmail:k}),s.jsx(An,{initialDraft:f,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const Ca=O((function(n){const e=wt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||n(q({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Ri({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(wn);function Ea(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,dunningCaseListFetchState:b}=C((y=>{const I=wt(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),H),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(tt({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ca,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(Fi(y)),onSortChange:v})]})}const ka=O((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),n(_i({data:{due_date:a.due_date!==""?a.due_date:void 0,notes:a.notes.trim()!==""?a.notes.split(`
|
|
2
|
+
`).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:a.po_number!==""?a.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))}}}))(Fn);function ya(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((g=>Ft(g,t??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{a&&t!=null&&n(Ti({invoiceId:t}))}),[a,t,n]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ka,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const xa=O((function(n){const e=Rt(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,a)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&n(Tt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Rn);function ba(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=Rt(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),H),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(pe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),s.jsx(xa,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{n(Oi(I)),n(pe({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function lt(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=Tn(),a=vt(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C(_t),v=Mi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,g=f=>{c(f)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(Ro,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{n(Ni())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{g(!0)}})]})}const ja=O((function(n,e){const t=Ot(n,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:a=>{n(qi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Hi())}}}))(On);function Pa(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((S=>Ot(S,t??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{n(Ui()),g.current=null}),[n,t]),r.useEffect((()=>{a&&t!=null&&n(Ne({invoiceId:t}))}),[a,n,t]),r.useEffect((()=>{c!=null&&t!=null&&o==="Completed"&&g.current!==t&&(g.current=t,n(Bi({localData:Vi(c)})))}),[n,o,c,t]);const f=r.useRef(v.fetchState);return r.useEffect((()=>{const S=f.current;f.current=v.fetchState,S!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ja,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const Da=O((function(n){return{invoicingOverview:Mt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Nt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Mn);function La(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>Mt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Nt(a))}),[i,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),s.jsx(Da,{navigate:e,selectedPeriod:a,tenantEmailDomain:t})]})}const Aa=O((function(n){const e=Ut(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Nn);function $a(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:f,appliedSearch:S,appliedSort:h,nextCursor:P,transactionListFetchState:b,transactions:k}=C((w=>{const A=Ut(w);return{activeType:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,transactionListFetchState:A.fetchState,transactions:A.transactions}}),H),y=b==="Completed",I=`/${t}/invoicing`,j=r.useCallback((w=>{const A=k.find((_=>_.id===w)),U=A?.linkedInvoices?.[0]?.invoiceID??A?.invoiceID;U!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((w=>{const A=k.find((U=>U.id===w))?.customerID;A!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:A,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(A)}`))}),[e,I,k]);return r.useEffect((()=>{const w=setTimeout((()=>d(a)),300);return()=>clearTimeout(w)}),[a]),r.useEffect((()=>{i&&n(Se({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Se({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),s.jsx(Aa,{navigate:e,tenantEmailDomain:t,activeType:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onTypeChange:w=>{n(Zi(w)),n(Se({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const wa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id};function dt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=t!=null&&t!=="",c=C(ue),d=C((E=>Ki(E))),l=C(Qi),v=C((E=>Ft(E,t??""))),u=v.invoice,g=`/${i}/invoicing`,f=r.useRef(null),S=r.useRef("");r.useEffect((()=>{n(Gi()),f.current=null,S.current=""}),[n,t]),r.useEffect((()=>{a&&n(o&&t!=null?Ne({invoiceId:t}):jt({filters:{},keepExistingListItems:!1}))}),[a,n,t,o]),r.useEffect((()=>{o&&u!=null&&t!=null&&v.fetchState==="Completed"&&f.current!==t&&(f.current=t,n(Wi({contextInvoiceId:t,localData:Yi(u)})))}),[n,u,t,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==S.current&&(S.current=E,n(Tt({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(nt({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[n,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const P=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:wa(E)})))),[c.customers]),b=C((E=>Ji(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(w=E.amountDue,A=Xi.currencySymbol,Bn("0,0.00",w,A)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var w,A}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",w=u.amountDue?.amount??0;return{amountDue:Le("0,0.00",u.amountDue),amountDueValue:w,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(t??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),s.jsx(Un,{customers:P,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{n(nt({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(eo(o?t??void 0:void 0))}})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Fa=(n,e)=>{if(n==null)return;const t=Le("0,0",n);return e!=null?`${t}/${e}`:t},en=(n,e,t)=>{const i=[n,Fa(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},ut=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ra=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:en(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Ta=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=O((function(n,e){const{editView:t}=e,i=t.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(ut).map((c=>({label:c.name??c.id,subtitle:en(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,coupons:t.coupons.map(Ta),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(ut).map(Ra),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(Vt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=Xt(e.tenantEmailDomain??"",je,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Bt({id:i}))},onCancelSubscription:a?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Oa(){const n=D(),e=L(),t=Y(),{subscription_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((k=>Ue(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed",[f,S]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&S(i)}),[i,g]);const h=f===i;ge(o),r.useEffect((()=>{o&&i!=null&&n(it({id:i}))}),[o,i,n]);const[P,b]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Be({id:i})),n(it({cacheOverride:!0,id:i})),b((k=>k+1)))}),[c.fetchState,n,i]),N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),s.jsx(_a,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},P)]})}const Ma=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Na=(n,e)=>{if(n==null)return;const t=Le("0,0",n);return e!=null?`${t}/${e}`:t},De=(n,e,t)=>{const i=[n,Na(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Ua=n=>({label:Ma(n),value:n.id}),he=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ba=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:De(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Va=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=O((function(n,e){const t=Ue(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Va),customers:t.customers.map(Ua),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",isLoading:t.isFormLoading,localData:t.localData,mode:t.mode,plans:t.plans.filter(he).map(Ba),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),n(Be({id:i})),n(Re(je)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{n(re({id:i,localData:o}))},onOpenAddress:()=>{const o=Xt(e.tenantEmailDomain??"",je,i),c=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:a}),n(Bt({id:i}))}}}))(Hn);function qa(){const n=D(),e=L(),t=Y(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=W(),{areTenantIdsInSync:c}=T(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((f=>to(f,i))),u=C((f=>Ue(f,i).localData));ge(c),r.useEffect((()=>{c&&n(no({subscriptionId:i}))}),[c,i,n]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const f=v??i,S=f!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(f)}`:`/${a}/invoicing/subscriptions`;e(S),n(Be({id:i}))}}),[l,v,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Za=O((function(n){const e=Ht(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),n(Vt({action:o,id:a,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(a,o)=>{const c=o?.trim()??"";c!==""&&i(a,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(a,o,c)=>{o!=="pause"?i(a,o):i(a,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(ao({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:f,appliedSearch:S,appliedSort:h,nextCursor:P,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Ht(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),H),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&n(ot({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==S||u?.field!==h?.field||u?.dir!==h?.dir)&&n(ot({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,S,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&n(io())}),[k,i,n]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),s.jsx(Za,{navigate:e,tenantEmailDomain:t,activeStatus:f,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>n(oo(j)),onSortChange:v})]})}const Ka=O((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),n(ro({action:"capture",id:i}))}:void 0}}))(Zn);function Qa(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>so(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&n(co({id:i}))}),[a,i,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:o})]})}function tn(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=n,o=D(),{areTenantIdsInSync:c}=T(),d=C(Ve),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(qt()),t&&o(lo()))}),[c,o,e,t,a]),r.useEffect((()=>{e&&c&&l&&i&&o(uo())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Ga={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=D(),{areTenantIdsInSync:t}=T(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(go),{configError:u,configFetchState:g,dunningScheduleActionOptions:f,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P}=C(Zt),b=C(Ve);tn({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Oe),y=n==="dunning"||n==="quickbooks",I=k.companyId??Ie.getSignedInUserTenant(i??"")?.companyId,j=C((F=>Lt(F,I))),E=mo(k.userRole??[]),w=k.tenantId??"",A=Ie.getSignedInUser(),U={userId:A?.userId??"",sessionId:A?.zeniSessionId??"",tenantId:w},_=c?.fileId,ee=C((F=>_!=null&&_!==""?vo(F,_):void 0)),He=C((F=>_!=null&&_!==""?po(F,_):void 0)),nn=_!=null&&_!==""&&ee!=null?{[_]:ee}:{},on=_!=null&&_!==""&&He!=null?{[_]:He}:{};r.useEffect((()=>(e(at()),()=>{e(at())})),[e]),r.useEffect((()=>{t&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[t,e,a]),r.useEffect((()=>{t&&y&&g==="Not-Started"&&e(le())}),[t,e,g,y]),r.useEffect((()=>{if(!t)return;const F=A?.userId;F!=null&&F!==""&&w!==""&&ze.shouldFetchActiveTenant(w)&&(ze.markActiveTenantFetchStarted(w),e(So(F,w,A?.zeniSessionId)))}),[t,e,A?.userId,A?.zeniSessionId,w]);const an=f.length>0||S.length>0,sn=a==="Not-Started"||a==="In-Progress"&&l==null||y&&!an&&(g==="Not-Started"||g==="In-Progress"),cn=a==="Completed"&&(!y||g==="Completed"),qe=j.externalConnections?.revenue?.find((F=>F.connectionName==="chargebee"))?.connectionId,me=se?.invoicingMicroServiceBaseUrl,Ze=me!=null&&me.length>0?`${me}/1.0/webhooks/stripe`:"",ve={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:F=>e(ct(F)),onDisconnect:(F,Z)=>{w!==""&&e(yo(w,F,rt(Z)))},onDisconnectStripe:()=>e(st()),onReconnectQBO:()=>{const F=k.tenantEmailDomain??i??"";de.init("/connection/auth",F),de.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Qt())},onSaveChargeBeeCredentials:(F,Z)=>{qe!=null&&w!==""&&e(Eo(w,qe,rt("revenue"),ko("chargebee"),{api_key:F,site:Z}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ze};return{authParams:U,deleteFileStatusById:nn,fieldHelp:o,dunningScheduleActionOptions:f,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ve,isInvoicingPageReady:cn,isLoading:sn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ze,updateFileStatusById:on,onConnectStripe:F=>e(ct(F)),onDeleteFile:F=>e(Co(F,w)),onDisconnectStripe:()=>e(st()),onEditFileName:(F,Z)=>e(Io(F,Z,w)),onReconnectQBO:ve.onReconnectQBO,onRefreshQBO:ve.onRefreshQBO,onRetryQboSyncTask:F=>e(Kt(F)),onSave:F=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(ho({settings:F,snackbarSection:Ga[n??""]}))},onStartQboBackfill:F=>e(zt(F)),updateFilesEntity:F=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(fo({files:F}))}}}function gt({appContent:n}){const e=L(),t=Y(),i=D(),{tenantEmailDomain:a}=R(),o=X("branding"),c=C((v=>xo(v))),d=C((v=>bo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(jo()),i(Re(fe)))}),[c.saveState.fetchState,i]);const l=pt(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(zn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Do({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${fe}/`,u=J(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:o.updateFilesEntity})]})}function Wa(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Kn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Ya(){const n=L(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Ja(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const Xa=O((function(n){const e=Gt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n($o({localData:e}))},onReset:()=>{n(Ao())},onRetryTask:e=>{n(Kt(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Lo())},onStartBackfill:e=>{n(zt(e))}}}))(Wn);function es(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=C(Oe),{configFetchState:a,settingsFetchState:o}=C(Gt);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||n(Me())}),[n,o]),r.useEffect((()=>{a==="Not-Started"&&n(le())}),[a,n]),tn({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage}),s.jsx(Xa,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Qt())})]})}const ts={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function ns(){const n=vt(),e=D(),t=L(),[i,a]=W(),o=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Zt),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const f=ts[g];a({},{replace:!0}),f!=null&&t(f,{replace:!0})}),[g,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Yn,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:n("invoicing_settings"),settings:o.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(wo())}})]})}function mt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(ns,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Ja,{})}),s.jsx(x,{path:"branding",element:s.jsx(gt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(gt,{appContent:s.jsx(z,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Ya,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Wa,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(es,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function As(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),{enableState:a,fetchState:o,status:c}=C(_t),d=pt(a.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=C((g=>Ve(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,o]),r.useEffect((()=>{i&&u==="Not-Started"&&n(qt())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),n(Fo()))}),[d,a.fetchState,l,n,e]),c==null&&o!=="Error"?s.jsx(Jn,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(lt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(lt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(La,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ca,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(aa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(ia,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(za,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Oa,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(z,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ba,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Yo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(ya,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(dt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(x,{path:"payments",element:s.jsx($a,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(dt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Qa,{})}),s.jsx(x,{path:"credits",element:s.jsx(ta,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(Xo,{})}),s.jsx(x,{path:"discounts",element:s.jsx(fa,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Go,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(pa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ea,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Ko,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Uo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(mt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(To,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ua,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(ma,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(la,{})}),s.jsx(x,{path:"*",element:s.jsx(M,{})})]})}export{As as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t}from"./liveblocks-
|
|
1
|
+
import{j as t}from"./liveblocks-UOzcPsHa.js";import{i as S,l as g,h as C,g as y,u as ee,t as te,j as E,N as ae,n as ne,o as p}from"./core-B5mDy9pu.js";import{Ug as k,Uh as j,Ui as T,Jk as D,J6 as U,Uj as B,Uk as oe,Ul as ie,Ja as se,gi as $,Jh as le,Je as re}from"./zeni-epic-state-7eY0g-Bc.js";import{a1 as x,H as r,a2 as de,j as v,Z as G,a3 as ce,a4 as me,a5 as pe,p as H,N as ue,c as he,a6 as ge,M as xe,E as fe,f as be,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as je,ab as ve,ac as $e}from"./index-6nH5LMe4.js";import{n as m}from"./mui-Do6nLzGb.js";import f from"./NotFoundScreen-BkYIKPgh.js";import{a as I}from"./sentry-DHDsO12F.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="914d6284-46fa-4c52-8b5f-6eb507bf39c2",e._sentryDebugIdIdentifier="sentry-dbid-914d6284-46fa-4c52-8b5f-6eb507bf39c2")}catch{}})();const Ie=m.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -7,7 +7,7 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${e=>e.theme.colors.grey4};
|
|
9
9
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
10
|
-
`,Ce=g((function(e){const a=k(e),n=
|
|
10
|
+
`,Ce=g((function(e){const a=k(e),n=j(e),{companyName:o}=a;return{companyName:o,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:a}}),(function(e,a){const{vendorId:n,billId:o}=a;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:a,billId:n}=S();return a==null||n==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ie,{windowSize:e,children:t.jsx(Ce,{vendorId:a,billId:n})})})}const De=m.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
height: 100vh;
|
|
13
13
|
width: 100%;
|
|
@@ -16,7 +16,7 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
16
16
|
align-items: center;
|
|
17
17
|
background-color: ${e=>e.theme.colors.grey4};
|
|
18
18
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
19
|
-
`,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=
|
|
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
20
|
display: flex;
|
|
21
21
|
height: 100%;
|
|
22
22
|
width: 100%;
|
|
@@ -25,7 +25,7 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
25
25
|
align-items: center;
|
|
26
26
|
background-color: ${e=>e.theme.colors.grey4};
|
|
27
27
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
28
|
-
`,Le=g((function(e){const a=k(e),n=
|
|
28
|
+
`,Le=g((function(e){const a=k(e),n=j(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?t.jsx(f,{}):t.jsx(t.Fragment,{children:t.jsx(Ne,{windowSize:n,children:t.jsx(Le,{location:a,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
|
|
29
29
|
display: flex;
|
|
30
30
|
height: 100%;
|
|
31
31
|
width: 100%;
|
|
@@ -34,7 +34,7 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
34
34
|
align-items: center;
|
|
35
35
|
background-color: ${e=>e.theme.colors.grey4};
|
|
36
36
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
37
|
-
`,Te=g((function(e){const a=k(e),n=
|
|
37
|
+
`,Te=g((function(e){const a=k(e),n=j(e),o=B(e),{companyName:i}=a;return{companyName:i,isDisabled:a.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:a}}),(function(e,a){const{navigate:n,location:o,vendorId:i,billId:l}=a;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,a.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=H(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),a=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?t.jsx(f,{}):t.jsx(Fe,{windowSize:n,children:t.jsx(Te,{location:a,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new ve(100,58)},He=m(ke)`
|
|
38
38
|
width: ${r.sp4};
|
|
39
39
|
height: ${r.sp4};
|
|
40
40
|
margin-bottom: ${r.sp3};
|
|
@@ -43,14 +43,14 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
position: absolute;
|
|
45
45
|
color: ${e=>e.theme.colors.brandColorJade};
|
|
46
|
-
`,
|
|
46
|
+
`,Je=m.div`
|
|
47
47
|
display: flex;
|
|
48
48
|
height: 100vh;
|
|
49
49
|
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
50
50
|
width: 100vw;
|
|
51
51
|
overflow-y: scroll;
|
|
52
52
|
background-color: ${e=>e.theme.colors.grey4};
|
|
53
|
-
`,
|
|
53
|
+
`,Me=m.div`
|
|
54
54
|
display: flex;
|
|
55
55
|
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
56
56
|
flex-direction: column;
|
|
@@ -69,4 +69,4 @@ import{j as t}from"./liveblocks-DKqwsBQp.js";import{i as S,l as g,h as C,g as y,
|
|
|
69
69
|
width: ${e=>e.windowSize=="small"?"auto":"42%"};
|
|
70
70
|
background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
|
|
71
71
|
margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
|
|
72
|
-
`,_e=g((function(e,a){return{file:a.file,type:a.type}}))(
|
|
72
|
+
`,_e=g((function(e,a){return{file:a.file,type:a.type}}))(je);function h({appContent:e}){const a=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=te(),d=s.get("token"),J=n.pathname.includes("address"),b=x(),M=xe(),A=fe(),w=be(),V=()=>{M.toggle()},_=E((u=>k(u))),K=E((u=>j(u))),{authParams:W,fetchState:c,billAttachment:q,billFetchState:P,companyName:O,currencySymbol:Q,amount:Z}=_,{tenantId:z,userId:N,sessionId:L}=W,{fetchState:R,internationalBankAccountCreateStatus:X}=K;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&a(le(i,o,d))}),[w,c,i,o,d,a]),I.useEffect((()=>{w&&c==="Completed"&&($(N,L,z),l!=null&&a(re(l)))}),[c,w,N,L,z,l,a]),c==="Error"?t.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?($(),t.jsx(ae,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?t.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):t.jsxs(t.Fragment,{children:[c==="Completed"&&P==="Completed"&&t.jsx(Se,{analytics:v,onLoad:u=>(Y=>Y.trackBillPayMagicLinkPageLoad(o??"",i??"",O,l??"",Ke(n.pathname),Q,Z))(u)}),t.jsxs(Je,{windowSize:b,children:[b!=="small"?t.jsx(He,{onClick:V}):null,t.jsx(Ve,{windowSize:b,isAddressPage:J,children:P==="In-Progress"?t.jsx(ye,{size:"ExtraLarge",start:!0}):t.jsx(_e,{file:q,type:"bill"})}),t.jsx(Me,{windowSize:b,children:e})]})]})}const Ke=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function We(){return t.jsx($e,{})}function dt(){return t.jsxs(ne,{children:[t.jsx(p,{path:"bank/account/save/success",element:t.jsx(We,{})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:t.jsx(h,{appContent:t.jsx(F,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:t.jsx(h,{appContent:t.jsx(Ae,{isSubPage:!0})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:t.jsx(h,{appContent:t.jsx(Ee,{})})}),t.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:t.jsx(h,{appContent:t.jsx(Ue,{})})}),t.jsx(p,{path:"*",element:t.jsx(f,{})})]})}export{dt as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{j as u}from"./liveblocks-UOzcPsHa.js";import{a as g}from"./sentry-DHDsO12F.js";import{u as O,g as _,h as w,t as M,j as l,N as U}from"./core-B5mDy9pu.js";import{z as r,E as P,G as V,Q as A,j as N,S as $,_ as G,$ as Q,X as R}from"./index-6nH5LMe4.js";import{fF as W,TL as X,Uc as q,U3 as B,gi as H,gk as J,U8 as K,gU as Y,dj as Z,Ud as ee,Ue as te}from"./zeni-epic-state-7eY0g-Bc.js";import{n as ne}from"./mui-Do6nLzGb.js";import{u as se}from"./useDeviceId-Bi38IJl0.js";import{f as ae}from"./analyticsHelper-CwB3kQvw.js";import{t as ie}from"./getLocaleForTenant-DH5Avx3x.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="4dae7e98-40db-4eec-877a-f148c9581cc4",t._sentryDebugIdIdentifier="sentry-dbid-4dae7e98-40db-4eec-877a-f148c9581cc4")}catch{}})();const T=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Te(){const t=O(),a=_(),f=w(),[y]=M(),n=y.get("token"),p=y.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>X(e))),D=r.getSignedInUser(),v=P().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),g.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),V.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,k.tenantsInOrder),Y().then((()=>{const e=R();e!=null&&A(e)})),setTimeout((()=>{N.trackLogin($.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,a.state,t]);const E=g.useCallback((()=>{f("/signin/auth")}),[f]),j=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),F=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(G,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(U,{to:e,state:{...a.state,origin:""}})}if(!T(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",L=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(U,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:L,magicLinkExpired:!L&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(Q,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
right: 0;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
background-color: ${t=>t.theme.colors.background};
|
|
12
|
+
`;export{Te as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as _}from"./liveblocks-UOzcPsHa.js";import{a as m}from"./sentry-DHDsO12F.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as F}from"./core-B5mDy9pu.js";import{fF as ne,TM as Ne,TN as se,g9 as xe,fE as Pe,TW as Ve,TP as Re,TQ as je,p$ as Le,gm as Oe,TT as b,TY as Ue,TZ as K,gn as Ze,T_ as ze,E1 as We,h1 as Ye,cV as qe,T$ as He,g8 as Qe,go as Je}from"./zeni-epic-state-7eY0g-Bc.js";import{w as Ke,i as Xe,M as ea,N as aa,d as ta,f as na,u as sa,c,g as oa,q as ia,z as ra,e as da,k as ca,V as la,r as ua,l as ma,n as X,L as fa,C as ha,D as ba,p as S,j as ee,x as pa,W as ae,A as ga,B as Sa}from"./index-6nH5LMe4.js";import{D as Ta}from"./mui-Do6nLzGb.js";import{u as Ea}from"./InboxNotificationsProvider-BmF5-_KA.js";import{u as ka}from"./useTaskManagerAccess-BG0Fkj9k.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new l.Error().stack;i&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[i]="b28c04ac-a839-4cc1-9152-cadd77891e43",l._sentryDebugIdIdentifier="sentry-dbid-b28c04ac-a839-4cc1-9152-cadd77891e43")}catch{}})();const Ca=Ke((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),T=ea(),n=Me(),B=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:E}=ka(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Ve),G=$.uiState.currentChatSessionId,k=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),A=F("/:tenantEmailDomain/dashboard")!==null,N=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),P=t((e=>Re(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),v=t((e=>je(e)));m.useEffect((()=>{k&&C&&!f&&v.fetchState==="Not-Started"&&r(Le(!0))}),[k,C,v.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Oe(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),V=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Te=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",Ee=t((e=>b(e).totalUnreadCount)),ke=t((e=>b(e).reducedFetchCountState)),R=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=Ea();m.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),m.useEffect((()=>{k&&E&&!f&&L.fetchState==="Not-Started"&&B.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[k,E,f,L.fetchState,B.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(K({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(K({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:ke,count:Ee},W=s!=null?ra.getSignedInUserTenant(s):null,Y=t((e=>W?.tenantId!=null?Ze(e,W.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),V===!1&&h.push("expense_automation_card");const q=t((e=>ze(e,h).fetchState)),H=t((e=>We(e).fetchState)),ye=A&&(q==="Completed"||q==="Error")||N&&(H==="Completed"||H==="Error")||!A&&!N?void 0:"disabled",we=m.useMemo((()=>Ye(o.userRole)),[o.userRole]),Ae=qe(we),ve=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&He(P.notificationSettings,p.userEmail,x,o,E),Q=da(),Fe=Q&&ca(a);return _.jsx(Ta,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:_.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:Y!=null?[Y]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:Ae,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Te,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:V,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:ve,rewardsPlan:v.rewardsPlan},isAiCfoAccessEnabled:Q,onNotificationIconClick:()=>{i(!1);let e=R===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=R===0&&j>0?"../../notifications/comments":"../../notifications/tasks");const u=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:S(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,_e=ae(J)&&J!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),_e&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Be=ga(e.type);Sa(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Be}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{T.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:A,updateCurrentChatSessionId:e=>{r(Qe({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:E,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Ba=l=>{const i=te(),s=t((T=>ne(T))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(T,n)=>{Xe(n)&&Ne(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return _.jsx(Ca,{...l,...a})};export{Ba as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-UOzcPsHa.js";import{h as r,l as i}from"./core-B5mDy9pu.js";import{am as n}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import"./sentry-DHDsO12F.js";import"./zeni-epic-state-7eY0g-Bc.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as mt,b as lt,o as ft,j as _}from"./liveblocks-
|
|
1
|
+
import{n as mt,b as lt,o as ft,j as _}from"./liveblocks-UOzcPsHa.js";import ut from"./NotFoundScreen-BkYIKPgh.js";import{a as k}from"./sentry-DHDsO12F.js";import{h as ht,g as pt,i as kt,u as gt,j as S,l as St,n as bt,o as K}from"./core-B5mDy9pu.js";import{cA as Tt,TP as X,fF as H,h1 as It,TT as b,a0N as J,TZ as m,TN as E,Aj as j,F$ as Ct,a0O as At,TM as Et,T$ as yt,Ao as Nt,a0P as F,br as $,gh as x,As as Q,a0Q as _t,cM as Bt,cF as wt}from"./zeni-epic-state-7eY0g-Bc.js";import{aq as xt,d as vt,N as Pt,c as Dt,as as Mt,dM as Rt,p as B,dN as Gt,w as Ut,dO as Ft,i as $t,a4 as jt}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-BsP5fVhq.js";import{u as Lt}from"./useTaskManagerAccess-BG0Fkj9k.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="0d53ba19-1ad1-4e26-a888-8de98236992b",t._sentryDebugIdIdentifier="sentry-dbid-0d53ba19-1ad1-4e26-a888-8de98236992b")}catch{}})();const Ot=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=St((function(t,l){const n=X(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=H(t),{currentTab:T}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&yt(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[T].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:T,fetchMoreCommentsNotifications:P}=l;return{onNotificationClick:(e,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}d==="unread"&&t(Q("task_manager","read",[e],!1))},onCommentNotificationClick:(e,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(T(e),t(F([e],$())));let i=`/${h}/${r[1]}`;const I=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(e,s)=>{t(E(e,s))},onUpdateNotificationTabState:(e,s)=>{t(m(e,s))},onUpdateNotificationViewCurrentTabAndSubTab:(e,s)=>{t(J(e,s));const d=`../${e}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:e=>{t(_t(e))},onFetchMoreNotifications:(e,s)=>{if(e==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(j("task_manager","dashboard",d))}else P?.()},onUpdateNotificationStatus:(e,s,d,r)=>{e==="tasks"?t(Q("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(T(i),t(F([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:e=>{e==="tasks"?t(Nt("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Ot(o,T).then((()=>{t(F(o,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const e=jt(n.state?.pathnameStackToGoBack),s=e.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:e.newStack}})},onSettingsClick:()=>{const e=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:e}})}}}))(Ut(Ft)),Wt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=Tt(h??""),o=gt(),f=vt(),[T,P]=k.useState(!1),e=S((a=>X(a))),s=S((a=>H(a))),{useFeatureGate:d}=Pt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:I}=Vt({mobileExploreReferrer:"Notifications"});Mt({isDataReady:!0});const Y=It(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((a=>b(a).notificationDetailsByTab.tasks.fetchState)),L=S((a=>b(a).currentTab)),D=S((a=>b(a).currentSubTab)),tt=S((a=>b(a).notificationDetailsByTab.comments.fetchCountState)),M=S((a=>b(a).notificationDetailsByTab.comments.fetchState)),at=S((a=>b(a).notificationDetailsByTab.comments.uiState.unreadCount)),et=S((a=>b(a).allExternalNotifications)).filter((a=>a.inboxNotification.readAt==null)).map((a=>a.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:w,isLoading:y,hasFetchedAll:C,isFetchingMore:R,fetchMore:ot}=mt(),{threads:O,isLoading:q,fetchMore:W,isFetchingMore:Z,hasFetchedAll:z}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(J(c)),c==null){const a=`../${L}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(a,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(y===!1&&C===!0&&s?.companyId!=null&&w!=null){const a=`dashboard_${s.companyId}`,p=w.filter((A=>A.roomId===a&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(E({unreadCount:p},"comments"))}}),[y,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const a=setTimeout((()=>ot?.()),0);return()=>clearTimeout(a)}));const G=y||R===!0||C!==!0||y||R===!0||C!==!0;k.useEffect((()=>{G&&M!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):G||M!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[G,M]),k.useEffect((()=>{o(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{e.fetchState!=="In-Progress"&&e.fetchState!=="Completed"&&T===!1&&(P(!0),o(Ct()))}),[e.fetchState]),k.useEffect((()=>{if(y===!1&&q===!1&&w!=null&&O!=null){const a=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===a)).filter((u=>Gt(u.kind))),A=p.filter((u=>u.readAt==null)),N=p.map((u=>u.id)),ct=p.map((u=>{const U=O.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return U!=null?{inboxNotification:{...u,threadId:U.id},thread:U}:(Z||z===!0||W==null||W(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:N},"comments")),o(E({totalCount:N.length,unreadCount:A.length},"comments")),o(At(ct))}}),[y,R,Z,C,z,q,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(a,p)=>{if($t(p)){const A=Et(p.mode);if(A==="dashboard"&&o(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const N=[];D==="all"?N.push("read","unread"):D!=="mentions"&&N.push(D),o(j("task_manager",A,N,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return _.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Y,signedInUser:f,externalNotificationsUnreadCount:at,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:et,isAiCfoAccessEnabled:i,onAskAiCfoClick:I,...nt})};function ma(){return _.jsxs(bt,{children:[_.jsx(K,{path:"/:selectedTab",element:_.jsx(Wt,{})}),_.jsx(K,{path:"*",element:_.jsx(ut,{})})]})}export{ma as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-
|
|
1
|
+
import{j as f}from"./liveblocks-UOzcPsHa.js";import{a as r}from"./sentry-DHDsO12F.js";import{u as A,g as j,j as o,N as C}from"./core-B5mDy9pu.js";import{Uq as P,fF as x,gm as z,Ur as D,Us as M,Ut as R,Uu as q,pS as k,T5 as L}from"./zeni-epic-state-7eY0g-Bc.js";import{z as h,ah as I}from"./index-6nH5LMe4.js";import"./mui-Do6nLzGb.js";import"./recharts-uFX1dZS-.js";import"./analytics-D6GpUSOP.js";import"./plaid-0g_vwjSd.js";import"./dnd-CGWe1ZMP.js";import"./stripe-cKAAJElX.js";import"./lottie-C5eNvt0I.js";import"./lexical-DW4lC8Zx.js";import"./pdf-DjwvAC2g.js";import"./utils-BsODCDYR.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="338f0360-45c2-4936-9963-db6197550231",n._sentryDebugIdIdentifier="sentry-dbid-338f0360-45c2-4936-9963-db6197550231")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>P(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),p=h.isSignedIn(),a=h.getSignedInUser(),m=o((e=>x(e))),l=o((e=>z(e))),d=o((e=>e.tenantState.fetchState)),y=o(D),S=o(M),u=o(R),[U,v]=r.useState(null),[b,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(q())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&a!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[p,a,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=U??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:v,approveError:b??S,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&a!=null&&c!=null&&n(L(a.userId,a.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(C,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
|