@zeniai/web-app-ui 5.3.30-dev → 5.3.31-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-DwZgnpO5.js → AccountMappingScreen-UdzIeE_v.js} +2 -2
- package/dist/assets/AddressRoutes-CaXv_Hc-.js +1 -0
- package/dist/assets/AddressScreen-Dmypz8Cm.js +9 -0
- package/dist/assets/AiCfoScreen-DNghBGiO.js +22 -0
- package/dist/assets/AppDrawer-kOTtyyGv.js +10 -0
- package/dist/assets/{BillPayApprovalRoutes-k9A_OynM.js → BillPayApprovalRoutes--ALQ35-1.js} +1 -1
- package/dist/assets/{BillPayRoutes-DqYiVdlx.js → BillPayRoutes-BcTRlRv8.js} +9 -9
- package/dist/assets/{BusinessVerificationPageScreen-3R_uxb4s.js → BusinessVerificationPageScreen-DzWgqXwG.js} +2 -2
- package/dist/assets/{CardsAiCfoScreen-Bi4DWU-D.js → CardsAiCfoScreen-C_lk15md.js} +2 -2
- package/dist/assets/{ChargeCardRoutes-D_J5Jsfo.js → ChargeCardRoutes-BjIdSbvb.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-CWgdKqmQ.js → CompanyPassportScreen-BKrZbZ6U.js} +1 -1
- package/dist/assets/{ConnectionAuthScreen-I4BlOLSg.js → ConnectionAuthScreen-Dzixugfp.js} +2 -2
- package/dist/assets/CustomerOnboardingAuthScreen-D31TaCjo.js +1 -0
- package/dist/assets/CustomerOnboardingRoutes-3cZyVkRN.js +30 -0
- package/dist/assets/{DashboardRoutes-ZMo0onUW.js → DashboardRoutes-BruAIMYU.js} +4 -4
- package/dist/assets/{DefaultTenantHome-BqaVnNI0.js → DefaultTenantHome-BtIFl_77.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-DhMVIfNi.js +18 -0
- package/dist/assets/DrawerScreen-CbY0_Vl5.js +1 -0
- package/dist/assets/EntityDetailRoutes-DpM6LjT5.js +1 -0
- package/dist/assets/ExpenseAutomationRoutes-Dll0r-g6.js +25 -0
- package/dist/assets/FeaturePreviewScreen-DRMNz052.js +1 -0
- package/dist/assets/HubSpotOAuthCallbackScreen-CaSUfoGO.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-BIRPulc1.js → InboxNotificationsProvider-55rQDTXA.js} +1 -1
- package/dist/assets/InvoicingRoutes-B8ytNofm.js +2 -0
- package/dist/assets/{MagicLinkRoutes-Bnp_x7Nk.js → MagicLinkRoutes-DbYU9yxF.js} +19 -19
- package/dist/assets/MagicLinkSignInScreen-DSGkqzLp.js +12 -0
- package/dist/assets/{MobileAppDrawer-CcN5sT0f.js → MobileAppDrawer-BAV0ejOs.js} +1 -1
- package/dist/assets/NotFoundScreen-ButYFiTG.js +1 -0
- package/dist/assets/NotificationRoutes-jy7KSYzl.js +1 -0
- package/dist/assets/OAuthConsentScreen-4W57tKq2.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-Diz_Rn8O.js +1 -0
- package/dist/assets/PaymentLinkScreen-BcSDg2Q0.js +21 -0
- package/dist/assets/PeopleRoutes-BsxSMUvq.js +22 -0
- package/dist/assets/PerformanceRoutes-DFKVpzlk.js +1 -0
- package/dist/assets/{Preview-ByUhhrY0.js → Preview-DNAybQkC.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-IBpF64YF.js → QBOConnectionScreen-BmXy-56M.js} +1 -1
- package/dist/assets/ReimbursementApprovalRoutes-DW0hPEhv.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-DetQk8QU.js → ReimbursementApprovalRuleDetailScreen-lyJcYNIg.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-C9_awEWz.js → ReimbursementRoutes-BQ18gzav.js} +9 -9
- package/dist/assets/ReportsRoutes-iapNY-Ca.js +1 -0
- package/dist/assets/RewardsRoutes-CO35jNo-.js +1 -0
- package/dist/assets/ScreenRoutes-B2fNAm1R.js +2 -0
- package/dist/assets/{SettingsRoutes-BEdYLTM7.js → SettingsRoutes-DU6XdEOY.js} +6 -6
- package/dist/assets/{SetupPagesScreen-Sjd63M0p.js → SetupPagesScreen-CPUD_j1y.js} +5 -5
- package/dist/assets/SignInScreen-DL2bXt_7.js +1 -0
- package/dist/assets/SignOutScreen-DSAHdKNP.js +9 -0
- package/dist/assets/{TaskListScreen-DdkR5DtM.js → TaskListScreen-BH2rdLa7.js} +2 -2
- package/dist/assets/{TaskRoutes-LOSKO78T.js → TaskRoutes-C-JJtR4s.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-CaIXvpDL.js +1 -0
- package/dist/assets/TransactionDetailScreen-srWo_3sK.js +5 -0
- package/dist/assets/TransactionListRoutes-CpBDr1qT.js +1 -0
- package/dist/assets/TreasuryRoutes-Ja8FQwZH.js +37 -0
- package/dist/assets/VendorsRoutes-CoiOEvIl.js +112 -0
- package/dist/assets/WiseConfirmationScreen-Dj7QUTt6.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-BXfvCXHr.js → ZeniAccountRoutes-BjLND6jg.js} +8 -8
- package/dist/assets/ZeniAccountStatementScreen-BgOPM6A3.js +9 -0
- package/dist/assets/{accountMappingHelper-CU6wucuM.js → accountMappingHelper-CAg2qsF3.js} +1 -1
- package/dist/assets/{analytics-BgUj-hR5.js → analytics-CqoRAkB1.js} +1 -1
- package/dist/assets/{analyticsHelper-Cypw_xC0.js → analyticsHelper-Cjtujqyf.js} +1 -1
- package/dist/assets/{core-CMivCywN.js → core-CiFsHd3i.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DRefzrWS.js → decodeURIComponentSafe-FYjI-TwW.js} +1 -1
- package/dist/assets/{dnd-B8NpvFCU.js → dnd-jcX4BW0a.js} +1 -1
- package/dist/assets/{empty-CllNfDt1.js → empty-4iGv0vIv.js} +1 -1
- package/dist/assets/{empty-CawgNJEF.js → empty-DSab5moc.js} +1 -1
- package/dist/assets/{emptyVideoElement-DBVZ22o5.js → emptyVideoElement-BSwv6rHf.js} +1 -1
- package/dist/assets/{epic-Cw47VvOB.js → epic-CjiXGW6W.js} +1 -1
- package/dist/assets/{expenseAutomationHelper-BuTA7ucx.js → expenseAutomationHelper-R2jHKv-Z.js} +1 -1
- package/dist/assets/getLocaleForTenant-CRduVQsY.js +1 -0
- package/dist/assets/{index-DCnLtCHg.js → index-0sENwUb_.js} +1 -1
- package/dist/assets/{index-BnHTUbKj.js → index-2FqIUc6q.js} +1 -1
- package/dist/assets/{index-CD-EymjZ.js → index-BJOxGHxN.js} +2 -2
- package/dist/assets/{index-baDCTZK3.js → index-CVbu1_bp.js} +1 -1
- package/dist/assets/{index-Cx55eHdr.js → index-Cz99TrBA.js} +1 -1
- package/dist/assets/{index-XoGDegrx.js → index-D6dzsKZ7.js} +1 -1
- package/dist/assets/{index-Djuwyi3d.js → index-DGRhh-da.js} +1 -1
- package/dist/assets/{index-DlMGj3Af.js → index-juRht-9c.js} +11171 -11173
- package/dist/assets/{lexical-Di6ZXkXF.js → lexical-DBiumTDC.js} +1 -1
- package/dist/assets/{liveblocks-mJJR3MsR.js → liveblocks-CkQ2CY6T.js} +1 -1
- package/dist/assets/{lottie-BTBtSLCO.js → lottie-cUBeCDOE.js} +1 -1
- package/dist/assets/{mui-C6XtNCo7.js → mui-FQy08n5j.js} +1 -1
- package/dist/assets/{pathToGoBack-DkQc48Fj.js → pathToGoBack-DWIhT07R.js} +1 -1
- package/dist/assets/{pdf-DSDpdkmb.js → pdf-C6cPvWx8.js} +3 -3
- package/dist/assets/{pdf-lib-BbzL8H1t.js → pdf-lib-C9DR7g8H.js} +1 -1
- package/dist/assets/{plaid-l8YRzpBD.js → plaid-Dw5LGskq.js} +1 -1
- package/dist/assets/{pusher-B8Hm6DMT.js → pusher-Bs1ItrSl.js} +1 -1
- package/dist/assets/{react-BeA4fGXX.js → react-B-yGKA4G.js} +1 -1
- package/dist/assets/{react-TfJbQpIh.js → react-BD9-MMqW.js} +1 -1
- package/dist/assets/{react-FrhNEOT3.js → react-BK8OyR5e.js} +1 -1
- package/dist/assets/{react-CFob_XAv.js → react-BzoedhUW.js} +1 -1
- package/dist/assets/{react-hzw_vRmY.js → react-N2ByZQ0u.js} +1 -1
- package/dist/assets/{react-CexHjl19.js → react-Rj21KKGh.js} +1 -1
- package/dist/assets/{recharts-Co0_Dmc-.js → recharts-CYbL6OhC.js} +1 -1
- package/dist/assets/routePaths-DqksJ4i_.js +1 -0
- package/dist/assets/{sentry-CItQHKpv.js → sentry-Lj2WEO6K.js} +1 -1
- package/dist/assets/{url-MmuF1WQx.js → url-Bk85P8pL.js} +1 -1
- package/dist/assets/{url-xQ9KNY2e.js → url-DhKb0GNI.js} +1 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-B3XyU0Fo.js +1 -0
- package/dist/assets/useAskAiCfoHostNavButtonProps-Dhoa0fnv.js +1 -0
- package/dist/assets/useChargeCardPusherEvents-YQlWLN09.js +1 -0
- package/dist/assets/{useDeviceId-DJLfe-br.js → useDeviceId-CWOFj37E.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-DpIv7GW3.js +1 -0
- package/dist/assets/useInitialThreadRequest-D-SxLs4P.js +1 -0
- package/dist/assets/{useTaskManagerAccess-B7jKkFFv.js → useTaskManagerAccess-BrCmQLIc.js} +1 -1
- package/dist/assets/{utils-macSqF2O.js → utils-DsJsAXTJ.js} +1 -1
- package/dist/assets/withTransactionSidePanel-BjLmCRfl.js +25 -0
- package/dist/assets/{zeni-epic-state-CqKBThJ0.js → zeni-epic-state-BdFiPfcm.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-C62kNpv6.js +0 -1
- package/dist/assets/AddressScreen-CLiV0mfm.js +0 -9
- package/dist/assets/AiCfoScreen-CqZYbNVQ.js +0 -22
- package/dist/assets/AppDrawer-BIggl_eh.js +0 -10
- package/dist/assets/CustomerOnboardingAuthScreen-B0zqTC0c.js +0 -1
- package/dist/assets/CustomerOnboardingRoutes-DD4F_qvN.js +0 -30
- package/dist/assets/DomesticWireDetailScreen-DQgaUF67.js +0 -18
- package/dist/assets/DrawerScreen-C6V6LURt.js +0 -1
- package/dist/assets/EntityDetailRoutes-Dm568mMt.js +0 -1
- package/dist/assets/ExpenseAutomationRoutes-B1Pq1A36.js +0 -38
- package/dist/assets/FeaturePreviewScreen-B_aYJlol.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-ClpdRb8W.js +0 -1
- package/dist/assets/InvoicingRoutes-CBGWefo8.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-D-6FJGXy.js +0 -12
- package/dist/assets/NotFoundScreen-fxNT7vgC.js +0 -1
- package/dist/assets/NotificationRoutes-BJVwBy9d.js +0 -1
- package/dist/assets/OAuthConsentScreen-DOVfptZ6.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-CGhv0VSW.js +0 -1
- package/dist/assets/PaymentLinkScreen-Ci5gr6F7.js +0 -21
- package/dist/assets/PeopleRoutes-Bee6xNme.js +0 -22
- package/dist/assets/PerformanceRoutes-CD6W5bUU.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-B5KvxgyI.js +0 -1
- package/dist/assets/ReportsRoutes-zo7ew2ho.js +0 -1
- package/dist/assets/RewardsRoutes-sTKxe2ug.js +0 -1
- package/dist/assets/ScheduleDetailsPrepaidExpensesScreen-CrWn6EEs.js +0 -25
- package/dist/assets/ScreenRoutes-DIYlkgqr.js +0 -2
- package/dist/assets/SignInScreen-_27hdB-U.js +0 -1
- package/dist/assets/SignOutScreen-CDr6KmEf.js +0 -9
- package/dist/assets/TransactionDetailRoutes-PwaQuAlN.js +0 -1
- package/dist/assets/TransactionDetailScreen-BlnM6_t9.js +0 -5
- package/dist/assets/TransactionListRoutes-Bx3VnAdU.js +0 -1
- package/dist/assets/TreasuryRoutes-BEdtvJnK.js +0 -37
- package/dist/assets/VendorsRoutes-DoXAtF5W.js +0 -88
- package/dist/assets/WiseConfirmationScreen-CVwWngtr.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-C3siKg2V.js +0 -9
- package/dist/assets/getLocaleForTenant-DCXbCJAu.js +0 -1
- package/dist/assets/routePaths-Bpj3i3MK.js +0 -1
- package/dist/assets/useAiCfoDashboardSuggestedQuestionsChips-CBJFyF6T.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-eZEppiJu.js +0 -1
- package/dist/assets/useChargeCardPusherEvents-D3l-sj94.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-DlmntN_b.js +0 -1
- package/dist/assets/useInitialThreadRequest-DBDsuRGA.js +0 -1
- package/dist/assets/withTransactionSidePanel-DMpmT4ot.js +0 -25
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-mJJR3MsR.js";import{a as r}from"./sentry-CItQHKpv.js";import{u as D,h as L,i as w,j as E,t as W,l as T,s as Z,g as J,N as B,n as ie,o as x}from"./core-CMivCywN.js";import{a8 as ln,h as p,aq as F,Q as g,cb as dn,cc as un,cd as gn,ce as mn,cf as vn,cg as pn,ch as fn,ci as Sn,cj as hn,ck as Cn,cl as In,cm as En,cn as kn,co as yn,p as X,cp as xn,cq as bn,ae as se,cr as jn,cs as Pn,z as he,ct as Dn,cu as Ln,cv as An,cw as $n,cx as wn,cy as Fn,cz as Rn,cA as Tn,J as On,ai as ft,cB as _n,cC as Mn,cD as Nn,cE as Un,cF as Bn,cG as Vn,cH as Zn,cI as Hn,cJ as qn,t as Ke,g as St,cK as Kn,cL as Qn,cM as Gn,cN as zn,cO as Wn,cP as Jn,cQ as Xn}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{A as K}from"./AddressScreen-CLiV0mfm.js";import N from"./NotFoundScreen-fxNT7vgC.js";import{Z0 as Yn,Z1 as ei,uM as Qe,Z2 as Pe,Z3 as Q,vQ as Ge,vX as ti,w0 as ht,Z4 as De,Z5 as Ct,vU as It,Z6 as Le,vS as Et,yw as ni,vT as ii,Z7 as G,vd as ce,vM as oi,xn as ze,vc as Ce,Z8 as ai,Z9 as kt,w7 as si,Za as z,we as ci,Zb as ri,Zc as yt,Zd as xt,yi as li,Ze as ue,Zf as We,Zg as bt,va as di,Zh as ui,v4 as gi,Zi as mi,xA as vi,Zj as jt,xJ as Je,Zk as pi,xG as fi,Zl as Ae,gd as Si,Zm as te,Zn as ne,wt as hi,vi as Xe,Zo as $e,vn as Pt,vl as Ci,vf as Ii,wm as Ei,vp as ki,wv as yi,Zp as Ie,wC as Dt,wA as Ee,Fm as we,xP as Ye,Zq as xi,vb as Fe,Zr as Re,vy as ke,vv as ye,vI as Lt,vH as Te,vs as bi,vB as At,vK as oe,fB as Oe,UP as $t,ve as _e,vF as ji,vG as Pi,vE as Di,Zs as Li,wa as et,wf as Ai,wb as wt,Zt as Ft,u_ as tt,Zu as $i,uW as Rt,Zv as wi,xV as Fi,xZ as H,xU as Ri,x1 as Me,Zw as Ti,Zx as Tt,y6 as nt,Zy as Oi,y3 as _i,Zz as Ot,x4 as Mi,x5 as V,x8 as Ni,ZA as _t,xi as ve,ZB as Ui,wu as Mt,Tm as Nt,ZC as Bi,xs as Vi,ZD as Ut,ZE as Zi,ZF as Hi,ZG as qi,yX as Ki,ZH as Qi,ZI as Bt,yd as Vt,ZJ as Zt,yV as pe,ZK as Gi,yS as zi,ZL as Wi,ZM as Ji,ZN as Xi,ZO as Yi,ZP as eo,ZQ as it,ZR as to,y$ as no,ZS as Ne,wM as ot,ZT as Ue,ZU as re,wW as Ht,wR as qt,wP as xe,ZV as io,wH as oo,yj as Kt,yK as at,yF as ao,ZW as so,yk as co,ZX as ro,yL as lo,yP as uo,ZY as go,ZZ as Qt,c7 as mo,mo as vo,mp as po,Z_ as st,vR as le,gh as fo,uc as So,mv as ho,yC as Gt,zb as Co,yz as zt,ui as Io,z8 as ct,u6 as Eo,z5 as rt,hP as ko,TP as lt,TQ as yo,Fy as Wt,hH as xo,Z$ as bo,UE as jo,_0 as Po,zh as fe,zi as Do,_1 as Lo,_2 as Jt,ze as Ao,_3 as $o,_4 as wo,xw as Fo,_5 as Ro}from"./zeni-epic-state-CqKBThJ0.js";import{M as To}from"./MobileAppDrawer-CcN5sT0f.js";import{q as de}from"./QBOConnectionScreen-IBpF64YF.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";import"./empty-CllNfDt1.js";import"./pdf-lib-BbzL8H1t.js";import"./index-baDCTZK3.js";import"./url-xQ9KNY2e.js";import"./index-Cx55eHdr.js";import"./decodeURIComponentSafe-DRefzrWS.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="da07a9df-1793-41aa-a98c-11457decd261",n._sentryDebugIdIdentifier="sentry-dbid-da07a9df-1793-41aa-a98c-11457decd261")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:I,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Yn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,C=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(Qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const P=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:P,isLoadingMore:h,searchValue:o,sortState:l,onEntityLinkClick:C,onLoadMore:()=>{S&&I!=null&&n(Qe({cursor:I,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:a,onSortChange:v})]})}const _o=new Set(["plan"]),Xt=[],Mo=Ct((n=>n.length>0?n:Xt),mn),No=Ct((n=>n.length>0?n:Xt),gn),Uo=T((function(n,e){const{view:t}=e;return{groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?o=>{i!==""&&n(It({action:o,id:i}))}:void 0,onEditChange:o=>{i!==""&&n(De({id:i,localData:o}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(o,a)=>{i!==""&&n(ti({action:a,id:o,parentItemId:i}))}}}))(un);function Bo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=(d=o.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>Pe(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(Q()),()=>{n(Q())})),[n]),r.useEffect((()=>{a&&n(Ge({id:t,kind:c}))}),[a,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(Q()),n(Ge({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed",[I,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=I!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Be(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:o=!1}=n,a=D(),{areTenantIdsInSync:c}=F(),d=E(Le),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(o&&v!=="Not-Started"||a(Et()),t&&a(ni()))}),[c,a,e,t,o]),r.useEffect((()=>{e&&c&&l&&i&&a(ii())}),[c,a,e,l,i]),{isQboConnected:l,qboView:d}}function Ve(n,e=!1){const t=D(),i=E((c=>G(c).productNextCursor!=null)),o=E((c=>G(c).productNextCursor)),a=E((c=>G(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&a!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&a!=="In-Progress"&&i&&o!=null&&t(ce({cursor:o,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,a,i,o])}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=T((function(n,e){const t=Pe(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:o}=e,a=o!=null?`${t}/catalog/${encodeURIComponent(o)}`:`${t}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(Q()),e.navigate(`${t}/catalog`)},onChange:c=>{n(De({id:o,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:o}))}}}))(vn);function qo(){const n=D(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[o]=W(),{areTenantIdsInSync:a}=F(),c=t!=null,d=o.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=o.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>Pe(S,t)));return Ve(a,!0),Be({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{a&&t!=null&&n(oi({id:t,kind:v}))}),[a,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(De({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(Q())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=T((function(n,e){const t=G(n),i=e.activeTab==="plans",o=e.activeTab==="all",a=i?t.plans:o?[...t.plans,...t.products]:t.products,c=i||o&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:o&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&a.length===0,isLoadingMore:c==="In-Progress"&&a.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",o=e.activeTab==="all",a=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(It({action:ai(d),id:c}))},onLoadMore:()=>{if(o)return e.planNextCursor!=null&&n(Ce({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));a!=null&&n(i?Ce({cursor:a,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:a,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function Go(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>G(O))),k=y.planFilters.search,b=y.planSort,C=y.planNextCursor,P=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(o)),300);return()=>clearTimeout(O)}),[o]),r.useEffect((()=>{i&&n(ze({cacheOverride:!1,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[i,n,I,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(ze({cacheOverride:!0,planFilters:I,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,I,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Qo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:o,sortState:u,planFilters:I,productFilters:j,sort:S,planNextCursor:C,productNextCursor:P,runningCatalogItemActionId:_,onSearchChange:a,onTabChange:d,onSortChange:m})]})}const zo=T((function(n,e){const t=kt(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(z()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:o}),n(ci({id:i}))}}}))(fn);function Wo(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{o&&t!=null&&n(si({id:t}))}),[o,t,n]),r.useEffect((()=>{if(a==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(z())}}),[a,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCouponFormPage}),s.jsx(zo,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Jo=T((function(n){const e=yt(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:o=>{e(bt(o))},onSubmit:()=>{const o=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:o.customer_id,lineItemCount:o.line_items?.length}),e(gi(o))}}}))(hn);function Xo(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),[i]=W(),{areTenantIdsInSync:o}=F(),a=i.get("customerId"),c=E((C=>yt(C))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((C=>li(C))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,I=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||I,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||a==null||a===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:a})))}),[a,l,n]),r.useEffect((()=>{o&&n(di({cacheOverride:!1}))}),[o,n]);const b=r.useRef(d);return r.useEffect((()=>{const C=b.current;if(b.current=d,C!=="Completed"&&d==="Completed"){const P=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(P)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Jo,{navigate:e,tenantEmailDomain:t})]})}const Yo=T((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(Cn);function ea(){const n=D(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>mi(d,t??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&t!=null&&n(vi({id:t}))}),[o,t,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Yo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:a})]})}const ta=T((function(n){const e=jt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(In);function na(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const C=jt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,creditNoteListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Je({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Je({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Yt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:o=>{n(Ie({id:i,localData:o}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const o=Yt(e.tenantEmailDomain??"",Ee,i),a=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:a}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ie({id:i,localData:o})),n(Dt({id:i}))},onFetchPaymentLinkEmailPreview:o=>n(yi({cacheOverride:o,customerId:i})),onSendPaymentLink:(o,a,c)=>n(ki({body:c,customerId:i,email:o,subject:a})),onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)}}}))(yn);function oa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((M=>Ae(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,I]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&I(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:C,stripeConnected:P}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=C.fetchState==="Error"?C.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{a&&i!=null&&n(hi({id:i}))}),[a,i,n]),r.useEffect((()=>{a&&i!=null&&P&&n(Xe({customerId:i}))}),[a,i,n,P]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n($e()),i!=null&&n(Pt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:o,onAddPaymentMethod:()=>{n(te()),i!=null&&P&&n(Xe({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:C.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:P,onChooseCard:()=>{i!=null&&n(Ii({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ci({customerId:i,data:M}))}}),s.jsx(kn,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=Ae(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,o=i!=null?"edit":"create",a=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),n($e()),n(we(Ee)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ie({id:i,localData:c}))},onOpenAddress:()=>{const c=Yt(e.tenantEmailDomain??"",Ee,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:o}),n(Dt({id:i}))}}}))(xn);function sa(){const n=D(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),{fetchState:c,savedCustomerId:d}=E((l=>Ae(l,i)));return r.useEffect((()=>{a&&i!=null&&n(Pt({id:i}))}),[a,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${o}/invoicing/customers/${encodeURIComponent(l)}`:`/${o}/invoicing/customers`;e(v),n($e())}}),[c,d,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:o})]})}const ca=T((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,o)=>{switch(o){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(Fe({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,customerListFetchState:y}=E((b=>{const C=ue(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,customerListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(Ye({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(Ye({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const be=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view:o}=e,a=i==null?void 0:o.diagnosticsBySession[i],c=a?.fetch.fetchState??"Not-Started";return{diagnostics:a?.items??[],errorMessage:c==="Error"?a?.fetch.error?.message:void 0,expired:a?.expired??!1,filters:t,hasMore:a?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(a?.items.length??0)>0,session:be(o,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:o,sessionId:a,tenantEmailDomain:c,view:d}=e,l=a==null?void 0:d.diagnosticsBySession[a],v=be(d,a),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>o(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&l?.nextCursor!=null&&n(ye({...i,cursor:l.nextCursor,sessionId:a}))},onRetry:v?.status!=="failed"||u?void 0:()=>{a!=null&&n(Te(a))},onRollback:S?()=>{a!=null&&n(Lt(a))}:void 0}}))(jn);function da(){const n=D(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),[a,c]=r.useState({}),d=E(Re),l=be(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{o&&t!=null&&n(ke(t))}),[o,n,t]),r.useEffect((()=>{if(!o||t==null)return;const f=setTimeout((()=>{n(ye({...a,sessionId:t}))}),300);return()=>clearTimeout(f)}),[o,n,a,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!o||t==null||!u)return;const f=setInterval((()=>{n(ke(t)),n(ye({...a,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[o,n,a,u,t]);const m=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;a.moduleId!=null&&f.set("module_id",a.moduleId),a.level!=null&&f.set("level",a.level),a.outcome!=null&&f.set("outcome",a.outcome),a.search!=null&&a.search.trim()!==""&&f.set("search",a.search.trim());const I=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${I===""?"":`?${I}`}`}),[a,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:a,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const en=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=en(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},ua=T((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:o,statusRows:a}=e.view;return{isLoading:!(o.fetchState!=="Not-Started"&&o.fetchState!=="In-Progress"||a.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:a}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,o=a=>{const c=a??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:a}),o(a)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),o()},onRetrySession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:a}),n(Te(a)),o(a)},onRollbackSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:a}),n(Lt(a))},onViewSession:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:a}),t(`/${i}/invoicing/data_import/${encodeURIComponent(a)}`)}}}))(Pn);function ga(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(Re);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const a=o.statusFetch.fetchState==="Completed"&&o.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:a}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:o})]})}const ma=T((function(n,e){const{activeId:t,integrationsView:i,settings:o,view:a}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=a,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:o}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const a=se?.invoicingMicroServiceBaseUrl,c=a!=null&&a.length>0?a:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),n(Di())},onGoToIntegrations:()=>{i(`/${o}/invoicing/settings`)},onGoToOverview:()=>i(`/${o}/invoicing/overview`),onRetry:()=>{t!=null&&n(Te(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Pi(t))},onUpload:a=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:a}))},onViewDetails:t==null?void 0:()=>i(`/${o}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Dn);function va(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),o=E(xt),a=E(Oe).companyId??he.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,a))),d=E(Re),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(_e()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(I=>{if(I==null||I==="")return null;try{return sessionStorage.getItem(en(I))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ke(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:o,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:o=>{n(wt({action:o,id:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:o,id:i}))}}}))(Ln);function fa(){const n=D(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((I=>Li(I,t))),c=a.actionState.fetchState==="In-Progress",d=a.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const m=v===t;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(et({id:t}))}),[o,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{a.fetchState==="Completed"&&(n(z()),n(et({cacheOverride:!0,id:t})),f((I=>I+1)))}),[a.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:a.discountLifecycleActionOptions,editView:a,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,o)=>{n(wt({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function ha(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((C=>{const P=Ft(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:P.sort,nextCursor:P.nextCursor,couponListFetchState:P.fetchState,runningDiscountActionId:P.runningActionId??null}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:a,onStatusChange:C=>n($i(C)),onSortChange:v})]})}const Ca=T((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,o=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCancel:o?()=>n(H({action:"cancel",id:i})):void 0,onResolve:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:o?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ia(){const n=D(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((h=>wi(h,t??""))),c=a.fetchState==="Completed",d=a.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[I,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=a.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,a.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:h,id:t})))}),[t,n,l]),C=r.useMemo((()=>a.emailPreview.preview==null?void 0:{bodyToken:a.emailPreview.preview.bodyToken,renderedHtmlTemplate:a.emailPreview.preview.renderedHtmlTemplate,subjectToken:a.emailPreview.preview.subjectToken}),[a.emailPreview.preview]);r.useEffect((()=>{o&&t!=null&&n(Ri({id:t}))}),[o,t,n]),r.useEffect((()=>{o&&d!=null&&n(Me({invoiceId:d}))}),[o,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{o||(v("idle"),m(!1),f(void 0),j(!1))}),[o]),r.useEffect((()=>{I&&S==null&&a.emailPreview.preview!=null&&f({body:a.emailPreview.preview.body,cc:a.emailPreview.preview.cc,subject:a.emailPreview.preview.subject,to:a.emailPreview.preview.to})}),[a.emailPreview.preview,S,I]),r.useEffect((()=>{l==="pending"&&(a.actionState.fetchState!=="In-Progress"?u&&a.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&a.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,a.actionState.fetchState]);const P=d!=null&&a.linkedInvoice?.id===d?a.linkedInvoice.dunningAttempts:void 0;return U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:a,dunningAttempts:P,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:a.emailPreview.fetchState==="Not-Started"||a.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:I,preview:C,previewErrorMessage:a.emailPreview.fetchState==="Error"?a.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?a.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||n(H({action:o,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const C=Tt(b);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:C.sort,nextCursor:C.nextCursor,dunningCaseListFetchState:C.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(o)),300);return()=>clearTimeout(b)}),[o]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({data:{due_date:o.due_date!==""?o.due_date:void 0,notes:o.notes.trim()!==""?o.notes.split(`
|
|
2
|
-
`).map((a=>a.trim())).filter((a=>a!=="")).map((a=>({note:a}))):void 0,po_number:o.po_number!==""?o.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onVoid:o=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))}}}))(Rn);function xa(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=E((m=>Ot(m,t??""))),c=a.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{o&&t!=null&&n(Mi({invoiceId:t}))}),[o,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:a})]})}const ba=T((function(n){const e=_t(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,o)=>{switch(o){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,o)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function ja(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((C=>{const P=_t(C);return{activeStatus:P.activeTab,appliedSearch:P.filters.search,appliedSort:C.invoicingInvoiceListState.sort,nextCursor:P.nextCursor,invoiceListFetchState:P.fetchState,voidingInvoiceId:P.runningActionId}}),Z),b=y==="Completed";return r.useEffect((()=>{const C=setTimeout((()=>d(o)),300);return()=>clearTimeout(C)}),[o]),r.useEffect((()=>{i&&n(ve({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(ve({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:a,onStatusChange:C=>{n(Ui(C)),n(ve({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=On(),o=ft(),[a,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:a,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:o("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Pa=T((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:o,reasonCodeOptions:a,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:o,reasonCodeOptions:a,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:o=>{n(Qi({localData:o}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Ki())}}}))(Mn);function Da(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),{fetchState:a,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Zi()),m.current=null}),[n,t]),r.useEffect((()=>{o&&t!=null&&n(Me({invoiceId:t}))}),[o,n,t]),r.useEffect((()=>{c!=null&&t!=null&&a==="Completed"&&m.current!==t&&(m.current=t,n(Hi({localData:qi(c)})))}),[n,a,c,t]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Pa,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),a=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(o))}),[i,n,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:a}),s.jsx(La,{navigate:e,selectedPeriod:o,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Zt(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(zi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function wa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:I,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Zt(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),Z),b=y==="Completed",C=`/${t}/invoicing`,P=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${C}/invoices/${encodeURIComponent(R)}`))}),[e,C,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${C}/customers/${encodeURIComponent(O)}`))}),[e,C,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(o)),300);return()=>clearTimeout(_)}),[o]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:a,onTypeChange:_=>{n(Gi(_)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:P})]})}const Fa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=D(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:o}=F(),a=t!=null&&t!=="",c=E(ue),d=E((h=>Wi(h))),l=E(Ji),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Xi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{o&&n(a&&t!=null?Me({invoiceId:t}):Fe({filters:{},keepExistingListItems:!1}))}),[o,n,t,a]),r.useEffect((()=>{a&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Yi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,a]),r.useEffect((()=>{if(a)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,a]);const I=r.useRef(l.fetchState);r.useEffect((()=>{const h=I.current;if(I.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!a||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,a]),C=a?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,P=!a||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:P}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:a?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(C)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(C)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:a?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(a?t??void 0:void 0))}})]})}const tn=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,o=i?.status,a=o!=null&&e.commercialEditAllowedFromStatuses.includes(o);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:a,coupons:t.coupons.map(Oa),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=="",a=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:o?c=>{const d=c?.trim()??"";d!==""&&a("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",xe,i),d=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Ht({id:i}))},onCancelSubscription:o?c=>{a("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:o?(c,d)=>{c!=="pause"?a(c):a(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Ma(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),{areTenantIdsInSync:a}=F(),c=E((k=>Ne(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const I=S===i;Ve(a),r.useEffect((()=>{a&&i!=null&&n(ot({id:i}))}),[a,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Ue()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:o},j)]})}const Na=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},je=(n,e,t)=>{const i=[n,Ua(e,t)].filter((o=>o!=null&&o!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),Se=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:je(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Za=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=T((function(n,e){const t=Ne(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(Se).map((i=>({label:i.name??i.id,subtitle:je(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Za),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(Se).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,o=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Ue()),n(we(xe)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{n(re({id:i,localData:a}))},onOpenAddress:()=>{const a=tn(e.tenantEmailDomain??"",xe,i),c=X(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:o}),n(Ht({id:i}))}}}))(Zn);function qa(){const n=D(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:o}=w(),[a]=W(),{areTenantIdsInSync:c}=F(),d=a.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ne(S,i).localData));Ve(c),r.useEffect((()=>{c&&(n(Fe({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${o}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${o}/invoicing/subscriptions`;e(f),n(Ue())}}),[l,v,i,n,e,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:o})]})}const Ka=T((function(n){const e=Kt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(o,a,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:a,subscriptionId:o}),n(qt({action:a,id:o,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(o,a)=>{const c=a?.trim()??"";c!==""&&i(o,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(o,a,c)=>{a!=="pause"?i(o,a):i(o,a,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(o,a)=>{i(o,"cancel",{cancel_reason_code:a.cancelReasonCode,end_of_term:!1,...a.cancelReason!=null&&a.cancelReason.trim()!==""?{cancel_reason:a.cancelReason.trim()}:{}})},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:o}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Hn);function Qa(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[o,a]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:I,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((P=>{const h=Kt(P);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),Z),b=y==="Completed";r.useEffect((()=>{const P=setTimeout((()=>d(o)),300);return()=>clearTimeout(P)}),[o]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==I?.field||u?.dir!==I?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,I]);const C=r.useRef(k);return r.useEffect((()=>{const P=C.current!=null&&k==null;C.current=k,P&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:o,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:a,onStatusChange:P=>n(so(P)),onSortChange:v})]})}const Ga=T((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:o,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(o)}`)},onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onSubscriptionClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:o,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(o)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function za(){const n=D(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:o}=F(),a=E((d=>ro(d,i??""))),c=a.fetchState==="Completed";return r.useEffect((()=>{o&&i!=null&&n(lo({id:i}))}),[o,i,n]),U(a.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(Ga,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:a})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function Y(n){const e=D(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:o,fieldHelp:a,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I}=E(Qt),j=E(Le);Be({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(Oe),k=n==="dunning"||n==="quickbooks",b=y.companyId??he.getSignedInUserTenant(i??"")?.companyId,C=E((A=>$t(A,b))),P=mo(y.userRole??[]),h=y.tenantId??"",_=he.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),Ze=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(o!=="Not-Started"&&o!=="Error"||e(_e()))}),[t,e,o]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ke.shouldFetchActiveTenant(h)&&(Ke.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=o==="Not-Started"||o==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=o==="Completed"&&(!k||u==="Completed"),He=C.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,ge=se?.invoicingMicroServiceBaseUrl,qe=ge!=null&&ge.length>0?`${ge}/1.0/webhooks/stripe`:"",me={deleteConnectionError:C.externalConnections?.deleteConnectionError?.message,deleteConnectionState:C.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:C,isAdmin:P,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{C.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(A,q)=>{He!=null&&h!==""&&e(ko(h,He,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:C.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:C.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:a,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:me,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:I,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Io(A,q)),onReconnectQBO:me.onReconnectQBO,onRefreshQBO:me.onRefreshQBO,onRetryQboSyncTask:A=>e(zt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Co({settings:A,snackbarSection:Wa[n??""]}))},onStartQboBackfill:A=>e(Gt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=J(),i=D(),{tenantEmailDomain:o}=w(),a=Y("branding"),c=E((v=>bo(v))),d=E((v=>jo(fe,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Po()),i(we(fe)))}),[c.saveState.fetchState,i]);const l=St(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Kn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:a.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:a.deleteFileStatusById,filesEndPoint:a.filesEndPoint,isLoading:a.isLoading,isSaving:a.isSaving,localData:c.localData,saveErrorMessage:a.saveErrorMessage,settings:a.settings,updateFileStatusById:a.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Lo({localData:v}))},onDeleteFile:a.onDeleteFile,onEditFileName:a.onEditFileName,onOpenAddress:()=>{const v=`/${o}/invoicing/settings/branding/${fe}/`,u=X(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Do()),updateFilesEntity:a.updateFilesEntity})]})}function Ja(){const n=L(),e=Y("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Xa(){const n=L(),e=Y("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Ya(){const n=L(),e=Y("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const es=T((function(n){const e=Jt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(zt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(Gt(e))}}}))(Wn);function ts(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),i=E(Oe),{configFetchState:o,settingsFetchState:a}=E(Jt);return r.useEffect((()=>{a!=="Not-Started"&&a!=="Error"||n(_e())}),[n,a]),r.useEffect((()=>{o==="Not-Started"&&n(le())}),[o,n]),Be({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=D(),t=L(),[i,o]=W(),a=Y(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];o({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,o]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:a.isInvoicingPageReady}),s.jsx(Jn,{analytics:p,integrationsSectionProps:{...a.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:a.isLoading,meetingUrl:n("invoicing_settings"),settings:a.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Ya,{})}),s.jsx(x,{path:"branding",element:s.jsx(vt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(vt,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Xa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ja,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=D(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:o,fetchState:a,status:c}=E(Nt),d=St(o.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Le(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(a!=="Not-Started"?a!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,a]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&o.fetchState==="Completed"&&(e(`${l}/catalog`),n(Ro()))}),[d,o.fetchState,l,n,e]),c==null&&a!=="Error"?s.jsx(Xn,{}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Xo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Da,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(za,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ia,{})}),s.jsx(x,{path:"catalog",element:s.jsx(Go,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as g}from"./liveblocks-mJJR3MsR.js";import{a as u}from"./sentry-CItQHKpv.js";import{u as U,g as _,h as w,t as A,j as l,N as L}from"./core-CMivCywN.js";import{z as r,E as M,G as P,N as V,h as N,Q as G,_ as R,$,S as B}from"./index-DlMGj3Af.js";import{fB as Q,Tb as W,TE as q,Tv as H,ge as J,gg as K,TA as X,gR as Y,df as Z,TF as ee,TG as te}from"./zeni-epic-state-CqKBThJ0.js";import{n as ne}from"./mui-C6XtNCo7.js";import{u as se}from"./useDeviceId-DJLfe-br.js";import{f as ae}from"./analyticsHelper-Cypw_xC0.js";import{t as ie}from"./getLocaleForTenant-DCXbCJAu.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new t.Error().stack;a&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[a]="68449ed2-1325-47d3-b7ab-3940db2ed5da",t._sentryDebugIdIdentifier="sentry-dbid-68449ed2-1325-47d3-b7ab-3940db2ed5da")}catch{}})();const C=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ce(){const t=U(),a=_(),f=w(),[k]=A(),n=k.get("token"),p=k.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:E,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),h=l((e=>e.tenantState.signInState)),I=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>Q(e))),b=l((e=>W(e))),D=r.getSignedInUser(),v=M().mode;u.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&C(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(q(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),u.useEffect((()=>{h!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(b.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(X("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,v,void 0,b.tenantsInOrder),Y().then((()=>{const e=B();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(G.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[h,S,y,s,o,b,v,a.state,t]);const F=u.useCallback((()=>{f("/signin/auth")}),[f]),j=u.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),O=u.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(I==="Completed"&&d!=null)return g.jsx(R,{phoneNumber:E,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:O,onCancelVerifyDevice:F});if(h==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return g.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!C(n,p)||m==null||I==="Error"){const e=a.state?.origin??"/",T=n!=null&&r.getLastUsedMagicLinkToken()===n;return g.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:T,magicLinkExpired:!T&&(r.isMagicLinkTriggered(n??"")||I==="Error"&&s?.zeniSessionId==null)}})}return g.jsx(oe,{"data-testid":"smooth-loader",children:g.jsx($,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Ce as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-mJJR3MsR.js";import{h as r,l as i}from"./core-CMivCywN.js";import{am as n}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import"./sentry-CItQHKpv.js";import"./zeni-epic-state-CqKBThJ0.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var 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-mJJR3MsR.js";import ut from"./NotFoundScreen-fxNT7vgC.js";import{a as k}from"./sentry-CItQHKpv.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-CMivCywN.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-CqKBThJ0.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-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{u as Lt}from"./useAskAiCfoHostNavButtonProps-eZEppiJu.js";import{u as Vt}from"./useTaskManagerAccess-B7jKkFFv.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},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-mJJR3MsR.js";import{a as r}from"./sentry-CItQHKpv.js";import{u as A,g as j,j as o,N as x}from"./core-CMivCywN.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-CqKBThJ0.js";import{z as h,ah as I}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var 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 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./liveblocks-mJJR3MsR.js";import{h as K,u as H,g as Q,i as X,j as d,l as Z,n as ee,o as C}from"./core-CMivCywN.js";import{fB as M,zu as R,us as ae,UJ as w,un as T,bq as te,b_ as se,uo as oe,UK as re,Ur as S,e8 as ne,Dg as ce,UL as ie,DE as le,dV as de,dU as me}from"./zeni-epic-state-CqKBThJ0.js";import{ai as fe,z as pe,aq as ue,as as he,J as ge,O as q,y as _,a8 as Fe,h as B,aD as be,p as Ie}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import Ce from"./NotFoundScreen-fxNT7vgC.js";import{F as Se}from"./FeaturePreviewScreen-B_aYJlol.js";import{a as g}from"./sentry-CItQHKpv.js";import{u as Te}from"./useAskAiCfoHostNavButtonProps-eZEppiJu.js";import{u as ye}from"./useInitialThreadRequest-DBDsuRGA.js";import{t as De}from"./routePaths-Bpj3i3MK.js";import{M as Ae}from"./MobileAppDrawer-CcN5sT0f.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="d736be17-d1d4-4c7e-883e-84a4db026b5d",s._sentryDebugIdIdentifier="sentry-dbid-d736be17-d1d4-4c7e-883e-84a4db026b5d")}catch{}})();const y=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},xe=Z((function(s){const e=re(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:B}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(T(a)),y(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(le(a))},onForecastVsActualsCompareToggle:a=>{s(ie(a)),s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(ce(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=ne(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=De(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),m=Ie(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:m,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(S({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(S({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(be);function v(){const s=fe(),e=K(),a=H(),o=Q(),{forecastId:r,tenantEmailDomain:c}=X(),[p,u]=g.useState(!1),[m,D]=g.useState(!1),F=pe.getSignedInUser(),A=d((t=>M(t))),$=A.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),x=d((t=>t.profitAndLossState)),E=d((t=>t.reportUIOptionsState.selectedForecast)),L=t=>x.pandLByForecastID[t]!=null&&oe(t,x).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:b}=ue();he({isDataReady:l});const{isAiCfoAccessEnabled:N,onAskAiCfoClick:G}=Te({mobileExploreReferrer:"Forecast"});g.useEffect((()=>{if(!p&&b)u(!0),l||a(ae());else if(l&&!m){D(!0);const t=((f,P,O)=>P!=null?f.forecasts.findIndex((I=>I.id===P)):O!=null?f.forecasts.findIndex((I=>I.id===O)):f.forecasts.length>0?0:-1)(i,r,E?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=E?.index?(a(w(i.forecasts[t].id,t)),y(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&y(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!L(i.forecasts[t].id)&&b&&a(T(i.forecasts[t].id))}}),[p,u,a,l,i,m,D,R,T,b]);const U=ge(),V=U?.loggedInUserRole!=null&&te(U.loggedInUserRole),{useFeatureGate:W}=q(),{isFeatureEnabled:j}=W(_.isReportsCommentingEnabled),Y=ye(j?A?.companyId:void 0,{clearParams:l&&m}),[z,J]=g.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",F?.firstName??""),h.searchParams.set("lastname",F?.lastName??""),h.searchParams.set("email",F?.userEmail??"");const k=t=>{J(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(Fe,{analytics:B,onLoad:t=>(f=>f.trackForecast())(t)}):null,n.jsx(Ae,{isAppContentDrawerOpen:z,handleDrawerToggle:k}),n.jsx(xe,{firstMonthOfFY:$,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:L,meetingUrl:se(h.toString()),hasTransactionAccess:V,isAiCfoAccessEnabled:N,onAskAiCfoClick:G,isReportsCommentingEnabled:j,initialOpenThreadRequest:Y,onClickMenuIcon:()=>{k(!0)}})]})}function He(){const s=d((c=>M(c))),{useFeatureGate:e}=q(),{isFeatureEnabled:a}=e(_.isDebitCardFeatureEnabled),o=de(a,s),r=me(s);return o===!0||r===!0?n.jsx(Se,{}):n.jsxs(ee,{children:[n.jsx(C,{path:"/",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId",element:n.jsx(v,{})}),n.jsx(C,{path:"/:forecastId/*",element:n.jsx(Ce,{})})]})}export{He as default};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-mJJR3MsR.js";import{a as d}from"./sentry-CItQHKpv.js";import{D as c,F as r,a9 as m,ad as f,ae as h}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{i as y}from"./core-CMivCywN.js";import"./zeni-epic-state-CqKBThJ0.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cfa0f651-32b4-433a-a231-fe07ba5399f5",e._sentryDebugIdIdentifier="sentry-dbid-cfa0f651-32b4-433a-a231-fe07ba5399f5")}catch{}})();const g=c("div")`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
width: 100%;
|
|
5
|
-
min-height: 100vh;
|
|
6
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
7
|
-
`,k=c("header")`
|
|
8
|
-
flex-shrink: 0;
|
|
9
|
-
padding: ${r.sp3} ${r.sp4};
|
|
10
|
-
`,b=c(m)`
|
|
11
|
-
width: ${r.sp4};
|
|
12
|
-
height: ${r.sp4};
|
|
13
|
-
color: ${e=>e.theme.colors.brandColorJade};
|
|
14
|
-
`,x=c("main")`
|
|
15
|
-
display: flex;
|
|
16
|
-
flex: 1 1 auto;
|
|
17
|
-
flex-direction: column;
|
|
18
|
-
align-items: center;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
padding: ${r.sp4};
|
|
21
|
-
`;function j({children:e}){return a.jsxs(g,{"data-testid":"invoicing-collect-payment-layout",children:[a.jsx(k,{children:a.jsx(b,{"aria-label":"Zeni",role:"img"})}),a.jsx(x,{children:e})]})}class w extends Error{statusCode;constructor(t,o){super(t),this.name="PortalRequestError",this.statusCode=o}}function $(e,t){const o=(function(){const n=h?.invoicingMicroServiceBaseUrl;return`${n!=null&&n.length>0?n:""}/1.0`})(),s={namespace:e,token:t};async function i(n,u){const l=await fetch(`${o}${n}`,{body:JSON.stringify(u),headers:{"Content-Type":"application/json"},method:"POST"}),p=await l.json();if(!l.ok)throw new w(p.status?.message??`Request failed (${l.status}).`,l.status);return p.data}return{checkoutSession:()=>i("/portal/payment-link/checkout-session",s),plaidLinkToken:()=>i("/portal/payment-link/plaid-link-token",s),requestAccess:()=>i("/portal/payment-link/request-access",s),savePaymentMethod:n=>i("/portal/payment-link/payment-methods",{...s,...n}),session:()=>i("/portal/payment-link/session",s),setupIntent:()=>i("/portal/payment-link/setup-intent",s)}}function B(){const{namespace:e="",token:t=""}=y();d.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]);const o=d.useMemo((()=>$(e,t)),[e,t]);return a.jsx(j,{children:a.jsx(f,{portal:o})})}export{B as default};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-mJJR3MsR.js";import{UF as re,fB as Y,lX as _,dV as N,dU as le,Rx as Q,U2 as de,Cd as Pe,UG as J,C2 as je,Cn as Le,Ch as ce,C6 as pe,Cl as ve,Ci as Te,UH as ue,rI as Ae,g2 as Fe,gA as Re,UI as H,Ca as me,C9 as ge,Cq as Oe,c7 as Ve}from"./zeni-epic-state-CqKBThJ0.js";import{a1 as Ce,O as X,y as G,z as K,f as fe,I as he,af as ye,az as be,aA as Ue,ab as Se,F as O,ag as we,G as W,aB as Be,aq as Ze,as as $e,a8 as ze,h as xe,Q as He,p as Ge,aC as _e,J as Ke}from"./index-DlMGj3Af.js";import{D as De,n as q,S as Ie}from"./mui-C6XtNCo7.js";import ae from"./NotFoundScreen-fxNT7vgC.js";import{a as d}from"./sentry-CItQHKpv.js";import{u as ee,i as We,j as g,h as qe,g as Me,l as Je,n as se,o as z}from"./core-CMivCywN.js";import{u as Ye}from"./useAskAiCfoHostNavButtonProps-eZEppiJu.js";import{M as Ne}from"./MobileAppDrawer-CcN5sT0f.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";(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]="75daab97-0c44-46a7-b556-e36f3b4e5039",e._sentryDebugIdIdentifier="sentry-dbid-75daab97-0c44-46a7-b556-e36f3b4e5039")}catch{}})();const Qe={overlayWidth:new Se(100,100,48)},te=W.getLocalizedStrings().peoplePage.invitePage,ne=W.getLocalizedStrings().common,Xe=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:C,isEditPeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[V,U]=d.useState(!1),[k,S]=d.useState(!1),{userId:w}=We(),r=g((l=>re(l))),p=g((l=>Y(l))),E=g((l=>_(l))),{useFeatureGate:D}=X(),{isFeatureEnabled:I}=D(G.isDebitCardFeatureEnabled),P=N(I,p),v=le(p),T=Q(p),B=de(p),Z=!!p.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,x=!P&&E&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.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=()=>{V===!0?S(!0):h()},$=c.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=D(G.isChargeCardFeatureEnabled),L=fe(p,j,I),{isCardsHidden:F}=he(p?.tenantId),y=!L||F,R=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:R===!1,isLiteRoleDisabled:B===!1,isBankingOnlyTenant:P,isCardsOnlyTenant:v,onResetClick:h,onDeleteUser:l=>{m(pe(l.userId,l.userRole.userRoleId))},onPeopleLocalDataUpdated:l=>{m(ce({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 d.useEffect((()=>{x===!1&&w!=null&&m(Pe(w))}),[x,w]),d.useEffect((()=>{r.updatePersonState.fetchState==="Completed"&&h()}),[r.updatePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:Qe.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=q(Ie)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,ke=q(we.H6Regular)`
|
|
6
|
-
margin-top: ${O.sp7};
|
|
7
|
-
padding-left: ${O.sp8};
|
|
8
|
-
padding-right: ${O.sp8};
|
|
9
|
-
color: ${e=>e.theme.colors.primary};
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
`,Ee=q(we.LargeRegularSp)`
|
|
12
|
-
color: ${e=>e.theme.colors.hero};
|
|
13
|
-
padding-left: ${O.sp8};
|
|
14
|
-
padding-right: ${O.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${O.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=W.getLocalizedStrings().peoplePage.invitePage,ie=W.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:C,isInvitePeopleDrawerOpen:i,closeDrawerHandler:b})=>{const f=Ce(),m=ee(),[V,U]=d.useState(!1),[k,S]=d.useState(!1),w=g((o=>re(o))),r=g((o=>Y(o))),p=g((o=>_(o))),{useFeatureGate:E}=X(),{isFeatureEnabled:D}=E(G.isDebitCardFeatureEnabled),I=N(D,r),P=le(r),v=Q(r),T=de(r),B=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,Z=!I&&p&&n.fetchState!=="Completed"||t.fetchState!=="Completed"||c.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=()=>{V===!0?S(!0):x()},A={onOkClick:()=>{S(!1),x()},onCancelClick:()=>{S(!1)}},$=c.companyView?.controllers.map((o=>o.user)),u=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=E(G.isChargeCardFeatureEnabled),L=fe(r,j,D),{isCardsHidden:F}=he(r?.tenantId),y=!L||F,R=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:C,isZeniTenant:v,onPeopleLocalDataUpdated:o=>{m(ce({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:R===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:Z};return d.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=q(Ie)`
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 100%;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
`,na=Je((function(e,t){const c=ue(e),n=K.getSignedInUser();return{data:c,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:c,companyId:n,shouldFetchClasses:C}=t;return{personAction:{onPersonDelete:(i,b)=>{e(pe(i,b))},onResendInvite:i=>{e(Oe(i))},onReloadPeople:()=>{e(me()),e(ge(n,C))},onBackClick:()=>{c("../../")},onModeChange:i=>{e(H({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(H({searchText:i}))}}}}))(_e);function M({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=qe(),n=ee(),C=Me(),{areTenantIdsInSync:i}=Ze(),b=K.getSignedInUser(),f=g((s=>Y(s))),{useFeatureGate:m}=X(),{isFeatureEnabled:V}=m(G.isDebitCardFeatureEnabled),U=g((s=>_(s))),k=!N(V,f)&&U,S=Q(f),w=f?.tenantId,{tenantEmailDomain:r}=f,[p,E]=d.useState(!1),[D,I]=d.useState(!1),[P,v]=d.useState(!1),[T,B]=d.useState("off"),[Z,x]=d.useState(!1),h=s=>{x(s)},{isAiCfoAccessEnabled:A,onAskAiCfoClick:$}=Ye({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ae(s.classState,s.classListState))),L=g((s=>Fe(s.userState,s.userRoleState,s.userListViewState,"manager"))),F=g((s=>Re(s))),y=f?.companyId;d.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]),d.useEffect((()=>{y!=null&&i&&n(ge(y,k))}),[y,k,i]),d.useEffect((()=>{I(e!=null&&e===!0),v(t!=null&&t===!0&&t)}),[e,t]),d.useEffect((()=>{n(H({searchText:"",sortKey:"name",sortOrder:"ascending"}))}),[]);const R=()=>{I(!1),v(!1),c("../")};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:R,isInvitePeopleDrawerOpen:D,managersListView:L,companyPassportView:F,classListView:j,companyId:y,mode:u.uiState.mode}):null,P===!0?a.jsx(Xe,{closeDrawerHandler:R,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:F,classListView:j,companyId:y,mode:u.uiState.mode}):null,a.jsx(Ne,{isAppContentDrawerOpen:Z,handleDrawerToggle:h}),a.jsx(na,{navigate:c,signedInUser:b,isZeni:f.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:y,shouldFetchClasses:k,classList:j,managersView:L,peopleView:u,onInvitePeopleClick:()=>{c("./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);c(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:A,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Ve(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(M,{})}),a.jsx(z,{path:"new",element:a.jsx(M,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(M,{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-mJJR3MsR.js";import E from"./NotFoundScreen-fxNT7vgC.js";import{a as r}from"./sentry-CItQHKpv.js";import{h as _,g as U,j as p,i as v,u as M,N as P,l as z,n as B,o as h}from"./core-CMivCywN.js";import{fB as N,a0h as b,bo as O,bn as F,iI as V,gd as $}from"./zeni-epic-state-CqKBThJ0.js";import{U as q,z as I,as as G,dN as H}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{u as J}from"./useAskAiCfoHostNavButtonProps-eZEppiJu.js";import{M as K}from"./MobileAppDrawer-CcN5sT0f.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";(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]="b2634089-8656-4399-a072-ff5995ad4c64",e._sentryDebugIdIdentifier="sentry-dbid-b2634089-8656-4399-a072-ff5995ad4c64")}catch{}})();const L=z((function(e){const t=I.getSignedInUser(),c=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:c??""},{aggregatedReportViewState:n}=b(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=U(),c=q(),o=p((a=>N(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:f}=v(),u=M(),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,d=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"||d(a,i,!0),m.current=!0}),[n?.fetchState,d]),j=r.useCallback(((a,i)=>{d(a,i,!1)}),[d]),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:c,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 he(){return s.jsxs(B,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(E,{})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-mJJR3MsR.js";import W from"./NotFoundScreen-fxNT7vgC.js";import{a as p}from"./sentry-CItQHKpv.js";import{h as C,g as D,u as V,j as u,N as k,l as U,n as Y,o as b}from"./core-CMivCywN.js";import{fB as E,Yl as h,YC as R,MY as N,MU as B,MX as m,MN as L,Y$ as $,MR as z,M_ as K}from"./zeni-epic-state-CqKBThJ0.js";import{z as M,w as T,c9 as X,l as _,bS as q,ca as F}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import{u as G,R as x}from"./ReimbursementApprovalRuleDetailScreen-DetQk8QU.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new e.Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="edf24354-90fc-4dfa-ad31-57cd9b2fd812",e._sentryDebugIdIdentifier="sentry-dbid-edf24354-90fc-4dfa-ad31-57cd9b2fd812")}catch{}})();const A="reimbursement-approval-rule-update",H=U((function(e){return{approvalView:h(e),remiSetupApproverViewUpdateData:R(e).remiSetupApproverViewUpdateData}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(A)&&e($(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!1))},onEditRuleClick:t=>{t!=null?(e(m(t)),n(`./${t}/edit`)):(e(m()),n("./new"))}}}))(T(X)),J=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),S=u((o=>o.remiSetupApproverViewState.fetchState)),c=u((o=>E(o))),d=u((o=>h(o))),g=u((o=>R(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{g?.updateStatus.fetchState==="Completed"&&a(N())}),[g]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!1)))}),[t,S,e,a]),M.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{d.allApprovalRules.length===0&&d.fetchState==="Completed"&&(v||(w(!0),a(m())),s("./new"))}),[v,d,a]);const f={events:c.companyId!=null?[`private-encrypted-${c.companyId}.${A}`]:[],eventCallback:(o,y,j)=>{o.endsWith(A)&&j.onApprovalRulesEventReceived(o)}};return c?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(H,{currentTenant:c,location:n,navigate:s,...f})},I="reimbursement-approval-rule-update",P=U((function(e){const s=h(e),n=R(e).remiSetupApproverViewUpdateData,a={};for(const l of Object.values(e.vendorState.vendorByID))l?.id!=null&&(a[l.id]=l.name);const t={};for(const l of Object.values(e.classState.classesByKey))l?.classId!=null&&(t[l.classId]=l.className);return{approvalView:s,remiSetupApproverViewUpdateData:n,vendorNamesById:a,departmentNamesById:t}}),(function(e,s){const{navigate:n,location:a}=s;return{onApprovalRulesEventReceived:t=>{t.endsWith(I)&&e($(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e(L(t,!0))},onEditRuleClick:t=>{t!=null?(e(m(t)),n(`./${t}/edit`)):(e(m()),n("./new"))},onReorderRules:t=>{e(K(t,!0))}}}))(T(F)),Q=()=>{const e=u((a=>E(a))),{isApprovalRulesV3Enabled:s,isLoading:n}=q(e?.tenantId);return s?r.jsx(Z,{isLoading:n}):r.jsx(J,{isLoading:n})},Z=({isLoading:e})=>{const s=C(),n=D(),a=V(),[t,l]=p.useState(!1),[v,w]=p.useState(!1),[S,c]=p.useState(!1),d=u((i=>i.remiSetupApproverViewState.fetchState)),g=u((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),f=u((i=>E(i))),o=u((i=>h(i)));G();const y=u((i=>R(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(N())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(B(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||g!=="Not-Started"||e||(w(!0),a(z(!1,!0)))}),[v,g,e,a]),M.getSignedInUser()==null)throw Error("Can't access reimbursement approval without signing in...");p.useEffect((()=>{o.allApprovalRules.length===0&&o.fetchState==="Completed"&&(S||(c(!0),a(m())),s("./new"))}),[S,o,a]);const j={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${I}`]:[],eventCallback:(i,ee,O)=>{i.endsWith(I)&&O.onApprovalRulesEventReceived(i)}};return f?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(P,{currentTenant:f,location:n,navigate:s,isLoading:e,...j})};function le(){return r.jsxs(Y,{children:[r.jsx(b,{path:"/",element:r.jsx(Q,{})}),r.jsx(b,{path:"/new",element:r.jsx(x,{})}),r.jsx(b,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(b,{path:"*",element:r.jsx(W,{})})]})}export{le as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as p}from"./liveblocks-mJJR3MsR.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-CMivCywN.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 Qe,Ua as Ze,Ub as Je,Uc as Xe,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-CqKBThJ0.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,J as Ta,d as Ua,ar as ka,as as ja,a8 as Da,h as N,Q as Oa,s as Fa,p as _e,at as Aa,au as Pa,av as Ea}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import La from"./NotFoundScreen-fxNT7vgC.js";import{F as Ba}from"./FeaturePreviewScreen-B_aYJlol.js";import{a as u}from"./sentry-CItQHKpv.js";import{u as Ma}from"./useInitialThreadRequest-DBDsuRGA.js";import{t as ne,a as re,b as va}from"./routePaths-Bpj3i3MK.js";import{M as Va}from"./MobileAppDrawer-CcN5sT0f.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";import"./InboxNotificationsProvider-BIRPulc1.js";import"./useTaskManagerAccess-B7jKkFFv.js";(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]="ea6a9797-59be-42fd-b001-14830da72113",e._sentryDebugIdIdentifier="sentry-dbid-ea6a9797-59be-42fd-b001-14830da72113")}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:k(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(Xe({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",k(t)),e(U(l?"cash_flow_by_classes":r?"balance_sheet_by_classes":"profit_and_loss_by_classes"))):a==="project"?(o.analytics?.trackGroupBySwitch("Projects",k(t)),e(U(l?"cash_flow_by_projects":r?"balance_sheet_by_projects":"profit_and_loss_by_projects"))):(o.analytics?.trackGroupBySwitch("Accounts",k(t)),e(U(l?"cash_flow":r?"balance_sheet":"profit_and_loss"))),y(e)},onUpdateClassesToFilterOut:a=>{S(o.selectedReportID)?e(Qe({classesToFilterOut:a})):I(o.selectedReportID)?e(Ze({classesToFilterOut:a})):e(Je({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),[Q,fe]=u.useState(!1),{isFeatureEnabled:Z}=l(q.isReportsCommentingEnabled);if(i==null)throw Error("Can't access reports page without signing in...");const j=d((n=>$(n))),me=j.masterTOSInfo?.isMasterTOSAccepted??!1,ue=j.company?.companyInfo.firstMonthOfFY??1,be=Ma(Z?j?.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&&!Q&&w==="Completed"&&b&&(s(F(i.userId,!1,!0,!1)),fe(!0))}),[c,Q,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 J=Ta(),we=J?.loggedInUserRole!=null&&ve(J?.loggedInUserRole)!==!0,[ge,Se]=u.useState(!1),X=n=>{Se(n)},Ie=Ua(),Re=ka();return(function(n){const{isDataReady:Te}=n,{pathname:Ue}=W(),K=Ca(Ue??"")==="reports",ke=wa(Te),je=u.useMemo((()=>K?xa:void 0),[K]);ga({canFetchSuggestedQuestions:ke,pageContexts:je})})({isDataReady:w==="Completed"}),ja({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:X}),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:X,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:Z,initialOpenThreadRequest:be})]})}const k=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-mJJR3MsR.js";import{z as w,a8 as N,h as u,Q as S,e1 as E,O as k,y as I}from"./index-DlMGj3Af.js";import"./mui-C6XtNCo7.js";import g from"./NotFoundScreen-fxNT7vgC.js";import{a as c}from"./sentry-CItQHKpv.js";import{u as C,j as h,h as F,g as L,l as T,n as U,o as d,N as y}from"./core-CMivCywN.js";import{fB as _,a17 as j,a18 as p,D6 as P,pX as V,a19 as z,D4 as B}from"./zeni-epic-state-CqKBThJ0.js";import"./recharts-Co0_Dmc-.js";import"./analytics-BgUj-hR5.js";import"./plaid-l8YRzpBD.js";import"./dnd-B8NpvFCU.js";import"./stripe-cKAAJElX.js";import"./lottie-BTBtSLCO.js";import"./lexical-Di6ZXkXF.js";import"./pdf-DSDpdkmb.js";import"./utils-macSqF2O.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="168b6d01-c071-4f69-ae02-07dddc650759",e._sentryDebugIdIdentifier="sentry-dbid-168b6d01-c071-4f69-ae02-07dddc650759")}catch{}})();const G=T((function(e,t){const n=j(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=w.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])})),u.trackInviteEmailClicked("send",s,r,s.length)}e(B())},onUpdateInviteFormLocalData:s=>{e(z({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&u.trackInviteEmailClicked("cancel")}}}))(E),O=()=>{const e=C(),[t,n]=c.useState(!1),[i,s]=c.useState(!1),r=h((o=>_(o))),l=F(),x=L(),f=w.getSignedInUser();if(f==null)throw Error("Can't access invite referral screen without signing in...");const m=h((o=>j(o))),b=f?.firstName!=null?f.firstName:"User";c.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),c.useEffect((()=>{t||m.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[m.fetchState,e]);const D=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[m.fetchState==="Completed"?a.jsx(N,{analytics:u,onLoad:o=>(v=>v.trackPageLoaded(S.Event.inviteEmailViewed))(o)}):null,a.jsx(G,{navigate:l,location:x,currentTenant:r,companyName:D,userName:b,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(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"how-it-works",element:a.jsx(y,{to:"refer",replace:!0})}),a.jsx(d,{path:"refer/*",element:t?a.jsx(O,{}):a.jsx(g,{})}),a.jsx(d,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import{j as E}from"./liveblocks-mJJR3MsR.js";import{a as I}from"./sentry-CItQHKpv.js";import{i as M,u as q,h as W,g as z,j as h,l as Z}from"./core-CMivCywN.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 ge,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 fe,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-CqKBThJ0.js";import{a4 as ae,aY as ne,aZ as ze,z as qe,g as Ze,a7 as Xe,a8 as le,h as O,av as He,a_ as Qe,p as _,G as he,U as me,a$ as et,b0 as tt,b1 as at}from"./index-DlMGj3Af.js";import{n as pe}from"./mui-C6XtNCo7.js";import{p as nt}from"./pathToGoBack-DkQc48Fj.js";import K from"./NotFoundScreen-fxNT7vgC.js";import{c as V}from"./routePaths-Bpj3i3MK.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]="dc49822a-1283-45e4-95d8-6bb44c3c76df",e._sentryDebugIdIdentifier="sentry-dbid-dc49822a-1283-45e4-95d8-6bb44c3c76df")}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:f,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&&f.fetchState==="Not-Started"&&n(Je(s))}),[s,c,f.fetchState]),I.useEffect((()=>{n(Ne({scheduleType:"prepaid_expenses",shouldResetEnteredData:!1}))}),[n]),s==null?E.jsx(K,{}):c==null?f.fetchState==="Not-Started"||f.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(ge(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))),f=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&&f!=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[f]})]}):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((f=>f.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(ge(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:f,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||f==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(),f=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 g=A==="Completed"&&r===!0,p=y.selectedJEAccruedSchedule!=null;return A==="Completed"||A==="Not-Started"||d===!0&&p?E.jsxs(ot,{children:[g===!0?E.jsx(le,{analytics:O,onLoad:()=>{ut(y,T,P)}}):null,E.jsx(dt,{isRenderedInPanel:d,onPanelNavigateBack:s,setShouldNavigateBack:c,scheduleAccruedDetailsView:y,location:f,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)}`,f=_(l.state?.pathnameStackToGoBack,l.pathname);d(o,{state:{pathnameStackToGoBack:f,message:"comingFromScheduleDetailsFixedAssets"}})},onViewLinkedJE:c=>{const o=`${V(c,t.tenantEmailDomain)}`,f=_(l.state?.pathnameStackToGoBack,l.pathname);d(o,{state:{pathnameStackToGoBack:f}})},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:f,scheduleDetailsListSection:D}=c,{scheduleClass:C,scheduleExpenseCategory:x,accumulatedDepreciationCategory:r,assetId:k,months:i,startDate:m,postingDate:S,vendor:L}=f,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:f}=M(),D=t??f,C=s.state?.message==="expenseAutomation",x=mt(D),r=h((g=>g.scheduleDetailState.selectedJEScheduleKey));I.useEffect((()=>{r!=null&&r.length!==0||D!=="new"||l("../schedules/fixed_assets")}),[r,D]);const k="fixed_assets",i=h((g=>te(g,k))),m=h((g=>g.entityAutoCompleteState.autoCompleteText.common)),S=h((g=>ue(g,"common"))),L=h((g=>ie(g))),b=h((g=>g.classListState.fetchState)),T=h((g=>X(g))),y=h((g=>fe(g).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:g,year:p}=y;l(`../../month_end_close_checks/review/je_schedules/${g}-${p}`)}else l("../schedules/fixed_assets")}),[i.markAsCompleteStatus.fetchState]);const J=h((g=>F(g))),N=h((g=>H(g,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:(g,p)=>{n(Ce(g,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})},gt=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,ft=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:f}=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=f.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,f]=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=>fe(p).selectedPeriod)),N=T!=="Completed"||y!=="Completed";I.useEffect((()=>{o===!1&&N?(u(Ee(m,$,!0)),f(!0)):N===!1&&o===!1&&(u(De(m,r==="new"?void 0:r,!0)),f(!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,g=S.selectedJEScheduleTransaction!=null;return P==="Completed"||e===!0&&g?E.jsxs(gt,{children:[Y===!0?E.jsx(le,{analytics:O,onLoad:()=>{kt(S,m,j)}}):null,E.jsx(ft,{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};
|