@zeniai/web-app-ui 5.3.48-qa → 5.3.49-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-CiRabt-E.js +9 -0
- package/dist/assets/ActualMatchingMatchDetailScreen-CrIjNeef.js +1 -0
- package/dist/assets/AddressRoutes-B4RpxW72.js +1 -0
- package/dist/assets/AddressScreen-CPQlppZ3.js +9 -0
- package/dist/assets/{AiCfoScreen-DRk81N96.js → AiCfoScreen-DcV74Vwb.js} +3 -3
- package/dist/assets/{AppDrawer-CbgUVaEs.js → AppDrawer-DEmhHxBl.js} +3 -3
- package/dist/assets/{BillPayApprovalRoutes-CRw5sS5w.js → BillPayApprovalRoutes-DRDBSjZr.js} +1 -1
- package/dist/assets/BillPayRoutes-BVerU8xr.js +119 -0
- package/dist/assets/BusinessVerificationPageScreen-R4BiNdXk.js +9 -0
- package/dist/assets/CardsAiCfoScreen-SCqXPmm9.js +14 -0
- package/dist/assets/ChargeCardRoutes-Dxl-Fr5T.js +71 -0
- package/dist/assets/CompanyPassportScreen-CHE321d6.js +1 -0
- package/dist/assets/ConnectionAuthScreen-if4-dQ5X.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-qafzPnCc.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-BjVLhsMv.js +30 -0
- package/dist/assets/{DashboardRoutes-DOtnRGit.js → DashboardRoutes-Def0G9RV.js} +4 -4
- package/dist/assets/DefaultTenantHome-DrLH_DYg.js +1 -0
- package/dist/assets/DomesticWireDetailScreen-DnnWI2yA.js +18 -0
- package/dist/assets/DrawerScreen-CEC7Mn0M.js +1 -0
- package/dist/assets/EntityDetailRoutes-CJi5JMBH.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-DjNAjdBg.js +38 -0
- package/dist/assets/FeaturePreviewScreen-DTAcqRMm.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-BKVqVZzZ.js +1 -0
- package/dist/assets/InboxNotificationsProvider-Dwt_tkdC.js +1 -0
- package/dist/assets/InvoicingRoutes-CDGhZRcq.js +2 -0
- package/dist/assets/MagicLinkRoutes-DJrPTlpH.js +72 -0
- package/dist/assets/MagicLinkSignInScreen-tE33HPhZ.js +12 -0
- package/dist/assets/MobileAppDrawer-CCUOxU5h.js +1 -0
- package/dist/assets/NotFoundScreen-CaUndFTs.js +1 -0
- package/dist/assets/NotificationRoutes-D_aWgIj_.js +1 -0
- package/dist/assets/OAuthConsentScreen-XzMLC3jd.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-G1iTHjWf.js +1 -0
- package/dist/assets/{PaymentLinkScreen-D5UCUG0s.js → PaymentLinkScreen-CTXKytOV.js} +1 -1
- package/dist/assets/PeopleRoutes-BCTJIMEm.js +22 -0
- package/dist/assets/PerformanceRoutes-VB7l7YHB.js +1 -0
- package/dist/assets/{Preview-DFfstF1G.js → Preview-qQlP44Bb.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-0bGr42Ku.js → QBOConnectionScreen-B613NNPN.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-Oot7vjoE.js +1 -0
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-BbbYw1r6.js +1 -0
- package/dist/assets/ReimbursementRoutes-fet7iW_N.js +68 -0
- package/dist/assets/{ReportsRoutes-BtqrHuz-.js → ReportsRoutes-BiU3IfXy.js} +1 -1
- package/dist/assets/RewardsRoutes-KyVRs2V6.js +1 -0
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BeylIkiO.js +33 -0
- package/dist/assets/ScreenRoutes-p1iqGjnv.js +2 -0
- package/dist/assets/{SettingsRoutes-C1_iqx7p.js → SettingsRoutes-DgAnzCiw.js} +6 -6
- package/dist/assets/{SetupPagesScreen-K06f0ggy.js → SetupPagesScreen-C3gLfyZJ.js} +5 -5
- package/dist/assets/SignInScreen-C1PbWtoo.js +1 -0
- package/dist/assets/SignOutScreen-BBj0h9la.js +9 -0
- package/dist/assets/TaskListScreen-bZId4AF3.js +9 -0
- package/dist/assets/TaskRoutes-DCL22vAl.js +9 -0
- package/dist/assets/TransactionDetailRoutes-BAFfn1JT.js +1 -0
- package/dist/assets/TransactionDetailScreen-DaJqMIrN.js +5 -0
- package/dist/assets/TransactionListRoutes-CbPBDWZp.js +1 -0
- package/dist/assets/TreasuryRoutes-CGBE-vV8.js +37 -0
- package/dist/assets/{VendorsRoutes-CPto0F4-.js → VendorsRoutes-D_EkjlrJ.js} +17 -17
- package/dist/assets/{WiseConfirmationScreen-DS88ccTN.js → WiseConfirmationScreen-BNDdfueF.js} +2 -2
- package/dist/assets/{ZeniAccountRoutes-DbQRgRMK.js → ZeniAccountRoutes-Cf1eI0DS.js} +11 -11
- package/dist/assets/ZeniAccountStatementScreen-BN-JxJMw.js +9 -0
- package/dist/assets/{accountMappingHelper-Dc3TCyrX.js → accountMappingHelper-ZA3eE2RB.js} +1 -1
- package/dist/assets/{analytics-DP3hAmgL.js → analytics-EJdRN0EM.js} +1 -1
- package/dist/assets/analyticsHelper-yYV2XYgm.js +1 -0
- package/dist/assets/{core-C_3BcvPm.js → core-DrG65cn7.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CMkyCq70.js → decodeURIComponentSafe-Cq-VPmfw.js} +1 -1
- package/dist/assets/{dnd-BXrho-40.js → dnd-ySxwrcGd.js} +1 -1
- package/dist/assets/{empty-BqX05B9x.js → empty-HkstFjkG.js} +1 -1
- package/dist/assets/{empty-5gw21cFQ.js → empty-hypZVcyj.js} +1 -1
- package/dist/assets/{emptyVideoElement-Cko-_QcE.js → emptyVideoElement-hQo6iMam.js} +1 -1
- package/dist/assets/epic-BPI4oO0H.js +2 -0
- package/dist/assets/expenseAutomationHelper-BhQOMrvk.js +1 -0
- package/dist/assets/getLocaleForTenant-DB6O4KHG.js +1 -0
- package/dist/assets/{index-DfdR1P4V.js → index-BRSI70wf.js} +31522 -30719
- package/dist/assets/index-CItropkZ.js +1 -0
- package/dist/assets/{index-SmhLh3Eo.js → index-CNxuKyrU.js} +1 -1
- package/dist/assets/{index-knjfFBPr.js → index-CdqEwb4U.js} +1 -1
- package/dist/assets/{index-B7fi9F1i.js → index-Cju_tsP9.js} +1 -1
- package/dist/assets/{index-m_4D8W9h.js → index-Csgz6JKS.js} +2 -2
- package/dist/assets/{index-BG-FYGvC.js → index-D2y8Uf4E.js} +1 -1
- package/dist/assets/{index-qXuXknhd.js → index-DWaMzRgO.js} +1 -1
- package/dist/assets/{lexical-DY18TAnZ.js → lexical-DsG4GgCt.js} +1 -1
- package/dist/assets/{liveblocks-BHA40K9j.js → liveblocks-DJozFz1F.js} +2 -2
- package/dist/assets/{lottie-DHD1nzoa.js → lottie-B54UhbRD.js} +1 -1
- package/dist/assets/{mui-DsxbZgLG.js → mui-DqsEgFea.js} +1 -1
- package/dist/assets/{pathToGoBack-D0yBSaLk.js → pathToGoBack-Cvep4Zpb.js} +1 -1
- package/dist/assets/{pdf-BmQFuRIG.js → pdf-0ccxH7eS.js} +3 -3
- package/dist/assets/{pdf-lib-BgeYbcJF.js → pdf-lib-CYVFTJz1.js} +1 -1
- package/dist/assets/{plaid-ewZxuvzf.js → plaid-KeCmRFX0.js} +1 -1
- package/dist/assets/{pusher-DAk6660-.js → pusher-63t06gfb.js} +1 -1
- package/dist/assets/{react-BGUqUuxn.js → react-BNSYzriL.js} +1 -1
- package/dist/assets/{react-CPspBxzV.js → react-CAoDTuLJ.js} +1 -1
- package/dist/assets/{react-B55QK8Y2.js → react-Ca5GapOf.js} +1 -1
- package/dist/assets/{react-DSfrP2G8.js → react-CjVnH7Ak.js} +1 -1
- package/dist/assets/{react-C1aI4U0L.js → react-DoOX0jE5.js} +1 -1
- package/dist/assets/{react-BDRsWZYP.js → react-xEeg46_z.js} +1 -1
- package/dist/assets/{recharts-CmYjG1zt.js → recharts-Bmrae78L.js} +1 -1
- package/dist/assets/{routePaths-Cca1tWJp.js → routePaths-C_2IfGnd.js} +1 -1
- package/dist/assets/{sentry-CFLt6SLf.js → sentry-C1W0cBeR.js} +1 -1
- package/dist/assets/stripSplatSuffix-Dk3dK5Wm.js +1 -0
- package/dist/assets/{url-D-ZtJ2kF.js → url-BrtuL5Mk.js} +1 -1
- package/dist/assets/{url-DKuONDiE.js → url-C0aMyBCn.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-CQ1E-c6g.js +1 -0
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B4wwXC6_.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-DgHBW0CH.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-B1YNDwMw.js +1 -0
- package/dist/assets/{useDeviceId-CZr7CPDW.js → useDeviceId-BQkxGsaf.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-ezN2mPba.js +1 -0
- package/dist/assets/useInitialThreadRequest-CIOY8QiT.js +1 -0
- package/dist/assets/useTaskManagerAccess-CeXMA9mP.js +1 -0
- package/dist/assets/{utils-D1gULS4n.js → utils-BYrZSa_o.js} +1 -1
- package/dist/assets/withTransactionSidePanel-M6DARYy7.js +25 -0
- package/dist/assets/{zeni-epic-state-BK-HD5IA.js → zeni-epic-state-1I_oueWp.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +6 -6
- package/dist/assets/AccountMappingScreen-amEuzz3m.js +0 -9
- package/dist/assets/AddressRoutes-BvCvEc0i.js +0 -1
- package/dist/assets/AddressScreen-SjU2U0ZR.js +0 -9
- package/dist/assets/BillPayRoutes-gLnnTINY.js +0 -119
- package/dist/assets/BusinessVerificationPageScreen-OrLH3WzL.js +0 -9
- package/dist/assets/CardsAiCfoScreen-CK5nzziY.js +0 -14
- package/dist/assets/ChargeCardRoutes-VxC6xP7p.js +0 -71
- package/dist/assets/CompanyPassportScreen-CMquye6T.js +0 -1
- package/dist/assets/ConnectionAuthScreen-D-MaPmF7.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-Cd284ksv.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-BEKgaiHU.js +0 -30
- package/dist/assets/DefaultTenantHome-BgVy6pXM.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-ojJdskB-.js +0 -18
- package/dist/assets/DrawerScreen-DaPp3vfO.js +0 -1
- package/dist/assets/EntityDetailRoutes-CeZQKYjJ.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-D8dyN9JX.js +0 -38
- package/dist/assets/FeaturePreviewScreen-bhcVTnED.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-BycOX9mL.js +0 -1
- package/dist/assets/InboxNotificationsProvider-ICcfArFM.js +0 -1
- package/dist/assets/InvoicingRoutes-BkdZK7i6.js +0 -2
- package/dist/assets/MagicLinkRoutes-BIEFcYv2.js +0 -72
- package/dist/assets/MagicLinkSignInScreen-ufbtyKlL.js +0 -12
- package/dist/assets/MobileAppDrawer-DjEeoE6u.js +0 -1
- package/dist/assets/NotFoundScreen-BDRAfL_x.js +0 -1
- package/dist/assets/NotificationRoutes-DJF3aH5n.js +0 -1
- package/dist/assets/OAuthConsentScreen-Bl7eWr3R.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-CUZT8XbC.js +0 -1
- package/dist/assets/PeopleRoutes-DopLFED_.js +0 -22
- package/dist/assets/PerformanceRoutes-CoR3XZpX.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-4Gmx-MuW.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-DiBNgDsy.js +0 -1
- package/dist/assets/ReimbursementRoutes-DjQJfMVY.js +0 -68
- package/dist/assets/RewardsRoutes-Dq5pKyO9.js +0 -1
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-DtayUdWa.js +0 -25
- package/dist/assets/ScreenRoutes-BAM6ERJQ.js +0 -2
- package/dist/assets/SignInScreen-BvLUs9_l.js +0 -1
- package/dist/assets/SignOutScreen-qMNwfRFa.js +0 -9
- package/dist/assets/TaskListScreen-BorAtbzN.js +0 -9
- package/dist/assets/TaskRoutes-DJI1lloU.js +0 -9
- package/dist/assets/TransactionDetailRoutes-DCWaZrOs.js +0 -1
- package/dist/assets/TransactionDetailScreen-B2Yk34kC.js +0 -5
- package/dist/assets/TransactionListRoutes-eMDqkeHP.js +0 -1
- package/dist/assets/TreasuryRoutes-sgwJOYI2.js +0 -37
- package/dist/assets/ZeniAccountStatementScreen-B7vN9Y4_.js +0 -9
- package/dist/assets/analyticsHelper-Bfs4R3aB.js +0 -1
- package/dist/assets/epic-DMvtePZM.js +0 -2
- package/dist/assets/expenseAutomationHelper-dMv6Xo4s.js +0 -1
- package/dist/assets/getLocaleForTenant-CK0bI6xd.js +0 -1
- package/dist/assets/index-DIN19WtR.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BujA6eyw.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CnAY_u1k.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-7mxw_gTB.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-DL08zR5x.js +0 -1
- package/dist/assets/useInitialThreadRequest-C8Pdei5-.js +0 -1
- package/dist/assets/useTaskManagerAccess-DJ8lZv1E.js +0 -1
- package/dist/assets/withTransactionSidePanel-D2Vk8NEW.js +0 -25
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-BHA40K9j.js";import Ba from"./NotFoundScreen-BDRAfL_x.js";import{a,R as Pn}from"./sentry-CFLt6SLf.js";import{n as Te,S as Ua}from"./mui-DsxbZgLG.js";import{u as Se,h as bt,g as Xe,j as F,i as Ct,l as Va,t as Oa,n as Ma,o as ut}from"./core-C_3BcvPm.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 Ts,qD as Fn,ri as Ke,a0y as bs,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 Tt,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 To,a0W as bo,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-BK-HD5IA.js";import{M as Ze,y as Q,h as Y,p as ne,aq as On,as as Mn,dO as ac,z as et,dP as sc,dQ as oc,dR as cc,ae as Be,dS as ic,dT as Cn,ba as fn,dU as lc,a7 as jn,dV as rc,l as He,G as dc,w as uc,dW as mc,av as In,dX as pc,a as hc,dY as Sc,dZ as gc,r as Cc,V as fc,d_ as Ic,d$ as kc,e0 as Tc,b4 as bc,br as yc,ab as Ec,b5 as vc,b6 as Pc}from"./index-DfdR1P4V.js";import{u as Ln}from"./useAskAiCfoHostNavButtonProps-CnAY_u1k.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-B2Yk34kC.js";import{b as Bc,S as Uc,a as Vc,J as Oc}from"./ScheduleDetailsPrepaidExpensesScreen-DtayUdWa.js";import{s as Tn,i as zn,h as Mc,v as jc,c as Lc}from"./routePaths-Cca1tWJp.js";import{u as zc,a as $c,w as Gc}from"./withTransactionSidePanel-D2Vk8NEW.js";import{a as ht}from"./accountMappingHelper-Dc3TCyrX.js";import{D as qc}from"./DrawerScreen-DaPp3vfO.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";import"./decodeURIComponentSafe-CMkyCq70.js";import"./useInitialThreadRequest-C8Pdei5-.js";import"./expenseAutomationHelper-dMv6Xo4s.js";import"./pathToGoBack-D0yBSaLk.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]="c172e946-43a5-4e23-9f2c-a3664de11f42",t._sentryDebugIdIdentifier="sentry-dbid-c172e946-43a5-4e23-9f2c-a3664de11f42")}catch{}})();const Nc=()=>{const t=Se(),s=bt(),b=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}))}),[]),T=a.useCallback((h=>{const l=b.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=b.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(b.state?.pathnameStackToGoBack,b.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=b.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:T,handleReviewButtonClick:x,onBackClick:()=>{s("../../dashboard")},onReload:u,isAiCfoAccessEnabled:E,onAskAiCfoClick:w,aiAuditScorePercentageEnabled:d})})},Jc=Te.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
8
|
-
`,Wc=Pn.memo((({reconciliation:t,selectedDrawerAccountId:s,onClose:b,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:T,excludedAccountIDs:p,monthYearPeriod:u,statementUploadChosen:_}=t,x=T[s],S=a.useMemo((()=>$a(T,s)),[T,s]),h=a.useMemo((()=>Ga(T)),[T]),l=a.useMemo((()=>qa(T,s)),[T,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]),be=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)),b()}),[i,u,b]),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(bn,{children:f.jsx(yn,{$isV3:P===!0,children:f.jsx(oc,{excludedAccountReconciliation:ve,includeAccountFetch:t.includeAccountFetchState,isReconV3Enabled:P,onDismissClick:b,onIncludeIntoReconciliation:ee})})});if(x!=null){const k=P===!0?f.jsx(cc,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:x,monthYearPeriod:u,onDismissClick:b,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:be,reconciledByName:c,onDismissDateConflict:m,onReuploadAfterDateConflict:I,isReconV3Enabled:P}):f.jsx(ic,{excludeAccountFetch:t.excludeAccountFetchState,accountReconciliation:x,monthYearPeriod:u,onDismissClick:b,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(bn,{children:f.jsx(yn,{$isV3:P===!0,children:k})})}return null})),bn=Te.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
height: 100%;
|
|
12
|
-
`,yn=Te.div`
|
|
13
|
-
flex: 1;
|
|
14
|
-
min-height: 0;
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
min-width: 0;
|
|
19
|
-
overflow-x: hidden;
|
|
20
|
-
overflow-y: ${t=>t.$isV3===!0?"hidden":"auto"};
|
|
21
|
-
`;function Yc({panelType:t,scheduleId:s,onClose:b}){return f.jsx(Qc,{children:f.jsx(Kc,{children:Hc(t,s,b)})})}function Hc(t,s,b){switch(t){case"one_time_accrual":return f.jsx(Oc,{isRenderedInPanel:!0,accrualIdOverride:s,onPanelNavigateBack:b});case"accrued_expenses":return f.jsx(Vc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:b});case"fixed_assets":return f.jsx(Uc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,onPanelNavigateBack:b});case"prepaid_expenses":return f.jsx(Bc,{isRenderedInPanel:!0,scheduleDetailIdOverride:s,scheduleTypeOverride:"prepaid_expenses",onPanelNavigateBack:b})}}const Qc=Te.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
height: 100%;
|
|
25
|
-
`,Kc=Te.div`
|
|
26
|
-
flex: 1;
|
|
27
|
-
min-height: 0;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
min-width: 0;
|
|
32
|
-
overflow-x: hidden;
|
|
33
|
-
overflow-y: auto;
|
|
34
|
-
`,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),$=Ke(z.start),G=Ke(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(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})),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((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},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?K.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):Ks(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(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);T(`../../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);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(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]),T=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(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]),K=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(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(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=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=bc(),{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: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:Kn,classesForFilters:Xn,accountsForFilters:Zn,vendorSearchAutoCompleteData:{autoCompleteText:la,entityAutoCompleteView:Qn},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:K,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)`
|
|
35
|
-
display: flex;
|
|
36
|
-
min-height: 100%;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
`;function Vi(){return f.jsxs(Ma,{children:[f.jsx(ut,{path:"*",element:f.jsx(Nc,{})}),f.jsx(ut,{path:"/:selectedTab/:selectedPeriod/*",element:f.jsx(ii,{})}),f.jsx(ut,{path:"*",element:f.jsx(Ba,{})})]})}export{Vi as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BHA40K9j.js";import{a as r}from"./sentry-CFLt6SLf.js";import{aw as f,ax as c,C as l,a4 as p}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import m from"./NotFoundScreen-BDRAfL_x.js";import{h as u,g as b}from"./core-C_3BcvPm.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]="8a9afdc8-8d5a-41e6-98e7-00f6795c912e",e._sentryDebugIdIdentifier="sentry-dbid-8a9afdc8-8d5a-41e6-98e7-00f6795c912e")}catch{}})();const _=()=>{const e=u(),a=b(),t=r.useCallback((()=>{window.open("https://www.zeni.ai/demo/request","_blank")}),[]),d=r.useCallback((()=>{(()=>{const n=p(a.state?.pathnameStackToGoBack),i=n.poppedPathname??k();e(i,{state:{pathnameStackToGoBack:n.newStack}})})()}),[]),o=f(a.pathname);return o!=null?s.jsx(c,{menuItem:l(o),onDemoClick:t,onGoBack:d}):s.jsx(m,{})},k=(e=2)=>{let a="../";for(let t=0;t<e;t++)a=`${a}../`;return a};export{_ as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as r}from"./sentry-CFLt6SLf.js";import{u as l,h as m,g as p}from"./core-C_3BcvPm.js";import{hX as f,TP as g,TQ as _}from"./zeni-epic-state-BK-HD5IA.js";import{u as h,L as b,z as y}from"./index-DfdR1P4V.js";import"./liveblocks-BHA40K9j.js";import"./recharts-CmYjG1zt.js";import"./mui-DsxbZgLG.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.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 +0,0 @@
|
|
|
1
|
-
import{m as s}from"./liveblocks-BHA40K9j.js";import{j as d}from"./core-C_3BcvPm.js";import{fE as f}from"./zeni-epic-state-BK-HD5IA.js";import"./sentry-CFLt6SLf.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};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BHA40K9j.js";import{a as r}from"./sentry-CFLt6SLf.js";import{u as P,h as L,i as w,j as E,t as W,l as T,s as Z,g as J,N as B,n as ie,o as x}from"./core-C_3BcvPm.js";import{a8 as ln,h as p,aq as F,S as g,cb as dn,cc as un,cd as gn,ce as mn,cf as vn,cg as pn,ch as fn,ci as Sn,cj as hn,ck as 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 Dn,z as Ie,ct as Pn,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 Bn,cG as Vn,cH as Zn,cI as Hn,cJ as qn,t as Ke,l as St,cK as Kn,cL as Qn,cM as zn,cN as Gn,cO as Wn,cP as Jn,cQ as Yn}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import{A as K}from"./AddressScreen-SjU2U0ZR.js";import N from"./NotFoundScreen-BDRAfL_x.js";import{Z0 as Xn,Z1 as ei,uP as Qe,Z2 as Q,vg as ce,Z3 as Pe,Z4 as z,vT as ze,v_ as ti,w3 as ht,Z5 as Le,Z6 as It,vX as Ct,Z7 as Ae,vV as Et,yz as ni,vW as ii,vP as oi,xq as Ge,vf as Ce,Z8 as ai,Z9 as kt,wa as si,Za as G,wh as ci,Zb as ri,Zc as yt,Zd as xt,yl as li,Ze as ue,Zf as We,Zg as bt,vd as di,Zh as ui,v7 as gi,Zi as mi,xD as vi,Zj as jt,xM as Je,Zk as pi,xJ as fi,Zl as $e,gg as Si,Zm as te,Zn as ne,ww as hi,vl as Ye,Zo as we,vq as Dt,vo as Ii,vi as Ci,wp as Ei,vs as ki,wy as yi,Zp as Ee,wF as Pt,wD as ke,Fo as Fe,xS as Xe,Zq as xi,ve as Re,Zr as Te,vB as ye,vy as xe,vL as Lt,vK as Oe,vv as bi,vE as At,vN as oe,fE as _e,UP as $t,vh as Me,vI as ji,vJ as Di,vH as Pi,Zs as Li,wd as et,wi as Ai,we as wt,Zt as Ft,v1 as tt,Zu as $i,uZ as Rt,Zv as wi,xY as Fi,y0 as H,xX as Ri,x4 as Ne,Zw as Ti,Zx as Tt,y9 as nt,Zy as Oi,y6 as _i,Zz as Ot,x7 as Mi,x8 as V,xb as Ni,ZA as _t,xl as pe,ZB as Ui,wx as Mt,Tm as Nt,ZC as Bi,xv as Vi,ZD as Ut,ZE as Zi,ZF as Hi,ZG as qi,y_ as Ki,ZH as Qi,ZI as Bt,yg as Vt,ZJ as Zt,yY as fe,ZK as zi,yV as Gi,ZL as Wi,ZM as Ji,ZN as Yi,ZO as Xi,ZP as eo,ZQ as it,ZR as to,z2 as no,ZS as Ue,wP as ot,ZT as Be,ZU as re,wZ as Ht,wU as qt,wS as be,ZV as io,wK as oo,ym as Kt,yN as at,yI as ao,ZW as so,yn as co,ZX as ro,yO as lo,yS as uo,ZY as go,ZZ as Qt,c8 as mo,mr as vo,ms as po,Z_ as st,vU as le,gk as fo,uf as So,my as ho,yF as zt,ze as Io,yC as Gt,ul as Co,zb as ct,u9 as Eo,z8 as rt,hR as ko,TP as lt,TQ as yo,FA as Wt,hJ as xo,Z$ as bo,UE as jo,_0 as Do,zk as Se,zl as Po,_1 as Lo,_2 as Jt,zh as Ao,_3 as $o,_4 as wo,xz as Fo,_5 as Ro}from"./zeni-epic-state-BK-HD5IA.js";import{M as To}from"./MobileAppDrawer-DjEeoE6u.js";import{q as de}from"./QBOConnectionScreen-0bGr42Ku.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";import"./InboxNotificationsProvider-ICcfArFM.js";import"./useTaskManagerAccess-DJ8lZv1E.js";import"./empty-5gw21cFQ.js";import"./pdf-lib-BgeYbcJF.js";import"./index-qXuXknhd.js";import"./url-D-ZtJ2kF.js";import"./index-DIN19WtR.js";import"./decodeURIComponentSafe-CMkyCq70.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]="714af4cb-e7f1-458c-bff3-a4666509dd1a",n._sentryDebugIdIdentifier="sentry-dbid-714af4cb-e7f1-458c-bff3-a4666509dd1a")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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:m,hasMore:S,items:f,nextCursor:C,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Xn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,I=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(a)),300);return()=>clearTimeout(O)}),[a]),r.useEffect((()=>{i&&n(Qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:D,isLoadingMore:h,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&C!=null&&n(Qe({cursor:C,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function ge(n,e=!1){const t=P(),i=E((c=>Q(c).productNextCursor!=null)),a=E((c=>Q(c).productNextCursor)),o=E((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 _o=new Set(["plan"]),Yt=[],Mo=It((n=>n.length>0?n:Yt),mn),No=It((n=>n.length>0?n:Yt),gn),Uo=T((function(n,e){const{view:t}=e;return{applicableItemOptions:t.applicableItemOptions,groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&n(Ct({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&n(Le({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&n(ti({action:o,id:a,parentItemId:i}))}}}))(un);function Bo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[a]=W(),{areTenantIdsInSync:o}=F(),c=(d=a.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>Pe(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(ze({id:t,kind:c}))}),[o,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(z()),n(ze({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed";ge(o,!0);const[C,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=C!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Ve(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=n,o=P(),{areTenantIdsInSync:c}=F(),d=E(Ae),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(Et()),t&&o(ni()))}),[c,o,e,t,a]),r.useEffect((()=>{e&&c&&l&&i&&o(ii())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=T((function(n,e){const t=Pe(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${t}/catalog/${encodeURIComponent(a)}`:`${t}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(z()),e.navigate(`${t}/catalog`)},onChange:c=>{n(Le({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:a}))}}}))(vn);function qo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[a]=W(),{areTenantIdsInSync:o}=F(),c=t!=null,d=a.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>Pe(S,t)));return ge(o,!0),Ve({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{o&&t!=null&&n(oi({id:t,kind:v}))}),[o,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(Le({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(z())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=T((function(n,e){const t=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(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(Ct({action:ai(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 zo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,C=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>Q(O))),k=y.planFilters.search,b=y.planSort,I=y.planNextCursor,D=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(a)),300);return()=>clearTimeout(O)}),[a]),r.useEffect((()=>{i&&n(Ge({cacheOverride:!1,planFilters:C,productFilters:j,planSort:S,productSort:S}))}),[i,n,C,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(Ge({cacheOverride:!0,planFilters:C,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,C,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Qo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:a,sortState:u,planFilters:C,productFilters:j,sort:S,planNextCursor:I,productNextCursor:D,runningCatalogItemActionId:_,onSearchChange:o,onTabChange:d,onSortChange:m})]})}const Go=T((function(n,e){const t=kt(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(G()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:a}),n(ci({id:i}))}}}))(fn);function Wo(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{a&&t!=null&&n(si({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:g.Event.invoicingCouponFormPage}),s.jsx(Go,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Jo=T((function(n){const e=yt(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:a=>{e(bt(a))},onSubmit:()=>{const a=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(gi(a))}}}))(hn);function Yo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),[i]=W(),{areTenantIdsInSync:a}=F(),o=i.get("customerId"),c=E((I=>yt(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((I=>li(I))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,C=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||C,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:o})))}),[o,l,n]),r.useEffect((()=>{a&&n(di({cacheOverride:!1}))}),[a,n]);const b=r.useRef(d);return r.useEffect((()=>{const I=b.current;if(b.current=d,I!=="Completed"&&d==="Completed"){const D=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(D)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Jo,{navigate:e,tenantEmailDomain:t})]})}const Xo=T((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(In);function ea(){const n=P(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((d=>mi(d,t??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&t!=null&&n(vi({id:t}))}),[a,t,n]),U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Xo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:o})]})}const ta=T((function(n){const e=jt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Cn);function na(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const I=jt(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(Je({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(Je({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:a=>{n(Ee({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.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(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ee({id:i,localData:a})),n(Pt({id:i}))},onFetchPaymentLinkEmailPreview:a=>n(yi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>n(ki({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)}}}))(yn);function oa(){const n=P(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),c=E((M=>$e(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,C]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&C(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:I,stripeConnected:D}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{o&&i!=null&&n(hi({id:i}))}),[o,i,n]),r.useEffect((()=>{o&&i!=null&&D&&n(Ye({customerId:i}))}),[o,i,n,D]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(we()),i!=null&&n(Dt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{n(te()),i!=null&&D&&n(Ye({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:D,onChooseCard:()=>{i!=null&&n(Ci({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ii({customerId:i,data:M}))}}),s.jsx(kn,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=$e(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(g.Event.invoicingCustomerFormCancelled),n(we()),n(Fe(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(g.Event.invoicingCustomerSaved,{mode:a}),n(Pt({id:i}))}}}))(xn);function sa(){const n=P(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),{fetchState:c,savedCustomerId:d}=E((l=>$e(l,i)));return r.useEffect((()=>{o&&i!=null&&n(Dt({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(we())}}),[c,d,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:a})]})}const ca=T((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,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(Re({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,customerListFetchState:y}=E((b=>{const I=ue(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(Xe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(Xe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const je=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view: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",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>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(Oe(o))},onRollback:S?()=>{o!=null&&n(Lt(o))}:void 0}}))(jn);function da(){const n=P(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),[o,c]=r.useState({}),d=E(Te),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 m=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 C=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${C===""?"":`?${C}`}`}),[o,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters: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{}},ua=T((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(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),n(Oe(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),n(Lt(o))},onViewSession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),t(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Dn);function ga(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),a=E(Te);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:a})]})}const ma=T((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((m=>m.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((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.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(g.Event.invoicingChargebeeConnectClicked),n(Pi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{t!=null&&n(Oe(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Di(t))},onUpload:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:o}))},onViewDetails:t==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Pn);function va(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),a=E(xt),o=E(_e).companyId??Ie.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,o))),d=E(Te),{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(Me()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(C=>{if(C==null||C==="")return null;try{return sessionStorage.getItem(en(C))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ye(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:a=>{n(wt({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:a,id:i}))}}}))(Ln);function fa(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((C=>Li(C,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 m=v===t;r.useEffect((()=>(n(G()),()=>{n(G())})),[n]),r.useEffect((()=>{a&&n(et({id:t}))}),[a,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{o.fetchState==="Completed"&&(n(G()),n(et({cacheOverride:!0,id:t})),f((C=>C+1)))}),[o.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,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 ha(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((I=>{const D=Ft(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),Z),b=y==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>n($i(I)),onSortChange:v})]})}const Ia=T((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.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(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ca(){const n=P(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((h=>wi(h,t??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[C,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=o.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,o.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:h,id:t})))}),[t,n,l]),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(Ri({id:t}))}),[a,t,n]),r.useEffect((()=>{a&&d!=null&&n(Ne({invoiceId:d}))}),[a,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{a||(v("idle"),m(!1),f(void 0),j(!1))}),[a]),r.useEffect((()=>{C&&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,C]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&o.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,o.actionState.fetchState]);const D=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ia,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:o,dunningAttempts:D,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:C,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||n(H({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const I=Tt(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({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(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))}}}))(Rn);function xa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((m=>Ot(m,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(Mi({invoiceId:t}))}),[a,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const ba=T((function(n){const e=_t(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,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(g.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 ja(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((I=>{const D=_t(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),Z),b=y==="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&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{n(Ui(I)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=On(),a=ft(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Da=T((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(Qi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Ki())}}}))(Mn);function Pa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Zi()),m.current=null}),[n,t]),r.useEffect((()=>{a&&t!=null&&n(Ne({invoiceId:t}))}),[a,n,t]),r.useEffect((()=>{c!=null&&t!=null&&o==="Completed"&&m.current!==t&&(m.current=t,n(Hi({localData:qi(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:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(a))}),[i,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:o}),s.jsx(La,{navigate:e,selectedPeriod:a,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Zt(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(Gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function wa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:C,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Zt(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),Z),b=y==="Completed",I=`/${t}/invoicing`,D=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(R)}`))}),[e,I,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(O)}`))}),[e,I,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&n(fe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(fe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onTypeChange:_=>{n(zi(_)),n(fe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:D})]})}const Fa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=t!=null&&t!=="",c=E(ue),d=E((h=>Wi(h))),l=E(Ji),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Yi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{a&&n(o&&t!=null?Ne({invoiceId:t}):Re({filters:{},keepExistingListItems:!1}))}),[a,n,t,o]),r.useEffect((()=>{o&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Xi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,o]),r.useEffect((()=>{if(o)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,o]);const C=r.useRef(l.fetchState);r.useEffect((()=>{const h=C.current;if(C.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!o||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,D=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:D}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(I)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(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}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,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(Oa),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",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(g.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}}))(Vn);function Ma(){const n=P(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),c=E((k=>Ue(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const C=S===i;ge(o),r.useEffect((()=>{o&&i!=null&&n(ot({id:i}))}),[o,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Be()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:C,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},j)]})}const Na=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},De=(n,e,t)=>{const i=[n,Ua(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),he=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:De(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Za=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=T((function(n,e){const t=Ue(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Za),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(he).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Be()),n(Fe(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(g.Event.invoicingSubscriptionSaved,{mode:a}),n(Ht({id:i}))}}}))(Zn);function qa(){const n=P(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=w(),[o]=W(),{areTenantIdsInSync:c}=F(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ue(S,i).localData));ge(c),r.useEffect((()=>{c&&(n(Re({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),n(Be())}}),[l,v,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Ka=T((function(n){const e=Kt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(g.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(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.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(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Hn);function Qa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[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]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((D=>{const h=Kt(D);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),Z),b=y==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]);const I=r.useRef(k);return r.useEffect((()=>{const D=I.current!=null&&k==null;I.current=k,D&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:D=>n(so(D)),onSortChange:v})]})}const za=T((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function Ga(){const n=P(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:a}=F(),o=E((d=>ro(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&n(lo({id:i}))}),[a,i,n]),U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(za,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:o})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=P(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:a,fieldHelp:o,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:C}=E(Qt),j=E(Ae);Ve({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(_e),k=n==="dunning"||n==="quickbooks",b=y.companyId??Ie.getSignedInUserTenant(i??"")?.companyId,I=E((A=>$t(A,b))),D=mo(y.userRole??[]),h=y.tenantId??"",_=Ie.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),Ze=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[t,e,a]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ke.shouldFetchActiveTenant(h)&&(Ke.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=a==="Not-Started"||a==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=a==="Completed"&&(!k||u==="Completed"),He=I.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,me=se?.invoicingMicroServiceBaseUrl,qe=me!=null&&me.length>0?`${me}/1.0/webhooks/stripe`:"",ve={deleteConnectionError:I.externalConnections?.deleteConnectionError?.message,deleteConnectionState:I.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:I,isAdmin:D,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{I.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(A,q)=>{He!=null&&h!==""&&e(ko(h,He,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:I.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:I.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:o,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ve,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:C,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Co(A,q)),onReconnectQBO:ve.onReconnectQBO,onRefreshQBO:ve.onRefreshQBO,onRetryQboSyncTask:A=>e(Gt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Io({settings:A,snackbarSection:Wa[n??""]}))},onStartQboBackfill:A=>e(zt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=J(),i=P(),{tenantEmailDomain:a}=w(),o=X("branding"),c=E((v=>bo(v))),d=E((v=>jo(Se,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i(Fe(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:g.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Kn,{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(Lo({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(Po()),updateFilesEntity:o.updateFilesEntity})]})}function Ja(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Ya(){const n=L(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Xa(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const es=T((function(n){const e=Jt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(Gt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(zt(e))}}}))(Wn);function ts(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=E(_e),{configFetchState:a,settingsFetchState:o}=E(Jt);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||n(Me())}),[n,o]),r.useEffect((()=>{a==="Not-Started"&&n(le())}),[a,n]),Ve({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=P(),t=L(),[i,a]=W(),o=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];a({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Jn,{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(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Xa,{})}),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(Ya,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ja,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:a,fetchState:o,status:c}=E(Nt),d=St(a.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Ae(m).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(Ro()))}),[d,a.fetchState,l,n,e]),c==null&&o!=="Error"?s.jsx(Yn,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Yo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Ga,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ca,{})}),s.jsx(x,{path:"catalog",element:s.jsx(zo,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-BHA40K9j.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as E,N as te,n as ne,o as p}from"./core-C_3BcvPm.js";import{TI as k,TJ as I,TK as F,IM as D,Iy as M,TL as B,TM as oe,TN as ie,IC as se,gh as j,IJ as le,IG as re}from"./zeni-epic-state-BK-HD5IA.js";import{a1 as x,J as r,a2 as de,h as v,Y as G,a3 as ce,a4 as me,a5 as pe,p as K,M as ue,y as he,a6 as ge,r as xe,E as fe,e as be,a7 as we,a8 as Se,_ as ye,a9 as ke,aa as Ie,ab as ve,ac as je}from"./index-DfdR1P4V.js";import{n as m}from"./mui-DsxbZgLG.js";import f from"./NotFoundScreen-BDRAfL_x.js";import{a as $}from"./sentry-CFLt6SLf.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="7c17a991-c4ce-48f6-8bd6-acdbf721a9ce",e._sentryDebugIdIdentifier="sentry-dbid-7c17a991-c4ce-48f6-8bd6-acdbf721a9ce")}catch{}})();const $e=m.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
10
|
-
`,Ce=g((function(e){const t=k(e),n=I(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(M(i))},onSaveHandler:i=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(F({data:l}))}}}))(de);function T(){const e=x(),{vendorId:t,billId:n}=S();return t==null||n==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx($e,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const De=m.div`
|
|
11
|
-
display: flex;
|
|
12
|
-
height: 100vh;
|
|
13
|
-
width: 100%;
|
|
14
|
-
flex: 1 1 auto;
|
|
15
|
-
flex-direction: column;
|
|
16
|
-
align-items: center;
|
|
17
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
18
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
19
|
-
`,Be=g((function(e,t){const{isSubPage:n}=t;return{addressToEdit:B(e),googleAPIKey:G.googleMapsAPIKey,isSubPage:n}}),(function(e,t){const{navigate:n,location:o}=t,i=()=>{const l=me(o.state?.pathnameStackToGoBack),s=l.poppedPathname??Pe();n(s,{state:{pathnameStackToGoBack:l.newStack}})};return{onSubmitHandler:l=>{const s=ze(l);e(oe({addressToCreate:s})),i()},onCancel:()=>{i()}}}))(ce);function Ae({isSubPage:e}){const t=C(),n=y(),o=x();return a.jsx(a.Fragment,{children:a.jsx(De,{windowSize:o,children:a.jsx(Be,{location:n,navigate:t,isSubPage:e===!0,googleAPIKey:G.googleMapsAPIKey})})})}const Pe=(e=2)=>{let t="../";for(let n=0;n<e;n++)t=`${t}../`;return t},ze=e=>({street:[e.street.addressString,e.suite,e.secondaryInfo],city:e.city,state:e.state,country:e.country.selectedOption??"",countryCode:e.countryCode,postalCode:e.postalCode,latitude:e.street.addressValue?.locationLat,longitude:e.street.addressValue?.locationLng}),Le=m.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
height: 100%;
|
|
22
|
-
width: 100%;
|
|
23
|
-
flex: 1 1 auto;
|
|
24
|
-
flex-direction: column;
|
|
25
|
-
align-items: center;
|
|
26
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
27
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
28
|
-
`,Ne=g((function(e){const t=k(e),n=I(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(M(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(F({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Ee(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Le,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Te=m.div`
|
|
29
|
-
display: flex;
|
|
30
|
-
height: 100%;
|
|
31
|
-
width: 100%;
|
|
32
|
-
flex: 1 1 auto;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
align-items: center;
|
|
35
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
36
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
37
|
-
`,Fe=g((function(e){const t=k(e),n=I(e),o=B(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=K(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Me(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Te,{windowSize:n,children:a.jsx(Fe,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Ge={containerWidth:new ve(100,58)},Ke=m(ke)`
|
|
38
|
-
width: ${r.sp4};
|
|
39
|
-
height: ${r.sp4};
|
|
40
|
-
margin-bottom: ${r.sp3};
|
|
41
|
-
margin-top: ${r.sp3};
|
|
42
|
-
margin-left: ${r.sp8};
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
position: absolute;
|
|
45
|
-
color: ${e=>e.theme.colors.brandColorJade};
|
|
46
|
-
`,Ve=m.div`
|
|
47
|
-
display: flex;
|
|
48
|
-
height: 100vh;
|
|
49
|
-
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
50
|
-
width: 100vw;
|
|
51
|
-
overflow-y: scroll;
|
|
52
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
53
|
-
`,_e=m.div`
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: ${e=>e.windowSize==="small"?"column":"row"};
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
width: ${e=>`${Ge.containerWidth.value(e.windowSize)}%`};
|
|
58
|
-
${e=>e.windowSize!=="small"?"overflow: auto;":""}
|
|
59
|
-
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
60
|
-
padding-top: ${e=>e.windowSize!=="small"?r.sp2:"0px"};
|
|
61
|
-
`,He=m.div`
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
align-items: center;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
padding: ${e=>e.windowSize==="small"?r.sp3:`62px ${r.sp6} ${r.sp9} ${r.sp8}`};
|
|
67
|
-
height: ${e=>e.windowSize==="small"?"490px":"auto"};
|
|
68
|
-
overflow: ${e=>e.windowSize==="small"?"unset":"hidden"};
|
|
69
|
-
width: ${e=>e.windowSize=="small"?"auto":"42%"};
|
|
70
|
-
background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
|
|
71
|
-
margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
|
|
72
|
-
`,Je=g((function(e,t){return{file:t.file,type:t.type}}))(Ie);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),V=n.pathname.includes("address"),b=x(),_=xe(),A=fe(),w=be(),H=()=>{_.toggle()},J=E((u=>k(u))),W=E((u=>I(u))),{authParams:U,fetchState:c,billAttachment:Y,billFetchState:P,companyName:q,currencySymbol:O,amount:Q}=J,{tenantId:z,userId:L,sessionId:N}=U,{fetchState:R,internationalBankAccountCreateStatus:X}=W;return $.useEffect((()=>{j()}),[]),$.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[w,c,i,o,d,t]),$.useEffect((()=>{w&&c==="Completed"&&(j(L,N,z),l!=null&&t(re(l)))}),[c,w,L,N,z,l,t]),c==="Error"?a.jsx(f,{}):R==="Completed"||X.fetchState==="Completed"?(j(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(we,{fetchState:c,style:{height:"100vh",backgroundColor:A.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${A.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(Se,{analytics:v,onLoad:u=>(Z=>Z.trackBillPayMagicLinkPageLoad(o??"",i??"",q,l??"",We(n.pathname),O,Q))(u)}),a.jsxs(Ve,{windowSize:b,children:[b!=="small"?a.jsx(Ke,{onClick:H}):null,a.jsx(He,{windowSize:b,isAddressPage:V,children:P==="In-Progress"?a.jsx(ye,{size:"ExtraLarge",start:!0}):a.jsx(Je,{file:Y,type:"bill"})}),a.jsx(_e,{windowSize:b,children:e})]})]})}const We=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ue(){return a.jsx(je,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Ue,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(T,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Ae,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Ee,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Me,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{da as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-BHA40K9j.js";import{a as g}from"./sentry-CFLt6SLf.js";import{u as U,g as _,h as w,t as A,j as l,N as L}from"./core-C_3BcvPm.js";import{z as r,E as M,G as P,R as V,h as N,S as G,Z as R,_ as W,W as Z}from"./index-DfdR1P4V.js";import{fE as $,Tb as q,TE as B,Tv as H,gh as J,gj as K,TA as Q,gT as X,di as Y,TF as ee,TG as te}from"./zeni-epic-state-BK-HD5IA.js";import{n as ne}from"./mui-DsxbZgLG.js";import{u as se}from"./useDeviceId-CZr7CPDW.js";import{f as ae}from"./analyticsHelper-Bfs4R3aB.js";import{t as ie}from"./getLocaleForTenant-CK0bI6xd.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="1ee5482a-c14f-4001-9df1-1a954f742d0c",t._sentryDebugIdIdentifier="sentry-dbid-1ee5482a-c14f-4001-9df1-1a954f742d0c")}catch{}})();const E=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ee(){const t=U(),a=_(),m=w(),[y]=A(),n=y.get("token"),p=y.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:C}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>$(e))),k=l((e=>q(e))),D=r.getSignedInUser(),T=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&E(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(B(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),g.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(k.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,T,void 0,k.tenantsInOrder),X().then((()=>{const e=Z();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(G.Event.loginSuccess,"email",Y(o.productSettings))}),2e3))}),[h,S,b,s,o,k,T,a.state,t]);const j=g.useCallback((()=>{m("/signin/auth")}),[m]),F=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return u.jsx(R,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!E(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",v=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:v,magicLinkExpired:!v&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(W,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as B}from"./liveblocks-BHA40K9j.js";import{a as m}from"./sentry-CFLt6SLf.js";import{u as te,j as t,i as $e,g as Ge,h as Me,q as _}from"./core-C_3BcvPm.js";import{fE as ne,Tc as xe,Td as se,g8 as Ne,fD as Pe,Tm as Re,Tf as Ve,Tg as je,p_ as Le,gl as Oe,Tj as b,To as Ue,Tp as Q,gm as Ze,Tq as ze,Dt as He,h0 as qe,cV as Ye,Tr as Ke,g7 as We,gn as Je}from"./zeni-epic-state-BK-HD5IA.js";import{w as Qe,i as Xe,r as ea,M as aa,c as ta,e as na,u as sa,y as c,f as oa,T as ia,z as ra,d as da,j as ca,$ as la,o as ua,k as ma,n as X,L as fa,F as ha,H as ba,p as S,h as ee,v as pa,K as ae,B as ga,D as Sa}from"./index-DfdR1P4V.js";import{D as Ta}from"./mui-DsxbZgLG.js";import{u as ka}from"./InboxNotificationsProvider-ICcfArFM.js";import{u as Ea}from"./useTaskManagerAccess-DJ8lZv1E.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new l.Error().stack;i&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[i]="bd9391db-b659-4231-9727-84acc1869b3c",l._sentryDebugIdIdentifier="sentry-dbid-bd9391db-b659-4231-9727-84acc1869b3c")}catch{}})();const Ca=Qe((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),T=ea(),n=Me(),F=Ne(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ea(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Pe(e))),{status:ie}=t(Re),G=$.uiState.currentChatSessionId,E=na(),{setLoading:re}=sa(),[w,M]=m.useState(void 0),v=_("/:tenantEmailDomain/dashboard")!==null,x=_("/:tenantEmailDomain/reports")!==null,f=_("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:N}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,N),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),P=t((e=>Ve(e))),{isFeatureEnabled:C}=d(c.isReferralFeatureEnabled),A=t((e=>je(e)));m.useEffect((()=>{E&&C&&!f&&A.fetchState==="Not-Started"&&r(Le(!0))}),[E,C,A.fetchState,f]);const D=t((e=>e.tenantState)),me=t((e=>D.fetchState==="Completed"?Oe(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:he}=d(c.isArAgingFeatureEnabled),R=ia(),{isFeatureEnabled:be}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Te=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>b(e).totalUnreadCount)),Ee=t((e=>b(e).reducedFetchCountState)),V=t((e=>b(e).notificationDetailsByTab.tasks.uiState.unreadCount)),j=t((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),L=t((e=>b(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:O,isLoading:U,isFetchingMore:Z,hasFetchedAll:z,fetchMore:Ce}=ka();m.useEffect((()=>{const e=setTimeout((()=>Ce?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(U===!1&&Z===!1&&z===!0)if(o?.companyId!=null&&O!=null){const e=`dashboard_${o.companyId}`;M(O.filter((u=>u.roomId===e&&u.readAt==null)).length)}else M(0)}),[U,Z,z]),m.useEffect((()=>{E&&k&&!f&&L.fetchState==="Not-Started"&&F.tenantId!=null&&r(Ue("task_manager","dashboard"))}),[E,k,f,L.fetchState,F.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(Q({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(Q({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ee,count:ke},H=s!=null?ra.getSignedInUserTenant(s):null,q=t((e=>H?.tenantId!=null?Ze(e,H.tenantId):void 0)),h=[];fe===!1&&h.push("accounts_payable_aging"),he===!1&&h.push("accounts_receivable_aging"),h.push("zeni_accounts_promo_card","treasury_promo_card"),C===!1&&h.push("rewards_card"),R===!1&&h.push("expense_automation_card");const Y=t((e=>ze(e,h).fetchState)),K=t((e=>He(e).fetchState)),ye=v&&(Y==="Completed"||Y==="Error")||x&&(K==="Completed"||K==="Error")||!v&&!x?void 0:"disabled",we=m.useMemo((()=>qe(o.userRole)),[o.userRole]),ve=Ye(we),Ae=o?.rewardsLastViewedTime==null,De=p?.userEmail!=null&&P.fetchState==="Completed"&&Ke(P.notificationSettings,p.userEmail,N,o,k),W=da(),_e=W&&ca(a);return B.jsx(Ta,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:B.jsx(la,{signedInUser:p,currentTenantId:D.currentTenantId??"",tenants:D.fetchState==="Completed"?me:q!=null?[q]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:X(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:ve,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Te,isNotificationsTabVisible:De,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:R,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:C,isRewardsAnimated:Ae,rewardsPlan:A.rewardsPlan},isAiCfoAccessEnabled:W,onNotificationIconClick:()=>{i(!1);let e=V===0&&j>0?"notifications/comments":"notifications/tasks";X(a)&&(e=V===0&&j>0?"../../notifications/comments":"../../notifications/tasks");const u=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:S(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,Be=ae(J)&&J!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),Be&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const Fe=ga(e.type);Sa(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${Fe}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ha({dispatch:r,navigate:n,pathToNavigate:ba(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{T.toggle()},isAiCfo:_e,aiCfoView:$,isOnDashboard:v,updateCurrentChatSessionId:e=>{r(We({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:be,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Fa=l=>{const i=te(),s=t((T=>ne(T))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(T,n)=>{Xe(n)&&xe(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return B.jsx(Ca,{...l,...a})};export{Fa as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-BHA40K9j.js";import{h as r,l as i}from"./core-C_3BcvPm.js";import{am as n}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import"./sentry-CFLt6SLf.js";import"./zeni-epic-state-BK-HD5IA.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as mt,a as lt,n as ft,j as N}from"./liveblocks-BHA40K9j.js";import ut from"./NotFoundScreen-BDRAfL_x.js";import{a as k}from"./sentry-CFLt6SLf.js";import{h as ht,g as pt,i as kt,u as gt,j as b,l as bt,n as St,o as K}from"./core-C_3BcvPm.js";import{cA as Tt,Tf as X,fE as Y,h0 as It,Tj as S,a0d as O,Tp as m,Td as A,zL as $,Fr as Ct,a0e as yt,Tc as At,Tr as Et,zQ as _t,a0f as F,br as j,gg as x,zU as Q,a0g as Nt,cM as Bt,cF as wt}from"./zeni-epic-state-BK-HD5IA.js";import{aq as xt,c as vt,M as Dt,y as Mt,as as Rt,dK as Pt,p as B,dL as Ut,w as Gt,dM as Ft,i as jt,a4 as $t}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import{u as Lt}from"./useAskAiCfoHostNavButtonProps-CnAY_u1k.js";import{u as Vt}from"./useTaskManagerAccess-DJ8lZv1E.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="2d4b6e10-2c76-4e63-9af1-00b5c68fb367",t._sentryDebugIdIdentifier="sentry-dbid-2d4b6e10-2c76-4e63-9af1-00b5c68fb367")}catch{}})();const qt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),zt=bt((function(t,l){const n=X(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=S(t),f=Y(t),{currentTab:T}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&Et(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[T].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:T,fetchMoreCommentsNotifications:D}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}d==="unread"&&t(Q("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(T(a),t(F([a],j())));let i=`/${h}/${r[1]}`;const I=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(A(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(O(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t($("task_manager","dashboard",d))}else D?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(Q("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(T(i),t(F([i],j())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(A({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),qt(o,T).then((()=>{t(F(o,j())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(A({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=$t(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Gt(Ft)),Wt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=Tt(h??""),o=gt(),f=vt(),[T,D]=k.useState(!1),a=b((e=>X(e))),s=b((e=>Y(e))),{useFeatureGate:d}=Dt(),{isFeatureEnabled:r}=d(Mt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:I}=Lt({mobileExploreReferrer:"Notifications"});Rt({isDataReady:!0});const Z=It(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const L=b((e=>S(e).notificationDetailsByTab.tasks.fetchState)),V=b((e=>S(e).currentTab)),M=b((e=>S(e).currentSubTab)),tt=b((e=>S(e).notificationDetailsByTab.comments.fetchCountState)),R=b((e=>S(e).notificationDetailsByTab.comments.fetchState)),et=b((e=>S(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=b((e=>S(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Pt().allUsers,{inboxNotifications:w,isLoading:E,hasFetchedAll:C,isFetchingMore:P,fetchMore:ot}=mt(),{threads:q,isLoading:z,fetchMore:W,isFetchingMore:H,hasFetchedAll:J}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(V!==c&&c!=null&&o(O(c)),c==null){const e=`../${V}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(E===!1&&C===!0&&s?.companyId!=null&&w!=null){const e=`dashboard_${s.companyId}`,p=w.filter((y=>y.roomId===e&&y.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(A({unreadCount:p},"comments"))}}),[E,C]),k.useEffect((()=>{L!=="In-Progress"&&g&&o($("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const U=E||P===!0||C!==!0||E||P===!0||C!==!0;k.useEffect((()=>{U&&R!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):U||R!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[U,R]),k.useEffect((()=>{o(A({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&T===!1&&(D(!0),o(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(E===!1&&z===!1&&w!=null&&q!=null){const e=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===e)).filter((u=>Ut(u.kind))),y=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const G=q.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return G!=null?{inboxNotification:{...u,threadId:G.id},thread:G}:(H||J===!0||W==null||W(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(A({totalCount:_.length,unreadCount:y.length},"comments")),o(yt(ct))}}),[E,P,H,C,J,z,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(jt(p)){const y=At(p.mode);if(y==="dashboard"&&o(A({unreadCount:p.data.unread},"tasks")),L!=="In-Progress"){const _=[];M==="all"?_.push("read","unread"):M!=="mentions"&&_.push(M),o($("task_manager",y,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Vt(f);return N.jsx(zt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:I,...nt})};function me(){return N.jsxs(St,{children:[N.jsx(K,{path:"/:selectedTab",element:N.jsx(Wt,{})}),N.jsx(K,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-BHA40K9j.js";import{a as r}from"./sentry-CFLt6SLf.js";import{u as A,g as j,j as o,N as x}from"./core-C_3BcvPm.js";import{TS as C,fE as P,gl as R,TT as z,TU as D,TV as M,TW as L,pR as k,Sx as N}from"./zeni-epic-state-BK-HD5IA.js";import{z as h,ah as I}from"./index-DfdR1P4V.js";import"./mui-DsxbZgLG.js";import"./recharts-CmYjG1zt.js";import"./analytics-DP3hAmgL.js";import"./plaid-ewZxuvzf.js";import"./dnd-BXrho-40.js";import"./stripe-cKAAJElX.js";import"./lottie-DHD1nzoa.js";import"./lexical-DY18TAnZ.js";import"./pdf-BmQFuRIG.js";import"./utils-D1gULS4n.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="4e1249b3-deeb-43bd-8854-70af7383960e",n._sentryDebugIdIdentifier="sentry-dbid-4e1249b3-deeb-43bd-8854-70af7383960e")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>C(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),p=h.isSignedIn(),a=h.getSignedInUser(),f=o((e=>P(e))),l=o((e=>R(e))),d=o((e=>e.tenantState.fetchState)),b=o(z),y=o(D),u=o(M),[S,v]=r.useState(null),[T,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&a!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[p,a,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const U=r.useMemo((()=>{if(f?.tenantId!=null)return f.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((_=>_.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[f?.tenantId,l]),c=S??U;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):p?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:v,approveError:T??y,isApproving:b==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&a!=null&&c!=null&&n(N(a.userId,a.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(x,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
|