@zeniai/web-app-ui 5.3.29-qa → 5.3.30-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-Bim1Hr_z.js → AccountMappingScreen-DwZgnpO5.js} +2 -2
- package/dist/assets/AddressRoutes-C62kNpv6.js +1 -0
- package/dist/assets/AddressScreen-CLiV0mfm.js +9 -0
- package/dist/assets/AiCfoScreen-CqZYbNVQ.js +22 -0
- package/dist/assets/AppDrawer-BIggl_eh.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-Cf5w1Fd_.js → BillPayApprovalRoutes-k9A_OynM.js} +1 -1
- package/dist/assets/{BillPayRoutes-DDeK4O3Z.js → BillPayRoutes-DqYiVdlx.js} +9 -9
- package/dist/assets/{BusinessVerificationPageScreen-BhpdMjkc.js → BusinessVerificationPageScreen-3R_uxb4s.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-BmeTr_5u.js → CardsAiCfoScreen-Bi4DWU-D.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-Y_ZnY6a9.js → ChargeCardRoutes-D_J5Jsfo.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-BChXj6Kk.js → CompanyPassportScreen-CWgdKqmQ.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-I4BlOLSg.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-B0zqTC0c.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CRNi6Rqr.js → CustomerOnboardingRoutes-DD4F_qvN.js} +5 -5
- package/dist/assets/{DashboardRoutes-CzNNddHy.js → DashboardRoutes-ZMo0onUW.js} +4 -4
- package/dist/assets/{DefaultTenantHome-CmugmZX7.js → DefaultTenantHome-BqaVnNI0.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DQgaUF67.js +18 -0
- package/dist/assets/DrawerScreen-C6V6LURt.js +1 -0
- package/dist/assets/EntityDetailRoutes-Dm568mMt.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-B1Pq1A36.js +38 -0
- package/dist/assets/FeaturePreviewScreen-B_aYJlol.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-ClpdRb8W.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-MlM0K3gF.js → InboxNotificationsProvider-BIRPulc1.js} +1 -1
- package/dist/assets/InvoicingRoutes-CBGWefo8.js +2 -0
- package/dist/assets/{MagicLinkRoutes-B3omwZ45.js → MagicLinkRoutes-Bnp_x7Nk.js} +20 -20
- package/dist/assets/MagicLinkSignInScreen-D-6FJGXy.js +12 -0
- package/dist/assets/{MobileAppDrawer-DigqZbbY.js → MobileAppDrawer-CcN5sT0f.js} +1 -1
- package/dist/assets/NotFoundScreen-fxNT7vgC.js +1 -0
- package/dist/assets/NotificationRoutes-BJVwBy9d.js +1 -0
- package/dist/assets/OAuthConsentScreen-DOVfptZ6.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-CGhv0VSW.js +1 -0
- package/dist/assets/{PaymentLinkScreen-fA05KlxQ.js → PaymentLinkScreen-Ci5gr6F7.js} +2 -2
- package/dist/assets/PeopleRoutes-Bee6xNme.js +22 -0
- package/dist/assets/PerformanceRoutes-CD6W5bUU.js +1 -0
- package/dist/assets/{Preview-CzyJ4PGQ.js → Preview-ByUhhrY0.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-ByKxBz2v.js → QBOConnectionScreen-IBpF64YF.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-B5KvxgyI.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-CuE7ORwk.js → ReimbursementApprovalRuleDetailScreen-DetQk8QU.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-6nUym5eB.js → ReimbursementRoutes-C9_awEWz.js} +9 -9
- package/dist/assets/ReportsRoutes-zo7ew2ho.js +1 -0
- package/dist/assets/RewardsRoutes-sTKxe2ug.js +1 -0
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CrWn6EEs.js +25 -0
- package/dist/assets/ScreenRoutes-DIYlkgqr.js +2 -0
- package/dist/assets/{SettingsRoutes-AaNqIdby.js → SettingsRoutes-BEdYLTM7.js} +6 -6
- package/dist/assets/{SetupPagesScreen-BgHIeOKB.js → SetupPagesScreen-Sjd63M0p.js} +5 -5
- package/dist/assets/SignInScreen-_27hdB-U.js +1 -0
- package/dist/assets/SignOutScreen-CDr6KmEf.js +9 -0
- package/dist/assets/TaskListScreen-DdkR5DtM.js +9 -0
- package/dist/assets/{TaskRoutes-BWLw4wFO.js → TaskRoutes-LOSKO78T.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-PwaQuAlN.js +1 -0
- package/dist/assets/TransactionDetailScreen-BlnM6_t9.js +5 -0
- package/dist/assets/TransactionListRoutes-Bx3VnAdU.js +1 -0
- package/dist/assets/TreasuryRoutes-BEdtvJnK.js +37 -0
- package/dist/assets/VendorsRoutes-DoXAtF5W.js +88 -0
- package/dist/assets/WiseConfirmationScreen-CVwWngtr.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-DpPln-Iv.js → ZeniAccountRoutes-BXfvCXHr.js} +8 -8
- package/dist/assets/ZeniAccountStatementScreen-C3siKg2V.js +9 -0
- package/dist/assets/{accountMappingHelper-BIF4Ld_b.js → accountMappingHelper-CU6wucuM.js} +1 -1
- package/dist/assets/{analytics-B5-t19F2.js → analytics-BgUj-hR5.js} +1 -1
- package/dist/assets/{analyticsHelper-5kEw8e8E.js → analyticsHelper-Cypw_xC0.js} +1 -1
- package/dist/assets/{core-C5rVvNoh.js → core-CMivCywN.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-ChlmY296.js → decodeURIComponentSafe-DRefzrWS.js} +1 -1
- package/dist/assets/{dnd-DqvXOfHm.js → dnd-B8NpvFCU.js} +1 -1
- package/dist/assets/{empty-D5lwiblX.js → empty-CawgNJEF.js} +1 -1
- package/dist/assets/{empty-BTHEbwNZ.js → empty-CllNfDt1.js} +1 -1
- package/dist/assets/{emptyVideoElement-I-9RXuP2.js → emptyVideoElement-DBVZ22o5.js} +1 -1
- package/dist/assets/{epic-DYPr57kS.js → epic-Cw47VvOB.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-DT3oLJj6.js → expenseAutomationHelper-BuTA7ucx.js} +1 -1
- package/dist/assets/getLocaleForTenant-DCXbCJAu.js +1 -0
- package/dist/assets/{index-DCp3lIjg.js → index-BnHTUbKj.js} +1 -1
- package/dist/assets/{index-CZcqif3N.js → index-CD-EymjZ.js} +2 -2
- package/dist/assets/{index-CGyxP256.js → index-Cx55eHdr.js} +1 -1
- package/dist/assets/{index-De1cB3Ka.js → index-DCnLtCHg.js} +1 -1
- package/dist/assets/{index-Bue9AeKl.js → index-Djuwyi3d.js} +1 -1
- package/dist/assets/{index-BTTzX8oM.js → index-DlMGj3Af.js} +16552 -16499
- package/dist/assets/{index-CibO_KMz.js → index-XoGDegrx.js} +1 -1
- package/dist/assets/{index-DMhoHJcD.js → index-baDCTZK3.js} +1 -1
- package/dist/assets/{lexical-BO1ifV0W.js → lexical-Di6ZXkXF.js} +1 -1
- package/dist/assets/{liveblocks-BhGApeF9.js → liveblocks-mJJR3MsR.js} +1 -1
- package/dist/assets/{lottie-CSUQXsXJ.js → lottie-BTBtSLCO.js} +1 -1
- package/dist/assets/{mui-AVx3Hg0F.js → mui-C6XtNCo7.js} +1 -1
- package/dist/assets/{pathToGoBack-CW7sD0XS.js → pathToGoBack-DkQc48Fj.js} +1 -1
- package/dist/assets/{pdf-B6tAgCXh.js → pdf-DSDpdkmb.js} +3 -3
- package/dist/assets/{pdf-lib-u-Ml-CIk.js → pdf-lib-BbzL8H1t.js} +1 -1
- package/dist/assets/{plaid-BuoWWOAj.js → plaid-l8YRzpBD.js} +1 -1
- package/dist/assets/{pusher-D8sdZANA.js → pusher-B8Hm6DMT.js} +1 -1
- package/dist/assets/{react-Sh9CA0od.js → react-BeA4fGXX.js} +1 -1
- package/dist/assets/{react-DAMRot7g.js → react-CFob_XAv.js} +1 -1
- package/dist/assets/{react-DzRqKqJZ.js → react-CexHjl19.js} +1 -1
- package/dist/assets/{react-DbafCI99.js → react-FrhNEOT3.js} +1 -1
- package/dist/assets/{react-q70XtbNu.js → react-TfJbQpIh.js} +1 -1
- package/dist/assets/{react-BslW5-Xl.js → react-hzw_vRmY.js} +1 -1
- package/dist/assets/{recharts-uwVP8vj-.js → recharts-Co0_Dmc-.js} +1 -1
- package/dist/assets/routePaths-Bpj3i3MK.js +1 -0
- package/dist/assets/{sentry-B98sAG37.js → sentry-CItQHKpv.js} +1 -1
- package/dist/assets/{url-qe19dJXu.js → url-MmuF1WQx.js} +1 -1
- package/dist/assets/{url-RaJlDbzw.js → url-xQ9KNY2e.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CBJFyF6T.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-eZEppiJu.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-D3l-sj94.js +1 -0
- package/dist/assets/{useDeviceId-6INyJgde.js → useDeviceId-DJLfe-br.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DlmntN_b.js +1 -0
- package/dist/assets/useInitialThreadRequest-DBDsuRGA.js +1 -0
- package/dist/assets/{useTaskManagerAccess-vcnpqvQT.js → useTaskManagerAccess-B7jKkFFv.js} +1 -1
- package/dist/assets/{utils-B1bcOxs7.js → utils-macSqF2O.js} +1 -1
- package/dist/assets/withTransactionSidePanel-DMpmT4ot.js +25 -0
- package/dist/assets/{zeni-epic-state-BVExw1ei.js → zeni-epic-state-CqKBThJ0.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-CdDnkC-7.js +0 -1
- package/dist/assets/AddressScreen-Dyq7f1j-.js +0 -9
- package/dist/assets/AiCfoScreen-BAtt2kQC.js +0 -22
- package/dist/assets/AppDrawer-BGKn6F8p.js +0 -10
- package/dist/assets/ConnectionAuthScreen-DboT0gK7.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-C9C7O3K1.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-C2hFGwu0.js +0 -18
- package/dist/assets/DrawerScreen-lK0vJxIS.js +0 -1
- package/dist/assets/EntityDetailRoutes-BSm0QeV6.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-CVR_qG3c.js +0 -25
- package/dist/assets/FeaturePreviewScreen-CVnp0bZd.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-Ck10qQ6V.js +0 -1
- package/dist/assets/InvoicingRoutes-Q8vi5u3U.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-D8Vs7E-F.js +0 -12
- package/dist/assets/NotFoundScreen-C_nzijM_.js +0 -1
- package/dist/assets/NotificationRoutes-DKgxAwSp.js +0 -1
- package/dist/assets/OAuthConsentScreen-DY5NR4TR.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-5el-0Lj7.js +0 -1
- package/dist/assets/PeopleRoutes-DJYa775V.js +0 -22
- package/dist/assets/PerformanceRoutes-CrDIRhB1.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-CGtOCJ7F.js +0 -1
- package/dist/assets/ReportsRoutes-s2hJ2RsR.js +0 -1
- package/dist/assets/RewardsRoutes-C-di4Yoz.js +0 -1
- package/dist/assets/ScreenRoutes-BhCi8qGV.js +0 -2
- package/dist/assets/SignInScreen-DCTVuESb.js +0 -1
- package/dist/assets/SignOutScreen-Dl74ZT33.js +0 -9
- package/dist/assets/TaskListScreen-D4isBRlx.js +0 -9
- package/dist/assets/TransactionDetailRoutes-BLhI-0B0.js +0 -1
- package/dist/assets/TransactionDetailScreen-IKPgPc-W.js +0 -5
- package/dist/assets/TransactionListRoutes-Bu8kgDQQ.js +0 -1
- package/dist/assets/TreasuryRoutes-CZBiOy69.js +0 -37
- package/dist/assets/VendorsRoutes-KMa9llQ2.js +0 -112
- package/dist/assets/WiseConfirmationScreen-tpmS2fpR.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-C_X33S2u.js +0 -9
- package/dist/assets/getLocaleForTenant-DQ9OiUn_.js +0 -1
- package/dist/assets/routePaths-Cx9L8hBM.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-C7_zR2C_.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-XPXgI-Bx.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-98NnzJRh.js +0 -1
- package/dist/assets/useInitialThreadRequest-DuL5mYzq.js +0 -1
- package/dist/assets/withTransactionSidePanel-F28FfzEK.js +0 -25
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BhGApeF9.js";import{a as r}from"./sentry-B98sAG37.js";import{u as P,h as A,i as F,j as E,t as W,l as O,s as Z,g as Y,N as B,n as te,o as y}from"./core-C5rVvNoh.js";import{a6 as lt,h as p,ao as T,Q as g,c9 as dt,ca as ut,cb as gt,cc as mt,cd as vt,ce as pt,cf as ft,cg as St,ch as ht,ci as Ct,cj as It,ck as Et,cl as kt,cm as yt,p as J,cn as xt,co as bt,ac as ae,cp as jt,cq as Dt,z as Se,cr as Pt,cs as At,ct as Lt,cu as $t,cv as wt,cw as Ft,cx as Tt,cy as Rt,V as Ot,ag as Sn,cz as _t,cA as Mt,cB as Nt,cC as Ut,cD as Bt,cE as Vt,cF as Zt,cG as Ht,cH as qt,t as Ke,g as hn,cI as Kt,cJ as Qt,cK as Gt,cL as zt,cM as Wt,cN as Yt,cO as Jt}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import{A as K}from"./AddressScreen-Dyq7f1j-.js";import M from"./NotFoundScreen-C_nzijM_.js";import{YY as Xt,YZ as ei,uM as Qe,Y_ as je,Y$ as Q,vQ as Ge,vX as ni,w0 as Cn,Z0 as De,Z1 as In,vU as En,Z2 as Pe,vS as kn,yw as ti,vT as ii,Z3 as G,vd as se,vM as oi,xn as ze,vc as he,Z4 as ai,Z5 as yn,w7 as si,Z6 as z,we as ci,Z7 as ri,Z8 as xn,Z9 as bn,yi as li,Za as de,Zb as We,Zc as jn,va as di,Zd as ui,v4 as gi,Ze as mi,xA as vi,Zf as Dn,xJ as Ye,Zg as pi,xG as fi,Zh as Ae,gd as Si,Zi as ee,Zj as ne,wt as hi,vi as Je,Zk as Le,vn as Pn,vl as Ci,vf as Ii,wm as Ei,vp as ki,wv as yi,Zl as Ce,wC as An,wA as Ie,Fm as $e,xP as Xe,Zm as xi,vb as we,Zn as Fe,vy as Ee,vv as ke,vI as Ln,vH as Te,vs as bi,vB as $n,vK as ie,fB as Re,UL as wn,ve as Oe,vF as ji,vG as Di,vE as Pi,Zo as Ai,wa as en,wf as Li,wb as Fn,Zp as Tn,u_ as nn,Zq as $i,uW as Rn,Zr as wi,xV as Fi,xZ as H,xU as Ti,x1 as _e,Zs as Ri,Zt as On,y6 as tn,Zu as Oi,y3 as _i,Zv as _n,x4 as Mi,x5 as V,x8 as Ni,Zw as Mn,xi as me,Zx as Ui,wu as Nn,Tj as Un,Zy as Bi,xs as Vi,Zz as Bn,ZA as Zi,ZB as Hi,ZC as qi,yX as Ki,ZD as Qi,ZE as Vn,yd as Zn,ZF as Hn,yV as ve,ZG as Gi,yS as zi,ZH as Wi,ZI as Yi,ZJ as Ji,ZK as Xi,ZL as eo,ZM as on,ZN as no,y$ as to,ZO as Me,wM as an,ZP as Ne,ZQ as ce,wW as qn,wR as Kn,wP as ye,ZR as io,wH as oo,yj as Qn,yK as sn,yF as ao,ZS as so,yk as co,ZT as ro,yL as lo,yP as uo,ZU as go,ZV as Gn,c7 as mo,mo as vo,mp as po,ZW as cn,vR as re,gh as fo,uc as So,mv as ho,yC as zn,zb as Co,yz as Wn,ui as Io,z8 as rn,u6 as Eo,z5 as ln,hP as ko,TL as dn,TM as yo,Fy as Yn,hH as xo,ZX as bo,UA as jo,ZY as Do,zh as pe,zi as Po,ZZ as Ao,Z_ as Jn,ze as Lo,Z$ as $o,_0 as wo,xw as Fo,_1 as To}from"./zeni-epic-state-BVExw1ei.js";import{M as Ro}from"./MobileAppDrawer-DigqZbbY.js";import{q as le}from"./QBOConnectionScreen-ByKxBz2v.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./InboxNotificationsProvider-MlM0K3gF.js";import"./useTaskManagerAccess-vcnpqvQT.js";import"./empty-BTHEbwNZ.js";import"./pdf-lib-u-Ml-CIk.js";import"./index-DMhoHJcD.js";import"./url-RaJlDbzw.js";import"./index-CGyxP256.js";import"./decodeURIComponentSafe-ChlmY296.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="b12010f2-2ce3-4fda-a998-c12e113cf413",t._sentryDebugIdIdentifier="sentry-dbid-b12010f2-2ce3-4fda-a998-c12e113cf413")}catch{}})();const w=({event:t,isReady:e=!0})=>e?s.jsx(lt,{analytics:p,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function Oo(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:h,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:k}=E(Xt),x=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${n??""}/invoicing`,I=r.useCallback(((_,R)=>{const U=ei(b,_,R,j);U!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:_,entityId:R,fromScreen:"audit_log"}),e(U))}),[j,e,b]);r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&t(Qe({filters:x,keepExistingListItems:!1,sort:u}))}),[i,x,u,t]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,C=m==="In-Progress"&&f.length>0,L=m==="Completed";return N(m)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingAuditLogPage,isReady:L}),s.jsx(dt,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:k,entries:f,hasMore:S,isLoading:D,isLoadingMore:C,searchValue:o,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&h!=null&&t(Qe({cursor:h,filters:x,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Xn=[],Mo=In((t=>t.length>0?t:Xn),mt),No=In((t=>t.length>0?t:Xn),gt),Uo=O((function(t,e){const{view:n}=e;return{groupedAccountOptions:Mo(n.qboAccountHierarchy),groupedClassOptions:No(n.qboClassHierarchy),catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?o=>{i!==""&&t(En({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&t(De({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),t(Cn({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&t(ni({action:a,id:o,parentItemId:i}))}}}))(ut);function Bo(){const t=P(),e=A(),{item_id:n,tenantEmailDomain:i}=F(),[o]=W(),{areTenantIdsInSync:a}=T(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>je(k,n))),{pageFetchState:v,plan:u}=l,m=v.fetchState;r.useEffect((()=>(t(Q()),()=>{t(Q())})),[t]),r.useEffect((()=>{a&&t(Ge({id:n,kind:c}))}),[a,n,c,t]);const[S,f]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(t(Q()),t(Ge({cacheOverride:!0,id:n,kind:c})),f((k=>k+1)))}),[l.fetchState,t,n,c]);const h=u==null&&(m==="Not-Started"||m==="In-Progress"),j=m==="Completed";return N(m)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogItemDetailPage,isReady:j}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:c,isLoading:h,view:l},S)]})}function Ue(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=t,a=P(),{areTenantIdsInSync:c}=T(),d=E(Pe),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(kn()),n&&a(ti()))}),[c,a,e,n,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Be(t,e=!1){const n=P(),i=E((c=>G(c).productNextCursor!=null)),o=E((c=>G(c).productNextCursor)),a=E((c=>G(c).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&a!=="Not-Started"||n(se({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&a!=="In-Progress"&&i&&o!=null&&n(se({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=O((function(t,e){const n=je(t,e.itemId);return{fieldHelp:n.fieldHelp,isQboPickerDataLoading:n.isQboPickerDataLoading,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:o}=e,a=o!=null?`${n}/catalog/${encodeURIComponent(o)}`:`${n}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),t(Q()),e.navigate(`${n}/catalog`)},onChange:c=>{t(De({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),t(Cn({id:o}))}}}))(vt);function qo(){const t=P(),e=A(),{item_id:n,tenantEmailDomain:i}=F(),[o]=W(),{areTenantIdsInSync:a}=T(),c=n!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>je(S,n)));return Be(a,!0),Ue({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&n!=null&&t(oi({id:n,kind:v}))}),[a,n,v,t]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||t(De({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,t]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??n,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),t(Q())}}),[m.fetchState,m.savedItemId,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:n})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=O((function(t,e){const n=G(t),i=e.activeTab==="plans",o=e.activeTab==="all",a=i?n.plans:o?[...n.plans,...n.products]:n.products,c=i||o&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:o&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.length>0,plans:n.plans,productColumns:n.productColumns,products:n.products}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",a=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${n}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${n}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{t(En({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&t(he({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(se({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));a!=null&&t(i?he({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):se({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pt);function Go(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,h=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),k=E((_=>G(_))),x=k.planFilters.search,b=k.planSort,I=k.planNextCursor,D=k.productNextCursor,C=k.fetchState==="Completed",L=k.runningActionId??null;return r.useEffect((()=>{const _=setTimeout((()=>v(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&t(ze({cacheOverride:!1,planFilters:h,productFilters:j,planSort:S,productSort:S}))}),[i,t,h,j,S]),r.useEffect((()=>{i&&(f!==x||S?.field!==b?.field||S?.dir!==b?.dir)&&t(ze({cacheOverride:!0,planFilters:h,productFilters:j,planSort:S,productSort:S}))}),[x,b,i,t,h,j,f,S]),N(k.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCatalogPage,isReady:C}),s.jsx(Qo,{navigate:e,tenantEmailDomain:n,activeTab:c,searchValue:o,sortState:u,planFilters:h,productFilters:j,sort:S,planNextCursor:I,productNextCursor:D,runningCatalogItemActionId:L,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const zo=O((function(t,e){const n=yn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode,periodUnitOptions:n.periodUnitOptions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),t(z()),e.navigate(`${n}/discounts`)},onChange:c=>{t(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),t(ci({id:i}))}}}))(ft);function Wo(){const t=P(),e=A(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),{fetchState:a,savedCouponId:c}=E((d=>yn(d,n)));return r.useEffect((()=>{o&&n!=null&&t(si({id:n}))}),[o,n,t]),r.useEffect((()=>{if(a==="Completed"){const d=c??n,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),t(z())}}),[a,c,n,t,e,i]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCouponFormPage}),s.jsx(zo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Yo=O((function(t){const e=xn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:o=>{e(jn(o))},onSubmit:()=>{const o=ui(t.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(ht);function Jo(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),[i]=W(),{areTenantIdsInSync:o}=T(),a=i.get("customerId"),c=E((I=>xn(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(bn),m=E((I=>li(I))),S=E(de),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,h=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||h,k=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(t(We()),()=>{t(We())})),[t]);const x=r.useRef(!1);r.useEffect((()=>{x.current||a==null||a===""||l.customerId!==""||(x.current=!0,t(jn({...l,customerId:a})))}),[a,l,t]),r.useEffect((()=>{o&&t(di({cacheOverride:!1}))}),[o,t]);const b=r.useRef(d);return r.useEffect((()=>{const I=b.current;if(b.current=d,I!=="Completed"&&d==="Completed"){const D=v!=null?`/${n}/invoicing/invoices/${encodeURIComponent(v)}`:`/${n}/invoicing/invoices`;e(D)}}),[d,v,e,n]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreateInvoicePage,isReady:k}),j?s.jsx(St,{}):s.jsx(Yo,{navigate:e,tenantEmailDomain:n})]})}const Xo=O((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(Ct);function ea(){const t=P(),e=A(),{credit_note_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((d=>mi(d,n??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&n!=null&&t(vi({id:n}))}),[o,n,t]),N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Xo,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:a})]})}const na=O((function(t){const e=Dn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(It);function ta(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,creditNoteListFetchState:k}=E((b=>{const I=Dn(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),Z),x=k==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Ye({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCreditsListPage,isReady:x}),s.jsx(na,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(pi(b)),onSortChange:v})]})}const et=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},ia=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:n.record.invoicingCustomer==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:o=>{t(Ce({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${n}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${n}/subscriptions/new`),onOpenAddress:()=>{const o=et(e.tenantEmailDomain??"",Ie,i),a=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),t(Ce({id:i,localData:o})),t(An({id:i}))},onFetchPaymentLinkEmailPreview:o=>t(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>t(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)}}}))(yt);function oa(){const t=P(),e=A(),n=Y(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),c=E((L=>Ae(L,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),{plaidTokenFetchState:f,promotionalCreditSubmitState:h}=c,{paymentMethodSaveState:j,setupIntentFetchState:k,stripeConnected:x}=c.record,b=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const L=c.record.sendLinkState.fetchState;b.current!=="Error"&&L==="Error"&&t(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),b.current=L}),[t,c.record.sendLinkState.fetchState]);const I=k.fetchState==="Error"?k.error?.message??"Failed to start card setup.":j.fetchState==="Error"?j.error?.message??"Failed to save payment method.":f.fetchState==="Error"?f.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(ee()),t(ne()),()=>{t(ee()),t(ne())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{a&&i!=null&&t(hi({id:i}))}),[a,i,t]),r.useEffect((()=>{a&&i!=null&&x&&t(Je({customerId:i}))}),[a,i,t,x]);const[D,C]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(t(Le()),i!=null&&t(Pn({id:i})),C((L=>L+1)))}),[c.fetchState,t,i]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,location:n,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{t(ee()),i!=null&&x&&t(Je({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{t(ne()),S(!0)}},D),s.jsx(Et,{errorMessage:I,isCreatingSetupIntent:k.fetchState==="In-Progress",isSaving:j.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:j.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:x,onChooseCard:()=>{i!=null&&t(Ii({customerId:i}))},onClose:()=>{u(!1),t(ee())},onSavePaymentMethod:L=>{i!=null&&t(Ci({customerId:i,data:L}))}}),s.jsx(kt,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:h.fetchState==="Error"?h.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:h.fetchState==="In-Progress",open:m,submitSucceeded:h.fetchState==="Completed",onClose:()=>{S(!1),t(ne())},onSubmit:({amount:L,description:_})=>{i!=null&&t(Ei({amount:L,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:_}))}})]})}const aa=O((function(t,e){const n=Ae(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),t(Le()),t($e(Ie)),e.navigate(`${n}/customers`)},onChange:c=>{t(Ce({id:i,localData:c}))},onOpenAddress:()=>{const c=et(e.tenantEmailDomain??"",Ie,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),t(An({id:i}))}}}))(xt);function sa(){const t=P(),e=A(),n=Y(),{customer_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&t(Pn({id:i}))}),[a,i,t]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),t(Le())}}),[c,d,i,t,e,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:n,navigate:e,tenantEmailDomain:o})]})}const ca=O((function(t){const e=de(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&t(we({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bt);function ra(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,customerListFetchState:k}=E((b=>{const I=de(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),Z),x=k==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(Xe({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingCustomersListPage,isReady:x}),s.jsx(ca,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(xi(b)),onSortChange:v})]})}const xe=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),la=O((function(t,e){const{filters:n,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:n,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:xe(o,i)}}),(function(t,e){const{downloadUrl:n,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=xe(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{n!=null&&window.open(n,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&t(ke({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&t(Te(a))},onRollback:S?()=>{a!=null&&t(Ln(a))}:void 0}}))(jt);function da(){const t=P(),e=A(),{sessionId:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),[a,c]=r.useState({}),d=E(Fe),l=xe(d,n),v=n==null?void 0:d.diagnosticsBySession[n];r.useEffect((()=>{o&&n!=null&&t(Ee(n))}),[o,t,n]),r.useEffect((()=>{if(!o||n==null)return;const f=setTimeout((()=>{t(ke({...a,sessionId:n}))}),300);return()=>clearTimeout(f)}),[o,t,a,n]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||n==null||!u)return;const f=setInterval((()=>{t(Ee(n)),t(ke({...a,sessionId:n}))}),3e3);return()=>clearInterval(f)}),[o,t,a,u,n]);const m=r.useMemo((()=>{if(n==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const h=f.toString();return`${ae?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[a,n]),S=v?.fetch.fetchState??"Not-Started";return N(S)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:n,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const nt=t=>`invoicing_active_migration:${t}`,oe=(t,e)=>{if(t!=null&&t!=="")try{const n=nt(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ua=O((function(t,e){const{sessions:n,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:n,statusRows:a}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,o=a=>{const c=a??null;t(ie(c)),oe(i,c),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),t(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),t(Ln(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),n(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Dt);function ga(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),o=E(Fe);r.useEffect((()=>{i&&(t(bi()),t($n()))}),[i,t]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:n,view:o})]})}const ma=O((function(t,e){const{activeId:n,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=n!=null?d[n]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===n)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=ae?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),t(Pi())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{n!=null&&t(Te(n))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),n!=null&&t(Di(n))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),t(ji({files:a}))},onViewDetails:n==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(Pt);function va(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),o=E(bn),a=E(Re).companyId??Se.getSignedInUserTenant(n??"")?.companyId,c=E((f=>wn(f,a))),d=E(Fe),{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&&(t(Oe()),t($n()))}),[i,t]),r.useEffect((()=>{if(l!=null)return;const f=(h=>{if(h==null||h==="")return null;try{return sessionStorage.getItem(nt(h))}catch{return null}})(n);f!=null&&t(ie(f))}),[l,t,n]),r.useEffect((()=>{oe(n,l)}),[l,n]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{t(Ee(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,t]),r.useEffect((()=>{m==="done"&&(t(ie(null)),oe(n,null))}),[t,m,n]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:n,view:d,onBack:()=>{t(ie(null)),oe(n,null),e(`/${n}/invoicing/data_import`)}})]})}const pa=O((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:n.coupon==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:o=>{t(Fn({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),t(Li({data:o,id:i}))}}}))(At);function fa(){const t=P(),e=A(),{coupon_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((m=>Ai(m,n))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed";r.useEffect((()=>(t(z()),()=>{t(z())})),[t]),r.useEffect((()=>{o&&t(en({id:n}))}),[o,n,t]);const[v,u]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(t(z()),t(en({cacheOverride:!0,id:n})),u((m=>m+1)))}),[a.fetchState,t,n]),N(d)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{couponId:n??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},v)]})}const Sa=O((function(t){const e=Tn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,o)=>{t(Fn({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(Rn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Lt);function ha(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,couponListFetchState:k,runningDiscountActionId:x}=E((I=>{const D=Tn(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),Z),b=k==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(o)),300);return()=>clearTimeout(I)}),[o]),r.useEffect((()=>{i&&t(nn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(nn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:x,onSearchChange:a,onStatusChange:I=>t($i(I)),onSortChange:v})]})}const Ca=O((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>t(H({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),t(H({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),t(H({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),t(H({action:"retry",id:i}))}:void 0}}))(wt);function Ia(){const t=P(),e=A(),{case_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((C=>wi(C,n??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[h,j]=r.useState(!1),k=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),x=r.useCallback((()=>{if(n==null)return;t(Fi({id:n})),v("idle"),m(!1);const C=a.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),j(!0)}),[n,t,a.emailPreview.preview]),b=r.useCallback((C=>{n!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:n}),t(H({action:"send-email",body:C,id:n})))}),[n,t,l]),I=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&n!=null&&t(Ti({id:n}))}),[o,n,t]),r.useEffect((()=>{o&&d!=null&&t(_e({invoiceId:d}))}),[o,d,t]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[n]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{h&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,h]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(n!=null&&t(Ri({id:n})),k()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[n,k,t,l,u,a.actionState.fetchState]);const D=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:a,dunningAttempts:D,onSendEmail:x}),s.jsx($t,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:k,onSend:b,open:h,preview:I,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=O((function(t){const e=On(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${n}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||t(H({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&t(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ft);function ka(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,dunningCaseListFetchState:k}=E((b=>{const I=On(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),Z),x=k==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&t(tn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(tn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingDunningListPage,isReady:x}),s.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>t(Oi(b)),onSortChange:v})]})}const ya=O((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:n.invoice==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),t(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),t(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
|
|
2
|
-
`).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),t(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))}}}))(Tt);function xa(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=E((l=>_n(l,n??""))),c=a.pageFetchState.fetchState,d=c==="Completed";return r.useEffect((()=>{o&&n!=null&&t(Mi({invoiceId:n}))}),[o,n,t]),N(c)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:n??"",navigate:e,tenantEmailDomain:i,view:a})]})}const ba=O((function(t){const e=Mn(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;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(`${n}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":t(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":t(V({action:"regenerate",invoiceId:i}));break;case"void":t(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),t(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&t(Nn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Rt);function ja(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,invoiceListFetchState:k,voidingInvoiceId:x}=E((I=>{const D=Mn(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),Z),b=k==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(o)),300);return()=>clearTimeout(I)}),[o]),r.useEffect((()=>{i&&t(me({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(me({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:x,onSearchChange:a,onStatusChange:I=>{t(Ui(I)),t(me({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function un(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),i=Ot(),o=Sn(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Un),v=Bi(i?.loggedInUserRoleMap),u=`/${n}/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(Ro,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_t,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{t(Vi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Da=O((function(t,e){const n=Bn(t,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,submitState:c,typeOptions:d}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:a,typeOptions:d}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:o=>{t(Qi({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Ki())}}}))(Mt);function Pa(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Bn(f,n??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{t(Zi()),m.current=null}),[t,n]),r.useEffect((()=>{o&&n!=null&&t(_e({invoiceId:n}))}),[o,t,n]),r.useEffect((()=>{c!=null&&n!=null&&a==="Completed"&&m.current!==n&&(m.current=n,t(Hi({localData:qi(c)})))}),[t,a,c,n]);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(w,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Aa=O((function(t){return{invoicingOverview:Vn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{t(Zn(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Nt);function La(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Vn(c).fetchState))==="Completed";return r.useEffect((()=>{i&&t(Zn(o))}),[i,t,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(Aa,{navigate:e,selectedPeriod:o,tenantEmailDomain:n})]})}const $a=O((function(t){const e=Hn(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&t(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ut);function wa(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:h,nextCursor:j,transactionListFetchState:k,transactions:x}=E((L=>{const _=Hn(L);return{activeType:_.activeTab,appliedSearch:_.filters.search,appliedSort:_.sort,nextCursor:_.nextCursor,transactionListFetchState:_.fetchState,transactions:_.transactions}}),Z),b=k==="Completed",I=`/${n}/invoicing`,D=r.useCallback((L=>{const _=x.find((U=>U.id===L)),R=_?.linkedInvoices?.[0]?.invoiceID??_?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(R)}`))}),[e,I,x]),C=r.useCallback((L=>{const _=x.find((R=>R.id===L))?.customerID;_!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:_,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(_)}`))}),[e,I,x]);return r.useEffect((()=>{const L=setTimeout((()=>d(o)),300);return()=>clearTimeout(L)}),[o]),r.useEffect((()=>{i&&t(ve({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:n,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:L=>{t(Gi(L)),t(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:C,onViewTransactionInvoice:D})]})}const Fa=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id},gn=(t,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(t);function mn(){const t=P(),e=A(),{invoice_id:n,tenantEmailDomain:i}=F(),{areTenantIdsInSync:o}=T(),a=n!=null&&n!=="",c=E(de),d=E((C=>Wi(C))),l=E(Yi),v=E((C=>_n(C,n??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Ji()),S.current=null,f.current=""}),[t,n]),r.useEffect((()=>{o&&t(a&&n!=null?_e({invoiceId:n}):we({filters:{},keepExistingListItems:!1}))}),[o,t,n,a]),r.useEffect((()=>{a&&u!=null&&n!=null&&v.fetchState==="Completed"&&S.current!==n&&(S.current=n,t(Xi({contextInvoiceId:n,localData:eo(u)})))}),[t,u,n,v.fetchState,a]),r.useEffect((()=>{if(a)return;const C=d.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t(Nn({filters:{customerId:C},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&t(on({localData:{...d.localData,customerId:C,invoiceToLink:""}})))}),[t,d.localData,a]);const h=r.useRef(l.fetchState);r.useEffect((()=>{const C=h.current;if(h.current=l.fetchState,C!=="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((C=>({id:C.id,name:Fa(C)})))),[c.customers]),k=E((C=>no(C,d.localData.customerId))),x=r.useMemo((()=>k.map((C=>({amountDue:gn(C.amountDue,"USD"),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber})))),[k]),b=r.useMemo((()=>{if(!a||u==null)return;const C=u.currencyCode??"USD",L=u.amountDue?.amount??0;return{amountDue:gn(L,C),amountDueValue:L,currencyCode:C,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),I=a?`${m}/invoices/${encodeURIComponent(n??"")}`:`${m}/payments`,D=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingRecordPaymentPage,isReady:D}),s.jsx(Bt,{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:x,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(I)},onChange:C=>{t(on({localData:C}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?n:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),t(to(a?n??void 0:void 0))}})]})}const tt=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Ta=(t,e)=>{if(t==null)return;const n=new Intl.NumberFormat("en-US",{currency:t.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(t.amount);return e!=null?`${n}/${e}`:n},it=(t,e,n)=>{const i=[t,Ta(e,n)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},vn=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Ra=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:it(t.productCode,t.price,t.periodUnit),value:t.priceCode}),Oa=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),_a=O((function(t,e){const{editView:n}=e,i=n.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.products.filter((c=>c.itemType==="addon")).filter(vn).map((c=>({label:c.name??c.id,subtitle:it(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:n.coupons.map(Oa),isLoading:n.subscription==null&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans.filter(vn).map(Ra),shippingAddressLabel:n.shippingAddressLabel,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),t(Kn({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:c=>{t(ce({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tt(e.tenantEmailDomain??"",ye,i),d=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${n}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),t(ce({id:i,localData:c})),t(qn({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vt);function Ma(){const t=P(),e=A(),n=Y(),{subscription_id:i,tenantEmailDomain:o}=F(),{areTenantIdsInSync:a}=T(),c=E((h=>Me(h,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed";Be(a),r.useEffect((()=>{a&&i!=null&&t(an({id:i}))}),[a,i,t]);const[S,f]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(t(Ne()),t(an({cacheOverride:!0,id:i})),f((h=>h+1)))}),[c.fetchState,t,i]),N(u)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:n,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},S)]})}const Na=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id},Ua=(t,e)=>{if(t==null)return;const n=new Intl.NumberFormat("en-US",{currency:t.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(t.amount);return e!=null?`${n}/${e}`:n},be=(t,e,n)=>{const i=[t,Ua(e,n)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=t=>({label:Na(t),value:t.id}),fe=t=>t.priceCode!=null&&t.priceCode.trim()!=="",Va=t=>({billingCycles:t.billingCycles,billingPeriod:t.period,billingPeriodUnit:t.periodUnit,label:t.name??t.id,subtitle:be(t.productCode,t.price,t.periodUnit),trialPeriod:t.trialPeriod,trialPeriodUnit:t.trialPeriodUnit,value:t.priceCode}),Za=t=>({label:t.name??t.couponCode??t.id,value:t.couponCode??t.id}),Ha=O((function(t,e){const n=Me(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.products.filter((i=>i.itemType==="addon")).filter(fe).map((i=>({label:i.name??i.id,subtitle:be(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:n.products.filter((i=>i.itemType==="charge")).filter(fe).map((i=>({label:i.name??i.id,subtitle:be(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:n.coupons.map(Za),customers:n.customers.map(Ba),errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",localData:n.localData,mode:n.mode,plans:n.plans.filter(fe).map(Va),shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),t(Ne()),t($e(ye)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{t(ce({id:i,localData:a}))},onOpenAddress:()=>{const a=tt(e.tenantEmailDomain??"",ye,i),c=J(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),t(qn({id:i}))}}}))(Zt);function qa(){const t=P(),e=A(),n=Y(),{subscription_id:i,tenantEmailDomain:o}=F(),[a]=W(),{areTenantIdsInSync:c}=T(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Me(S,i).localData));Be(c),r.useEffect((()=>{c&&(t(we({filters:{},keepExistingListItems:!1})),t(he({filters:{type:"plan"},keepExistingListItems:!1})),t(Rn({filters:{},keepExistingListItems:!1})),i!=null&&t(oo({id:i})))}),[c,i,t]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,t(ce({id:i,localData:{...u,customerId:d}})))}),[d,i,u,t]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),t(Ne())}}),[l,v,i,t,e,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ka=O((function(t){const e=Qn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(o,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),t(Kn({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&t(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Ht);function Qa(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:h,nextCursor:j,subscriptionListFetchState:k,runningActionSubscriptionId:x}=E((D=>{const C=Qn(D);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,subscriptionListFetchState:C.fetchState,runningActionSubscriptionId:C.runningActionId??null}}),Z),b=k==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(o)),300);return()=>clearTimeout(D)}),[o]),r.useEffect((()=>{i&&t(sn({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==h?.field||u?.dir!==h?.dir)&&t(sn({cacheOverride:!0,filters:m,sort:u}))}),[i,t,m,u,f,h]);const I=r.useRef(x);return r.useEffect((()=>{const D=I.current!=null&&x==null;I.current=x,D&&i&&t(ao())}),[x,i,t]),N(k)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:n,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:x,onSearchChange:a,onStatusChange:D=>t(so(D)),onSortChange:v})]})}const Ga=O((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),t(uo({action:"capture",id:i}))}:void 0}}))(qt);function za(){const t=P(),e=A(),{tenantEmailDomain:n,transaction_id:i}=F(),{areTenantIdsInSync:o}=T(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&t(lo({id:i}))}),[o,i,t]),N(a.fetchState)?s.jsx(M,{}):s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:a})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(t){const e=P(),{areTenantIdsInSync:n}=T(),{tenantEmailDomain:i}=F(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:h}=E(Gn),j=E(Pe);Ue({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const k=E(Re),x=t==="dunning"||t==="quickbooks",b=k.companyId??Se.getSignedInUserTenant(i??"")?.companyId,I=E(($=>wn($,b))),D=mo(k.userRole??[]),C=k.tenantId??"",L=Se.getSignedInUser(),_={userId:L?.userId??"",sessionId:L?.zeniSessionId??"",tenantId:C},R=d?.logo_file_id,U=E(($=>R!=null&&R!==""?$.fileState.fileByFileId[R]:void 0)),Ve=E(($=>R!=null&&R!==""?vo($,R):void 0)),Ze=E(($=>R!=null&&R!==""?po($,R):void 0)),ot=R!=null&&R!==""&&Ve!=null?{[R]:Ve}:{},at=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(cn()),()=>{e(cn())})),[e]),r.useEffect((()=>{n&&(o!=="Not-Started"&&o!=="Error"||e(Oe()))}),[n,e,o]),r.useEffect((()=>{n&&x&&u==="Not-Started"&&e(re())}),[n,e,u,x]),r.useEffect((()=>{if(!n)return;const $=L?.userId;$!=null&&$!==""&&C!==""&&Ke.shouldFetchActiveTenant(C)&&(Ke.markActiveTenantFetchStarted(C),e(fo($,C,L?.zeniSessionId)))}),[n,e,L?.userId,L?.zeniSessionId,C]),r.useEffect((()=>{n&&R!=null&&R!==""&&C!==""&&U==null&&e(So(R,C))}),[n,e,U,R,C]);const st=m.length>0||S.length>0,ct=o==="Not-Started"||o==="In-Progress"&&d==null||x&&!st&&(u==="Not-Started"||u==="In-Progress"),rt=o==="Completed"&&(!x||u==="Completed"),He=I.externalConnections?.revenue?.find(($=>$.connectionName==="chargebee"))?.connectionId,ue=ae?.invoicingMicroServiceBaseUrl,qe=ue!=null&&ue.length>0?`${ue}/1.0/webhooks/stripe`:"",ge={deleteConnectionError:I.externalConnections?.deleteConnectionError?.message,deleteConnectionState:I.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:I,isAdmin:D,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:$=>e(ln($)),onDisconnect:($,q)=>{C!==""&&e(xo(C,$,dn(q)))},onDisconnectStripe:()=>e(rn()),onReconnectQBO:()=>{const $=k.tenantEmailDomain??i??"";le.init("/connection/auth",$),le.handleClick()},onRefreshQBO:()=>{I.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Yn())},onSaveChargeBeeCredentials:($,q)=>{He!=null&&C!==""&&e(ko(C,He,dn("revenue"),yo("chargebee"),{api_key:$,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:_,deleteFileStatusById:ot,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:ae?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ge,isInvoicingPageReady:rt,isLoading:ct,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:U,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:h,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":x&&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:at,onConnectStripe:$=>e(ln($)),onDeleteFile:$=>e(Eo($)),onDisconnectStripe:()=>e(rn()),onEditFileName:($,q)=>e(Io($,q)),onReconnectQBO:ge.onReconnectQBO,onRefreshQBO:ge.onRefreshQBO,onRetryQboSyncTask:$=>e(Wn($)),onSave:$=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:t??"hub"}),e(Co({settings:$,snackbarSection:Wa[t??""]}))},onStartQboBackfill:$=>e(zn($)),updateFilesEntity:$=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:$}))}}}function pn({appContent:t}){const e=A(),n=Y(),i=P(),{tenantEmailDomain:o}=F(),a=X("branding"),c=E((v=>bo(v))),d=E((v=>jo(pe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i($e(pe)))}),[c.saveState.fetchState,i]);const l=hn(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(w,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Kt,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:t,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Ao({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${pe}/`,u=J(n.state?.pathnameStackToGoBack,n.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:a.updateFilesEntity})]})}function Ya(){const t=A(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Ja(){const t=A(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function Xa(){const t=A(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zt,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const es=O((function(t){const e=Jn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(wo({localData:e}))},onReset:()=>{t($o())},onRetryTask:e=>{t(Wn(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),t(Lo())},onStartBackfill:e=>{t(zn(e))}}}))(Wt);function ns(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),i=E(Re),{configFetchState:o,settingsFetchState:a}=E(Jn);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||t(Oe())}),[t,a]),r.useEffect((()=>{o==="Not-Started"&&t(re())}),[o,t]),Ue({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{le.init("/connection/auth",i.tenantEmailDomain??n??""),le.handleClick()},onRefresh:()=>t(Yn())})]})}const ts={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const t=Sn(),e=P(),n=A(),[i,o]=W(),a=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Gn),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ts[m];o({},{replace:!0}),S!=null&&n(S,{replace:!0})}),[m,n,o]),s.jsxs(s.Fragment,{children:[s.jsx(w,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Yt,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:t("invoicing_settings"),settings:a.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function fn(){return s.jsxs(te,{children:[s.jsx(y,{index:!0,element:s.jsx(is,{})}),s.jsx(y,{path:"payment-destination",element:s.jsx(Xa,{})}),s.jsx(y,{path:"branding",element:s.jsx(pn,{})}),s.jsx(y,{path:"branding/:addressType",element:s.jsx(pn,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(y,{path:"integrations",element:s.jsx(Ja,{})}),s.jsx(y,{path:"dunning",element:s.jsx(Ya,{})}),s.jsx(y,{path:"quickbooks",element:s.jsx(ns,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const t=P(),e=A(),{tenantEmailDomain:n}=F(),{areTenantIdsInSync:i}=T(),{enableState:o,fetchState:a,status:c}=E(Un),d=hn(o.fetchState),l=`/${n}/invoicing`,v=r.useRef(!1),u=E((m=>Pe(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,t(re({cacheOverride:!1}))):t(re({cacheOverride:!1})))}),[i,t,a]),r.useEffect((()=>{i&&u==="Not-Started"&&t(kn())}),[i,t,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),t(To()))}),[d,o.fetchState,l,t,e]),c==null&&a!=="Error"?s.jsx(Jt,{}):c==="not_started"?s.jsxs(te,{children:[s.jsx(y,{path:"promo",element:s.jsx(un,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(te,{children:[s.jsx(y,{path:"promo",element:s.jsx(un,{})}),s.jsx(y,{path:"settings/*",element:s.jsx(fn,{})}),s.jsx(y,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(te,{children:[s.jsx(y,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(y,{path:"overview",element:s.jsx(La,{})}),s.jsx(y,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(y,{path:"customers",element:s.jsx(ra,{})}),s.jsx(y,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(y,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(y,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(y,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(y,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(y,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(y,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(y,{path:"invoices/create",element:s.jsx(Jo,{})}),s.jsx(y,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(y,{path:"invoices/:invoice_id/record-payment",element:s.jsx(mn,{})}),s.jsx(y,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(y,{path:"payments",element:s.jsx(wa,{})}),s.jsx(y,{path:"payments/record",element:s.jsx(mn,{})}),s.jsx(y,{path:"payments/:transaction_id",element:s.jsx(za,{})}),s.jsx(y,{path:"credits",element:s.jsx(ta,{})}),s.jsx(y,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(y,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(y,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(y,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(y,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(y,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(y,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(y,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(y,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(y,{path:"settings/*",element:s.jsx(fn,{})}),s.jsx(y,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(y,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(y,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(y,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(y,{path:"*",element:s.jsx(M,{})})]})}export{$s as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-BhGApeF9.js";import{a as u}from"./sentry-B98sAG37.js";import{u as U,g as w,h as _,t as A,j as l,N as L}from"./core-C5rVvNoh.js";import{z as r,E as M,G as P,N as V,h as N,Q as B,X as R,Y as G,S as Q}from"./index-BTTzX8oM.js";import{fB as W,Tb as X,TA as Y,Tr as $,ge as q,gg as H,Tw as J,gR as K,df as Z,TB as ee,TC as te}from"./zeni-epic-state-BVExw1ei.js";import{n as ne}from"./mui-AVx3Hg0F.js";import{u as se}from"./useDeviceId-6INyJgde.js";import{f as ae}from"./analyticsHelper-5kEw8e8E.js";import{t as ie}from"./getLocaleForTenant-DQ9OiUn_.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.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]="08a84dc7-9361-4313-97f3-ebe345ea4448",t._sentryDebugIdIdentifier="sentry-dbid-08a84dc7-9361-4313-97f3-ebe345ea4448")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=w(),m=_(),[k]=A(),n=k.get("token"),p=k.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:D}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),b=l((e=>X(e))),E=r.getSignedInUser(),T=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(Y(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),u.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants($(b.tenantsInOrder),s.zeniSessionId),q(s.userId,s.zeniSessionId,o.tenantId),t(H(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(J("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,T,void 0,b.tenantsInOrder),K().then((()=>{const e=Q();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(B.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[h,S,y,s,o,b,T,a.state,t]);const j=u.useCallback((()=>{m("/signin/auth")}),[m]),F=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return g.jsx(R,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:D,onResendOtp:F,onVerifyOtp:O,onCancelVerifyDevice:j});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||E!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||f==null||I==="Error"){const e=a.state?.origin??"/",v=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:v,magicLinkExpired:!v&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx(G,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Ce as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-BhGApeF9.js";import{h as r,l as i}from"./core-C5rVvNoh.js";import{ak as n}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import"./sentry-B98sAG37.js";import"./zeni-epic-state-BVExw1ei.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.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]="e1fe4b0b-a509-4443-892f-577d1dfd5036",o._sentryDebugIdIdentifier="sentry-dbid-e1fe4b0b-a509-4443-892f-577d1dfd5036")}catch{}})();const a=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as mt,a as lt,n as ft,j as N}from"./liveblocks-BhGApeF9.js";import ut from"./NotFoundScreen-C_nzijM_.js";import{a as k}from"./sentry-B98sAG37.js";import{h as ht,g as pt,i as kt,u as gt,j as S,l as St,n as bt,o as W}from"./core-C5rVvNoh.js";import{cz as It,Te as Y,fB as H,g_ as Tt,Ti as b,a09 as Q,Tm as m,Td as E,zJ as j,Fp as Ct,a0a as yt,Tc as Et,To as At,zO as _t,a0b as F,br as $,gd as x,zS as X,a0c as Nt,cL as Bt,cE as wt}from"./zeni-epic-state-BVExw1ei.js";import{ao as xt,c as vt,O as Rt,y as Dt,aq as Pt,dI as Gt,p as B,dJ as Ut,w as Mt,dK as Ft,i as $t,a2 as jt}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import{u as zt}from"./useTaskManagerAccess-vcnpqvQT.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.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]="e4587881-5996-4727-b331-94277a0a83e6",t._sentryDebugIdIdentifier="sentry-dbid-e4587881-5996-4727-b331-94277a0a83e6")}catch{}})();const Lt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((s=>{l(c),s()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=St((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,s=b(t),f=H(t),{currentTab:I}=s;return{notificationView:s,isNotificationSettingsVisible:h.userEmail!=null&&At(n.notificationSettings,h.userEmail,g,f,c),isDisabled:s.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:s,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:R}=l;return{onNotificationClick:(a,o,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${o}`,T=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:T,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,o,d)=>{const r=o.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t(F([a],$())));let i=`/${h}/${r[1]}`;const T=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:T,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,o)=>{t(E(a,o))},onUpdateNotificationTabState:(a,o)=>{t(m(a,o))},onUpdateNotificationViewCurrentTabAndSubTab:(a,o)=>{t(Q(a,o));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,o)=>{if(a==="tasks"){const d=[];o==="all"?d.push("read","unread"):o!=="mentions"&&d.push(o),t(j("task_manager","dashboard",d))}else R?.()},onUpdateNotificationStatus:(a,o,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t(F([i],$())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Lt(s,I).then((()=>{t(F(s,$())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((o=>{t(m({markAsAllReadState:{fetchState:"Error",error:o}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=jt(n.state?.pathnameStackToGoBack),o=a.poppedPathname??"../../dashboard";f(o,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt(Ft)),Ot=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),s=gt(),f=vt(),[I,R]=k.useState(!1),a=S((e=>Y(e))),o=S((e=>H(e))),{useFeatureGate:d}=Rt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:T}=Vt({mobileExploreReferrer:"Notifications"});Pt({isDataReady:!0});const Z=Tt(o.userRole);if(o==null||n==null||o.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=S((e=>b(e).notificationDetailsByTab.tasks.fetchState)),z=S((e=>b(e).currentTab)),D=S((e=>b(e).currentSubTab)),tt=S((e=>b(e).notificationDetailsByTab.comments.fetchCountState)),P=S((e=>b(e).notificationDetailsByTab.comments.fetchState)),et=S((e=>b(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=S((e=>b(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),ot=Gt().allUsers,{inboxNotifications:w,isLoading:A,hasFetchedAll:C,isFetchingMore:G,fetchMore:st}=mt(),{threads:L,isLoading:q,fetchMore:O,isFetchingMore:J,hasFetchedAll:K}=lt({query:{metadata:{companyId:o.companyId,application:"dashboard"}}});k.useEffect((()=>{if(z!==c&&c!=null&&s(Q(c)),c==null){const e=`../${z}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&s(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(A===!1&&C===!0&&o?.companyId!=null&&w!=null){const e=`dashboard_${o.companyId}`,p=w.filter((y=>y.roomId===e&&y.readAt==null)).length;s(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),s(E({unreadCount:p},"comments"))}}),[A,C]),k.useEffect((()=>{V!=="In-Progress"&&g&&s(j("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>st?.()),0);return()=>clearTimeout(e)}));const U=A||G===!0||C!==!0||A||G===!0||C!==!0;k.useEffect((()=>{U&&P!=="In-Progress"?s(m({fetchState:"In-Progress",error:void 0},"comments")):U||P!=="In-Progress"||s(m({fetchState:"Completed",error:void 0},"comments"))}),[U,P]),k.useEffect((()=>{s(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(R(!0),s(Ct()))}),[a.fetchState]),k.useEffect((()=>{if(A===!1&&q===!1&&w!=null&&L!=null){const e=`dashboard_${o.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 M=L.find((dt=>{return dt.id===((v=u).kind==="thread"?v.threadId:"subjectId"in v?v.subjectId:void 0);var v}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(J||K===!0||O==null||O(),null)})).filter((u=>u!=null));s(m({allNotificationsIds:_},"comments")),s(E({totalCount:_.length,unreadCount:y.length},"comments")),s(yt(ct))}}),[A,G,J,C,K,q,w?.length]);const nt={events:o.userRoleId!=null?[`private-encrypted-${o.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if($t(p)){const y=Et(p.mode);if(y==="dashboard"&&s(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),s(j("task_manager",y,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=zt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:ot,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:T,...nt})};function me(){return N.jsxs(bt,{children:[N.jsx(W,{path:"/:selectedTab",element:N.jsx(Ot,{})}),N.jsx(W,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-BhGApeF9.js";import{a as r}from"./sentry-B98sAG37.js";import{u as A,g as P,j as o,N as j}from"./core-C5rVvNoh.js";import{TO as x,fB as C,gi as R,TP as z,TQ as D,TR as M,TS as L,pO as k,Sx as N}from"./zeni-epic-state-BVExw1ei.js";import{z as h,af as I}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="16dd0a8e-1340-4daa-9641-635e37c9391a",n._sentryDebugIdIdentifier="sentry-dbid-16dd0a8e-1340-4daa-9641-635e37c9391a")}catch{}})();function ee(){const n=A(),a=P(),{params:t,error:i}=r.useMemo((()=>x(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),p=h.isSignedIn(),s=h.getSignedInUser(),m=o((e=>C(e))),l=o((e=>R(e))),d=o((e=>e.tenantState.fetchState)),y=o(z),S=o(D),u=o(M),[v,T]=r.useState(null),[E,b]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{p&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[p,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const _=r.useMemo((()=>{if(m?.tenantId!=null)return m.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((U=>U.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[m?.tenantId,l]),c=v??_;return i!=null?f.jsx(I,{variant:"invalid_params",paramsError:i}):p?f.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:T,approveError:E??S,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(N(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{b("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):f.jsx(j,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./liveblocks-BhGApeF9.js";import{h as J,u as K,g as Q,i as X,j as d,l as Z,n as ee,o as C}from"./core-C5rVvNoh.js";import{fB as M,zu as R,us as ae,UF as w,un as y,bq as te,b_ as se,uo as oe,UG as re,Un as S,e8 as ne,Dg as ce,UH as ie,DE as le,dV as de,dU as me}from"./zeni-epic-state-BVExw1ei.js";import{ag as fe,z as pe,ao as ue,aq as he,V as ge,O as q,y as B,a6 as Fe,h as _,aB as be,p as Ie}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import Ce from"./NotFoundScreen-C_nzijM_.js";import{F as Se}from"./FeaturePreviewScreen-CVnp0bZd.js";import{a as g}from"./sentry-B98sAG37.js";import{u as ye}from"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import{u as Te}from"./useInitialThreadRequest-DuL5mYzq.js";import{t as De}from"./routePaths-Cx9L8hBM.js";import{M as Ae}from"./MobileAppDrawer-DigqZbbY.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./InboxNotificationsProvider-MlM0K3gF.js";import"./useTaskManagerAccess-vcnpqvQT.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="bcab5081-9e6f-40ee-ad70-3f86b739c710",s._sentryDebugIdIdentifier="sentry-dbid-bcab5081-9e6f-40ee-ad70-3f86b739c710")}catch{}})();const T=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=Z((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:_}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(y(a)),T(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=De(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function v(){const s=fe(),e=J(),a=K(),o=Q(),{forecastId:r,tenantEmailDomain:c}=X(),[p,u]=g.useState(!1),[m,D]=g.useState(!1),F=pe.getSignedInUser(),A=d((t=>M(t))),G=A.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),x=d((t=>t.profitAndLossState)),j=d((t=>t.reportUIOptionsState.selectedForecast)),E=t=>x.pandLByForecastID[t]!=null&&oe(t,x).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:N,onAskAiCfoClick:V}=ye({mobileExploreReferrer:"Forecast"});g.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){D(!0);const t=((f,P,O)=>P!=null?f.forecasts.findIndex((I=>I.id===P)):O!=null?f.forecasts.findIndex((I=>I.id===O)):f.forecasts.length>0?0:-1)(i,r,j?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=j?.index?(a(w(i.forecasts[t].id,t)),T(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&T(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!E(i.forecasts[t].id)&&b&&a(y(i.forecasts[t].id))}}),[p,u,a,l,i,m,D,R,y,b]);const U=ge(),$=U?.loggedInUserRole!=null&&te(U.loggedInUserRole),{useFeatureGate:W}=q(),{isFeatureEnabled:k}=W(B.isReportsCommentingEnabled),Y=Te(k?A?.companyId:void 0,{clearParams:l&&m}),[z,H]=g.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",F?.firstName??""),h.searchParams.set("lastname",F?.lastName??""),h.searchParams.set("email",F?.userEmail??"");const L=t=>{H(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(Fe,{analytics:_,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Ae,{isAppContentDrawerOpen:z,handleDrawerToggle:L}),n.jsx(xe,{firstMonthOfFY:G,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:E,meetingUrl:se(h.toString()),hasTransactionAccess:$,isAiCfoAccessEnabled:N,onAskAiCfoClick:V,isReportsCommentingEnabled:k,initialOpenThreadRequest:Y,onClickMenuIcon:()=>{L(!0)}})]})}function Ke(){const s=d((c=>M(c))),{useFeatureGate:e}=q(),{isFeatureEnabled:a}=e(B.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{Ke as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-BhGApeF9.js";import{UB as re,fB as Y,lX as G,dV as N,dU as le,Rx as X,T_ as ce,Cd as Pe,UC as Q,C2 as je,Cn as Le,Ch as de,C6 as pe,Cl as Te,Ci as ve,UD as ue,rI as Ae,g2 as Re,gA as Ve,UE as H,Ca as me,C9 as ge,Cq as Oe,c7 as Fe}from"./zeni-epic-state-BVExw1ei.js";import{$ as Ce,O as J,y as _,z as K,f as fe,K as he,ad as ye,ax as be,ay as Ue,a9 as Se,H as O,ae as we,G as W,az as Be,ao as Ze,aq as $e,a6 as ze,h as xe,Q as He,p as _e,aA as Ge,V as Ke}from"./index-BTTzX8oM.js";import{D as De,n as M,S as Ie}from"./mui-AVx3Hg0F.js";import ae from"./NotFoundScreen-C_nzijM_.js";import{a as c}from"./sentry-B98sAG37.js";import{u as ee,i as We,j as g,h as Me,g as qe,l as Qe,n as se,o as z}from"./core-C5rVvNoh.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import{M as Ne}from"./MobileAppDrawer-DigqZbbY.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./InboxNotificationsProvider-MlM0K3gF.js";import"./useTaskManagerAccess-vcnpqvQT.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]="77b241c0-59b6-4332-a5a0-22edce18a188",e._sentryDebugIdIdentifier="sentry-dbid-77b241c0-59b6-4332-a5a0-22edce18a188")}catch{}})();const Xe={overlayWidth:new Se(100,100,48)},te=W.getLocalizedStrings().peoplePage.invitePage,ne=W.getLocalizedStrings().common,Je=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:C,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[F,U]=c.useState(!1),[k,S]=c.useState(!1),{userId:w}=We(),r=g((l=>re(l))),p=g((l=>Y(l))),E=g((l=>G(l))),{useFeatureGate:D}=J(),{isFeatureEnabled:I}=D(_.isDebitCardFeatureEnabled),P=N(I,p),T=le(p),v=X(p),B=ce(p),Z=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,x=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const h=()=>{m(Q()),b()},A=()=>{F===!0?S(!0):h()},$=d.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=D(_.isChargeCardFeatureEnabled),L=fe(p,j,I),{isCardsHidden:R}=he(p?.tenantId),y=!L||R,V=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:C,isZeniTenant:v,isAccountingClassesEnabled:E,isReimbursementDisabled:Z===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isLiteRoleDisabled:B===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:T,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(de({peopleLocalData:l})),U(!0)},onSaveClick:()=>{m(C==="zeni_only"?je(e):Le(v))},onCloseClick:A,isLoading:x||r.person==null},o={onOkClick:()=>{S(!1),h()},onCancelClick:()=>{S(!1)}};return c.useEffect((()=>{x===!1&&w!=null&&m(Pe(w))}),[x,w]),c.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:Xe.overlayWidth.valuePercentage(f),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:A,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:te.discardTitle}),descriptionComponent:a.jsx(Ee,{children:te.discardDescription}),primaryButtonText:ne.yes,secondaryButtonText:ne.no,action:o,isEditPopup:!0}):null,a.jsx(Ue,{...s})]})})},ea=M(Ie)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,ke=M(we.H6Regular)`
|
|
6
|
-
margin-top: ${O.sp7};
|
|
7
|
-
padding-left: ${O.sp8};
|
|
8
|
-
padding-right: ${O.sp8};
|
|
9
|
-
color: ${e=>e.theme.colors.primary};
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
`,Ee=M(we.LargeRegularSp)`
|
|
12
|
-
color: ${e=>e.theme.colors.hero};
|
|
13
|
-
padding-left: ${O.sp8};
|
|
14
|
-
padding-right: ${O.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${O.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=W.getLocalizedStrings().peoplePage.invitePage,ie=W.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:C,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[F,U]=c.useState(!1),[k,S]=c.useState(!1),w=g((o=>re(o))),r=g((o=>Y(o))),p=g((o=>G(o))),{useFeatureGate:E}=J(),{isFeatureEnabled:D}=E(_.isDebitCardFeatureEnabled),I=N(D,r),P=le(r),T=X(r),v=ce(r),B=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,Z=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||d.fetchState!=="Completed"||e==null;if(K.getSignedInUser()==null)throw Error("Can't access invite people page without signing in...");const x=()=>{b(),m(Q())},h=()=>{F===!0?S(!0):x()},A={onOkClick:()=>{S(!1),x()},onCancelClick:()=>{S(!1)}},$=d.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(_.isChargeCardFeatureEnabled),L=fe(r,j,D),{isCardsHidden:R}=he(r?.tenantId),y=!L||R,V=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:C,isZeniTenant:T,onPeopleLocalDataUpdated:o=>{m(de({peopleLocalData:o})),U(!0)},onResetClick:x,onSaveClick:()=>{m(C==="zeni_only"?Te(e):ve())},onCloseClick:h,peopleDetails:w,isAccountingClassesEnabled:p,isReimbursementDisabled:B===!1,isLiteRoleDisabled:v===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:Z};return c.useEffect((()=>{w.invitePersonState.fetchState==="Completed"&&(b(),m(Q()))}),[w.invitePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(f),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:ye.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(be,{titleComponent:a.jsx(ke,{children:oe.discardTitle}),descriptionComponent:a.jsx(Ee,{children:oe.discardDescription}),primaryButtonText:ie.yes,secondaryButtonText:ie.no,action:A}):null,a.jsx(Be,{...s})]})})},ta=M(Ie)`
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 100%;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
`,na=Qe((function(e,t){const d=ue(e),n=K.getSignedInUser();return{data:d,loggedinUserId:n?.userId??"",isZeniTenant:t.isZeniTenant===!0,shouldFetchClasses:t.shouldFetchClasses,isZeniAdminUser:n?.userEmailDomain==="zeni.ai"&&t.isZeni===!0,isAccountingClassesEnabled:G(e),analytics:xe}}),(function(e,t){const{navigate:d,companyId:n,shouldFetchClasses:C}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Oe(i))},onReloadPeople:()=>{e(me()),e(ge(n,C))},onBackClick:()=>{d("../../")},onModeChange:i=>{e(H({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(H({searchText:i}))}}}}))(Ge);function q({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const d=Me(),n=ee(),C=qe(),{areTenantIdsInSync:i}=Ze(),b=K.getSignedInUser(),f=g((s=>Y(s))),{useFeatureGate:m}=J(),{isFeatureEnabled:F}=m(_.isDebitCardFeatureEnabled),U=g((s=>G(s))),k=!N(F,f)&&U,S=X(f),w=f?.tenantId,{tenantEmailDomain:r}=f,[p,E]=c.useState(!1),[D,I]=c.useState(!1),[P,T]=c.useState(!1),[v,B]=c.useState("off"),[Z,x]=c.useState(!1),h=s=>{x(s)},{isAiCfoAccessEnabled:A,onAskAiCfoClick:$}=Ye({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ae(s.classState,s.classListState))),L=g((s=>Re(s.userState,s.userRoleState,s.userListViewState,"manager"))),R=g((s=>Ve(s))),y=f?.companyId;c.useEffect((()=>{p&&v===u.uiState.mode||!i||(n(H({searchText:"",sortKey:"name",sortOrder:"ascending"})),B(u.uiState.mode),E(!0),n(me()))}),[p,b,w,n,u.uiState.mode,i]),c.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),c.useEffect((()=>{I(e!=null&&e===!0),T(t!=null&&t===!0&&t)}),[e,t]),c.useEffect((()=>{n(H({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const V=()=>{I(!1),T(!1),d("../")};return a.jsxs(a.Fragment,{children:[u.fetchState==="Completed"?a.jsx(ze,{analytics:xe,onLoad:s=>s.trackPageLoaded(He.Event.members)}):null,D===!0?a.jsx(sa,{closeDrawerHandler:V,isInvitePeopleDrawerOpen:D,managersListView:L,companyPassportView:R,classListView:j,companyId:y,mode:u.uiState.mode}):null,P===!0?a.jsx(Je,{closeDrawerHandler:V,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:R,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ne,{isAppContentDrawerOpen:Z,handleDrawerToggle:h}),a.jsx(na,{navigate:d,signedInUser:b,isZeni:f.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{d("./new")},onColumnSortConfigChanged:(s,o)=>{n(H({sortKey:s,sortOrder:o}))},onRowClick:s=>{const o=`/${r}/people/${encodeURIComponent(s)}/edit`,l=_e(C.state?.pathnameStackToGoBack,C.pathname);d(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:A,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Fe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(q,{})}),a.jsx(z,{path:"new",element:a.jsx(q,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(q,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BhGApeF9.js";import E from"./NotFoundScreen-C_nzijM_.js";import{a as r}from"./sentry-B98sAG37.js";import{h as _,g as v,j as p,i as M,u as U,N as P,l as z,n as B,o as h}from"./core-C5rVvNoh.js";import{fB as O,a0d as b,bo as F,bn as N,iI as V,gd as q}from"./zeni-epic-state-BVExw1ei.js";import{_ as L,z as I,aq as $,dL as G}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import{M as J}from"./MobileAppDrawer-DigqZbbY.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./InboxNotificationsProvider-MlM0K3gF.js";import"./useTaskManagerAccess-vcnpqvQT.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]="f4a2f384-abaa-4a7f-80f2-d920a4fe50ce",e._sentryDebugIdIdentifier="sentry-dbid-f4a2f384-abaa-4a7f-80f2-d920a4fe50ce")}catch{}})();const K=z((function(e){const t=I.getSignedInUser(),d=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:d??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),d=L(),o=p((a=>O(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:m}=M(),u=U(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const f=r.useRef(!1),[w,S]=r.useState(!1),C=F(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=N(l),y=C||k||x,c=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&f.current&&(u(q({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),f.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||c(a,i,!0),f.current=!0}),[n?.fetchState,c]),j=r.useCallback(((a,i)=>{c(a,i,!1)}),[c]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return $({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(K,{navigate:e,location:t,themeState:d,currentTenant:o,signedInUser:l,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(P,{to:`/${m}/dashboard`,replace:!0})};function he(){return s.jsxs(B,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-BhGApeF9.js";import W from"./NotFoundScreen-C_nzijM_.js";import{a as p}from"./sentry-B98sAG37.js";import{h as C,g as D,u as V,j as u,N as k,l as U,n as Y,o as g}from"./core-C5rVvNoh.js";import{fB as E,Yh as h,Yy as R,MY as N,MU as B,MX as f,MN as L,YX as M,MR as X,M_ as z}from"./zeni-epic-state-BVExw1ei.js";import{z as T,w as $,c7 as K,l as _,bQ as Q,c8 as q}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import{u as F,R as x}from"./ReimbursementApprovalRuleDetailScreen-CuE7ORwk.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="b9167535-79e7-453b-8234-6e937df608da",e._sentryDebugIdIdentifier="sentry-dbid-b9167535-79e7-453b-8234-6e937df608da")}catch{}})();const A="reimbursement-approval-rule-update",G=U((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:R(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e(M(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!1))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))}}}))($(K)),H=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),b=u((o=>R(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{b?.updateStatus.fetchState==="Completed"&&a(N())}),[b]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!1)))}),[t,S,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(w(!0),a(f())),s("./new"))}),[v,d,a]);const m={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${A}`]:[],eventCallback:(o,y,j)=>{o.endsWith(A)&&j.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(G,{currentTenant:c,location:n,navigate:s,...m})},I="reimbursement-approval-rule-update",J=U((function(e){const s=h(e),n=R(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(I)&&e(M(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!0))},onEditRuleClick:t=>{t!=null?(e(f(t)),n(`./${t}/edit`)):(e(f()),n("./new"))},onReorderRules:t=>{e(z(t,!0))}}}))($(q)),P=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=Q(e?.tenantId);return s?r.jsx(Z,{isLoading:n}):r.jsx(H,{isLoading:n})},Z=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),b=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),m=u((i=>E(i))),o=u((i=>h(i)));F();const y=u((i=>R(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(N())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||b!=="Not-Started"||e||(w(!0),a(X(!1,!0)))}),[v,b,e,a]),T.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(f())),s("./new"))}),[S,o,a]);const j={events:m.companyId!=null?[`private-encrypted-${m.companyId}.${I}`]:[],eventCallback:(i,ee,O)=>{i.endsWith(I)&&O.onApprovalRulesEventReceived(i)}};return m?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(J,{currentTenant:m,location:n,navigate:s,isLoading:e,...j})};function le(){return r.jsxs(Y,{children:[r.jsx(g,{path:"/",element:r.jsx(P,{})}),r.jsx(g,{path:"/new",element:r.jsx(x,{})}),r.jsx(g,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(g,{path:"*",element:r.jsx(W,{})})]})}export{le as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as p}from"./liveblocks-BhGApeF9.js";import{g as W,h as De,u as Oe,i as Fe,j as d,l as Ae,n as Pe,o as ee}from"./core-C5rVvNoh.js";import{fB as $,Dr as R,TZ as Ee,lX as le,tx as ce,um as F,lC as Le,lL as A,lD as P,kG as E,kx as L,kw as Me,CB as ie,ur as Be,bq as ve,T_ as Ve,bn as xe,DO as ze,T$ as Ge,U0 as He,ch as S,Cu as Ye,U1 as ae,U2 as qe,U3 as Ne,U4 as $e,U5 as Ze,U6 as Qe,U7 as Xe,U8 as Je,U9 as Ke,Ua as We,Ub as ea,Uc as aa,Ud as sa,Ue as k,Uf as M,Ug as B,Uh as v,Ui as V,Uj as x,Uk as z,Ul as G,Um as H,Un as Y,e8 as ta,Ds as oa,Df as se,Dg as te,Dy as na,Dk as oe,DE as ra,Uo as la,Up as ca,Uq as ia,Ur as da,Us as pa,Ut as _a,Uu as fa,Uv as ma,Uw as ba,Ux as ua,dV as ha,dU as ya}from"./zeni-epic-state-BVExw1ei.js";import{al as Ca,am as wa,an as ga,a as Sa,$ as Ia,O as de,y as q,z as pe,ao as Ra,V as Ta,d as ka,ap as ja,aq as Ua,a6 as Da,h as N,Q as Oa,q as Fa,p as _e,ar as Aa,as as Pa,at as Ea}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import La from"./NotFoundScreen-C_nzijM_.js";import{F as Ma}from"./FeaturePreviewScreen-CVnp0bZd.js";import{a as b}from"./sentry-B98sAG37.js";import{u as Ba}from"./useInitialThreadRequest-DuL5mYzq.js";import{t as ne,a as re,b as va}from"./routePaths-Cx9L8hBM.js";import{M as Va}from"./MobileAppDrawer-DigqZbbY.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./InboxNotificationsProvider-MlM0K3gF.js";import"./useTaskManagerAccess-vcnpqvQT.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]="e94eb7dc-a9d0-40f5-a917-ab08ab03f386",e._sentryDebugIdIdentifier="sentry-dbid-e94eb7dc-a9d0-40f5-a917-ab08ab03f386")}catch{}})();const xa=["profit_loss","balance_sheet","cash_flow"],I=e=>e==="balance_sheet"||e==="balance_sheet_by_classes"||e==="balance_sheet_by_projects",y=e=>{e(Y({resetLeftScroll:!0})),e(H({resetLeftScroll:!0})),e(G({resetLeftScroll:!0})),e(z({resetLeftScroll:!0})),e(x({resetLeftScroll:!0})),e(V({resetLeftScroll:!0})),e(M({resetLeftScroll:!0})),e(v({resetLeftScroll:!0})),e(B({resetLeftScroll:!0}))},za=e=>{e(ca()),e(ia()),e(da()),e(pa()),e(_a()),e(fa()),e(ma()),e(ba()),e(ua())},Ga=Ae((function(e){const o=pe.getSignedInUser(),_=e.tenantState.currentTenantId,m=$(e),a=m?.companyName??"",s={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:_??""},t=R(e),r=Ve(m);return{fetchState:t.fetchState,selectedTimeframe:t.filter.timeframe,selectedReport:t.selectedReportId,displayOrder:t.displayOrder,reportFormat:t.reportFormat,dataAvailable:t.dataAvailable,balancesInTimeframe:t.balancesInTimeframe,allTimeframeTicks:t.allTimeframeTicks,selectedCOABalancesRange:t.filter.balancesRange,isCompareMode:t.isCompareModeOn,profitAndLossReport:t.profitAndLossReport,profitAndLossClassesViewReport:t.profitAndLossByClassReport,profitAndLossProjectViewReport:t.profitAndLossByProjectReport,profitAndLossByClassHorizontalReport:t.profitAndLossByClassHorizontalReport,balanceSheetReport:t.balanceSheetReport,balanceSheetClassesViewReport:t.balanceSheetByClassReport,cashFlowClassesViewReport:t.cashFlowByClassReport,cashFlowProjectViewReport:t.cashFlowByProjectReport,balanceSheetProjectViewReport:t.balanceSheetByProjectReport,cashFlowReport:t.cashFlowReport,downloadState:t.downloadState,analytics:N,isZeniUser:xe(o),showAccountGroups:r===!0,isAccountingClassesEnabled:le(e),isAccountingProjectsEnabled:ce(e),currentTenantCompanyName:a,statementEndPoint:`${Ea}/statement`,authParams:s,isZeniCOAUsed:r}}),(function(e,o){const{navigate:_,handleDrawerToggle:m}=o;return{onReloadReport:()=>{o.signedInUser!=null&&e(F(o.signedInUser.userId,!0,!1))},updateDownloadStateHandler:a=>{e(la(a))},onTimeframeSelectionChanged:(a,s,t)=>{if(e(ra(a)),s){const{isCompareModeOn:r,filter:l}=o,{additionalBalances:f,balancesRange:i}=l;let c=[...f];a==="year"&&(c=c.filter((C=>C!=="this_period_vs_same_period_last_year"&&C!=="this_period_vs_same_period_last_year_percent"&&C!=="same_period_last_year"))),e(se(o.firstMonthOfFY,r,i.numberOfPeriods<1?1:i.numberOfPeriods,c)),f.length>0&&e(te(o.firstMonthOfFY,c.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",i.numberOfPeriods<1?1:i.numberOfPeriods,c))}t!==!0&&setTimeout((()=>y(e)),50)},onReportSelectionChanged:a=>{const s=o.selectedReportID;if(a===s)return;const t=o.classViewLayout;e(k(a)),(I(a)||S(a))&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(oe({numberOfPeriods:1,orderBy:"ascending_date"})),a!=="profit_and_loss"&&a!=="profit_and_loss_by_classes"&&s==="profit_and_loss_by_classes"&&t==="horizontal"&&e(ae({classViewLayout:"vertical"})),y(e)},onCOABalancesRangeChanged:(a,s)=>{e(oe(a,s)),y(e)},onThisPeriodChanged:(a,s,t)=>{e(na(o.firstMonthOfFY,a,s<1?1:s)),t!==!0&&y(e)},onAdditionalBalanceSelectionChanged:(a,s,t,r)=>{e(se(o.firstMonthOfFY,a,t<1?1:t,s)),s.length>0&&e(te(o.firstMonthOfFY,s.includes("this_period_vs_last_period")?"compare_mode_amount":"compare_mode_percent",t<1?1:t,s)),r!==!0&&o.isCompareModeOn===a||setTimeout((()=>y(e)),50)},onUpdateHighlightedNumberOfPeriods:(a,s,t,r)=>{e(oa({firstMonthOfFY:o.firstMonthOfFY,isCompareModeOn:s,additionalBalances:a,maxNumOfPeriodsToHighlight:t<1?1:t,coaBalances:r}))},onAccountBalanceClick:o.hasTransactionAccess!==!0?void 0:(a,s,t)=>{let r,l;if(s.balanceTimeFrame==="month"||s.balanceTimeFrame==="quarter"?(r=s.balanceTimeFrame,l=ta(s)):s.balanceTimeFrame==="year"?(r="quarter",l={startDate:s.endDate.startOf("quarter"),endDate:s.endDate}):console.error(`timeframe ${s.balanceTimeFrame} is not supported`),l!=null&&r!=null){const f=a.accountName===""?a.accountDescription:a.accountName,i=(()=>{if(o.selectedReportID==="profit_and_loss_by_classes"&&o.classViewLayout==="horizontal"&&a.accountType!=null){if(t?.isHorizontalClassTotalColumn===!0)return ne(o.tenantEmailDomain,a.accountId,a.accountType,f,r,l);if(t?.isHorizontalClassColumn===!0&&s.id!=null)return re(o.tenantEmailDomain,a.accountId,a.accountType,s.id,f,r,l)}return a.projectsViewParentId?.projectId!=null&&a.accountType!=null?va(o.tenantEmailDomain,a.accountId,a.accountType,a.projectsViewParentId.projectId,f,r,l):a.classesViewParentId!=null&&a.classesViewParentId.parentClassId!=null&&a.accountType!=null?re(o.tenantEmailDomain,a.accountId,a.accountType,a.classesViewParentId.parentClassId[0],f,r,l):a.accountType!=null?ne(o.tenantEmailDomain,a.accountId,a.accountType,f,r,l):void 0})();if(i!=null){const c=_e(o.location.state?.pathnameStackToGoBack,o.location.pathname);_(i,{state:{pathnameStackToGoBack:c,referrer:j(o.selectedReportID)}})}}},onTableScroll:(a,s)=>{switch(a){case"profit_and_loss":e(Y({scrollPosition:s}));break;case"profit_and_loss_by_classes":e(H({scrollPosition:s}));break;case"profit_and_loss_by_projects":e(G({scrollPosition:s}));break;case"balance_sheet":e(z({scrollPosition:s}));break;case"balance_sheet_by_classes":e(x({scrollPosition:s}));break;case"balance_sheet_by_projects":e(V({scrollPosition:s}));break;case"cash_flow_by_classes":e(v({scrollPosition:s}));break;case"cash_flow_by_projects":e(B({scrollPosition:s}));break;case"cash_flow":e(M({scrollPosition:s}));break;default:console.log(`Table Scroll state for ${a} is not handled`)}},onElementCollapseStateChanged:(a,s,t)=>{switch(a){case"profit_and_loss":e(Y({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_classes":e(H({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"profit_and_loss_by_projects":e(G({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet":e(z({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_classes":e(x({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"balance_sheet_by_projects":e(V({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_classes":e(v({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow_by_projects":e(B({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow":e(M({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;default:console.log(`Collapse state toggle for ${a} is not handled`)}},onBackClick:()=>{_("../../")},onUpdateAccountViewMode:(a,s)=>{const t=s??o.selectedReportID,r=I(t),l=S(t);l?(e(Je({viewMode:a})),e(Ke({viewMode:a}))):r?(e(We({viewMode:a})),e(ea({viewMode:a}))):(e(aa({viewMode:a})),e(sa({viewMode:a}))),a==="classes"?(o.analytics?.trackGroupBySwitch("Classes",j(t)),e(k(l?"cash_flow_by_classes":r?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",j(t)),e(k(l?"cash_flow_by_projects":r?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",j(t)),e(k(l?"cash_flow":r?"balance_sheet":"profit_and_loss"))),y(e)},onUpdateClassesToFilterOut:a=>{S(o.selectedReportID)?e(Ze({classesToFilterOut:a})):I(o.selectedReportID)?e(Qe({classesToFilterOut:a})):e(Xe({classesToFilterOut:a}))},onUpdateProjectsToFilterOut:a=>{S(o.selectedReportID)?e(qe({projectsToFilterOut:a})):I(o.selectedReportID)?e(Ne({projectsToFilterOut:a})):e($e({projectsToFilterOut:a}))},onUpdateClassViewLayout:a=>{e(ae({classViewLayout:a}))},onOpenAccountViewMode:()=>{const a=I(o.selectedReportID),s=S(o.selectedReportID);o.isAccountingClassesEnabled&&e(s?P():a?L():Ye()),o.isAccountingProjectsEnabled&&e(s?A():a?E():ie())},onUpdateDisplayOrder:a=>{e(He(a))},onUpdateReportFormat:a=>{za(e),e(Ge(a))},onClickMenuIcon:()=>{m(!0)},onResyncReports:()=>{const a=o.selectedReportID;e(a!=="balance_sheet_by_classes"?a!=="balance_sheet_by_projects"?a!=="cash_flow_by_classes"?a!=="cash_flow_by_projects"?ze(a==="profit_and_loss_by_projects"?"profit_and_loss_by_projects":"profit_and_loss_by_classes"):A(!0):P(!0):E(!0):L(!0))}}}))(Aa);function Ha(){const{isAiCfoOpen:e,setIsAiCfoOpen:o}=Sa(),_=Ia(),m=Pa(_),a=De(),s=Oe(),t=W(),{tenantEmailDomain:r}=Fe(),{useFeatureGate:l}=de(),{isFeatureEnabled:f}=l(q.isReportsHorizontalClassLayoutSwitchEnabled),i=pe.getSignedInUser(),[c,C]=b.useState(!1),[Z,fe]=b.useState(!1),{isFeatureEnabled:Q}=l(q.isReportsCommentingEnabled);if(i==null)throw Error("Can't access reports page without signing in...");const U=d((n=>$(n))),me=U.masterTOSInfo?.isMasterTOSAccepted??!1,be=U.company?.companyInfo.firstMonthOfFY??1,ue=Ba(Q?U?.companyId:void 0),w=d((n=>R(n).fetchState)),he=d((n=>Ee(n))),{areTenantIdsInSync:u}=Ra(),D=d((n=>n.financeStatementState.selectedReportId)),T=d((n=>le(n))),g=d((n=>ce(n))),ye=d((n=>R(n).isCompareModeOn)),h=d((n=>R(n).filter)),O=d((n=>R(n).selectedReportAndTimeframeFetchState)),Ce=d((n=>n.profitAndLossClassesViewState.uiState.classViewLayout));b.useEffect((()=>{!c&&u&&(C(!0),s(F(i.userId,!0,!0,!1)))}),[c,i,s,u]),b.useEffect((()=>{c&&!Z&&w==="Completed"&&u&&(s(F(i.userId,!1,!0,!1)),fe(!0))}),[c,Z,w,u]),b.useEffect((()=>{if(c&&O.fetchState==="Not-Started"&&h.timeframe!=="free_range"&&h.timeframe!=="week"&&u)switch(D){case"profit_and_loss":case"profit_and_loss_by_classes":s(Be(h.timeframe));break;case"profit_and_loss_by_projects":g&&s(ie());break;case"balance_sheet":s(Me(h.timeframe));break;case"balance_sheet_by_classes":T&&s(L());break;case"balance_sheet_by_projects":g&&s(E());break;case"cash_flow_by_classes":T&&s(P());break;case"cash_flow_by_projects":g&&s(A());break;case"cash_flow":s(Le(h.timeframe))}}),[c,D,O,u,T,g]);const X=Ta(),we=X?.loggedInUserRole!=null&&ve(X?.loggedInUserRole)!==!0,[ge,Se]=b.useState(!1),J=n=>{Se(n)},Ie=ka(),Re=ja();return(function(n){const{isDataReady:Te}=n,{pathname:ke}=W(),K=Ca(ke??"")==="reports",je=wa(Te),Ue=b.useMemo((()=>K?xa:void 0),[K]);ga({canFetchSuggestedQuestions:je,pageContexts:Ue})})({isDataReady:w==="Completed"}),Ua({isDataReady:w==="Completed"}),p.jsxs(p.Fragment,{children:[w==="Completed"?p.jsx(Da,{analytics:N,onLoad:n=>n.trackPageLoaded(Oa.Event.reports)}):null,p.jsx(Va,{isAppContentDrawerOpen:ge,handleDrawerToggle:J}),p.jsx(Ga,{firstMonthOfFY:be,tenantEmailDomain:r,location:t,navigate:a,windowSize:_,classViewLayout:Ce,selectedReportID:D,analytics:N,filter:h,isAccountingClassesEnabled:T,isAccountingProjectsEnabled:g,isCompareModeOn:ye,hasTransactionAccess:we,signedInUser:i,selectedReportAndTimeframeFetchState:O,handleDrawerToggle:J,reportsResyncFetchState:he.reportsResyncFetchState,isAiCfoAccessEnabled:Re&&Ie&&!e,onAskAiCfoClick:()=>{if(me)if(m){const n=_e(t.state?.pathnameStackToGoBack,t.pathname);a(`/${r}/ai-cfo/explore`,{state:{pathnameStackToGoBack:n,referrer:"Reports"}})}else o(!0);else Fa({location:t,navigate:a,mergeState:{referrer:"Reports"}})},isHorizontalClassReportSwitchEnabled:f,isReportsCommentingEnabled:Q,initialOpenThreadRequest:ue})]})}const j=e=>{switch(e){case"profit_and_loss":case"profit_and_loss_by_classes":case"profit_and_loss_by_projects":return"Profit & Loss";case"balance_sheet":case"balance_sheet_by_classes":case"balance_sheet_by_projects":return"Balance Sheet";case"cash_flow":case"cash_flow_by_classes":case"cash_flow_by_projects":return"Cash Flow";default:return"Reports"}};function _s(){const e=d((s=>$(s))),{useFeatureGate:o}=de(),{isFeatureEnabled:_}=o(q.isDebitCardFeatureEnabled),m=ha(_,e),a=ya(e);return m===!0||a===!0?p.jsx(Ma,{}):p.jsxs(Pe,{children:[p.jsx(ee,{path:"/",element:p.jsx(Ha,{})}),p.jsx(ee,{path:"*",element:p.jsx(La,{})})]})}export{_s as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-BhGApeF9.js";import{z as b,a6 as N,h as f,Q as S,d_ as E,O as k,y as I}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import g from"./NotFoundScreen-C_nzijM_.js";import{a as c}from"./sentry-B98sAG37.js";import{u as C,j as h,h as F,g as L,l as _,n as T,o as d,N as y}from"./core-C5rVvNoh.js";import{fB as U,a13 as w,a14 as p,D6 as P,pX as V,a15 as z,D4 as B}from"./zeni-epic-state-BVExw1ei.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.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]="216bc121-eca2-4673-ba4b-d54b553a077a",e._sentryDebugIdIdentifier="sentry-dbid-216bc121-eca2-4673-ba4b-d54b553a077a")}catch{}})();const G=_((function(e,t){const n=w(e);return{inviteFormView:n.localData,submitStatus:n.saveStatus,userName:t.userName,rewardsPlan:n.rewardsPlan,companyLegalName:t.companyName}}),(function(e,t){const{navigate:n}=t,i=b.getSignedInUser();return{onDismissClick:()=>{e(p()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((l=>{s.push(l.companyName),r.push(l.emailIds[0])})),f.trackInviteEmailClicked("send",s,r,s.length)}e(B())},onUpdateInviteFormLocalData:s=>{e(z({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&f.trackInviteEmailClicked("cancel")}}}))(E),O=()=>{const e=C(),[t,n]=c.useState(!1),[i,s]=c.useState(!1),r=h((o=>U(o))),l=F(),j=L(),u=b.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const m=h((o=>w(o))),x=u?.firstName!=null?u.firstName:"User";c.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),c.useEffect((()=>{t||m.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[m.fetchState,e]);const D=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[m.fetchState==="Completed"?a.jsx(N,{analytics:f,onLoad:o=>(v=>v.trackPageLoaded(S.Event.inviteEmailViewed))(o)}):null,a.jsx(G,{navigate:l,location:j,currentTenant:r,companyName:D,userName:x,inviteFormCompayData:m.localData})]})};function ne(){const{useFeatureGate:e}=k(),{isFeatureEnabled:t}=e(I.isReferralFeatureEnabled);return a.jsxs(T,{children:[a.jsx(d,{path:"/",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"refer/*",element:t?a.jsx(O,{}):a.jsx(g,{})}),a.jsx(d,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotFoundScreen-C_nzijM_.js","assets/sentry-B98sAG37.js","assets/core-C5rVvNoh.js","assets/zeni-epic-state-BVExw1ei.js","assets/index-BTTzX8oM.js","assets/mui-AVx3Hg0F.js","assets/analytics-B5-t19F2.js","assets/utils-B1bcOxs7.js","assets/index-BhC2LNQw.css","assets/DashboardRoutes-CzNNddHy.js","assets/withTransactionSidePanel-F28FfzEK.js","assets/useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js","assets/TransactionDetailScreen-IKPgPc-W.js","assets/decodeURIComponentSafe-ChlmY296.js","assets/useInitialThreadRequest-DuL5mYzq.js","assets/routePaths-Cx9L8hBM.js","assets/expenseAutomationHelper-DT3oLJj6.js","assets/analyticsHelper-5kEw8e8E.js","assets/CompanyPassportScreen-BChXj6Kk.js","assets/MobileAppDrawer-DigqZbbY.js","assets/InboxNotificationsProvider-MlM0K3gF.js","assets/useTaskManagerAccess-vcnpqvQT.js","assets/useAiCfoDashboardSuggestedQuestionsChips-C7_zR2C_.js","assets/FeaturePreviewScreen-CVnp0bZd.js","assets/BillPayRoutes-DDeK4O3Z.js","assets/AddressScreen-Dyq7f1j-.js","assets/DomesticWireDetailScreen-C2hFGwu0.js","assets/BusinessVerificationPageScreen-BhpdMjkc.js","assets/DrawerScreen-lK0vJxIS.js","assets/SetupPagesScreen-BgHIeOKB.js","assets/BillPayApprovalRoutes-Cf5w1Fd_.js","assets/ReimbursementApprovalRuleDetailScreen-CuE7ORwk.js","assets/getLocaleForTenant-DQ9OiUn_.js","assets/ReimbursementRoutes-6nUym5eB.js","assets/ReimbursementApprovalRoutes-CGtOCJ7F.js","assets/TransactionListRoutes-Bu8kgDQQ.js","assets/ZeniAccountStatementScreen-C_X33S2u.js","assets/SettingsRoutes-AaNqIdby.js","assets/AccountMappingScreen-Bim1Hr_z.js","assets/QBOConnectionScreen-ByKxBz2v.js","assets/empty-BTHEbwNZ.js","assets/index-DMhoHJcD.js","assets/url-RaJlDbzw.js","assets/index-CGyxP256.js","assets/accountMappingHelper-BIF4Ld_b.js","assets/useEmailConnectResultRefresh-98NnzJRh.js","assets/ReportsRoutes-s2hJ2RsR.js","assets/ChargeCardRoutes-Y_ZnY6a9.js","assets/useChargeCardPusherEvents-XPXgI-Bx.js","assets/PeopleRoutes-DJYa775V.js","assets/ExpenseAutomationRoutes-CVR_qG3c.js","assets/TreasuryRoutes-CZBiOy69.js","assets/VendorsRoutes-KMa9llQ2.js","assets/pathToGoBack-CW7sD0XS.js","assets/ZeniAccountRoutes-DpPln-Iv.js","assets/AddressRoutes-CdDnkC-7.js","assets/PandLWithForecastRoutes-5el-0Lj7.js","assets/CustomerOnboardingRoutes-CRNi6Rqr.js","assets/TransactionDetailRoutes-BLhI-0B0.js","assets/EntityDetailRoutes-BSm0QeV6.js","assets/InvoicingRoutes-Q8vi5u3U.js","assets/NotificationRoutes-DKgxAwSp.js","assets/PerformanceRoutes-CrDIRhB1.js","assets/RewardsRoutes-C-di4Yoz.js","assets/TaskRoutes-BWLw4wFO.js","assets/TaskListScreen-D4isBRlx.js","assets/AiCfoScreen-BAtt2kQC.js","assets/CardsAiCfoScreen-BmeTr_5u.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as s,bn as cs,fB as ms,dV as _s,dU as Es,Aj as hs,de as ps,gG as gs,g5 as xs,db as pe,cF as Rs,gj as js,cx as Is,bE as Ts,br as As,Tp as bs,v as fs,Tr as ys,bq as Ds,Ts as Cs,bK as vs,bJ as Os,bt as Ps,ct as Us,Tt as ws,Tu as Fs,d6 as Ls,d9 as Vs,d8 as ks,cE as Hs,cL as Bs,pO as ge,ge as xe,gV as Ss,gg as Re,gI as je,gJ as Ie,gh as Ns}from"./zeni-epic-state-BVExw1ei.js";import{j as e}from"./liveblocks-BhGApeF9.js";import{a as U}from"./sentry-B98sAG37.js";import{N as u,u as Ms,h as Zs,i as Gs,g as $s,j as $,q as Te,n as zs,o as n}from"./core-C5rVvNoh.js";import{J as l,E as qs,u as Ws,z as y,O as Ys,d as Js,W as Ks,y as M,f as Xs,K as Qs,V as et,L as F,G as Ae,t as _,P as st,M as tt,h as te}from"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import{f as be}from"./analyticsHelper-5kEw8e8E.js";import{t as nt}from"./getLocaleForTenant-DQ9OiUn_.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},A=new a.Error().stack;A&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[A]="2590d965-53a8-4bd9-ae07-41556cbf73d9",a._sentryDebugIdIdentifier="sentry-dbid-2590d965-53a8-4bd9-ae07-41556cbf73d9")}catch{}})();const at=l((()=>s((()=>import("./NotFoundScreen-C_nzijM_.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),ot=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/reimbursements`}),rt=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/bills`}),fe=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/treasury`}),ye=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/checking`}),De=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/cards`}),D=({showZeniAccountRoute:a,isUserHasBillPayAccess:A,isUserHasReimbursementAccess:B,showTreasuryRoute:i,isTenantBankingOnly:V,showChargeCardRoute:O,tenantEmailDomain:v})=>{if(V===!0){if(a)return e.jsx(ye,{tenantEmailDomain:v});if(i)return e.jsx(fe,{tenantEmailDomain:v});if(O)return e.jsx(De,{tenantEmailDomain:v})}return a?e.jsx(ye,{tenantEmailDomain:v}):i?e.jsx(fe,{tenantEmailDomain:v}):O?e.jsx(De,{tenantEmailDomain:v}):A?e.jsx(rt,{tenantEmailDomain:v}):B?e.jsx(ot,{tenantEmailDomain:v}):e.jsx(at,{})},it={dashboard:()=>s((()=>import("./DashboardRoutes-CzNNddHy.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,0,17,18,19,20,21,22,23,8])),bills:()=>s((()=>import("./BillPayRoutes-DDeK4O3Z.js")),__vite__mapDeps([24,1,2,3,4,5,6,7,25,0,26,11,14,27,15,19,20,21,28,23,29,17,30,31,32,8])),reimbursement:()=>s((()=>import("./ReimbursementRoutes-6nUym5eB.js")),__vite__mapDeps([33,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,11,14,28,34,31,32,8])),transactions:()=>s((()=>import("./TransactionListRoutes-Bu8kgDQQ.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])),settings:()=>s((()=>import("./SettingsRoutes-AaNqIdby.js")),__vite__mapDeps([37,1,2,3,4,5,6,7,21,38,19,20,39,40,41,42,43,13,44,25,0,17,27,15,18,45,30,31,34,8])),reports:()=>s((()=>import("./ReportsRoutes-s2hJ2RsR.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])),chargeCards:()=>s((()=>import("./ChargeCardRoutes-Y_ZnY6a9.js")),__vite__mapDeps([47,1,2,3,4,5,6,7,11,19,20,21,29,27,15,0,17,14,48,25,8])),people:()=>s((()=>import("./PeopleRoutes-DJYa775V.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])),expenseAutomation:()=>s((()=>import("./ExpenseAutomationRoutes-CVR_qG3c.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,10,44,28,8])),treasury:()=>s((()=>import("./TreasuryRoutes-CZBiOy69.js")),__vite__mapDeps([51,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])),vendors:()=>s((()=>import("./VendorsRoutes-KMa9llQ2.js")),__vite__mapDeps([52,1,2,3,4,5,6,7,25,0,23,53,15,11,19,20,21,28,44,8])),zeniAccounts:()=>s((()=>import("./ZeniAccountRoutes-DpPln-Iv.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8]))},lt=["bills","transactions","settings","reimbursement","reports","chargeCards","people"],ne=a=>{"requestIdleCallback"in window?requestIdleCallback(a):setTimeout(a,100)},ut=l((()=>s((()=>import("./ReportsRoutes-s2hJ2RsR.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])))),dt=l((()=>s((()=>import("./AddressRoutes-CdDnkC-7.js")),__vite__mapDeps([55,1,2,3,25,4,5,6,7,0,8])))),ct=l((()=>s((()=>import("./PeopleRoutes-DJYa775V.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])))),mt=l((()=>s((()=>import("./PandLWithForecastRoutes-5el-0Lj7.js")),__vite__mapDeps([56,1,2,3,4,5,6,7,0,23,11,14,15,19,20,21,8])))),_t=l((()=>s((()=>import("./CustomerOnboardingRoutes-CRNi6Rqr.js")),__vite__mapDeps([57,1,2,3,25,4,5,6,7,0,39,40,41,42,43,13,45,48,8])))),Et=l((()=>s((()=>import("./VendorsRoutes-KMa9llQ2.js")),__vite__mapDeps([52,1,2,3,4,5,6,7,25,0,23,53,15,11,19,20,21,28,44,8])))),ht=l((()=>s((()=>import("./TransactionDetailRoutes-BLhI-0B0.js")),__vite__mapDeps([58,1,2,3,0,4,5,6,7,12,11,13,14,15,16,8])))),Ce=l((()=>s((()=>import("./EntityDetailRoutes-BSm0QeV6.js")),__vite__mapDeps([59,1,2,3,4,5,6,7,13,10,11,12,14,15,16,8])))),pt=l((()=>s((()=>import("./DashboardRoutes-CzNNddHy.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,0,17,18,19,20,21,22,23,8])))),ve=l((()=>s((()=>import("./BillPayRoutes-DDeK4O3Z.js")),__vite__mapDeps([24,1,2,3,4,5,6,7,25,0,26,11,14,27,15,19,20,21,28,23,29,17,30,31,32,8])))),gt=l((()=>s((()=>import("./SettingsRoutes-AaNqIdby.js")),__vite__mapDeps([37,1,2,3,4,5,6,7,21,38,19,20,39,40,41,42,43,13,44,25,0,17,27,15,18,45,30,31,34,8])))),xt=l((()=>s((()=>import("./InvoicingRoutes-Q8vi5u3U.js")),__vite__mapDeps([60,1,2,3,4,5,6,7,25,0,19,20,21,39,40,41,42,43,13,8])))),Oe=l((()=>s((()=>import("./ReimbursementRoutes-6nUym5eB.js")),__vite__mapDeps([33,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,11,14,28,34,31,32,8])))),Rt=l((()=>s((()=>import("./ZeniAccountRoutes-DpPln-Iv.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8])))),jt=l((()=>s((()=>import("./TreasuryRoutes-CZBiOy69.js")),__vite__mapDeps([51,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])))),It=l((()=>s((()=>import("./TransactionListRoutes-Bu8kgDQQ.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])))),Tt=l((()=>s((()=>import("./ChargeCardRoutes-Y_ZnY6a9.js")),__vite__mapDeps([47,1,2,3,4,5,6,7,11,19,20,21,29,27,15,0,17,14,48,25,8])))),At=l((()=>s((()=>import("./NotificationRoutes-DKgxAwSp.js")),__vite__mapDeps([61,1,2,3,0,4,5,6,7,11,21,8])))),bt=l((()=>s((()=>import("./PerformanceRoutes-CrDIRhB1.js")),__vite__mapDeps([62,1,2,3,0,4,5,6,7,11,19,20,21,8])))),ft=l((()=>s((()=>import("./ExpenseAutomationRoutes-CVR_qG3c.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,10,44,28,8])))),yt=l((()=>s((()=>import("./RewardsRoutes-C-di4Yoz.js")),__vite__mapDeps([63,1,2,3,4,5,6,7,0,8])))),Dt=l((()=>s((()=>import("./TaskRoutes-BWLw4wFO.js")),__vite__mapDeps([64,1,2,3,0,4,5,6,7,14,19,20,21,65,11,8])))),Ct=l((()=>s((()=>import("./AiCfoScreen-BAtt2kQC.js")),__vite__mapDeps([66,1,2,3,4,5,6,7,22,53,8])))),Pe=l((()=>s((()=>import("./CardsAiCfoScreen-BmeTr_5u.js")),__vite__mapDeps([67,1,2,3,4,5,6,7,8])))),C=l((()=>s((()=>import("./NotFoundScreen-C_nzijM_.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),vt=l((()=>s((()=>import("./TaskListScreen-D4isBRlx.js").then((a=>a.f))),__vite__mapDeps([65,1,2,3,4,5,6,7,11,19,20,21,8])))),Ot=({isDashboardAccess:a,showZeniAccountRoute:A,isUserHasBillPayAccess:B,isUserHasReimbursementAccess:i,showTreasuryRoute:V,isTenantBankingOnly:O,isTenantCardsOnly:v,showChargeCardRoute:k})=>{if(O===!0){if(A)return e.jsx(u,{to:"checking"});if(V)return e.jsx(u,{to:"treasury"});if(k)return e.jsx(u,{to:"cards"})}return v===!0&&k?e.jsx(u,{to:"cards"}):a?e.jsx(u,{to:"dashboard"}):A?e.jsx(u,{to:"checking"}):V?e.jsx(u,{to:"treasury"}):k?e.jsx(u,{to:"cards"}):B?e.jsx(u,{to:"bills"}):i?e.jsx(u,{to:"reimbursements"}):e.jsx(u,{to:"dashboard"})},Ue=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/dashboard`}),Bt=Object.freeze(Object.defineProperty({__proto__:null,default:function({setTenantEmailDomain:a}){const A=Ms(),B=Zs(),{tenantEmailDomain:i}=Gs(),V=qs().mode,{setLoading:O,clearAllLoading:v,clearLoading:k}=Ws(),b=y.getSignedInUserTenant(i)?.tenantId,I=y.getSignedInUser(),J=cs(I),z=$s(),[L,we]=U.useState(!1),r=$((o=>ms(o))),{useFeatureGate:S}=Ys(),Z=Js(),ae=Ks(),Fe=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,Le=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",{isFeatureEnabled:Ve}=S(M.isChargeCardFeatureEnabled),{isFeatureEnabled:oe}=S(M.isDebitCardFeatureEnabled),T=$((o=>o.tenantState.fetchState)),p=$((o=>o.tenantState.activeTenantFetchState.fetchState)),E=p==="Completed"||T==="Completed"?_s(oe,r):void 0,K=p==="Completed"||T==="Completed"?Es(r):void 0,re=p==="Completed"||T==="Completed"?hs(r)&&!ps(r):void 0,ke=Xs(r,Ve,oe),{isCardsHidden:He}=Qs(r?.tenantId),Be=!ke||!!He,{isFeatureEnabled:Se}=S(M.isSettingsFeatureEnabled),{isFeatureEnabled:X}=S(M.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ne}=S(M.isInvoicingFeatureEnabled??"is_invoicing_feature_enabled"),Me=Ne||tt==="DEV",q=$((o=>gs(o)));if(i!=null){const o=y.getSignedInUserTenant(i);I!=null&&o!=null&&be(I,r,V)}const G={tenantId:b,userId:I?.userId,sessionId:I?.zeniSessionId},ie=xs(),h=et(),Ze=r.company==null||h?.loggedInUserRoleMap!=null&&pe(h.loggedInUserRole),Ge=Rs(h?.loggedInUserRoleMap),Q=Te("/:tenantEmailDomain/onboarding/*")!==null,ee=Te("/:tenantEmailDomain/month_end_close_checks/review/:selectedTab/:selectedPeriod/*"),$e=$((o=>G.tenantId!=null?js(o,G.tenantId):void 0));U.useEffect((()=>{O(F.TENANT_FETCHING),a(i)}),[i]),U.useEffect((()=>{if(ee!=null&&b!=null){const o=ee.params.selectedPeriod;if(o!=null){const f=o.split("-");if(f.length===2){const d=Is(Number(f[0])),t=Number(f[1]),c=Ts(`01-${d<10?`0${d}`:d}-${t}`,Ae.getLocalizedStrings().dateFormat.analytics.DDDashMMDashYYYY),N=As();c.isAfter(N,"month")===!1?A(bs(b,{month:d,year:t})):B(`/${i}/month_end_close_checks/review`)}}}}),[ee,b]),U.useEffect((()=>{L||(we(!0),O(F.TENANT_FETCHING))}),[L,G,ie,I,A,y]),U.useLayoutEffect((()=>{!fs(ie,G)&&y.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,d,t){if(xe(f?.userId,f?.zeniSessionId,o.tenantId),d(Ss(!0)),d(Re(o.tenantId)),o.tenantId!=null&&_.clearTenant(o.tenantId),o.tenantId!=null){const c=y.getSignedInUserTenantWithId(o.tenantId);t&&Ae.updateAppLocaleID(nt(t)),c?.tenantEmailDomain!=null&&y.saveActiveTenantDomainForUser(c?.tenantEmailDomain)}o.userId!=null?te.identify(o.userId,{tenant_id:o.tenantId}):te.resetUserIdentity()})(G,I,A,$e))}),[b]),U.useEffect((()=>{y.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,d,t,c,N,H){if(d==null&&t==null)return void console.warn("There is no current tenant selected!!");const W=t!=null&&c?.zeniSessionId!=null,ls=d==null||d.tenantId!==t,us=d!=null&&d.excludedResources==null,ds=d!=null&&d.externalConnections==null;if(W&&ls){H(Re(t));const Y=y.getSignedInUserTenantWithId(t);Y?.tenantEmailDomain!=null&&y.saveActiveTenantDomainForUser(Y?.tenantEmailDomain),xe(c?.userId,c?.zeniSessionId,t),_.shouldFetchExcludedResources(t)&&(_.markExcludedResourcesFetchStarted(t),H(je(c.userId,t))),_.shouldFetchConnections(t)&&(_.markConnectionsFetchStarted(t),H(Ie(c.userId,t)))}else W&&us&&_.shouldFetchExcludedResources(t)&&(_.markExcludedResourcesFetchStarted(t),H(je(c.userId,t))),W&&ds&&_.shouldFetchConnections(t)&&(_.markConnectionsFetchStarted(t),H(Ie(c.userId,t)));if(W){te.identify(c.userId,{tenant_id:t});const Y=t==null||t!=null&&(f==="Completed"||f==="Error");o==="Completed"||f!=="Not-Started"&&f!=="Error"||t==null||!_.shouldFetchActiveTenant(t)||(_.markActiveTenantFetchStarted(t),N(F.TENANT_FETCHING),H(Ns(c.userId,t,c.zeniSessionId))),Y&&(o==="Not-Started"||o==="Error")&&_.shouldFetchAllTenants()&&(_.markAllTenantsFetchStarted(),H(ge(c.userId,c.zeniSessionId)))}})(T,p,r,b,I,O,A))}),[b,p]),U.useEffect((()=>{y.isSignedIn()&&T==="Completed"&&q.tenantsBaseInOrder.length>0&&(k(F.TENANT_FETCHING),y.saveSignedInUserTenants(ys(q.tenantsBaseInOrder)),I!=null&&be(I,r,V,void 0,q.tenantsBaseInOrder))}),[q,T,r,I]),U.useEffect((()=>{p==="In-Progress"&&O(F.TENANT_FETCHING),p!=="Completed"&&p!=="Error"||(p==="Completed"&&b!=null?(v(),_.markActiveTenantFetchCompleted(b)):p==="Error"&&b!=null&&(_.markActiveTenantFetchFailed(b),k(F.TENANT_FETCHING),k(F.TENANT_SWITCHING))),T!=="Completed"&&T!=="Error"||(T==="Completed"?_.markAllTenantsFetchCompleted():T==="Error"&&_.markAllTenantsFetchFailed())}),[p,T,b,L]);const le=U.useRef(!1);U.useEffect((()=>{!le.current&&p==="Completed"&&L&&(le.current=!0,(function(o=lt,f=3e3){setTimeout((()=>{const d=t=>{if(t>=o.length)return;const c=o[t],N=it[c];N!=null?N().then((()=>ne((()=>d(t+1))))).catch((()=>ne((()=>d(t+1))))):d(t+1)};ne((()=>d(0)))}),f)})())}),[p,L]);const P=r?.userRole!=null&&Ds(r?.userRole),{isFeatureEnabled:ze}=S(M.isReferralFeatureEnabled),qe=r?.userRole!=null&&r.userRole.includes("charge_card_user"),We=r?.userRole!=null&&r.userRole.includes("charge_card_admin"),w=r?.userRole!=null&&pe(r.userRole),ue=r?.company==null||r.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!P,de=!Be&&!P,Ye=Cs(h?.loggedInUserRoleMap),Je=r.externalConnections?.accounting[0]?.isValid,Ke=r.externalConnections?.fetchState==="Completed",se=r.company?.companyOnboardingInfo.isOnboardingCompleted,ce=r?.company==null||r.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!P,me=ce&&vs(h?.loggedInUserRoleMap),_e=Fe&&!P,Xe=Le&&!P,Qe=ue&&Os(h?.loggedInUserRoleMap),es=de&&Ps(h?.loggedInUserRoleMap),ss=_e&&Us(h?.loggedInUserRoleMap),ts=ws(h?.loggedInUserRoleMap),ns=Fs(h?.loggedInUserRoleMap),as=Ls(h?.loggedInUserRoleMap),os=Vs(h?.loggedInUserRoleMap),rs=ks(h?.loggedInUserRoleMap),g=Hs(h?.loggedInUserRoleMap),x=Bs(h?.loggedInUserRoleMap),Ee=ue&&g,he=ce&&x,R=_e&&as,j=Xe&&os,m=de&&rs,is=r.excludedResources?.resources?.find((o=>o.resource==="/invites"))!=null||Ge===!0||Ye===!0||ts===!0||ns===!0;return y.isSignedIn()?b==null?T==="Completed"?e.jsx(u,{to:"/",replace:!0,state:{...z.state,message:"...",origin:z.pathname}}):(I!=null&&T!=="In-Progress"&&A(ge(I.userId,I.zeniSessionId)),null):p!=="In-Progress"&&p!=="Not-Started"||T==="Completed"?(se===!0||J&&!Q)&&Ke&&Je!==!0&&E===!1&&K===!1&&re===!1?(a(void 0),e.jsx(u,{to:"/connection/auth",replace:!0})):!L||re!==!0||se!==!0||Q||J?!L||se!==!1||Q||J?L&&r?.userRole&&E!=null&&K!=null&&i!=null&&Object.keys(h.loggedInUserRoleMap).length>0?e.jsx(zs,{children:e.jsxs(n,{element:e.jsx(st,{}),children:[e.jsx(n,{path:"/",element:e.jsx(Ot,{isDashboardAccess:w,showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,isTenantCardsOnly:K,showChargeCardRoute:m})}),e.jsx(n,{path:"dashboard/*",element:w?e.jsx(pt,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"reports/*",element:w?e.jsx(ut,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"people/*",element:is||w?e.jsx(ct,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"forecast/*",element:w?e.jsx(mt,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"onboarding/*",element:e.jsx(_t,{})}),e.jsx(n,{path:"transaction/*",element:w&&P===!1||qe||We?e.jsx(ht,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"transactions/*",element:w&&P===!1?e.jsx(It,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"customer/*",element:w&&P===!1?e.jsx(Ce,{entityType:"customer"}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,isTenantBankingOnly:E,showTreasuryRoute:j,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"vendor/*",element:w&&P===!1?e.jsx(Ce,{entityType:"vendor"}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"tasks",element:e.jsx(vt,{})}),e.jsx(n,{path:"tasks/*",element:e.jsx(Dt,{})}),e.jsx(n,{path:"address/*",element:Qe||me||ss||es?e.jsx(dt,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"checking/*",element:R?e.jsx(Rt,{}):e.jsx(C,{})}),e.jsx(n,{path:"treasury/*",element:j?e.jsx(jt,{}):e.jsx(C,{})}),e.jsx(n,{path:"performance",element:ae===!0?e.jsx(bt,{}):e.jsx(Ue,{tenantEmailDomain:i})}),e.jsx(n,{path:"month_end_close_checks/review/*",element:ae===!0&&P===!1?e.jsx(ft,{}):e.jsx(Ue,{tenantEmailDomain:i})}),e.jsx(n,{path:"notifications/*",element:e.jsx(At,{})}),e.jsx(n,{path:"vendors/*",element:Ze?e.jsx(Et,{}):e.jsx(C,{})}),e.jsx(n,{path:"bill/*",element:Ee?e.jsx(ve,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"bills/*",element:Ee?e.jsx(ve,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"reimbursement/*",element:he?e.jsx(Oe,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"reimbursements/*",element:he?e.jsx(Oe,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(n,{path:"settings/*",element:Se?e.jsx(gt,{hasAdminLevelAccess:me}):e.jsx(C,{})}),e.jsx(n,{path:"invoicing/*",element:Me?e.jsx(xt,{}):e.jsx(C,{})}),e.jsx(n,{path:"cards/ask",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:X}):e.jsx(C,{})}),e.jsx(n,{path:"cards/ask/:session_id",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:X}):e.jsx(C,{})}),e.jsx(n,{path:"cards/*",element:m?e.jsx(Tt,{}):e.jsx(C,{})}),e.jsx(n,{path:"rewards/*",element:ze?e.jsx(yt,{}):e.jsx(C,{})}),e.jsx(n,{path:"/ai-cfo",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(n,{path:"/ai-cfo/",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(n,{path:"/ai-cfo/:session_id",element:Z?e.jsx(Ct,{isFileUploadEnabled:X}):e.jsx(C,{})}),e.jsx(n,{path:"*",element:e.jsx(C,{})})]})}):null:(a(void 0),e.jsx(u,{to:`/${i}/onboarding`,replace:!0})):(a(void 0),e.jsx(u,{to:`/${i}/onboarding/thankyou`,replace:!0})):null:(console.warn("User logged out!!"),a(void 0),e.jsx(u,{to:"/signin/auth",replace:!0,state:{...z.state,message:"...",origin:z.pathname}}))}},Symbol.toStringTag,{value:"Module"}));export{D as F,Bt as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-BhGApeF9.js";import{a as u,R as C,q as A}from"./sentry-B98sAG37.js";import{u as z,h as D,j as l,g as M,N as O,l as j}from"./core-C5rVvNoh.js";import{u as P,z as s,E as _,h as E,G as F,N,Q as B,R,S as V,T as $,U as b}from"./index-BTTzX8oM.js";import{fB as q,Tb as J,Tr as Q,ge as W,gg as G,Tw as H,gR as K,df as X,Tx as y,Ty as Y,Tz as Z,b_ as v}from"./zeni-epic-state-BVExw1ei.js";import"./mui-AVx3Hg0F.js";import{u as ee}from"./useDeviceId-6INyJgde.js";import{f as te}from"./analyticsHelper-5kEw8e8E.js";import{t as ne}from"./getLocaleForTenant-DQ9OiUn_.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="3c764fdf-b2d3-4ae2-bdc8-b6571ebb38f5",t._sentryDebugIdIdentifier="sentry-dbid-3c764fdf-b2d3-4ae2-bdc8-b6571ebb38f5")}catch{}})();const ie=j((function(t,i){const d=t.tenantState.fetchState,g=t.tenantState.sendEmailMagicLinkFetchState,{magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}=i;return{googleClientId:b.googleClientId,microsoftClientId:b.microsoftClientId,signInError:t.tenantState.error?.error,fetchState:d,sendMagicLinkStatus:g,magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}}),(function(t,i){const{location:d,navigate:g}=i;return console.warn(JSON.stringify(window.location)),{onOAuthError:(n,a)=>{A({message:`OAuth error from provider ${a} with error ${n}`,level:"error",tags:{authProvider:a,errorType:"zeni.login.error"},extra:{error:n,windowLocation:window.location.href}})},onOAuthSuccess:(n,a)=>{const c=a==="google"?window.location.origin:window.location.origin+window.location.pathname;t(Z({authCode:n,oauthProvider:a,appType:"web",redirectUri:v(c),sourceUri:v(d.state!=null?d.state.origin:"")}))},getSignedInUser:()=>s.getSignedInUser(),onSignedInCallback:()=>{const n=d.state?.origin;n&&n!=="/"?g(n,{replace:!0}):window.open(window.location.origin,"_self")},sendMagicLink:n=>{const{deviceId:a}=i;a!=null&&(s.saveMagicLinkEmail(n),t(Y(n,a)))},clearSignInError:()=>{t(y())}}}))($),ae=C.memo(ie);function be({setTenantEmailDomain:t}){const i=z(),d=D(),{clearAllLoading:g}=P(),n=s.getSignedInUser();u.useLayoutEffect((()=>{g()}),[g]);const a=ee(),c=l((e=>e.tenantState.magicLinkCodeVerifier)),{sendEmailMagicLinkFetchState:h,accountLocked:T,accountUnlockTime:L}=l((e=>e.tenantState)),p=l((e=>e.tenantState.fetchState)),k=l((e=>e.tenantState.activeTenantFetchState.fetchState)),S=l((e=>e.tenantState.signInState)),o=l((e=>e.tenantState.loggedInUser)),r=l((e=>q(e))),I=l((e=>J(e))),m=M(),w=_().mode,U=m.state?.magicLinkExpired,x=m.state?.magicLinkAlreadyUsed;if(u.useEffect((()=>{h.fetchState==="Completed"&&c!=null&&(E.trackSignInLinkSent(),s.saveMagicLinkCodeVerifier(c))}),[h.fetchState,c]),u.useEffect((()=>{t(void 0)}),[]),u.useEffect((()=>{S!=="In-Progress"||p!=="Completed"&&k!=="Completed"||o?.zeniSessionId==null||r==null||(s.savePayNowInfoTooltip(!0,o.zeniSessionId),s.saveSignedInUserWithSession(o,o.zeniSessionId),s.saveSignedInUserTenants(Q(I.tenantsInOrder),o.zeniSessionId),W(o.userId,o.zeniSessionId,r.tenantId),i(G(r.tenantId)),s.saveActiveTenantDomainForUser(r.tenantEmailDomain),i(H("Completed")),F.updateAppLocaleID(ne(r)),te(o,r,w,void 0,I.tenantsInOrder),K().then((()=>{const e=V();e!=null&&N(e)})),setTimeout((()=>{E.trackLogin(B.Event.loginSuccess,o.authProvider??"google",X(r.productSettings))}),2e3))}),[S,p,k,o,r,I,w,m.state,i]),S==="In-Progress"&&p==="Completed"&&o?.zeniSessionId!=null&&r!=null||n!=null){const e=m.state?.origin??"/";return f.jsx(O,{to:e,state:{...m.state,origin:""}})}return f.jsxs(f.Fragment,{children:[f.jsx(ae,{magicLinkExpired:!!U,magicLinkAlreadyUsed:!!x,magicLinkExpiredEmail:s.getMagicLinkEmail()??void 0,location:m,navigate:d,deviceId:a??void 0,showEmailLogin:!0}),T===!0&&L!=null?f.jsx(R,{onClose:()=>i(y()),unlockDate:L}):null]})}export{be as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-BhGApeF9.js";import{a as i}from"./sentry-B98sAG37.js";import{u as c,g as d,N as u}from"./core-C5rVvNoh.js";import{z as n,h as a,Q as m,a5 as p}from"./index-BTTzX8oM.js";import{gU as g,TN as y}from"./zeni-epic-state-BVExw1ei.js";import{n as b}from"./mui-AVx3Hg0F.js";import"./recharts-uwVP8vj-.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="96b186c5-39ba-4640-9408-426124f45d62",t._sentryDebugIdIdentifier="sentry-dbid-96b186c5-39ba-4640-9408-426124f45d62")}catch{}})();function L(){const t=c(),e=d(),r=i.useRef(!1),f=n.isSignedIn(),o=e.state?.message==="logout"||f;return i.useEffect((()=>{if(o&&!r.current){r.current=!0;try{t(g()),y(),a.trackLogout(m.Event.logoutSuccess),a.resetUserIdentity(),n.clearAll()}catch(l){console.error("Error during sign out:",l)}finally{window.location.replace("/signin/auth")}}}),[o,t]),o?s.jsx(h,{children:s.jsx(p,{fetchState:"In-Progress"})}):s.jsx(u,{to:"../",replace:!0})}const h=b.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${t=>t.theme.colors.grey4};
|
|
9
|
-
`;export{L as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as C}from"./liveblocks-BhGApeF9.js";import{a as T}from"./sentry-B98sAG37.js";import{h as pe,u as fe,g as Te,k as ge,j as F,i as _e,l as me}from"./core-C5rVvNoh.js";import{aI as De,aJ as be,z as x,O as Se,y as G,aq as he,a6 as Ee,h as ye,Q as Ae,e1 as Ce,p as R,a2 as Ge}from"./index-BTTzX8oM.js";import{fB as Ie,a1a as X,Qm as B,a1b as Y,a16 as Be,PK as M,a1c as Ke,PS as q,Ps as ve,P4 as Le,Qn as V,a1d as W,gd as we,Qd as Re,Qi as Ue,Q5 as Pe,Q3 as J,Qj as Fe,Q0 as je,a1e as xe,a1f as Oe,a1g as $e,a1h as Ne,a1i as I,dt as Qe,ds as ze,a1j as Ze,Pp as Me}from"./zeni-epic-state-BVExw1ei.js";import{n as qe}from"./mui-AVx3Hg0F.js";import{u as Ve}from"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import{M as We}from"./MobileAppDrawer-DigqZbbY.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new a.Error().stack;e&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[e]="182ee7ef-1dd0-44be-80f3-01f551571ef5",a._sentryDebugIdIdentifier="sentry-dbid-182ee7ef-1dd0-44be-80f3-01f551571ef5")}catch{}})();const c={TASK_CREATED:"task-created",TASK_UPDATED:"task-updated",TASK_SNOOZE_RESURFACED:"task-snooze-resurfaced",TASKS_BULK_UPDATED:"tasks-bulk-updated",TASKS_BULK_DELETED:"tasks-bulk-deleted"},Je=(a,e)=>a==null||a===""?[]:e.map((n=>`private-encrypted-${a}.${n}`)),He=(a,e)=>a==null||a===""?[]:e.map((n=>`private-encrypted-${a}.${n}`)),U=a=>Array.isArray(a)&&a.every((e=>typeof e=="string")),Xe=a=>{if(a==null||typeof a!="object")return null;const e=a,n=typeof e.task_id=="string"?e.task_id:typeof e.id=="string"?e.id:null;if(n==null||typeof e.tenant_id!="string"||typeof e.event_type!="string")return null;const o={task_id:n,tenant_id:e.tenant_id,event_type:e.event_type};return typeof e.is_private=="boolean"&&(o.is_private=e.is_private),U(e.assignees)&&(o.assignees=e.assignees),U(e.direct_assignees)&&(o.direct_assignees=e.direct_assignees),typeof e.created_by=="string"&&(o.created_by=e.created_by),U(e.task_group_ids)&&(o.task_group_ids=e.task_group_ids),typeof e.name=="string"&&(o.name=e.name),typeof e.parent_task_id=="string"&&(o.parent_task_id=e.parent_task_id),o},Ye=a=>{if(a==null||typeof a!="object")return null;const e=a;return U(e.task_ids)?{task_ids:e.task_ids}:null},pa=a=>{if(a==null||typeof a!="object")return null;const e=a;return typeof e.task_id!="string"?null:{task_id:e.task_id}},ea=a=>{const{events:e,onEvent:n,onSubscribed:o}=a,i=De(),g=T.useRef(n),l=T.useRef(o),_=T.useRef(0);T.useEffect((()=>{g.current=n}),[n]),T.useEffect((()=>{l.current=o}),[o]);const t=T.useMemo((()=>[...e].sort().join("|")),[e]);T.useEffect((()=>{if(i==null||e.length===0)return;const s=[],p=new Set,S=()=>{if(l.current==null)return;const m=Date.now();m-_.current<5e3||(_.current=m,l.current())};return e.forEach((m=>{const[D,b]=be(m);if(b==="")return;const E=i.channel(D),y=f=>{g.current(b,f)};let k;if(E?.subscribed===!0){if(k=E,k.bind(b,y),!p.has(D)){p.add(D),S();const f=()=>{S()};k.bind("pusher:subscription_succeeded",f),s.push((()=>{k.unbind("pusher:subscription_succeeded",f)}))}s.push((()=>{E.unbind(b,y)}))}else{if(k=E??i.subscribe(D),k.bind(b,y),!p.has(D)){p.add(D);const f=()=>{S()};k.bind("pusher:subscription_succeeded",f),s.push((()=>{k.unbind("pusher:subscription_succeeded",f)}))}s.push((()=>{k.unbind(b,y)}))}})),()=>{s.forEach((m=>m()))}}),[i,t])},aa=qe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${a=>a.theme.colors.grey4};
|
|
9
|
-
`,ta=me((function(a,e){const n=X(a,e.isTaskTemplatesEnabled),{taskGroupId:o}=e,i=o!=null&&o!==""?{...n,taskGroupsWithTasksList:n.taskGroupsWithTasksList.map((t=>({...t,tasks:t.tasks.filter((s=>s.taskGroupIds.includes(o)))}))).filter((t=>t.tasks.length>0))}:n,g=Be(a),l=x.isZeniUser(),_=a.taskDetailState?.subTaskCreateStatus?.fetchState;return{taskListView:i,tagListView:g,localData:i.localData,isTaskTemplatesEnabled:e.isTaskTemplatesEnabled,isZeniUser:l,subTaskCreateStatus:_}}),(function(a,e){const{navigate:n,currentTenant:o,location:i,isTaskTemplatesEnabled:g}=e,{tenantEmailDomain:l}=o,{groupByKey:_}=e.uiState;return{onTaskManagementRowClick:t=>{const s=H(l,t),p=R(i.state?.pathnameStackToGoBack,i.pathname);n(s,{state:{pathnameStackToGoBack:p}})},onReloadTasks:()=>{a(B(!0,g))},onTabChange:t=>{a(Ne(t))},onParentTaskClick:t=>{const s=H(l,t);window.open(s,"_blank","noopener")},bulkUpdateTasks:(t,s)=>{a(J(t,null,s))},onNewTaskClick:()=>{if(e.localData.defaultTaskGroupId!=null){const t=j(l,e.localData.defaultTaskGroupId),s=R(i.state?.pathnameStackToGoBack,i.pathname);n(t,{state:{pathnameStackToGoBack:s,message:"comingFromTaskListPage"}})}},onColumnSortConfigChanged:(t,s)=>{a(W({uiState:{sortKey:t,sortOrder:s}}))},onFiltersChange:t=>{a($e({filters:t}))},onSearchTextChanged:t=>{a(Oe({searchText:t}))},onReloadCards:()=>{a(B(!0,g))},onBackClick:()=>{if(i.state?.message==="triggerBackClick"){const t=Ge(i.state?.pathnameStackToGoBack),s=t.poppedPathname??"../";n(s,{state:{pathnameStackToGoBack:t.newStack}})}else n("../")},updateLocalData:t=>{a(xe({localData:t}))},resetLocalData:()=>{a(Y({taskGroupById:e.taskGroupState.taskGroupById}))},handleCreateGroup:t=>{a(je(e.localData.newTaskGroupName,t))},assignGroupToTasks:t=>{a(J(e.localData.selectedTaskIds,t,Fe(e.uiState.groupByKey,t)))},onDeleteTaskGroup:t=>{a(Pe(t))},onAddNewTaskToTaskGroup:t=>{if(e.localData.defaultTaskGroupId!=null){const s=na(_,t);a(M({taskDetailLocalData:s}));const p=j(l,e.uiState.groupByKey==="groupName"?t:e.localData.defaultTaskGroupId),S=R(i.state?.pathnameStackToGoBack,i.pathname);n(p,{state:{pathnameStackToGoBack:S,message:"comingFromTaskListPage"}})}},onDragNDrop:(t,s)=>{a(Ue(e.localData.selectedTaskIds.length>0?e.localData.selectedTaskIds:[t],s))},onTaskGroupRename:(t,s)=>{a(Re(t,s))},onTimeSpentUpdate:(t,s)=>{a(V({task:t,updates:s}))},onShowToast:t=>{a(we(t))},onGroupByFilterChange:t=>{a(W({uiState:{groupByKey:t}}))},updateTask:(t,s)=>{a(V({task:t,updates:s}))},onCreateTagClick:(t,s)=>{a(Le(t,s))},onSubtaskCreation:(t,s)=>{a(ve({...s,parentTaskId:t}))},handleGroupTemplateClick:t=>{a(q(t,[]))},handleGroupTemplateTaskClick:(t,s)=>{a(q(t,[s]))},handleNewTaskInitialization:t=>{if(a(M({taskDetailLocalData:{...Ke,name:t}})),e.localData.defaultTaskGroupId!=null){const s=j(l,e.localData.defaultTaskGroupId),p=R(i.state?.pathnameStackToGoBack,i.pathname);n(s,{state:{pathnameStackToGoBack:p,message:"comingFromTaskListPage"}})}},onTaskGroupNameClick:t=>{n(`/${l}/tasks/group/${t}`)},onQuickResponsesClick:()=>{n(`/${l}/tasks/quick-responses`)}}}))(Ce);function sa(){const a=pe(),e=fe(),n=Te(),o=x.getSignedInUser(),i=x.isZeniUser(),g=ge(),l=F((u=>Ie(u))),{taskGroupId:_}=_e(),{useFeatureGate:t}=Se(),{isFeatureEnabled:s}=t(G.isTaskTemplatesEnabled),{isFeatureEnabled:p}=t(G.isTaskCannedResponsesEnabled),{isFeatureEnabled:S}=t(G.isTaskCategorizationEnabled),{isFeatureEnabled:m}=t(G.isTaskBulkResolutionEnabled),{isFeatureEnabled:D}=t(G.isTaskGroupAssigneesEnabled),{isFeatureEnabled:b}=t(G.isTaskRecurringParentEnabled),[E,y]=T.useState(!1),k=F((u=>X(u,s))),f=F((u=>u.taskGroupState)),K=k.fetchState,{isAiCfoAccessEnabled:ee,onAskAiCfoClick:ae}=Ve({mobileExploreReferrer:"Task Checklist"});he({isDataReady:K==="Completed"}),T.useEffect((()=>{e(B(!1,s))}),[l?.tenantId,e,s]);const te=T.useMemo((()=>{const u=[c.TASK_CREATED,c.TASK_UPDATED,c.TASKS_BULK_UPDATED,c.TASKS_BULK_DELETED],A=[c.TASK_CREATED,c.TASK_UPDATED,c.TASK_SNOOZE_RESURFACED,c.TASKS_BULK_UPDATED];return[...Je(l?.companyId,u),...He(o?.userId,A)]}),[l?.companyId,o?.userId]);if(ea({events:te,onEvent:(u,A)=>{switch(u){case c.TASK_CREATED:case c.TASK_UPDATED:{const r=Xe(A);if(r!=null){const w=g.getState(),O=r.task_id,h=O!=null?w.taskState.taskByID?.[O]:void 0,P=h!=null;if(!i)if(r.is_private===!0){if(!P)return}else{const v=o?.userId,L=new Set([...r.assignees??[],...r.direct_assignees??[]]);if(r.created_by!=null&&r.created_by!==""&&L.add(r.created_by),!(v!=null&&L.has(v))&&!P)return}if(u===c.TASK_UPDATED&&P&&h!=null&&Array.isArray(r.task_group_ids)){const v=new Set(Object.values(w.taskGroupState.taskGroupById??{}).filter((d=>d!=null&&!d.isDeleted)).map((d=>d.id))),L=(h.taskGroupIds??[]).filter((d=>v.has(d))),$=(r.task_group_ids??[]).filter((d=>v.has(d))),se=L.length===$.length&&L.every((d=>$.includes(d))),N=h.taskGroupIds??[],Q=r.task_group_ids??[],ne=N.length!==Q.length||!N.every((d=>Q.includes(d))),oe=(d,de)=>{const z=d??[],Z=de??[];if(z.length!==Z.length)return!1;const ce=new Set(Z);return z.every((ke=>ce.has(ke)))},re=r.name==null||r.name===h.name,ie=r.is_private==null||r.is_private===h.isPrivate,le=r.assignees==null||oe(r.assignees,h.assignees),ue=r.direct_assignees==null;if(se&&ne&&re&&ie&&le&&ue)return}}return void e(B(!0,s))}case c.TASKS_BULK_DELETED:{const r=Ye(A);return r==null?void 0:void r.task_ids.forEach((w=>e(Me(w))))}case c.TASKS_BULK_UPDATED:case c.TASK_SNOOZE_RESURFACED:return void e(B(!0,s))}},onSubscribed:()=>{e(B(!0,s))}}),T.useEffect((()=>{K==="Completed"&&e(Y({taskGroupById:f.taskGroupById}))}),[K,f.taskGroupById]),o==null)throw Error("Can't access task list page without signing in...");return C.jsxs(C.Fragment,{children:[K==="Completed"?C.jsx(Ee,{analytics:ye,onLoad:u=>(A=>A.trackPageLoaded(Ae.Event.taskListPage))(u)}):null,C.jsxs(aa,{children:[C.jsx(We,{isAppContentDrawerOpen:E,handleDrawerToggle:u=>{y(u)}}),C.jsx(ta,{location:n,navigate:a,currentTenant:l,taskGroupId:_,taskGroupState:f,localData:k.localData,uiState:k.uiState,isTaskTemplatesEnabled:s,taskListFetchState:K,isTaskCategorizationEnabled:S,isTaskCannedResponsesEnabled:p,isTaskBulkResolutionEnabled:m,isTaskGroupAssigneesEnabled:D,isTaskRecurringParentEnabled:b,isAiCfoAccessEnabled:ee,onAskAiCfoClick:ae})]})]})}const H=(a,e)=>`/${a}/tasks/${encodeURIComponent(e)}`,j=(a,e)=>`/${a}/tasks/new/${e}`,na=(a,e)=>{if(a==="assignee"){const n=e.split(",");return{...I.taskDetailLocalData,assignee:n}}if(a==="priority"){const n=Qe(e);return{...I.taskDetailLocalData,priority:n}}if(a==="status"){const n=ze(e);return{...I.taskDetailLocalData,status:n}}if(a==="tag"){const n=e.split(",");return{...I.taskDetailLocalData,tagIds:n}}if(a==="dueDate"){const n=Ze(e);return{...I.taskDetailLocalData,dueDate:n}}return{...I.taskDetailLocalData}},fa=Object.freeze(Object.defineProperty({__proto__:null,default:sa},Symbol.toStringTag,{value:"Module"}));export{c as T,He as a,Je as b,Ye as c,Xe as d,sa as e,fa as f,pa as t,ea as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./liveblocks-BhGApeF9.js";import i from"./NotFoundScreen-C_nzijM_.js";import{T as r}from"./TransactionDetailScreen-IKPgPc-W.js";import"./sentry-B98sAG37.js";import{n as a,o}from"./core-C5rVvNoh.js";import"./zeni-epic-state-BVExw1ei.js";import"./recharts-uwVP8vj-.js";import"./index-BTTzX8oM.js";import"./mui-AVx3Hg0F.js";import"./analytics-B5-t19F2.js";import"./plaid-BuoWWOAj.js";import"./dnd-DqvXOfHm.js";import"./stripe-cKAAJElX.js";import"./lottie-CSUQXsXJ.js";import"./lexical-BO1ifV0W.js";import"./pdf-B6tAgCXh.js";import"./utils-B1bcOxs7.js";import"./useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js";import"./decodeURIComponentSafe-ChlmY296.js";import"./useInitialThreadRequest-DuL5mYzq.js";import"./routePaths-Cx9L8hBM.js";import"./expenseAutomationHelper-DT3oLJj6.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]="9520d72a-46e5-44e2-9697-a97671635162",e._sentryDebugIdIdentifier="sentry-dbid-9520d72a-46e5-44e2-9697-a97671635162")}catch{}})();function z(){return t.jsxs(a,{children:[t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId",element:t.jsx(r,{})}),t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId/page-not-found",element:t.jsx(i,{})}),t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId/vendor/create",element:t.jsx(r,{})}),t.jsx(o,{path:"/*",element:t.jsx(r,{})})]})}export{z as default};
|