@zeniai/web-app-ui 5.3.29-qa → 5.3.30-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-Bim1Hr_z.js → AccountMappingScreen-DwZgnpO5.js} +2 -2
- package/dist/assets/AddressRoutes-C62kNpv6.js +1 -0
- package/dist/assets/AddressScreen-CLiV0mfm.js +9 -0
- package/dist/assets/AiCfoScreen-CqZYbNVQ.js +22 -0
- package/dist/assets/AppDrawer-BIggl_eh.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-Cf5w1Fd_.js → BillPayApprovalRoutes-k9A_OynM.js} +1 -1
- package/dist/assets/{BillPayRoutes-DDeK4O3Z.js → BillPayRoutes-DqYiVdlx.js} +9 -9
- package/dist/assets/{BusinessVerificationPageScreen-BhpdMjkc.js → BusinessVerificationPageScreen-3R_uxb4s.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-BmeTr_5u.js → CardsAiCfoScreen-Bi4DWU-D.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-Y_ZnY6a9.js → ChargeCardRoutes-D_J5Jsfo.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-BChXj6Kk.js → CompanyPassportScreen-CWgdKqmQ.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-I4BlOLSg.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-B0zqTC0c.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CRNi6Rqr.js → CustomerOnboardingRoutes-DD4F_qvN.js} +5 -5
- package/dist/assets/{DashboardRoutes-CzNNddHy.js → DashboardRoutes-ZMo0onUW.js} +4 -4
- package/dist/assets/{DefaultTenantHome-CmugmZX7.js → DefaultTenantHome-BqaVnNI0.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DQgaUF67.js +18 -0
- package/dist/assets/DrawerScreen-C6V6LURt.js +1 -0
- package/dist/assets/EntityDetailRoutes-Dm568mMt.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-B1Pq1A36.js +38 -0
- package/dist/assets/FeaturePreviewScreen-B_aYJlol.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-ClpdRb8W.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-MlM0K3gF.js → InboxNotificationsProvider-BIRPulc1.js} +1 -1
- package/dist/assets/InvoicingRoutes-CBGWefo8.js +2 -0
- package/dist/assets/{MagicLinkRoutes-B3omwZ45.js → MagicLinkRoutes-Bnp_x7Nk.js} +20 -20
- package/dist/assets/MagicLinkSignInScreen-D-6FJGXy.js +12 -0
- package/dist/assets/{MobileAppDrawer-DigqZbbY.js → MobileAppDrawer-CcN5sT0f.js} +1 -1
- package/dist/assets/NotFoundScreen-fxNT7vgC.js +1 -0
- package/dist/assets/NotificationRoutes-BJVwBy9d.js +1 -0
- package/dist/assets/OAuthConsentScreen-DOVfptZ6.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-CGhv0VSW.js +1 -0
- package/dist/assets/{PaymentLinkScreen-fA05KlxQ.js → PaymentLinkScreen-Ci5gr6F7.js} +2 -2
- package/dist/assets/PeopleRoutes-Bee6xNme.js +22 -0
- package/dist/assets/PerformanceRoutes-CD6W5bUU.js +1 -0
- package/dist/assets/{Preview-CzyJ4PGQ.js → Preview-ByUhhrY0.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-ByKxBz2v.js → QBOConnectionScreen-IBpF64YF.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-B5KvxgyI.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CuE7ORwk.js → ReimbursementApprovalRuleDetailScreen-DetQk8QU.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-6nUym5eB.js → ReimbursementRoutes-C9_awEWz.js} +9 -9
- package/dist/assets/ReportsRoutes-zo7ew2ho.js +1 -0
- package/dist/assets/RewardsRoutes-sTKxe2ug.js +1 -0
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CrWn6EEs.js +25 -0
- package/dist/assets/ScreenRoutes-DIYlkgqr.js +2 -0
- package/dist/assets/{SettingsRoutes-AaNqIdby.js → SettingsRoutes-BEdYLTM7.js} +6 -6
- package/dist/assets/{SetupPagesScreen-BgHIeOKB.js → SetupPagesScreen-Sjd63M0p.js} +5 -5
- package/dist/assets/SignInScreen-_27hdB-U.js +1 -0
- package/dist/assets/SignOutScreen-CDr6KmEf.js +9 -0
- package/dist/assets/TaskListScreen-DdkR5DtM.js +9 -0
- package/dist/assets/{TaskRoutes-BWLw4wFO.js → TaskRoutes-LOSKO78T.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-PwaQuAlN.js +1 -0
- package/dist/assets/TransactionDetailScreen-BlnM6_t9.js +5 -0
- package/dist/assets/TransactionListRoutes-Bx3VnAdU.js +1 -0
- package/dist/assets/TreasuryRoutes-BEdtvJnK.js +37 -0
- package/dist/assets/VendorsRoutes-DoXAtF5W.js +88 -0
- package/dist/assets/WiseConfirmationScreen-CVwWngtr.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-DpPln-Iv.js → ZeniAccountRoutes-BXfvCXHr.js} +8 -8
- package/dist/assets/ZeniAccountStatementScreen-C3siKg2V.js +9 -0
- package/dist/assets/{accountMappingHelper-BIF4Ld_b.js → accountMappingHelper-CU6wucuM.js} +1 -1
- package/dist/assets/{analytics-B5-t19F2.js → analytics-BgUj-hR5.js} +1 -1
- package/dist/assets/{analyticsHelper-5kEw8e8E.js → analyticsHelper-Cypw_xC0.js} +1 -1
- package/dist/assets/{core-C5rVvNoh.js → core-CMivCywN.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-ChlmY296.js → decodeURIComponentSafe-DRefzrWS.js} +1 -1
- package/dist/assets/{dnd-DqvXOfHm.js → dnd-B8NpvFCU.js} +1 -1
- package/dist/assets/{empty-D5lwiblX.js → empty-CawgNJEF.js} +1 -1
- package/dist/assets/{empty-BTHEbwNZ.js → empty-CllNfDt1.js} +1 -1
- package/dist/assets/{emptyVideoElement-I-9RXuP2.js → emptyVideoElement-DBVZ22o5.js} +1 -1
- package/dist/assets/{epic-DYPr57kS.js → epic-Cw47VvOB.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-DT3oLJj6.js → expenseAutomationHelper-BuTA7ucx.js} +1 -1
- package/dist/assets/getLocaleForTenant-DCXbCJAu.js +1 -0
- package/dist/assets/{index-DCp3lIjg.js → index-BnHTUbKj.js} +1 -1
- package/dist/assets/{index-CZcqif3N.js → index-CD-EymjZ.js} +2 -2
- package/dist/assets/{index-CGyxP256.js → index-Cx55eHdr.js} +1 -1
- package/dist/assets/{index-De1cB3Ka.js → index-DCnLtCHg.js} +1 -1
- package/dist/assets/{index-Bue9AeKl.js → index-Djuwyi3d.js} +1 -1
- package/dist/assets/{index-BTTzX8oM.js → index-DlMGj3Af.js} +16552 -16499
- package/dist/assets/{index-CibO_KMz.js → index-XoGDegrx.js} +1 -1
- package/dist/assets/{index-DMhoHJcD.js → index-baDCTZK3.js} +1 -1
- package/dist/assets/{lexical-BO1ifV0W.js → lexical-Di6ZXkXF.js} +1 -1
- package/dist/assets/{liveblocks-BhGApeF9.js → liveblocks-mJJR3MsR.js} +1 -1
- package/dist/assets/{lottie-CSUQXsXJ.js → lottie-BTBtSLCO.js} +1 -1
- package/dist/assets/{mui-AVx3Hg0F.js → mui-C6XtNCo7.js} +1 -1
- package/dist/assets/{pathToGoBack-CW7sD0XS.js → pathToGoBack-DkQc48Fj.js} +1 -1
- package/dist/assets/{pdf-B6tAgCXh.js → pdf-DSDpdkmb.js} +3 -3
- package/dist/assets/{pdf-lib-u-Ml-CIk.js → pdf-lib-BbzL8H1t.js} +1 -1
- package/dist/assets/{plaid-BuoWWOAj.js → plaid-l8YRzpBD.js} +1 -1
- package/dist/assets/{pusher-D8sdZANA.js → pusher-B8Hm6DMT.js} +1 -1
- package/dist/assets/{react-Sh9CA0od.js → react-BeA4fGXX.js} +1 -1
- package/dist/assets/{react-DAMRot7g.js → react-CFob_XAv.js} +1 -1
- package/dist/assets/{react-DzRqKqJZ.js → react-CexHjl19.js} +1 -1
- package/dist/assets/{react-DbafCI99.js → react-FrhNEOT3.js} +1 -1
- package/dist/assets/{react-q70XtbNu.js → react-TfJbQpIh.js} +1 -1
- package/dist/assets/{react-BslW5-Xl.js → react-hzw_vRmY.js} +1 -1
- package/dist/assets/{recharts-uwVP8vj-.js → recharts-Co0_Dmc-.js} +1 -1
- package/dist/assets/routePaths-Bpj3i3MK.js +1 -0
- package/dist/assets/{sentry-B98sAG37.js → sentry-CItQHKpv.js} +1 -1
- package/dist/assets/{url-qe19dJXu.js → url-MmuF1WQx.js} +1 -1
- package/dist/assets/{url-RaJlDbzw.js → url-xQ9KNY2e.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CBJFyF6T.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-eZEppiJu.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-D3l-sj94.js +1 -0
- package/dist/assets/{useDeviceId-6INyJgde.js → useDeviceId-DJLfe-br.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DlmntN_b.js +1 -0
- package/dist/assets/useInitialThreadRequest-DBDsuRGA.js +1 -0
- package/dist/assets/{useTaskManagerAccess-vcnpqvQT.js → useTaskManagerAccess-B7jKkFFv.js} +1 -1
- package/dist/assets/{utils-B1bcOxs7.js → utils-macSqF2O.js} +1 -1
- package/dist/assets/withTransactionSidePanel-DMpmT4ot.js +25 -0
- package/dist/assets/{zeni-epic-state-BVExw1ei.js → zeni-epic-state-CqKBThJ0.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-CdDnkC-7.js +0 -1
- package/dist/assets/AddressScreen-Dyq7f1j-.js +0 -9
- package/dist/assets/AiCfoScreen-BAtt2kQC.js +0 -22
- package/dist/assets/AppDrawer-BGKn6F8p.js +0 -10
- package/dist/assets/ConnectionAuthScreen-DboT0gK7.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-C9C7O3K1.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-C2hFGwu0.js +0 -18
- package/dist/assets/DrawerScreen-lK0vJxIS.js +0 -1
- package/dist/assets/EntityDetailRoutes-BSm0QeV6.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-CVR_qG3c.js +0 -25
- package/dist/assets/FeaturePreviewScreen-CVnp0bZd.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-Ck10qQ6V.js +0 -1
- package/dist/assets/InvoicingRoutes-Q8vi5u3U.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-D8Vs7E-F.js +0 -12
- package/dist/assets/NotFoundScreen-C_nzijM_.js +0 -1
- package/dist/assets/NotificationRoutes-DKgxAwSp.js +0 -1
- package/dist/assets/OAuthConsentScreen-DY5NR4TR.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-5el-0Lj7.js +0 -1
- package/dist/assets/PeopleRoutes-DJYa775V.js +0 -22
- package/dist/assets/PerformanceRoutes-CrDIRhB1.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-CGtOCJ7F.js +0 -1
- package/dist/assets/ReportsRoutes-s2hJ2RsR.js +0 -1
- package/dist/assets/RewardsRoutes-C-di4Yoz.js +0 -1
- package/dist/assets/ScreenRoutes-BhCi8qGV.js +0 -2
- package/dist/assets/SignInScreen-DCTVuESb.js +0 -1
- package/dist/assets/SignOutScreen-Dl74ZT33.js +0 -9
- package/dist/assets/TaskListScreen-D4isBRlx.js +0 -9
- package/dist/assets/TransactionDetailRoutes-BLhI-0B0.js +0 -1
- package/dist/assets/TransactionDetailScreen-IKPgPc-W.js +0 -5
- package/dist/assets/TransactionListRoutes-Bu8kgDQQ.js +0 -1
- package/dist/assets/TreasuryRoutes-CZBiOy69.js +0 -37
- package/dist/assets/VendorsRoutes-KMa9llQ2.js +0 -112
- package/dist/assets/WiseConfirmationScreen-tpmS2fpR.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-C_X33S2u.js +0 -9
- package/dist/assets/getLocaleForTenant-DQ9OiUn_.js +0 -1
- package/dist/assets/routePaths-Cx9L8hBM.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-C7_zR2C_.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-XPXgI-Bx.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-98NnzJRh.js +0 -1
- package/dist/assets/useInitialThreadRequest-DuL5mYzq.js +0 -1
- package/dist/assets/withTransactionSidePanel-F28FfzEK.js +0 -25
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{j as I}from"./liveblocks-mJJR3MsR.js";import _a from"./NotFoundScreen-fxNT7vgC.js";import{a,R as An}from"./sentry-CItQHKpv.js";import{n as Te,S as Fa}from"./mui-C6XtNCo7.js";import{u as Se,h as bt,g as Xe,j as F,i as gt,l as Ba,t as Ua,n as Va,o as dt}from"./core-CMivCywN.js";import{fB as Fe,a0i as Oa,pY as Re,Ts as Ma,zl as ja,a0j as La,a0k as za,a0l as $a,a0m as ut,a0n as Je,gd as Ct,a0o as nn,eJ as Ga,fY as qa,a0p as an,a0q as Ye,qP as Na,uc as Ja,gP as Ya,gN as Wa,a0r as Ha,r0 as Ka,r9 as Qa,q7 as Za,ql as Pn,gM as de,gO as Xa,a0s as es,qH as xn,ra as ts,qi as ns,qd as as,ui as ss,gL as De,a0t as Ke,Bv as wn,LO as Rn,a0u as Dn,EO as _n,a0v as os,fh as cs,fj as is,sd as ft,Wa as sn,Wc as ls,l_ as rs,Wd as ds,m5 as us,dh as ms,CO as It,a0w as ps,a0x as hs,s3 as Ss,s4 as gs,W0 as Cs,V6 as fs,$M as Is,qA as Fn,rf as Qe,a0y as ks,W6 as on,W5 as Ne,a0z as cn,mm as bs,a0A as Ts,a0B as ys,a0C as vs,a0D as Es,qv as As,ri as We,a0E as Ps,a0F as xs,a0G as ws,rq as Rs,m9 as Ds,m0 as _s,a0H as Fs,m8 as ln,Wn as Bs,a0I as Us,a0J as Vs,tP as Os,tq as Ms,rg as he,tp as mt,a0K as js,a0L as Ls,a0M as zs,a0N as $s,nF as Gs,br as qs,nA as rn,nm as Ns,a0O as Js,gY as Ys,nx as Ws,sf as Hs,sh as Ks,rY as Qs,V9 as Zs,Va as Xs,Eg as eo,Ef as to,Ew as no,a0P as dn,s2 as ao,fg as kt,s8 as so,a0Q as oo,so as co,rS as io,st as lo,rX as ro,rB as uo,a0R as mo,Ti as Bn,qT as po,qr as ho,qy as un,rl as So,a0S as go,a0T as Co,rh as Un,a0U as fo,a0V as Io,a0W as ko,a0X as bo,sx as To,a0Y as yo,a0Z as vo,a0_ as mn,t_ as Eo,th as Ao,r$ as pn,W4 as Po,a0$ as xo,a10 as wo,m7 as Ro,a11 as Do,Qu as _o,m6 as Fo,lX as Bo,Th as Uo,sQ as Vn,ta as Vo,re as hn,rj as Oo,bE as Mo,nu as jo,nr as Lo,a12 as zo,rA as Sn,t6 as gn,t4 as $o,a13 as Go,sV as qo,sA as No,t7 as Jo,a14 as Yo,a15 as Wo,sG as Ho,a16 as Ko,sB as Qo,sF as Zo,sD as Xo,td as ec}from"./zeni-epic-state-CqKBThJ0.js";import{O as Ze,y as Q,h as N,p as ee,aq as On,as as Mn,dO as tc,z as et,dP as nc,dQ as ac,dR as sc,ae as _e,dS as oc,dT as Cn,ba as fn,dU as cc,a7 as jn,dV as ic,g as He,G as lc,w as rc,dW as dc,av as In,dX as uc,a as mc,dY as pc,dZ as hc,U as Sc,J as gc,d_ as Cc,d$ as fc,e0 as Ic,b4 as kc,br as bc,ab as Tc,b5 as yc,b6 as vc}from"./index-DlMGj3Af.js";import{u as Ln}from"./useAskAiCfoHostNavButtonProps-eZEppiJu.js";import{g as kn,h as Ec,r as Ac,b as Pc,c as xc,i as wc,a as Rc,C as Dc}from"./TransactionDetailScreen-BlnM6_t9.js";import{b as _c,S as Fc,a as Bc,J as Uc}from"./ScheduleDetailsPrepaidExpensesScreen-CrWn6EEs.js";import{s as bn,i as zn,h as Vc,v as Oc,c as Mc}from"./routePaths-Bpj3i3MK.js";import{u as jc,a as Lc,w as zc}from"./withTransactionSidePanel-DMpmT4ot.js";import{a as pt}from"./accountMappingHelper-CU6wucuM.js";import{D as $c}from"./DrawerScreen-C6V6LURt.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./decodeURIComponentSafe-DRefzrWS.js";import"./useInitialThreadRequest-DBDsuRGA.js";import"./expenseAutomationHelper-BuTA7ucx.js";import"./pathToGoBack-DkQc48Fj.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="0a59bc30-c967-4b57-82e2-c870b3337930",t._sentryDebugIdIdentifier="sentry-dbid-0a59bc30-c967-4b57-82e2-c870b3337930")}catch{}})();const Gc=()=>{const t=Se(),s=bt(),b=Xe(),g=F((i=>Fe(i))),{useFeatureGate:C}=Ze(),{isFeatureEnabled:l}=C(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:m}=C(Q.aiAuditScorePercentage),P=F((i=>i.expenseAutomationViewState.selectedPeriodByTenantId)),d=F((i=>Oa(i,g.tenantId))),{isAiCfoAccessEnabled:y,onAskAiCfoClick:w}=Ln({mobileExploreReferrer:"Month-End Close Overview"}),x=a.useCallback(((i,D,G=!1)=>{t(Re({tenantId:D,period:{month:i.month,year:i.year},refreshViewInBackground:G}))}),[]),h=a.useCallback((i=>{const D=b.state?.referrer;d.monthEndCloseChecks?.auditSummary!=null&&N.trackMonthCloseAuditPage(i.month,i.year,d.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",d.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,D??null),t(Ma(g.tenantId,i))}),[g.tenantId,d.monthEndCloseChecks?.auditSummary,d.monthEndCloseChecks?.reportEmailSentDate]),S=P[g.tenantId],u=a.useCallback((()=>{const i=b.state?.referrer;d.monthEndCloseChecks?.auditSummary!=null&&N.trackMonthCloseAuditPage(S.month,S.year,d.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",d.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,i??null),x(S,g.tenantId,!0)}),[x,S,g.tenantId,d.monthEndCloseChecks?.auditSummary,d.monthEndCloseChecks?.reportEmailSentDate]),B=ee(b.state?.pathnameStackToGoBack,b.pathname),E=a.useCallback((()=>{if(d.monthEndCloseChecks!=null&&S!=null){const i=d.monthEndCloseChecks.monthEndCloseCheckList.find((D=>D.progress<100));if(i!=null)return void s(`./${i.id}/${S.month}-${S.year}`,{state:{pathnameStackToGoBack:B,message:"comingFromOverview"}});s(`./month_end_insights/${S.month}-${S.year}`,{state:{pathnameStackToGoBack:B,message:"comingFromOverview"}})}}),[d.monthEndCloseChecks,S]),{areTenantIdsInSync:p}=On();return Mn({isDataReady:d.fetchState==="Completed"}),a.useEffect((()=>{S!=null&&d.fetchState!=="In-Progress"&&d.fetchState!=="Completed"&&p&&x(S,g.tenantId)}),[x,S,d.fetchState,g.tenantId,p]),a.useEffect((()=>{S!=null&&d.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&d.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&p&&t(ja(S))}),[S,d.monthClosePerformanceTrendFetchStatus.fetchState,p]),a.useEffect((()=>{const i=setInterval((()=>{d.fetchState!=="In-Progress"&&d.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(i)}),[d.fetchState]),a.useEffect((()=>{if(d.fetchState==="Completed"&&d.monthEndCloseChecks?.auditSummary!=null){const i=b.state?.referrer;N.trackMonthCloseAuditPage(d.selectedPeriod.month,d.selectedPeriod.year,d.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",d.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,i??null)}}),[d.fetchState,d.selectedPeriod,d.monthEndCloseChecks?.auditSummary,d.monthEndCloseChecks?.reportEmailSentDate]),I.jsx(qc,{children:I.jsx(tc,{monthEndCloseChecksView:d,isRealtimeInsightsFeatureEnabled:l,onMonthEndCheckClick:i=>{s(`./${i}/${S.month}-${S.year}`,{state:{pathnameStackToGoBack:B,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:h,handleReviewButtonClick:E,onBackClick:()=>{s("../../dashboard")},onReload:u,isAiCfoAccessEnabled:y,onAskAiCfoClick:w,aiAuditScorePercentageEnabled:m})})},qc=Te.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
height: 100vh;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex: 1 1 auto;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
background-color: ${t=>t.theme.colors.grey4};
|
|
8
|
+
`,Nc=An.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:b,onFetchLinkTokenClick:g,onEstablishConnectionClick:C})=>{const l=Se(),{useFeatureGate:m}=Ze(),{isFeatureEnabled:P}=m(Q.isReconV3Enabled),{isFeatureEnabled:d}=m(Q.isReconciliationCombinedStatementEnabled),y=et.getSignedInUser(),w=F((T=>Fe(T))),x=a.useMemo((()=>({userId:y?.userId??"",sessionId:y?.zeniSessionId??"",tenantId:w?.tenantId??""})),[y?.userId,y?.zeniSessionId,w?.tenantId]),{accountReconciliationsByAccountID:h,excludedAccountIDs:S,monthYearPeriod:u,statementUploadChosen:B}=t,E=h[s],p=a.useMemo((()=>La(h,s)),[h,s]),i=a.useMemo((()=>za(h)),[h]),D=a.useMemo((()=>$a(h,s)),[h,s]),G=a.useRef(!1),O=a.useCallback((T=>{G.current=T,Cn(s,T)}),[s]),A=a.useCallback((T=>{l(ut({accountId:s,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:T.completedSteps,startedAtMs:T.startedAtMs,totalDurationSeconds:T.totalDurationSeconds})),T.accountMappings!=null&&l(Je({accountId:s,selectedPeriod:u,localData:{combinedStatementAccountMappings:T.accountMappings}})),E!=null&&requestAnimationFrame((()=>{G.current||l(Ct({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:nc(E)}]}))}))}),[l,u,E,s]),M=a.useCallback((()=>{l(ut({accountId:s,selectedPeriod:u,dismissedToBackground:!1}))}),[l,s,u]),e=a.useCallback((T=>{l(nn({accountId:s,selectedPeriod:u,backgroundCompletedSteps:T}))}),[l,u,s]),n=a.useCallback((()=>{l(nn({accountId:s,selectedPeriod:u,backgroundCompletedSteps:0})),l(ut({accountId:s,selectedPeriod:u,dismissedToBackground:!1}))}),[l,u,s]);a.useEffect((()=>()=>{Cn(null,!1)}),[]);const c=E?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??E?.accountReconEntity.statementMetaData?.statementUploadId,r=E?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,f=F((T=>r!=null&&r!==""?Ga(qa(T.userState,r)):"")),k=a.useCallback((()=>{l(an({accountId:s,selectedPeriod:u}))}),[l,s,u]),R=a.useCallback((()=>{l(an({accountId:s,selectedPeriod:u})),l(Ye({statementUploadChosen:!0}))}),[l,s,u]),j=(T,K)=>{l(ss(T,K.split(".")[0]))},q=(T,K)=>{if(K===!0){const te=E?.combinedStatementGroupId??E?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??E?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(te!=null&&te!=="")return void l(ns({accountId:s,selectedPeriod:u,combinedStatementGroupId:te,fileId:T}))}c!=null&&l(as({accountId:s,selectedPeriod:u,fileId:T,statementUploadId:c}))},J=()=>{l(Ye({statementUploadChosen:!1}))},ae=T=>{l(ts({accountId:s,selectedPeriod:u,payload:T,statementAccountScope:d===!0?E?.localData?.statementAccountScope??"single_account":"single_account"}))},se=a.useCallback(((T,K,te)=>{l(Na({accountId:T,selectedPeriod:K,statementUploadId:te}))}),[l]),_=a.useCallback(((T,K,te,fe,ce)=>{ce!=null&&ce!==""&&l(Ja(ce)),l(fe==null||fe===""?Wa({accountId:T,selectedPeriod:K,statementUploadId:te}):Ya({accountId:T,selectedPeriod:K,statementUploadId:te,combinedStatementGroupId:fe}))}),[l]),ye=a.useCallback(((T,K)=>{K!==""&&l(Ha({accountId:s,selectedPeriod:u,statementUpdateLocalData:T,statementUploadId:K}))}),[l,s,u]),ue=a.useCallback((()=>{c!=null&&l(E?.localData?.statementAccountScope!=="multi_account"?Qa({accountId:s,selectedPeriod:u,statementUploadId:c}):Ka({accountId:s,selectedPeriod:u,statementUploadId:c}))}),[l,E?.localData?.statementAccountScope,s,u,c]),W=a.useCallback((T=>{c!=null&&l(Za({accountId:s,selectedPeriod:u,statementUploadId:c,accountMappings:T}))}),[l,u,s,c]),ge=a.useCallback((()=>{l(Ye({statementUploadChosen:!0}))}),[l]),Be=T=>{l(Je({accountId:s,selectedPeriod:u,localData:{accountSource:T}}))},Ue=T=>{l(Je({accountId:s,selectedPeriod:u,localData:{statementAccountScope:T}}))},H=a.useCallback((()=>{l(Pn({accountId:s}))}),[l,s]),oe=a.useCallback((T=>{l(de(u,T,!0)),b()}),[l,u,b]),Z=a.useCallback((()=>{l(Xa({accountId:s,selectedPeriod:u,statementProcessingFailed:!1})),l(es({accountId:s,selectedPeriod:u}))}),[l,s,u]),Ve=a.useCallback((()=>{l(xn({accountId:s}))}),[l,s]),Ce=S.includes(s)?t.excludedAccountReconciliationByAccountID[s]:void 0;if(Ce!=null)return I.jsx(Tn,{children:I.jsx(yn,{$isV3:P===!0,children:I.jsx(ac,{excludedAccountReconciliation:Ce,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:P,onDismissClick:b,onIncludeIntoReconciliation:Ve})})});if(E!=null){const T=P===!0?I.jsx(sc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:E,monthYearPeriod:u,onDismissClick:b,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:C,onEditFileName:j,onDeleteFile:q,onSelectSourceType:Be,onSelectStatementAccountScope:Ue,isReconciliationCombinedStatementEnabled:d===!0,ledgerAccounts:p,statementOverrideWarningAccountIds:D,unavailableLedgerAccountIds:i,onConfirmStatementMapping:W,filesEndPoint:_e.fileMicroServiceBaseUrl,authParams:x,openFilePicker:B,onStatementUploadSuccess:ae,onUploadWindowOpenedOnce:J,onExcludeFromReconciliation:H,onRetryParsing:se,onFetchStatementParseInfo:_,onReviewClicked:oe,statementProcessingFailed:E.statementProcessingFailed,statementProcessingDismissedToBackground:E.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:Z,onContinueInBackground:A,onClearStatementProcessingDismissedToBackground:M,onResetStatementProcessingProgress:n,onStatementProcessingProgressChange:e,onStatementFlowVisibilityChange:O,onReuploadStatement:ge,onStatementFormDataChange:ye,onStatementConfirmSave:ue,reconciledByName:f,onDismissDateConflict:k,onReuploadAfterDateConflict:R,isReconV3Enabled:P}):I.jsx(oc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:E,monthYearPeriod:u,onDismissClick:b,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:C,onEditFileName:j,onDeleteFile:q,onSelectSourceType:Be,filesEndPoint:_e.fileMicroServiceBaseUrl,authParams:x,openFilePicker:B,onStatementUploadSuccess:ae,onUploadWindowOpenedOnce:J,onExcludeFromReconciliation:H});return I.jsx(Tn,{children:I.jsx(yn,{$isV3:P===!0,children:T})})}return null})),Tn=Te.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
height: 100%;
|
|
12
|
+
`,yn=Te.div`
|
|
13
|
+
flex: 1;
|
|
14
|
+
min-height: 0;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
min-width: 0;
|
|
19
|
+
overflow-x: hidden;
|
|
20
|
+
overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
|
|
21
|
+
`;function Jc({panelType:t,scheduleId:s,onClose:b}){return I.jsx(Wc,{children:I.jsx(Hc,{children:Yc(t,s,b)})})}function Yc(t,s,b){switch(t){case"one_time_accrual":return I.jsx(Uc,{isRenderedInPanel:!0,accrualIdOverride:s,onPanelNavigateBack:b});case"accrued_expenses":return I.jsx(Bc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:b});case"fixed_assets":return I.jsx(Fc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:b});case"prepaid_expenses":return I.jsx(_c,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:b})}}const Wc=Te.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
height: 100%;
|
|
25
|
+
`,Hc=Te.div`
|
|
26
|
+
flex: 1;
|
|
27
|
+
min-height: 0;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
overflow-x: hidden;
|
|
33
|
+
overflow-y: auto;
|
|
34
|
+
`,Kc=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,Qc=Lc({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const s=(function(h=!0){const S=bt(),u=Xe(),B=Se(),E=gt(),p=jc({childPathPattern:Kc,enabled:h}),i=p.matchGroups[0],D=zn(i)?i:void 0,G=p.matchGroups[1]!=null&&p.matchGroups[1]!==""?p.matchGroups[1]:void 0,O=p.isOpen&&D!=null&&G!=null,A=E.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",M=a.useRef({isOpen:O,scheduleId:G});M.current={isOpen:O,scheduleId:G};const e=a.useCallback(((c,r,f)=>{f!=null&&(r==="prepaid_expenses"||r==="fixed_assets")&&B(_n({selectedJEScheduleKey:f})),!p.isMobile&&h?M.current.isOpen&&M.current.scheduleId===c?p.closePanel():p.navigateToChild(`schedule/${r}/${c}`,{replace:M.current.isOpen}):S(bn(r,c,A),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[B,S,p.isMobile,p.navigateToChild,p.closePanel,h,A]),n=a.useCallback((()=>{if(D==null||G==null)return;const c=ee(u.state?.pathnameStackToGoBack,u.pathname);S(bn(D,G,A),{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"je_schedules"}})}),[S,D,G,A,u.pathname,u.state]);return{closePanel:p.closePanel,isOpen:O,maximize:n,openPanel:e,panelType:O?D:void 0,scheduleId:O?G:void 0}})(t),b=a.useRef(null),[g,C]=a.useState(null),l=a.useMemo((()=>({registerPanelDirtyGuard:h=>{b.current=h}})),[]),m=a.useCallback((h=>{b.current?.isDirty()===!0?C((()=>h)):h()}),[]),P=a.useCallback((()=>{m(s.closePanel)}),[m,s.closePanel]),d=a.useCallback((()=>{m(s.maximize)}),[m,s.maximize]),y=a.useCallback(((h,S,u)=>{m((()=>s.openPanel(h,S,u)))}),[m,s.openPanel]),w=a.useMemo((()=>{if(g!=null)return{onCancel:()=>C(null),onDiscard:()=>{b.current=null,C(null),g()}}}),[g]),x=a.useMemo((()=>{if(s.isOpen&&s.panelType!=null&&s.scheduleId!=null)return I.jsx(cc.Provider,{value:l,children:I.jsx(Jc,{panelType:s.panelType,scheduleId:s.scheduleId,onClose:P},`${s.panelType}:${s.scheduleId}`)})}),[s.isOpen,s.panelType,s.scheduleId,P,l]);return{injectedProps:a.useMemo((()=>({closeSchedulePanel:P,isSchedulePanelOpen:s.isOpen,openSchedulePanel:y,schedulePanelContent:x,schedulePendingDiscardConfirmation:w})),[P,y,x,w,s.isOpen]),selectedItemId:s.scheduleId,sidePanel:{closePanel:P,maximize:d}}}});function Zc({companyId:t,closeCustomerRequestDrawer:s,addCustomerRequest:b,resetCustomerRequest:g}){const C=et.getSignedInUser();if(C==null)throw Error("Can't access Customer Request page without signing in...");const l=F((m=>os(m,t,C)));return a.useEffect((()=>{g()}),[]),I.jsx(I.Fragment,{children:l.fetchState==="In-Progress"||l.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?I.jsx(jn,{fetchState:"In-Progress"}):I.jsx(ic,{onCloseClick:s,addCustomerRequest:b,snippets:l.companyMonthEndReportTemplatesData,bulletPoints:l.zeniRequestsData??[]})})}const Xc={schedules:"Review Schedules",existing_schedules:"Existing Schedules"},ei=()=>{const t=F((w=>De(w))),s=Xe(),{currentSelectedViewFetchState:b,currentSelectedView:g,selectedPeriod:C}=t,l=He(g),m=He(b.fetchState),P=t.jeSchedules.uiState.selectedPageTab??"schedules",d=He(P),y=a.useCallback((w=>{const x=s.state?.referrer;g==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?N.trackTransactionsReviewPage(C.month,C.year,t.transactionView.totalCountByTab.review,0,w,x??null):N.trackTransactionsAutoCategorisedPage(C.month,C.year,t.transactionView.totalCountByTab.autoCategorized,0,w,x??null)),g==="missing_receipts"&&N.trackMissingReceiptsPage(C.month,C.year,w,t.missingReceipts.transactions.length,x??null),g==="je_schedules"&&N.trackMonthCloseScheduleListPage(C.month,C.year,w,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(h=>{const S={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return h.forEach((u=>{if(cs(u))S.oneTimeAccrualCount+=1;else switch(is(u)){case"prepaid_expenses":S.prepaidCount+=1;break;case"fixed_assets":S.fixedAssetsCount+=1;break;case"accrued_expenses":S.accruedCount+=1}})),S})(t.jeSchedules.pendingReviewSchedules),Xc[P],x??null),g==="flux_analysis"&&N.trackFluxAnalysisPage(C.month,C.year,w,ti(t.fluxAnalysis),x??null),g==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&N.trackInsightsEmailPage(C.month,C.year,w,"draft",t.auditSummary.auditScorePercentage,null,x??null)}),[C,t,P]);return a.useEffect((()=>{(m!==b.fetchState||g!==l||g==="je_schedules"&&d!=null&&P!==d)&&b.fetchState==="Completed"&&y(!1)}),[g,b.fetchState,l,P,d]),y},ti=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:ni,comma:vn,space:ai}},dateFormat:$n}=lc.getLocalizedStrings(),En=ec,si=Ba((function(t,s){const{uncategorizedAccounts:b,vendorSearchAutoCompleteData:g,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:l,companyId:m,isMissingReceiptsBulkUploadEnabled:P,isTransactionActivityEnabled:d,newScheduleActiveType:y}=s,w=et.getSignedInUser(),x=t.tenantState.currentTenantId,h={userId:w?.userId??"",sessionId:w?.zeniSessionId??"",tenantId:x??""},S=De(t),{selectedTransactionCategorizationTab:u}=S,{searchTransactionsResults:B,searchTransactionsFetchState:E}=ps(t),p=y==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:i,classListNestedAccountHierarchy:D,allDepreciationAccountListNestedAccountHierarchy:G,newScheduleLocalData:O,saveStatus:A}=hs(t,p);return{expenseAutomationViewSelector:S,accountListNestedAccountHierarchy:i,allDepreciationAccountListNestedAccountHierarchy:G,baseTransactionSearchFetchState:E,baseTransactionSearchResults:B,classListNestedAccountHierarchy:D,newScheduleLocalData:O,initialSelectedBaseTransaction:O.selectedBaseTransactionId!=null?Ss(t.transactionState,gs(O.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Cs(t),newScheduleSaveStatus:A,bulkUploadSelector:P===!0?S.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:g,authParams:h,receiptUploadEndpoint:`${_e.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${In}/transaction_attachments`,bulkUploadEndpoint:P===!0?`${_e.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:S.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:l,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:w,uncategorizedAccounts:b,companyId:m,isTransactionActivityEnabled:d,receiptsEmail:Is(t.tenantState,x),downloadParams:{authParams:h,jeScheduleEndPoint:`${In}/jeScheduleReports`,timezone:fs(),companyName:Fe(t).companyName}}}),(function(t,s){const{themeState:b,isAccountingClassesEnabled:g,isCOTEnabled:C,isMissingReceiptsBulkUploadEnabled:l,location:m,vendorSearchAutoCompleteData:P,expenseAutomationViewSelector:d,currentTenant:y,newScheduleActiveType:w,uncategorizedAccounts:x,navigate:h,onClickCustomerRequest:S,handleEditClick:u,openSchedulePanel:B,setActivityLogTransactionId:E}=s,{selectedPeriod:p,currentSelectedView:i,reconciliation:{selectedAccountId:D}}=d,{accountSettingsView:G}=d.jeSchedules,O=Fn(p),A=Qe(O.start),M=Qe(O.end);return{onZeniLogoClick:()=>{b.toggle()},onUploadReceiptAttachment:e=>{N.trackMissingReceiptAttached(p.month,p.year),t(Ao(e))},onUploadTransactionReceipt:(e,n,c,r,f,k)=>{t(mn(e,n,{fetchState:"In-Progress"}));const R=()=>t(mn(e,n,{fetchState:"Error"}));uc(`${_e.accountMicroServiceBaseUrl}/1.0/transactions/${n}/attachments`,k,n,c,r,f).then((j=>{j!=null?t(Eo(e,j)):R()})).catch(R)},onMissingReceiptsRowClick:(e,n)=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,n);const c=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,n)=>{t(vo(e,n)),y!=null&&t(Re({tenantId:y.tenantId,period:n,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,n,c,r)=>{t(yo(e,{fetchState:n,error:c})),c!=null&&t(Ct({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:r!=null?ai+ni+r+vn:vn}]}))},onUpdateJESchedulesUIState:e=>{e.createdGroupCollapsed!=null?t(Io()):e.pendingGroupCollapsed!=null?t(ko()):e.selectedJETypeFilter!==void 0?t(bo(e.selectedJETypeFilter)):t(To(e))},onUpdateMissingReceiptsUIState:e=>{t(fo(e))},onFetchMissingReceiptsList:()=>{M!=null&&A!=null&&t(Un({start:A,end:M},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...l===!0?{onBulkUploadFiles:e=>{t(Xo(e))},onBulkUploadProgress:e=>{t(Zo(e))},onBulkUploadSuccess:e=>{t(Qo({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Ko(e))},onConfirmBulkUploadMatch:(e,n,c,r,f)=>{t(Ho(e,n,c,r,f))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Wo())},onSetBulkUploadResultsTab:e=>{t(Yo(e))},onSetBulkUploadCompletedSubTab:e=>{t(Jo(e))},onSetBulkUploadSortConfig:(e,n)=>{t(gn({sortKey:e,sortOrder:n}))},onClearBulkUpload:()=>{t(No())},onSearchTransactionsForManualMatch:(e,n)=>{t(En(e,n??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=d.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(En(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,n)=>{t(qo(e,n))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(Go())},onFetchBulkUploadBatches:e=>{t(Vn(e))},onFetchMoreBatchDetails:()=>{t($o())},onResetBulkUploadSort:()=>{t(gn({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(Co())},onSearchTextChanged:e=>{const n=d.currentSelectedView,c=d.selectedTransactionCategorizationTab;n==="transaction_categorization"&&(t(mt({selectedTab:c,uiState:{searchString:e}})),M!=null&&A!=null&&t(he(c,{start:A,end:M},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const n=d.selectedTransactionCategorizationTab;t(go({filters:e,selectedTab:n}))},onRefresh:()=>{s.trackExpenseAutomationTabAnalytics(!0),t(So())},onClose:()=>{i==="reconciliation"&&D!=null&&t(un({selectedAccountId:void 0})),h("../")},onBack:()=>{i==="reconciliation"&&D!=null&&t(un({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(ho(e))},onSaveReconciliationReview:e=>{t(po(e))},onUpdateStep:e=>{const{selectedPeriod:n}=d,c=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../${e}/${n.month}-${n.year}`,{state:{pathnameStackToGoBack:c,referrer:d.currentSelectedView}}),t(Bn(e))},handleLogOutClick:()=>{const e=ee(m.state?.pathnameStackToGoBack,m.pathname);h("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:n}=e,{prepaidExpensesAccount:c,fixedAssetsAccount:r,accruedExpensesAccount:f}=n,k=pt(G.prepaidExpensesAccountList,c.selectedOptions),R=pt(G.fixedAssetsAccountList,r.selectedOptions),j=pt(G.accruedExpensesAccountList,f.selectedOptions),q={selectedPrepaidExpensesAccountIds:k.map((J=>J.accountId)),selectedFixedAssetsAccountIds:R.map((J=>J.accountId)),selectedAccruedExpensesAccountIds:j.map((J=>J.accountId))};t(mo({data:q}))},onSaveJeAccountSettingsClick:()=>{t(uo())},onJESchedulesFormDataChange(e,n){const{jeScheduleID:c,accumulatedDepreciationCategory:r,scheduleClass:f,scheduleExpenseCategory:k,vendor:R}=n,{allAccountList:j,allClassList:q,allDepreciationAccountList:J}=d.jeSchedules,ae=P.entityAutoCompleteView.vendor.length>0?P.entityAutoCompleteView.vendor.find((W=>W.id===R?.selectedOption)):void 0,se={id:ae?.zeniId??R?.selectedOption??"",name:ae?.name??R?.defaultOptions.find((W=>W.value===R?.selectedOption))?.label??"",logo:ae?.logo},_=k?.selectedOption!=null?j.find((W=>W.qboId===k.selectedOption)):void 0,ye=f?.selectedOption!=null?q.find((W=>W.classId===f.selectedOption)):void 0,ue=r?.selectedOption!=null?J.find((W=>W.qboId===r.selectedOption)):void 0;t(ro({scheduledJournalEntryID:e,localData:{jeScheduleID:c,scheduledJournalEntryID:e,updatedCategoryId:_?.accountId,updatedClassId:ye?.classId,updatedAccumulatedDepreciationCategoryID:ue?.accountId,updatedVendor:{id:se.id,name:se.name}}}))},onRevertJeSchedule(e,n,c,r,f){t(lo(e,n,c,r,f))},ignoreRecommendedJeSchedule(e,n,c,r){t(io(e,n,c,r))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(e,n)=>{e.trim().length>=2?t(on({searchString:e,entityType:n,searchOrigin:"common"})):e.trim().length===0&&t(Ne("common"))},onCancelAutoComplete:()=>{t(Ne("common"))}},onPostJESchedule(e,n){t(co({scheduledJournalEntryID:e,jeScheduleTransactionKey:n}))},clearJeScheduleLocalData(){t(oo())},onViewTransaction(e){if(s.tenantEmailDomain==null)return;const n=Mc(e,s.tenantEmailDomain),c=ee(s.location.state?.pathnameStackToGoBack,`${s.location.pathname}${s.location.search}`);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(so({query:e,scheduleType:w==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,n){const c=kt(e)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets";t(dn({scheduleType:c,localData:n}))},onSaveSchedule(e,n){const c=e==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{allAccountList:r,allDepreciationAccountList:f}=d.jeSchedules,k=n.selectedAccount!=null?r.find((j=>j.qboId===n.selectedAccount)):void 0,R=n.selectedAccumulatedDepreciationCategory!=null?f.find((j=>j.qboId===n.selectedAccumulatedDepreciationCategory)):void 0;t(dn({scheduleType:c,localData:{...n,selectedAccount:k?.accountId,selectedAccumulatedDepreciationCategory:R?.accountId}})),t(ao({scheduleType:c}))},onCreateAccruedSchedule(e){const n="accrued_expenses";t(Zs()),t(Xs()),t(eo({scheduleType:n,localData:e,selectedJeScheduleDetailId:void 0})),t(to({scheduleType:n})),t(no(n,void 0))},onCreateOneTimeAccrual(e){t(Qs(e))},handleJeScheduleClick:(e,n,c)=>{if((function(f,k){return k!=="accrued_expenses"})(0,c)&&t(_n({selectedJEScheduleKey:n})),B!=null&&zn(c))return void B(e,c,n);const r=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../../vendors/schedules/${c}/details/${e}`,{state:{pathnameStackToGoBack:r,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,n,c,r)=>{t(n!=="revert"?Ks(e,c,r):Hs(e,c,r))},onOneTimeAccrualClick:e=>{if(B!=null)return void B(e,"one_time_accrual");const n=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{y!=null&&t(Ws(e,y.companyId,y.tenantId))},onClickCustomerRequest:S,setActivityLogTransactionId:E,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Ys())},onOpenFileAttachmentSnackBar:()=>{t(Ct({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Js(e))},onUpdateFileAttachment:e=>{t(Ns({files:e}))},previewMonthEndReport:(e,n,c,r,f)=>{y!=null&&t(rn(e,y.companyId,n,!0,c,r,{agentInsightEdits:f,tenantId:y.tenantId}))},saveMonthEndReport:(e,n,c,r,f)=>{y!=null&&t(rn(e,y.companyId,n,!1,c,r,{agentInsightEdits:f,tenantId:y.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const n=m.state?.referrer,{selectedPeriod:c,auditSummary:r}=d;y!=null&&r?.auditScorePercentage!=null&&(t(Gs(y.companyId,e,y.tenantId)),N.trackInsightsEmailPage(c.month,c.year,!1,"draft",r.auditScorePercentage,qs().format($n.analytics.MMMDDCommaYYYYformat),n??null))},onTransactionCategorizationRowClick:(e,n)=>{const c=d.transactionView.uiState.searchString??"",r=d.transactionView.transactions,f=r.findIndex((j=>j.id===e)),k=c.length>0?{resultPosition:f>=0?f+1:void 0,resultsCount:r.length,searchTerm:c}:void 0;if(s.openTransactionPanel)return void s.openTransactionPanel(e,n,k);const R=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:R,message:"expenseAutomation",origin:"transaction_categorization",searchContext:k}})},setLocalDataForCategoryAndClass:(e,n,c,r,f,k,R,j,q,J,ae,se)=>{t($s(e,n,c,r,x,f,k,R,j,q,J,ae,se))},onCancelAutoComplete:()=>{t(Ne("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(cn({scrollPosition:e}))},onUpdateTab:e=>{s.closeSidePanel?.(),M!=null&&A!=null&&(t(he(e,{start:A,end:M},!1,!1)),t(zs(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{s.closeSidePanel?.(),M!=null&&A!=null&&(t(Ls(e)),t(he("autoCategorized",{start:A,end:M},!1,!1)))},onTransactionGroupChange:e=>{s.closeSidePanel?.(),M!=null&&A!=null&&(t(js(e)),t(he(s.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:A,end:M},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,n)=>{t(mt({selectedTab:e,uiState:n})),M!=null&&A!=null&&t(he(e,{start:A,end:M},!1,!1,n.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,n)=>{t(mt({selectedTab:e,uiState:n}))},onFetchTransactionCategorizationList:(e,n,c,r,f,k)=>{M!=null&&A!=null&&t(he(e,{start:A,end:M},!0,c,n,r,f,k))},resetTransactionCategorizationLocalData:(e,n,c,r,f,k,R)=>{t(Ms(e,n,c,r,R??null,f,k,!1)),Ac(t,n.map(String))},updateSelectedVendorForTransaction:(e,n,c,r,f)=>{t(ln({selectedTab:e,transactionId:n,lineId:c,selectedTransaction:r,uncategorizedAccounts:x,updatedVendor:f,isAccountingClassesEnabled:g}))},onSaveUpdateTransactionCategorization:(e,n,c)=>{const r=m.state?.referrer;e==="autoCategorized"?N.trackTransactionsAutoCategorisedPage(p.month,p.year,d.transactionView.totalCountByTab.autoCategorized,n.length,!1,r??null):N.trackTransactionsReviewPage(p.month,p.year,d.transactionView.totalCountByTab.review,n.length,!1,r??null),t(Os(e,n,c)),Ec(n.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,n)=>{t(Vs({selectedTab:e,transactionIds:n}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,n,c,r,f,k)=>{const{transactionId:R,transaction:j,lineIds:q}=n;k!=null&&t(Bs({transactionId:R,customerUpdates:k})),t(Us({selectedTab:r,transactionId:R.id,lineId:q[0],selectedTransaction:j,uncategorizedAccounts:x,updatedCustomer:k,selectedEntity:f,isAccountingClassesEnabled:g})),f!=null&&t(It({entity:f,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:r,isFetchCOT:C}))},onFetchRecommendationsForEntityCategorization:(e,n,c,r,f,k)=>{const{transactionId:R,transaction:j,lineIds:q}=n;k!=null&&(t(Ds({transactionId:R,vendorUpdates:{name:k.name,id:k.id?k.id:void 0}})),t(_s({vendorId:k.id?k.id:void 0,localData:{vendorName:k.name,vendorId:k.id?k.id:void 0}}))),k?.id?(t(ln({selectedTab:r,transactionId:R.id,lineId:q[0],selectedTransaction:j,uncategorizedAccounts:x,updatedVendor:k,selectedEntity:f,isAccountingClassesEnabled:g})),f!=null&&t(It({entity:f,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:r,isFetchCOT:C}))):t(Fs({selectedTab:r,transactionId:R.id,lineId:q[0]}))},fetchFluxViewOnScroll:(e,n)=>{t(We(e,!0,!1,n,!1,!0))},onFetchFluxViewList:()=>{t(We(p,!0,!1,null,!1,!1))},markAsReview:(e,n,c,r)=>{N.trackFluxAnalysisReviewed(c.month,c.year,r??!1,e),t(Rs(n,e,c,r??!1))},onUpdateFluxAnalysisUIState:e=>{t(ws(e))},updateOperatingExpensesIdsForReview:e=>{t(xs({operatingExpenseIds:e,selectedPeriod:p}))},redirectToVendorDetailPage:e=>{if(s.tenantEmailDomain!=null){const n=Oc(e.id,e.qboId,s.tenantEmailDomain),c=ee(s.location.state?.pathnameStackToGoBack,s.location.pathname);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(Ps({sectionId:e,selectedPeriod:p}))},onFetchReimbursementView:(e,n,c)=>{t(We(e,!0,!1,n,!0,c))},onReviewClicked:e=>{t(de(p,e))},setOpenDrawerClicked:e=>{t(Ke({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,n)=>{t(wn("expense_automation_reconcile",e,n))},onEstablishConnectionClick:(e,n)=>{const c=y?.companyId;c!=null&&(t(Rn(e,c,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",n)),t(Dn({accountId:n,connectionInProgress:!0})))},onAddStatementClick:e=>{t(Ke({selectedDrawerAccountId:e})),t(Je({accountId:e,selectedPeriod:p,localData:{accountSource:"bank_statement"}})),t(Ye({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(de(p,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(As({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,n)=>{t(Es({sortKey:e,sortOrder:n}))},onReconReviewTabColumnSortConfigChanged:(e,n)=>{t(vs({sortKey:e,sortOrder:n}))},onReconTabUpdate:e=>{s.closeSidePanel?.(),t(ys({selectedTab:e}))},updateReconReviewTabLocalData:(e,n,c)=>{const r=e.vendor?.id;c&&r!=null&&t(bs(r)),t(Ts({data:e,transactionId:n}))},onReconMatchedTransactionClick:e=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,ft("bill"));const n=ee(m.state?.pathnameStackToGoBack,m.pathname);h(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{h(-1)},onReconListPageScroll:e=>{t(cn({scrollPosition:e}))},onVendorAutoCompleteInputChange:e=>{e.trim().length>=2?t(on({searchString:e,searchOrigin:"common"})):e.trim().length===0&&t(Ne("common"))},onReconNodeCollapseToggled:(e,n)=>{t(ks({nodeId:e,collapsed:n}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(Pn({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(xn({accountId:e}))}}}),((t,s,b)=>{const{isMissingReceiptsBulkUploadEnabled:g,...C}=b;return(function(l,m,P){return{...l,...m,...P,onUploadTransactionReceipt:(d,y,w,x,h)=>{m.onUploadTransactionReceipt(d,y,w,x,h,l.authParams)}}})(t,s,C)}))(rc(dc)),ht="newScheduleMode",St="newScheduleType",oi=Qc(zc((function(t){const s=t.displayName??t.name??"Component",b=An.memo(t),g=C=>{const l=Se(),m=(function(){const p=Se(),i=F((D=>De(D).reconciliation.selectedDrawerAccountId));return{isOpen:i!=null,selectedAccountId:i,openPanel:a.useCallback((D=>{p(Ke({selectedDrawerAccountId:D}))}),[p]),closePanel:a.useCallback((()=>{p(Ke({selectedDrawerAccountId:void 0}))}),[p])}})(),P=F((p=>De(p).reconciliation)),d=F((p=>Fe(p))),y=a.useCallback(((p,i)=>{l(wn("expense_automation_reconcile",p,i))}),[l]),w=a.useCallback(((p,i)=>{const D=d?.companyId;D!=null&&(l(Rn(p,D,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",i)),l(Dn({accountId:i,connectionInProgress:!0})))}),[l,d?.companyId]),x=a.useMemo((()=>{if(m.isOpen&&m.selectedAccountId!=null)return I.jsx(Nc,{reconciliation:P,selectedDrawerAccountId:m.selectedAccountId,onClose:m.closePanel,onFetchLinkTokenClick:y,onEstablishConnectionClick:w})}),[m.isOpen,m.selectedAccountId,m.closePanel,P,y,w]),h=a.useMemo((()=>({reconPanelContent:x,reconSidePanelIsOpen:m.isOpen,closeReconSidePanel:m.closePanel})),[x,m.isOpen,m.closePanel]),{useFeatureGate:S}=Ze(),{isFeatureEnabled:u}=S(Q.isReconV3Enabled),B=a.useContext(fn),E=a.useMemo((()=>m.isOpen?u===!0?{selectedItemId:m.selectedAccountId}:{closePanel:m.closePanel,selectedItemId:m.selectedAccountId}:B),[m.isOpen,m.closePanel,m.selectedAccountId,B,u]);return I.jsx(fn.Provider,{value:E,children:I.jsx(b,{...C,...h})})};return g.displayName=`withReconSidePanel(${s})`,g})((({closeSidePanel:t,openTransactionPanel:s,panelContent:b,sidePanelIsFullView:g,sidePanelIsOpen:C,reconPanelContent:l,reconSidePanelIsOpen:m,closeReconSidePanel:P,isSchedulePanelOpen:d,openSchedulePanel:y,schedulePanelContent:w,schedulePendingDiscardConfirmation:x})=>{const{isAiCfoOpen:h,setIsAiCfoOpen:S}=mc(),u=pc(),{isOpen:B}=hc(),E=bt(),p=Xe(),i=Se(),{isAiCfoAccessEnabled:D,onAskAiCfoClick:G}=Ln({mobileExploreReferrer:"Transaction categorization"}),O=a.useCallback((()=>{C===!0&&g!==!0&&t?.()}),[t,C,g]),{areTenantIdsInSync:A}=On(),M=ei(),e=Sc(),[n,c]=a.useState(!1),[r,f]=Ua(),k=a.useCallback((o=>{f((v=>{const $=new URLSearchParams(v);return o==null?($.delete(ht),$.delete(St),$):($.set(ht,o.scheduleDetailsMode),$.set(St,o.scheduleType),$)}),{replace:!0})}),[f]),[R,j]=a.useState(void 0),q=a.useCallback(((o,v,$)=>{const z=kt(o);j(z),k({scheduleDetailsMode:v,scheduleType:o}),i(pn({scheduleType:z==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:$}))}),[i,k]),J=a.useMemo((()=>{const o=r.get(ht),v=r.get(St);return o!=null&&v!=null?{scheduleDetailsMode:o,scheduleType:v}:void 0}),[r]),ae=a.useCallback((o=>{k(o),o!=null&&i(pn({scheduleType:kt(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[i,k]),se=F((o=>sn(o))),_=F((o=>Fe(o))),[ye,ue]=a.useState(!1),[W,ge]=a.useState(!1),[Be,Ue]=a.useState([]),[H,oe]=a.useState(null),Z=a.useCallback((()=>{oe(null)}),[]),Ve=H?.contentType==="activity"?H.detail.transactionId:void 0,Ce=a.useCallback((o=>{o!=null?(h&&S(!1),u(),O(),oe({contentType:"activity",detail:{transactionId:o}})):oe((v=>v?.contentType==="activity"?null:v))}),[O,h,u,S]),T=a.useCallback((o=>{h&&S(!1),u(),O(),oe({contentType:"transfer",detail:o})}),[O,h,u,S]),K=a.useCallback((()=>{u(),Z(),O(),G()}),[O,Z,G,u]),te=a.useRef(h);a.useEffect((()=>{h===!0&&te.current===!1&&(u(),Z(),O()),te.current=h}),[O,Z,h,u]);const fe=a.useRef(B);a.useEffect((()=>{B===!0&&fe.current===!1&&(h&&S(!1),Z(),C===!0&&g!==!0&&t?.()),fe.current=B}),[Z,t,B,h,S,g,C]);const ce=C===!0&&g!==!0,Tt=a.useRef(ce);a.useEffect((()=>{ce&&!Tt.current&&(h&&S(!1),u(),Z()),Tt.current=ce}),[Z,h,ce,u,S]);const[yt,Gn]=a.useState(!1),vt=a.useRef(!1),{selectedTab:Et}=gt(),{tenantEmailDomain:tt}=gt(),[nt,At]=a.useState(p.state?.message==="comingFromTransactionDetail"),Pt=p.state?.message==="comingFromOverview",qn=gc(),at=et.getSignedInUser(),{useFeatureGate:ie}=Ze(),{isFeatureEnabled:xt}=ie(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:ve}=ie(Q.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:st}=ie(Q.isTransactionActivityEnabled),{isFeatureEnabled:Nn}=ie(Q.isAccrualEnabled),{isFeatureEnabled:wt}=ie(Q.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:Jn}=ie(Q.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:Yn}=ie(Q.isProjectsTransactionsEnabled),{isFeatureEnabled:Wn}=ie(Q.isReconV3Enabled),Hn=a.useCallback((o=>{const v=ft(o.transactionType??(o.view==="reconciliation"?"bill":"expense")),$=ee(p.state?.pathnameStackToGoBack,p.pathname),z=new URLSearchParams({view:"full"});o.threadId!=null&&z.set("thread_id",o.threadId),o.entityType!=null&&z.set("entity_type",o.entityType),E(`/${tt}/transaction/${encodeURIComponent(v)}/${o.transactionId??o.entityId}?${z.toString()}`,{state:{pathnameStackToGoBack:$,message:"expenseAutomation"}})}),[E,tt,p.state,p.pathname]),Kn=F((o=>Po(o,"common"))),L=F((o=>De(o))),{categoryOptions:Qn,paymentAccountNames:Zn}=F((o=>xo(o.accountState))),Xn=F((o=>wo(o.classState))),{monthEndCloseChecksView:Y,currentSelectedView:U,selectedPeriod:V,selectedTransactionCategorizationTab:ot,currentSelectedViewBackgroundRefreshFetchState:ea,currentSelectedViewFetchState:le,jeSchedules:ct,reconciliation:Rt}=L;Pc(U==="transaction_categorization");const ta=L.transactionView.saveStatus.fetchState,Oe=L.transactionView.transactions,Dt=a.useRef(Oe);Dt.current=Oe;const _t=F((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Ft=F((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Bt=a.useRef(_t);Bt.current=_t;const Ut=a.useRef(Ft);Ut.current=Ft;const Me=F((o=>{const v=o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return v!=null?o.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[v]?.filters:void 0})),Vt=a.useRef("");a.useEffect((()=>{if(U!=="transaction_categorization")return;const o=L.transactionView.uiState.searchString??"";if(le.fetchState!=="Completed"||o.length===0||o===Vt.current)return;Vt.current=o;const v=Me!=null?Cc(Me):0,$=Me?.categories.filter((z=>z.values.length>0&&String(z.values[0]??"").trim()!=="")).map((z=>`${z.field}:${z.values.join(",")}`))??[];N.trackAiCloseTransactionSearch({filtersApplied:$,hasResults:Oe.length>0,isFiltered:v>0,resultsCount:Oe.length,searchTerm:o,searchType:"free_text"})}),[U,le.fetchState,L.transactionView.uiState.searchString,L.transactionView.transactions,Me]);const re=xc(ta,(()=>{const o=[],v=Ut.current,$=Bt.current,z=$!=null&&v!=null?$[v]:void 0;if(z?.transactionReviewLocalDataById!=null)for(const ke of Object.values(z.transactionReviewLocalDataById)){const X=ke?.transactionReviewLocalData?.lineItemById;if(X!=null)for(const it of Object.values(X)){const we=it?.account;we?.accountId!=null&&o.push(we.accountId)}}const Ie=Dt.current;for(const ke of Ie)for(const X of ke.lines??[])"account"in X&&X.account?.accountId!=null&&o.push(X.account.accountId);return o}));a.useEffect((()=>{U==="transaction_categorization"&&C!==!0||Ce(void 0)}),[U,Ce,C]),a.useEffect((()=>{m===!0&&P?.()}),[U,Rt.selectedAccountId]);const na=L.transactionView.selectedTransactionCategorizationCompletedSubTab,aa=L.transactionView.selectedTransactionGroup,je=`${ot}|${na}|${aa}`,Le=a.useRef(null),Ot=a.useRef(null);a.useEffect((()=>{Le.current!==null?Le.current!==je&&(Le.current=je,U==="transaction_categorization"&&Z()):Le.current=je}),[Z,U,je]);const sa=F((o=>Ve==null?void 0:Ro(o.transactionState,Ve))),me=sa?.qboId,Mt=F((o=>me==null?void 0:Do(o,me)));a.useEffect((()=>{me!=null&&i(_o(me))}),[i,me]);const{createTransferEntryStatus:jt,creditCardTransferAccountsList:Lt,transferAccounts:zt}=L.transactionView,$t=a.useCallback((o=>wc(i,o)),[i]),Gt=a.useMemo((()=>U!=="transaction_categorization"||H==null?null:H.contentType==="activity"?st===!0?I.jsx(fc,{activityLogView:Mt,qboId:me,onClose:()=>oe(null),selectedTransactionId:H.detail.transactionId,isQuickViewCardStyle:!0},String(H.detail.transactionId)):null:H.contentType==="transfer"?I.jsx(Ic,{createTransferEntryStatus:jt,creditCardTransferAccountsList:Lt,transaction:H.detail,transferAccounts:zt,onClose:()=>oe(null),onCreateTransfer:$t,isQuickViewCardStyle:!0},String(H.detail.transactionId)):null),[U,H,st,Mt,me,jt,Lt,zt,$t]),oa=Gt!=null,{selectedAccountId:Ee}=Rt,qt=He(ct.accountSettingsView.saveState.fetchState),ca=F((o=>Fo(o.accountState,o.accountListState,"accountList"))),ia=F((o=>Bo(o))),Ae=Et!=null?Uo(Et):U,la=F((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Mn({isDataReady:le.fetchState==="Completed"}),at==null)throw Error("Can't access expense automation screen without signing in...");const Nt=Fn(V),Pe=Qe(Nt.start),xe=Qe(Nt.end);if(Pe==null||xe==null)throw Error(`Invalid start - ${Pe} and end - ${xe} period from given ${V}`);const ra=a.useCallback((()=>{ue(!1)}),[]),da=a.useCallback((()=>{ge(!0)}),[]),ua=a.useCallback((o=>{Ue(o),ge(!1)}),[]),ma=a.useCallback((()=>{Ue([])}),[]),ze=L.missingReceipts.bulkUpload.phase,Jt=L.missingReceipts.bulkUpload.currentBatchId;a.useEffect((()=>{ve===!0&&U==="missing_receipts"&&ze==="matching"&&Jt!=null&&i(Vn({cacheOverride:!0}))}),[ve,U,ze,Jt,i]);const Yt=at?.userId,pa=V.month,ha=V.year,Wt=_?.tenantId;a.useEffect((()=>{U==="missing_receipts"&&ve!==!1&&ze==="idle"&&Yt!=null&&Wt!=null&&i(Vo())}),[U,ve,ze,Yt,Wt,pa,ha,i]),a.useEffect((()=>{se.newVendorState?.vendorDetailLocalData?.vendorName!=null?c(!0):c(!1)}),[se.newVendorState?.vendorDetailLocalData?.vendorName]),a.useEffect((()=>{Ae!=null&&U!==Ae&&i(Bn(Ae))}),[Ae]),a.useEffect((()=>{yt===!1&&le.fetchState==="Completed"&&A&&(Gn(!0),i(hn(!1,!1)))}),[yt,le,A]),a.useEffect((()=>{const o={month:V.month,year:V.year},v=Ot.current;Ot.current=o,v===null||v.month===o.month&&v.year===o.year||!Pt&&A&&(i(hn(!1,!1)),i(de(V,Ee,!1,!1)))}),[V.month,V.year,A]);const $e=a.useCallback(((o=!1,v=!1)=>{const $={start:Pe,end:xe};switch(U){case"transaction_categorization":i(he(ot,$,o,!nt,void 0,void 0,v)),At(!1);break;case"flux_analysis":i(We(V,o,v,null));break;case"month_end_insights":if(v===!1){const z=new Date(V.year,V.month,0),Ie=Mo(z.toDateString()).format($n.analytics.YYYYDashMMDashDDFormat);i(jo(!0,_.companyId,_.tenantId,Ie)),i(Lo(_.companyId,_.tenantId))}break;case"je_schedules":i(Oo($,v));break;case"missing_receipts":i(Un($,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,v));break;default:i(de(V,Ee,o,v))}}),[U,Pe,xe,_.companyId,_.tenantId,ot,V,Ee,nt,At]),Sa=a.useCallback((()=>{$e(!0,!0)}),[$e]);a.useEffect((()=>{U===Ae&&le.fetchState==="Not-Started"&&A&&$e(!0)}),[le,Pe,xe,_.companyId,_.tenantId,A]),a.useEffect((()=>{Pt||nt||vt.current||ea.fetchState==="In-Progress"||le.fetchState!=="Completed"||(vt.current=!0,$e(!0,!0))}),[]),a.useEffect((()=>{Y.fetchState!=="In-Progress"&&Y.fetchState!=="Completed"&&Y.fetchState!=="Error"&&_?.tenantId!=null&&i(Re({tenantId:_.tenantId,period:V,refreshViewInBackground:!1}))}),[Y.fetchState,_?.tenantId]),a.useEffect((()=>{Y.fetchState!=="Completed"||!A||(Y.monthEndCloseChecks?.monthEndCloseCheckList.some((o=>o.id==="reconciliation"))??!1)&&L.reconciliation.fetchStatus.fetchState==="Not-Started"&&i(de(V,void 0,!1,!1))}),[Y.fetchState,A,V.month,V.year,L.reconciliation.fetchStatus.fetchState,i]),a.useEffect((()=>{L.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?ue(!0):ue(!1)}),[L.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),a.useEffect((()=>{L.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&A&&(i(Re({tenantId:_.tenantId,period:V,refreshViewInBackground:!0})),i(zo({companyId:_.companyId})),E("../"))}),[L.monthEndInsights?.sendMonthEndReportStatus?.fetchState,_.tenantId,V,_.companyId,A]),a.useEffect((()=>{const o=setInterval((()=>{Y.fetchState!=="In-Progress"&&Y.fetchState==="Completed"&&i(Re({tenantId:_.tenantId,period:V,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[Y.fetchState,_.tenantId,V,i]),a.useEffect((()=>{const o=setInterval((()=>{U==="reconciliation"&&Ee==null&&L.reconciliation.fetchStatus.fetchState==="Completed"&&L.reconciliation.refreshStatus.fetchState!=="In-Progress"&&i(de(V,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[U,i,L.reconciliation.fetchStatus.fetchState,L.reconciliation.refreshStatus.fetchState,de,Ee,V]);const Ht=kn(),Kt=kc(),{onRecommendationSelection:Qt,popup:ga}=Rc({isEnabled:Ht}),Ca=a.useMemo((()=>({...Kt,onRecommendationSelection:Qt})),[Kt,Qt]);a.useEffect((()=>{const o=(Y.monthEndCloseChecks?.monthEndCloseCheckList.find((v=>v.id==="month_end_insights"))?.isDisabled??!1)&&!xt;U!=="month_end_insights"||!o&&Y.monthEndCloseChecks?.reportEmailSentDate==null||E("../")}),[U,Y.monthEndCloseChecks]);const fa=m===!0?l:b,Ia=m===!0||C===!0,ka=m===!0?P:t;a.useEffect((()=>{qt==="In-Progress"&&ct.accountSettingsView.saveState.fetchState==="Completed"&&i(Sn())}),[qt,ct.accountSettingsView.saveState.fetchState,Sn]);const{transactionId:Zt,onSaveVendor:ba,onSaveSuccess:Ta,onCancel:ya,vendorViewDetails:va}=(({expenseAutomationViewSelector:o,closeDrawerHandler:v,currentSelectedView:$})=>{const z=Se();let Ie,ke,X;const it=kn(),we=o.transactionView;let Xt=()=>{};const{transactions:Ea,selectedTransactionId:be,selectedTransactionLineId:Ge,transactionLocalData:Aa}=we;if($==="transaction_categorization"){const lt=Aa.find((pe=>pe.transactionId===be)),ne=Ea.find((pe=>pe.id===be)),en=Ge!=null?lt?.transactionReviewLocalData?.lineItemById[Ge]:void 0,tn=en?.account;ke=en?.class?.classId,Ie=["Uncategorized Income","Uncategorized Expense"].includes(tn?.accountName??"")?void 0:tn?.accountId;const xa=Vc(be,ne?.typeOfTransaction);ne!=null&&xa&&(X={id:be,type:ft(ne.typeOfTransaction)}),Xt=()=>{if(be!=null&&Ge!=null&&ne!=null){const pe=we.transactionLocalData.find((qe=>qe.transactionId===be))?.transactionReviewLocalData;if(pe!=null&&ne.lines!=null&&ne.lines.length>0){const qe=pe.lineItemById[Ge];let rt=pe.selectedEntity;if(ms(ne)||(rt=qe.selectedEntityLine),rt!=null){const wa=rt,Ra={transactionId:{id:ne.id,type:ne.type},transaction:ne,lineIds:ne.lines.map((Da=>Da.id))??[]};z(It({entity:wa,amount:qe.amount.amount,transactionDetails:Ra,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:it}))}}}}}const Pa=F((lt=>sn(lt,void 0,Ie,ke)));return{transactionId:X,onSaveVendor:()=>{z(us(X,void 0,!1,!0))},onSaveSuccess:Xt,onCancel:()=>{X!=null&&z(ls({transactionId:X})),z(rs()),z(ds()),v()},vendorViewDetails:Pa}})({expenseAutomationViewSelector:L,closeDrawerHandler:()=>{c(!1)},currentSelectedView:U});return qn?.loggedInUserRoleMap==null?Y.fetchState==="Error"?I.jsx(bc,{onGoHome:()=>E("../",{replace:!0}),onReload:()=>window.location.reload()}):I.jsx(jn,{fetchState:"In-Progress"}):I.jsxs(I.Fragment,{children:[I.jsx($c,{isOpen:W,drawerLeftMargin:new Tc(0,0,300,650),onClose:()=>{ge(!1)},children:I.jsx(ci,{onClick:o=>o.stopPropagation(),children:I.jsx(Zc,{companyId:_.companyId,closeCustomerRequestDrawer:()=>ge(!1),addCustomerRequest:ua,resetCustomerRequest:ma})})}),Zt!=null&&n&&I.jsx(Dc,{isOpen:n,transactionId:Zt,onSaveVendor:ba,onSaveSuccess:Ta,onCancel:ya,vendorViewDetails:va}),I.jsx(yc,{toolkit:Ca,children:I.jsx(si,{events:[],eventCallback:(o,v,$)=>{},navigate:E,location:p,themeState:e,categoryOptions:Qn,classesForFilters:Xn,accountsForFilters:Zn,vendorSearchAutoCompleteData:{autoCompleteText:la,entityAutoCompleteView:Kn},expenseAutomationViewSelector:L,isMissingReceiptsBulkUploadEnabled:ve,monthEndInsightsPreviewMode:ye,monthEndInsightsCustomerRequestData:Be,isRealtimeInsightsFeatureEnabled:xt,isCreateTransferEntryFromExpenseEnabled:wt,isAccountingClassesEnabled:ia,isProjectsTransactionsEnabled:Yn,isCOTEnabled:Ht,currentTenant:_,companyId:_.companyId,signedInUser:at,isTransactionActivityEnabled:st,isRightPanelOpen:oa,rightSidePanel:Gt,onOpenTransferRightPanel:wt===!0?T:void 0,uncategorizedAccounts:ca,newScheduleActiveType:R,isAccrualEnabled:Nn,newScheduleSelection:J,onNewScheduleSelectionChange:ae,onScheduleTypeChange:q,onNewScheduleSaved:Sa,onClickCustomerRequest:da,handleEditClick:ra,tenantEmailDomain:tt,trackExpenseAutomationTabAnalytics:M,setActivityLogTransactionId:Ce,closeSidePanel:ka,openTransactionPanel:s,openSchedulePanel:y,sidePanelIsOpen:Ia,sidePanelIsFullView:m!==!0&&g,panelContent:fa,isAiCfoAccessEnabled:D,onAskAiCfoClick:K,isExpenseAutomationCommentingEnabled:Jn,isReconV3Enabled:Wn,onExpenseAutomationCommentingThreadClick:Hn,sidePanelListPercent:m===!0?66:void 0,isSchedulePanelOpen:d,schedulePanelContent:w,schedulePendingDiscardConfirmation:x})}),ga,re.showPopup&&re.popupType!=null&&I.jsx(vc,{popupType:re.popupType,currencySymbol:re.currencySymbol,accountId:re.popupAccountId??"",accountName:re.popupAccountName??"",onSubmit:re.handleSubmit,onDismiss:re.handleDismiss})]})})))),ci=Te(Fa)`
|
|
35
|
+
display: flex;
|
|
36
|
+
min-height: 100%;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
`;function Bi(){return I.jsxs(Va,{children:[I.jsx(dt,{path:"*",element:I.jsx(Gc,{})}),I.jsx(dt,{path:"/:selectedTab/:selectedPeriod/*",element:I.jsx(oi,{})}),I.jsx(dt,{path:"*",element:I.jsx(_a,{})})]})}export{Bi as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-mJJR3MsR.js";import{a as r}from"./sentry-CItQHKpv.js";import{aw as i,ax as c,Y as l,a4 as p}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import m from"./NotFoundScreen-fxNT7vgC.js";import{h as u,g as b}from"./core-CMivCywN.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]="cf2ef61c-8d24-4f1a-9654-3478543a52ed",e._sentryDebugIdIdentifier="sentry-dbid-cf2ef61c-8d24-4f1a-9654-3478543a52ed")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=p(a.state?.pathnameStackToGoBack),f=n.poppedPathname??k();e(f,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=i(a.pathname);return o!=null?s.jsx(c,{menuItem:l(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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./sentry-CItQHKpv.js";import{u as l,h as f,g as m}from"./core-CMivCywN.js";import{hV as p,TP as g,TQ as _}from"./zeni-epic-state-CqKBThJ0.js";import{u as h,L as b,z as y}from"./index-DlMGj3Af.js";import"./liveblocks-mJJR3MsR.js";import"./recharts-Co0_Dmc-.js";import"./mui-C6XtNCo7.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.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]="147a1730-2875-4a6a-8a01-8fed02ae1a8e",e._sentryDebugIdIdentifier="sentry-dbid-147a1730-2875-4a6a-8a01-8fed02ae1a8e")}catch{}})();function R(){const e=l(),n=f(),o=m(),{setLoading:i,clearAllLoading:c}=h(),a=r.useRef(!1);return r.useLayoutEffect((()=>{i(b.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(a.current)return;a.current=!0;const s=new URLSearchParams(o.search).get("code"),u=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),s!=null&&u!=null){const t=JSON.parse(u);e(p(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:s,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}c();const d=y.getActiveTenantForUser();n(d?.tenantEmailDomain!=null?`/${d.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as s}from"./liveblocks-
|
|
1
|
+
import{m as s}from"./liveblocks-mJJR3MsR.js";import{j as r}from"./core-CMivCywN.js";import{fB as d}from"./zeni-epic-state-CqKBThJ0.js";import"./sentry-CItQHKpv.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]="a8de6012-72c4-4a84-96b4-0e4c3e78103c",e._sentryDebugIdIdentifier="sentry-dbid-a8de6012-72c4-4a84-96b4-0e4c3e78103c")}catch{}})();const h=()=>r((e=>d(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-mJJR3MsR.js";import{a as r}from"./sentry-CItQHKpv.js";import{u as D,h as L,i as w,j as E,t as W,l as T,s as Z,g as J,N as B,n as ie,o as x}from"./core-CMivCywN.js";import{a8 as ln,h as p,aq as F,Q as g,cb as dn,cc as un,cd as gn,ce as mn,cf as vn,cg as pn,ch as fn,ci as Sn,cj as hn,ck as Cn,cl as In,cm as En,cn as kn,co as yn,p as X,cp as xn,cq as bn,ae as se,cr as jn,cs as Pn,z as he,ct as Dn,cu as Ln,cv as An,cw as $n,cx as wn,cy as Fn,cz as Rn,cA as Tn,J as On,ai as ft,cB as _n,cC as Mn,cD as Nn,cE as Un,cF as Bn,cG as Vn,cH as Zn,cI as Hn,cJ as qn,t as Ke,g as St,cK as Kn,cL as Qn,cM as Gn,cN as zn,cO as Wn,cP as Jn,cQ as Xn}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{A as K}from"./AddressScreen-CLiV0mfm.js";import N from"./NotFoundScreen-fxNT7vgC.js";import{Z0 as Yn,Z1 as ei,uM as Qe,Z2 as Pe,Z3 as Q,vQ as Ge,vX as ti,w0 as ht,Z4 as De,Z5 as Ct,vU as It,Z6 as Le,vS as Et,yw as ni,vT as ii,Z7 as G,vd as ce,vM as oi,xn as ze,vc as Ce,Z8 as ai,Z9 as kt,w7 as si,Za as z,we as ci,Zb as ri,Zc as yt,Zd as xt,yi as li,Ze as ue,Zf as We,Zg as bt,va as di,Zh as ui,v4 as gi,Zi as mi,xA as vi,Zj as jt,xJ as Je,Zk as pi,xG as fi,Zl as Ae,gd as Si,Zm as te,Zn as ne,wt as hi,vi as Xe,Zo as $e,vn as Pt,vl as Ci,vf as Ii,wm as Ei,vp as ki,wv as yi,Zp as Ie,wC as Dt,wA as Ee,Fm as we,xP as Ye,Zq as xi,vb as Fe,Zr as Re,vy as ke,vv as ye,vI as Lt,vH as Te,vs as bi,vB as At,vK as oe,fB as Oe,UP as $t,ve as _e,vF as ji,vG as Pi,vE as Di,Zs as Li,wa as et,wf as Ai,wb as wt,Zt as Ft,u_ as tt,Zu as $i,uW as Rt,Zv as wi,xV as Fi,xZ as H,xU as Ri,x1 as Me,Zw as Ti,Zx as Tt,y6 as nt,Zy as Oi,y3 as _i,Zz as Ot,x4 as Mi,x5 as V,x8 as Ni,ZA as _t,xi as ve,ZB as Ui,wu as Mt,Tm as Nt,ZC as Bi,xs as Vi,ZD as Ut,ZE as Zi,ZF as Hi,ZG as qi,yX as Ki,ZH as Qi,ZI as Bt,yd as Vt,ZJ as Zt,yV as pe,ZK as Gi,yS as zi,ZL as Wi,ZM as Ji,ZN as Xi,ZO as Yi,ZP as eo,ZQ as it,ZR as to,y$ as no,ZS as Ne,wM as ot,ZT as Ue,ZU as re,wW as Ht,wR as qt,wP as xe,ZV as io,wH as oo,yj as Kt,yK as at,yF as ao,ZW as so,yk as co,ZX as ro,yL as lo,yP as uo,ZY as go,ZZ as Qt,c7 as mo,mo as vo,mp as po,Z_ as st,vR as le,gh as fo,uc as So,mv as ho,yC as Gt,zb as Co,yz as zt,ui as Io,z8 as ct,u6 as Eo,z5 as rt,hP as ko,TP as lt,TQ as yo,Fy as Wt,hH as xo,Z$ as bo,UE as jo,_0 as Po,zh as fe,zi as Do,_1 as Lo,_2 as Jt,ze as Ao,_3 as $o,_4 as wo,xw as Fo,_5 as Ro}from"./zeni-epic-state-CqKBThJ0.js";import{M as To}from"./MobileAppDrawer-CcN5sT0f.js";import{q as de}from"./QBOConnectionScreen-IBpF64YF.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";import"./empty-CllNfDt1.js";import"./pdf-lib-BbzL8H1t.js";import"./index-baDCTZK3.js";import"./url-xQ9KNY2e.js";import"./index-Cx55eHdr.js";import"./decodeURIComponentSafe-DRefzrWS.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]="da07a9df-1793-41aa-a98c-11457decd261",n._sentryDebugIdIdentifier="sentry-dbid-da07a9df-1793-41aa-a98c-11457decd261")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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:m,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Yn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,C=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(Qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const P=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:P,isLoadingMore:h,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{S&&I!=null&&n(Qe({cursor:I,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Xt=[],Mo=Ct((n=>n.length>0?n:Xt),mn),No=Ct((n=>n.length>0?n:Xt),gn),Uo=T((function(n,e){const{view:t}=e;return{groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(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!==""?o=>{i!==""&&n(It({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&n(De({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&n(ti({action:a,id:o,parentItemId:i}))}}}))(un);function Bo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>Pe(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(Q()),()=>{n(Q())})),[n]),r.useEffect((()=>{a&&n(Ge({id:t,kind:c}))}),[a,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(Q()),n(Ge({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed",[I,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=I!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Be(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=n,a=D(),{areTenantIdsInSync:c}=F(),d=E(Le),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(Et()),t&&a(ni()))}),[c,a,e,t,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Ve(n,e=!1){const t=D(),i=E((c=>G(c).productNextCursor!=null)),o=E((c=>G(c).productNextCursor)),a=E((c=>G(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&a!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&a!=="In-Progress"&&i&&o!=null&&t(ce({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=T((function(n,e){const t=Pe(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,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",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:o}=e,a=o!=null?`${t}/catalog/${encodeURIComponent(o)}`:`${t}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(Q()),e.navigate(`${t}/catalog`)},onChange:c=>{n(De({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:o}))}}}))(vn);function qo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=t!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>Pe(S,t)));return Ve(a,!0),Be({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&t!=null&&n(oi({id:t,kind:v}))}),[a,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(De({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(Q())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=T((function(n,e){const t=G(n),i=e.activeTab==="plans",o=e.activeTab==="all",a=i?t.plans:o?[...t.plans,...t.products]:t.products,c=i||o&&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:o&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",a=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(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(It({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&n(Ce({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})));a!=null&&n(i?Ce({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function Go(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>G(O))),k=y.planFilters.search,b=y.planSort,C=y.planNextCursor,P=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(ze({cacheOverride:!1,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[i,n,I,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(ze({cacheOverride:!0,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,I,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Qo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:o,sortState:u,planFilters:I,productFilters:j,sort:S,planNextCursor:C,productNextCursor:P,runningCatalogItemActionId:_,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const zo=T((function(n,e){const t=kt(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,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(z()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),n(ci({id:i}))}}}))(fn);function Wo(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{o&&t!=null&&n(si({id:t}))}),[o,t,n]),r.useEffect((()=>{if(a==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(z())}}),[a,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCouponFormPage}),s.jsx(zo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Jo=T((function(n){const e=yt(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(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:o=>{e(bt(o))},onSubmit:()=>{const o=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(hn);function Xo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),[i]=W(),{areTenantIdsInSync:o}=F(),a=i.get("customerId"),c=E((C=>yt(C))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((C=>li(C))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||I,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||a==null||a===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:a})))}),[a,l,n]),r.useEffect((()=>{o&&n(di({cacheOverride:!1}))}),[o,n]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const P=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(P)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Jo,{navigate:e,tenantEmailDomain:t})]})}const Yo=T((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(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(Cn);function ea(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>mi(d,t??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&t!=null&&n(vi({id:t}))}),[o,t,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Yo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:a})]})}const ta=T((function(n){const e=jt(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(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function na(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const C=jt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Je({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Je({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Yt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((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:o=>{n(Ie({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const o=Yt(e.tenantEmailDomain??"",Ee,i),a=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ie({id:i,localData:o})),n(Dt({id:i}))},onFetchPaymentLinkEmailPreview:o=>n(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>n(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)}}}))(yn);function oa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((M=>Ae(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,I]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&I(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:P}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.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&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{a&&i!=null&&n(hi({id:i}))}),[a,i,n]),r.useEffect((()=>{a&&i!=null&&P&&n(Xe({customerId:i}))}),[a,i,n,P]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n($e()),i!=null&&n(Pt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{n(te()),i!=null&&P&&n(Xe({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:P,onChooseCard:()=>{i!=null&&n(Ii({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ci({customerId:i,data:M}))}}),s.jsx(kn,{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:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=Ae(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",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),n($e()),n(we(Ee)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ie({id:i,localData:c}))},onOpenAddress:()=>{const c=Yt(e.tenantEmailDomain??"",Ee,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),n(Dt({id:i}))}}}))(xn);function sa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&n(Pt({id:i}))}),[a,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),n($e())}}),[c,d,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:o})]})}const ca=T((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(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,o)=>{switch(o){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(Fe({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,customerListFetchState:y}=E((b=>{const C=ue(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Ye({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const be=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:t,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:be(o,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=be(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&n(ye({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&n(Te(a))},onRollback:S?()=>{a!=null&&n(Lt(a))}:void 0}}))(jn);function da(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),[a,c]=r.useState({}),d=E(Re),l=be(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{o&&t!=null&&n(ke(t))}),[o,n,t]),r.useEffect((()=>{if(!o||t==null)return;const f=setTimeout((()=>{n(ye({...a,sessionId:t}))}),300);return()=>clearTimeout(f)}),[o,n,a,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||t==null||!u)return;const f=setInterval((()=>{n(ke(t)),n(ye({...a,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[o,n,a,u,t]);const m=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const I=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${I===""?"":`?${I}`}`}),[a,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const en=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=en(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},ua=T((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:a}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,o=a=>{const c=a??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),n(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),n(Lt(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),t(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Pn);function ga(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(Re);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:o})]})}const ma=T((function(n,e){const{activeId:t,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=se?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),n(Di())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{t!=null&&n(Te(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Pi(t))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:a}))},onViewDetails:t==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Dn);function va(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(xt),a=E(Oe).companyId??he.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,a))),d=E(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(_e()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(I=>{if(I==null||I==="")return null;try{return sessionStorage.getItem(en(I))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ke(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,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:o=>{n(wt({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:o,id:i}))}}}))(Ln);function fa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((I=>Li(I,t))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const m=v===t;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(et({id:t}))}),[o,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(n(z()),n(et({cacheOverride:!0,id:t})),f((I=>I+1)))}),[a.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(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(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,o)=>{n(wt({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function ha(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((C=>{const P=Ft(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,couponListFetchState:P.fetchState,runningDiscountActionId:P.runningActionId??null}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:a,onStatusChange:C=>n($i(C)),onSortChange:v})]})}const Ca=T((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,o=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>n(H({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ia(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((h=>wi(h,t??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[I,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=a.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,a.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:h,id:t})))}),[t,n,l]),C=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&t!=null&&n(Ri({id:t}))}),[o,t,n]),r.useEffect((()=>{o&&d!=null&&n(Me({invoiceId:d}))}),[o,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{I&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,I]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,a.actionState.fetchState]);const P=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:a,dunningAttempts:P,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:I,preview:C,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(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(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||n(H({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const C=Tt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((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:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
|
|
2
|
+
`).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))}}}))(Rn);function xa(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((m=>Ot(m,t??""))),c=a.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((()=>{o&&t!=null&&n(Mi({invoiceId:t}))}),[o,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:a})]})}const ba=T((function(n){const e=_t(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(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){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,o)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function ja(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((C=>{const P=_t(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:P.nextCursor,invoiceListFetchState:P.fetchState,voidingInvoiceId:P.runningActionId}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(ve({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:a,onStatusChange:C=>{n(Ui(C)),n(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=On(),o=ft(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Pa=T((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,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:o,reasonCodeOptions:a,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:o=>{n(Qi({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Ki())}}}))(Mn);function Da(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Zi()),m.current=null}),[n,t]),r.useEffect((()=>{o&&t!=null&&n(Me({invoiceId:t}))}),[o,n,t]),r.useEffect((()=>{c!=null&&t!=null&&a==="Completed"&&m.current!==t&&(m.current=t,n(Hi({localData:qi(c)})))}),[n,a,c,t]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Pa,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(o))}),[i,n,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(La,{navigate:e,selectedPeriod:o,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Zt(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(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.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}))}}}))(Un);function wa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Zt(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),Z),b=y==="Completed",C=`/${t}/invoicing`,P=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(R)}`))}),[e,C,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(O)}`))}),[e,C,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:_=>{n(Gi(_)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:P})]})}const Fa=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},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=t!=null&&t!=="",c=E(ue),d=E((h=>Wi(h))),l=E(Ji),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Xi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{o&&n(a&&t!=null?Me({invoiceId:t}):Fe({filters:{},keepExistingListItems:!1}))}),[o,n,t,a]),r.useEffect((()=>{a&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Yi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,a]),r.useEffect((()=>{if(a)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,a]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const h=I.current;if(I.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!a||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),C=a?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,P=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:P}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(C)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(a?t??void 0:void 0))}})]})}const tn=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:t.coupons.map(Oa),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(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",xe,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Ht({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Ma(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((k=>Ne(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=S===i;Ve(a),r.useEffect((()=>{a&&i!=null&&n(ot({id:i}))}),[a,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Ue()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},j)]})}const Na=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},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},je=(n,e,t)=>{const i=[n,Ua(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),Se=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:je(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Za=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=T((function(n,e){const t=Ne(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Za),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(Se).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Ue()),n(we(xe)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{n(re({id:i,localData:a}))},onOpenAddress:()=>{const a=tn(e.tenantEmailDomain??"",xe,i),c=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),n(Ht({id:i}))}}}))(Zn);function qa(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),[a]=W(),{areTenantIdsInSync:c}=F(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ne(S,i).localData));Ve(c),r.useEffect((()=>{c&&(n(Fe({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),n(Ue())}}),[l,v,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ka=T((function(n){const e=Kt(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=(o,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),n(qt({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Hn);function Qa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((P=>{const h=Kt(P);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),Z),b=y==="Completed";r.useEffect((()=>{const P=setTimeout((()=>d(o)),300);return()=>clearTimeout(P)}),[o]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]);const C=r.useRef(k);return r.useEffect((()=>{const P=C.current!=null&&k==null;C.current=k,P&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:a,onStatusChange:P=>n(so(P)),onSortChange:v})]})}const Ga=T((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:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&n(lo({id:i}))}),[o,i,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:a})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function Y(n){const e=D(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I}=E(Qt),j=E(Le);Be({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(Oe),k=n==="dunning"||n==="quickbooks",b=y.companyId??he.getSignedInUserTenant(i??"")?.companyId,C=E((A=>$t(A,b))),P=mo(y.userRole??[]),h=y.tenantId??"",_=he.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),Ze=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(o!=="Not-Started"&&o!=="Error"||e(_e()))}),[t,e,o]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ke.shouldFetchActiveTenant(h)&&(Ke.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=o==="Not-Started"||o==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=o==="Completed"&&(!k||u==="Completed"),He=C.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,ge=se?.invoicingMicroServiceBaseUrl,qe=ge!=null&&ge.length>0?`${ge}/1.0/webhooks/stripe`:"",me={deleteConnectionError:C.externalConnections?.deleteConnectionError?.message,deleteConnectionState:C.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:C,isAdmin:P,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{C.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(A,q)=>{He!=null&&h!==""&&e(ko(h,He,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:C.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:C.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:me,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Io(A,q)),onReconnectQBO:me.onReconnectQBO,onRefreshQBO:me.onRefreshQBO,onRetryQboSyncTask:A=>e(zt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Co({settings:A,snackbarSection:Wa[n??""]}))},onStartQboBackfill:A=>e(Gt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=J(),i=D(),{tenantEmailDomain:o}=w(),a=Y("branding"),c=E((v=>bo(v))),d=E((v=>jo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Po()),i(we(fe)))}),[c.saveState.fetchState,i]);const l=St(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:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Kn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Lo({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${fe}/`,u=X(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Do()),updateFilesEntity:a.updateFilesEntity})]})}function Ja(){const n=L(),e=Y("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Xa(){const n=L(),e=Y("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Ya(){const n=L(),e=Y("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{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 es=T((function(n){const e=Jt(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(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(zt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(Gt(e))}}}))(Wn);function ts(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=E(Oe),{configFetchState:o,settingsFetchState:a}=E(Jt);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||n(_e())}),[n,a]),r.useEffect((()=>{o==="Not-Started"&&n(le())}),[o,n]),Be({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=D(),t=L(),[i,o]=W(),a=Y(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];o({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Jn,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:n("invoicing_settings"),settings:a.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Ya,{})}),s.jsx(x,{path:"branding",element:s.jsx(vt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(vt,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Xa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ja,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:o,fetchState:a,status:c}=E(Nt),d=St(o.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Le(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,a]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),n(Ro()))}),[d,o.fetchState,l,n,e]),c==null&&a!=="Error"?s.jsx(Xn,{}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),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(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),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(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Xo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Da,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(za,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-mJJR3MsR.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-CMivCywN.js";import{TI as k,TJ as v,TK as F,IM as D,Iy as G,TL as B,TM as oe,TN as ie,IC as se,ge as j,IJ as le,IG as de}from"./zeni-epic-state-CqKBThJ0.js";import{a1 as x,F as d,a2 as re,h as I,X as M,a3 as ce,a4 as me,a5 as pe,p as K,O as ue,y as he,a6 as ge,U as xe,E as be,e as fe,a7 as we,a8 as Se,$ as ye,a9 as ke,aa as ve,ab as Ie,ac as je}from"./index-DlMGj3Af.js";import{n as m}from"./mui-C6XtNCo7.js";import b from"./NotFoundScreen-fxNT7vgC.js";import{a as $}from"./sentry-CItQHKpv.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0fd108cb-7682-43b4-b526-390e8ab8dd41",e._sentryDebugIdIdentifier="sentry-dbid-0fd108cb-7682-43b4-b526-390e8ab8dd41")}catch{}})();const $e=m.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -6,8 +6,8 @@ import{j as a}from"./liveblocks-BhGApeF9.js";import{i as S,l as g,h as C,g as y,
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
box-shadow: ${e=>`0px 2px ${
|
|
10
|
-
`,Ce=g((function(e){const t=k(e),n=v(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(G(i))},onSaveHandler:i=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(F({data:l}))}}}))(
|
|
9
|
+
box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
10
|
+
`,Ce=g((function(e){const t=k(e),n=v(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(G(i))},onSaveHandler:i=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(F({data:l}))}}}))(re);function T(){const e=x(),{vendorId:t,billId:n}=S();return t==null||n==null?a.jsx(b,{}):a.jsx(a.Fragment,{children:a.jsx($e,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const De=m.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
height: 100vh;
|
|
13
13
|
width: 100%;
|
|
@@ -15,8 +15,8 @@ import{j as a}from"./liveblocks-BhGApeF9.js";import{i as S,l as g,h as C,g as y,
|
|
|
15
15
|
flex-direction: column;
|
|
16
16
|
align-items: center;
|
|
17
17
|
background-color: ${e=>e.theme.colors.grey4};
|
|
18
|
-
box-shadow: ${e=>`0px 2px ${
|
|
19
|
-
`,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:
|
|
18
|
+
box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
19
|
+
`,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:M.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(De,{windowSize:o,children:a.jsx(Be,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:M.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
|
|
20
20
|
display: flex;
|
|
21
21
|
height: 100%;
|
|
22
22
|
width: 100%;
|
|
@@ -24,8 +24,8 @@ import{j as a}from"./liveblocks-BhGApeF9.js";import{i as S,l as g,h as C,g as y,
|
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
align-items: center;
|
|
26
26
|
background-color: ${e=>e.theme.colors.grey4};
|
|
27
|
-
box-shadow: ${e=>`0px 2px ${
|
|
28
|
-
`,Ne=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:
|
|
27
|
+
box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
28
|
+
`,Ne=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(G(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:r}=s;e(F({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),r=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(pe);function Ee(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(b,{}):a.jsx(a.Fragment,{children:a.jsx(Le,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Te=m.div`
|
|
29
29
|
display: flex;
|
|
30
30
|
height: 100%;
|
|
31
31
|
width: 100%;
|
|
@@ -33,13 +33,13 @@ import{j as a}from"./liveblocks-BhGApeF9.js";import{i as S,l as g,h as C,g as y,
|
|
|
33
33
|
flex-direction: column;
|
|
34
34
|
align-items: center;
|
|
35
35
|
background-color: ${e=>e.theme.colors.grey4};
|
|
36
|
-
box-shadow: ${e=>`0px 2px ${
|
|
37
|
-
`,Fe=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:
|
|
38
|
-
width: ${
|
|
39
|
-
height: ${
|
|
40
|
-
margin-bottom: ${
|
|
41
|
-
margin-top: ${
|
|
42
|
-
margin-left: ${
|
|
36
|
+
box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
37
|
+
`,Fe=g((function(e){const t=k(e),n=v(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{I.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:r}=s;e(ie({data:r}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),r=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:r}})}}}))(ge);function Ge(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(b,{}):a.jsx(Te,{windowSize:n,children:a.jsx(Fe,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Me={containerWidth:new Ie(100,58)},Ke=m(ke)`
|
|
38
|
+
width: ${d.sp4};
|
|
39
|
+
height: ${d.sp4};
|
|
40
|
+
margin-bottom: ${d.sp3};
|
|
41
|
+
margin-top: ${d.sp3};
|
|
42
|
+
margin-left: ${d.sp8};
|
|
43
43
|
cursor: pointer;
|
|
44
44
|
position: absolute;
|
|
45
45
|
color: ${e=>e.theme.colors.brandColorJade};
|
|
@@ -54,19 +54,19 @@ import{j as a}from"./liveblocks-BhGApeF9.js";import{i as S,l as g,h as C,g as y,
|
|
|
54
54
|
display: flex;
|
|
55
55
|
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
56
56
|
flex-direction: column;
|
|
57
|
-
width: ${e=>`${
|
|
57
|
+
width: ${e=>`${Me.containerWidth.value(e.windowSize)}%`};
|
|
58
58
|
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
59
|
-
box-shadow: ${e=>`0px 2px ${
|
|
60
|
-
padding-top: ${e=>e.windowSize!=="small"?
|
|
61
|
-
`,
|
|
59
|
+
box-shadow: ${e=>`0px 2px ${d.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
60
|
+
padding-top: ${e=>e.windowSize!=="small"?d.sp2:"0px"};
|
|
61
|
+
`,He=m.div`
|
|
62
62
|
display: flex;
|
|
63
63
|
flex-direction: column;
|
|
64
64
|
align-items: center;
|
|
65
65
|
justify-content: center;
|
|
66
|
-
padding: ${e=>e.windowSize==="small"?
|
|
66
|
+
padding: ${e=>e.windowSize==="small"?d.sp3:`62px ${d.sp6} ${d.sp9} ${d.sp8}`};
|
|
67
67
|
height: ${e=>e.windowSize==="small"?"490px":"auto"};
|
|
68
68
|
overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
|
|
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
|
-
`,Ue=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),
|
|
72
|
+
`,Ue=g((function(e,t){return{file:t.file,type:t.type}}))(ve);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),r=s.get("token"),V=n.pathname.includes("address"),f=x(),_=xe(),A=be(),w=fe(),H=()=>{_.toggle()},U=E((u=>k(u))),W=E((u=>v(u))),{authParams:J,fetchState:c,billAttachment:O,billFetchState:P,companyName:q,currencySymbol:Q,amount:X}=U,{tenantId:z,userId:L,sessionId:N}=J,{fetchState:R,internationalBankAccountCreateStatus:Y}=W;return $.useEffect((()=>{j()}),[]),$.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&r!=null&&t(le(i,o,r))}),[w,c,i,o,r,t]),$.useEffect((()=>{w&&c==="Completed"&&(j(L,N,z),l!=null&&t(de(l)))}),[c,w,L,N,z,l,t]),c==="Error"?a.jsx(b,{}):R==="Completed"||Y.fetchState==="Completed"?(j(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${d.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:I,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",q,l??"",We(n.pathname),Q,X))(u)}),a.jsxs(Ve,{windowSize:f,children:[f!=="small"?a.jsx(Ke,{onClick:H}):null,a.jsx(He,{windowSize:f,isAddressPage:V,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(Ue,{file:O,type:"bill"})}),a.jsx(_e,{windowSize:f,children:e})]})]})}const We=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Je(){return a.jsx(je,{})}function ra(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Je,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Ee,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ge,{})})}),a.jsx(p,{path:"*",element:a.jsx(b,{})})]})}export{ra as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{j as g}from"./liveblocks-mJJR3MsR.js";import{a as u}from"./sentry-CItQHKpv.js";import{u as U,g as _,h as w,t as A,j as l,N as L}from"./core-CMivCywN.js";import{z as r,E as M,G as P,N as V,h as N,Q as G,_ as R,$,S as B}from"./index-DlMGj3Af.js";import{fB as Q,Tb as W,TE as q,Tv as H,ge as J,gg as K,TA as X,gR as Y,df as Z,TF as ee,TG as te}from"./zeni-epic-state-CqKBThJ0.js";import{n as ne}from"./mui-C6XtNCo7.js";import{u as se}from"./useDeviceId-DJLfe-br.js";import{f as ae}from"./analyticsHelper-Cypw_xC0.js";import{t as ie}from"./getLocaleForTenant-DCXbCJAu.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.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]="68449ed2-1325-47d3-b7ab-3940db2ed5da",t._sentryDebugIdIdentifier="sentry-dbid-68449ed2-1325-47d3-b7ab-3940db2ed5da")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=_(),f=w(),[k]=A(),n=k.get("token"),p=k.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:E,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>Q(e))),b=l((e=>W(e))),D=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),u.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(b.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),Y().then((()=>{const e=B();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(G.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[h,S,y,s,o,b,v,a.state,t]);const F=u.useCallback((()=>{f("/signin/auth")}),[f]),j=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return g.jsx(R,{phoneNumber:E,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:O,onCancelVerifyDevice:F});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||m==null||I==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx($,{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{Ce as default};
|