@zeniai/web-app-ui 5.3.39-prod → 5.3.40-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-CYKESKzr.js → AccountMappingScreen-BIUIsIRE.js} +2 -2
- package/dist/assets/AddressRoutes--gUEIlXc.js +1 -0
- package/dist/assets/AddressScreen-Bej9zQot.js +9 -0
- package/dist/assets/{AiCfoScreen-CUzkdnk3.js → AiCfoScreen-BQaocZqa.js} +1 -1
- package/dist/assets/{AppDrawer-DXgubk8e.js → AppDrawer-BYM-DSkR.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-C2jlHQ7M.js → BillPayApprovalRoutes-qtIPcgB0.js} +1 -1
- package/dist/assets/BillPayRoutes-CnpuGuHe.js +119 -0
- package/dist/assets/{BusinessVerificationPageScreen-DahCdFps.js → BusinessVerificationPageScreen-D2Ary0QP.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-CGnwOYJ8.js → CardsAiCfoScreen-V1ZiSm5h.js} +3 -3
- package/dist/assets/{ChargeCardRoutes-BazlPF9u.js → ChargeCardRoutes-DgTzZTph.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-DUdRbkF8.js → CompanyPassportScreen-CNlNZlol.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-5CXbYx5t.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-Dwb1vXcC.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-B50wTNox.js → CustomerOnboardingRoutes-BKJm_JEE.js} +3 -3
- package/dist/assets/{DashboardRoutes-Crkjw3Id.js → DashboardRoutes-BKHZJKkt.js} +1 -1
- package/dist/assets/{DefaultTenantHome-Bt9vmYHR.js → DefaultTenantHome-ttl2hapk.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-BZaPu7aX.js +18 -0
- package/dist/assets/{DrawerScreen-C1TXRcww.js → DrawerScreen-CeUxZGpo.js} +1 -1
- package/dist/assets/EntityDetailRoutes-CjcEzz2g.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-DBIvjop9.js → ExpenseAutomationRoutes-BJzy8xal.js} +6 -6
- package/dist/assets/FeaturePreviewScreen-ClB4hfhH.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-DT13Wh7A.js → HubSpotOAuthCallbackScreen-CvNAfhTh.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-Bce8xb55.js → InboxNotificationsProvider-BU6hQETc.js} +1 -1
- package/dist/assets/InvoicingRoutes-B1gAqEf9.js +2 -0
- package/dist/assets/{MagicLinkRoutes-Br2hoo0f.js → MagicLinkRoutes-B0E48n4q.js} +20 -20
- package/dist/assets/MagicLinkSignInScreen-DmrCJmgr.js +12 -0
- package/dist/assets/{MobileAppDrawer-C1pxYQQs.js → MobileAppDrawer-ezuGFNmX.js} +1 -1
- package/dist/assets/NotFoundScreen-BHK2wcy4.js +1 -0
- package/dist/assets/{NotificationRoutes-CoyKkx8E.js → NotificationRoutes-CJaAWW0k.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-BEcg5zam.js → OAuthConsentScreen-Lh-iiFIq.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-Ct9R8yRZ.js → PandLWithForecastRoutes-BbdTHIrJ.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-Bpem65oz.js → PaymentLinkScreen-DtmVsAJS.js} +5 -5
- package/dist/assets/PeopleRoutes-CNtwYayL.js +22 -0
- package/dist/assets/PerformanceRoutes-DKKm8Wqd.js +1 -0
- package/dist/assets/{Preview-HOriLeq_.js → Preview-Cbn9H8uJ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-Wj2P3Fde.js → QBOConnectionScreen-IJewO3Tq.js} +23 -23
- package/dist/assets/ReimbursementApprovalRoutes-CaWqEdpt.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-D2GP0etd.js → ReimbursementApprovalRuleDetailScreen-C9pFfWce.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-K81h5TuA.js → ReimbursementRoutes-DxyXmLRP.js} +7 -7
- package/dist/assets/{ReportsRoutes-C2snVdy8.js → ReportsRoutes-C6GStBGQ.js} +1 -1
- package/dist/assets/RewardsRoutes-DsLNX64E.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-V7gtE8RC.js → ScheduleDetailsPrepaidExpensesScreen-BsuRR9R3.js} +4 -4
- package/dist/assets/ScreenRoutes-L97Vug0k.js +2 -0
- package/dist/assets/{SettingsRoutes-Cqwd2uda.js → SettingsRoutes-BOJoESyV.js} +6 -6
- package/dist/assets/{SetupPagesScreen-f1N9Cz0q.js → SetupPagesScreen-D-0MxRfj.js} +5 -5
- package/dist/assets/SignInScreen-BE9J9fIz.js +1 -0
- package/dist/assets/SignOutScreen-CTevoMDc.js +9 -0
- package/dist/assets/{TaskListScreen-UbcwhPqf.js → TaskListScreen-CnVcsAwc.js} +2 -2
- package/dist/assets/{TaskRoutes-B60I9FKM.js → TaskRoutes-CQy6J4IF.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-WkmYYr0f.js +1 -0
- package/dist/assets/{TransactionDetailScreen-DkBKkmlJ.js → TransactionDetailScreen-DE0VBfkC.js} +1 -1
- package/dist/assets/{TransactionListRoutes-CT56obE2.js → TransactionListRoutes-D9kITRhY.js} +1 -1
- package/dist/assets/{TreasuryRoutes-DMbv4CWu.js → TreasuryRoutes-C6jv6nMF.js} +1 -1
- package/dist/assets/{VendorsRoutes-BqIaCgRw.js → VendorsRoutes-CaVrball.js} +17 -17
- package/dist/assets/{WiseConfirmationScreen-M1yWfm7t.js → WiseConfirmationScreen-CzbEV-Z5.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-CZZ2L9Kc.js → ZeniAccountRoutes-GdGf0SYA.js} +9 -9
- package/dist/assets/{ZeniAccountStatementScreen-CNDmdAfe.js → ZeniAccountStatementScreen-Cy-_EAj7.js} +2 -2
- package/dist/assets/{accountMappingHelper-IZT3VRrm.js → accountMappingHelper-DeDocU0d.js} +1 -1
- package/dist/assets/{analytics-BraOqOO1.js → analytics-N153TuwK.js} +1 -1
- package/dist/assets/{analyticsHelper-BM5BTTUi.js → analyticsHelper-Cw60VlOq.js} +1 -1
- package/dist/assets/{core-BTcTlweO.js → core-1xnf2RtE.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-BtKRHKiX.js → decodeURIComponentSafe-DcD-XNVX.js} +1 -1
- package/dist/assets/{dnd-BoQ5C62n.js → dnd-DsH8jkrb.js} +1 -1
- package/dist/assets/{empty-xKpGK8On.js → empty-Cvto7Qa_.js} +1 -1
- package/dist/assets/{empty-B0NiNSvB.js → empty-GMcl-a5k.js} +1 -1
- package/dist/assets/{emptyVideoElement-2b9d4olX.js → emptyVideoElement-3SZu1zsn.js} +1 -1
- package/dist/assets/{epic-DBHknCRT.js → epic-FXcGvl3F.js} +2 -2
- package/dist/assets/{expenseAutomationHelper-B9yXZ1rw.js → expenseAutomationHelper-CNRtAWpH.js} +1 -1
- package/dist/assets/{getLocaleForTenant-BEhIaWEh.js → getLocaleForTenant-Cb4ANH4Q.js} +1 -1
- package/dist/assets/{index-BSH2P79i.js → index-B9A0BRu3.js} +1 -1
- package/dist/assets/{index-DOPPIiem.js → index-Bdznf1tI.js} +1 -1
- package/dist/assets/{index-C2R5hhyT.js → index-BuVXkUYw.js} +2 -2
- package/dist/assets/{index-CPfXu-MN.js → index-CAK36XTm.js} +1 -1
- package/dist/assets/{index-BG5XnXjP.js → index-C_EhkY0q.js} +1 -1
- package/dist/assets/{index-Bv_gAW4_.js → index-Ctq16f6K.js} +1 -1
- package/dist/assets/{index-BJGQmd5Z.js → index-Dc3AC-iD.js} +1 -1
- package/dist/assets/{index-TGDDWC5W.js → index-nXM19luG.js} +25828 -25822
- package/dist/assets/{lexical-DXRGtjuN.js → lexical-d2so_3As.js} +1 -1
- package/dist/assets/{liveblocks-BxYL1OgN.js → liveblocks-C_WAhyd7.js} +1 -1
- package/dist/assets/{lottie-NpyKchhe.js → lottie-NIzYzhlS.js} +1 -1
- package/dist/assets/{mui-pCWXyHva.js → mui-BAsIRnB1.js} +1 -1
- package/dist/assets/{pathToGoBack-CzIcoraG.js → pathToGoBack-BmzgWhs1.js} +1 -1
- package/dist/assets/{pdf-OKLicNBW.js → pdf-BKNPlqtE.js} +4 -4
- package/dist/assets/{pdf-lib-De_6kPvr.js → pdf-lib-RqzDns79.js} +1 -1
- package/dist/assets/{plaid-CQ3219ms.js → plaid-dW1_MCaE.js} +1 -1
- package/dist/assets/{pusher-CNBK0rIV.js → pusher-BVnEdZ0V.js} +1 -1
- package/dist/assets/{react-CQp_LE2T.js → react-BFlpt3K4.js} +1 -1
- package/dist/assets/{react-DFmLhP3W.js → react-ClcLrViu.js} +1 -1
- package/dist/assets/{react-BmlMM4Hc.js → react-Dq2pDn48.js} +1 -1
- package/dist/assets/{react-DOtOHej0.js → react-gANl8FSl.js} +1 -1
- package/dist/assets/{react-C2eUkZYQ.js → react-hvFnEVKT.js} +1 -1
- package/dist/assets/{react-BxRRbSNz.js → react-xy8FhgjK.js} +1 -1
- package/dist/assets/{recharts-DITYpsYw.js → recharts-C2rsrRI6.js} +1 -1
- package/dist/assets/{routePaths-3cJbMI-5.js → routePaths-WEgtxKVV.js} +1 -1
- package/dist/assets/{sentry-CBGLGt6C.js → sentry-lC29HHPj.js} +1 -1
- package/dist/assets/{url-CjdSzyHM.js → url-B8rnjauu.js} +1 -1
- package/dist/assets/{url-UnzJzFFd.js → url-LYbpMOZt.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-DbTimNwr.js → useAiCfoDashboardSuggestedQuestionsChips-DJIBd7UL.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CRADLi0_.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-B893sZ5F.js → useChargeCardPusherEvents-BwfDpPGN.js} +1 -1
- package/dist/assets/{useDeviceId-DebjpKwR.js → useDeviceId-BX84j5B2.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-DWnaVvBR.js → useEmailConnectResultRefresh-f-R3NS2J.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-BREcdNRj.js → useInitialThreadRequest-CbTk8gTV.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-CxGYFCdI.js → useTaskManagerAccess-CCKD6ndI.js} +1 -1
- package/dist/assets/{utils-SKzA7CXw.js → utils-BBaMea9r.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-CMzfl6nd.js → withTransactionSidePanel-D-Ctl_K2.js} +1 -1
- package/dist/assets/{zeni-epic-state-BnWuRnd6.js → zeni-epic-state-BVNUxmav.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-DAo3WseZ.js +0 -1
- package/dist/assets/AddressScreen-CVh8BPrB.js +0 -9
- package/dist/assets/BillPayRoutes-COsfWSu_.js +0 -119
- package/dist/assets/ConnectionAuthScreen-HV_NFV_a.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-wj5uUCdd.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-B_RnpssZ.js +0 -18
- package/dist/assets/EntityDetailRoutes-BWiLL1YS.js +0 -1
- package/dist/assets/FeaturePreviewScreen-DwYCYDOn.js +0 -1
- package/dist/assets/InvoicingRoutes-BO0X-UM5.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-CONCFbGH.js +0 -12
- package/dist/assets/NotFoundScreen-CIYbJrC7.js +0 -1
- package/dist/assets/PeopleRoutes-DL4GGMh5.js +0 -22
- package/dist/assets/PerformanceRoutes-Cfy42E_F.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-oqwIMUnj.js +0 -1
- package/dist/assets/RewardsRoutes-CCv8pMCB.js +0 -1
- package/dist/assets/ScreenRoutes-BcwURyWe.js +0 -2
- package/dist/assets/SignInScreen-v9sXWzQJ.js +0 -1
- package/dist/assets/SignOutScreen-BZPhHb4h.js +0 -9
- package/dist/assets/TransactionDetailRoutes-B1Fq5bWn.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-zn3r_NtN.js +0 -1
package/dist/assets/{ExpenseAutomationRoutes-DBIvjop9.js → ExpenseAutomationRoutes-BJzy8xal.js}
RENAMED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-
|
|
1
|
+
import{j as f}from"./liveblocks-C_WAhyd7.js";import Ba from"./NotFoundScreen-BHK2wcy4.js";import{a,R as Pn}from"./sentry-lC29HHPj.js";import{n as be,S as Ua}from"./mui-BAsIRnB1.js";import{u as Se,h as Tt,g as Xe,j as F,i as Ct,l as Va,t as Oa,n as Ma,o as ut}from"./core-1xnf2RtE.js";import{fE as Ue,a0i as ja,p$ as _e,Ts as La,zn as za,a0j as $a,a0k as Ga,a0l as qa,a0m as mt,a0n as Je,gg as ft,a0o as nn,eM as Na,f$ as Ja,a0p as an,a0q as We,qS as Wa,uf as Ya,gR as Ha,gP as Qa,a0r as Ka,r3 as Za,rc as Xa,qa as es,qo as An,gO as de,gQ as ts,a0s as ns,qK as xn,rd as as,ql as ss,qg as os,ul as cs,gN as Fe,a0t as Qe,Bx as wn,LO as Rn,a0u as Dn,EQ as _n,a0v as is,fj as ls,fl as rs,sg as It,Wa as sn,Wc as ds,m1 as us,Wd as ms,m8 as ps,dk as hs,CQ as kt,a0w as Ss,a0x as gs,s6 as Cs,s7 as fs,W0 as Is,V6 as ks,$M as bs,qD as Fn,ri as Ke,a0y as Ts,W6 as on,W5 as Ne,a0z as cn,mp as ys,a0A as Es,a0B as vs,a0C as Ps,a0D as As,qy as xs,rl as Ye,a0E as ws,a0F as Rs,a0G as Ds,rt as _s,mc as Fs,m3 as Bs,a0H as Us,mb as ln,Wn as Vs,a0I as Os,a0J as Ms,tS as js,tt as Ls,rj as he,ts as pt,a0K as zs,a0L as $s,a0M as Gs,a0N as qs,nI as Ns,br as Js,nD as rn,np as Ws,a0O as Ys,g_ as Hs,nA as Qs,si as Ks,sk as Zs,r$ as Xs,V9 as eo,Va as to,Ei as no,Eh as ao,Ey as so,a0P as dn,s5 as oo,fw as bt,sb as co,a0Q as io,sr as lo,rV as ro,sw as uo,r_ as mo,rE as po,a0R as ho,Ti as Bn,qW as So,qu as go,qB as un,ro as Co,a0S as fo,a0T as Io,rk as Un,a0U as ko,a0V as bo,a0W as To,a0X as yo,sA as Eo,a0Y as vo,a0Z as Po,a0_ as mn,u1 as Ao,tk as xo,s2 as pn,W4 as wo,a0$ as Ro,a10 as Do,ma as _o,a11 as Fo,Qu as Bo,m9 as Uo,l_ as Vo,Th as Oo,sT as Vn,td as Mo,rh as hn,rm as jo,bE as Lo,nx as zo,nu as $o,a12 as Go,rD as Sn,t9 as gn,t7 as qo,a13 as No,sY as Jo,sD as Wo,ta as Yo,a14 as Ho,a15 as Qo,sJ as Ko,a16 as Zo,sE as Xo,sI as ec,sG as tc,tg as nc}from"./zeni-epic-state-BVNUxmav.js";import{M as Ze,y as Q,h as Y,p as ne,aq as On,as as Mn,dQ as ac,z as et,dR as sc,dS as oc,dT as cc,ae as Be,dU as ic,dV as Cn,ba as fn,dW as lc,a7 as jn,dX as rc,l as He,G as dc,w as uc,dY as mc,av as In,dZ as pc,a as hc,d_ as Sc,d$ as gc,X as Cc,V as fc,e0 as Ic,e1 as kc,e2 as bc,b4 as Tc,br as yc,ab as Ec,b5 as vc,b6 as Pc}from"./index-nXM19luG.js";import{u as Ln}from"./useAskAiCfoHostNavButtonProps-CRADLi0_.js";import{g as kn,h as Ac,r as xc,b as wc,c as Rc,i as Dc,a as _c,C as Fc}from"./TransactionDetailScreen-DE0VBfkC.js";import{b as Bc,S as Uc,a as Vc,J as Oc}from"./ScheduleDetailsPrepaidExpensesScreen-BsuRR9R3.js";import{s as bn,i as zn,h as Mc,v as jc,c as Lc}from"./routePaths-WEgtxKVV.js";import{u as zc,a as $c,w as Gc}from"./withTransactionSidePanel-D-Ctl_K2.js";import{a as ht}from"./accountMappingHelper-DeDocU0d.js";import{D as qc}from"./DrawerScreen-CeUxZGpo.js";import"./recharts-C2rsrRI6.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.js";import"./decodeURIComponentSafe-DcD-XNVX.js";import"./useInitialThreadRequest-CbTk8gTV.js";import"./expenseAutomationHelper-CNRtAWpH.js";import"./pathToGoBack-BmzgWhs1.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]="c855ebf7-38ca-4eae-be5c-c068512ea502",t._sentryDebugIdIdentifier="sentry-dbid-c855ebf7-38ca-4eae-be5c-c068512ea502")}catch{}})();const Nc=()=>{const t=Se(),s=Tt(),T=Xe(),g=F((h=>Ue(h))),{useFeatureGate:C}=Ze(),{isFeatureEnabled:i}=C(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:d}=C(Q.aiAuditScorePercentage),P=F((h=>h.expenseAutomationViewState.selectedPeriodByTenantId)),r=F((h=>ja(h,g.tenantId))),{isAiCfoAccessEnabled:E,onAskAiCfoClick:w}=Ln({mobileExploreReferrer:"Month-End Close Overview"}),A=a.useCallback(((h,l,q=!1)=>{t(_e({tenantId:l,period:{month:h.month,year:h.year},refreshViewInBackground:q}))}),[]),b=a.useCallback((h=>{const l=T.state?.referrer;r.monthEndCloseChecks?.auditSummary!=null&&Y.trackMonthCloseAuditPage(h.month,h.year,r.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",r.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,l??null),t(La(g.tenantId,h))}),[g.tenantId,r.monthEndCloseChecks?.auditSummary,r.monthEndCloseChecks?.reportEmailSentDate]),p=P[g.tenantId],u=a.useCallback((()=>{const h=T.state?.referrer;r.monthEndCloseChecks?.auditSummary!=null&&Y.trackMonthCloseAuditPage(p.month,p.year,r.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",r.monthEndCloseChecks.auditSummary.auditScorePercentage,!0,h??null),A(p,g.tenantId,!0)}),[A,p,g.tenantId,r.monthEndCloseChecks?.auditSummary,r.monthEndCloseChecks?.reportEmailSentDate]),_=ne(T.state?.pathnameStackToGoBack,T.pathname),x=a.useCallback((()=>{if(r.monthEndCloseChecks!=null&&p!=null){const h=r.monthEndCloseChecks.monthEndCloseCheckList.find((l=>l.progress<100));if(h!=null)return void s(`./${h.id}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview"}});s(`./month_end_insights/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview"}})}}),[r.monthEndCloseChecks,p]),{areTenantIdsInSync:S}=On();return Mn({isDataReady:r.fetchState==="Completed"}),a.useEffect((()=>{p!=null&&r.fetchState!=="In-Progress"&&r.fetchState!=="Completed"&&S&&A(p,g.tenantId)}),[A,p,r.fetchState,g.tenantId,S]),a.useEffect((()=>{p!=null&&r.monthClosePerformanceTrendFetchStatus.fetchState!=="In-Progress"&&r.monthClosePerformanceTrendFetchStatus.fetchState!=="Completed"&&S&&t(za(p))}),[p,r.monthClosePerformanceTrendFetchStatus.fetchState,S]),a.useEffect((()=>{const h=setInterval((()=>{r.fetchState!=="In-Progress"&&r.fetchState==="Completed"&&u()}),3e5);return()=>clearInterval(h)}),[r.fetchState]),a.useEffect((()=>{if(r.fetchState==="Completed"&&r.monthEndCloseChecks?.auditSummary!=null){const h=T.state?.referrer;Y.trackMonthCloseAuditPage(r.selectedPeriod.month,r.selectedPeriod.year,r.monthEndCloseChecks.reportEmailSentDate!=null?"closed":"in-review",r.monthEndCloseChecks.auditSummary.auditScorePercentage,!1,h??null)}}),[r.fetchState,r.selectedPeriod,r.monthEndCloseChecks?.auditSummary,r.monthEndCloseChecks?.reportEmailSentDate]),f.jsx(Jc,{children:f.jsx(ac,{monthEndCloseChecksView:r,isRealtimeInsightsFeatureEnabled:i,onMonthEndCheckClick:h=>{s(`./${h}/${p.month}-${p.year}`,{state:{pathnameStackToGoBack:_,message:"comingFromOverview",referrer:"Expense Automation - Overview"}})},onPeriodChange:b,handleReviewButtonClick:x,onBackClick:()=>{s("../../dashboard")},onReload:u,isAiCfoAccessEnabled:E,onAskAiCfoClick:w,aiAuditScorePercentageEnabled:d})})},Jc=be.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100vh;
|
|
4
4
|
width: 100%;
|
|
5
5
|
flex: 1 1 auto;
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
background-color: ${t=>t.theme.colors.grey4};
|
|
8
|
-
`,Wc=Pn.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:
|
|
8
|
+
`,Wc=Pn.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:T,onFetchLinkTokenClick:g,onEstablishConnectionClick:C})=>{const i=Se(),{useFeatureGate:d}=Ze(),{isFeatureEnabled:P}=d(Q.isReconV3Enabled),{isFeatureEnabled:r}=d(Q.isReconciliationCombinedStatementEnabled),E=et.getSignedInUser(),w=F((k=>Ue(k))),A=a.useMemo((()=>({userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:w?.tenantId??""})),[E?.userId,E?.zeniSessionId,w?.tenantId]),{accountReconciliationsByAccountID:b,excludedAccountIDs:p,monthYearPeriod:u,statementUploadChosen:_}=t,x=b[s],S=a.useMemo((()=>$a(b,s)),[b,s]),h=a.useMemo((()=>Ga(b)),[b]),l=a.useMemo((()=>qa(b,s)),[b,s]),q=a.useRef(!1),N=a.useCallback((k=>{q.current=k,Cn(s,k)}),[s]),L=a.useCallback((k=>{i(mt({accountId:s,selectedPeriod:u,dismissedToBackground:!0,backgroundCompletedSteps:k.completedSteps,startedAtMs:k.startedAtMs,totalDurationSeconds:k.totalDurationSeconds})),k.accountMappings!=null&&i(Je({accountId:s,selectedPeriod:u,localData:{combinedStatementAccountMappings:k.accountMappings}})),x!=null&&requestAnimationFrame((()=>{q.current||i(ft({messageSection:"statement_parsing_in_progress",messageText:"success",type:"info",showStatusIcon:!0,variables:[{variableName:"_account_name_",variableValue:sc(x)}]}))}))}),[i,u,x,s]),z=a.useCallback((()=>{i(mt({accountId:s,selectedPeriod:u,dismissedToBackground:!1}))}),[i,s,u]),$=a.useCallback((k=>{i(nn({accountId:s,selectedPeriod:u,backgroundCompletedSteps:k}))}),[i,u,s]),G=a.useCallback((()=>{i(nn({accountId:s,selectedPeriod:u,backgroundCompletedSteps:0})),i(mt({accountId:s,selectedPeriod:u,dismissedToBackground:!1}))}),[i,u,s]);a.useEffect((()=>()=>{Cn(null,!1)}),[]);const e=x?.parsedStatementData?.statementUpload?.statementMeta?.statementUploadId??x?.accountReconEntity.statementMetaData?.statementUploadId,n=x?.statementDateConflict?.previousReconciliationInfo?.reconciledByUserId,c=F((k=>n!=null&&n!==""?Na(Ja(k.userState,n)):"")),m=a.useCallback((()=>{i(an({accountId:s,selectedPeriod:u}))}),[i,s,u]),I=a.useCallback((()=>{i(an({accountId:s,selectedPeriod:u})),i(We({statementUploadChosen:!0}))}),[i,s,u]),y=(k,Z)=>{i(cs(k,Z.split(".")[0]))},R=(k,Z)=>{if(Z===!0){const oe=x?.combinedStatementGroupId??x?.parsedStatementData?.statementUpload?.statementMeta?.combinedStatementGroupId??x?.parsedStatementData?.statementUpload?.combinedStatementDetails?.combinedStatementGroupId;if(oe!=null&&oe!=="")return void i(ss({accountId:s,selectedPeriod:u,combinedStatementGroupId:oe,fileId:k}))}e!=null&&i(os({accountId:s,selectedPeriod:u,fileId:k,statementUploadId:e}))},V=()=>{i(We({statementUploadChosen:!1}))},W=k=>{i(as({accountId:s,selectedPeriod:u,payload:k,statementAccountScope:r===!0?x?.localData?.statementAccountScope??"single_account":"single_account"}))},K=a.useCallback(((k,Z,oe)=>{i(Wa({accountId:k,selectedPeriod:Z,statementUploadId:oe}))}),[i]),se=a.useCallback(((k,Z,oe,ge,Ce)=>{Ce!=null&&Ce!==""&&i(Ya(Ce)),i(ge==null||ge===""?Qa({accountId:k,selectedPeriod:Z,statementUploadId:oe}):Ha({accountId:k,selectedPeriod:Z,statementUploadId:oe,combinedStatementGroupId:ge}))}),[i]),D=a.useCallback(((k,Z)=>{Z!==""&&i(Ka({accountId:s,selectedPeriod:u,statementUpdateLocalData:k,statementUploadId:Z}))}),[i,s,u]),Te=a.useCallback((()=>{e!=null&&i(x?.localData?.statementAccountScope!=="multi_account"?Xa({accountId:s,selectedPeriod:u,statementUploadId:e}):Za({accountId:s,selectedPeriod:u,statementUploadId:e}))}),[i,x?.localData?.statementAccountScope,s,u,e]),ue=a.useCallback((k=>{e!=null&&i(es({accountId:s,selectedPeriod:u,statementUploadId:e,accountMappings:k}))}),[i,u,s,e]),ye=a.useCallback((()=>{i(We({statementUploadChosen:!0}))}),[i]),J=k=>{i(Je({accountId:s,selectedPeriod:u,localData:{accountSource:k}}))},tt=k=>{i(Je({accountId:s,selectedPeriod:u,localData:{statementAccountScope:k}}))},Ee=a.useCallback((()=>{i(An({accountId:s}))}),[i,s]),X=a.useCallback((k=>{i(de(u,k,!0)),T()}),[i,u,T]),ie=a.useCallback((()=>{i(ts({accountId:s,selectedPeriod:u,statementProcessingFailed:!1})),i(ns({accountId:s,selectedPeriod:u}))}),[i,s,u]),ee=a.useCallback((()=>{i(xn({accountId:s}))}),[i,s]),ve=p.includes(s)?t.excludedAccountReconciliationByAccountID[s]:void 0;if(ve!=null)return f.jsx(Tn,{children:f.jsx(yn,{$isV3:P===!0,children:f.jsx(oc,{excludedAccountReconciliation:ve,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:P,onDismissClick:T,onIncludeIntoReconciliation:ee})})});if(x!=null){const k=P===!0?f.jsx(cc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:x,monthYearPeriod:u,onDismissClick:T,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:C,onEditFileName:y,onDeleteFile:R,onSelectSourceType:J,onSelectStatementAccountScope:tt,isReconciliationCombinedStatementEnabled:r===!0,ledgerAccounts:S,statementOverrideWarningAccountIds:l,unavailableLedgerAccountIds:h,onConfirmStatementMapping:ue,filesEndPoint:Be.fileMicroServiceBaseUrl,authParams:A,openFilePicker:_,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:V,onExcludeFromReconciliation:Ee,onRetryParsing:K,onFetchStatementParseInfo:se,onReviewClicked:X,statementProcessingFailed:x.statementProcessingFailed,statementProcessingDismissedToBackground:x.statementProcessingDismissedToBackground,onDismissStatementProcessingFailed:ie,onContinueInBackground:L,onClearStatementProcessingDismissedToBackground:z,onResetStatementProcessingProgress:G,onStatementProcessingProgressChange:$,onStatementFlowVisibilityChange:N,onReuploadStatement:ye,onStatementFormDataChange:D,onStatementConfirmSave:Te,reconciledByName:c,onDismissDateConflict:m,onReuploadAfterDateConflict:I,isReconV3Enabled:P}):f.jsx(ic,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:x,monthYearPeriod:u,onDismissClick:T,plaidConnectionDetails:t.plaidConnectionDetails,onFetchLinkTokenClick:g,onEstablishConnectionClick:C,onEditFileName:y,onDeleteFile:R,onSelectSourceType:J,filesEndPoint:Be.fileMicroServiceBaseUrl,authParams:A,openFilePicker:_,onStatementUploadSuccess:W,onUploadWindowOpenedOnce:V,onExcludeFromReconciliation:Ee});return f.jsx(Tn,{children:f.jsx(yn,{$isV3:P===!0,children:k})})}return null})),Tn=be.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
height: 100%;
|
|
12
|
-
`,yn=
|
|
12
|
+
`,yn=be.div`
|
|
13
13
|
flex: 1;
|
|
14
14
|
min-height: 0;
|
|
15
15
|
display: flex;
|
|
@@ -18,11 +18,11 @@ import{j as f}from"./liveblocks-BxYL1OgN.js";import Ba from"./NotFoundScreen-CIY
|
|
|
18
18
|
min-width: 0;
|
|
19
19
|
overflow-x: hidden;
|
|
20
20
|
overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
|
|
21
|
-
`;function Yc({panelType:t,scheduleId:s,onClose:
|
|
21
|
+
`;function Yc({panelType:t,scheduleId:s,onClose:T}){return f.jsx(Qc,{children:f.jsx(Kc,{children:Hc(t,s,T)})})}function Hc(t,s,T){switch(t){case"one_time_accrual":return f.jsx(Oc,{isRenderedInPanel:!0,accrualIdOverride:s,onPanelNavigateBack:T});case"accrued_expenses":return f.jsx(Vc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:T});case"fixed_assets":return f.jsx(Uc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:T});case"prepaid_expenses":return f.jsx(Bc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:T})}}const Qc=be.div`
|
|
22
22
|
display: flex;
|
|
23
23
|
flex-direction: column;
|
|
24
24
|
height: 100%;
|
|
25
|
-
`,
|
|
25
|
+
`,Kc=be.div`
|
|
26
26
|
flex: 1;
|
|
27
27
|
min-height: 0;
|
|
28
28
|
display: flex;
|
|
@@ -31,7 +31,7 @@ import{j as f}from"./liveblocks-BxYL1OgN.js";import Ba from"./NotFoundScreen-CIY
|
|
|
31
31
|
min-width: 0;
|
|
32
32
|
overflow-x: hidden;
|
|
33
33
|
overflow-y: auto;
|
|
34
|
-
`,Zc=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,Xc=$c({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const s=(function(T=!0){const p=bt(),u=Xe(),_=Se(),x=Ct(),S=zc({childPathPattern:Zc,enabled:T}),h=S.matchGroups[0],l=zn(h)?h:void 0,q=S.matchGroups[1]!=null&&S.matchGroups[1]!==""?S.matchGroups[1]:void 0,N=S.isOpen&&l!=null&&q!=null,L=x.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",z=a.useRef({isOpen:N,scheduleId:q});z.current={isOpen:N,scheduleId:q};const $=a.useCallback(((e,n,c)=>{c!=null&&(n==="prepaid_expenses"||n==="fixed_assets")&&_(_n({selectedJEScheduleKey:c})),!S.isMobile&&T?z.current.isOpen&&z.current.scheduleId===e?S.closePanel():S.navigateToChild(`schedule/${n}/${e}`,{replace:z.current.isOpen}):p(Tn(n,e,L),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[_,p,S.isMobile,S.navigateToChild,S.closePanel,T,L]),G=a.useCallback((()=>{if(l==null||q==null)return;const e=ne(u.state?.pathnameStackToGoBack,u.pathname);p(Tn(l,q,L),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[p,l,q,L,u.pathname,u.state]);return{closePanel:S.closePanel,isOpen:N,maximize:G,openPanel:$,panelType:N?l:void 0,scheduleId:N?q:void 0}})(t),b=a.useRef(null),[g,C]=a.useState(null),i=a.useMemo((()=>({registerPanelDirtyGuard:T=>{b.current=T}})),[]),d=a.useCallback((T=>{b.current?.isDirty()===!0?C((()=>T)):T()}),[]),P=a.useCallback((()=>{d(s.closePanel)}),[d,s.closePanel]),r=a.useCallback((()=>{d(s.maximize)}),[d,s.maximize]),E=a.useCallback(((T,p,u)=>{d((()=>s.openPanel(T,p,u)))}),[d,s.openPanel]),w=a.useMemo((()=>{if(g!=null)return{onCancel:()=>C(null),onDiscard:()=>{b.current=null,C(null),g()}}}),[g]),A=a.useMemo((()=>{if(s.isOpen&&s.panelType!=null&&s.scheduleId!=null)return f.jsx(lc.Provider,{value:i,children:f.jsx(Yc,{panelType:s.panelType,scheduleId:s.scheduleId,onClose:P},`${s.panelType}:${s.scheduleId}`)})}),[s.isOpen,s.panelType,s.scheduleId,P,i]);return{injectedProps:a.useMemo((()=>({closeSchedulePanel:P,isSchedulePanelOpen:s.isOpen,openSchedulePanel:E,schedulePanelContent:A,schedulePendingDiscardConfirmation:w})),[P,E,A,w,s.isOpen]),selectedItemId:s.scheduleId,sidePanel:{closePanel:P,maximize:r}}}});function ei({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 i=F((d=>is(d,t,C)));return a.useEffect((()=>{g()}),[]),f.jsx(f.Fragment,{children:i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?f.jsx(jn,{fetchState:"In-Progress"}):f.jsx(rc,{onCloseClick:s,addCustomerRequest:b,snippets:i.companyMonthEndReportTemplatesData,bulletPoints:i.zeniRequestsData??[]})})}const ti={schedules:"Review Schedules",existing_schedules:"Existing Schedules"},ni=()=>{const t=F((w=>Fe(w))),s=Xe(),{currentSelectedViewFetchState:b,currentSelectedView:g,selectedPeriod:C}=t,i=He(g),d=He(b.fetchState),P=t.jeSchedules.uiState.selectedPageTab??"schedules",r=He(P),E=a.useCallback((w=>{const A=s.state?.referrer;g==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?Y.trackTransactionsReviewPage(C.month,C.year,t.transactionView.totalCountByTab.review,0,w,A??null):Y.trackTransactionsAutoCategorisedPage(C.month,C.year,t.transactionView.totalCountByTab.autoCategorized,0,w,A??null)),g==="missing_receipts"&&Y.trackMissingReceiptsPage(C.month,C.year,w,t.missingReceipts.transactions.length,A??null),g==="je_schedules"&&Y.trackMonthCloseScheduleListPage(C.month,C.year,w,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(T=>{const p={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return T.forEach((u=>{if(ls(u))p.oneTimeAccrualCount+=1;else switch(rs(u)){case"prepaid_expenses":p.prepaidCount+=1;break;case"fixed_assets":p.fixedAssetsCount+=1;break;case"accrued_expenses":p.accruedCount+=1}})),p})(t.jeSchedules.pendingReviewSchedules),ti[P],A??null),g==="flux_analysis"&&Y.trackFluxAnalysisPage(C.month,C.year,w,ai(t.fluxAnalysis),A??null),g==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&Y.trackInsightsEmailPage(C.month,C.year,w,"draft",t.auditSummary.auditScorePercentage,null,A??null)}),[C,t,P]);return a.useEffect((()=>{(d!==b.fetchState||g!==i||g==="je_schedules"&&r!=null&&P!==r)&&b.fetchState==="Completed"&&E(!1)}),[g,b.fetchState,i,P,r]),E},ai=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:si,comma:En,space:oi}},dateFormat:$n}=dc.getLocalizedStrings(),vn=nc,ci=Va((function(t,s){const{uncategorizedAccounts:b,vendorSearchAutoCompleteData:g,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:i,companyId:d,isMissingReceiptsBulkUploadEnabled:P,isTransactionActivityEnabled:r,newScheduleActiveType:E}=s,w=et.getSignedInUser(),A=t.tenantState.currentTenantId,T={userId:w?.userId??"",sessionId:w?.zeniSessionId??"",tenantId:A??""},p=Fe(t),{selectedTransactionCategorizationTab:u}=p,{searchTransactionsResults:_,searchTransactionsFetchState:x}=Ss(t),S=E==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:h,classListNestedAccountHierarchy:l,allDepreciationAccountListNestedAccountHierarchy:q,newScheduleLocalData:N,saveStatus:L}=gs(t,S);return{expenseAutomationViewSelector:p,accountListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:q,baseTransactionSearchFetchState:x,baseTransactionSearchResults:_,classListNestedAccountHierarchy:l,newScheduleLocalData:N,initialSelectedBaseTransaction:N.selectedBaseTransactionId!=null?Cs(t.transactionState,fs(N.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Is(t),newScheduleSaveStatus:L,bulkUploadSelector:P===!0?p.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:g,authParams:T,receiptUploadEndpoint:`${Be.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${In}/transaction_attachments`,bulkUploadEndpoint:P===!0?`${Be.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:p.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:i,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:w,uncategorizedAccounts:b,companyId:d,isTransactionActivityEnabled:r,receiptsEmail:Ts(t.tenantState,A),downloadParams:{authParams:T,jeScheduleEndPoint:`${In}/jeScheduleReports`,timezone:ks(),companyName:Ue(t).companyName}}}),(function(t,s){const{themeState:b,isAccountingClassesEnabled:g,isCOTEnabled:C,isMissingReceiptsBulkUploadEnabled:i,location:d,vendorSearchAutoCompleteData:P,expenseAutomationViewSelector:r,currentTenant:E,newScheduleActiveType:w,uncategorizedAccounts:A,navigate:T,onClickCustomerRequest:p,handleEditClick:u,closeSchedulePanel:_,isSchedulePanelOpen:x,openSchedulePanel:S,setActivityLogTransactionId:h}=s,{selectedPeriod:l,currentSelectedView:q,reconciliation:{selectedAccountId:N}}=r,{accountSettingsView:L}=r.jeSchedules,z=Fn(l),$=Qe(z.start),G=Qe(z.end);return{onZeniLogoClick:()=>{b.toggle()},onUploadReceiptAttachment:e=>{Y.trackMissingReceiptAttached(l.month,l.year),t(xo(e))},onUploadTransactionReceipt:(e,n,c,m,I,y)=>{t(mn(e,n,{fetchState:"In-Progress"}));const R=()=>t(mn(e,n,{fetchState:"Error"}));pc(`${Be.accountMicroServiceBaseUrl}/1.0/transactions/${n}/attachments`,y,n,c,m,I).then((V=>{V!=null?t(Ao(e,V)):R()})).catch(R)},onMissingReceiptsRowClick:(e,n)=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,n);const c=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,n)=>{t(Po(e,n)),E!=null&&t(_e({tenantId:E.tenantId,period:n,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,n,c,m)=>{t(vo(e,{fetchState:n,error:c})),c!=null&&t(ft({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:m!=null?oi+si+m+En:En}]}))},onUpdateJESchedulesUIState:e=>{const n=r.jeSchedules.uiState,c=e.selectedPageTab!=null&&e.selectedPageTab!==n.selectedPageTab,m=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==n.selectedJETypeFilter;x===!0&&(c||m)&&_?.(),e.createdGroupCollapsed!=null?t(To()):e.pendingGroupCollapsed!=null?t(bo()):e.selectedJETypeFilter!==void 0?t(yo(e.selectedJETypeFilter)):t(Eo(e))},onUpdateMissingReceiptsUIState:e=>{t(ko(e))},onFetchMissingReceiptsList:()=>{G!=null&&$!=null&&t(Un({start:$,end:G},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...i===!0?{onBulkUploadFiles:e=>{t(tc(e))},onBulkUploadProgress:e=>{t(ec(e))},onBulkUploadSuccess:e=>{t(Xo({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Zo(e))},onConfirmBulkUploadMatch:(e,n,c,m,I)=>{t(Qo(e,n,c,m,I))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Ko())},onSetBulkUploadResultsTab:e=>{t(Ho(e))},onSetBulkUploadCompletedSubTab:e=>{t(Yo(e))},onSetBulkUploadSortConfig:(e,n)=>{t(gn({sortKey:e,sortOrder:n}))},onClearBulkUpload:()=>{t(Wo())},onSearchTransactionsForManualMatch:(e,n)=>{t(vn(e,n??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=r.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(vn(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,n)=>{t(Jo(e,n))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(No())},onFetchBulkUploadBatches:e=>{t(Vn(e))},onFetchMoreBatchDetails:()=>{t(qo())},onResetBulkUploadSort:()=>{t(gn({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(Io())},onSearchTextChanged:e=>{const n=r.currentSelectedView,c=r.selectedTransactionCategorizationTab;n==="transaction_categorization"&&(t(pt({selectedTab:c,uiState:{searchString:e}})),G!=null&&$!=null&&t(he(c,{start:$,end:G},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const n=r.selectedTransactionCategorizationTab;t(fo({filters:e,selectedTab:n}))},onRefresh:()=>{s.trackExpenseAutomationTabAnalytics(!0),t(Co())},onClose:()=>{q==="reconciliation"&&N!=null&&t(un({selectedAccountId:void 0})),T("../")},onBack:()=>{q==="reconciliation"&&N!=null&&t(un({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(go(e))},onSaveReconciliationReview:e=>{t(So(e))},onUpdateStep:e=>{const{selectedPeriod:n}=r,c=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../${e}/${n.month}-${n.year}`,{state:{pathnameStackToGoBack:c,referrer:r.currentSelectedView}}),t(Bn(e))},handleLogOutClick:()=>{const e=ne(d.state?.pathnameStackToGoBack,d.pathname);T("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:n}=e,{prepaidExpensesAccount:c,fixedAssetsAccount:m,accruedExpensesAccount:I}=n,y=ht(L.prepaidExpensesAccountList,c.selectedOptions),R=ht(L.fixedAssetsAccountList,m.selectedOptions),V=ht(L.accruedExpensesAccountList,I.selectedOptions),W={selectedPrepaidExpensesAccountIds:y.map((Q=>Q.accountId)),selectedFixedAssetsAccountIds:R.map((Q=>Q.accountId)),selectedAccruedExpensesAccountIds:V.map((Q=>Q.accountId))};t(ho({data:W}))},onSaveJeAccountSettingsClick:()=>{t(po())},onJESchedulesFormDataChange(e,n){const{jeScheduleID:c,accumulatedDepreciationCategory:m,scheduleClass:I,scheduleExpenseCategory:y,vendor:R}=n,{allAccountList:V,allClassList:W,allDepreciationAccountList:Q}=r.jeSchedules,se=P.entityAutoCompleteView.vendor.length>0?P.entityAutoCompleteView.vendor.find((J=>J.id===R?.selectedOption)):void 0,D={id:se?.zeniId??R?.selectedOption??"",name:se?.name??R?.defaultOptions.find((J=>J.value===R?.selectedOption))?.label??"",logo:se?.logo},be=y?.selectedOption!=null?V.find((J=>J.qboId===y.selectedOption)):void 0,ue=I?.selectedOption!=null?W.find((J=>J.classId===I.selectedOption)):void 0,ye=m?.selectedOption!=null?Q.find((J=>J.qboId===m.selectedOption)):void 0;t(mo({scheduledJournalEntryID:e,localData:{jeScheduleID:c,scheduledJournalEntryID:e,updatedCategoryId:be?.accountId,updatedClassId:ue?.classId,updatedAccumulatedDepreciationCategoryID:ye?.accountId,updatedVendor:{id:D.id,name:D.name}}}))},onRevertJeSchedule(e,n,c,m,I){t(uo(e,n,c,m,I))},ignoreRecommendedJeSchedule(e,n,c,m){t(ro(e,n,c,m))},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(lo({scheduledJournalEntryID:e,jeScheduleTransactionKey:n}))},clearJeScheduleLocalData(){t(io())},onViewTransaction(e){if(s.tenantEmailDomain==null)return;const n=Lc(e,s.tenantEmailDomain),c=ne(s.location.state?.pathnameStackToGoBack,`${s.location.pathname}${s.location.search}`);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(co({query:e,scheduleType:w==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,n){const c=Tt(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:m,allDepreciationAccountList:I}=r.jeSchedules,y=n.selectedAccount!=null?m.find((V=>V.qboId===n.selectedAccount)):void 0,R=n.selectedAccumulatedDepreciationCategory!=null?I.find((V=>V.qboId===n.selectedAccumulatedDepreciationCategory)):void 0;t(dn({scheduleType:c,localData:{...n,selectedAccount:y?.accountId,selectedAccumulatedDepreciationCategory:R?.accountId}})),t(oo({scheduleType:c}))},onCreateAccruedSchedule(e){const n="accrued_expenses";t(eo()),t(to()),t(no({scheduleType:n,localData:e,selectedJeScheduleDetailId:void 0})),t(ao({scheduleType:n})),t(so(n,void 0))},onCreateOneTimeAccrual(e){t(Xs(e))},handleJeScheduleClick:(e,n,c)=>{if((function(I,y){return y!=="accrued_expenses"})(0,c)&&t(_n({selectedJEScheduleKey:n})),S!=null&&zn(c))return void S(e,c,n);const m=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../../vendors/schedules/${c}/details/${e}`,{state:{pathnameStackToGoBack:m,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,n,c,m)=>{t(n!=="revert"?Zs(e,c,m):Qs(e,c,m))},onOneTimeAccrualClick:e=>{if(S!=null)return void S(e,"one_time_accrual");const n=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{E!=null&&t(Ks(e,E.companyId,E.tenantId))},onClickCustomerRequest:p,setActivityLogTransactionId:h,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Hs())},onOpenFileAttachmentSnackBar:()=>{t(ft({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Ys(e))},onUpdateFileAttachment:e=>{t(Ws({files:e}))},previewMonthEndReport:(e,n,c,m,I)=>{E!=null&&t(rn(e,E.companyId,n,!0,c,m,{agentInsightEdits:I,tenantId:E.tenantId}))},saveMonthEndReport:(e,n,c,m,I)=>{E!=null&&t(rn(e,E.companyId,n,!1,c,m,{agentInsightEdits:I,tenantId:E.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const n=d.state?.referrer,{selectedPeriod:c,auditSummary:m}=r;E!=null&&m?.auditScorePercentage!=null&&(t(Ns(E.companyId,e,E.tenantId)),Y.trackInsightsEmailPage(c.month,c.year,!1,"draft",m.auditScorePercentage,Js().format($n.analytics.MMMDDCommaYYYYformat),n??null))},onTransactionCategorizationRowClick:(e,n)=>{const c=r.transactionView.uiState.searchString??"",m=r.transactionView.transactions,I=m.findIndex((V=>V.id===e)),y=c.length>0?{resultPosition:I>=0?I+1:void 0,resultsCount:m.length,searchTerm:c}:void 0;if(s.openTransactionPanel)return void s.openTransactionPanel(e,n,y);const R=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:R,message:"expenseAutomation",origin:"transaction_categorization",searchContext:y}})},setLocalDataForCategoryAndClass:(e,n,c,m,I,y,R,V,W,Q,se,D)=>{t(qs(e,n,c,m,A,I,y,R,V,W,Q,se,D))},onCancelAutoComplete:()=>{t(Ne("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(cn({scrollPosition:e}))},onUpdateTab:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t(he(e,{start:$,end:G},!1,!1)),t(Gs(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t($s(e)),t(he("autoCategorized",{start:$,end:G},!1,!1)))},onTransactionGroupChange:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t(zs(e)),t(he(s.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:$,end:G},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,n)=>{t(pt({selectedTab:e,uiState:n})),G!=null&&$!=null&&t(he(e,{start:$,end:G},!1,!1,n.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,n)=>{t(pt({selectedTab:e,uiState:n}))},onFetchTransactionCategorizationList:(e,n,c,m,I,y)=>{G!=null&&$!=null&&t(he(e,{start:$,end:G},!0,c,n,m,I,y))},resetTransactionCategorizationLocalData:(e,n,c,m,I,y,R)=>{t(Ls(e,n,c,m,R??null,I,y,!1)),xc(t,n.map(String))},updateSelectedVendorForTransaction:(e,n,c,m,I)=>{t(ln({selectedTab:e,transactionId:n,lineId:c,selectedTransaction:m,uncategorizedAccounts:A,updatedVendor:I,isAccountingClassesEnabled:g}))},onSaveUpdateTransactionCategorization:(e,n,c)=>{const m=d.state?.referrer;e==="autoCategorized"?Y.trackTransactionsAutoCategorisedPage(l.month,l.year,r.transactionView.totalCountByTab.autoCategorized,n.length,!1,m??null):Y.trackTransactionsReviewPage(l.month,l.year,r.transactionView.totalCountByTab.review,n.length,!1,m??null),t(js(e,n,c)),Ac(n.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,n)=>{t(Ms({selectedTab:e,transactionIds:n}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,n,c,m,I,y)=>{const{transactionId:R,transaction:V,lineIds:W}=n;y!=null&&t(Vs({transactionId:R,customerUpdates:y})),t(Os({selectedTab:m,transactionId:R.id,lineId:W[0],selectedTransaction:V,uncategorizedAccounts:A,updatedCustomer:y,selectedEntity:I,isAccountingClassesEnabled:g})),I!=null&&t(kt({entity:I,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:m,isFetchCOT:C}))},onFetchRecommendationsForEntityCategorization:(e,n,c,m,I,y)=>{const{transactionId:R,transaction:V,lineIds:W}=n;y!=null&&(t(Fs({transactionId:R,vendorUpdates:{name:y.name,id:y.id?y.id:void 0}})),t(Bs({vendorId:y.id?y.id:void 0,localData:{vendorName:y.name,vendorId:y.id?y.id:void 0}}))),y?.id?(t(ln({selectedTab:m,transactionId:R.id,lineId:W[0],selectedTransaction:V,uncategorizedAccounts:A,updatedVendor:y,selectedEntity:I,isAccountingClassesEnabled:g})),I!=null&&t(kt({entity:I,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:m,isFetchCOT:C}))):t(Us({selectedTab:m,transactionId:R.id,lineId:W[0]}))},fetchFluxViewOnScroll:(e,n)=>{t(Ye(e,!0,!1,n,!1,!0))},onFetchFluxViewList:()=>{t(Ye(l,!0,!1,null,!1,!1))},markAsReview:(e,n,c,m)=>{Y.trackFluxAnalysisReviewed(c.month,c.year,m??!1,e),t(_s(n,e,c,m??!1))},onUpdateFluxAnalysisUIState:e=>{t(Ds(e))},updateOperatingExpensesIdsForReview:e=>{t(Rs({operatingExpenseIds:e,selectedPeriod:l}))},redirectToVendorDetailPage:e=>{if(s.tenantEmailDomain!=null){const n=jc(e.id,e.qboId,s.tenantEmailDomain),c=ne(s.location.state?.pathnameStackToGoBack,s.location.pathname);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(ws({sectionId:e,selectedPeriod:l}))},onFetchReimbursementView:(e,n,c)=>{t(Ye(e,!0,!1,n,!0,c))},onReviewClicked:e=>{t(de(l,e))},setOpenDrawerClicked:e=>{t(Ke({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,n)=>{t(wn("expense_automation_reconcile",e,n))},onEstablishConnectionClick:(e,n)=>{const c=E?.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:l,localData:{accountSource:"bank_statement"}})),t(We({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(de(l,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(xs({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,n)=>{t(As({sortKey:e,sortOrder:n}))},onReconReviewTabColumnSortConfigChanged:(e,n)=>{t(Ps({sortKey:e,sortOrder:n}))},onReconTabUpdate:e=>{s.closeSidePanel?.(),t(vs({selectedTab:e}))},updateReconReviewTabLocalData:(e,n,c)=>{const m=e.vendor?.id;c&&m!=null&&t(ys(m)),t(Es({data:e,transactionId:n}))},onReconMatchedTransactionClick:e=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,It("bill"));const n=ne(d.state?.pathnameStackToGoBack,d.pathname);T(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{T(-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(bs({nodeId:e,collapsed:n}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(An({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(xn({accountId:e}))}}}),((t,s,b)=>{const{isMissingReceiptsBulkUploadEnabled:g,...C}=b;return(function(i,d,P){return{...i,...d,...P,onUploadTransactionReceipt:(r,E,w,A,T)=>{d.onUploadTransactionReceipt(r,E,w,A,T,i.authParams)}}})(t,s,C)}))(uc(mc)),St="newScheduleMode",gt="newScheduleType",ii=Xc(Gc((function(t){const s=t.displayName??t.name??"Component",b=Pn.memo(t),g=C=>{const i=Se(),d=(function(){const S=Se(),h=F((l=>Fe(l).reconciliation.selectedDrawerAccountId));return{isOpen:h!=null,selectedAccountId:h,openPanel:a.useCallback((l=>{S(Ke({selectedDrawerAccountId:l}))}),[S]),closePanel:a.useCallback((()=>{S(Ke({selectedDrawerAccountId:void 0}))}),[S])}})(),P=F((S=>Fe(S).reconciliation)),r=F((S=>Ue(S))),E=a.useCallback(((S,h)=>{i(wn("expense_automation_reconcile",S,h))}),[i]),w=a.useCallback(((S,h)=>{const l=r?.companyId;l!=null&&(i(Rn(S,l,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",h)),i(Dn({accountId:h,connectionInProgress:!0})))}),[i,r?.companyId]),A=a.useMemo((()=>{if(d.isOpen&&d.selectedAccountId!=null)return f.jsx(Wc,{reconciliation:P,selectedDrawerAccountId:d.selectedAccountId,onClose:d.closePanel,onFetchLinkTokenClick:E,onEstablishConnectionClick:w})}),[d.isOpen,d.selectedAccountId,d.closePanel,P,E,w]),T=a.useMemo((()=>({reconPanelContent:A,reconSidePanelIsOpen:d.isOpen,closeReconSidePanel:d.closePanel})),[A,d.isOpen,d.closePanel]),{useFeatureGate:p}=Ze(),{isFeatureEnabled:u}=p(K.isReconV3Enabled),_=a.useContext(fn),x=a.useMemo((()=>d.isOpen?u===!0?{selectedItemId:d.selectedAccountId}:{closePanel:d.closePanel,selectedItemId:d.selectedAccountId}:_),[d.isOpen,d.closePanel,d.selectedAccountId,_,u]);return f.jsx(fn.Provider,{value:x,children:f.jsx(b,{...C,...T})})};return g.displayName=`withReconSidePanel(${s})`,g})((({closeSidePanel:t,openTransactionPanel:s,panelContent:b,sidePanelIsFullView:g,sidePanelIsOpen:C,reconPanelContent:i,reconSidePanelIsOpen:d,closeReconSidePanel:P,isSchedulePanelOpen:r,closeSchedulePanel:E,openSchedulePanel:w,schedulePanelContent:A,schedulePendingDiscardConfirmation:T})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:u}=hc(),_=Sc(),{isOpen:x}=gc(),S=bt(),h=Xe(),l=Se(),{isAiCfoAccessEnabled:q,onAskAiCfoClick:N}=Ln({mobileExploreReferrer:"Transaction categorization"}),L=a.useCallback((()=>{C===!0&&g!==!0&&t?.()}),[t,C,g]),{areTenantIdsInSync:z}=On(),$=ni(),G=Cc(),[e,n]=a.useState(!1),[c,m]=Oa(),I=a.useCallback((o=>{m((v=>{const j=new URLSearchParams(v);return o==null?(j.delete(St),j.delete(gt),j):(j.set(St,o.scheduleDetailsMode),j.set(gt,o.scheduleType),j)}),{replace:!0})}),[m]),[y,R]=a.useState(void 0),V=a.useCallback(((o,v,j)=>{const M=Tt(o);R(M),I({scheduleDetailsMode:v,scheduleType:o}),l(pn({scheduleType:M==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:j}))}),[l,I]),W=a.useMemo((()=>{const o=c.get(St),v=c.get(gt);return o!=null&&v!=null?{scheduleDetailsMode:o,scheduleType:v}:void 0}),[c]),Q=a.useCallback((o=>{I(o),o!=null&&l(pn({scheduleType:Tt(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[l,I]),se=F((o=>sn(o))),D=F((o=>Ue(o))),[be,ue]=a.useState(!1),[ye,J]=a.useState(!1),[tt,Ee]=a.useState([]),[X,ie]=a.useState(null),ee=a.useCallback((()=>{ie(null)}),[]),ve=X?.contentType==="activity"?X.detail.transactionId:void 0,k=a.useCallback((o=>{o!=null?(p&&u(!1),_(),L(),ie({contentType:"activity",detail:{transactionId:o}})):ie((v=>v?.contentType==="activity"?null:v))}),[L,p,_,u]),Z=a.useCallback((o=>{p&&u(!1),_(),L(),ie({contentType:"transfer",detail:o})}),[L,p,_,u]),oe=a.useCallback((()=>{_(),ee(),L(),N()}),[L,ee,N,_]),ge=a.useRef(p);a.useEffect((()=>{p===!0&&ge.current===!1&&(_(),ee(),L()),ge.current=p}),[L,ee,p,_]);const Ce=a.useRef(x);a.useEffect((()=>{x===!0&&Ce.current===!1&&(p&&u(!1),ee(),C===!0&&g!==!0&&t?.()),Ce.current=x}),[ee,t,x,p,u,g,C]);const Ve=C===!0&&g!==!0,yt=a.useRef(Ve);a.useEffect((()=>{Ve&&!yt.current&&(p&&u(!1),_(),ee()),yt.current=Ve}),[ee,p,Ve,_,u]);const[Et,Gn]=a.useState(!1),vt=a.useRef(!1),{selectedTab:Pt}=Ct(),{tenantEmailDomain:nt}=Ct(),[at,At]=a.useState(h.state?.message==="comingFromTransactionDetail"),xt=h.state?.message==="comingFromOverview",qn=fc(),st=et.getSignedInUser(),{useFeatureGate:ce}=Ze(),{isFeatureEnabled:wt}=ce(K.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:Pe}=ce(K.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:ot}=ce(K.isTransactionActivityEnabled),{isFeatureEnabled:Nn}=ce(K.isAccrualEnabled),{isFeatureEnabled:Rt}=ce(K.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:Jn}=ce(K.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:Wn}=ce(K.isProjectsTransactionsEnabled),{isFeatureEnabled:Yn}=ce(K.isReconV3Enabled),Hn=a.useCallback((o=>{const v=It(o.transactionType??(o.view==="reconciliation"?"bill":"expense")),j=ne(h.state?.pathnameStackToGoBack,h.pathname),M=new URLSearchParams({view:"full"});o.threadId!=null&&M.set("thread_id",o.threadId),o.entityType!=null&&M.set("entity_type",o.entityType),S(`/${nt}/transaction/${encodeURIComponent(v)}/${o.transactionId??o.entityId}?${M.toString()}`,{state:{pathnameStackToGoBack:j,message:"expenseAutomation"}})}),[S,nt,h.state,h.pathname]),Kn=F((o=>wo(o,"common"))),O=F((o=>Fe(o))),{categoryOptions:Qn,paymentAccountNames:Zn}=F((o=>Ro(o.accountState))),Xn=F((o=>Do(o.classState))),{monthEndCloseChecksView:H,currentSelectedView:B,selectedPeriod:U,selectedTransactionCategorizationTab:ct,currentSelectedViewBackgroundRefreshFetchState:ea,currentSelectedViewFetchState:le,jeSchedules:it,reconciliation:Dt}=O;wc(B==="transaction_categorization");const ta=O.transactionView.saveStatus.fetchState,Oe=O.transactionView.transactions,_t=a.useRef(Oe);_t.current=Oe;const Ft=F((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Bt=F((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Ut=a.useRef(Ft);Ut.current=Ft;const Vt=a.useRef(Bt);Vt.current=Bt;const Me=F((o=>{const v=o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return v!=null?o.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[v]?.filters:void 0})),Ot=a.useRef("");a.useEffect((()=>{if(B!=="transaction_categorization")return;const o=O.transactionView.uiState.searchString??"";if(le.fetchState!=="Completed"||o.length===0||o===Ot.current)return;Ot.current=o;const v=Me!=null?Ic(Me):0,j=Me?.categories.filter((M=>M.values.length>0&&String(M.values[0]??"").trim()!=="")).map((M=>`${M.field}:${M.values.join(",")}`))??[];Y.trackAiCloseTransactionSearch({filtersApplied:j,hasResults:Oe.length>0,isFiltered:v>0,resultsCount:Oe.length,searchTerm:o,searchType:"free_text"})}),[B,le.fetchState,O.transactionView.uiState.searchString,O.transactionView.transactions,Me]);const re=Rc(ta,(()=>{const o=[],v=Vt.current,j=Ut.current,M=j!=null&&v!=null?j[v]:void 0;if(M?.transactionReviewLocalDataById!=null)for(const Ie of Object.values(M.transactionReviewLocalDataById)){const te=Ie?.transactionReviewLocalData?.lineItemById;if(te!=null)for(const lt of Object.values(te)){const De=lt?.account;De?.accountId!=null&&o.push(De.accountId)}}const fe=_t.current;for(const Ie of fe)for(const te of Ie.lines??[])"account"in te&&te.account?.accountId!=null&&o.push(te.account.accountId);return o}));a.useEffect((()=>{B==="transaction_categorization"&&C!==!0||k(void 0)}),[B,k,C]),a.useEffect((()=>{d===!0&&P?.()}),[B,Dt.selectedAccountId]);const na=O.transactionView.selectedTransactionCategorizationCompletedSubTab,aa=O.transactionView.selectedTransactionGroup,je=`${ct}|${na}|${aa}`,Le=a.useRef(null),Mt=a.useRef(null);a.useEffect((()=>{Le.current!==null?Le.current!==je&&(Le.current=je,B==="transaction_categorization"&&ee()):Le.current=je}),[ee,B,je]);const sa=F((o=>ve==null?void 0:_o(o.transactionState,ve))),me=sa?.qboId,jt=F((o=>me==null?void 0:Fo(o,me)));a.useEffect((()=>{me!=null&&l(Bo(me))}),[l,me]);const{createTransferEntryStatus:Lt,creditCardTransferAccountsList:zt,transferAccounts:$t}=O.transactionView,Gt=a.useCallback((o=>Dc(l,o)),[l]),qt=a.useMemo((()=>B!=="transaction_categorization"||X==null?null:X.contentType==="activity"?ot===!0?f.jsx(kc,{activityLogView:jt,qboId:me,onClose:()=>ie(null),selectedTransactionId:X.detail.transactionId,isQuickViewCardStyle:!0},String(X.detail.transactionId)):null:X.contentType==="transfer"?f.jsx(Tc,{createTransferEntryStatus:Lt,creditCardTransferAccountsList:zt,transaction:X.detail,transferAccounts:$t,onClose:()=>ie(null),onCreateTransfer:Gt,isQuickViewCardStyle:!0},String(X.detail.transactionId)):null),[B,X,ot,jt,me,Lt,zt,$t,Gt]),oa=qt!=null,{selectedAccountId:Ae}=Dt,Nt=He(it.accountSettingsView.saveState.fetchState),ca=F((o=>Uo(o.accountState,o.accountListState,"accountList"))),ia=F((o=>Vo(o))),xe=Pt!=null?Oo(Pt):B,la=F((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Mn({isDataReady:le.fetchState==="Completed"}),st==null)throw Error("Can't access expense automation screen without signing in...");const Jt=Fn(U),we=Qe(Jt.start),Re=Qe(Jt.end);if(we==null||Re==null)throw Error(`Invalid start - ${we} and end - ${Re} period from given ${U}`);const ra=a.useCallback((()=>{ue(!1)}),[]),da=a.useCallback((()=>{J(!0)}),[]),ua=a.useCallback((o=>{Ee(o),J(!1)}),[]),ma=a.useCallback((()=>{Ee([])}),[]),ze=O.missingReceipts.bulkUpload.phase,Wt=O.missingReceipts.bulkUpload.currentBatchId;a.useEffect((()=>{Pe===!0&&B==="missing_receipts"&&ze==="matching"&&Wt!=null&&l(Vn({cacheOverride:!0}))}),[Pe,B,ze,Wt,l]);const Yt=st?.userId,pa=U.month,ha=U.year,Ht=D?.tenantId;a.useEffect((()=>{B==="missing_receipts"&&Pe!==!1&&ze==="idle"&&Yt!=null&&Ht!=null&&l(Mo())}),[B,Pe,ze,Yt,Ht,pa,ha,l]),a.useEffect((()=>{se.newVendorState?.vendorDetailLocalData?.vendorName!=null?n(!0):n(!1)}),[se.newVendorState?.vendorDetailLocalData?.vendorName]),a.useEffect((()=>{xe!=null&&B!==xe&&l(Bn(xe))}),[xe]),a.useEffect((()=>{Et===!1&&le.fetchState==="Completed"&&z&&(Gn(!0),l(hn(!1,!1)))}),[Et,le,z]),a.useEffect((()=>{const o={month:U.month,year:U.year},v=Mt.current;Mt.current=o,v===null||v.month===o.month&&v.year===o.year||!xt&&z&&(l(hn(!1,!1)),l(de(U,Ae,!1,!1)))}),[U.month,U.year,z]);const $e=a.useCallback(((o=!1,v=!1)=>{const j={start:we,end:Re};switch(B){case"transaction_categorization":l(he(ct,j,o,!at,void 0,void 0,v)),At(!1);break;case"flux_analysis":l(Ye(U,o,v,null));break;case"month_end_insights":if(v===!1){const M=new Date(U.year,U.month,0),fe=Lo(M.toDateString()).format($n.analytics.YYYYDashMMDashDDFormat);l(zo(!0,D.companyId,D.tenantId,fe)),l($o(D.companyId,D.tenantId))}break;case"je_schedules":l(jo(j,v));break;case"missing_receipts":l(Un(j,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,v));break;default:l(de(U,Ae,o,v))}}),[B,we,Re,D.companyId,D.tenantId,ct,U,Ae,at,At]),Sa=a.useCallback((()=>{$e(!0,!0)}),[$e]);a.useEffect((()=>{B===xe&&le.fetchState==="Not-Started"&&z&&$e(!0)}),[le,we,Re,D.companyId,D.tenantId,z]),a.useEffect((()=>{xt||at||vt.current||ea.fetchState==="In-Progress"||le.fetchState!=="Completed"||(vt.current=!0,$e(!0,!0))}),[]),a.useEffect((()=>{H.fetchState!=="In-Progress"&&H.fetchState!=="Completed"&&H.fetchState!=="Error"&&D?.tenantId!=null&&l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!1}))}),[H.fetchState,D?.tenantId]),a.useEffect((()=>{H.fetchState!=="Completed"||!z||(H.monthEndCloseChecks?.monthEndCloseCheckList.some((o=>o.id==="reconciliation"))??!1)&&O.reconciliation.fetchStatus.fetchState==="Not-Started"&&l(de(U,void 0,!1,!1))}),[H.fetchState,z,U.month,U.year,O.reconciliation.fetchStatus.fetchState,l]),a.useEffect((()=>{O.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?ue(!0):ue(!1)}),[O.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),a.useEffect((()=>{O.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&z&&(l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!0})),l(Go({companyId:D.companyId})),S("../"))}),[O.monthEndInsights?.sendMonthEndReportStatus?.fetchState,D.tenantId,U,D.companyId,z]),a.useEffect((()=>{const o=setInterval((()=>{H.fetchState!=="In-Progress"&&H.fetchState==="Completed"&&l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[H.fetchState,D.tenantId,U,l]),a.useEffect((()=>{const o=setInterval((()=>{B==="reconciliation"&&Ae==null&&O.reconciliation.fetchStatus.fetchState==="Completed"&&O.reconciliation.refreshStatus.fetchState!=="In-Progress"&&l(de(U,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[B,l,O.reconciliation.fetchStatus.fetchState,O.reconciliation.refreshStatus.fetchState,de,Ae,U]);const ga=kn(),{isFeatureEnabled:Ca}=ce(K.isRecommendationFeedbackEnabled),Kt=bc(),{onRecommendationSelection:Qt,popup:fa}=_c({isEnabled:Ca}),Ia=a.useMemo((()=>({...Kt,onRecommendationSelection:Qt})),[Kt,Qt]);a.useEffect((()=>{const o=(H.monthEndCloseChecks?.monthEndCloseCheckList.find((v=>v.id==="month_end_insights"))?.isDisabled??!1)&&!wt;B!=="month_end_insights"||!o&&H.monthEndCloseChecks?.reportEmailSentDate==null||S("../")}),[B,H.monthEndCloseChecks]);const ka=d===!0?i:b,Ta=d===!0||C===!0,ba=d===!0?P:t;a.useEffect((()=>{Nt==="In-Progress"&&it.accountSettingsView.saveState.fetchState==="Completed"&&l(Sn())}),[Nt,it.accountSettingsView.saveState.fetchState,Sn]);const{transactionId:Zt,onSaveVendor:ya,onSaveSuccess:Ea,onCancel:va,vendorViewDetails:Pa}=(({expenseAutomationViewSelector:o,closeDrawerHandler:v,currentSelectedView:j})=>{const M=Se();let fe,Ie,te;const lt=kn(),De=o.transactionView;let Xt=()=>{};const{transactions:Aa,selectedTransactionId:ke,selectedTransactionLineId:Ge,transactionLocalData:xa}=De;if(j==="transaction_categorization"){const rt=xa.find((pe=>pe.transactionId===ke)),ae=Aa.find((pe=>pe.id===ke)),en=Ge!=null?rt?.transactionReviewLocalData?.lineItemById[Ge]:void 0,tn=en?.account;Ie=en?.class?.classId,fe=["Uncategorized Income","Uncategorized Expense"].includes(tn?.accountName??"")?void 0:tn?.accountId;const Ra=Mc(ke,ae?.typeOfTransaction);ae!=null&&Ra&&(te={id:ke,type:It(ae.typeOfTransaction)}),Xt=()=>{if(ke!=null&&Ge!=null&&ae!=null){const pe=De.transactionLocalData.find((qe=>qe.transactionId===ke))?.transactionReviewLocalData;if(pe!=null&&ae.lines!=null&&ae.lines.length>0){const qe=pe.lineItemById[Ge];let dt=pe.selectedEntity;if(hs(ae)||(dt=qe.selectedEntityLine),dt!=null){const Da=dt,_a={transactionId:{id:ae.id,type:ae.type},transaction:ae,lineIds:ae.lines.map((Fa=>Fa.id))??[]};M(kt({entity:Da,amount:qe.amount.amount,transactionDetails:_a,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:lt}))}}}}}const wa=F((rt=>sn(rt,void 0,fe,Ie)));return{transactionId:te,onSaveVendor:()=>{M(ps(te,void 0,!1,!0))},onSaveSuccess:Xt,onCancel:()=>{te!=null&&M(ds({transactionId:te})),M(us()),M(ms()),v()},vendorViewDetails:wa}})({expenseAutomationViewSelector:O,closeDrawerHandler:()=>{n(!1)},currentSelectedView:B});return qn?.loggedInUserRoleMap==null?H.fetchState==="Error"?f.jsx(yc,{onGoHome:()=>S("../",{replace:!0}),onReload:()=>window.location.reload()}):f.jsx(jn,{fetchState:"In-Progress"}):f.jsxs(f.Fragment,{children:[f.jsx(qc,{isOpen:ye,drawerLeftMargin:new Ec(0,0,300,650),onClose:()=>{J(!1)},children:f.jsx(li,{onClick:o=>o.stopPropagation(),children:f.jsx(ei,{companyId:D.companyId,closeCustomerRequestDrawer:()=>J(!1),addCustomerRequest:ua,resetCustomerRequest:ma})})}),Zt!=null&&e&&f.jsx(Fc,{isOpen:e,transactionId:Zt,onSaveVendor:ya,onSaveSuccess:Ea,onCancel:va,vendorViewDetails:Pa}),f.jsx(vc,{toolkit:Ia,children:f.jsx(ci,{events:[],eventCallback:(o,v,j)=>{},navigate:S,location:h,themeState:G,categoryOptions:Qn,classesForFilters:Xn,accountsForFilters:Zn,vendorSearchAutoCompleteData:{autoCompleteText:la,entityAutoCompleteView:Kn},expenseAutomationViewSelector:O,isMissingReceiptsBulkUploadEnabled:Pe,monthEndInsightsPreviewMode:be,monthEndInsightsCustomerRequestData:tt,isRealtimeInsightsFeatureEnabled:wt,isCreateTransferEntryFromExpenseEnabled:Rt,isAccountingClassesEnabled:ia,isProjectsTransactionsEnabled:Wn,isCOTEnabled:ga,currentTenant:D,companyId:D.companyId,signedInUser:st,isTransactionActivityEnabled:ot,isRightPanelOpen:oa,rightSidePanel:qt,onOpenTransferRightPanel:Rt===!0?Z:void 0,uncategorizedAccounts:ca,newScheduleActiveType:y,isAccrualEnabled:Nn,newScheduleSelection:W,onNewScheduleSelectionChange:Q,onScheduleTypeChange:V,onNewScheduleSaved:Sa,onClickCustomerRequest:da,handleEditClick:ra,tenantEmailDomain:nt,trackExpenseAutomationTabAnalytics:$,setActivityLogTransactionId:k,closeSidePanel:ba,openTransactionPanel:s,closeSchedulePanel:E,openSchedulePanel:w,sidePanelIsOpen:Ta,sidePanelIsFullView:d!==!0&&g,panelContent:ka,isAiCfoAccessEnabled:q,onAskAiCfoClick:oe,isExpenseAutomationCommentingEnabled:Jn,isReconV3Enabled:Yn,onExpenseAutomationCommentingThreadClick:Hn,sidePanelListPercent:d===!0?66:void 0,isSchedulePanelOpen:r,schedulePanelContent:A,schedulePendingDiscardConfirmation:T})}),fa,re.showPopup&&re.popupType!=null&&f.jsx(Pc,{popupType:re.popupType,currencySymbol:re.currencySymbol,accountId:re.popupAccountId??"",accountName:re.popupAccountName??"",onSubmit:re.handleSubmit,onDismiss:re.handleDismiss})]})})))),li=Te(Ua)`
|
|
34
|
+
`,Zc=/^schedule\/(prepaid_expenses|fixed_assets|accrued_expenses|one_time_accrual)\/([^/?]+)$/,Xc=$c({displayNamePrefix:"withScheduleSidePanel",usePanelSetup:function(t){const s=(function(b=!0){const p=Tt(),u=Xe(),_=Se(),x=Ct(),S=zc({childPathPattern:Zc,enabled:b}),h=S.matchGroups[0],l=zn(h)?h:void 0,q=S.matchGroups[1]!=null&&S.matchGroups[1]!==""?S.matchGroups[1]:void 0,N=S.isOpen&&l!=null&&q!=null,L=x.tenantEmailDomain??u.pathname.split("/").find(Boolean)??"",z=a.useRef({isOpen:N,scheduleId:q});z.current={isOpen:N,scheduleId:q};const $=a.useCallback(((e,n,c)=>{c!=null&&(n==="prepaid_expenses"||n==="fixed_assets")&&_(_n({selectedJEScheduleKey:c})),!S.isMobile&&b?z.current.isOpen&&z.current.scheduleId===e?S.closePanel():S.navigateToChild(`schedule/${n}/${e}`,{replace:z.current.isOpen}):p(bn(n,e,L),{state:{message:"expenseAutomation",origin:"je_schedules"}})}),[_,p,S.isMobile,S.navigateToChild,S.closePanel,b,L]),G=a.useCallback((()=>{if(l==null||q==null)return;const e=ne(u.state?.pathnameStackToGoBack,u.pathname);p(bn(l,q,L),{state:{pathnameStackToGoBack:e,message:"expenseAutomation",origin:"je_schedules"}})}),[p,l,q,L,u.pathname,u.state]);return{closePanel:S.closePanel,isOpen:N,maximize:G,openPanel:$,panelType:N?l:void 0,scheduleId:N?q:void 0}})(t),T=a.useRef(null),[g,C]=a.useState(null),i=a.useMemo((()=>({registerPanelDirtyGuard:b=>{T.current=b}})),[]),d=a.useCallback((b=>{T.current?.isDirty()===!0?C((()=>b)):b()}),[]),P=a.useCallback((()=>{d(s.closePanel)}),[d,s.closePanel]),r=a.useCallback((()=>{d(s.maximize)}),[d,s.maximize]),E=a.useCallback(((b,p,u)=>{d((()=>s.openPanel(b,p,u)))}),[d,s.openPanel]),w=a.useMemo((()=>{if(g!=null)return{onCancel:()=>C(null),onDiscard:()=>{T.current=null,C(null),g()}}}),[g]),A=a.useMemo((()=>{if(s.isOpen&&s.panelType!=null&&s.scheduleId!=null)return f.jsx(lc.Provider,{value:i,children:f.jsx(Yc,{panelType:s.panelType,scheduleId:s.scheduleId,onClose:P},`${s.panelType}:${s.scheduleId}`)})}),[s.isOpen,s.panelType,s.scheduleId,P,i]);return{injectedProps:a.useMemo((()=>({closeSchedulePanel:P,isSchedulePanelOpen:s.isOpen,openSchedulePanel:E,schedulePanelContent:A,schedulePendingDiscardConfirmation:w})),[P,E,A,w,s.isOpen]),selectedItemId:s.scheduleId,sidePanel:{closePanel:P,maximize:r}}}});function ei({companyId:t,closeCustomerRequestDrawer:s,addCustomerRequest:T,resetCustomerRequest:g}){const C=et.getSignedInUser();if(C==null)throw Error("Can't access Customer Request page without signing in...");const i=F((d=>is(d,t,C)));return a.useEffect((()=>{g()}),[]),f.jsx(f.Fragment,{children:i.fetchState==="In-Progress"||i.companyMonthEndReportTemplatesData.fetchState==="In-Progress"?f.jsx(jn,{fetchState:"In-Progress"}):f.jsx(rc,{onCloseClick:s,addCustomerRequest:T,snippets:i.companyMonthEndReportTemplatesData,bulletPoints:i.zeniRequestsData??[]})})}const ti={schedules:"Review Schedules",existing_schedules:"Existing Schedules"},ni=()=>{const t=F((w=>Fe(w))),s=Xe(),{currentSelectedViewFetchState:T,currentSelectedView:g,selectedPeriod:C}=t,i=He(g),d=He(T.fetchState),P=t.jeSchedules.uiState.selectedPageTab??"schedules",r=He(P),E=a.useCallback((w=>{const A=s.state?.referrer;g==="transaction_categorization"&&(t.selectedTransactionCategorizationTab==="review"?Y.trackTransactionsReviewPage(C.month,C.year,t.transactionView.totalCountByTab.review,0,w,A??null):Y.trackTransactionsAutoCategorisedPage(C.month,C.year,t.transactionView.totalCountByTab.autoCategorized,0,w,A??null)),g==="missing_receipts"&&Y.trackMissingReceiptsPage(C.month,C.year,w,t.missingReceipts.transactions.length,A??null),g==="je_schedules"&&Y.trackMonthCloseScheduleListPage(C.month,C.year,w,t.jeSchedules.pendingReviewSchedules.length,t.jeSchedules.resolveSchedules.length,(b=>{const p={accruedCount:0,fixedAssetsCount:0,oneTimeAccrualCount:0,prepaidCount:0};return b.forEach((u=>{if(ls(u))p.oneTimeAccrualCount+=1;else switch(rs(u)){case"prepaid_expenses":p.prepaidCount+=1;break;case"fixed_assets":p.fixedAssetsCount+=1;break;case"accrued_expenses":p.accruedCount+=1}})),p})(t.jeSchedules.pendingReviewSchedules),ti[P],A??null),g==="flux_analysis"&&Y.trackFluxAnalysisPage(C.month,C.year,w,ai(t.fluxAnalysis),A??null),g==="month_end_insights"&&t.auditSummary?.auditScorePercentage!=null&&Y.trackInsightsEmailPage(C.month,C.year,w,"draft",t.auditSummary.auditScorePercentage,null,A??null)}),[C,t,P]);return a.useEffect((()=>{(d!==T.fetchState||g!==i||g==="je_schedules"&&r!=null&&P!==r)&&T.fetchState==="Completed"&&E(!1)}),[g,T.fetchState,i,P,r]),E},ai=t=>t.sections.generalExpense.vendors.length+t.sections.reimbursement.vendors.length,{common:{strings:{hyphen:si,comma:En,space:oi}},dateFormat:$n}=dc.getLocalizedStrings(),vn=nc,ci=Va((function(t,s){const{uncategorizedAccounts:T,vendorSearchAutoCompleteData:g,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:i,companyId:d,isMissingReceiptsBulkUploadEnabled:P,isTransactionActivityEnabled:r,newScheduleActiveType:E}=s,w=et.getSignedInUser(),A=t.tenantState.currentTenantId,b={userId:w?.userId??"",sessionId:w?.zeniSessionId??"",tenantId:A??""},p=Fe(t),{selectedTransactionCategorizationTab:u}=p,{searchTransactionsResults:_,searchTransactionsFetchState:x}=Ss(t),S=E==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",{accountListNestedAccountHierarchy:h,classListNestedAccountHierarchy:l,allDepreciationAccountListNestedAccountHierarchy:q,newScheduleLocalData:N,saveStatus:L}=gs(t,S);return{expenseAutomationViewSelector:p,accountListNestedAccountHierarchy:h,allDepreciationAccountListNestedAccountHierarchy:q,baseTransactionSearchFetchState:x,baseTransactionSearchResults:_,classListNestedAccountHierarchy:l,newScheduleLocalData:N,initialSelectedBaseTransaction:N.selectedBaseTransactionId!=null?Cs(t.transactionState,fs(N.selectedBaseTransactionId)):void 0,newAccrualAccountsView:Is(t),newScheduleSaveStatus:L,bulkUploadSelector:P===!0?p.missingReceipts.bulkUpload:void 0,vendorSearchAutoCompleteData:g,authParams:b,receiptUploadEndpoint:`${Be.accountMicroServiceBaseUrl}`,transactionAttachmentsEndpoint:`${In}/transaction_attachments`,bulkUploadEndpoint:P===!0?`${Be.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`:void 0,isDisabled:!1,currentTab:u,selectedTransactionGroup:p.transactionView.selectedTransactionGroup,monthEndInsightsCustomerRequestData:C,monthEndInsightsPreviewMode:i,allThreadsSectionOpen:!1,enableMonthEndInsightsZeniGPTFeature:!1,loggedInUser:w,uncategorizedAccounts:T,companyId:d,isTransactionActivityEnabled:r,receiptsEmail:bs(t.tenantState,A),downloadParams:{authParams:b,jeScheduleEndPoint:`${In}/jeScheduleReports`,timezone:ks(),companyName:Ue(t).companyName}}}),(function(t,s){const{themeState:T,isAccountingClassesEnabled:g,isCOTEnabled:C,isMissingReceiptsBulkUploadEnabled:i,location:d,vendorSearchAutoCompleteData:P,expenseAutomationViewSelector:r,currentTenant:E,newScheduleActiveType:w,uncategorizedAccounts:A,navigate:b,onClickCustomerRequest:p,handleEditClick:u,closeSchedulePanel:_,isSchedulePanelOpen:x,openSchedulePanel:S,setActivityLogTransactionId:h}=s,{selectedPeriod:l,currentSelectedView:q,reconciliation:{selectedAccountId:N}}=r,{accountSettingsView:L}=r.jeSchedules,z=Fn(l),$=Ke(z.start),G=Ke(z.end);return{onZeniLogoClick:()=>{T.toggle()},onUploadReceiptAttachment:e=>{Y.trackMissingReceiptAttached(l.month,l.year),t(xo(e))},onUploadTransactionReceipt:(e,n,c,m,I,y)=>{t(mn(e,n,{fetchState:"In-Progress"}));const R=()=>t(mn(e,n,{fetchState:"Error"}));pc(`${Be.accountMicroServiceBaseUrl}/1.0/transactions/${n}/attachments`,y,n,c,m,I).then((V=>{V!=null?t(Ao(e,V)):R()})).catch(R)},onMissingReceiptsRowClick:(e,n)=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,n);const c=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"missing_receipts"}})},onUploadReceiptComplete:(e,n)=>{t(Po(e,n)),E!=null&&t(_e({tenantId:E.tenantId,period:n,refreshViewInBackground:!0}))},onUploadReceiptFetchStatus:(e,n,c,m)=>{t(vo(e,{fetchState:n,error:c})),c!=null&&t(ft({messageSection:"missing_receipts_attachment",messageText:"failed",type:"error",showStatusIcon:!0,variables:[{variableName:"__message__",variableValue:m!=null?oi+si+m+En:En}]}))},onUpdateJESchedulesUIState:e=>{const n=r.jeSchedules.uiState,c=e.selectedPageTab!=null&&e.selectedPageTab!==n.selectedPageTab,m=e.selectedJETypeFilter!==void 0&&e.selectedJETypeFilter!==n.selectedJETypeFilter;x===!0&&(c||m)&&_?.(),e.createdGroupCollapsed!=null?t(bo()):e.pendingGroupCollapsed!=null?t(To()):e.selectedJETypeFilter!==void 0?t(yo(e.selectedJETypeFilter)):t(Eo(e))},onUpdateMissingReceiptsUIState:e=>{t(ko(e))},onFetchMissingReceiptsList:()=>{G!=null&&$!=null&&t(Un({start:$,end:G},{amount:75,currencyCode:"USD",currencySymbol:"$"},!0,!1))},...i===!0?{onBulkUploadFiles:e=>{t(tc(e))},onBulkUploadProgress:e=>{t(ec(e))},onBulkUploadSuccess:e=>{t(Xo({batchId:e}))},onBulkUploadUploadedFileCount:e=>{t(Zo(e))},onConfirmBulkUploadMatch:(e,n,c,m,I)=>{t(Ko(e,n,c,m,I))},onBulkUploadConfirmMatchAcknowledged:()=>{t(Qo())},onSetBulkUploadResultsTab:e=>{t(Ho(e))},onSetBulkUploadCompletedSubTab:e=>{t(Yo(e))},onSetBulkUploadSortConfig:(e,n)=>{t(gn({sortKey:e,sortOrder:n}))},onClearBulkUpload:()=>{t(Wo())},onSearchTransactionsForManualMatch:(e,n)=>{t(vn(e,n??void 0))},onLoadMoreManualSearch:()=>{const{manualSearch:e}=r.missingReceipts.bulkUpload;e.nextPageToken!=null&&e.searchQuery!==""&&t(vn(e.searchQuery,e.nextPageToken))},onFetchCompletedTransactions:(e,n)=>{t(Jo(e,n))},onClearBulkUploadBatchDetailsForScopeChange:()=>{t(No())},onFetchBulkUploadBatches:e=>{t(Vn(e))},onFetchMoreBatchDetails:()=>{t(qo())},onResetBulkUploadSort:()=>{t(gn({sortKey:void 0,sortOrder:void 0}))}}:{},onClearMissingReceiptsTabNavigation:()=>{t(Io())},onSearchTextChanged:e=>{const n=r.currentSelectedView,c=r.selectedTransactionCategorizationTab;n==="transaction_categorization"&&(t(pt({selectedTab:c,uiState:{searchString:e}})),G!=null&&$!=null&&t(he(c,{start:$,end:G},!0,!1,e,void 0,!1,!0)))},onFiltersChange:e=>{const n=r.selectedTransactionCategorizationTab;t(fo({filters:e,selectedTab:n}))},onRefresh:()=>{s.trackExpenseAutomationTabAnalytics(!0),t(Co())},onClose:()=>{q==="reconciliation"&&N!=null&&t(un({selectedAccountId:void 0})),b("../")},onBack:()=>{q==="reconciliation"&&N!=null&&t(un({selectedAccountId:void 0}))},onSaveReconciliation:e=>{t(go(e))},onSaveReconciliationReview:e=>{t(So(e))},onUpdateStep:e=>{const{selectedPeriod:n}=r,c=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../${e}/${n.month}-${n.year}`,{state:{pathnameStackToGoBack:c,referrer:r.currentSelectedView}}),t(Bn(e))},handleLogOutClick:()=>{const e=ne(d.state?.pathnameStackToGoBack,d.pathname);b("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},onJeAccountSettingsChange:e=>{const{vendorsAccountSection:n}=e,{prepaidExpensesAccount:c,fixedAssetsAccount:m,accruedExpensesAccount:I}=n,y=ht(L.prepaidExpensesAccountList,c.selectedOptions),R=ht(L.fixedAssetsAccountList,m.selectedOptions),V=ht(L.accruedExpensesAccountList,I.selectedOptions),W={selectedPrepaidExpensesAccountIds:y.map((K=>K.accountId)),selectedFixedAssetsAccountIds:R.map((K=>K.accountId)),selectedAccruedExpensesAccountIds:V.map((K=>K.accountId))};t(ho({data:W}))},onSaveJeAccountSettingsClick:()=>{t(po())},onJESchedulesFormDataChange(e,n){const{jeScheduleID:c,accumulatedDepreciationCategory:m,scheduleClass:I,scheduleExpenseCategory:y,vendor:R}=n,{allAccountList:V,allClassList:W,allDepreciationAccountList:K}=r.jeSchedules,se=P.entityAutoCompleteView.vendor.length>0?P.entityAutoCompleteView.vendor.find((J=>J.id===R?.selectedOption)):void 0,D={id:se?.zeniId??R?.selectedOption??"",name:se?.name??R?.defaultOptions.find((J=>J.value===R?.selectedOption))?.label??"",logo:se?.logo},Te=y?.selectedOption!=null?V.find((J=>J.qboId===y.selectedOption)):void 0,ue=I?.selectedOption!=null?W.find((J=>J.classId===I.selectedOption)):void 0,ye=m?.selectedOption!=null?K.find((J=>J.qboId===m.selectedOption)):void 0;t(mo({scheduledJournalEntryID:e,localData:{jeScheduleID:c,scheduledJournalEntryID:e,updatedCategoryId:Te?.accountId,updatedClassId:ue?.classId,updatedAccumulatedDepreciationCategoryID:ye?.accountId,updatedVendor:{id:D.id,name:D.name}}}))},onRevertJeSchedule(e,n,c,m,I){t(uo(e,n,c,m,I))},ignoreRecommendedJeSchedule(e,n,c,m){t(ro(e,n,c,m))},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(lo({scheduledJournalEntryID:e,jeScheduleTransactionKey:n}))},clearJeScheduleLocalData(){t(io())},onViewTransaction(e){if(s.tenantEmailDomain==null)return;const n=Lc(e,s.tenantEmailDomain),c=ne(s.location.state?.pathnameStackToGoBack,`${s.location.pathname}${s.location.search}`);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",origin:"je_schedules"}})},onSearchBaseTransaction(e){t(co({query:e,scheduleType:w==="prepaid_expenses"?"prepaid_expenses":"fixed_assets"}))},onNewScheduleFormChange(e,n){const c=bt(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:m,allDepreciationAccountList:I}=r.jeSchedules,y=n.selectedAccount!=null?m.find((V=>V.qboId===n.selectedAccount)):void 0,R=n.selectedAccumulatedDepreciationCategory!=null?I.find((V=>V.qboId===n.selectedAccumulatedDepreciationCategory)):void 0;t(dn({scheduleType:c,localData:{...n,selectedAccount:y?.accountId,selectedAccumulatedDepreciationCategory:R?.accountId}})),t(oo({scheduleType:c}))},onCreateAccruedSchedule(e){const n="accrued_expenses";t(eo()),t(to()),t(no({scheduleType:n,localData:e,selectedJeScheduleDetailId:void 0})),t(ao({scheduleType:n})),t(so(n,void 0))},onCreateOneTimeAccrual(e){t(Xs(e))},handleJeScheduleClick:(e,n,c)=>{if((function(I,y){return y!=="accrued_expenses"})(0,c)&&t(_n({selectedJEScheduleKey:n})),S!=null&&zn(c))return void S(e,c,n);const m=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../../vendors/schedules/${c}/details/${e}`,{state:{pathnameStackToGoBack:m,message:"expenseAutomation",origin:"je_schedules"}})},onOneTimeAccrualFeedback:(e,n,c,m)=>{t(n!=="revert"?Zs(e,c,m):Ks(e,c,m))},onOneTimeAccrualClick:e=>{if(S!=null)return void S(e,"one_time_accrual");const n=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../../vendors/schedules/one_time_accrual/details/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"je_schedules"}})},improveMonthEndInsightsUsingZeniGPTClick:e=>{E!=null&&t(Qs(e,E.companyId,E.tenantId))},onClickCustomerRequest:p,setActivityLogTransactionId:h,onCloseAllThreadsSection:()=>{},onCloseFileAttachmentSnackBar:()=>{t(Hs())},onOpenFileAttachmentSnackBar:()=>{t(ft({messageSection:"cockpit_month_end_email_attachment_upload",messageText:"failed",type:"error",showStatusIcon:!0}))},onRemoveFileAttachment:e=>{t(Ys(e))},onUpdateFileAttachment:e=>{t(Ws({files:e}))},previewMonthEndReport:(e,n,c,m,I)=>{E!=null&&t(rn(e,E.companyId,n,!0,c,m,{agentInsightEdits:I,tenantId:E.tenantId}))},saveMonthEndReport:(e,n,c,m,I)=>{E!=null&&t(rn(e,E.companyId,n,!1,c,m,{agentInsightEdits:I,tenantId:E.tenantId}))},onEditMonthEndInsightsClick:u,sendMonthEndReport:e=>{const n=d.state?.referrer,{selectedPeriod:c,auditSummary:m}=r;E!=null&&m?.auditScorePercentage!=null&&(t(Ns(E.companyId,e,E.tenantId)),Y.trackInsightsEmailPage(c.month,c.year,!1,"draft",m.auditScorePercentage,Js().format($n.analytics.MMMDDCommaYYYYformat),n??null))},onTransactionCategorizationRowClick:(e,n)=>{const c=r.transactionView.uiState.searchString??"",m=r.transactionView.transactions,I=m.findIndex((V=>V.id===e)),y=c.length>0?{resultPosition:I>=0?I+1:void 0,resultsCount:m.length,searchTerm:c}:void 0;if(s.openTransactionPanel)return void s.openTransactionPanel(e,n,y);const R=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../../transaction/${n}/${e}`,{state:{pathnameStackToGoBack:R,message:"expenseAutomation",origin:"transaction_categorization",searchContext:y}})},setLocalDataForCategoryAndClass:(e,n,c,m,I,y,R,V,W,K,se,D)=>{t(qs(e,n,c,m,A,I,y,R,V,W,K,se,D))},onCancelAutoComplete:()=>{t(Ne("common"))},updateExpenseAutomationReconListScrollPosition:e=>{t(cn({scrollPosition:e}))},onUpdateTab:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t(he(e,{start:$,end:G},!1,!1)),t(Gs(e)))},onUpdateTransactionCategorizationCompletedSubTab:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t($s(e)),t(he("autoCategorized",{start:$,end:G},!1,!1)))},onTransactionGroupChange:e=>{s.closeSidePanel?.(),G!=null&&$!=null&&(t(zs(e)),t(he(s.expenseAutomationViewSelector.selectedTransactionCategorizationTab,{start:$,end:G},!1,!1)))},onUpdateTransactionCategorizationUIState:(e,n)=>{t(pt({selectedTab:e,uiState:n})),G!=null&&$!=null&&t(he(e,{start:$,end:G},!1,!1,n.searchString,null,!0))},onUpdateScrollYOffSetTransactionCategorizationUIState:(e,n)=>{t(pt({selectedTab:e,uiState:n}))},onFetchTransactionCategorizationList:(e,n,c,m,I,y)=>{G!=null&&$!=null&&t(he(e,{start:$,end:G},!0,c,n,m,I,y))},resetTransactionCategorizationLocalData:(e,n,c,m,I,y,R)=>{t(Ls(e,n,c,m,R??null,I,y,!1)),xc(t,n.map(String))},updateSelectedVendorForTransaction:(e,n,c,m,I)=>{t(ln({selectedTab:e,transactionId:n,lineId:c,selectedTransaction:m,uncategorizedAccounts:A,updatedVendor:I,isAccountingClassesEnabled:g}))},onSaveUpdateTransactionCategorization:(e,n,c)=>{const m=d.state?.referrer;e==="autoCategorized"?Y.trackTransactionsAutoCategorisedPage(l.month,l.year,r.transactionView.totalCountByTab.autoCategorized,n.length,!1,m??null):Y.trackTransactionsReviewPage(l.month,l.year,r.transactionView.totalCountByTab.review,n.length,!1,m??null),t(js(e,n,c)),Ac(n.map(String))},onUpdateSelectedCheckboxTransactionIds:(e,n)=>{t(Ms({selectedTab:e,transactionIds:n}))},onFetchRecommendationsForEntityCategorizationWithCustomer:(e,n,c,m,I,y)=>{const{transactionId:R,transaction:V,lineIds:W}=n;y!=null&&t(Vs({transactionId:R,customerUpdates:y})),t(Os({selectedTab:m,transactionId:R.id,lineId:W[0],selectedTransaction:V,uncategorizedAccounts:A,updatedCustomer:y,selectedEntity:I,isAccountingClassesEnabled:g})),I!=null&&t(kt({entity:I,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:m,isFetchCOT:C}))},onFetchRecommendationsForEntityCategorization:(e,n,c,m,I,y)=>{const{transactionId:R,transaction:V,lineIds:W}=n;y!=null&&(t(Fs({transactionId:R,vendorUpdates:{name:y.name,id:y.id?y.id:void 0}})),t(Bs({vendorId:y.id?y.id:void 0,localData:{vendorName:y.name,vendorId:y.id?y.id:void 0}}))),y?.id?(t(ln({selectedTab:m,transactionId:R.id,lineId:W[0],selectedTransaction:V,uncategorizedAccounts:A,updatedVendor:y,selectedEntity:I,isAccountingClassesEnabled:g})),I!=null&&t(kt({entity:I,amount:e,transactionDetails:n,flowType:"categorization",selectedTab:m,isFetchCOT:C}))):t(Us({selectedTab:m,transactionId:R.id,lineId:W[0]}))},fetchFluxViewOnScroll:(e,n)=>{t(Ye(e,!0,!1,n,!1,!0))},onFetchFluxViewList:()=>{t(Ye(l,!0,!1,null,!1,!1))},markAsReview:(e,n,c,m)=>{Y.trackFluxAnalysisReviewed(c.month,c.year,m??!1,e),t(_s(n,e,c,m??!1))},onUpdateFluxAnalysisUIState:e=>{t(Ds(e))},updateOperatingExpensesIdsForReview:e=>{t(Rs({operatingExpenseIds:e,selectedPeriod:l}))},redirectToVendorDetailPage:e=>{if(s.tenantEmailDomain!=null){const n=jc(e.id,e.qboId,s.tenantEmailDomain),c=ne(s.location.state?.pathnameStackToGoBack,s.location.pathname);s.navigate(n,{state:{pathnameStackToGoBack:c,message:"expenseAutomation",referrer:"Vendor List",origin:"flux_analysis"}})}},updateSectionIdsForReview:e=>{t(ws({sectionId:e,selectedPeriod:l}))},onFetchReimbursementView:(e,n,c)=>{t(Ye(e,!0,!1,n,!0,c))},onReviewClicked:e=>{t(de(l,e))},setOpenDrawerClicked:e=>{t(Qe({selectedDrawerAccountId:e}))},onFetchLinkTokenClick:(e,n)=>{t(wn("expense_automation_reconcile",e,n))},onEstablishConnectionClick:(e,n)=>{const c=E?.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(Qe({selectedDrawerAccountId:e})),t(Je({accountId:e,selectedPeriod:l,localData:{accountSource:"bank_statement"}})),t(We({statementUploadChosen:!0}))},onReloadReconciliationListPage:()=>{t(de(l,void 0,!0,!1))},onUpdateReconcileTabLocalData:e=>{t(xs({selectedTransactionIds:e}))},onReconTabColumnSortConfigChanged:(e,n)=>{t(As({sortKey:e,sortOrder:n}))},onReconReviewTabColumnSortConfigChanged:(e,n)=>{t(Ps({sortKey:e,sortOrder:n}))},onReconTabUpdate:e=>{s.closeSidePanel?.(),t(vs({selectedTab:e}))},updateReconReviewTabLocalData:(e,n,c)=>{const m=e.vendor?.id;c&&m!=null&&t(ys(m)),t(Es({data:e,transactionId:n}))},onReconMatchedTransactionClick:e=>{if(s.openTransactionPanel)return void s.openTransactionPanel(e,It("bill"));const n=ne(d.state?.pathnameStackToGoBack,d.pathname);b(`../../transaction/bill/${e}`,{state:{pathnameStackToGoBack:n,message:"expenseAutomation",origin:"reconciliation"}})},onReloadPage:()=>{window.location.reload()},onBackClick:()=>{b(-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(Ts({nodeId:e,collapsed:n}))},updateSectionCollapseStatus:()=>{},onExcludeAccountFromReconciliation:e=>{t(An({accountId:e}))},onIncludeAccountIntoReconciliation:e=>{t(xn({accountId:e}))}}}),((t,s,T)=>{const{isMissingReceiptsBulkUploadEnabled:g,...C}=T;return(function(i,d,P){return{...i,...d,...P,onUploadTransactionReceipt:(r,E,w,A,b)=>{d.onUploadTransactionReceipt(r,E,w,A,b,i.authParams)}}})(t,s,C)}))(uc(mc)),St="newScheduleMode",gt="newScheduleType",ii=Xc(Gc((function(t){const s=t.displayName??t.name??"Component",T=Pn.memo(t),g=C=>{const i=Se(),d=(function(){const S=Se(),h=F((l=>Fe(l).reconciliation.selectedDrawerAccountId));return{isOpen:h!=null,selectedAccountId:h,openPanel:a.useCallback((l=>{S(Qe({selectedDrawerAccountId:l}))}),[S]),closePanel:a.useCallback((()=>{S(Qe({selectedDrawerAccountId:void 0}))}),[S])}})(),P=F((S=>Fe(S).reconciliation)),r=F((S=>Ue(S))),E=a.useCallback(((S,h)=>{i(wn("expense_automation_reconcile",S,h))}),[i]),w=a.useCallback(((S,h)=>{const l=r?.companyId;l!=null&&(i(Rn(S,l,"expense_automation_reconcile",void 0,"link_account_no_microdeposit",h)),i(Dn({accountId:h,connectionInProgress:!0})))}),[i,r?.companyId]),A=a.useMemo((()=>{if(d.isOpen&&d.selectedAccountId!=null)return f.jsx(Wc,{reconciliation:P,selectedDrawerAccountId:d.selectedAccountId,onClose:d.closePanel,onFetchLinkTokenClick:E,onEstablishConnectionClick:w})}),[d.isOpen,d.selectedAccountId,d.closePanel,P,E,w]),b=a.useMemo((()=>({reconPanelContent:A,reconSidePanelIsOpen:d.isOpen,closeReconSidePanel:d.closePanel})),[A,d.isOpen,d.closePanel]),{useFeatureGate:p}=Ze(),{isFeatureEnabled:u}=p(Q.isReconV3Enabled),_=a.useContext(fn),x=a.useMemo((()=>d.isOpen?u===!0?{selectedItemId:d.selectedAccountId}:{closePanel:d.closePanel,selectedItemId:d.selectedAccountId}:_),[d.isOpen,d.closePanel,d.selectedAccountId,_,u]);return f.jsx(fn.Provider,{value:x,children:f.jsx(T,{...C,...b})})};return g.displayName=`withReconSidePanel(${s})`,g})((({closeSidePanel:t,openTransactionPanel:s,panelContent:T,sidePanelIsFullView:g,sidePanelIsOpen:C,reconPanelContent:i,reconSidePanelIsOpen:d,closeReconSidePanel:P,isSchedulePanelOpen:r,closeSchedulePanel:E,openSchedulePanel:w,schedulePanelContent:A,schedulePendingDiscardConfirmation:b})=>{const{isAiCfoOpen:p,setIsAiCfoOpen:u}=hc(),_=Sc(),{isOpen:x}=gc(),S=Tt(),h=Xe(),l=Se(),{isAiCfoAccessEnabled:q,onAskAiCfoClick:N}=Ln({mobileExploreReferrer:"Transaction categorization"}),L=a.useCallback((()=>{C===!0&&g!==!0&&t?.()}),[t,C,g]),{areTenantIdsInSync:z}=On(),$=ni(),G=Cc(),[e,n]=a.useState(!1),[c,m]=Oa(),I=a.useCallback((o=>{m((v=>{const j=new URLSearchParams(v);return o==null?(j.delete(St),j.delete(gt),j):(j.set(St,o.scheduleDetailsMode),j.set(gt,o.scheduleType),j)}),{replace:!0})}),[m]),[y,R]=a.useState(void 0),V=a.useCallback(((o,v,j)=>{const M=bt(o);R(M),I({scheduleDetailsMode:v,scheduleType:o}),l(pn({scheduleType:M==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:j}))}),[l,I]),W=a.useMemo((()=>{const o=c.get(St),v=c.get(gt);return o!=null&&v!=null?{scheduleDetailsMode:o,scheduleType:v}:void 0}),[c]),K=a.useCallback((o=>{I(o),o!=null&&l(pn({scheduleType:bt(o.scheduleType)==="prepaid_expenses"?"prepaid_expenses":"fixed_assets",shouldResetEnteredData:!0}))}),[l,I]),se=F((o=>sn(o))),D=F((o=>Ue(o))),[Te,ue]=a.useState(!1),[ye,J]=a.useState(!1),[tt,Ee]=a.useState([]),[X,ie]=a.useState(null),ee=a.useCallback((()=>{ie(null)}),[]),ve=X?.contentType==="activity"?X.detail.transactionId:void 0,k=a.useCallback((o=>{o!=null?(p&&u(!1),_(),L(),ie({contentType:"activity",detail:{transactionId:o}})):ie((v=>v?.contentType==="activity"?null:v))}),[L,p,_,u]),Z=a.useCallback((o=>{p&&u(!1),_(),L(),ie({contentType:"transfer",detail:o})}),[L,p,_,u]),oe=a.useCallback((()=>{_(),ee(),L(),N()}),[L,ee,N,_]),ge=a.useRef(p);a.useEffect((()=>{p===!0&&ge.current===!1&&(_(),ee(),L()),ge.current=p}),[L,ee,p,_]);const Ce=a.useRef(x);a.useEffect((()=>{x===!0&&Ce.current===!1&&(p&&u(!1),ee(),C===!0&&g!==!0&&t?.()),Ce.current=x}),[ee,t,x,p,u,g,C]);const Ve=C===!0&&g!==!0,yt=a.useRef(Ve);a.useEffect((()=>{Ve&&!yt.current&&(p&&u(!1),_(),ee()),yt.current=Ve}),[ee,p,Ve,_,u]);const[Et,Gn]=a.useState(!1),vt=a.useRef(!1),{selectedTab:Pt}=Ct(),{tenantEmailDomain:nt}=Ct(),[at,At]=a.useState(h.state?.message==="comingFromTransactionDetail"),xt=h.state?.message==="comingFromOverview",qn=fc(),st=et.getSignedInUser(),{useFeatureGate:ce}=Ze(),{isFeatureEnabled:wt}=ce(Q.isRealtimeInsightsFeatureEnabled),{isFeatureEnabled:Pe}=ce(Q.isMissingReceiptsBulkUploadEnabled),{isFeatureEnabled:ot}=ce(Q.isTransactionActivityEnabled),{isFeatureEnabled:Nn}=ce(Q.isAccrualEnabled),{isFeatureEnabled:Rt}=ce(Q.isCreateTransferEntryFromExpenseEnabled),{isFeatureEnabled:Jn}=ce(Q.isExpenseAutomationCommentingEnabled),{isFeatureEnabled:Wn}=ce(Q.isProjectsTransactionsEnabled),{isFeatureEnabled:Yn}=ce(Q.isReconV3Enabled),Hn=a.useCallback((o=>{const v=It(o.transactionType??(o.view==="reconciliation"?"bill":"expense")),j=ne(h.state?.pathnameStackToGoBack,h.pathname),M=new URLSearchParams({view:"full"});o.threadId!=null&&M.set("thread_id",o.threadId),o.entityType!=null&&M.set("entity_type",o.entityType),S(`/${nt}/transaction/${encodeURIComponent(v)}/${o.transactionId??o.entityId}?${M.toString()}`,{state:{pathnameStackToGoBack:j,message:"expenseAutomation"}})}),[S,nt,h.state,h.pathname]),Qn=F((o=>wo(o,"common"))),O=F((o=>Fe(o))),{categoryOptions:Kn,paymentAccountNames:Zn}=F((o=>Ro(o.accountState))),Xn=F((o=>Do(o.classState))),{monthEndCloseChecksView:H,currentSelectedView:B,selectedPeriod:U,selectedTransactionCategorizationTab:ct,currentSelectedViewBackgroundRefreshFetchState:ea,currentSelectedViewFetchState:le,jeSchedules:it,reconciliation:Dt}=O;wc(B==="transaction_categorization");const ta=O.transactionView.saveStatus.fetchState,Oe=O.transactionView.transactions,_t=a.useRef(Oe);_t.current=Oe;const Ft=F((o=>o.expenseAutomationTransactionsViewState?.transactionCategorizationView)),Bt=F((o=>o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab)),Ut=a.useRef(Ft);Ut.current=Ft;const Vt=a.useRef(Bt);Vt.current=Bt;const Me=F((o=>{const v=o.expenseAutomationTransactionsViewState?.selectedTransactionCategorizationTab;return v!=null?o.expenseAutomationTransactionsViewState?.transactionCategorizationView?.[v]?.filters:void 0})),Ot=a.useRef("");a.useEffect((()=>{if(B!=="transaction_categorization")return;const o=O.transactionView.uiState.searchString??"";if(le.fetchState!=="Completed"||o.length===0||o===Ot.current)return;Ot.current=o;const v=Me!=null?Ic(Me):0,j=Me?.categories.filter((M=>M.values.length>0&&String(M.values[0]??"").trim()!=="")).map((M=>`${M.field}:${M.values.join(",")}`))??[];Y.trackAiCloseTransactionSearch({filtersApplied:j,hasResults:Oe.length>0,isFiltered:v>0,resultsCount:Oe.length,searchTerm:o,searchType:"free_text"})}),[B,le.fetchState,O.transactionView.uiState.searchString,O.transactionView.transactions,Me]);const re=Rc(ta,(()=>{const o=[],v=Vt.current,j=Ut.current,M=j!=null&&v!=null?j[v]:void 0;if(M?.transactionReviewLocalDataById!=null)for(const Ie of Object.values(M.transactionReviewLocalDataById)){const te=Ie?.transactionReviewLocalData?.lineItemById;if(te!=null)for(const lt of Object.values(te)){const De=lt?.account;De?.accountId!=null&&o.push(De.accountId)}}const fe=_t.current;for(const Ie of fe)for(const te of Ie.lines??[])"account"in te&&te.account?.accountId!=null&&o.push(te.account.accountId);return o}));a.useEffect((()=>{B==="transaction_categorization"&&C!==!0||k(void 0)}),[B,k,C]),a.useEffect((()=>{d===!0&&P?.()}),[B,Dt.selectedAccountId]);const na=O.transactionView.selectedTransactionCategorizationCompletedSubTab,aa=O.transactionView.selectedTransactionGroup,je=`${ct}|${na}|${aa}`,Le=a.useRef(null),Mt=a.useRef(null);a.useEffect((()=>{Le.current!==null?Le.current!==je&&(Le.current=je,B==="transaction_categorization"&&ee()):Le.current=je}),[ee,B,je]);const sa=F((o=>ve==null?void 0:_o(o.transactionState,ve))),me=sa?.qboId,jt=F((o=>me==null?void 0:Fo(o,me)));a.useEffect((()=>{me!=null&&l(Bo(me))}),[l,me]);const{createTransferEntryStatus:Lt,creditCardTransferAccountsList:zt,transferAccounts:$t}=O.transactionView,Gt=a.useCallback((o=>Dc(l,o)),[l]),qt=a.useMemo((()=>B!=="transaction_categorization"||X==null?null:X.contentType==="activity"?ot===!0?f.jsx(kc,{activityLogView:jt,qboId:me,onClose:()=>ie(null),selectedTransactionId:X.detail.transactionId,isQuickViewCardStyle:!0},String(X.detail.transactionId)):null:X.contentType==="transfer"?f.jsx(bc,{createTransferEntryStatus:Lt,creditCardTransferAccountsList:zt,transaction:X.detail,transferAccounts:$t,onClose:()=>ie(null),onCreateTransfer:Gt,isQuickViewCardStyle:!0},String(X.detail.transactionId)):null),[B,X,ot,jt,me,Lt,zt,$t,Gt]),oa=qt!=null,{selectedAccountId:Ae}=Dt,Nt=He(it.accountSettingsView.saveState.fetchState),ca=F((o=>Uo(o.accountState,o.accountListState,"accountList"))),ia=F((o=>Vo(o))),xe=Pt!=null?Oo(Pt):B,la=F((o=>o.entityAutoCompleteState.autoCompleteText.common));if(Mn({isDataReady:le.fetchState==="Completed"}),st==null)throw Error("Can't access expense automation screen without signing in...");const Jt=Fn(U),we=Ke(Jt.start),Re=Ke(Jt.end);if(we==null||Re==null)throw Error(`Invalid start - ${we} and end - ${Re} period from given ${U}`);const ra=a.useCallback((()=>{ue(!1)}),[]),da=a.useCallback((()=>{J(!0)}),[]),ua=a.useCallback((o=>{Ee(o),J(!1)}),[]),ma=a.useCallback((()=>{Ee([])}),[]),ze=O.missingReceipts.bulkUpload.phase,Wt=O.missingReceipts.bulkUpload.currentBatchId;a.useEffect((()=>{Pe===!0&&B==="missing_receipts"&&ze==="matching"&&Wt!=null&&l(Vn({cacheOverride:!0}))}),[Pe,B,ze,Wt,l]);const Yt=st?.userId,pa=U.month,ha=U.year,Ht=D?.tenantId;a.useEffect((()=>{B==="missing_receipts"&&Pe!==!1&&ze==="idle"&&Yt!=null&&Ht!=null&&l(Mo())}),[B,Pe,ze,Yt,Ht,pa,ha,l]),a.useEffect((()=>{se.newVendorState?.vendorDetailLocalData?.vendorName!=null?n(!0):n(!1)}),[se.newVendorState?.vendorDetailLocalData?.vendorName]),a.useEffect((()=>{xe!=null&&B!==xe&&l(Bn(xe))}),[xe]),a.useEffect((()=>{Et===!1&&le.fetchState==="Completed"&&z&&(Gn(!0),l(hn(!1,!1)))}),[Et,le,z]),a.useEffect((()=>{const o={month:U.month,year:U.year},v=Mt.current;Mt.current=o,v===null||v.month===o.month&&v.year===o.year||!xt&&z&&(l(hn(!1,!1)),l(de(U,Ae,!1,!1)))}),[U.month,U.year,z]);const $e=a.useCallback(((o=!1,v=!1)=>{const j={start:we,end:Re};switch(B){case"transaction_categorization":l(he(ct,j,o,!at,void 0,void 0,v)),At(!1);break;case"flux_analysis":l(Ye(U,o,v,null));break;case"month_end_insights":if(v===!1){const M=new Date(U.year,U.month,0),fe=Lo(M.toDateString()).format($n.analytics.YYYYDashMMDashDDFormat);l(zo(!0,D.companyId,D.tenantId,fe)),l($o(D.companyId,D.tenantId))}break;case"je_schedules":l(jo(j,v));break;case"missing_receipts":l(Un(j,{amount:75,currencyCode:"USD",currencySymbol:"$"},o,v));break;default:l(de(U,Ae,o,v))}}),[B,we,Re,D.companyId,D.tenantId,ct,U,Ae,at,At]),Sa=a.useCallback((()=>{$e(!0,!0)}),[$e]);a.useEffect((()=>{B===xe&&le.fetchState==="Not-Started"&&z&&$e(!0)}),[le,we,Re,D.companyId,D.tenantId,z]),a.useEffect((()=>{xt||at||vt.current||ea.fetchState==="In-Progress"||le.fetchState!=="Completed"||(vt.current=!0,$e(!0,!0))}),[]),a.useEffect((()=>{H.fetchState!=="In-Progress"&&H.fetchState!=="Completed"&&H.fetchState!=="Error"&&D?.tenantId!=null&&l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!1}))}),[H.fetchState,D?.tenantId]),a.useEffect((()=>{H.fetchState!=="Completed"||!z||(H.monthEndCloseChecks?.monthEndCloseCheckList.some((o=>o.id==="reconciliation"))??!1)&&O.reconciliation.fetchStatus.fetchState==="Not-Started"&&l(de(U,void 0,!1,!1))}),[H.fetchState,z,U.month,U.year,O.reconciliation.fetchStatus.fetchState,l]),a.useEffect((()=>{O.monthEndInsights?.previewMonthEndReportStatus?.fetchState==="Completed"?ue(!0):ue(!1)}),[O.monthEndInsights?.previewMonthEndReportStatus?.fetchState]),a.useEffect((()=>{O.monthEndInsights?.sendMonthEndReportStatus?.fetchState==="Completed"&&z&&(l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!0})),l(Go({companyId:D.companyId})),S("../"))}),[O.monthEndInsights?.sendMonthEndReportStatus?.fetchState,D.tenantId,U,D.companyId,z]),a.useEffect((()=>{const o=setInterval((()=>{H.fetchState!=="In-Progress"&&H.fetchState==="Completed"&&l(_e({tenantId:D.tenantId,period:U,refreshViewInBackground:!0}))}),3e5);return()=>clearInterval(o)}),[H.fetchState,D.tenantId,U,l]),a.useEffect((()=>{const o=setInterval((()=>{B==="reconciliation"&&Ae==null&&O.reconciliation.fetchStatus.fetchState==="Completed"&&O.reconciliation.refreshStatus.fetchState!=="In-Progress"&&l(de(U,void 0,!0,!0))}),3e5);return()=>clearInterval(o)}),[B,l,O.reconciliation.fetchStatus.fetchState,O.reconciliation.refreshStatus.fetchState,de,Ae,U]);const ga=kn(),{isFeatureEnabled:Ca}=ce(Q.isRecommendationFeedbackEnabled),Qt=Tc(),{onRecommendationSelection:Kt,popup:fa}=_c({isEnabled:Ca}),Ia=a.useMemo((()=>({...Qt,onRecommendationSelection:Kt})),[Qt,Kt]);a.useEffect((()=>{const o=(H.monthEndCloseChecks?.monthEndCloseCheckList.find((v=>v.id==="month_end_insights"))?.isDisabled??!1)&&!wt;B!=="month_end_insights"||!o&&H.monthEndCloseChecks?.reportEmailSentDate==null||S("../")}),[B,H.monthEndCloseChecks]);const ka=d===!0?i:T,ba=d===!0||C===!0,Ta=d===!0?P:t;a.useEffect((()=>{Nt==="In-Progress"&&it.accountSettingsView.saveState.fetchState==="Completed"&&l(Sn())}),[Nt,it.accountSettingsView.saveState.fetchState,Sn]);const{transactionId:Zt,onSaveVendor:ya,onSaveSuccess:Ea,onCancel:va,vendorViewDetails:Pa}=(({expenseAutomationViewSelector:o,closeDrawerHandler:v,currentSelectedView:j})=>{const M=Se();let fe,Ie,te;const lt=kn(),De=o.transactionView;let Xt=()=>{};const{transactions:Aa,selectedTransactionId:ke,selectedTransactionLineId:Ge,transactionLocalData:xa}=De;if(j==="transaction_categorization"){const rt=xa.find((pe=>pe.transactionId===ke)),ae=Aa.find((pe=>pe.id===ke)),en=Ge!=null?rt?.transactionReviewLocalData?.lineItemById[Ge]:void 0,tn=en?.account;Ie=en?.class?.classId,fe=["Uncategorized Income","Uncategorized Expense"].includes(tn?.accountName??"")?void 0:tn?.accountId;const Ra=Mc(ke,ae?.typeOfTransaction);ae!=null&&Ra&&(te={id:ke,type:It(ae.typeOfTransaction)}),Xt=()=>{if(ke!=null&&Ge!=null&&ae!=null){const pe=De.transactionLocalData.find((qe=>qe.transactionId===ke))?.transactionReviewLocalData;if(pe!=null&&ae.lines!=null&&ae.lines.length>0){const qe=pe.lineItemById[Ge];let dt=pe.selectedEntity;if(hs(ae)||(dt=qe.selectedEntityLine),dt!=null){const Da=dt,_a={transactionId:{id:ae.id,type:ae.type},transaction:ae,lineIds:ae.lines.map((Fa=>Fa.id))??[]};M(kt({entity:Da,amount:qe.amount.amount,transactionDetails:_a,flowType:"categorization",selectedTab:o.selectedTransactionCategorizationTab,isFetchCOT:lt}))}}}}}const wa=F((rt=>sn(rt,void 0,fe,Ie)));return{transactionId:te,onSaveVendor:()=>{M(ps(te,void 0,!1,!0))},onSaveSuccess:Xt,onCancel:()=>{te!=null&&M(ds({transactionId:te})),M(us()),M(ms()),v()},vendorViewDetails:wa}})({expenseAutomationViewSelector:O,closeDrawerHandler:()=>{n(!1)},currentSelectedView:B});return qn?.loggedInUserRoleMap==null?H.fetchState==="Error"?f.jsx(yc,{onGoHome:()=>S("../",{replace:!0}),onReload:()=>window.location.reload()}):f.jsx(jn,{fetchState:"In-Progress"}):f.jsxs(f.Fragment,{children:[f.jsx(qc,{isOpen:ye,drawerLeftMargin:new Ec(0,0,300,650),onClose:()=>{J(!1)},children:f.jsx(li,{onClick:o=>o.stopPropagation(),children:f.jsx(ei,{companyId:D.companyId,closeCustomerRequestDrawer:()=>J(!1),addCustomerRequest:ua,resetCustomerRequest:ma})})}),Zt!=null&&e&&f.jsx(Fc,{isOpen:e,transactionId:Zt,onSaveVendor:ya,onSaveSuccess:Ea,onCancel:va,vendorViewDetails:Pa}),f.jsx(vc,{toolkit:Ia,children:f.jsx(ci,{events:[],eventCallback:(o,v,j)=>{},navigate:S,location:h,themeState:G,categoryOptions:Kn,classesForFilters:Xn,accountsForFilters:Zn,vendorSearchAutoCompleteData:{autoCompleteText:la,entityAutoCompleteView:Qn},expenseAutomationViewSelector:O,isMissingReceiptsBulkUploadEnabled:Pe,monthEndInsightsPreviewMode:Te,monthEndInsightsCustomerRequestData:tt,isRealtimeInsightsFeatureEnabled:wt,isCreateTransferEntryFromExpenseEnabled:Rt,isAccountingClassesEnabled:ia,isProjectsTransactionsEnabled:Wn,isCOTEnabled:ga,currentTenant:D,companyId:D.companyId,signedInUser:st,isTransactionActivityEnabled:ot,isRightPanelOpen:oa,rightSidePanel:qt,onOpenTransferRightPanel:Rt===!0?Z:void 0,uncategorizedAccounts:ca,newScheduleActiveType:y,isAccrualEnabled:Nn,newScheduleSelection:W,onNewScheduleSelectionChange:K,onScheduleTypeChange:V,onNewScheduleSaved:Sa,onClickCustomerRequest:da,handleEditClick:ra,tenantEmailDomain:nt,trackExpenseAutomationTabAnalytics:$,setActivityLogTransactionId:k,closeSidePanel:Ta,openTransactionPanel:s,closeSchedulePanel:E,openSchedulePanel:w,sidePanelIsOpen:ba,sidePanelIsFullView:d!==!0&&g,panelContent:ka,isAiCfoAccessEnabled:q,onAskAiCfoClick:oe,isExpenseAutomationCommentingEnabled:Jn,isReconV3Enabled:Yn,onExpenseAutomationCommentingThreadClick:Hn,sidePanelListPercent:d===!0?66:void 0,isSchedulePanelOpen:r,schedulePanelContent:A,schedulePendingDiscardConfirmation:b})}),fa,re.showPopup&&re.popupType!=null&&f.jsx(Pc,{popupType:re.popupType,currencySymbol:re.currencySymbol,accountId:re.popupAccountId??"",accountName:re.popupAccountName??"",onSubmit:re.handleSubmit,onDismiss:re.handleDismiss})]})})))),li=be(Ua)`
|
|
35
35
|
display: flex;
|
|
36
36
|
min-height: 100%;
|
|
37
37
|
flex-direction: column;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./liveblocks-C_WAhyd7.js";import{a as r}from"./sentry-lC29HHPj.js";import{aw as c,ax as l,q as p,a4 as f}from"./index-nXM19luG.js";import"./mui-BAsIRnB1.js";import m from"./NotFoundScreen-BHK2wcy4.js";import{h as u,g as b}from"./core-1xnf2RtE.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]="0558ec16-7d14-475c-91d0-925b0ae2f1dd",e._sentryDebugIdIdentifier="sentry-dbid-0558ec16-7d14-475c-91d0-925b0ae2f1dd")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=f(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=c(a.pathname);return o!=null?s.jsx(l,{menuItem:p(o),onDemoClick:t,onGoBack:d}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./sentry-
|
|
1
|
+
import{a as r}from"./sentry-lC29HHPj.js";import{u as l,h as m,g as p}from"./core-1xnf2RtE.js";import{hX as f,TP as g,TQ as _}from"./zeni-epic-state-BVNUxmav.js";import{u as h,L as b,z as y}from"./index-nXM19luG.js";import"./liveblocks-C_WAhyd7.js";import"./recharts-C2rsrRI6.js";import"./mui-BAsIRnB1.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.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]="ec601175-4065-42c0-8005-e7a1386e1045",e._sentryDebugIdIdentifier="sentry-dbid-ec601175-4065-42c0-8005-e7a1386e1045")}catch{}})();function R(){const e=l(),n=m(),o=p(),{setLoading:i,clearAllLoading:d}=h(),s=r.useRef(!1);return r.useLayoutEffect((()=>{i(b.CONNECTION_AUTH)}),[i]),r.useEffect((()=>{if(s.current)return;s.current=!0;const a=new URLSearchParams(o.search).get("code"),c=sessionStorage.getItem("hubspot_oauth_pending");if(sessionStorage.removeItem("hubspot_oauth_pending"),a!=null&&c!=null){const t=JSON.parse(c);e(f(t.tenant_id,t.connection_id,g("revenue"),_("hubspot"),{authorization_code:a,client_id:t.client_id,client_secret:t.client_secret,redirect_uri:t.redirect_uri}))}d();const u=y.getActiveTenantForUser();n(u?.tenantEmailDomain!=null?`/${u.tenantEmailDomain}/settings/integrations`:"/",{replace:!0})}),[]),null}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as s}from"./liveblocks-
|
|
1
|
+
import{m as s}from"./liveblocks-C_WAhyd7.js";import{j as d}from"./core-1xnf2RtE.js";import{fE as f}from"./zeni-epic-state-BVNUxmav.js";import"./sentry-lC29HHPj.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]="e40ea1f3-fe09-4e9c-a3dd-32e5cdf19438",e._sentryDebugIdIdentifier="sentry-dbid-e40ea1f3-fe09-4e9c-a3dd-32e5cdf19438")}catch{}})();const h=()=>d((e=>f(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-C_WAhyd7.js";import{a as r}from"./sentry-lC29HHPj.js";import{u as D,h as L,i as R,j as C,t as W,l as _,s as Z,g as J,N as B,n as ie,o as x}from"./core-1xnf2RtE.js";import{a8 as ln,h as p,aq as T,R as m,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 In,cl as Cn,cm as En,cn as kn,co as yn,p as Y,cp as xn,cq as bn,ae as se,cr as jn,cs as Pn,z as Ie,ct as Dn,cu as Ln,cv as An,cw as $n,cx as wn,cy as Fn,cz as Rn,cA as Tn,V as On,ai as ft,cB as _n,cC as Mn,cD as Nn,cE as Un,cF as De,cG as Bn,cH as Vn,cI as Zn,cJ as Hn,cK as qn,cL as Kn,t as Qe,l as St,cM as Qn,cN as zn,cO as Gn,cP as Wn,cQ as Jn,cR as Yn,cS as Xn}from"./index-nXM19luG.js";import"./mui-BAsIRnB1.js";import{A as K}from"./AddressScreen-Bej9zQot.js";import M from"./NotFoundScreen-BHK2wcy4.js";import{Z0 as ei,Z1 as ti,uP as ze,Z2 as Q,vg as ce,Z3 as Le,Z4 as z,vT as Ge,v_ as ni,w3 as ht,Z5 as Ae,Z6 as It,vX as Ct,Z7 as $e,vV as Et,yz as ii,vW as oi,vP as ai,xq as We,vf as Ce,Z8 as si,Z9 as kt,wa as ci,Za as G,wh as ri,Zb as li,Zc as yt,Zd as xt,yl as di,Ze as ue,Zf as Je,Zg as bt,vd as ui,Zh as gi,v7 as mi,Zi as vi,xD as pi,Zj as jt,xM as Ye,Zk as fi,xJ as Si,Zl as we,gg as hi,Zm as te,Zn as ne,ww as Ii,vl as Xe,Zo as Fe,vq as Pt,vo as Ci,vi as Ei,wp as ki,vs as yi,wy as xi,Zp as Ee,wF as Dt,wD as ke,Fo as Re,xS as et,Zq as bi,ve as Te,Zr as Oe,vB as ye,vy as xe,vL as Lt,vK as _e,vv as ji,vE as At,vN as oe,fE as Me,UP as $t,vh as Ne,vI as Pi,vJ as Di,vH as Li,Zs as Ai,wd as tt,wi as $i,we as wt,Zt as Ft,v1 as nt,Zu as wi,uZ as Rt,Zv as Fi,xY as Ri,y0 as H,xX as Ti,x4 as Ue,Zw as Oi,Zx as Tt,y9 as it,Zy as _i,y6 as Mi,Zz as Ot,x7 as Ni,x8 as V,xb as Ui,ZA as _t,xl as pe,ZB as Bi,wx as Mt,Tm as Nt,ZC as Vi,xv as Zi,ZD as Ut,ZE as Hi,ZF as qi,ZG as Ki,y_ as Qi,ZH as zi,ZI as Bt,yg as Vt,ZJ as Zt,yY as fe,ZK as Gi,yV as Wi,ZL as Ji,ZM as Yi,ZN as Xi,ZO as eo,ZP as to,ZQ as ot,ZR as no,e9 as io,z2 as oo,ZS as Be,wP as at,ZT as Ve,ZU as re,wZ as Ht,wU as qt,wS as be,ZV as ao,wK as so,ym as Kt,yN as st,yI as co,ZW as ro,yn as lo,ZX as uo,yO as go,yS as mo,ZY as vo,ZZ as Qt,c8 as po,mr as fo,ms as So,Z_ as ct,vU as le,gk as ho,my as Io,yF as zt,ze as Co,yC as Gt,ul as Eo,zb as rt,u9 as ko,z8 as lt,hR as yo,TP as dt,TQ as xo,FA as Wt,hJ as bo,Z$ as jo,UE as Po,_0 as Do,zk as Se,zl as Lo,_1 as Ao,_2 as Jt,zh as $o,_3 as wo,_4 as Fo,xz as Ro,_5 as To}from"./zeni-epic-state-BVNUxmav.js";import{M as Oo}from"./MobileAppDrawer-ezuGFNmX.js";import{q as de}from"./QBOConnectionScreen-IJewO3Tq.js";import"./recharts-C2rsrRI6.js";import"./analytics-N153TuwK.js";import"./plaid-dW1_MCaE.js";import"./dnd-DsH8jkrb.js";import"./stripe-cKAAJElX.js";import"./lottie-NIzYzhlS.js";import"./lexical-d2so_3As.js";import"./pdf-BKNPlqtE.js";import"./utils-BBaMea9r.js";import"./InboxNotificationsProvider-BU6hQETc.js";import"./useTaskManagerAccess-CCKD6ndI.js";import"./empty-GMcl-a5k.js";import"./pdf-lib-RqzDns79.js";import"./index-Ctq16f6K.js";import"./url-LYbpMOZt.js";import"./index-Dc3AC-iD.js";import"./decodeURIComponentSafe-DcD-XNVX.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]="78def842-33ce-4d43-8f0f-25bbc4e24880",n._sentryDebugIdIdentifier="sentry-dbid-78def842-33ce-4d43-8f0f-25bbc4e24880")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function N(...n){return n.some((e=>e==="Error"))}function _o(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:g,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b}=C(ei),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),y=`/${t??""}/invoicing`,I=r.useCallback(((A,U)=>{const O=ti(y,A,U,P);O!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{entity:A,entityId:U,fromScreen:"audit_log"}),e(O))}),[P,e,y]);r.useEffect((()=>{const A=setTimeout((()=>d(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&n(ze({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const j=g==="Not-Started"||g==="In-Progress"&&f.length===0,E=g==="In-Progress"&&f.length>0,w=g==="Completed";return N(g)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingAuditLogPage,isReady:w}),s.jsx(dn,{auditLogEntityRouteOptions:P,auditLogListSortFieldOptions:b,entries:f,hasMore:S,isLoading:j,isLoadingMore:E,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&h!=null&&n(ze({cursor:h,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function ge(n,e=!1){const t=D(),i=C((c=>Q(c).productNextCursor!=null)),a=C((c=>Q(c).productNextCursor)),o=C((c=>Q(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&o!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&o!=="In-Progress"&&i&&a!=null&&t(ce({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,o,i,a])}const Mo=new Set(["plan"]),Yt=[],No=It((n=>n.length>0?n:Yt),mn),Uo=It((n=>n.length>0?n:Yt),gn),Bo=_((function(n,e){const{view:t}=e;return{applicableItemOptions:t.applicableItemOptions,groupedAccountOptions:No(t.qboAccountHierarchy),groupedClassOptions:Uo(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&n(Ct({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&n(Ae({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&n(ni({action:o,id:a,parentItemId:i}))}}}))(un);function Vo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=(d=a.get("kind"))!=null&&Mo.has(d)?d:"plan";var d;const l=C((k=>Le(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(Ge({id:t,kind:c}))}),[o,t,c,n]);const[g,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(z()),n(Ge({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed";ge(o,!0);const[h,P]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&P(t)}),[t,f]);const b=h!==t&&(u==="Not-Started"||u==="In-Progress");return N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Bo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:b,view:l},g)]})}function Ze(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=n,o=D(),{areTenantIdsInSync:c}=T(),d=C($e),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(Et()),t&&o(ii()))}),[c,o,e,t,a]),r.useEffect((()=>{e&&c&&l&&i&&o(oi())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Zo=new Set(["addon","charge","plan"]),Ho=new Set(["plan"]),qo=_((function(n,e){const t=Le(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:a}=e,o=a!=null?`${t}/catalog/${encodeURIComponent(a)}`:`${t}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemFormCancelled),n(z()),e.navigate(`${t}/catalog`)},onChange:c=>{n(Ae({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:a}))}}}))(vn);function Ko(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=R(),[a]=W(),{areTenantIdsInSync:o}=T(),c=t!=null,d=a.get("type"),l=d!=null&&Zo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Ho.has(u)?u:"plan";var u;const g=C((S=>Le(S,t)));return ge(o,!0),Ze({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{o&&t!=null&&n(ai({id:t,kind:v}))}),[o,t,v,n]),r.useEffect((()=>{c||l==null||g.localData.catalogType===l||n(Ae({localData:{...g.localData,catalogType:l}}))}),[c,l,g.localData?.catalogType,n]),r.useEffect((()=>{if(g.fetchState==="Completed"){const S=g.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(z())}}),[g.fetchState,g.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogItemFormPage}),s.jsx(qo,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Qo={addons:"addon",all:"item",charges:"charge",plans:"plan"},zo=_((function(n,e){const t=Q(n),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?t.plans:a?[...t.plans,...t.products]:t.products,c=i||a&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:a&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Qo[e.activeTab];p.trackInvoicingActionClick(m.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(Ct({action:si(d),id:c}))},onLoadMore:()=>{if(a)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})));o!=null&&n(i?Ce({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function Go(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,g]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),P=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),b=C((A=>Q(A))),k=b.planFilters.search,y=b.planSort,I=b.planNextCursor,j=b.productNextCursor,E=b.fetchState==="Completed",w=b.runningActionId??null;return r.useEffect((()=>{const A=setTimeout((()=>v(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&n(We({cacheOverride:!1,planFilters:h,productFilters:P,planSort:S,productSort:S}))}),[i,n,h,P,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==y?.field||S?.dir!==y?.dir)&&n(We({cacheOverride:!0,planFilters:h,productFilters:P,planSort:S,productSort:S}))}),[k,y,i,n,h,P,f,S]),N(b.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCatalogPage,isReady:E}),s.jsx(zo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:a,sortState:u,planFilters:h,productFilters:P,sort:S,planNextCursor:I,productNextCursor:j,runningCatalogItemActionId:w,onSearchChange:o,onTabChange:d,onSortChange:g})]})}const Wo=_((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,a=i!=null?"edit":"create",o=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponFormCancelled),n(G()),e.navigate(`${t}/discounts`)},onChange:c=>{n(li({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCouponSaved,{mode:a}),n(ri({id:i}))}}}))(fn);function Jo(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,savedCouponId:c}=C((d=>kt(d,t)));return r.useEffect((()=>{a&&t!=null&&n(ci({id:t}))}),[a,t,n]),r.useEffect((()=>{if(o==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(G())}}),[o,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCouponFormPage}),s.jsx(Wo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Yo=_((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(m.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:a=>{e(bt(a))},onSubmit:()=>{const a=gi(n.localData);p.trackInvoicingActionClick(m.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(mi(a))}}}))(hn);function Xo(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),[i]=W(),{areTenantIdsInSync:a}=T(),o=i.get("customerId"),c=C((I=>yt(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=C(xt),g=C((I=>di(I))),S=C(ue),f=g.fetchState==="Not-Started"||g.fetchState==="In-Progress"&&u==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,P=f||h,b=g.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(Je()),()=>{n(Je())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:o})))}),[o,l,n]),r.useEffect((()=>{a&&n(ui({cacheOverride:!1}))}),[a,n]);const y=r.useRef(d);return r.useEffect((()=>{const I=y.current;if(y.current=d,I!=="Completed"&&d==="Completed"){const j=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(j)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreateInvoicePage,isReady:b}),P?s.jsx(Sn,{}):s.jsx(Yo,{navigate:e,tenantEmailDomain:t})]})}const ea=_((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(In);function ta(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>vi(d,t??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&t!=null&&n(pi({id:t}))}),[a,t,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(ea,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:o})]})}const na=_((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(m.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(Si({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Cn);function ia(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,creditNoteListFetchState:b}=C((y=>{const I=jt(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),Z),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(Ye({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCreditsListPage,isReady:k}),s.jsx(na,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(fi(y)),onSortChange:v})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},oa=_((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:a=>{n(Ee({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const a=Xt(e.tenantEmailDomain??"",ke,i),o=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerEdited,{customerId:i}),n(Ee({id:i,localData:a})),n(Dt({id:i}))},onFetchPaymentLinkEmailPreview:a=>n(xi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>n(yi({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)}}}))(yn);function aa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((O=>we(O,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[g,S]=r.useState(!1),[f,h]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&h(i)}),[i,c.record.fetchState]);const P=f===i,{plaidTokenFetchState:b,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:y,setupIntentFetchState:I,stripeConnected:j}=c.record,E=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const O=c.record.sendLinkState.fetchState;E.current!=="Error"&&O==="Error"&&n(hi({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),E.current=O}),[n,c.record.sendLinkState.fetchState]);const w=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":y.fetchState==="Error"?y.error?.message??"Failed to save payment method.":b.fetchState==="Error"?b.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{o&&i!=null&&n(Ii({id:i}))}),[o,i,n]),r.useEffect((()=>{o&&i!=null&&j&&n(Xe({customerId:i}))}),[o,i,n,j]);const[A,U]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Fe()),i!=null&&n(Pt({id:i})),U((O=>O+1)))}),[c.fetchState,n,i]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(oa,{customerId:i??"",editView:c,hasLoadedRecord:P,location:t,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{n(te()),i!=null&&j&&n(Xe({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},A),s.jsx(En,{errorMessage:w,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:y.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:y.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:j,onChooseCard:()=>{i!=null&&n(Ei({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:O=>{i!=null&&n(Ci({customerId:i,data:O}))}}),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:g,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:O,description:ee})=>{i!=null&&n(ki({amount:O,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const sa=_((function(n,e){const t=we(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerFormCancelled),n(Fe()),n(Re(ke)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ee({id:i,localData:c}))},onOpenAddress:()=>{const c=Xt(e.tenantEmailDomain??"",ke,i),d=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerSaved,{mode:a}),n(Dt({id:i}))}}}))(xn);function ca(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),{fetchState:c,savedCustomerId:d}=C((l=>we(l,i)));return r.useEffect((()=>{o&&i!=null&&n(Pt({id:i}))}),[o,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),n(Fe())}}),[c,d,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomerFormPage}),s.jsx(sa,{customerId:i,location:t,navigate:e,tenantEmailDomain:a})]})}const ra=_((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(Te({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function la(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,customerListFetchState:b}=C((y=>{const I=ue(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),Z),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(et({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(et({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ra,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(bi(y)),onSortChange:v})]})}const je=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),da=_((function(n,e){const{filters:t,sessionId:i,view:a}=e,o=i==null?void 0:a.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:t,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:je(a,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=je(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",g=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!g;return{onBack:()=>a(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&n(xe({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&n(_e(o))},onRollback:S?()=>{o!=null&&n(Lt(o))}:void 0}}))(jn);function ua(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),[o,c]=r.useState({}),d=C(Oe),l=je(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{a&&t!=null&&n(ye(t))}),[a,n,t]),r.useEffect((()=>{if(!a||t==null)return;const f=setTimeout((()=>{n(xe({...o,sessionId:t}))}),300);return()=>clearTimeout(f)}),[a,n,o,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||t==null||!u)return;const f=setInterval((()=>{n(ye(t)),n(xe({...o,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[a,n,o,u,t]);const g=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;o.moduleId!=null&&f.set("module_id",o.moduleId),o.level!=null&&f.set("level",o.level),o.outcome!=null&&f.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&f.set("search",o.search.trim());const h=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${h===""?"":`?${h}`}`}),[o,t]),S=v?.fetch.fetchState??"Not-Started";return N(S)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(da,{downloadUrl:g,filters:o,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{}},ga=_((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:o}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,a=o=>{const c=o??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),n(_e(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),n(Lt(o))},onViewSession:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),t(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Pn);function ma(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(Oe);r.useEffect((()=>{i&&(n(ji()),n(At()))}),[i,n]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(ga,{navigate:e,tenantEmailDomain:t,view:a})]})}const va=_((function(n,e){const{activeId:t,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((g=>g.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:a?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:a?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((g=>g.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(m.Event.invoicingChargebeeConnectClicked),n(Li())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{t!=null&&n(_e(t))},onSaveLater:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportStarted),t!=null&&n(Di(t))},onUpload:o=>{p.trackInvoicingActionClick(m.Event.invoicingImportFileUploaded),n(Pi({files:o}))},onViewDetails:t==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Dn);function pa(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),a=C(xt),o=C(Me).companyId??Ie.getSignedInUserTenant(t??"")?.companyId,c=C((f=>$t(f,o))),d=C(Oe),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(Ne()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(en(h))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const g=u?.status,S=g==="scanning"||g==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ye(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{g==="done"&&(n(oe(null)),ae(t,null))}),[n,g,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDataImportMigratePage}),s.jsx(va,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const fa=_((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:a=>{n(wt({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingCouponEdited,{couponId:i}),n($i({data:a,id:i}))}}}))(Ln);function Sa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((h=>Ai(h,t))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const g=v===t;r.useEffect((()=>(n(G()),()=>{n(G())})),[n]),r.useEffect((()=>{a&&n(tt({id:t}))}),[a,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{o.fetchState==="Completed"&&(n(G()),n(tt({cacheOverride:!0,id:t})),f((h=>h+1)))}),[o.fetchState,n,t]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(fa,{hasLoadedRecord:g,couponId:t??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const ha=_((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(m.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,a)=>{n(wt({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function Ia(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,couponListFetchState:b,runningDiscountActionId:k}=C((I=>{const j=Ft(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,couponListFetchState:j.fetchState,runningDiscountActionId:j.runningActionId??null}}),Z),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(nt({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDiscountsListPage,isReady:y}),s.jsx(ha,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>n(wi(I)),onSortChange:v})]})}const Ca=_((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>n(H({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ea(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((E=>Fi(E,t??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,g]=r.useState(!1),[S,f]=r.useState(),[h,P]=r.useState(!1),b=r.useCallback((()=>{v("idle"),g(!1),f(void 0),P(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Ri({id:t})),v("idle"),g(!1);const E=o.emailPreview.preview;f(E==null?void 0:{body:E.body,cc:E.cc,subject:E.subject,to:E.to}),P(!0)}),[t,n,o.emailPreview.preview]),y=r.useCallback((E=>{t!=null&&l!=="pending"&&(g(!1),v("pending"),p.trackInvoicingActionClick(m.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:E,id:t})))}),[t,n,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&t!=null&&n(Ti({id:t}))}),[a,t,n]),r.useEffect((()=>{a&&d!=null&&n(Ue({invoiceId:d}))}),[a,d,n]),r.useEffect((()=>{v("idle"),g(!1),f(void 0),P(!1)}),[t]),r.useEffect((()=>{a||(v("idle"),g(!1),f(void 0),P(!1))}),[a]),r.useEffect((()=>{h&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(t!=null&&n(Oi({id:t})),b()):u&&o.actionState.fetchState==="Error"&&v("failed"):g(!0))}),[t,b,n,l,u,o.actionState.fetchState]);const j=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:o,dunningAttempts:j,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:b,onSend:y,open:h,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const ka=_((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(m.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||n(H({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ya(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,dunningCaseListFetchState:b}=C((y=>{const I=Tt(y);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),Z),k=b==="Completed";return r.useEffect((()=>{const y=setTimeout((()=>d(a)),300);return()=>clearTimeout(y)}),[a]),r.useEffect((()=>{i&&n(it({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(it({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingDunningListPage,isReady:k}),s.jsx(ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onStatusChange:y=>n(_i(y)),onSortChange:v})]})}const xa=_((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ui({data:{due_date:a.due_date!==""?a.due_date:void 0,notes:a.notes.trim()!==""?a.notes.split(`
|
|
2
|
+
`).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:a.po_number!==""?a.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))}}}))(Rn);function ba(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=C((g=>Ot(g,t??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{a&&t!=null&&n(Ni({invoiceId:t}))}),[a,t,n]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(xa,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const ja=_((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(m.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,a)=>{p.trackInvoicingActionClick(m.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function Pa(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,invoiceListFetchState:b,voidingInvoiceId:k}=C((I=>{const j=_t(I);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:j.nextCursor,invoiceListFetchState:j.fetchState,voidingInvoiceId:j.runningActionId}}),Z),y=b==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(pe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingInvoicesListPage,isReady:y}),s.jsx(ja,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{n(Bi(I)),n(pe({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v})]})}function ut(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=On(),a=ft(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=C(Nt),v=Vi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,g=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(Oo,{isAppContentDrawerOpen:o,handleDrawerToggle:g}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{n(Zi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{g(!0)}})]})}const Da=_((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:a=>{n(zi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Qi())}}}))(Mn);function La(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=C((f=>Ut(f,t??""))),u=`/${i}/invoicing`,g=r.useRef(null);r.useEffect((()=>{n(Hi()),g.current=null}),[n,t]),r.useEffect((()=>{a&&t!=null&&n(Ue({invoiceId:t}))}),[a,n,t]),r.useEffect((()=>{c!=null&&t!=null&&o==="Completed"&&g.current!==t&&(g.current=t,n(qi({localData:Ki(c)})))}),[n,o,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:m.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const Aa=_((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(m.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(m.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function $a(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=C((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(a))}),[i,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingOverviewPage,isReady:o}),s.jsx(Aa,{navigate:e,selectedPeriod:a,tenantEmailDomain:t})]})}const wa=_((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(m.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(Wi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function Fa(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:P,transactionListFetchState:b,transactions:k}=C((w=>{const A=Zt(w);return{activeType:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,transactionListFetchState:A.fetchState,transactions:A.transactions}}),Z),y=b==="Completed",I=`/${t}/invoicing`,j=r.useCallback((w=>{const A=k.find((O=>O.id===w)),U=A?.linkedInvoices?.[0]?.invoiceID??A?.invoiceID;U!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(U)}`))}),[e,I,k]),E=r.useCallback((w=>{const A=k.find((U=>U.id===w))?.customerID;A!=null&&(p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:A,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(A)}`))}),[e,I,k]);return r.useEffect((()=>{const w=setTimeout((()=>d(a)),300);return()=>clearTimeout(w)}),[a]),r.useEffect((()=>{i&&n(fe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(fe({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingPaymentsListPage,isReady:y}),s.jsx(wa,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,onSearchChange:o,onTypeChange:w=>{n(Gi(w)),n(fe({cacheOverride:!1,filters:g,sort:u}))},onSortChange:v,onViewTransactionCustomer:E,onViewTransactionInvoice:j})]})}const Ra=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id};function gt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=R(),{areTenantIdsInSync:a}=T(),o=t!=null&&t!=="",c=C(ue),d=C((E=>Ji(E))),l=C(Yi),v=C((E=>Ot(E,t??""))),u=v.invoice,g=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Xi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{a&&n(o&&t!=null?Ue({invoiceId:t}):Te({filters:{},keepExistingListItems:!1}))}),[a,n,t,o]),r.useEffect((()=>{o&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(eo({contextInvoiceId:t,localData:to(u)})))}),[n,u,t,v.fetchState,o]),r.useEffect((()=>{if(o)return;const E=d.localData.customerId;E!==""&&E!==f.current&&(f.current=E,n(Mt({filters:{customerId:E},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(ot({localData:{...d.localData,customerId:E,invoiceToLink:""}})))}),[n,d.localData,o]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const E=h.current;if(h.current=l.fetchState,E!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${g}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${g}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,g]);const P=r.useMemo((()=>c.customers.map((E=>({id:E.id,name:Ra(E)})))),[c.customers]),b=C((E=>no(E,d.localData.customerId))),k=r.useMemo((()=>b.map((E=>{return{amountDue:(w=E.amountDue,A=io.currencySymbol,Vn("0,0.00",w,A)),amountDueValue:E.amountDue,id:E.id,label:E.invoiceNumber};var w,A}))),[b]),y=r.useMemo((()=>{if(!o||u==null)return;const E=u.currencyCode??"USD",w=u.amountDue?.amount??0;return{amountDue:De("0,0.00",u.amountDue),amountDueValue:w,currencyCode:E,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${g}/invoices/${encodeURIComponent(t??"")}`:`${g}/payments`,j=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingRecordPaymentPage,isReady:j}),s.jsx(Bn,{customers:P,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:y,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingRecordPaymentCancelled),e(I)},onChange:E=>{n(ot({localData:E}))},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(oo(o?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}/`},Ta=(n,e)=>{if(n==null)return;const t=De("0,0",n);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ta(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Oa=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}),_a=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ma=_((function(n,e){const{editView:t}=e,i=t.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,coupons:t.coupons.map(_a),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(Oa),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",be,i),d=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Ht({id:i}))},onCancelSubscription:a?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Zn);function Na(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=R(),{areTenantIdsInSync:o}=T(),c=C((k=>Be(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,g=u==="Completed",[S,f]=r.useState(g?i:void 0);r.useEffect((()=>{i!=null&&g&&f(i)}),[i,g]);const h=S===i;ge(o),r.useEffect((()=>{o&&i!=null&&n(at({id:i}))}),[o,i,n]);const[P,b]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Ve()),n(at({cacheOverride:!0,id:i})),b((k=>k+1)))}),[c.fetchState,n,i]),N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionDetailPage,isReady:g}),s.jsx(Ma,{hasLoadedRecord:h,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},P)]})}const Ua=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},Ba=(n,e)=>{if(n==null)return;const t=De("0,0",n);return e!=null?`${t}/${e}`:t},Pe=(n,e,t)=>{const i=[n,Ba(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Va=n=>({label:Ua(n),value:n.id}),he=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Za=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:Pe(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Ha=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),qa=_((function(n,e){const t=Be(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(he).map((i=>({label:i.name??i.id,subtitle:Pe(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(he).map((i=>({label:i.name??i.id,subtitle:Pe(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Ha),customers:t.customers.map(Va),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(he).map(Za),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionFormCancelled),n(Ve()),n(Re(be)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{n(re({id:i,localData:o}))},onOpenAddress:()=>{const o=tn(e.tenantEmailDomain??"",be,i),c=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionSaved,{mode:a}),n(Ht({id:i}))}}}))(Hn);function Ka(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=R(),[o]=W(),{areTenantIdsInSync:c}=T(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=C((S=>ao(S,i))),u=C((S=>Be(S,i).localData));ge(c),r.useEffect((()=>{c&&(n(Te({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(so({id:i})))}),[c,i,n]);const g=r.useRef(!1);return r.useEffect((()=>{g.current||i!=null||d==null||d===""||u.customerId!==""||(g.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),n(Ve())}}),[l,v,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionFormPage}),s.jsx(qa,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Qa=_((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=(a,o,c)=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),n(qt({action:o,id:a,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(m.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(m.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(a,o)=>{const c=o?.trim()??"";c!==""&&i(a,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(a,o,c)=>{o!=="pause"?i(a,o):i(a,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(lo({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),g=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:P,subscriptionListFetchState:b,runningActionSubscriptionId:k}=C((j=>{const E=Kt(j);return{activeStatus:E.activeTab,appliedSearch:E.filters.search,appliedSort:E.sort,nextCursor:E.nextCursor,subscriptionListFetchState:E.fetchState,runningActionSubscriptionId:E.runningActionId??null}}),Z),y=b==="Completed";r.useEffect((()=>{const j=setTimeout((()=>d(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&n(st({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(g.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&n(st({cacheOverride:!0,filters:g,sort:u}))}),[i,n,g,u,f,h]);const I=r.useRef(k);return r.useEffect((()=>{const j=I.current!=null&&k==null;I.current=k,j&&i&&n(co())}),[k,i,n]),N(b)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSubscriptionsListPage,isReady:y}),s.jsx(Qa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:g,sort:u,nextCursor:P,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:j=>n(ro(j)),onSortChange:v})]})}const Ga=_((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(m.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(m.Event.invoicingTransactionCaptured,{transactionId:i}),n(mo({action:"capture",id:i}))}:void 0}}))(Kn);function Wa(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=R(),{areTenantIdsInSync:a}=T(),o=C((d=>uo(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&n(go({id:i}))}),[a,i,n]),N(o.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:o})]})}const Ja={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=D(),{areTenantIdsInSync:t}=T(),{tenantEmailDomain:i}=R(),{fetchState:a,fieldHelp:o,logoFile:c,saveState:d,settings:l,stripeConnectState:v}=C(vo),{configError:u,configFetchState:g,dunningScheduleActionOptions:S,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P}=C(Qt),b=C($e);Ze({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=C(Me),y=n==="dunning"||n==="quickbooks",I=k.companyId??Ie.getSignedInUserTenant(i??"")?.companyId,j=C((F=>$t(F,I))),E=po(k.userRole??[]),w=k.tenantId??"",A=Ie.getSignedInUser(),U={userId:A?.userId??"",sessionId:A?.zeniSessionId??"",tenantId:w},O=c?.fileId,ee=C((F=>O!=null&&O!==""?fo(F,O):void 0)),He=C((F=>O!=null&&O!==""?So(F,O):void 0)),on=O!=null&&O!==""&&ee!=null?{[O]:ee}:{},an=O!=null&&O!==""&&He!=null?{[O]:He}:{};r.useEffect((()=>(e(ct()),()=>{e(ct())})),[e]),r.useEffect((()=>{t&&(a!=="Not-Started"&&a!=="Error"||e(Ne()))}),[t,e,a]),r.useEffect((()=>{t&&y&&g==="Not-Started"&&e(le())}),[t,e,g,y]),r.useEffect((()=>{if(!t)return;const F=A?.userId;F!=null&&F!==""&&w!==""&&Qe.shouldFetchActiveTenant(w)&&(Qe.markActiveTenantFetchStarted(w),e(ho(F,w,A?.zeniSessionId)))}),[t,e,A?.userId,A?.zeniSessionId,w]);const sn=S.length>0||f.length>0,cn=a==="Not-Started"||a==="In-Progress"&&l==null||y&&!sn&&(g==="Not-Started"||g==="In-Progress"),rn=a==="Completed"&&(!y||g==="Completed"),qe=j.externalConnections?.revenue?.find((F=>F.connectionName==="chargebee"))?.connectionId,me=se?.invoicingMicroServiceBaseUrl,Ke=me!=null&&me.length>0?`${me}/1.0/webhooks/stripe`:"",ve={deleteConnectionError:j.externalConnections?.deleteConnectionError?.message,deleteConnectionState:j.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:j,isAdmin:E,isStripeBusy:v.fetchState==="In-Progress",onConnectStripe:F=>e(lt(F)),onDisconnect:(F,q)=>{w!==""&&e(bo(w,F,dt(q)))},onDisconnectStripe:()=>e(rt()),onReconnectQBO:()=>{const F=k.tenantEmailDomain??i??"";de.init("/connection/auth",F),de.handleClick()},onRefreshQBO:()=>{j.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(F,q)=>{qe!=null&&w!==""&&e(yo(w,qe,dt("revenue"),xo("chargebee"),{api_key:F,site:q}))},saveChargeBeeError:j.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:j.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ke};return{authParams:U,deleteFileStatusById:on,fieldHelp:o,dunningScheduleActionOptions:S,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ve,isInvoicingPageReady:rn,isLoading:cn,isSaving:d.fetchState==="In-Progress",isStripeBusy:v.fetchState==="In-Progress",logoFile:c,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:h,qboSyncStatusOptions:P,qboView:b,saveErrorMessage:d.fetchState==="Error"?d.error?.message??"Failed to save settings.":y&&g==="Error"?u?.message??"Failed to load invoicing configuration.":void 0,settings:l,stripeError:v.fetchState==="Error"?v.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ke,updateFileStatusById:an,onConnectStripe:F=>e(lt(F)),onDeleteFile:F=>e(ko(F,w)),onDisconnectStripe:()=>e(rt()),onEditFileName:(F,q)=>e(Eo(F,q,w)),onReconnectQBO:ve.onReconnectQBO,onRefreshQBO:ve.onRefreshQBO,onRetryQboSyncTask:F=>e(Gt(F)),onSave:F=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Co({settings:F,snackbarSection:Ja[n??""]}))},onStartQboBackfill:F=>e(zt(F)),updateFilesEntity:F=>{p.trackInvoicingActionClick(m.Event.invoicingLogoUploaded),e(Io({files:F}))}}}function vt({appContent:n}){const e=L(),t=J(),i=D(),{tenantEmailDomain:a}=R(),o=X("branding"),c=C((v=>jo(v))),d=C((v=>Po(Se,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i(Re(Se)))}),[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:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Qn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Ao({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${Se}/`,u=Y(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Lo()),updateFilesEntity:o.updateFilesEntity})]})}function Ya(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{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=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function es(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Wn,{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 ts=_((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(Fo({localData:e}))},onReset:()=>{n(wo())},onRetryTask:e=>{n(Gt(e))},onSave:()=>{p.trackInvoicingActionClick(m.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n($o())},onStartBackfill:e=>{n(zt(e))}}}))(Jn);function ns(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),i=C(Me),{configFetchState:a,settingsFetchState:o}=C(Jt);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||n(Ne())}),[n,o]),r.useEffect((()=>{a==="Not-Started"&&n(le())}),[a,n]),Ze({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage}),s.jsx(ts,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const is={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function os(){const n=ft(),e=D(),t=L(),[i,a]=W(),o=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=C(Qt),g=i.get("tab");return r.useEffect((()=>{if(g==null)return;const S=is[g];a({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[g,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:m.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Yn,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:n("invoicing_settings"),settings:o.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Ro())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(os,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(es,{})}),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(Ya,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ns,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function ws(){const n=D(),e=L(),{tenantEmailDomain:t}=R(),{areTenantIdsInSync:i}=T(),{enableState:a,fetchState:o,status:c}=C(Nt),d=St(a.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=C((g=>$e(g).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,o]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),n(To()))}),[d,a.fetchState,l,n,e]),c==null&&o!=="Error"?s.jsx(Xn,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(ut,{})}),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(ut,{})}),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($a,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(la,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(ca,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(aa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(za,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(Ka,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Na,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(Pa,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Xo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(ba,{})}),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(La,{})}),s.jsx(x,{path:"payments",element:s.jsx(Fa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Wa,{})}),s.jsx(x,{path:"credits",element:s.jsx(ia,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ta,{})}),s.jsx(x,{path:"discounts",element:s.jsx(Ia,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Jo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(Sa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ya,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ea,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(Ko,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Vo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(_o,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ma,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(pa,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(ua,{})}),s.jsx(x,{path:"*",element:s.jsx(M,{})})]})}export{ws as default};
|