@zeniai/web-app-ui 5.3.28-qa → 5.3.29-qa
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 +9 -0
- package/dist/assets/AddressRoutes-CdDnkC-7.js +1 -0
- package/dist/assets/{AddressScreen-pJKlDi3q.js → AddressScreen-Dyq7f1j-.js} +2 -2
- package/dist/assets/AiCfoScreen-BAtt2kQC.js +22 -0
- package/dist/assets/AppDrawer-BGKn6F8p.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-BLyF1vsz.js → BillPayApprovalRoutes-Cf5w1Fd_.js} +1 -1
- package/dist/assets/{BillPayRoutes-C-gdP6KL.js → BillPayRoutes-DDeK4O3Z.js} +9 -9
- package/dist/assets/{BusinessVerificationPageScreen-Boe3kgD5.js → BusinessVerificationPageScreen-BhpdMjkc.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-BBJBV1b_.js → CardsAiCfoScreen-BmeTr_5u.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-CYP3hEhW.js → ChargeCardRoutes-Y_ZnY6a9.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-wR6Twi6v.js → CompanyPassportScreen-BChXj6Kk.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-C8yz1QVT.js → ConnectionAuthScreen-DboT0gK7.js} +2 -2
- package/dist/assets/CustomerOnboardingAuthScreen-C9C7O3K1.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CHW2qzKd.js → CustomerOnboardingRoutes-CRNi6Rqr.js} +5 -5
- package/dist/assets/{DashboardRoutes-CiwFfaic.js → DashboardRoutes-CzNNddHy.js} +4 -4
- package/dist/assets/{DefaultTenantHome-B0-M7I8X.js → DefaultTenantHome-CmugmZX7.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-C2hFGwu0.js +18 -0
- package/dist/assets/DrawerScreen-lK0vJxIS.js +1 -0
- package/dist/assets/EntityDetailRoutes-BSm0QeV6.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-CVR_qG3c.js +25 -0
- package/dist/assets/FeaturePreviewScreen-CVnp0bZd.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-Ck10qQ6V.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-B9BL9-5c.js → InboxNotificationsProvider-MlM0K3gF.js} +1 -1
- package/dist/assets/InvoicingRoutes-Q8vi5u3U.js +2 -0
- package/dist/assets/{MagicLinkRoutes-DDMQyFLn.js → MagicLinkRoutes-B3omwZ45.js} +7 -7
- package/dist/assets/MagicLinkSignInScreen-D8Vs7E-F.js +12 -0
- package/dist/assets/{MobileAppDrawer-DCgsEnVh.js → MobileAppDrawer-DigqZbbY.js} +1 -1
- package/dist/assets/NotFoundScreen-C_nzijM_.js +1 -0
- package/dist/assets/NotificationRoutes-DKgxAwSp.js +1 -0
- package/dist/assets/OAuthConsentScreen-DY5NR4TR.js +1 -0
- package/dist/assets/{PandLWithForecastRoutes-BsegyO1D.js → PandLWithForecastRoutes-5el-0Lj7.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-eNhR9FUM.js → PaymentLinkScreen-fA05KlxQ.js} +8 -8
- package/dist/assets/PeopleRoutes-DJYa775V.js +22 -0
- package/dist/assets/PerformanceRoutes-CrDIRhB1.js +1 -0
- package/dist/assets/{Preview-slW2Ixf-.js → Preview-CzyJ4PGQ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-BYc3DqHZ.js → QBOConnectionScreen-ByKxBz2v.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-DNX741Rs.js → ReimbursementApprovalRoutes-CGtOCJ7F.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-2ORMbxwr.js → ReimbursementApprovalRuleDetailScreen-CuE7ORwk.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-BN8vNYWi.js → ReimbursementRoutes-6nUym5eB.js} +9 -9
- package/dist/assets/ReportsRoutes-s2hJ2RsR.js +1 -0
- package/dist/assets/RewardsRoutes-C-di4Yoz.js +1 -0
- package/dist/assets/ScreenRoutes-BhCi8qGV.js +2 -0
- package/dist/assets/{SettingsRoutes-Cl1VWOb0.js → SettingsRoutes-AaNqIdby.js} +6 -6
- package/dist/assets/{SetupPagesScreen-DAbhBEAF.js → SetupPagesScreen-BgHIeOKB.js} +5 -5
- package/dist/assets/SignInScreen-DCTVuESb.js +1 -0
- package/dist/assets/SignOutScreen-Dl74ZT33.js +9 -0
- package/dist/assets/TaskListScreen-D4isBRlx.js +9 -0
- package/dist/assets/{TaskRoutes-BPceEuj1.js → TaskRoutes-BWLw4wFO.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-BLhI-0B0.js +1 -0
- package/dist/assets/{TransactionDetailScreen-CsnmL0BT.js → TransactionDetailScreen-IKPgPc-W.js} +2 -2
- package/dist/assets/TransactionListRoutes-Bu8kgDQQ.js +1 -0
- package/dist/assets/TreasuryRoutes-CZBiOy69.js +37 -0
- package/dist/assets/VendorsRoutes-KMa9llQ2.js +112 -0
- package/dist/assets/WiseConfirmationScreen-tpmS2fpR.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-361LPKCn.js → ZeniAccountRoutes-DpPln-Iv.js} +7 -7
- package/dist/assets/ZeniAccountStatementScreen-C_X33S2u.js +9 -0
- package/dist/assets/{accountMappingHelper-BgNXnMXC.js → accountMappingHelper-BIF4Ld_b.js} +1 -1
- package/dist/assets/{analytics-Cuu7a7XR.js → analytics-B5-t19F2.js} +1 -1
- package/dist/assets/{analyticsHelper-CGHyb6cb.js → analyticsHelper-5kEw8e8E.js} +1 -1
- package/dist/assets/{core-D5xlmXJj.js → core-C5rVvNoh.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-N0xRs_hS.js → decodeURIComponentSafe-ChlmY296.js} +1 -1
- package/dist/assets/{dnd-DN-HQej8.js → dnd-DqvXOfHm.js} +1 -1
- package/dist/assets/{empty-C81l0a_D.js → empty-BTHEbwNZ.js} +1 -1
- package/dist/assets/{empty-O3WXjhlr.js → empty-D5lwiblX.js} +1 -1
- package/dist/assets/{emptyVideoElement-DNB4w3eI.js → emptyVideoElement-I-9RXuP2.js} +1 -1
- package/dist/assets/{epic-BSdQyFUw.js → epic-DYPr57kS.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-BchoKsfU.js → expenseAutomationHelper-DT3oLJj6.js} +1 -1
- package/dist/assets/getLocaleForTenant-DQ9OiUn_.js +1 -0
- package/dist/assets/{index-waurk8Yr.js → index-BTTzX8oM.js} +11164 -11164
- package/dist/assets/{index-L6DNygfO.js → index-Bue9AeKl.js} +1 -1
- package/dist/assets/{index-B2tEu4AE.js → index-CGyxP256.js} +1 -1
- package/dist/assets/{index-B4N0qOBD.js → index-CZcqif3N.js} +2 -2
- package/dist/assets/{index-BZhSlJBy.js → index-CibO_KMz.js} +1 -1
- package/dist/assets/{index-CojIsciJ.js → index-DCp3lIjg.js} +1 -1
- package/dist/assets/{index-CcXiIb6r.js → index-DMhoHJcD.js} +1 -1
- package/dist/assets/{index-ChKsFe22.js → index-De1cB3Ka.js} +1 -1
- package/dist/assets/{lexical-DDQ51-Oa.js → lexical-BO1ifV0W.js} +1 -1
- package/dist/assets/{liveblocks-DOBkg1D1.js → liveblocks-BhGApeF9.js} +1 -1
- package/dist/assets/{lottie-o0tP_TXQ.js → lottie-CSUQXsXJ.js} +1 -1
- package/dist/assets/{mui-DpenkF9f.js → mui-AVx3Hg0F.js} +1 -1
- package/dist/assets/{pathToGoBack-Cjq5n9wd.js → pathToGoBack-CW7sD0XS.js} +1 -1
- package/dist/assets/{pdf-DIMTd5ya.js → pdf-B6tAgCXh.js} +3 -3
- package/dist/assets/{pdf-lib-DU5YZRdD.js → pdf-lib-u-Ml-CIk.js} +1 -1
- package/dist/assets/{plaid-D5L6VoNT.js → plaid-BuoWWOAj.js} +1 -1
- package/dist/assets/{pusher-oX4CN6zb.js → pusher-D8sdZANA.js} +1 -1
- package/dist/assets/{react-C-oQLK1P.js → react-BslW5-Xl.js} +1 -1
- package/dist/assets/{react-nXpxox7I.js → react-DAMRot7g.js} +1 -1
- package/dist/assets/{react-Dq7Fy1Mm.js → react-DbafCI99.js} +1 -1
- package/dist/assets/{react-Cj8ClW-m.js → react-DzRqKqJZ.js} +1 -1
- package/dist/assets/{react-a6JNjSit.js → react-Sh9CA0od.js} +1 -1
- package/dist/assets/{react-966-QmHM.js → react-q70XtbNu.js} +1 -1
- package/dist/assets/{recharts-CcOTx_Jj.js → recharts-uwVP8vj-.js} +1 -1
- package/dist/assets/routePaths-Cx9L8hBM.js +1 -0
- package/dist/assets/{sentry-B0nIwgR6.js → sentry-B98sAG37.js} +1 -1
- package/dist/assets/{url-kBT6SwtU.js → url-RaJlDbzw.js} +1 -1
- package/dist/assets/{url-VkrE7aAr.js → url-qe19dJXu.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-C7_zR2C_.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-Ddvy6nOQ.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-XPXgI-Bx.js +1 -0
- package/dist/assets/{useDeviceId-ChTv1tr4.js → useDeviceId-6INyJgde.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-98NnzJRh.js +1 -0
- package/dist/assets/useInitialThreadRequest-DuL5mYzq.js +1 -0
- package/dist/assets/{useTaskManagerAccess-Boniioo_.js → useTaskManagerAccess-vcnpqvQT.js} +1 -1
- package/dist/assets/{utils-DQ0YEP-f.js → utils-B1bcOxs7.js} +1 -1
- package/dist/assets/withTransactionSidePanel-F28FfzEK.js +25 -0
- package/dist/assets/{zeni-epic-state-DVQQo6UD.js → zeni-epic-state-BVExw1ei.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AccountMappingScreen-B8Z5Jukp.js +0 -9
- package/dist/assets/AddressRoutes-AB7f2rQK.js +0 -1
- package/dist/assets/AiCfoScreen-bXnwas9y.js +0 -22
- package/dist/assets/AppDrawer-Bc0CsVN9.js +0 -10
- package/dist/assets/CustomerOnboardingAuthScreen-Cp-54_Na.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-CI14rSQG.js +0 -18
- package/dist/assets/DrawerScreen-D4sZ0x81.js +0 -1
- package/dist/assets/EntityDetailRoutes-iu3nvuUO.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-BcV9yLxC.js +0 -38
- package/dist/assets/FeaturePreviewScreen-BRYywZxe.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-fyIv5A_N.js +0 -1
- package/dist/assets/InvoicingRoutes-Dcjbiv_o.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-D0umlmyl.js +0 -12
- package/dist/assets/NotFoundScreen-BZ7M6wRY.js +0 -1
- package/dist/assets/NotificationRoutes-P9DoW6gN.js +0 -1
- package/dist/assets/OAuthConsentScreen-BKn6Nxeb.js +0 -1
- package/dist/assets/PeopleRoutes-D6QzTTon.js +0 -22
- package/dist/assets/PerformanceRoutes-JzQ8nQOx.js +0 -1
- package/dist/assets/ReportsRoutes-Cq8Nmx-s.js +0 -1
- package/dist/assets/RewardsRoutes-D5AiHAwp.js +0 -1
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-BWl6soT-.js +0 -25
- package/dist/assets/ScreenRoutes-DcyDHL-V.js +0 -2
- package/dist/assets/SignInScreen-7BmIPffr.js +0 -1
- package/dist/assets/SignOutScreen-CkhaclxF.js +0 -9
- package/dist/assets/TaskListScreen-DBk5pNZk.js +0 -9
- package/dist/assets/TransactionDetailRoutes-BL6LPgyb.js +0 -1
- package/dist/assets/TransactionListRoutes-DwAAMpvf.js +0 -1
- package/dist/assets/TreasuryRoutes-CW1AM8Em.js +0 -37
- package/dist/assets/VendorsRoutes-BkMbhAF5.js +0 -88
- package/dist/assets/WiseConfirmationScreen-BWYKTltN.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-DSVS1O6h.js +0 -9
- package/dist/assets/getLocaleForTenant-CyZtaI04.js +0 -1
- package/dist/assets/routePaths-D2W1iWQZ.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-BrGfKrOJ.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-buoAy4Wo.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-29AHMbXs.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-a5BahjbB.js +0 -1
- package/dist/assets/useInitialThreadRequest-BmsCi-c4.js +0 -1
- package/dist/assets/withTransactionSidePanel-Bd8MYkO_.js +0 -25
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-DOBkg1D1.js";import{a as r}from"./sentry-B0nIwgR6.js";import{u as D,h as L,i as w,j as E,t as W,l as T,s as Z,g as J,N as B,n as ie,o as x}from"./core-D5xlmXJj.js";import{a8 as ln,j as p,aq as F,S as g,cb as dn,cc as un,cd as gn,ce as mn,cf as vn,cg as pn,ch as fn,ci as Sn,cj as hn,ck as Cn,cl as In,cm as En,cn as kn,co as yn,p as X,cp as xn,cq as bn,ae as se,cr as jn,cs as Pn,z as he,ct as Dn,cu as Ln,cv as An,cw as $n,cx as wn,cy as Fn,cz as Rn,cA as Tn,V as On,ai as ft,cB as _n,cC as Mn,cD as Nn,cE as Un,cF as Bn,cG as Vn,cH as Zn,cI as Hn,cJ as qn,t as Ke,h as St,cK as Kn,cL as Qn,cM as Gn,cN as zn,cO as Wn,cP as Jn,cQ as Xn}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import{A as K}from"./AddressScreen-pJKlDi3q.js";import N from"./NotFoundScreen-BZ7M6wRY.js";import{Z0 as Yn,Z1 as ei,uM as Qe,Z2 as Pe,Z3 as Q,vQ as Ge,vX as ti,w0 as ht,Z4 as De,Z5 as Ct,vU as It,Z6 as Le,vS as Et,yw as ni,vT as ii,Z7 as G,vd as ce,vM as oi,xn as ze,vc as Ce,Z8 as ai,Z9 as kt,w7 as si,Za as z,we as ci,Zb as ri,Zc as yt,Zd as xt,yi as li,Ze as ue,Zf as We,Zg as bt,va as di,Zh as ui,v4 as gi,Zi as mi,xA as vi,Zj as jt,xJ as Je,Zk as pi,xG as fi,Zl as Ae,gd as Si,Zm as te,Zn as ne,wt as hi,vi as Xe,Zo as $e,vn as Pt,vl as Ci,vf as Ii,wm as Ei,vp as ki,wv as yi,Zp as Ie,wC as Dt,wA as Ee,Fm as we,xP as Ye,Zq as xi,vb as Fe,Zr as Re,vy as ke,vv as ye,vI as Lt,vH as Te,vs as bi,vB as At,vK as oe,fB as Oe,UP as $t,ve as _e,vF as ji,vG as Pi,vE as Di,Zs as Li,wa as et,wf as Ai,wb as wt,Zt as Ft,u_ as tt,Zu as $i,uW as Rt,Zv as wi,xV as Fi,xZ as H,xU as Ri,x1 as Me,Zw as Ti,Zx as Tt,y6 as nt,Zy as Oi,y3 as _i,Zz as Ot,x4 as Mi,x5 as V,x8 as Ni,ZA as _t,xi as ve,ZB as Ui,wu as Mt,Tm as Nt,ZC as Bi,xs as Vi,ZD as Ut,ZE as Zi,ZF as Hi,ZG as qi,yX as Ki,ZH as Qi,ZI as Bt,yd as Vt,ZJ as Zt,yV as pe,ZK as Gi,yS as zi,ZL as Wi,ZM as Ji,ZN as Xi,ZO as Yi,ZP as eo,ZQ as it,ZR as to,y$ as no,ZS as Ne,wM as ot,ZT as Ue,ZU as re,wW as Ht,wR as qt,wP as xe,ZV as io,wH as oo,yj as Kt,yK as at,yF as ao,ZW as so,yk as co,ZX as ro,yL as lo,yP as uo,ZY as go,ZZ as Qt,c7 as mo,mo as vo,mp as po,Z_ as st,vR as le,gh as fo,uc as So,mv as ho,yC as Gt,zb as Co,yz as zt,ui as Io,z8 as ct,u6 as Eo,z5 as rt,hP as ko,TP as lt,TQ as yo,Fy as Wt,hH as xo,Z$ as bo,UE as jo,_0 as Po,zh as fe,zi as Do,_1 as Lo,_2 as Jt,ze as Ao,_3 as $o,_4 as wo,xw as Fo,_5 as Ro}from"./zeni-epic-state-DVQQo6UD.js";import{M as To}from"./MobileAppDrawer-DCgsEnVh.js";import{q as de}from"./QBOConnectionScreen-BYc3DqHZ.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";import"./InboxNotificationsProvider-B9BL9-5c.js";import"./useTaskManagerAccess-Boniioo_.js";import"./empty-C81l0a_D.js";import"./pdf-lib-DU5YZRdD.js";import"./index-CcXiIb6r.js";import"./url-kBT6SwtU.js";import"./index-B2tEu4AE.js";import"./decodeURIComponentSafe-N0xRs_hS.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="5094a9ea-0b79-49b3-a180-3e7d1c491e8b",n._sentryDebugIdIdentifier="sentry-dbid-5094a9ea-0b79-49b3-a180-3e7d1c491e8b")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Yn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,C=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(Qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const P=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:P,isLoadingMore:h,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{S&&I!=null&&n(Qe({cursor:I,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Xt=[],Mo=Ct((n=>n.length>0?n:Xt),mn),No=Ct((n=>n.length>0?n:Xt),gn),Uo=T((function(n,e){const{view:t}=e;return{groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?o=>{i!==""&&n(It({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&n(De({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&n(ti({action:a,id:o,parentItemId:i}))}}}))(un);function Bo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>Pe(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(Q()),()=>{n(Q())})),[n]),r.useEffect((()=>{a&&n(Ge({id:t,kind:c}))}),[a,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(Q()),n(Ge({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed",[I,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=I!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Be(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=n,a=D(),{areTenantIdsInSync:c}=F(),d=E(Le),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(Et()),t&&a(ni()))}),[c,a,e,t,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Ve(n,e=!1){const t=D(),i=E((c=>G(c).productNextCursor!=null)),o=E((c=>G(c).productNextCursor)),a=E((c=>G(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&a!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&a!=="In-Progress"&&i&&o!=null&&t(ce({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=T((function(n,e){const t=Pe(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:o}=e,a=o!=null?`${t}/catalog/${encodeURIComponent(o)}`:`${t}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(Q()),e.navigate(`${t}/catalog`)},onChange:c=>{n(De({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:o}))}}}))(vn);function qo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=t!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>Pe(S,t)));return Ve(a,!0),Be({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&t!=null&&n(oi({id:t,kind:v}))}),[a,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(De({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(Q())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=T((function(n,e){const t=G(n),i=e.activeTab==="plans",o=e.activeTab==="all",a=i?t.plans:o?[...t.plans,...t.products]:t.products,c=i||o&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:o&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",a=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(It({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&n(Ce({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));a!=null&&n(i?Ce({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function Go(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>G(O))),k=y.planFilters.search,b=y.planSort,C=y.planNextCursor,P=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(ze({cacheOverride:!1,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[i,n,I,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(ze({cacheOverride:!0,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,I,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Qo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:o,sortState:u,planFilters:I,productFilters:j,sort:S,planNextCursor:C,productNextCursor:P,runningCatalogItemActionId:_,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const zo=T((function(n,e){const t=kt(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(z()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),n(ci({id:i}))}}}))(fn);function Wo(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{o&&t!=null&&n(si({id:t}))}),[o,t,n]),r.useEffect((()=>{if(a==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(z())}}),[a,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCouponFormPage}),s.jsx(zo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Jo=T((function(n){const e=yt(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:o=>{e(bt(o))},onSubmit:()=>{const o=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(hn);function Xo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),[i]=W(),{areTenantIdsInSync:o}=F(),a=i.get("customerId"),c=E((C=>yt(C))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((C=>li(C))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||I,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||a==null||a===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:a})))}),[a,l,n]),r.useEffect((()=>{o&&n(di({cacheOverride:!1}))}),[o,n]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const P=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(P)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Jo,{navigate:e,tenantEmailDomain:t})]})}const Yo=T((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(Cn);function ea(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>mi(d,t??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&t!=null&&n(vi({id:t}))}),[o,t,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Yo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:a})]})}const ta=T((function(n){const e=jt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function na(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const C=jt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Je({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Je({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Yt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:o=>{n(Ie({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const o=Yt(e.tenantEmailDomain??"",Ee,i),a=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ie({id:i,localData:o})),n(Dt({id:i}))},onFetchPaymentLinkEmailPreview:o=>n(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>n(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)}}}))(yn);function oa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((M=>Ae(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,I]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&I(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:P}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{a&&i!=null&&n(hi({id:i}))}),[a,i,n]),r.useEffect((()=>{a&&i!=null&&P&&n(Xe({customerId:i}))}),[a,i,n,P]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n($e()),i!=null&&n(Pt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{n(te()),i!=null&&P&&n(Xe({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:P,onChooseCard:()=>{i!=null&&n(Ii({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ci({customerId:i,data:M}))}}),s.jsx(kn,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=Ae(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),n($e()),n(we(Ee)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ie({id:i,localData:c}))},onOpenAddress:()=>{const c=Yt(e.tenantEmailDomain??"",Ee,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),n(Dt({id:i}))}}}))(xn);function sa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&n(Pt({id:i}))}),[a,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),n($e())}}),[c,d,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:o})]})}const ca=T((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(Fe({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,customerListFetchState:y}=E((b=>{const C=ue(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Ye({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const be=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:t,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:be(o,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=be(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&n(ye({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&n(Te(a))},onRollback:S?()=>{a!=null&&n(Lt(a))}:void 0}}))(jn);function da(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),[a,c]=r.useState({}),d=E(Re),l=be(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{o&&t!=null&&n(ke(t))}),[o,n,t]),r.useEffect((()=>{if(!o||t==null)return;const f=setTimeout((()=>{n(ye({...a,sessionId:t}))}),300);return()=>clearTimeout(f)}),[o,n,a,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||t==null||!u)return;const f=setInterval((()=>{n(ke(t)),n(ye({...a,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[o,n,a,u,t]);const m=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const I=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${I===""?"":`?${I}`}`}),[a,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const en=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=en(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},ua=T((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:a}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,o=a=>{const c=a??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),n(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),n(Lt(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),t(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Pn);function ga(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(Re);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:o})]})}const ma=T((function(n,e){const{activeId:t,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=se?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),n(Di())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{t!=null&&n(Te(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Pi(t))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:a}))},onViewDetails:t==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Dn);function va(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(xt),a=E(Oe).companyId??he.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,a))),d=E(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(_e()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(I=>{if(I==null||I==="")return null;try{return sessionStorage.getItem(en(I))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ke(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:o=>{n(wt({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:o,id:i}))}}}))(Ln);function fa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((I=>Li(I,t))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const m=v===t;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(et({id:t}))}),[o,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(n(z()),n(et({cacheOverride:!0,id:t})),f((I=>I+1)))}),[a.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,o)=>{n(wt({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function ha(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((C=>{const P=Ft(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,couponListFetchState:P.fetchState,runningDiscountActionId:P.runningActionId??null}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:a,onStatusChange:C=>n($i(C)),onSortChange:v})]})}const Ca=T((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>n(H({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ia(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((h=>wi(h,t??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[I,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=a.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,a.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:h,id:t})))}),[t,n,l]),C=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&t!=null&&n(Ri({id:t}))}),[o,t,n]),r.useEffect((()=>{o&&d!=null&&n(Me({invoiceId:d}))}),[o,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{I&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,I]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,a.actionState.fetchState]);const P=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:a,dunningAttempts:P,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:I,preview:C,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||n(H({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const C=Tt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
|
|
2
|
-
`).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))}}}))(Rn);function xa(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((m=>Ot(m,t??""))),c=a.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{o&&t!=null&&n(Mi({invoiceId:t}))}),[o,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:a})]})}const ba=T((function(n){const e=_t(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function ja(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((C=>{const P=_t(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:P.nextCursor,invoiceListFetchState:P.fetchState,voidingInvoiceId:P.runningActionId}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(ve({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:a,onStatusChange:C=>{n(Ui(C)),n(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=On(),o=ft(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Pa=T((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:a,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:o=>{n(Qi({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Ki())}}}))(Mn);function Da(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Zi()),m.current=null}),[n,t]),r.useEffect((()=>{o&&t!=null&&n(Me({invoiceId:t}))}),[o,n,t]),r.useEffect((()=>{c!=null&&t!=null&&a==="Completed"&&m.current!==t&&(m.current=t,n(Hi({localData:qi(c)})))}),[n,a,c,t]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Pa,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(o))}),[i,n,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(La,{navigate:e,selectedPeriod:o,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Zt(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function wa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Zt(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),Z),b=y==="Completed",C=`/${t}/invoicing`,P=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(R)}`))}),[e,C,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(O)}`))}),[e,C,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:_=>{n(Gi(_)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:P})]})}const Fa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=t!=null&&t!=="",c=E(ue),d=E((h=>Wi(h))),l=E(Ji),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Xi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{o&&n(a&&t!=null?Me({invoiceId:t}):Fe({filters:{},keepExistingListItems:!1}))}),[o,n,t,a]),r.useEffect((()=>{a&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Yi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,a]),r.useEffect((()=>{if(a)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,a]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const h=I.current;if(I.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!a||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),C=a?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,P=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:P}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(C)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(a?t??void 0:void 0))}})]})}const tn=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:t.coupons.map(Oa),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",xe,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Ht({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Ma(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((k=>Ne(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=S===i;Ve(a),r.useEffect((()=>{a&&i!=null&&n(ot({id:i}))}),[a,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Ue()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},j)]})}const Na=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},je=(n,e,t)=>{const i=[n,Ua(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),Se=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:je(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Za=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=T((function(n,e){const t=Ne(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Za),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(Se).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Ue()),n(we(xe)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{n(re({id:i,localData:a}))},onOpenAddress:()=>{const a=tn(e.tenantEmailDomain??"",xe,i),c=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),n(Ht({id:i}))}}}))(Zn);function qa(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),[a]=W(),{areTenantIdsInSync:c}=F(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ne(S,i).localData));Ve(c),r.useEffect((()=>{c&&(n(Fe({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),n(Ue())}}),[l,v,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ka=T((function(n){const e=Kt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(o,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),n(qt({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Hn);function Qa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((P=>{const h=Kt(P);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),Z),b=y==="Completed";r.useEffect((()=>{const P=setTimeout((()=>d(o)),300);return()=>clearTimeout(P)}),[o]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]);const C=r.useRef(k);return r.useEffect((()=>{const P=C.current!=null&&k==null;C.current=k,P&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:a,onStatusChange:P=>n(so(P)),onSortChange:v})]})}const Ga=T((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&n(lo({id:i}))}),[o,i,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:a})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function Y(n){const e=D(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I}=E(Qt),j=E(Le);Be({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(Oe),k=n==="dunning"||n==="quickbooks",b=y.companyId??he.getSignedInUserTenant(i??"")?.companyId,C=E((A=>$t(A,b))),P=mo(y.userRole??[]),h=y.tenantId??"",_=he.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),Ze=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(o!=="Not-Started"&&o!=="Error"||e(_e()))}),[t,e,o]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ke.shouldFetchActiveTenant(h)&&(Ke.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=o==="Not-Started"||o==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=o==="Completed"&&(!k||u==="Completed"),He=C.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,ge=se?.invoicingMicroServiceBaseUrl,qe=ge!=null&&ge.length>0?`${ge}/1.0/webhooks/stripe`:"",me={deleteConnectionError:C.externalConnections?.deleteConnectionError?.message,deleteConnectionState:C.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:C,isAdmin:P,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{C.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(A,q)=>{He!=null&&h!==""&&e(ko(h,He,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:C.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:C.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:me,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Io(A,q)),onReconnectQBO:me.onReconnectQBO,onRefreshQBO:me.onRefreshQBO,onRetryQboSyncTask:A=>e(zt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Co({settings:A,snackbarSection:Wa[n??""]}))},onStartQboBackfill:A=>e(Gt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=J(),i=D(),{tenantEmailDomain:o}=w(),a=Y("branding"),c=E((v=>bo(v))),d=E((v=>jo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Po()),i(we(fe)))}),[c.saveState.fetchState,i]);const l=St(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Kn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Lo({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${fe}/`,u=X(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Do()),updateFilesEntity:a.updateFilesEntity})]})}function Ja(){const n=L(),e=Y("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Xa(){const n=L(),e=Y("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Ya(){const n=L(),e=Y("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const es=T((function(n){const e=Jt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(zt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(Gt(e))}}}))(Wn);function ts(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=E(Oe),{configFetchState:o,settingsFetchState:a}=E(Jt);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||n(_e())}),[n,a]),r.useEffect((()=>{o==="Not-Started"&&n(le())}),[o,n]),Be({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=D(),t=L(),[i,o]=W(),a=Y(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];o({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Jn,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:n("invoicing_settings"),settings:a.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Ya,{})}),s.jsx(x,{path:"branding",element:s.jsx(vt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(vt,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Xa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ja,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:o,fetchState:a,status:c}=E(Nt),d=St(o.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Le(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,a]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),n(Ro()))}),[d,o.fetchState,l,n,e]),c==null&&a!=="Error"?s.jsx(Xn,{}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Xo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Da,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(za,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-DOBkg1D1.js";import{a as u}from"./sentry-B0nIwgR6.js";import{u as O,g as _,h as w,t as A,j as l,N as L}from"./core-D5xlmXJj.js";import{z as r,E as M,G as P,R as V,j as N,S as R,Z as G,$,U as B}from"./index-waurk8Yr.js";import{fB as W,Tb as Z,TE as q,Tv as H,ge as J,gg as K,TA as Q,gR as X,df as Y,TF as ee,TG as te}from"./zeni-epic-state-DVQQo6UD.js";import{n as ne}from"./mui-DpenkF9f.js";import{u as se}from"./useDeviceId-ChTv1tr4.js";import{f as ae}from"./analyticsHelper-CGHyb6cb.js";import{t as ie}from"./getLocaleForTenant-CyZtaI04.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="40dc451d-4960-4181-b3c0-30ba4f38adec",t._sentryDebugIdIdentifier="sentry-dbid-40dc451d-4960-4181-b3c0-30ba4f38adec")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=O(),a=_(),m=w(),[k]=A(),n=k.get("token"),p=k.get("stytch_token_type"),f=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:E,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),b=l((e=>Z(e))),D=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&f!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,f)))}),[n,p,t,i,f,s?.zeniSessionId]),u.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(b.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),X().then((()=>{const e=B();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(R.Event.loginSuccess,"email",Y(o.productSettings))}),2e3))}),[I,S,y,s,o,b,v,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]),U=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return g.jsx(G,{phoneNumber:E,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:F,onVerifyOtp:U,onCancelVerifyDevice:j});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||f==null||h==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx($,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Ce as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-DOBkg1D1.js";import{h as r,l as i}from"./core-D5xlmXJj.js";import{am as n}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import"./sentry-B0nIwgR6.js";import"./zeni-epic-state-DVQQo6UD.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="f2f6ef04-8019-4dfe-8bec-98d5efe59039",o._sentryDebugIdIdentifier="sentry-dbid-f2f6ef04-8019-4dfe-8bec-98d5efe59039")}catch{}})();const f=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(f,{navigate:o})}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as mt,a as lt,n as ft,j as N}from"./liveblocks-DOBkg1D1.js";import ut from"./NotFoundScreen-BZ7M6wRY.js";import{a as k}from"./sentry-B0nIwgR6.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 J}from"./core-D5xlmXJj.js";import{cz as Tt,Tf as Y,fB as H,g_ as It,Tj as b,a0d as Q,Tp as m,Td as E,zJ as $,Fp as Ct,a0e as yt,Tc as Et,Tr as At,zO as _t,a0f as j,br as F,gd as x,zS as X,a0g as Nt,cL as Bt,cE as wt}from"./zeni-epic-state-DVQQo6UD.js";import{aq as xt,c as vt,O as Rt,y as Dt,as as Pt,dK as Gt,p as B,dL as Ut,w as Mt,dM as jt,i as Ft,a4 as $t}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import{u as Lt}from"./useAskAiCfoHostNavButtonProps-buoAy4Wo.js";import{u as Vt}from"./useTaskManagerAccess-Boniioo_.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="6a12bdb8-a8f2-49fc-968a-90930a657ea6",t._sentryDebugIdIdentifier="sentry-dbid-6a12bdb8-a8f2-49fc-968a-90930a657ea6")}catch{}})();const zt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=St((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=b(t),f=H(t),{currentTab:T}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&At(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[T].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:T,fetchMoreCommentsNotifications:R}=l;return{onNotificationClick:(e,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,I=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[e],!1))},onCommentNotificationClick:(e,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(T(e),t(j([e],F())));let i=`/${h}/${r[1]}`;const I=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:I,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(e,s)=>{t(E(e,s))},onUpdateNotificationTabState:(e,s)=>{t(m(e,s))},onUpdateNotificationViewCurrentTabAndSubTab:(e,s)=>{t(Q(e,s));const d=`../${e}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:e=>{t(Nt(e))},onFetchMoreNotifications:(e,s)=>{if(e==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t($("task_manager","dashboard",d))}else R?.()},onUpdateNotificationStatus:(e,s,d,r)=>{e==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(T(i),t(j([i],F())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:e=>{e==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),zt(o,T).then((()=>{t(j(o,F())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const e=$t(n.state?.pathnameStackToGoBack),s=e.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:e.newStack}})},onSettingsClick:()=>{const e=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:e}})}}}))(Mt(jt)),Wt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=Tt(h??""),o=gt(),f=vt(),[T,R]=k.useState(!1),e=S((a=>Y(a))),s=S((a=>H(a))),{useFeatureGate:d}=Rt(),{isFeatureEnabled:r}=d(Dt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:I}=Lt({mobileExploreReferrer:"Notifications"});Pt({isDataReady:!0});const Z=It(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const L=S((a=>b(a).notificationDetailsByTab.tasks.fetchState)),V=S((a=>b(a).currentTab)),D=S((a=>b(a).currentSubTab)),tt=S((a=>b(a).notificationDetailsByTab.comments.fetchCountState)),P=S((a=>b(a).notificationDetailsByTab.comments.fetchState)),at=S((a=>b(a).notificationDetailsByTab.comments.uiState.unreadCount)),et=S((a=>b(a).allExternalNotifications)).filter((a=>a.inboxNotification.readAt==null)).map((a=>a.inboxNotification.id)),st=Gt().allUsers,{inboxNotifications:w,isLoading:A,hasFetchedAll:C,isFetchingMore:G,fetchMore:ot}=mt(),{threads:z,isLoading:q,fetchMore:W,isFetchingMore:K,hasFetchedAll:O}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(V!==c&&c!=null&&o(Q(c)),c==null){const a=`../${V}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(a,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(A===!1&&C===!0&&s?.companyId!=null&&w!=null){const a=`dashboard_${s.companyId}`,p=w.filter((y=>y.roomId===a&&y.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(E({unreadCount:p},"comments"))}}),[A,C]),k.useEffect((()=>{L!=="In-Progress"&&g&&o($("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const a=setTimeout((()=>ot?.()),0);return()=>clearTimeout(a)}));const U=A||G===!0||C!==!0||A||G===!0||C!==!0;k.useEffect((()=>{U&&P!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):U||P!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[U,P]),k.useEffect((()=>{o(E({hasMore:C!==!0},"comments"))}),[C]),k.useEffect((()=>{e.fetchState!=="In-Progress"&&e.fetchState!=="Completed"&&T===!1&&(R(!0),o(Ct()))}),[e.fetchState]),k.useEffect((()=>{if(A===!1&&q===!1&&w!=null&&z!=null){const a=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===a)).filter((u=>Ut(u.kind))),y=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=z.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}:(K||O===!0||W==null||W(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(E({totalCount:_.length,unreadCount:y.length},"comments")),o(yt(ct))}}),[A,G,K,C,O,q,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(a,p)=>{if(Ft(p)){const y=Et(p.mode);if(y==="dashboard"&&o(E({unreadCount:p.data.unread},"tasks")),L!=="In-Progress"){const _=[];D==="all"?_.push("read","unread"):D!=="mentions"&&_.push(D),o($("task_manager",y,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Vt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:at,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:et,isAiCfoAccessEnabled:i,onAskAiCfoClick:I,...nt})};function ma(){return N.jsxs(bt,{children:[N.jsx(J,{path:"/:selectedTab",element:N.jsx(Wt,{})}),N.jsx(J,{path:"*",element:N.jsx(ut,{})})]})}export{ma as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as m}from"./liveblocks-DOBkg1D1.js";import{a as r}from"./sentry-B0nIwgR6.js";import{u as A,g as j,j as o,N as x}from"./core-D5xlmXJj.js";import{TS as C,fB as P,gi as z,TT as D,TU as M,TV as R,TW as L,pO as k,Sx as N}from"./zeni-epic-state-DVQQo6UD.js";import{z as h,ah as I}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new n.Error().stack;s&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[s]="8281e3b7-afe6-42bf-98a6-bc0d0c0cc8f3",n._sentryDebugIdIdentifier="sentry-dbid-8281e3b7-afe6-42bf-98a6-bc0d0c0cc8f3")}catch{}})();function ee(){const n=A(),s=j(),{params:t,error:i}=r.useMemo((()=>C(s.search)),[s.search]),w=r.useMemo((()=>new URLSearchParams(s.search).get("client_name")??t?.clientId??"Unknown Application"),[s.search,t]),f=h.isSignedIn(),a=h.getSignedInUser(),p=o((e=>P(e))),l=o((e=>z(e))),c=o((e=>e.tenantState.fetchState)),b=o(D),y=o(M),d=o(R),[S,v]=r.useState(null),[T,E]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(L())}),[n,s.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{f&&a!=null&&!g.current&&(c!=="Not-Started"&&c!=="Error"||(g.current=!0,n(k(a.userId,a.zeniSessionId??void 0))))}),[f,a,c,n]),r.useEffect((()=>{d!=null&&d!==""&&(window.location.href=d)}),[d]);const U=r.useMemo((()=>{if(p?.tenantId!=null)return p.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((_=>_.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[p?.tenantId,l]),u=S??U;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):f?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:a?.userEmail,isInitializing:c!=="Completed",tenants:l,selectedTenantId:u,onSelectTenant:v,approveError:T??y,isApproving:b==="In-Progress",showAllowButton:u!=null,onApprove:()=>{t!=null&&a!=null&&u!=null&&n(N(a.userId,a.zeniSessionId??void 0,u,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{E("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(x,{to:"/signin/auth",state:{origin:s.pathname+s.search},replace:!0})}export{ee as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-DOBkg1D1.js";import{UF as re,fB as N,lX as _,dV as Y,dU as le,Rx as X,U2 as ce,Cd as Pe,UG as J,C2 as je,Cn as Le,Ch as de,C6 as pe,Cl as ve,Ci as Te,UH as ue,rI as Ae,g2 as Re,gA as Ve,UI as H,Ca as me,C9 as ge,Cq as Fe,c7 as Oe}from"./zeni-epic-state-DVQQo6UD.js";import{a1 as Ce,O as Q,y as G,z as K,f as fe,N as he,af as ye,az as be,aA as Ue,ab as Se,J as F,ag as we,G as q,aB as Be,aq as Ze,as as $e,a8 as ze,j as xe,S as He,p as Ge,aC as _e,V as Ke}from"./index-waurk8Yr.js";import{D as De,n as M,S as Ie}from"./mui-DpenkF9f.js";import ae from"./NotFoundScreen-BZ7M6wRY.js";import{a as c}from"./sentry-B0nIwgR6.js";import{u as ee,i as qe,j as g,h as Me,g as We,l as Je,n as se,o as z}from"./core-D5xlmXJj.js";import{u as Ne}from"./useAskAiCfoHostNavButtonProps-buoAy4Wo.js";import{M as Ye}from"./MobileAppDrawer-DCgsEnVh.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";import"./InboxNotificationsProvider-B9BL9-5c.js";import"./useTaskManagerAccess-Boniioo_.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]="1787b23a-adb5-43dc-91c5-ce8662140627",e._sentryDebugIdIdentifier="sentry-dbid-1787b23a-adb5-43dc-91c5-ce8662140627")}catch{}})();const Xe={overlayWidth:new Se(100,100,48)},te=q.getLocalizedStrings().peoplePage.invitePage,ne=q.getLocalizedStrings().common,Qe=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:C,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[O,U]=c.useState(!1),[k,S]=c.useState(!1),{userId:w}=qe(),r=g((l=>re(l))),p=g((l=>N(l))),E=g((l=>_(l))),{useFeatureGate:D}=Q(),{isFeatureEnabled:I}=D(G.isDebitCardFeatureEnabled),P=Y(I,p),v=le(p),T=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(J()),b()},A=()=>{O===!0?S(!0):h()},$=d.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=D(G.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:T,isAccountingClassesEnabled:E,isReimbursementDisabled:Z===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isLiteRoleDisabled:B===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:v,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(T))},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: ${F.sp7};
|
|
7
|
-
padding-left: ${F.sp8};
|
|
8
|
-
padding-right: ${F.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: ${F.sp8};
|
|
14
|
-
padding-right: ${F.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${F.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=q.getLocalizedStrings().peoplePage.invitePage,ie=q.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:d,classListView:n,mode:C,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[O,U]=c.useState(!1),[k,S]=c.useState(!1),w=g((o=>re(o))),r=g((o=>N(o))),p=g((o=>_(o))),{useFeatureGate:E}=Q(),{isFeatureEnabled:D}=E(G.isDebitCardFeatureEnabled),I=Y(D,r),P=le(r),v=X(r),T=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(J())},h=()=>{O===!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(G.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:v,onPeopleLocalDataUpdated:o=>{m(de({peopleLocalData:o})),U(!0)},onResetClick:x,onSaveClick:()=>{m(C==="zeni_only"?ve(e):Te())},onCloseClick:h,peopleDetails:w,isAccountingClassesEnabled:p,isReimbursementDisabled:B===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:y,isTreasuryDisabled:V===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:Z};return c.useEffect((()=>{w.invitePersonState.fetchState==="Completed"&&(b(),m(J()))}),[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=Je((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:_(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(Fe(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}))}}}}))(_e);function W({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const d=Me(),n=ee(),C=We(),{areTenantIdsInSync:i}=Ze(),b=K.getSignedInUser(),f=g((s=>N(s))),{useFeatureGate:m}=Q(),{isFeatureEnabled:O}=m(G.isDebitCardFeatureEnabled),U=g((s=>_(s))),k=!Y(O,f)&&U,S=X(f),w=f?.tenantId,{tenantEmailDomain:r}=f,[p,E]=c.useState(!1),[D,I]=c.useState(!1),[P,v]=c.useState(!1),[T,B]=c.useState("off"),[Z,x]=c.useState(!1),h=s=>{x(s)},{isAiCfoAccessEnabled:A,onAskAiCfoClick:$}=Ne({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&&T===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),v(t!=null&&t===!0&&t)}),[e,t]),c.useEffect((()=>{n(H({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const V=()=>{I(!1),v(!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(Qe,{closeDrawerHandler:V,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:R,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ye,{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=Ge(C.state?.pathnameStackToGoBack,C.pathname);d(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:A,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(W,{})}),a.jsx(z,{path:"new",element:a.jsx(W,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(W,{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-DOBkg1D1.js";import E from"./NotFoundScreen-BZ7M6wRY.js";import{a as r}from"./sentry-B0nIwgR6.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 b}from"./core-D5xlmXJj.js";import{fB as N,a0h as h,bo as O,bn as F,iI as V,gd as $}from"./zeni-epic-state-DVQQo6UD.js";import{_ as q,z as I,as as G,dN as H}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import{u as J}from"./useAskAiCfoHostNavButtonProps-buoAy4Wo.js";import{M as K}from"./MobileAppDrawer-DCgsEnVh.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";import"./InboxNotificationsProvider-B9BL9-5c.js";import"./useTaskManagerAccess-Boniioo_.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]="d0de1eb6-781f-4519-a756-f770b01b9b3e",e._sentryDebugIdIdentifier="sentry-dbid-d0de1eb6-781f-4519-a756-f770b01b9b3e")}catch{}})();const L=z((function(e){const t=I.getSignedInUser(),d=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:d??""},{aggregatedReportViewState:n}=h(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(H),Q=()=>{const e=_(),t=v(),d=q(),o=p((a=>N(a))),{aggregatedReportViewState:n}=p((a=>h(a))),{tenantEmailDomain:f}=M(),u=U(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const m=r.useRef(!1),[w,S]=r.useState(!1),C=O(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=F(l),y=C||k||x,c=r.useCallback(((a,i,T)=>{u(V({fromMonth:a,toMonth:i,cacheOverride:T}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&m.current&&(u($({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),m.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||c(a,i,!0),m.current=!0}),[n?.fetchState,c]),j=r.useCallback(((a,i)=>{c(a,i,!1)}),[c]),g=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=J({mobileExploreReferrer:"Performance"});return G({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(K,{isAppContentDrawerOpen:w,handleDrawerToggle:g}),s.jsx(L,{navigate:e,location:t,themeState:d,currentTenant:o,signedInUser:l,tenantEmailDomain:f,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:g,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(P,{to:`/${f}/dashboard`,replace:!0})};function be(){return s.jsxs(B,{children:[s.jsx(b,{path:"*",element:s.jsx(Q,{})}),s.jsx(b,{path:"*",element:s.jsx(E,{})})]})}export{be as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as p}from"./liveblocks-DOBkg1D1.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-D5xlmXJj.js";import{fB as $,Dr as R,U1 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 Be,CB as ie,ur as Me,bq as ve,U2 as Ve,bn as xe,DO as ze,U3 as Ge,U4 as He,ch as S,Cu as Ye,U5 as ae,U6 as qe,U7 as Ne,U8 as $e,U9 as Ze,Ua as Qe,Ub as Xe,Uc as Je,Ud as Ke,Ue as We,Uf as ea,Ug as aa,Uh as sa,Ui as U,Uj as B,Uk as M,Ul as v,Um as V,Un as x,Uo as z,Up as G,Uq as H,Ur as Y,e8 as ta,Ds as oa,Df as se,Dg as te,Dy as na,Dk as oe,DE as ra,Us as la,Ut as ca,Uu as ia,Uv as da,Uw as pa,Ux as _a,Uy as fa,Uz as ma,UA as ua,UB as ba,dV as ha,dU as ya}from"./zeni-epic-state-DVQQo6UD.js";import{an as Ca,ao as wa,ap as ga,a as Sa,a1 as Ia,O as de,y as q,z as pe,aq as Ra,V as Ta,d as Ua,ar as ja,as as ka,a8 as Da,j as N,S as Oa,s as Fa,p as _e,at as Aa,au as Pa,av as Ea}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import La from"./NotFoundScreen-BZ7M6wRY.js";import{F as Ba}from"./FeaturePreviewScreen-BRYywZxe.js";import{a as u}from"./sentry-B0nIwgR6.js";import{u as Ma}from"./useInitialThreadRequest-BmsCi-c4.js";import{t as ne,a as re,b as va}from"./routePaths-D2W1iWQZ.js";import{M as Va}from"./MobileAppDrawer-DCgsEnVh.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.js";import"./InboxNotificationsProvider-B9BL9-5c.js";import"./useTaskManagerAccess-Boniioo_.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]="42c0c0bb-06ec-4fa9-874c-67739886d19a",e._sentryDebugIdIdentifier="sentry-dbid-42c0c0bb-06ec-4fa9-874c-67739886d19a")}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(B({resetLeftScroll:!0})),e(v({resetLeftScroll:!0})),e(M({resetLeftScroll:!0}))},za=e=>{e(ca()),e(ia()),e(da()),e(pa()),e(_a()),e(fa()),e(ma()),e(ua()),e(ba())},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(U(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(M({scrollPosition:s}));break;case"cash_flow":e(B({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(M({nodeCollapseState:{nodeId:s,isCollapsed:t}}));break;case"cash_flow":e(B({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(U(l?"cash_flow_by_classes":r?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",j(t)),e(U(l?"cash_flow_by_projects":r?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",j(t)),e(U(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]=u.useState(!1),[Z,fe]=u.useState(!1),{isFeatureEnabled:Q}=l(q.isReportsCommentingEnabled);if(i==null)throw Error("Can't access reports page without signing in...");const k=d((n=>$(n))),me=k.masterTOSInfo?.isMasterTOSAccepted??!1,ue=k.company?.companyInfo.firstMonthOfFY??1,be=Ma(Q?k?.companyId:void 0),w=d((n=>R(n).fetchState)),he=d((n=>Ee(n))),{areTenantIdsInSync:b}=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));u.useEffect((()=>{!c&&b&&(C(!0),s(F(i.userId,!0,!0,!1)))}),[c,i,s,b]),u.useEffect((()=>{c&&!Z&&w==="Completed"&&b&&(s(F(i.userId,!1,!0,!1)),fe(!0))}),[c,Z,w,b]),u.useEffect((()=>{if(c&&O.fetchState==="Not-Started"&&h.timeframe!=="free_range"&&h.timeframe!=="week"&&b)switch(D){case"profit_and_loss":case"profit_and_loss_by_classes":s(Me(h.timeframe));break;case"profit_and_loss_by_projects":g&&s(ie());break;case"balance_sheet":s(Be(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,b,T,g]);const X=Ta(),we=X?.loggedInUserRole!=null&&ve(X?.loggedInUserRole)!==!0,[ge,Se]=u.useState(!1),J=n=>{Se(n)},Ie=Ua(),Re=ja();return(function(n){const{isDataReady:Te}=n,{pathname:Ue}=W(),K=Ca(Ue??"")==="reports",je=wa(Te),ke=u.useMemo((()=>K?xa:void 0),[K]);ga({canFetchSuggestedQuestions:je,pageContexts:ke})})({isDataReady:w==="Completed"}),ka({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:ue,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:be})]})}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(Ba,{}):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-DOBkg1D1.js";import{z as j,a8 as N,j as f,S as b,e1 as E,O as k,y as I}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import g from"./NotFoundScreen-BZ7M6wRY.js";import{a as c}from"./sentry-B0nIwgR6.js";import{u as C,j as y,h as F,g as L,l as T,n as U,o as d,N as h}from"./core-D5xlmXJj.js";import{fB as _,a17 as w,a18 as p,D6 as P,pX as V,a19 as z,D4 as B}from"./zeni-epic-state-DVQQo6UD.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="3d8623ed-319a-41de-849e-d49d9293c21d",e._sentryDebugIdIdentifier="sentry-dbid-3d8623ed-319a-41de-849e-d49d9293c21d")}catch{}})();const G=T((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=j.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=y((o=>_(o))),l=F(),x=L(),u=j.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const m=y((o=>w(o))),D=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 S=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(b.Event.inviteEmailViewed))(o)}):null,a.jsx(G,{navigate:l,location:x,currentTenant:r,companyName:S,userName:D,inviteFormCompayData:m.localData})]})};function ne(){const{useFeatureGate:e}=k(),{isFeatureEnabled:t}=e(I.isReferralFeatureEnabled);return a.jsxs(U,{children:[a.jsx(d,{path:"/",element:a.jsx(h,{to:"refer",replace:!0})}),a.jsx(d,{path:"how-it-works",element:a.jsx(h,{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,25 +0,0 @@
|
|
|
1
|
-
import{j as E}from"./liveblocks-DOBkg1D1.js";import{a as I}from"./sentry-B0nIwgR6.js";import{i as M,u as q,h as W,g as z,j as h,l as Z}from"./core-D5xlmXJj.js";import{V$ as be,W0 as we,lX as X,rP as Je,r$ as Ne,sh as je,sf as Oe,si as Pe,sl as _e,W1 as Ve,fB as F,U_ as oe,W2 as de,gX as H,cA as Q,cB as ee,Ew as fe,W3 as Se,EA as Me,Sn as ie,Eu as Ge,Eo as Re,W4 as ue,Eg as $e,Ef as Fe,Ea as Ue,El as Ye,EB as Ke,W5 as U,W6 as re,Eh as We,U$ as te,gL as ge,ER as Ee,EK as De,W7 as ke,rV as Ce,EE as ye,EC as ve,W8 as Ae,EY as Ie,EV as xe,EF as Te,EX as Be}from"./zeni-epic-state-DVQQo6UD.js";import{a4 as ae,aY as ne,aZ as ze,z as qe,h as Ze,a7 as Xe,a8 as le,j as O,av as He,a_ as Qe,p as _,G as he,_ as me,a$ as et,b0 as tt,b1 as at}from"./index-waurk8Yr.js";import{n as pe}from"./mui-DpenkF9f.js";import{p as nt}from"./pathToGoBack-Cjq5n9wd.js";import K from"./NotFoundScreen-BZ7M6wRY.js";import{c as V}from"./routePaths-D2W1iWQZ.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]="1b47df82-e4af-4497-8bd3-d92357d2fbb9",e._sentryDebugIdIdentifier="sentry-dbid-1b47df82-e4af-4497-8bd3-d92357d2fbb9")}catch{}})();function bt({isRenderedInPanel:e=!1,accrualIdOverride:t,onPanelNavigateBack:d}={}){const{accrualId:l}=M(),s=t??l,n=q(),u=W(),a=z(),{accrual:c,actionFetchState:o,detailFetchState:g,localData:D}=h((i=>be(i,s??""))),C=h((i=>we(i))),x=h((i=>X(i))),r=I.useCallback((()=>{const i=ae(a.state?.pathnameStackToGoBack);u(i.poppedPathname??nt(4),{state:{pathnameStackToGoBack:i.newStack}})}),[a.state,u]),k=I.useRef(!1);return I.useEffect((()=>{o.fetchState!=="In-Progress"&&k.current&&o.fetchState==="Completed"&&(k.current=!1,r())}),[o.fetchState,r]),I.useEffect((()=>{s!=null&&c==null&&g.fetchState==="Not-Started"&&n(Je(s))}),[s,c,g.fetchState]),I.useEffect((()=>{n(Ne({scheduleType:"prepaid_expenses",shouldResetEnteredData:!1}))}),[n]),s==null?E.jsx(K,{}):c==null?g.fetchState==="Not-Started"||g.fetchState==="In-Progress"?E.jsx(ne,{}):E.jsx(K,{}):E.jsx(ze,{isRenderedInPanel:e,accrual:c,actionFetchState:o.fetchState,isAccountingClassesEnabled:x,localData:D,newAccrualAccountsView:C,onAccrualFormChange:(i,m)=>{n(Ve({accrualId:i,localData:m}))},onAccrualFormClear:i=>{n(_e({accrualId:i}))},onApproveAndPost:i=>{n(Pe(s,i))},onNavigateBack:d??r,onRevert:(i,m)=>{k.current=!0,n(Oe(s,i,m))},onSkip:(i,m)=>{n(je(s,i,m))}})}const lt=he.getLocalizedStrings(),st=Z((function(e,t){const d=de(e,t.scheduleTab),l=e.tenantState.currentTenantId;return{authParams:{userId:t.signedInUser.userId??"",sessionId:t.signedInUser.zeniSessionId??"",tenantId:l??""},linkBillExpenseView:d.linkBillExpenseView,transactions:d.linkBillExpenseView.transactions}}),(function(e,t){const{navigate:d,location:l}=t;return{onTransactionSelect(s){e(Se({selectedTransaction:s}))},onBackClick:()=>{d("..",{relative:"path"})},onCancel(){e(Se({selectedTransaction:void 0})),e(Me()),d("..",{relative:"path"})},onTransactionClick:s=>{const n=`${V(s,t.tenantEmailDomain)}`,u=_(l.state?.pathnameStackToGoBack,l.pathname);d(n,{state:{pathnameStackToGoBack:u}})},onLinkSave(){t.setShouldNavigateBack(!1),e(fe(t.scheduleTab,t.scheduleAccruedDetailsView.selectedJEAccruedSchedule?.jeScheduleId))}}}))(Qe),wt=({setShouldNavigateBack:e})=>{const t=W(),d=z(),{scheduleDetailId:l,tenantEmailDomain:s}=M(),{scheduleType:n}=M();if(s==null)throw Error("Can't access Link Bill Expense page without tenant Email Domain");const u=h((r=>F(r))),a=oe(n)??"accrued_expenses",c=qe.getSignedInUser();if(c==null)throw Error("Can't access Link Bill Expensedetail page without signing in...");if(l==null)throw Error("Invalid Schedule Detail Id");const o=h((r=>de(r,a))),g=o.selectedJELinkRowIndex,D=h((r=>H(r,u.companyId))),C=Ze(o.updateStatus.fetchState);I.useEffect((()=>{C==="In-Progress"&&o.updateStatus.fetchState==="Completed"&&t("..",{relative:"path"})}),[C,o.updateStatus.fetchState]),I.useEffect((()=>{o.fetchState==="Not-Started"&&t("..",{relative:"path"})}),[]),I.useEffect((()=>{o.selectedJEAccruedSchedule!=null&&o.selectedJELinkRowIndex!=null||t("..",{relative:"path"})}),[o.selectedJEAccruedSchedule,o.selectedJELinkRowIndex]);const x=o.linkBillExpenseView.fetchState==="Completed";return E.jsx(E.Fragment,{children:o.linkBillExpenseView.fetchState==="In-Progress"?E.jsx(Xe,{fetchState:o.linkBillExpenseView.fetchState}):o.selectedJEAccruedSchedule!=null&&g!=null?E.jsxs(E.Fragment,{children:[x===!0?E.jsx(le,{analytics:O,onLoad:()=>{ct(o,a,D)}}):null,E.jsx(st,{signedInUser:c,attachmentEndPoint:`${He}/vendor_attachments`,setShouldNavigateBack:e,scheduleVendorId:o.selectedJEAccruedSchedule.vendor.id??"",location:d,tenantEmailDomain:s,scheduleAccruedDetailsView:o,saveFetchState:o.updateStatus.fetchState,scheduleTab:a,navigate:t,analytics:O,controllerUserDetails:D,saveStatus:o.updateStatus.fetchState,jeAccruedSchedule:o.selectedJEAccruedSchedule,localData:o.scheduleAccruedDetailsLocalData.jeScheduleDetails[g]})]}):null})},Le=e=>{const t=lt.dateFormat.analytics.YYYYDashMMDashDDFormat;return{scheduleCreateDate:e.createTime.format(t)??null,scheduleMonthlyAmount:e.recurringAmount??null,startingBalance:e.otherAttributes.startingBalance??null,scheduleAccountCategory:e.jeCredit.account?.accountName??null,description:e.memo,runningBalance:e.balanceAsOfToday??null,currentBalance:e.balanceAsOfToday??null,currentStatus:e.status.label,period:e.period??null,startMonth:e.startDate?.format(t)??null,endMonth:e.endDate?.format(t)??null}},ct=(e,t,d)=>{const l=e.selectedJEAccruedSchedule,s=e.selectedJELinkRowIndex;let n;s!=null&&l!=null&&(n=l.scheduledJournalEntry[s]);const{transactions:u}=e.linkBillExpenseView,a=u.some((g=>g.isRecommendedTransaction===!0)),c=Q(d.controllers),o=ee(d.controllerUserIds);l!=null&&O.trackScheduleAccruedDetailsJournalEntryLinkedLoaded({scheduleType:t,schedule:{...Le(l)},scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},journalEntryDetails:{wasRecommendationAvailable:a,journalEntryPostingStatus:n?.status.label??""},vendorName:l.vendor.name??null,controllerEmails:c,controllerUserIds:o})},ot=pe.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 0 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`,dt=Z((function(e){const t=F(e),d=e.entityAutoCompleteState.autoCompleteText.common,l=ue(e,"common");return{tenantName:t.companyName,vendorSearchAutoCompleteData:{autoCompleteText:d,entityAutoCompleteView:l}}}),(function(e,t){const{navigate:d,location:l}=t,s="accrued_expenses";return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const n=ae(l.state?.pathnameStackToGoBack);n.poppedPathname==null?d("../schedules/accrued_expenses"):d(n.poppedPathname,{state:{pathnameStackToGoBack:n.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:n=>{t.setShouldNavigateBack(!0),e(fe(s,n))},onDelete:n=>{e(We(s,n))},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(n,u)=>{n.trim().length>=2?e(re({searchString:n,entityType:u,searchOrigin:"common"})):n.trim().length===0&&e(U("common"))},onCancelAutoComplete:()=>{e(U("common"))}},onEditAmount:(n,u)=>{e(Ke(s,n,u))},onJELinkClick:n=>{e(Ye({selectedJELinkRowIndex:n})),d("./edit_link")},onCancelAccrual:(n,u,a)=>{e(Ue(n,u,a))},onTransactionClick:n=>{const u=`${V(n,t.tenantEmailDomain)}`,a=_(l.state?.pathnameStackToGoBack,l.pathname);d(u,{state:{pathnameStackToGoBack:a}})},onViewPostedJE:n=>{const u=`${V(n,t.tenantEmailDomain)}`,a=_(l.state?.pathnameStackToGoBack,l.pathname);d(u,{state:{pathnameStackToGoBack:a}})},onViewRecordedJE:n=>{const u=`${V(n,t.tenantEmailDomain)}`,a=_(l.state?.pathnameStackToGoBack,l.pathname);d(u,{state:{pathnameStackToGoBack:a}})},onViewBillExpense:n=>{const u=`${V(n,t.tenantEmailDomain)}`,a=_(l.state?.pathnameStackToGoBack,l.pathname);d(u,{state:{pathnameStackToGoBack:a}})},onDetailPageChange:(n,u,a)=>{const{scheduleDetailsAccruedExpensesSection:c}=n,{amount:o,memo:g,months:D,scheduleAccruedExpenseCategory:C,scheduleClass:x,scheduleExpenseCategory:r,startDate:k,vendor:i}=c,m=x.selectedOption!=null?t.classList.find((T=>T.classId===x.selectedOption)):void 0,S=r.selectedOption!=null?t.accountList.find((T=>T.qboId===r.selectedOption)):void 0,L=C.selectedOption!=null?t.accruedAccountList.find((T=>T.qboId===C.selectedOption)):void 0,b=D?.selectedOption;e($e({scheduleType:s,localData:u,selectedJeScheduleDetailId:t.scheduleDetailId})),a!==!1||t.scheduleDetailId!=null||S?.accountId==null||t.isAccountingClassesEnabled!==!1&&m?.classId==null||L==null||i.selectedOption==null||g==null||o==null&&o==0||k==null||b==null||e(Fe({scheduleType:s}))}}}))(et),Jt=({shouldNavigateBack:e,setShouldNavigateBack:t,isRenderedInPanel:d=!1,scheduleDetailIdOverride:l,onPanelNavigateBack:s}={})=>{const[n,u]=I.useState(!1),a=e??n,c=t??u,o=W(),g=z(),D=q(),C=me(),{tenantEmailDomain:x}=M(),[r,k]=I.useState(!1);if(x==null)throw new Error("Can't access this page without a tenantEmailDomain");const{scheduleDetailId:i}=M(),m=l??i;let S;m!=="new"&&(S=m);const L=it(m),b=h((B=>B.scheduleAccruedDetailState.selectedJEAccruedScheduleKey)),T="accrued_expenses",y=h((B=>de(B,"accrued_expenses"))),w=h((B=>ie(B))),J=h((B=>B.classListState.fetchState)),N=h((B=>X(B))),v=w!=="Completed"||J!=="Completed";I.useEffect((()=>{r===!1&&v?(D(Ge(T,S)),k(!0)):v===!1&&r===!1&&m!=="new"&&(D(Re(T,m)),k(!0))}),[r]);const j=h((B=>F(B))),P=h((B=>H(B,j.companyId))),A=y.fetchState,G=y.allAccountList,R=y.allClassList,$=y.allAccruedAccountList,Y=y.scheduleAccruedDetailsLocalData;if(L!==!0||y.fetchState==="Error")return E.jsx(K,{});const f=A==="Completed"&&r===!0,p=y.selectedJEAccruedSchedule!=null;return A==="Completed"||A==="Not-Started"||d===!0&&p?E.jsxs(ot,{children:[f===!0?E.jsx(le,{analytics:O,onLoad:()=>{ut(y,T,P)}}):null,E.jsx(dt,{isRenderedInPanel:d,onPanelNavigateBack:s,setShouldNavigateBack:c,scheduleAccruedDetailsView:y,location:g,navigate:o,classList:R,accountList:G,shouldNavigateBack:a,accruedAccountList:$,scheduleLocalData:Y,selectedJEScheduleKey:b,scheduleDetailId:S,selectedScheduledJournalEntries:y.selectedJEAccruedSchedule?.scheduledJournalEntry??[],themeState:C,tenantEmailDomain:x,analytics:O,controllerUserDetails:P,isAccountingClassesEnabled:N,status:y.selectedJEAccruedSchedule?.status.code})]}):E.jsx(ne,{})},it=e=>e!=null,ut=(e,t,d)=>{const l=e.selectedJEAccruedSchedule,s=Q(d.controllers),n=ee(d.controllerUserIds);l!=null&&O.trackScheduleAccruedDetailsLoaded({scheduleType:t,scheduleExpenseCategoryAndClass:{expenseCategory:l.jeDebit.account?.accountName??null,expenseClass:l.jeDebit.accountingClass?.className??null},schedule:{...Le(l)},vendorName:l.vendor.name??null,controllerEmails:s,controllerUserIds:n})},rt=pe.div`
|
|
10
|
-
display: flex;
|
|
11
|
-
min-height: 100%;
|
|
12
|
-
width: 100%;
|
|
13
|
-
flex: 1 0 auto;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
align-items: center;
|
|
16
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
17
|
-
`,se=he.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,ht=Z((function(e){const t=F(e),d=te(e,"fixed_assets");return{tenantName:t.companyName,scheduleDetailsView:d}}),(function(e,t){const{navigate:d,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,u="fixed_assets",a=n.flatMap((c=>c.error)).filter((c=>!!c))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const c=ae(t.location.state?.pathnameStackToGoBack);c.poppedPathname==null?d("../schedules/fixed_assets"):t.navigate(c.poppedPathname,{state:{pathnameStackToGoBack:c.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:c=>{e(Be(u,c,a.length>0))},onDelete:c=>{e(Te(u,c))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(xe(u,t.selectedJEScheduleKey))},onEditAmount:(c,o)=>{e(Ie(u,c,o))},onJELinkClick:c=>{e(Ae({selectedJELinkRowIndex:c})),d("./edit_link")},onTransactionClick:c=>{const o=`${V(c,t.tenantEmailDomain)}`,g=_(l.state?.pathnameStackToGoBack,l.pathname);d(o,{state:{pathnameStackToGoBack:g,message:"comingFromScheduleDetailsFixedAssets"}})},onViewLinkedJE:c=>{const o=`${V(c,t.tenantEmailDomain)}`,g=_(l.state?.pathnameStackToGoBack,l.pathname);d(o,{state:{pathnameStackToGoBack:g}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(c,o)=>{c.trim().length>=2?e(re({searchString:c,entityType:o,searchOrigin:"common"})):c.trim().length===0&&e(U("common"))},onCancelAutoComplete:()=>{e(U("common"))}},onDetailPageChange:(c,o)=>{const{scheduleDetailsFixedAssetsSection:g,scheduleDetailsListSection:D}=c,{scheduleClass:C,scheduleExpenseCategory:x,accumulatedDepreciationCategory:r,assetId:k,months:i,startDate:m,postingDate:S,vendor:L}=g,b=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((A=>A.id===L?.selectedOption)):void 0,T={id:b?.zeniId??L?.selectedOption??"",name:b?.name??L?.defaultOptions.find((A=>A.value===L?.selectedOption))?.label??"",logo:b?.logo},y=C.selectedOption!=null?t.classList.find((A=>A.classId===C.selectedOption)):void 0,w=x.selectedOption!=null?t.accountList.find((A=>A.qboId===x.selectedOption)):void 0,J=r.selectedOption!=null?t.depAccountList.find((A=>A.qboId===r.selectedOption)):void 0,N=i?.selectedOption,v=D.map(((A,G)=>({...t.scheduleLocalData.jeScheduleDetails[G],amount:{...t.scheduleLocalData.jeScheduleDetails[G].amount,amount:A.amount}}))),j=S.type==="day"?S.dayOfMonth?S.dayOfMonth:1:void 0,P=S.type==="lastDayOfMonth"||void 0;e(ye({scheduleType:u,localData:{selectedAccount:w?.accountId,selectedClass:y?.classId,selectedAccumulatedDepreciationCategory:J?.accountId,selectedDate:m,selectedMonths:N,assetId:k,jeScheduleDetails:v,lastDayOfMonth:P,selectedDayOfMonth:j,selectedVendor:T},selectedJeScheduleDetailId:t.scheduleDetailId})),o!==!1||J?.accountId==null||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||w?.accountId==null||t.isAccountingClassesEnabled!==!1&&y?.classId==null||m==null||N==null||P!==!0&&j==null||e(ve({scheduleType:u}))}}}))(tt),Nt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,onPanelNavigateBack:d}={})=>{const l=W(),s=z(),n=q(),u=me(),{tenantEmailDomain:a}=M(),[c,o]=I.useState(!1),{scheduleDetailId:g}=M(),D=t??g,C=s.state?.message==="expenseAutomation",x=mt(D),r=h((f=>f.scheduleDetailState.selectedJEScheduleKey));I.useEffect((()=>{r!=null&&r.length!==0||D!=="new"||l("../schedules/fixed_assets")}),[r,D]);const k="fixed_assets",i=h((f=>te(f,k))),m=h((f=>f.entityAutoCompleteState.autoCompleteText.common)),S=h((f=>ue(f,"common"))),L=h((f=>ie(f))),b=h((f=>f.classListState.fetchState)),T=h((f=>X(f))),y=h((f=>ge(f).selectedPeriod)),w=L!=="Completed"||b!=="Completed";I.useEffect((()=>{c===!1&&w?(n(Ee(k,R,!0)),o(!0)):w===!1&&c===!1&&(n(De(k,D==="new"?void 0:D,!0)),o(!0))}),[c]),I.useEffect((()=>{if(i.markAsCompleteStatus.fetchState==="Completed")if(n(ke()),C===!0){const{month:f,year:p}=y;l(`../../month_end_close_checks/review/je_schedules/${f}-${p}`)}else l("../schedules/fixed_assets")}),[i.markAsCompleteStatus.fetchState]);const J=h((f=>F(f))),N=h((f=>H(f,J.companyId))),v=i.fetchState,j=i.allAccountList,P=i.allClassList,A=i.allDepreciationAccountList,G=i.scheduleDetailsLocalData.fixed_assets;let R;if(D!=="new"&&(R=D),x!==!0||i.fetchState==="Error")return E.jsx(K,{});const $=v==="Completed"&&c===!0,Y=i.selectedJEScheduleTransaction!=null;return v==="Completed"||e===!0&&Y?E.jsxs(rt,{children:[$===!0?E.jsx(le,{analytics:O,onLoad:()=>{St(i,k,N)}}):null,E.jsx(ht,{isRenderedInPanel:e,onPanelNavigateBack:d,location:s,navigate:l,classList:P,vendorSearchEntityAutoCompleteView:S,vendorSearchAutoCompleteData:{autoCompleteText:m,entityAutoCompleteView:S},expenseAutomationSelectedPeriod:y,usedInExpenseAutomation:C,removeJeScheduleTransactionKey:(f,p)=>{n(Ce(f,p))},accountList:j,depAccountList:A,scheduleLocalData:G,selectedJEScheduleKey:r,scheduleDetailId:R,selectedScheduledJournalEntries:i.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:u,tenantEmailDomain:a,analytics:O,controllerUserDetails:N,isAccountingClassesEnabled:T,status:i.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ne,{})},mt=e=>e!=null,pt=e=>({transactionDate:e.date.format(se),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),St=(e,t,d)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=Q(d.controllers),u=ee(d.controllerUserIds);var a;l!=null&&s!=null&&O.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...pt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(se)??null,endMonth:a.endDate?.format(se)??null})},vendorName:s.vendor.name??null,fixedAssetsDetails:{accumulatedDepreciationCategory:s.jeCredit.account?.accountName??null,assetId:s.otherAttributes.assetId??null},controllerEmails:n,controllerUserIds:u})},ft=pe.div`
|
|
18
|
-
display: flex;
|
|
19
|
-
min-height: 100%;
|
|
20
|
-
width: 100%;
|
|
21
|
-
flex: 1 0 auto;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
align-items: center;
|
|
24
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
25
|
-
`,ce=he.getLocalizedStrings().dateFormat.analytics.YYYYDashMMDashDDFormat,gt=Z((function(e,t){const d=F(e),l=te(e,t.scheduleTab);return{tenantName:d.companyName,scheduleDetailsView:l}}),(function(e,t){const{navigate:d,location:l,vendorSearchAutoCompleteData:s,selectedScheduledJournalEntries:n}=t,u=n.flatMap((a=>a.error)).filter((a=>!!a))??[];return{onNavigateBack:()=>{if(t.onPanelNavigateBack!=null)return void t.onPanelNavigateBack();const a=ae(t.location.state?.pathnameStackToGoBack);a.poppedPathname==null?d("../schedules/prepaid_expenses"):t.navigate(a.poppedPathname,{state:{pathnameStackToGoBack:a.newStack}})},onZeniLogoClick:()=>{t.themeState.toggle()},onSave:a=>{e(Be(t.scheduleTab,a,u.length>0))},onDelete:a=>{e(Te(t.scheduleTab,a))},onMarkAsComplete:()=>{t.selectedJEScheduleKey!=null&&e(xe(t.scheduleTab,t.selectedJEScheduleKey))},onEditAmount:(a,c)=>{e(Ie(t.scheduleTab,a,c))},onJELinkClick:a=>{e(Ae({selectedJELinkRowIndex:a})),d("./edit_link")},onTransactionClick:a=>{const c=`${V(a,t.tenantEmailDomain)}`,o=_(l.state?.pathnameStackToGoBack,l.pathname);d(c,{state:{pathnameStackToGoBack:o,message:"comingFromScheduleDetails"}})},onViewLinkedJE:a=>{const c=`${V(a,t.tenantEmailDomain)}`,o=_(l.state?.pathnameStackToGoBack,l.pathname);d(c,{state:{pathnameStackToGoBack:o}})},vendorSearchAutoCompleteActions:{onAutoCompleteInputChange:(a,c)=>{a.trim().length>=2?e(re({searchString:a,entityType:c,searchOrigin:"common"})):a.trim().length===0&&e(U("common"))},onCancelAutoComplete:()=>{e(U("common"))}},onDetailPageChange:(a,c)=>{const{scheduleDetailsSection:o,scheduleDetailsListSection:g}=a,{scheduleClass:D,scheduleExpenseCategory:C,months:x,startDate:r,postingDate:k,vendor:i}=o,m=s.entityAutoCompleteView.vendor.length>0?s.entityAutoCompleteView.vendor.find((v=>v.id===i?.selectedOption)):void 0,S={id:m?.zeniId??i?.selectedOption??"",name:m?.name??i?.defaultOptions.find((v=>v.value===i?.selectedOption))?.label??"",logo:m?.logo},L=D.selectedOption!=null?t.classList.find((v=>v.classId===D.selectedOption)):void 0,b=C.selectedOption!=null?t.accountList.find((v=>v.qboId===C.selectedOption)):void 0,T=x?.selectedOption,y=g.map(((v,j)=>({...t.scheduleLocalData.jeScheduleDetails[j],amount:{...t.scheduleLocalData.jeScheduleDetails[j].amount,amount:v.amount}}))),w=k.type==="day"?k.dayOfMonth?k.dayOfMonth:1:void 0,J=k.type==="lastDayOfMonth"||void 0,N={selectedAccount:b?.accountId,selectedClass:L?.classId,selectedDate:r,selectedMonths:T,jeScheduleDetails:y,lastDayOfMonth:J,selectedVendor:S,selectedDayOfMonth:w};e(ye({scheduleType:t.scheduleTab,localData:N,selectedJeScheduleDetailId:t.scheduleDetailId})),c!==!1||t.scheduleDetailId!=null&&t.status!=="draft"&&t.status!=="marked_as_completed"||b?.accountId==null||t.isAccountingClassesEnabled!==!1&&L?.classId==null||r==null||T==null||J!==!0&&w==null||e(ve({scheduleType:t.scheduleTab}))}}}))(at),jt=({isRenderedInPanel:e=!1,scheduleDetailIdOverride:t,scheduleTypeOverride:d,onPanelNavigateBack:l}={})=>{const s=W(),n=z(),u=q(),a=me(),{tenantEmailDomain:c}=M(),[o,g]=I.useState(!1),D=n.state?.message==="expenseAutomation",{scheduleType:C,scheduleDetailId:x}=M(),r=t??x,k=Et(d??C,r),i=h((p=>p.scheduleDetailState.selectedJEScheduleKey));I.useEffect((()=>{i!=null&&i.length!==0||r!=="new"||s("../schedules/prepaid_expenses")}),[i,r]);const m=d??oe(C)??"prepaid_expenses",S=h((p=>te(p,m))),L=h((p=>p.entityAutoCompleteState.autoCompleteText.common)),b=h((p=>ue(p,"common"))),T=h((p=>ie(p))),y=h((p=>p.classListState.fetchState)),w=h((p=>X(p))),J=h((p=>ge(p).selectedPeriod)),N=T!=="Completed"||y!=="Completed";I.useEffect((()=>{o===!1&&N?(u(Ee(m,$,!0)),g(!0)):N===!1&&o===!1&&(u(De(m,r==="new"?void 0:r,!0)),g(!0))}),[o]),I.useEffect((()=>{if(S.markAsCompleteStatus.fetchState==="Completed")if(u(ke()),D===!0){const{month:p,year:B}=J;s(`../../month_end_close_checks/review/je_schedules/${p}-${B}`)}else s("../schedules/prepaid_expenses")}),[S.markAsCompleteStatus.fetchState]);const v=h((p=>F(p))),j=h((p=>H(p,v.companyId))),P=S.fetchState,A=S.allAccountList,G=S.allClassList,R=S.scheduleDetailsLocalData;let $;if(r!=="new"&&($=r),k!==!0||S.fetchState==="Error")return E.jsx(K,{});const Y=P==="Completed"&&o===!0,f=S.selectedJEScheduleTransaction!=null;return P==="Completed"||e===!0&&f?E.jsxs(ft,{children:[Y===!0?E.jsx(le,{analytics:O,onLoad:()=>{kt(S,m,j)}}):null,E.jsx(gt,{isRenderedInPanel:e,onPanelNavigateBack:l,location:n,vendorSearchEntityAutoCompleteView:b,vendorSearchAutoCompleteData:{autoCompleteText:L,entityAutoCompleteView:b},usedInExpenseAutomation:D,removeJeScheduleTransactionKey:(p,B)=>{u(Ce(p,B))},expenseAutomationSelectedPeriod:J,navigate:s,classList:G,accountList:A,scheduleLocalData:R[m],selectedJEScheduleKey:i,scheduleDetailId:$,selectedScheduledJournalEntries:S.selectedJEScheduleTransaction?.scheduledJournalEntry??[],themeState:a,tenantEmailDomain:c,scheduleTab:m,analytics:O,controllerUserDetails:j,isAccountingClassesEnabled:w,status:S.selectedJEScheduleTransaction?.status.code})]}):E.jsx(ne,{})},Et=(e,t)=>oe(e)!=null&&t!=null,Dt=e=>({transactionDate:e.date.format(ce),transactionAmount:e.amount,scheduleCategory:e.account.accountName,scheduleClass:e.classBase?.className??null,description:e.memo}),kt=(e,t,d)=>{const l=e.selectedJEScheduleTransaction?.baseTransaction,s=e.selectedJEScheduleTransaction,n=Q(d.controllers),u=ee(d.controllerUserIds);var a;l!=null&&s!=null&&O.trackScheduleDetailsLoaded({scheduleType:t,transaction:{...Dt(l)},scheduleExpenseCategoryAndClass:{expenseCategory:s.jeDebit.account?.accountName??null,expenseClass:s.jeDebit.accountingClass?.className??null},scheduledTransaction:{...(a=s,{currentBalance:a.balanceAsOfToday??null,currentStatus:a.status.label,period:a.period??null,startMonth:a.startDate?.format(ce)??null,endMonth:a.endDate?.format(ce)??null})},vendorName:s.vendor.name??null,controllerEmails:n,controllerUserIds:u})};export{bt as J,Nt as S,Jt as a,jt as b,wt as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotFoundScreen-BZ7M6wRY.js","assets/sentry-B0nIwgR6.js","assets/core-D5xlmXJj.js","assets/zeni-epic-state-DVQQo6UD.js","assets/index-waurk8Yr.js","assets/mui-DpenkF9f.js","assets/analytics-Cuu7a7XR.js","assets/utils-DQ0YEP-f.js","assets/index-BhC2LNQw.css","assets/DashboardRoutes-CiwFfaic.js","assets/withTransactionSidePanel-Bd8MYkO_.js","assets/useAskAiCfoHostNavButtonProps-buoAy4Wo.js","assets/TransactionDetailScreen-CsnmL0BT.js","assets/decodeURIComponentSafe-N0xRs_hS.js","assets/useInitialThreadRequest-BmsCi-c4.js","assets/routePaths-D2W1iWQZ.js","assets/expenseAutomationHelper-BchoKsfU.js","assets/analyticsHelper-CGHyb6cb.js","assets/CompanyPassportScreen-wR6Twi6v.js","assets/MobileAppDrawer-DCgsEnVh.js","assets/InboxNotificationsProvider-B9BL9-5c.js","assets/useTaskManagerAccess-Boniioo_.js","assets/useAiCfoDashboardSuggestedQuestionsChips-BrGfKrOJ.js","assets/FeaturePreviewScreen-BRYywZxe.js","assets/BillPayRoutes-C-gdP6KL.js","assets/AddressScreen-pJKlDi3q.js","assets/DomesticWireDetailScreen-CI14rSQG.js","assets/BusinessVerificationPageScreen-Boe3kgD5.js","assets/DrawerScreen-D4sZ0x81.js","assets/SetupPagesScreen-DAbhBEAF.js","assets/BillPayApprovalRoutes-BLyF1vsz.js","assets/ReimbursementApprovalRuleDetailScreen-2ORMbxwr.js","assets/getLocaleForTenant-CyZtaI04.js","assets/ReimbursementRoutes-BN8vNYWi.js","assets/ReimbursementApprovalRoutes-DNX741Rs.js","assets/TransactionListRoutes-DwAAMpvf.js","assets/ZeniAccountStatementScreen-DSVS1O6h.js","assets/SettingsRoutes-Cl1VWOb0.js","assets/AccountMappingScreen-B8Z5Jukp.js","assets/QBOConnectionScreen-BYc3DqHZ.js","assets/empty-C81l0a_D.js","assets/index-CcXiIb6r.js","assets/url-kBT6SwtU.js","assets/index-B2tEu4AE.js","assets/accountMappingHelper-BgNXnMXC.js","assets/useEmailConnectResultRefresh-a5BahjbB.js","assets/ReportsRoutes-Cq8Nmx-s.js","assets/ChargeCardRoutes-CYP3hEhW.js","assets/useChargeCardPusherEvents-29AHMbXs.js","assets/PeopleRoutes-D6QzTTon.js","assets/ExpenseAutomationRoutes-BcV9yLxC.js","assets/ScheduleDetailsPrepaidExpensesScreen-BWl6soT-.js","assets/pathToGoBack-Cjq5n9wd.js","assets/TreasuryRoutes-CW1AM8Em.js","assets/VendorsRoutes-BkMbhAF5.js","assets/ZeniAccountRoutes-361LPKCn.js","assets/AddressRoutes-AB7f2rQK.js","assets/PandLWithForecastRoutes-BsegyO1D.js","assets/CustomerOnboardingRoutes-CHW2qzKd.js","assets/TransactionDetailRoutes-BL6LPgyb.js","assets/EntityDetailRoutes-iu3nvuUO.js","assets/InvoicingRoutes-Dcjbiv_o.js","assets/NotificationRoutes-P9DoW6gN.js","assets/PerformanceRoutes-JzQ8nQOx.js","assets/RewardsRoutes-D5AiHAwp.js","assets/TaskRoutes-BPceEuj1.js","assets/TaskListScreen-DBk5pNZk.js","assets/AiCfoScreen-bXnwas9y.js","assets/CardsAiCfoScreen-BBJBV1b_.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as s,bn as ms,fB as _s,dV as Es,dU as hs,Aj as ps,de as gs,c7 as xs,gG as Rs,g5 as js,db as pe,cF as Is,gj as Ts,cx as As,bE as bs,br as fs,Ts as ys,v as Ds,Tv as Cs,bq as vs,Tw as Os,bK as Ps,bJ as Us,bt as ws,ct as Fs,Tx as Ls,Ty as Vs,d6 as ks,d9 as Hs,d8 as Bs,cE as Ss,cL as Ns,pO as ge,ge as xe,gV as Ms,gg as Re,gI as je,gJ as Ie,gh as Zs}from"./zeni-epic-state-DVQQo6UD.js";import{j as e}from"./liveblocks-DOBkg1D1.js";import{a as U}from"./sentry-B0nIwgR6.js";import{N as u,u as Gs,h as $s,i as zs,g as qs,j as $,q as Te,n as Ws,o as t}from"./core-D5xlmXJj.js";import{M as l,E as Ys,u as Js,z as y,O as Qs,d as Ks,W as Xs,y as M,f as en,N as sn,V as nn,L as F,G as Ae,t as _,P as tn,Q as an,j as ne}from"./index-waurk8Yr.js";import"./mui-DpenkF9f.js";import{f as be}from"./analyticsHelper-CGHyb6cb.js";import{t as on}from"./getLocaleForTenant-CyZtaI04.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]="a7a7cbbf-f686-4db8-b85a-170dc2c078f0",a._sentryDebugIdIdentifier="sentry-dbid-a7a7cbbf-f686-4db8-b85a-170dc2c078f0")}catch{}})();const rn=l((()=>s((()=>import("./NotFoundScreen-BZ7M6wRY.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),ln=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/reimbursements`}),un=({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(un,{tenantEmailDomain:v}):B?e.jsx(ln,{tenantEmailDomain:v}):e.jsx(rn,{})},dn={dashboard:()=>s((()=>import("./DashboardRoutes-CiwFfaic.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-C-gdP6KL.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-BN8vNYWi.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-DwAAMpvf.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])),settings:()=>s((()=>import("./SettingsRoutes-Cl1VWOb0.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-Cq8Nmx-s.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])),chargeCards:()=>s((()=>import("./ChargeCardRoutes-CYP3hEhW.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-D6QzTTon.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])),expenseAutomation:()=>s((()=>import("./ExpenseAutomationRoutes-BcV9yLxC.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,51,52,10,44,28,8])),treasury:()=>s((()=>import("./TreasuryRoutes-CW1AM8Em.js")),__vite__mapDeps([53,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])),vendors:()=>s((()=>import("./VendorsRoutes-BkMbhAF5.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,25,0,23,51,52,15,11,19,20,21,28,44,8])),zeniAccounts:()=>s((()=>import("./ZeniAccountRoutes-361LPKCn.js")),__vite__mapDeps([55,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8]))},cn=["bills","transactions","settings","reimbursement","reports","chargeCards","people"],te=a=>{"requestIdleCallback"in window?requestIdleCallback(a):setTimeout(a,100)},mn=l((()=>s((()=>import("./ReportsRoutes-Cq8Nmx-s.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])))),_n=l((()=>s((()=>import("./AddressRoutes-AB7f2rQK.js")),__vite__mapDeps([56,1,2,3,25,4,5,6,7,0,8])))),En=l((()=>s((()=>import("./PeopleRoutes-D6QzTTon.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])))),hn=l((()=>s((()=>import("./PandLWithForecastRoutes-BsegyO1D.js")),__vite__mapDeps([57,1,2,3,4,5,6,7,0,23,11,14,15,19,20,21,8])))),pn=l((()=>s((()=>import("./CustomerOnboardingRoutes-CHW2qzKd.js")),__vite__mapDeps([58,1,2,3,25,4,5,6,7,0,39,40,41,42,43,13,45,48,8])))),gn=l((()=>s((()=>import("./VendorsRoutes-BkMbhAF5.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,25,0,23,51,52,15,11,19,20,21,28,44,8])))),xn=l((()=>s((()=>import("./TransactionDetailRoutes-BL6LPgyb.js")),__vite__mapDeps([59,1,2,3,0,4,5,6,7,12,11,13,14,15,16,8])))),Ce=l((()=>s((()=>import("./EntityDetailRoutes-iu3nvuUO.js")),__vite__mapDeps([60,1,2,3,4,5,6,7,13,10,11,12,14,15,16,8])))),Rn=l((()=>s((()=>import("./DashboardRoutes-CiwFfaic.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-C-gdP6KL.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])))),jn=l((()=>s((()=>import("./SettingsRoutes-Cl1VWOb0.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])))),In=l((()=>s((()=>import("./InvoicingRoutes-Dcjbiv_o.js")),__vite__mapDeps([61,1,2,3,4,5,6,7,25,0,19,20,21,39,40,41,42,43,13,8])))),Oe=l((()=>s((()=>import("./ReimbursementRoutes-BN8vNYWi.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])))),Tn=l((()=>s((()=>import("./ZeniAccountRoutes-361LPKCn.js")),__vite__mapDeps([55,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8])))),An=l((()=>s((()=>import("./TreasuryRoutes-CW1AM8Em.js")),__vite__mapDeps([53,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])))),bn=l((()=>s((()=>import("./TransactionListRoutes-DwAAMpvf.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])))),fn=l((()=>s((()=>import("./ChargeCardRoutes-CYP3hEhW.js")),__vite__mapDeps([47,1,2,3,4,5,6,7,11,19,20,21,29,27,15,0,17,14,48,25,8])))),yn=l((()=>s((()=>import("./NotificationRoutes-P9DoW6gN.js")),__vite__mapDeps([62,1,2,3,0,4,5,6,7,11,21,8])))),Dn=l((()=>s((()=>import("./PerformanceRoutes-JzQ8nQOx.js")),__vite__mapDeps([63,1,2,3,0,4,5,6,7,11,19,20,21,8])))),Cn=l((()=>s((()=>import("./ExpenseAutomationRoutes-BcV9yLxC.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,51,52,10,44,28,8])))),vn=l((()=>s((()=>import("./RewardsRoutes-D5AiHAwp.js")),__vite__mapDeps([64,1,2,3,4,5,6,7,0,8])))),On=l((()=>s((()=>import("./TaskRoutes-BPceEuj1.js")),__vite__mapDeps([65,1,2,3,0,4,5,6,7,14,19,20,21,66,11,8])))),Pn=l((()=>s((()=>import("./AiCfoScreen-bXnwas9y.js")),__vite__mapDeps([67,1,2,3,4,5,6,7,22,52,15,8])))),Pe=l((()=>s((()=>import("./CardsAiCfoScreen-BBJBV1b_.js")),__vite__mapDeps([68,1,2,3,4,5,6,7,8])))),C=l((()=>s((()=>import("./NotFoundScreen-BZ7M6wRY.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),Un=l((()=>s((()=>import("./TaskListScreen-DBk5pNZk.js").then((a=>a.f))),__vite__mapDeps([66,1,2,3,4,5,6,7,11,19,20,21,8])))),wn=({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`}),Mn=Object.freeze(Object.defineProperty({__proto__:null,default:function({setTenantEmailDomain:a}){const A=Gs(),B=$s(),{tenantEmailDomain:i}=zs(),V=Ys().mode,{setLoading:O,clearAllLoading:v,clearLoading:k}=Js(),b=y.getSignedInUserTenant(i)?.tenantId,I=y.getSignedInUser(),J=ms(I),z=qs(),[L,we]=U.useState(!1),r=$((o=>_s(o))),{useFeatureGate:S}=Qs(),Z=Ks(),ae=Xs(),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"?Es(oe,r):void 0,Q=p==="Completed"||T==="Completed"?hs(r):void 0,re=p==="Completed"||T==="Completed"?ps(r)&&!gs(r):void 0,ke=en(r,Ve,oe),{isCardsHidden:He}=sn(r?.tenantId),Be=!ke||!!He,{isFeatureEnabled:Se}=S(M.isSettingsFeatureEnabled),{isFeatureEnabled:K}=S(M.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ne}=S(M.isInvoicingFeatureEnabled??"is_invoicing_feature_enabled"),Me=Ne||an==="DEV",Ze=r?.userRole!=null&&xs(r.userRole),q=$((o=>Rs(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=js(),h=nn(),Ge=r.company==null||h?.loggedInUserRoleMap!=null&&pe(h.loggedInUserRole),$e=Is(h?.loggedInUserRoleMap),X=Te("/:tenantEmailDomain/onboarding/*")!==null,ee=Te("/:tenantEmailDomain/month_end_close_checks/review/:selectedTab/:selectedPeriod/*"),ze=$((o=>G.tenantId!=null?Ts(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=As(Number(f[0])),n=Number(f[1]),c=bs(`01-${d<10?`0${d}`:d}-${n}`,Ae.getLocalizedStrings().dateFormat.analytics.DDDashMMDashYYYY),N=fs();c.isAfter(N,"month")===!1?A(ys(b,{month:d,year:n})):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((()=>{!Ds(ie,G)&&y.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,d,n){if(xe(f?.userId,f?.zeniSessionId,o.tenantId),d(Ms(!0)),d(Re(o.tenantId)),o.tenantId!=null&&_.clearTenant(o.tenantId),o.tenantId!=null){const c=y.getSignedInUserTenantWithId(o.tenantId);n&&Ae.updateAppLocaleID(on(n)),c?.tenantEmailDomain!=null&&y.saveActiveTenantDomainForUser(c?.tenantEmailDomain)}o.userId!=null?ne.identify(o.userId,{tenant_id:o.tenantId}):ne.resetUserIdentity()})(G,I,A,ze))}),[b]),U.useEffect((()=>{y.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,f,d,n,c,N,H){if(d==null&&n==null)return void console.warn("There is no current tenant selected!!");const W=n!=null&&c?.zeniSessionId!=null,us=d==null||d.tenantId!==n,ds=d!=null&&d.excludedResources==null,cs=d!=null&&d.externalConnections==null;if(W&&us){H(Re(n));const Y=y.getSignedInUserTenantWithId(n);Y?.tenantEmailDomain!=null&&y.saveActiveTenantDomainForUser(Y?.tenantEmailDomain),xe(c?.userId,c?.zeniSessionId,n),_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),H(je(c.userId,n))),_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),H(Ie(c.userId,n)))}else W&&ds&&_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),H(je(c.userId,n))),W&&cs&&_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),H(Ie(c.userId,n)));if(W){ne.identify(c.userId,{tenant_id:n});const Y=n==null||n!=null&&(f==="Completed"||f==="Error");o==="Completed"||f!=="Not-Started"&&f!=="Error"||n==null||!_.shouldFetchActiveTenant(n)||(_.markActiveTenantFetchStarted(n),N(F.TENANT_FETCHING),H(Zs(c.userId,n,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(Cs(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=cn,f=3e3){setTimeout((()=>{const d=n=>{if(n>=o.length)return;const c=o[n],N=dn[c];N!=null?N().then((()=>te((()=>d(n+1))))).catch((()=>te((()=>d(n+1))))):d(n+1)};te((()=>d(0)))}),f)})())}),[p,L]);const P=r?.userRole!=null&&vs(r?.userRole),{isFeatureEnabled:qe}=S(M.isReferralFeatureEnabled),We=r?.userRole!=null&&r.userRole.includes("charge_card_user"),Ye=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,Je=Os(h?.loggedInUserRoleMap),Qe=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&&Ps(h?.loggedInUserRoleMap),_e=Fe&&!P,Xe=Le&&!P,es=ue&&Us(h?.loggedInUserRoleMap),ss=de&&ws(h?.loggedInUserRoleMap),ns=_e&&Fs(h?.loggedInUserRoleMap),ts=Ls(h?.loggedInUserRoleMap),as=Vs(h?.loggedInUserRoleMap),os=ks(h?.loggedInUserRoleMap),rs=Hs(h?.loggedInUserRoleMap),is=Bs(h?.loggedInUserRoleMap),g=Ss(h?.loggedInUserRoleMap),x=Ns(h?.loggedInUserRoleMap),Ee=ue&&g,he=ce&&x,R=_e&&os,j=Xe&&rs,m=de&&is,ls=r.excludedResources?.resources?.find((o=>o.resource==="/invites"))!=null||$e===!0||Je===!0||ts===!0||as===!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&&!X)&&Ke&&Qe!==!0&&E===!1&&Q===!1&&re===!1?(a(void 0),e.jsx(u,{to:"/connection/auth",replace:!0})):!L||re!==!0||se!==!0||X||J?!L||se!==!1||X||J?L&&r?.userRole&&E!=null&&Q!=null&&i!=null&&Object.keys(h.loggedInUserRoleMap).length>0?e.jsx(Ws,{children:e.jsxs(t,{element:e.jsx(tn,{}),children:[e.jsx(t,{path:"/",element:e.jsx(wn,{isDashboardAccess:w,showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,isTenantCardsOnly:Q,showChargeCardRoute:m})}),e.jsx(t,{path:"dashboard/*",element:w?e.jsx(Rn,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"reports/*",element:w?e.jsx(mn,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"people/*",element:ls||w?e.jsx(En,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"forecast/*",element:w?e.jsx(hn,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"onboarding/*",element:e.jsx(pn,{})}),e.jsx(t,{path:"transaction/*",element:w&&P===!1||We||Ye?e.jsx(xn,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"transactions/*",element:w&&P===!1?e.jsx(bn,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{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(t,{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(t,{path:"tasks",element:e.jsx(Un,{})}),e.jsx(t,{path:"tasks/*",element:e.jsx(On,{})}),e.jsx(t,{path:"address/*",element:es||me||ns||ss?e.jsx(_n,{}):e.jsx(D,{showZeniAccountRoute:R,isUserHasBillPayAccess:g,isUserHasReimbursementAccess:x,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"checking/*",element:R?e.jsx(Tn,{}):e.jsx(C,{})}),e.jsx(t,{path:"treasury/*",element:j?e.jsx(An,{}):e.jsx(C,{})}),e.jsx(t,{path:"performance",element:ae===!0?e.jsx(Dn,{}):e.jsx(Ue,{tenantEmailDomain:i})}),e.jsx(t,{path:"month_end_close_checks/review/*",element:ae===!0&&P===!1?e.jsx(Cn,{}):e.jsx(Ue,{tenantEmailDomain:i})}),e.jsx(t,{path:"notifications/*",element:e.jsx(yn,{})}),e.jsx(t,{path:"vendors/*",element:Ge?e.jsx(gn,{}):e.jsx(C,{})}),e.jsx(t,{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(t,{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(t,{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(t,{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(t,{path:"settings/*",element:Se?e.jsx(jn,{hasAdminLevelAccess:me}):e.jsx(C,{})}),e.jsx(t,{path:"invoicing/*",element:Me&&Ze?e.jsx(In,{}):e.jsx(C,{})}),e.jsx(t,{path:"cards/ask",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:K}):e.jsx(C,{})}),e.jsx(t,{path:"cards/ask/:session_id",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:K}):e.jsx(C,{})}),e.jsx(t,{path:"cards/*",element:m?e.jsx(fn,{}):e.jsx(C,{})}),e.jsx(t,{path:"rewards/*",element:qe?e.jsx(vn,{}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo/",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo/:session_id",element:Z?e.jsx(Pn,{isFileUploadEnabled:K}):e.jsx(C,{})}),e.jsx(t,{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,Mn as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-DOBkg1D1.js";import{a as f,R as x,q as A}from"./sentry-B0nIwgR6.js";import{u as D,h as z,j as l,g as j,N as M,l as O}from"./core-D5xlmXJj.js";import{u as B,z as s,E as P,j as w,G as _,R as F,S as N,T as R,U as V,X as $,Y as v}from"./index-waurk8Yr.js";import{fB as q,Tb as J,Tv as W,ge as X,gg as G,TA as H,gR as Y,df as K,TB as T,TC as Q,TD as Z,b_ as y}from"./zeni-epic-state-DVQQo6UD.js";import"./mui-DpenkF9f.js";import{u as ee}from"./useDeviceId-ChTv1tr4.js";import{f as te}from"./analyticsHelper-CGHyb6cb.js";import{t as ne}from"./getLocaleForTenant-CyZtaI04.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="2d63677a-46a5-4496-9c76-72fced76232d",t._sentryDebugIdIdentifier="sentry-dbid-2d63677a-46a5-4496-9c76-72fced76232d")}catch{}})();const ie=O((function(t,i){const d=t.tenantState.fetchState,g=t.tenantState.sendEmailMagicLinkFetchState,{magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}=i;return{googleClientId:v.googleClientId,microsoftClientId:v.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:y(c),sourceUri:y(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(Q(n,a)))},clearSignInError:()=>{t(T())}}}))($),ae=x.memo(ie);function ve({setTenantEmailDomain:t}){const i=D(),d=z(),{clearAllLoading:g}=B(),n=s.getSignedInUser();f.useLayoutEffect((()=>{g()}),[g]);const a=ee(),c=l((e=>e.tenantState.magicLinkCodeVerifier)),{sendEmailMagicLinkFetchState:L,accountLocked:C,accountUnlockTime:h}=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=j(),E=P().mode,U=m.state?.magicLinkExpired,b=m.state?.magicLinkAlreadyUsed;if(f.useEffect((()=>{L.fetchState==="Completed"&&c!=null&&(w.trackSignInLinkSent(),s.saveMagicLinkCodeVerifier(c))}),[L.fetchState,c]),f.useEffect((()=>{t(void 0)}),[]),f.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(W(I.tenantsInOrder),o.zeniSessionId),X(o.userId,o.zeniSessionId,r.tenantId),i(G(r.tenantId)),s.saveActiveTenantDomainForUser(r.tenantEmailDomain),i(H("Completed")),_.updateAppLocaleID(ne(r)),te(o,r,E,void 0,I.tenantsInOrder),Y().then((()=>{const e=V();e!=null&&F(e)})),setTimeout((()=>{w.trackLogin(N.Event.loginSuccess,o.authProvider??"google",K(r.productSettings))}),2e3))}),[S,p,k,o,r,I,E,m.state,i]),S==="In-Progress"&&p==="Completed"&&o?.zeniSessionId!=null&&r!=null||n!=null){const e=m.state?.origin??"/";return u.jsx(M,{to:e,state:{...m.state,origin:""}})}return u.jsxs(u.Fragment,{children:[u.jsx(ae,{magicLinkExpired:!!U,magicLinkAlreadyUsed:!!b,magicLinkExpiredEmail:s.getMagicLinkEmail()??void 0,location:m,navigate:d,deviceId:a??void 0,showEmailLogin:!0}),C===!0&&h!=null?u.jsx(R,{onClose:()=>i(T()),unlockDate:h}):null]})}export{ve as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-DOBkg1D1.js";import{a}from"./sentry-B0nIwgR6.js";import{u as f,g as d,N as u}from"./core-D5xlmXJj.js";import{z as i,j as n,S as m,a7 as p}from"./index-waurk8Yr.js";import{gU as g,TR as b}from"./zeni-epic-state-DVQQo6UD.js";import{n as y}from"./mui-DpenkF9f.js";import"./recharts-CcOTx_Jj.js";import"./analytics-Cuu7a7XR.js";import"./plaid-D5L6VoNT.js";import"./dnd-DN-HQej8.js";import"./stripe-cKAAJElX.js";import"./lottie-o0tP_TXQ.js";import"./lexical-DDQ51-Oa.js";import"./pdf-DIMTd5ya.js";import"./utils-DQ0YEP-f.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]="244957b5-16b5-4b11-a09b-5aaa1ab7c0b2",t._sentryDebugIdIdentifier="sentry-dbid-244957b5-16b5-4b11-a09b-5aaa1ab7c0b2")}catch{}})();function L(){const t=f(),e=d(),r=a.useRef(!1),l=i.isSignedIn(),o=e.state?.message==="logout"||l;return a.useEffect((()=>{if(o&&!r.current){r.current=!0;try{t(g()),b(),n.trackLogout(m.Event.logoutSuccess),n.resetUserIdentity(),i.clearAll()}catch(c){console.error("Error during sign out:",c)}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=y.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};
|