@zeniai/web-app-ui 5.3.39-qa → 5.3.40-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AccountMappingScreen-BAU-qRLp.js → AccountMappingScreen-BIUIsIRE.js} +2 -2
- package/dist/assets/AddressRoutes--gUEIlXc.js +1 -0
- package/dist/assets/AddressScreen-Bej9zQot.js +9 -0
- package/dist/assets/{AiCfoScreen-BBf4eJEu.js → AiCfoScreen-BQaocZqa.js} +1 -1
- package/dist/assets/{AppDrawer-DcpLPX_Z.js → AppDrawer-BYM-DSkR.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-DGoaGoSS.js → BillPayApprovalRoutes-qtIPcgB0.js} +1 -1
- package/dist/assets/BillPayRoutes-CnpuGuHe.js +119 -0
- package/dist/assets/{BusinessVerificationPageScreen-DhS4fDp-.js → BusinessVerificationPageScreen-D2Ary0QP.js} +1 -1
- package/dist/assets/{CardsAiCfoScreen-bSLoVBaQ.js → CardsAiCfoScreen-V1ZiSm5h.js} +3 -3
- package/dist/assets/{ChargeCardRoutes-D6hDp1gd.js → ChargeCardRoutes-DgTzZTph.js} +1 -1
- package/dist/assets/{CompanyPassportScreen-B7AZ6muL.js → CompanyPassportScreen-CNlNZlol.js} +1 -1
- package/dist/assets/ConnectionAuthScreen-5CXbYx5t.js +11 -0
- package/dist/assets/CustomerOnboardingAuthScreen-Dwb1vXcC.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-BPlSTemN.js → CustomerOnboardingRoutes-BKJm_JEE.js} +3 -3
- package/dist/assets/{DashboardRoutes-DhTtyJA8.js → DashboardRoutes-BKHZJKkt.js} +1 -1
- package/dist/assets/{DefaultTenantHome-CpmWOufA.js → DefaultTenantHome-ttl2hapk.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-BZaPu7aX.js +18 -0
- package/dist/assets/{DrawerScreen-CQsaXCgG.js → DrawerScreen-CeUxZGpo.js} +1 -1
- package/dist/assets/EntityDetailRoutes-CjcEzz2g.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-DTV4TgBw.js → ExpenseAutomationRoutes-BJzy8xal.js} +6 -6
- package/dist/assets/FeaturePreviewScreen-ClB4hfhH.js +1 -0
- package/dist/assets/{HubSpotOAuthCallbackScreen-C1pwTZXw.js → HubSpotOAuthCallbackScreen-CvNAfhTh.js} +1 -1
- package/dist/assets/{InboxNotificationsProvider-ChJcQEgX.js → InboxNotificationsProvider-BU6hQETc.js} +1 -1
- package/dist/assets/InvoicingRoutes-B1gAqEf9.js +2 -0
- package/dist/assets/{MagicLinkRoutes-8SaxPcKe.js → MagicLinkRoutes-B0E48n4q.js} +20 -20
- package/dist/assets/MagicLinkSignInScreen-DmrCJmgr.js +12 -0
- package/dist/assets/{MobileAppDrawer-vlvV1xit.js → MobileAppDrawer-ezuGFNmX.js} +1 -1
- package/dist/assets/NotFoundScreen-BHK2wcy4.js +1 -0
- package/dist/assets/{NotificationRoutes-CvNrjMdZ.js → NotificationRoutes-CJaAWW0k.js} +1 -1
- package/dist/assets/{OAuthConsentScreen-pnOHcvlx.js → OAuthConsentScreen-Lh-iiFIq.js} +1 -1
- package/dist/assets/{PandLWithForecastRoutes-BiFB7431.js → PandLWithForecastRoutes-BbdTHIrJ.js} +1 -1
- package/dist/assets/{PaymentLinkScreen-CwOwoApf.js → PaymentLinkScreen-DtmVsAJS.js} +5 -5
- package/dist/assets/PeopleRoutes-CNtwYayL.js +22 -0
- package/dist/assets/PerformanceRoutes-DKKm8Wqd.js +1 -0
- package/dist/assets/{Preview-Cd0OfxQN.js → Preview-Cbn9H8uJ.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-B0L_AclK.js → QBOConnectionScreen-IJewO3Tq.js} +23 -23
- package/dist/assets/ReimbursementApprovalRoutes-CaWqEdpt.js +1 -0
- package/dist/assets/{ReimbursementApprovalRuleDetailScreen-B4mlHv4v.js → ReimbursementApprovalRuleDetailScreen-C9pFfWce.js} +1 -1
- package/dist/assets/{ReimbursementRoutes-Cmi5XSLV.js → ReimbursementRoutes-DxyXmLRP.js} +7 -7
- package/dist/assets/{ReportsRoutes-Ca9z0dzs.js → ReportsRoutes-C6GStBGQ.js} +1 -1
- package/dist/assets/RewardsRoutes-DsLNX64E.js +1 -0
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-CVl3oEan.js → ScheduleDetailsPrepaidExpensesScreen-BsuRR9R3.js} +4 -4
- package/dist/assets/ScreenRoutes-L97Vug0k.js +2 -0
- package/dist/assets/{SettingsRoutes-CIQIbtA4.js → SettingsRoutes-BOJoESyV.js} +6 -6
- package/dist/assets/{SetupPagesScreen-CaMzRKH4.js → SetupPagesScreen-D-0MxRfj.js} +5 -5
- package/dist/assets/SignInScreen-BE9J9fIz.js +1 -0
- package/dist/assets/SignOutScreen-CTevoMDc.js +9 -0
- package/dist/assets/{TaskListScreen-4UaZwa55.js → TaskListScreen-CnVcsAwc.js} +2 -2
- package/dist/assets/{TaskRoutes-BfExYi8s.js → TaskRoutes-CQy6J4IF.js} +2 -2
- package/dist/assets/TransactionDetailRoutes-WkmYYr0f.js +1 -0
- package/dist/assets/{TransactionDetailScreen-Cb5yfs3f.js → TransactionDetailScreen-DE0VBfkC.js} +1 -1
- package/dist/assets/{TransactionListRoutes-ChMw7wyY.js → TransactionListRoutes-D9kITRhY.js} +1 -1
- package/dist/assets/{TreasuryRoutes-SVHz5bxI.js → TreasuryRoutes-C6jv6nMF.js} +1 -1
- package/dist/assets/{VendorsRoutes-DB7RgtWf.js → VendorsRoutes-CaVrball.js} +17 -17
- package/dist/assets/{WiseConfirmationScreen-Cjt7egwc.js → WiseConfirmationScreen-CzbEV-Z5.js} +1 -1
- package/dist/assets/{ZeniAccountRoutes-B2j4f9z0.js → ZeniAccountRoutes-GdGf0SYA.js} +9 -9
- package/dist/assets/{ZeniAccountStatementScreen-Bpw3ybwZ.js → ZeniAccountStatementScreen-Cy-_EAj7.js} +2 -2
- package/dist/assets/{accountMappingHelper-C4bJZjrw.js → accountMappingHelper-DeDocU0d.js} +1 -1
- package/dist/assets/{analytics-D7uefUiL.js → analytics-N153TuwK.js} +1 -1
- package/dist/assets/{analyticsHelper-B-a7Fayn.js → analyticsHelper-Cw60VlOq.js} +1 -1
- package/dist/assets/{core-C_niDoeS.js → core-1xnf2RtE.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-DRmjOSrJ.js → decodeURIComponentSafe-DcD-XNVX.js} +1 -1
- package/dist/assets/{dnd-D1zQ4XOY.js → dnd-DsH8jkrb.js} +1 -1
- package/dist/assets/{empty-D4px1jRa.js → empty-Cvto7Qa_.js} +1 -1
- package/dist/assets/{empty-plTjK7bM.js → empty-GMcl-a5k.js} +1 -1
- package/dist/assets/{emptyVideoElement-CWvA7PC9.js → emptyVideoElement-3SZu1zsn.js} +1 -1
- package/dist/assets/{epic-B98c-3UB.js → epic-FXcGvl3F.js} +2 -2
- package/dist/assets/{expenseAutomationHelper-KeB0Y2So.js → expenseAutomationHelper-CNRtAWpH.js} +1 -1
- package/dist/assets/{getLocaleForTenant-DPltcijU.js → getLocaleForTenant-Cb4ANH4Q.js} +1 -1
- package/dist/assets/{index-BBoA-o2I.js → index-B9A0BRu3.js} +1 -1
- package/dist/assets/{index-BjhJNDPV.js → index-Bdznf1tI.js} +1 -1
- package/dist/assets/{index-Cgw2Iyxl.js → index-BuVXkUYw.js} +2 -2
- package/dist/assets/{index-Ffv7Gw0d.js → index-CAK36XTm.js} +1 -1
- package/dist/assets/{index-CNYHEI30.js → index-C_EhkY0q.js} +1 -1
- package/dist/assets/{index-Bd0MxrbX.js → index-Ctq16f6K.js} +1 -1
- package/dist/assets/{index-yYSNW2wj.js → index-Dc3AC-iD.js} +1 -1
- package/dist/assets/{index-BdTIsd0C.js → index-nXM19luG.js} +25828 -25822
- package/dist/assets/{lexical-DIbwTPqX.js → lexical-d2so_3As.js} +1 -1
- package/dist/assets/{liveblocks-CCDNnA6G.js → liveblocks-C_WAhyd7.js} +1 -1
- package/dist/assets/{lottie-Cik7Vc5G.js → lottie-NIzYzhlS.js} +1 -1
- package/dist/assets/{mui-CG0oORSs.js → mui-BAsIRnB1.js} +1 -1
- package/dist/assets/{pathToGoBack-Cbtxs9kR.js → pathToGoBack-BmzgWhs1.js} +1 -1
- package/dist/assets/{pdf-B5xhf5T3.js → pdf-BKNPlqtE.js} +4 -4
- package/dist/assets/{pdf-lib-DAt-g1mM.js → pdf-lib-RqzDns79.js} +1 -1
- package/dist/assets/{plaid-b9MOUNjK.js → plaid-dW1_MCaE.js} +1 -1
- package/dist/assets/{pusher-C2RLrGqG.js → pusher-BVnEdZ0V.js} +1 -1
- package/dist/assets/{react-B9DEESnS.js → react-BFlpt3K4.js} +1 -1
- package/dist/assets/{react-CsqZDgs-.js → react-ClcLrViu.js} +1 -1
- package/dist/assets/{react-DgJ83_B3.js → react-Dq2pDn48.js} +1 -1
- package/dist/assets/{react-C_QLEWRr.js → react-gANl8FSl.js} +1 -1
- package/dist/assets/{react-CoD7nOAo.js → react-hvFnEVKT.js} +1 -1
- package/dist/assets/{react-D5wI2pEw.js → react-xy8FhgjK.js} +1 -1
- package/dist/assets/{recharts-7qGQ-5hE.js → recharts-C2rsrRI6.js} +1 -1
- package/dist/assets/{routePaths-Bhwno7et.js → routePaths-WEgtxKVV.js} +1 -1
- package/dist/assets/{sentry-BjDPgsoW.js → sentry-lC29HHPj.js} +1 -1
- package/dist/assets/{url-CItIJO-P.js → url-B8rnjauu.js} +1 -1
- package/dist/assets/{url-C475xLhj.js → url-LYbpMOZt.js} +1 -1
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CQRJq0ZV.js → useAiCfoDashboardSuggestedQuestionsChips-DJIBd7UL.js} +1 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CRADLi0_.js +1 -0
- package/dist/assets/{useChargeCardPusherEvents-CPwkVP5N.js → useChargeCardPusherEvents-BwfDpPGN.js} +1 -1
- package/dist/assets/{useDeviceId-C5uH2VJL.js → useDeviceId-BX84j5B2.js} +1 -1
- package/dist/assets/{useEmailConnectResultRefresh-DKKrSHiH.js → useEmailConnectResultRefresh-f-R3NS2J.js} +1 -1
- package/dist/assets/{useInitialThreadRequest-rxOpZrgz.js → useInitialThreadRequest-CbTk8gTV.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-DbCLyiws.js → useTaskManagerAccess-CCKD6ndI.js} +1 -1
- package/dist/assets/{utils-D17QWGSb.js → utils-BBaMea9r.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-DkNsltpW.js → withTransactionSidePanel-D-Ctl_K2.js} +1 -1
- package/dist/assets/{zeni-epic-state-B-J-Dqbg.js → zeni-epic-state-BVNUxmav.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-Dv524oDL.js +0 -1
- package/dist/assets/AddressScreen-CE2tz7A0.js +0 -9
- package/dist/assets/BillPayRoutes-HEjZO-kj.js +0 -119
- package/dist/assets/ConnectionAuthScreen-aCmL-CWB.js +0 -11
- package/dist/assets/CustomerOnboardingAuthScreen-5FJVZkWH.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-Yv6wkPjU.js +0 -18
- package/dist/assets/EntityDetailRoutes-DUPgSWiB.js +0 -1
- package/dist/assets/FeaturePreviewScreen-BLAUJ7pd.js +0 -1
- package/dist/assets/InvoicingRoutes-CC22gTlb.js +0 -2
- package/dist/assets/MagicLinkSignInScreen-CMaVR3FF.js +0 -12
- package/dist/assets/NotFoundScreen-D5e2DgC8.js +0 -1
- package/dist/assets/PeopleRoutes-DCZg6uXB.js +0 -22
- package/dist/assets/PerformanceRoutes-DR8cl8Ny.js +0 -1
- package/dist/assets/ReimbursementApprovalRoutes-4hrtdQB2.js +0 -1
- package/dist/assets/RewardsRoutes-hIB4j24u.js +0 -1
- package/dist/assets/ScreenRoutes-DYMsPfJf.js +0 -2
- package/dist/assets/SignInScreen-DVFajMjZ.js +0 -1
- package/dist/assets/SignOutScreen-CNNmoHlp.js +0 -9
- package/dist/assets/TransactionDetailRoutes-lbbanXrr.js +0 -1
- package/dist/assets/useAskAiCfoHostNavButtonProps-CHt7UN_l.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CCDNnA6G.js";import{a as r}from"./sentry-BjDPgsoW.js";import{u as P,h as L,i as w,j as E,t as W,l as T,s as Z,g as J,N as B,n as ie,o as x}from"./core-C_niDoeS.js";import{a8 as ln,j as p,aq as F,U as g,cb as dn,cc as un,cd as gn,ce as mn,cf as vn,cg as pn,ch as fn,ci as Sn,cj as hn,ck as In,cl as Cn,cm as En,cn as kn,co as yn,k as Y,cp as xn,cq as bn,ae as se,cr as jn,cs as Dn,z as Ie,ct as Pn,cu as Ln,cv as An,cw as $n,cx as wn,cy as Fn,cz as Rn,cA as Tn,V as On,ai as ft,cB as _n,cC as Mn,cD as Nn,cE as Un,cF as Bn,cG as Vn,cH as Zn,cI as Hn,cJ as qn,t as Ke,l as St,cK as Kn,cL as Qn,cM as zn,cN as Gn,cO as Wn,cP as Jn,cQ as Yn}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import{A as K}from"./AddressScreen-CE2tz7A0.js";import N from"./NotFoundScreen-D5e2DgC8.js";import{Z0 as Xn,Z1 as ei,uP as Qe,Z2 as Q,vg as ce,Z3 as Pe,Z4 as z,vT as ze,v_ as ti,w3 as ht,Z5 as Le,Z6 as It,vX as Ct,Z7 as Ae,vV as Et,yz as ni,vW as ii,vP as oi,xq as Ge,vf as Ce,Z8 as ai,Z9 as kt,wa as si,Za as G,wh as ci,Zb as ri,Zc as yt,Zd as xt,yl as li,Ze as ue,Zf as We,Zg as bt,vd as di,Zh as ui,v7 as gi,Zi as mi,xD as vi,Zj as jt,xM as Je,Zk as pi,xJ as fi,Zl as $e,gg as Si,Zm as te,Zn as ne,ww as hi,vl as Ye,Zo as we,vq as Dt,vo as Ii,vi as Ci,wp as Ei,vs as ki,wy as yi,Zp as Ee,wF as Pt,wD as ke,Fo as Fe,xS as Xe,Zq as xi,ve as Re,Zr as Te,vB as ye,vy as xe,vL as Lt,vK as Oe,vv as bi,vE as At,vN as oe,fE as _e,UP as $t,vh as Me,vI as ji,vJ as Di,vH as Pi,Zs as Li,wd as et,wi as Ai,we as wt,Zt as Ft,v1 as tt,Zu as $i,uZ as Rt,Zv as wi,xY as Fi,y0 as H,xX as Ri,x4 as Ne,Zw as Ti,Zx as Tt,y9 as nt,Zy as Oi,y6 as _i,Zz as Ot,x7 as Mi,x8 as V,xb as Ni,ZA as _t,xl as pe,ZB as Ui,wx as Mt,Tm as Nt,ZC as Bi,xv as Vi,ZD as Ut,ZE as Zi,ZF as Hi,ZG as qi,y_ as Ki,ZH as Qi,ZI as Bt,yg as Vt,ZJ as Zt,yY as fe,ZK as zi,yV as Gi,ZL as Wi,ZM as Ji,ZN as Yi,ZO as Xi,ZP as eo,ZQ as it,ZR as to,z2 as no,ZS as Ue,wP as ot,ZT as Be,ZU as re,wZ as Ht,wU as qt,wS as be,ZV as io,wK as oo,ym as Kt,yN as at,yI as ao,ZW as so,yn as co,ZX as ro,yO as lo,yS as uo,ZY as go,ZZ as Qt,c8 as mo,mr as vo,ms as po,Z_ as st,vU as le,gk as fo,uf as So,my as ho,yF as zt,ze as Io,yC as Gt,ul as Co,zb as ct,u9 as Eo,z8 as rt,hR as ko,TP as lt,TQ as yo,FA as Wt,hJ as xo,Z$ as bo,UE as jo,_0 as Do,zk as Se,zl as Po,_1 as Lo,_2 as Jt,zh as Ao,_3 as $o,_4 as wo,xz as Fo,_5 as Ro}from"./zeni-epic-state-B-J-Dqbg.js";import{M as To}from"./MobileAppDrawer-vlvV1xit.js";import{q as de}from"./QBOConnectionScreen-B0L_AclK.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.js";import"./InboxNotificationsProvider-ChJcQEgX.js";import"./useTaskManagerAccess-DbCLyiws.js";import"./empty-plTjK7bM.js";import"./pdf-lib-DAt-g1mM.js";import"./index-Bd0MxrbX.js";import"./url-C475xLhj.js";import"./index-yYSNW2wj.js";import"./decodeURIComponentSafe-DRmjOSrJ.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]="4c48da7f-1f7f-4096-a02c-e28af338cfc9",n._sentryDebugIdIdentifier="sentry-dbid-4c48da7f-1f7f-4096-a02c-e28af338cfc9")}catch{}})();const $=({event:n,isReady:e=!0})=>e?s.jsx(ln,{analytics:p,onLoad:t=>t.trackPageLoaded(n)}):null;function U(...n){return n.some((e=>e==="Error"))}function Oo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),{fetchState:m,hasMore:S,items:f,nextCursor:C,auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y}=E(Xn),k=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),b=`/${t??""}/invoicing`,I=r.useCallback(((O,R)=>{const M=ei(b,O,R,j);M!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{entity:O,entityId:R,fromScreen:"audit_log"}),e(M))}),[j,e,b]);r.useEffect((()=>{const O=setTimeout((()=>d(a)),300);return()=>clearTimeout(O)}),[a]),r.useEffect((()=>{i&&n(Qe({filters:k,keepExistingListItems:!1,sort:u}))}),[i,k,u,n]);const D=m==="Not-Started"||m==="In-Progress"&&f.length===0,h=m==="In-Progress"&&f.length>0,_=m==="Completed";return U(m)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingAuditLogPage,isReady:_}),s.jsx(dn,{auditLogEntityRouteOptions:j,auditLogListSortFieldOptions:y,entries:f,hasMore:S,isLoading:D,isLoadingMore:h,searchValue:a,sortState:l,onEntityLinkClick:I,onLoadMore:()=>{S&&C!=null&&n(Qe({cursor:C,filters:k,keepExistingListItems:!0,sort:u}))},onSearchChange:o,onSortChange:v})]})}function ge(n,e=!1){const t=P(),i=E((c=>Q(c).productNextCursor!=null)),a=E((c=>Q(c).productNextCursor)),o=E((c=>Q(c).productFetchState.fetchState));r.useEffect((()=>{n&&(e&&o!=="Not-Started"||t(ce({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[n,t,e]),r.useEffect((()=>{n&&o!=="In-Progress"&&i&&a!=null&&t(ce({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[n,t,o,i,a])}const _o=new Set(["plan"]),Yt=[],Mo=It((n=>n.length>0?n:Yt),mn),No=It((n=>n.length>0?n:Yt),gn),Uo=T((function(n,e){const{view:t}=e;return{applicableItemOptions:t.applicableItemOptions,groupedAccountOptions:Mo(t.qboAccountHierarchy),groupedClassOptions:No(t.qboClassHierarchy),catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:t.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",itemId:e.itemId,localData:t.localData,plan:t.plan}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${t}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&n(Ct({action:a,id:i}))}:void 0,onEditChange:a=>{i!==""&&n(Le({id:i,localData:a}))},onSaveEdit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemEdited,{itemId:i}),n(ht({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&n(ti({action:o,id:a,parentItemId:i}))}}}))(un);function Bo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[a]=W(),{areTenantIdsInSync:o}=F(),c=(d=a.get("kind"))!=null&&_o.has(d)?d:"plan";var d;const l=E((k=>Pe(k,t))),{pageFetchState:v}=l,u=v.fetchState;r.useEffect((()=>(n(z()),()=>{n(z())})),[n]),r.useEffect((()=>{o&&n(ze({id:t,kind:c}))}),[o,t,c,n]);const[m,S]=r.useState(0);r.useEffect((()=>{l.fetchState==="Completed"&&(n(z()),n(ze({cacheOverride:!0,id:t,kind:c})),S((k=>k+1)))}),[l.fetchState,n,t,c]);const f=u==="Completed";ge(o,!0);const[C,j]=r.useState(f?t:void 0);r.useEffect((()=>{t!=null&&f&&j(t)}),[t,f]);const y=C!==t&&(u==="Not-Started"||u==="In-Progress");return U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemDetailPage,isReady:f}),s.jsx(Uo,{navigate:e,tenantEmailDomain:i,itemId:t??"",kind:c,isLoading:y,view:l},m)]})}function Ve(n={}){const{enabled:e=!0,fetchSyncHealth:t=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=n,o=P(),{areTenantIdsInSync:c}=F(),d=E(Ae),l=d.connection?.connected===!0,v=d.connectionFetchState.fetchState;return r.useEffect((()=>{e&&c&&(a&&v!=="Not-Started"||o(Et()),t&&o(ni()))}),[c,o,e,t,a]),r.useEffect((()=>{e&&c&&l&&i&&o(ii())}),[c,o,e,l,i]),{isQboConnected:l,qboView:d}}const Vo=new Set(["addon","charge","plan"]),Zo=new Set(["plan"]),Ho=T((function(n,e){const t=Pe(n,e.itemId);return{fieldHelp:t.fieldHelp,isQboPickerDataLoading:t.isQboPickerDataLoading,qboClassHierarchy:t.qboClassHierarchy,qboAccountHierarchy:t.qboAccountHierarchy,applicabilityValues:t.applicabilityValues,periodUnitOptions:t.periodUnitOptions,trialEndActionOptions:t.trialEndActionOptions,trialUnitOptions:t.trialUnitOptions,typeOptions:t.typeOptions,applicableItemOptions:t.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save catalog item.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,pricingModelValues:t.pricingModelValues,prorationValues:t.prorationValues,tierTypeOptionsByPricingModel:t.catalogTierTypeOptionsByPricingModel,tierTypeValues:t.tierTypeValues}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.isEdit?"edit":"create",{itemId:a}=e,o=a!=null?`${t}/catalog/${encodeURIComponent(a)}`:`${t}/catalog`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemFormCancelled),n(z()),e.navigate(`${t}/catalog`)},onChange:c=>{n(Le({id:a,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemSaved,{mode:i}),n(ht({id:a}))}}}))(vn);function qo(){const n=P(),e=L(),{item_id:t,tenantEmailDomain:i}=w(),[a]=W(),{areTenantIdsInSync:o}=F(),c=t!=null,d=a.get("type"),l=d!=null&&Vo.has(d)?d:void 0,v=(u=a.get("kind"))!=null&&Zo.has(u)?u:"plan";var u;const m=E((S=>Pe(S,t)));return ge(o,!0),Ve({loadAccountingPickers:!0,reuseCached:!0}),r.useEffect((()=>{o&&t!=null&&n(oi({id:t,kind:v}))}),[o,t,v,n]),r.useEffect((()=>{c||l==null||m.localData.catalogType===l||n(Le({localData:{...m.localData,catalogType:l}}))}),[c,l,m.localData?.catalogType,n]),r.useEffect((()=>{if(m.fetchState==="Completed"){const S=m.savedItemId??t,f=S!=null?`/${i}/invoicing/catalog/${encodeURIComponent(S)}`:`/${i}/invoicing/catalog`;e(f),n(z())}}),[m.fetchState,m.savedItemId,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogItemFormPage}),s.jsx(Ho,{navigate:e,tenantEmailDomain:i,defaultType:l,isEdit:c,itemId:t})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Qo=T((function(n,e){const t=Q(n),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?t.plans:a?[...t.plans,...t.products]:t.products,c=i||a&&t.fetchState==="In-Progress"?t.fetchState:t.productFetchState.fetchState;return{catalogItemLifecycleActionOptions:t.catalogItemLifecycleActionOptions,counts:t.count,countsLoading:t.countsFetchState.fetchState==="Not-Started"||t.countsFetchState.fetchState==="In-Progress",hasMore:i?t.planNextCursor!=null:a&&t.planNextCursor!=null||t.productNextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress"&&o.length===0,isLoadingMore:c==="In-Progress"&&o.length>0,plans:t.plans,productColumns:t.productColumns,products:t.products}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=e.activeTab==="plans",a=e.activeTab==="all",o=i?e.planNextCursor:e.productNextCursor;return{activeTab:e.activeTab,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTabChange:e.onTabChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${t}/data_import`)},onAddItem:()=>{const c=Ko[e.activeTab];p.trackInvoicingActionClick(g.Event.invoicingAddCatalogItemClicked,{itemType:c}),e.navigate(`${t}/catalog/new?type=${c}`)},onItemClick:(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingCatalogItemRowClicked,{itemId:d}),e.navigate(`${t}/catalog/${encodeURIComponent(d)}`)},onCatalogItemLifecycleAction:(c,d)=>{n(Ct({action:ai(d),id:c}))},onLoadMore:()=>{if(a)return e.planNextCursor!=null&&n(Ce({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&n(ce({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&n(i?Ce({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):ce({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(pn);function zo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState("plans"),[l,v]=r.useState(""),[u,m]=r.useState(null),S=r.useMemo((()=>u!=null?{dir:u.direction,field:u.columnKey}:void 0),[u]),f=l.trim()!==""?l.trim():void 0,C=r.useMemo((()=>({search:f,type:"plan"})),[f]),j=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),y=E((O=>Q(O))),k=y.planFilters.search,b=y.planSort,I=y.planNextCursor,D=y.productNextCursor,h=y.fetchState==="Completed",_=y.runningActionId??null;return r.useEffect((()=>{const O=setTimeout((()=>v(a)),300);return()=>clearTimeout(O)}),[a]),r.useEffect((()=>{i&&n(Ge({cacheOverride:!1,planFilters:C,productFilters:j,planSort:S,productSort:S}))}),[i,n,C,j,S]),r.useEffect((()=>{i&&(f!==k||S?.field!==b?.field||S?.dir!==b?.dir)&&n(Ge({cacheOverride:!0,planFilters:C,productFilters:j,planSort:S,productSort:S}))}),[k,b,i,n,C,j,f,S]),U(y.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCatalogPage,isReady:h}),s.jsx(Qo,{navigate:e,tenantEmailDomain:t,activeTab:c,searchValue:a,sortState:u,planFilters:C,productFilters:j,sort:S,planNextCursor:I,productNextCursor:D,runningCatalogItemActionId:_,onSearchChange:o,onTabChange:d,onSortChange:m})]})}const Go=T((function(n,e){const t=kt(n,e.couponId);return{fieldHelp:t.fieldHelp,applyOnOptions:t.applyOnOptions,discountTypeOptions:t.discountTypeOptions,durationTypeOptions:t.durationTypeOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save coupon.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,periodUnitOptions:t.periodUnitOptions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/discounts/${encodeURIComponent(i)}`:`${t}/discounts`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponFormCancelled),n(G()),e.navigate(`${t}/discounts`)},onChange:c=>{n(ri({id:i,localData:c}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCouponSaved,{mode:a}),n(ci({id:i}))}}}))(fn);function Wo(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,savedCouponId:c}=E((d=>kt(d,t)));return r.useEffect((()=>{a&&t!=null&&n(si({id:t}))}),[a,t,n]),r.useEffect((()=>{if(o==="Completed"){const d=c??t,l=d!=null?`/${i}/invoicing/discounts/${encodeURIComponent(d)}`:`/${i}/invoicing/discounts`;e(l),n(G())}}),[o,c,t,n,e,i]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCouponFormPage}),s.jsx(Go,{couponId:t,navigate:e,tenantEmailDomain:i})]})}const Jo=T((function(n){const e=yt(n);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(n){return{dispatch:n}}),(function(n,{dispatch:e},t){const i=`/${t.tenantEmailDomain}/invoicing`;return{...n,onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceCancelled),t.navigate(`${i}/invoices`)},onChange:a=>{e(bt(a))},onSubmit:()=>{const a=ui(n.localData);p.trackInvoicingActionClick(g.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length}),e(gi(a))}}}))(hn);function Yo(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),[i]=W(),{areTenantIdsInSync:a}=F(),o=i.get("customerId"),c=E((I=>yt(I))),d=c.fetchState,l=c.localData,v=c.savedInvoiceId,u=E(xt),m=E((I=>li(I))),S=E(ue),f=m.fetchState==="Not-Started"||m.fetchState==="In-Progress"&&u==null,C=S.fetchState==="Not-Started"||S.fetchState==="In-Progress"&&S.customers.length===0,j=f||C,y=m.fetchState==="Completed"&&S.fetchState==="Completed";r.useEffect((()=>(n(We()),()=>{n(We())})),[n]);const k=r.useRef(!1);r.useEffect((()=>{k.current||o==null||o===""||l.customerId!==""||(k.current=!0,n(bt({...l,customerId:o})))}),[o,l,n]),r.useEffect((()=>{a&&n(di({cacheOverride:!1}))}),[a,n]);const b=r.useRef(d);return r.useEffect((()=>{const I=b.current;if(b.current=d,I!=="Completed"&&d==="Completed"){const D=v!=null?`/${t}/invoicing/invoices/${encodeURIComponent(v)}`:`/${t}/invoicing/invoices`;e(D)}}),[d,v,e,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreateInvoicePage,isReady:y}),j?s.jsx(Sn,{}):s.jsx(Jo,{navigate:e,tenantEmailDomain:t})]})}const Xo=T((function(n,e){const{detailView:t}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:t.creditNote,creditNoteId:e.creditNoteId,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${t}/credits`),onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)}}}))(In);function ea(){const n=P(),e=L(),{credit_note_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((d=>mi(d,t??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&t!=null&&n(vi({id:t}))}),[a,t,n]),U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditDetailPage,isReady:c}),s.jsx(Xo,{navigate:e,tenantEmailDomain:i,creditNoteId:t??"",detailView:o})]})}const ta=T((function(n){const e=jt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:t==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${t}/data_import`)},onCreditNoteClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${t}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(fi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Cn);function na(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,creditNoteListFetchState:y}=E((b=>{const I=jt(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,creditNoteListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(Je({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(Je({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCreditsListPage,isReady:k}),s.jsx(ta,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(pi(b)),onSortChange:v})]})}const Xt=(n,e,t)=>{const i=`/${n}/invoicing/customers/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},ia=T((function(n,e){const{editView:t,hasLoadedRecord:i}=e;return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,customer:t.record.invoicingCustomer,invoices:t.record.invoices.slice(0,5),isLoading:!i&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),hasPaymentLinkEmailPreviewFailed:t.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:t.emailPreviewFetchState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",paymentLinkEmailPreview:t.emailPreview,isSendingPaymentLink:t.record.sendLinkState.fetchState==="In-Progress",localData:t.localData,paymentMethods:t.record.paymentMethods,sendPaymentLinkErrorMessage:t.record.sendLinkState.fetchState==="Error"?t.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:t.record.sendLinkState.fetchState==="Completed"?t.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:t.record.stripeConnected}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${t}/customers`),onChange:a=>{n(Ee({id:i,localData:a}))},onCreateInvoice:()=>e.navigate(`${t}/invoices/create`),onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>e.onCreatePromotionalCredits(),onNewSubscription:()=>e.navigate(`${t}/subscriptions/new`),onOpenAddress:()=>{const a=Xt(e.tenantEmailDomain??"",ke,i),o=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${t}/settings/payment-destination`),onSaveEdit:a=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerEdited,{customerId:i}),n(Ee({id:i,localData:a})),n(Pt({id:i}))},onFetchPaymentLinkEmailPreview:a=>n(yi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,c)=>n(ki({body:c,customerId:i,email:a,subject:o})),onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)}}}))(yn);function oa(){const n=P(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),c=E((M=>$e(M,i))),d=c.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(!1),[m,S]=r.useState(!1),[f,C]=r.useState(c.record.fetchState==="Completed"?i:void 0);r.useEffect((()=>{i!=null&&c.record.fetchState==="Completed"&&C(i)}),[i,c.record.fetchState]);const j=f===i,{plaidTokenFetchState:y,promotionalCreditSubmitState:k}=c,{paymentMethodSaveState:b,setupIntentFetchState:I,stripeConnected:D}=c.record,h=r.useRef(c.record.sendLinkState.fetchState);r.useEffect((()=>{const M=c.record.sendLinkState.fetchState;h.current!=="Error"&&M==="Error"&&n(Si({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),h.current=M}),[n,c.record.sendLinkState.fetchState]);const _=I.fetchState==="Error"?I.error?.message??"Failed to start card setup.":b.fetchState==="Error"?b.error?.message??"Failed to save payment method.":y.fetchState==="Error"?y.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(n(te()),n(ne()),()=>{n(te()),n(ne())})),[n]),r.useEffect((()=>{t.state?.openPromotionalCreditsDialog===!0&&(S(!0),e(t.pathname,{replace:!0,state:null}))}),[t.pathname,t.state,e]),r.useEffect((()=>{o&&i!=null&&n(hi({id:i}))}),[o,i,n]),r.useEffect((()=>{o&&i!=null&&D&&n(Ye({customerId:i}))}),[o,i,n,D]);const[O,R]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(we()),i!=null&&n(Dt({id:i})),R((M=>M+1)))}),[c.fetchState,n,i]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerDetailPage,isReady:l}),s.jsx(ia,{customerId:i??"",editView:c,hasLoadedRecord:j,location:t,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{n(te()),i!=null&&D&&n(Ye({customerId:i})),u(!0)},onCreatePromotionalCredits:()=>{n(ne()),S(!0)}},O),s.jsx(En,{errorMessage:_,isCreatingSetupIntent:I.fetchState==="In-Progress",isSaving:b.fetchState==="In-Progress",open:v,plaidLinkToken:c.record.plaidLinkToken,saveSucceeded:b.fetchState==="Completed",setupIntent:c.record.setupIntent,stripeConnected:D,onChooseCard:()=>{i!=null&&n(Ci({customerId:i}))},onClose:()=>{u(!1),n(te())},onSavePaymentMethod:M=>{i!=null&&n(Ii({customerId:i,data:M}))}}),s.jsx(kn,{currentBalance:c.record.invoicingCustomer?.promotionalCredits,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:k.fetchState==="Error"?k.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:k.fetchState==="In-Progress",open:m,submitSucceeded:k.fetchState==="Completed",onClose:()=>{S(!1),n(ne())},onSubmit:({amount:M,description:ee})=>{i!=null&&n(Ei({amount:M,customerId:i,currencyCode:c.record.invoicingCustomer?.preferredCurrencyCode,description:ee}))}})]})}const aa=T((function(n,e){const t=$e(n,e.customerId);return{fieldHelp:t.fieldHelp,billingAddressLabel:t.billingAddressLabel,customerTypeOptions:t.customerTypeOptions,netTermDayOptions:t.netTermDayOptions,taxabilityOptions:t.taxabilityOptions,errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save customer.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?"edit":"create",o=i!=null?`${t}/customers/${encodeURIComponent(i)}`:`${t}/customers`;return{onBack:()=>e.navigate(o),onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerFormCancelled),n(we()),n(Fe(ke)),e.navigate(`${t}/customers`)},onChange:c=>{n(Ee({id:i,localData:c}))},onOpenAddress:()=>{const c=Xt(e.tenantEmailDomain??"",ke,i),d=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerSaved,{mode:a}),n(Pt({id:i}))}}}))(xn);function sa(){const n=P(),e=L(),t=J(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),{fetchState:c,savedCustomerId:d}=E((l=>$e(l,i)));return r.useEffect((()=>{o&&i!=null&&n(Dt({id:i}))}),[o,i,n]),r.useEffect((()=>{if(c==="Completed"){const l=d??i,v=l!=null?`/${a}/invoicing/customers/${encodeURIComponent(l)}`:`/${a}/invoicing/customers`;e(v),n(we())}}),[c,d,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomerFormPage}),s.jsx(aa,{customerId:i,location:t,navigate:e,tenantEmailDomain:a})]})}const ca=T((function(n){const e=ue(n),{fetchState:t}=e;return{addressesById:n.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.customers.length===0,isLoadingMore:t==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddCustomerClicked),e.navigate(`${t}/customers/new`)},onCustomerClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${t}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${t}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":e.navigate(`${t}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":e.navigate(`${t}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":e.navigate(`${t}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&n(Re({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(bn);function ra(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,customerListFetchState:y}=E((b=>{const I=ue(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,customerListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(Xe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(Xe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingCustomersListPage,isReady:k}),s.jsx(ca,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(xi(b)),onSortChange:v})]})}const je=(n,e)=>e==null?void 0:n.sessionDetail[e]??n.sessions.find((t=>t.id===e)),la=T((function(n,e){const{filters:t,sessionId:i,view:a}=e,o=i==null?void 0:a.diagnosticsBySession[i],c=o?.fetch.fetchState??"Not-Started";return{diagnostics:o?.items??[],errorMessage:c==="Error"?o?.fetch.error?.message:void 0,expired:o?.expired??!1,filters:t,hasMore:o?.nextCursor!=null,isLoading:c==="Not-Started"||c==="In-Progress",isLoadingMore:c==="In-Progress"&&(o?.items.length??0)>0,session:je(a,i)}}),(function(n,e){const{downloadUrl:t,filters:i,navigate:a,sessionId:o,tenantEmailDomain:c,view:d}=e,l=o==null?void 0:d.diagnosticsBySession[o],v=je(d,o),u=d.actionStateByKind.retry?.fetchState==="In-Progress",m=d.actionStateByKind.rollback?.fetchState==="In-Progress",S=v?.status==="done"&&v.rollback_available_until!=null&&new Date(v.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>a(`/${c}/invoicing/data_import`),onDownloadCsv:()=>{t!=null&&window.open(t,"_blank","noopener")},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{o!=null&&l?.nextCursor!=null&&n(xe({...i,cursor:l.nextCursor,sessionId:o}))},onRetry:v?.status!=="failed"||u?void 0:()=>{o!=null&&n(Oe(o))},onRollback:S?()=>{o!=null&&n(Lt(o))}:void 0}}))(jn);function da(){const n=P(),e=L(),{sessionId:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),[o,c]=r.useState({}),d=E(Te),l=je(d,t),v=t==null?void 0:d.diagnosticsBySession[t];r.useEffect((()=>{a&&t!=null&&n(ye(t))}),[a,n,t]),r.useEffect((()=>{if(!a||t==null)return;const f=setTimeout((()=>{n(xe({...o,sessionId:t}))}),300);return()=>clearTimeout(f)}),[a,n,o,t]);const u=l?.status==="scanning"||l?.status==="importing";r.useEffect((()=>{if(!a||t==null||!u)return;const f=setInterval((()=>{n(ye(t)),n(xe({...o,sessionId:t}))}),3e3);return()=>clearInterval(f)}),[a,n,o,u,t]);const m=r.useMemo((()=>{if(t==null)return;const f=new URLSearchParams;o.moduleId!=null&&f.set("module_id",o.moduleId),o.level!=null&&f.set("level",o.level),o.outcome!=null&&f.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&f.set("search",o.search.trim());const C=f.toString();return`${se?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(t)}/issues.csv${C===""?"":`?${C}`}`}),[o,t]),S=v?.fetch.fetchState??"Not-Started";return U(S)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:l!=null&&S!=="Not-Started"}),s.jsx(la,{downloadUrl:m,filters:o,navigate:e,sessionId:t,tenantEmailDomain:i,view:d,onFiltersChange:c})]})}const en=n=>`invoicing_active_migration:${n}`,ae=(n,e)=>{if(n!=null&&n!=="")try{const t=en(n);e==null?sessionStorage.removeItem(t):sessionStorage.setItem(t,e)}catch{}},ua=T((function(n,e){const{sessions:t,sessionsFetch:i,statusFetch:a,statusRows:o}=e.view;return{isLoading:!(a.fetchState!=="Not-Started"&&a.fetchState!=="In-Progress"||o.length!==0||i.fetchState!=="Not-Started"&&i.fetchState!=="In-Progress"),sessions:t,statusRows:o}}),(function(n,e){const{navigate:t,tenantEmailDomain:i}=e,a=o=>{const c=o??null;n(oe(c)),ae(i,c),t(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),n(Oe(o)),a(o)},onRollbackSession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),n(Lt(o))},onViewSession:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),t(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Dn);function ga(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),a=E(Te);r.useEffect((()=>{i&&(n(bi()),n(At()))}),[i,n]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportHubPage,isReady:o}),s.jsx(ua,{navigate:e,tenantEmailDomain:t,view:a})]})}const ma=T((function(n,e){const{activeId:t,integrationsView:i,settings:a,view:o}=e,{actionStateByKind:c,sessionDetail:d,sessions:l}=o,v=i.externalConnections?.revenue?.find((m=>m.connectionName==="chargebee")),u=t!=null?d[t]:void 0;return{chargebeeConnected:a?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:a?.chargebee_site,connectError:c.connect?.error?.message,connecting:c.connect?.fetchState==="In-Progress",retrying:c.retry?.fetchState==="In-Progress",session:u??l.find((m=>m.id===t)),starting:c.start?.fetchState==="In-Progress",uploading:c.upload?.fetchState==="In-Progress"}}),(function(n,e){const{activeId:t,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadTemplates:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportTemplatesDownloaded);const o=se?.invoicingMicroServiceBaseUrl,c=o!=null&&o.length>0?o:"";window.open(`${c}/1.0/data-import/templates`,"_blank","noopener")},onFetchFromChargebee:()=>{p.trackInvoicingActionClick(g.Event.invoicingChargebeeConnectClicked),n(Pi())},onGoToIntegrations:()=>{i(`/${a}/invoicing/settings`)},onGoToOverview:()=>i(`/${a}/invoicing/overview`),onRetry:()=>{t!=null&&n(Oe(t))},onSaveLater:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportStarted),t!=null&&n(Di(t))},onUpload:o=>{p.trackInvoicingActionClick(g.Event.invoicingImportFileUploaded),n(ji({files:o}))},onViewDetails:t==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(t)}`)}}))(Pn);function va(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),a=E(xt),o=E(_e).companyId??Ie.getSignedInUserTenant(t??"")?.companyId,c=E((f=>$t(f,o))),d=E(Te),{activeMigrationSessionId:l}=d,v=l??void 0,u=v!=null?d.sessionDetail[v]??d.sessions.find((f=>f.id===v)):void 0;r.useEffect((()=>{i&&(n(Me()),n(At()))}),[i,n]),r.useEffect((()=>{if(l!=null)return;const f=(C=>{if(C==null||C==="")return null;try{return sessionStorage.getItem(en(C))}catch{return null}})(t);f!=null&&n(oe(f))}),[l,n,t]),r.useEffect((()=>{ae(t,l)}),[l,t]);const m=u?.status,S=m==="scanning"||m==="importing";return r.useEffect((()=>{if(!i||v==null||!S)return;const f=setInterval((()=>{n(ye(v))}),3e3);return()=>clearInterval(f)}),[i,v,S,n]),r.useEffect((()=>{m==="done"&&(n(oe(null)),ae(t,null))}),[n,m,t]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDataImportMigratePage}),s.jsx(ma,{activeId:v,integrationsView:c,navigate:e,settings:a,tenantEmailDomain:t,view:d,onBack:()=>{n(oe(null)),ae(t,null),e(`/${t}/invoicing/data_import`)}})]})}const pa=T((function(n,e){const{editView:t}=e;return{fieldHelp:t.fieldHelp,coupon:t.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:t.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${t}/discounts`),onLifecycleAction:a=>{n(wt({action:a,id:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(g.Event.invoicingCouponEdited,{couponId:i}),n(Ai({data:a,id:i}))}}}))(Ln);function fa(){const n=P(),e=L(),{coupon_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((C=>Li(C,t))),c=o.actionState.fetchState==="In-Progress",d=o.pageFetchState.fetchState,l=d==="Completed",[v,u]=r.useState(l?t:void 0);r.useEffect((()=>{t!=null&&l&&u(t)}),[t,l]);const m=v===t;r.useEffect((()=>(n(G()),()=>{n(G())})),[n]),r.useEffect((()=>{a&&n(et({id:t}))}),[a,t,n]);const[S,f]=r.useState(0);return r.useEffect((()=>{o.fetchState==="Completed"&&(n(G()),n(et({cacheOverride:!0,id:t})),f((C=>C+1)))}),[o.fetchState,n,t]),U(d)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountDetailPage,isReady:l}),s.jsx(pa,{hasLoadedRecord:m,couponId:t??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:c,navigate:e,tenantEmailDomain:i},S)]})}const Sa=T((function(n){const e=Ft(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.coupons.length===0,isLoadingMore:t==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${t}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateCouponClicked),e.navigate(`${t}/discounts/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${t}/data_import`)},onDiscountLifecycleAction:(i,a)=>{n(wt({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(Rt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(An);function ha(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,couponListFetchState:y,runningDiscountActionId:k}=E((I=>{const D=Ft(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:D.sort,nextCursor:D.nextCursor,couponListFetchState:D.fetchState,runningDiscountActionId:D.runningActionId??null}}),Z),b=y==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(tt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(tt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDiscountsListPage,isReady:b}),s.jsx(Sa,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,runningDiscountActionId:k,onSearchChange:o,onStatusChange:I=>n($i(I)),onSortChange:v})]})}const Ia=T((function(n,e){const{readView:t}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:t.dunningCase,isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="";return{onBack:()=>e.navigate(`${t}/dunning`),onInvoiceClick:o=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:o,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(o)}`)},onCancel:a?()=>n(H({action:"cancel",id:i})):void 0,onResolve:a?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resolve",caseId:i}),n(H({action:"resolve",id:i}))}:void 0,onResume:a?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"resume",caseId:i}),n(H({action:"resume",id:i}))}:void 0,onRetry:a?()=>{p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"retry",caseId:i}),n(H({action:"retry",id:i}))}:void 0}}))(wn);function Ca(){const n=P(),e=L(),{case_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((h=>wi(h,t??""))),c=o.fetchState==="Completed",d=o.dunningCase?.invoiceID,[l,v]=r.useState("idle"),[u,m]=r.useState(!1),[S,f]=r.useState(),[C,j]=r.useState(!1),y=r.useCallback((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[]),k=r.useCallback((()=>{if(t==null)return;n(Fi({id:t})),v("idle"),m(!1);const h=o.emailPreview.preview;f(h==null?void 0:{body:h.body,cc:h.cc,subject:h.subject,to:h.to}),j(!0)}),[t,n,o.emailPreview.preview]),b=r.useCallback((h=>{t!=null&&l!=="pending"&&(m(!1),v("pending"),p.trackInvoicingActionClick(g.Event.invoicingDunningAction,{action:"send-email",caseId:t}),n(H({action:"send-email",body:h,id:t})))}),[t,n,l]),I=r.useMemo((()=>o.emailPreview.preview==null?void 0:{bodyToken:o.emailPreview.preview.bodyToken,renderedHtmlTemplate:o.emailPreview.preview.renderedHtmlTemplate,subjectToken:o.emailPreview.preview.subjectToken}),[o.emailPreview.preview]);r.useEffect((()=>{a&&t!=null&&n(Ri({id:t}))}),[a,t,n]),r.useEffect((()=>{a&&d!=null&&n(Ne({invoiceId:d}))}),[a,d,n]),r.useEffect((()=>{v("idle"),m(!1),f(void 0),j(!1)}),[t]),r.useEffect((()=>{a||(v("idle"),m(!1),f(void 0),j(!1))}),[a]),r.useEffect((()=>{C&&S==null&&o.emailPreview.preview!=null&&f({body:o.emailPreview.preview.body,cc:o.emailPreview.preview.cc,subject:o.emailPreview.preview.subject,to:o.emailPreview.preview.to})}),[o.emailPreview.preview,S,C]),r.useEffect((()=>{l==="pending"&&(o.actionState.fetchState!=="In-Progress"?u&&o.actionState.fetchState==="Completed"?(t!=null&&n(Ti({id:t})),y()):u&&o.actionState.fetchState==="Error"&&v("failed"):m(!0))}),[t,y,n,l,u,o.actionState.fetchState]);const D=d!=null&&o.linkedInvoice?.id===d?o.linkedInvoice.dunningAttempts:void 0;return U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningDetailPage,isReady:c}),s.jsx(Ia,{navigate:e,tenantEmailDomain:i,caseId:t??"",readView:o,dunningAttempts:D,onSendEmail:k}),s.jsx($n,{initialDraft:S,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:l==="pending",onClose:y,onSend:b,open:C,preview:I,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:l==="failed"?o.actionState.error?.message:void 0})]})}const Ea=T((function(n){const e=Tt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:t==="In-Progress"&&e.dunningCases.length>0,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${t}/data_import`),onDunningCaseClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingDunningCaseRowClicked,{caseId:i}),e.navigate(`${t}/dunning/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{a!=="retry"&&a!=="resume"&&a!=="resolve"&&a!=="cancel"||n(H({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&n(_i({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Fn);function ka(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,dunningCaseListFetchState:y}=E((b=>{const I=Tt(b);return{activeStatus:I.activeTab,appliedSearch:I.filters.search,appliedSort:I.sort,nextCursor:I.nextCursor,dunningCaseListFetchState:I.fetchState}}),Z),k=y==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>d(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&n(nt({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(nt({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingDunningListPage,isReady:k}),s.jsx(Ea,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onStatusChange:b=>n(Oi(b)),onSortChange:v})]})}const ya=T((function(n,e){const{view:t}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:t.billingAddress,invoice:t.invoice,invoiceId:e.invoiceId,shippingAddress:t.shippingAddress,isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isSaving:t.actionState.fetchState==="In-Progress",isVoiding:t.actionState.fetchState==="In-Progress"}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e;return{onBack:()=>e.navigate(`${t}/invoices`),onCustomerClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onIssueCreditNote:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentClicked,{fromScreen:"invoice_detail",invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRegenerated,{invoiceId:i}),n(V({action:"regenerate",invoiceId:i}))},onSaveEdit:a=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceEdited,{invoiceId:i}),n(Ni({data:{due_date:a.due_date!==""?a.due_date:void 0,notes:a.notes.trim()!==""?a.notes.split(`
|
|
2
|
-
`).map((o=>o.trim())).filter((o=>o!=="")).map((o=>({note:o}))):void 0,po_number:a.po_number!==""?a.po_number:null},invoiceId:i}))},onSendReminder:()=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceReminderSent,{invoiceId:i}),n(V({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onVoid:a=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))}}}))(Rn);function xa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=E((m=>Ot(m,t??""))),c=o.pageFetchState.fetchState,d=c==="Completed",[l,v]=r.useState(d?t:void 0);r.useEffect((()=>{t!=null&&d&&v(t)}),[t,d]);const u=l===t;return r.useEffect((()=>{a&&t!=null&&n(Mi({invoiceId:t}))}),[a,t,n]),U(c)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(ya,{invoiceId:t??"",hasLoadedRecord:u,navigate:e,tenantEmailDomain:i,view:o})]})}const ba=T((function(n){const e=_t(n),{fetchState:t}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:t==="Not-Started"||t==="In-Progress"&&e.invoices.length===0,isLoadingMore:t==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreateInvoiceClicked),e.navigate(`${t}/invoices/create`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${t}/data_import`)},onInvoiceClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceRowClicked,{invoiceId:i}),e.navigate(`${t}/invoices/${encodeURIComponent(i)}`)},onRowAction:(i,a)=>{switch(a){case"recordPayment":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/record-payment`);break;case"issueCreditNote":e.navigate(`${t}/invoices/${encodeURIComponent(i)}/issue-credit-note`);break;case"sendReminder":n(V({action:"send-reminder",invoiceId:i}));break;case"regenerate":n(V({action:"regenerate",invoiceId:i}));break;case"void":n(V({action:"void",invoiceId:i}))}},onVoidInvoice:(i,a)=>{p.trackInvoicingActionClick(g.Event.invoicingInvoiceVoided,{invoiceId:i}),n(V({action:"void",invoiceId:i,body:a}))},onLoadMore:()=>{e.nextCursor!=null&&n(Mt({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Tn);function ja(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,invoiceListFetchState:y,voidingInvoiceId:k}=E((I=>{const D=_t(I);return{activeStatus:D.activeTab,appliedSearch:D.filters.search,appliedSort:I.invoicingInvoiceListState.sort,nextCursor:D.nextCursor,invoiceListFetchState:D.fetchState,voidingInvoiceId:D.runningActionId}}),Z),b=y==="Completed";return r.useEffect((()=>{const I=setTimeout((()=>d(a)),300);return()=>clearTimeout(I)}),[a]),r.useEffect((()=>{i&&n(pe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(pe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoicesListPage,isReady:b}),s.jsx(ba,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,voidingInvoiceId:k,onSearchChange:o,onStatusChange:I=>{n(Ui(I)),n(pe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v})]})}function dt(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=On(),a=ft(),[o,c]=r.useState(!1),{acceptTermsState:d,status:l}=E(Nt),v=Bi(i?.loggedInUserRoleMap),u=`/${t}/invoicing`,m=S=>{c(S)};return l==="completed"?s.jsx(B,{to:`${u}/overview`,replace:!0}):l==="settings"&&v?s.jsx(B,{to:`${u}/settings`,replace:!0}):s.jsxs(s.Fragment,{children:[s.jsx(To,{isAppContentDrawerOpen:o,handleDrawerToggle:m}),s.jsx(_n,{analytics:p,isAccepting:d.fetchState==="In-Progress",isReadOnlyUser:!v,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{n(Vi())},onBackClick:()=>{e(`/${t}`)},onClickMenuIcon:()=>{m(!0)}})]})}const Da=T((function(n,e){const t=Ut(n,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:c,typeOptions:d}=t;return{fieldHelp:t.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:c.fetchState==="Error"?c.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:c.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:d}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(t);return{onBack:i,onCancel:i,onChange:a=>{n(Qi({localData:a}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),n(Ki())}}}))(Mn);function Pa(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,invoice:c,isPageReady:d,issuedCreditNoteId:l,submitState:v}=E((f=>Ut(f,t??""))),u=`/${i}/invoicing`,m=r.useRef(null);r.useEffect((()=>{n(Zi()),m.current=null}),[n,t]),r.useEffect((()=>{a&&t!=null&&n(Ne({invoiceId:t}))}),[a,n,t]),r.useEffect((()=>{c!=null&&t!=null&&o==="Completed"&&m.current!==t&&(m.current=t,n(Hi({localData:qi(c)})))}),[n,o,c,t]);const S=r.useRef(v.fetchState);return r.useEffect((()=>{const f=S.current;S.current=v.fetchState,f!=="Completed"&&v.fetchState==="Completed"&&l!=null&&e(`${u}/credits/${encodeURIComponent(l)}`)}),[l,e,v.fetchState,u]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingInvoiceDetailPage,isReady:d}),s.jsx(Da,{invoiceId:t??"",navigate:e,tenantEmailDomain:i})]})}const La=T((function(n){return{invoicingOverview:Bt(n)}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{n(Vt(e.selectedPeriod,!0))},onSubscriptionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${t}/subscriptions/${i}`)},onViewInvoices:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewInvoicesClicked),e.navigate(`${t}/invoices`)},onViewPayments:()=>{p.trackInvoicingActionClick(g.Event.invoicingViewPaymentsClicked),e.navigate(`${t}/payments`)}}}))(Nn);function Aa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a]=r.useState((()=>{const c=new Date;return{month:c.getMonth()+1,year:c.getFullYear()}})),o=E((c=>Bt(c).fetchState))==="Completed";return r.useEffect((()=>{i&&n(Vt(a))}),[i,n,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingOverviewPage,isReady:o}),s.jsx(La,{navigate:e,selectedPeriod:a,tenantEmailDomain:t})]})}const $a=T((function(n){const e=Zt(n),{fetchState:t}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.transactions.length===0,isLoadingMore:t==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${t}/data_import`)},onTransactionClick:i=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${t}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&n(Gi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Un);function wa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeType:S,appliedSearch:f,appliedSort:C,nextCursor:j,transactionListFetchState:y,transactions:k}=E((_=>{const O=Zt(_);return{activeType:O.activeTab,appliedSearch:O.filters.search,appliedSort:O.sort,nextCursor:O.nextCursor,transactionListFetchState:O.fetchState,transactions:O.transactions}}),Z),b=y==="Completed",I=`/${t}/invoicing`,D=r.useCallback((_=>{const O=k.find((M=>M.id===_)),R=O?.linkedInvoices?.[0]?.invoiceID??O?.invoiceID;R!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:R,toScreen:"invoice"}),e(`${I}/invoices/${encodeURIComponent(R)}`))}),[e,I,k]),h=r.useCallback((_=>{const O=k.find((R=>R.id===_))?.customerID;O!=null&&(p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:O,fromScreen:"payments_list",toScreen:"customer"}),e(`${I}/customers/${encodeURIComponent(O)}`))}),[e,I,k]);return r.useEffect((()=>{const _=setTimeout((()=>d(a)),300);return()=>clearTimeout(_)}),[a]),r.useEffect((()=>{i&&n(fe({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(fe({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingPaymentsListPage,isReady:b}),s.jsx($a,{navigate:e,tenantEmailDomain:t,activeType:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,onSearchChange:o,onTypeChange:_=>{n(zi(_)),n(fe({cacheOverride:!1,filters:m,sort:u}))},onSortChange:v,onViewTransactionCustomer:h,onViewTransactionInvoice:D})]})}const Fa=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},ut=(n,e)=>new Intl.NumberFormat("en-US",{currency:e,style:"currency"}).format(n);function gt(){const n=P(),e=L(),{invoice_id:t,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=t!=null&&t!=="",c=E(ue),d=E((h=>Wi(h))),l=E(Ji),v=E((h=>Ot(h,t??""))),u=v.invoice,m=`/${i}/invoicing`,S=r.useRef(null),f=r.useRef("");r.useEffect((()=>{n(Yi()),S.current=null,f.current=""}),[n,t]),r.useEffect((()=>{a&&n(o&&t!=null?Ne({invoiceId:t}):Re({filters:{},keepExistingListItems:!1}))}),[a,n,t,o]),r.useEffect((()=>{o&&u!=null&&t!=null&&v.fetchState==="Completed"&&S.current!==t&&(S.current=t,n(Xi({contextInvoiceId:t,localData:eo(u)})))}),[n,u,t,v.fetchState,o]),r.useEffect((()=>{if(o)return;const h=d.localData.customerId;h!==""&&h!==f.current&&(f.current=h,n(Mt({filters:{customerId:h},keepExistingListItems:!1})),d.localData.invoiceToLink!==""&&n(it({localData:{...d.localData,customerId:h,invoiceToLink:""}})))}),[n,d.localData,o]);const C=r.useRef(l.fetchState);r.useEffect((()=>{const h=C.current;if(C.current=l.fetchState,h!=="Completed"&&l.fetchState==="Completed"){if(l.recordedInvoiceId!=null)return void e(`${m}/invoices/${encodeURIComponent(l.recordedInvoiceId)}`);e(`${m}/payments`)}}),[e,l.fetchState,l.recordedInvoiceId,m]);const j=r.useMemo((()=>c.customers.map((h=>({id:h.id,name:Fa(h)})))),[c.customers]),y=E((h=>to(h,d.localData.customerId))),k=r.useMemo((()=>y.map((h=>({amountDue:ut(h.amountDue,"USD"),amountDueValue:h.amountDue,id:h.id,label:h.invoiceNumber})))),[y]),b=r.useMemo((()=>{if(!o||u==null)return;const h=u.currencyCode??"USD",_=u.amountDue?.amount??0;return{amountDue:ut(_,h),amountDueValue:_,currencyCode:h,customerName:u.customerName??u.customerID,invoiceId:u.id,invoiceNumber:u.invoiceNumber??u.id}}),[u,o]),I=o?`${m}/invoices/${encodeURIComponent(t??"")}`:`${m}/payments`,D=!o||v.fetchState==="Completed"&&d.localData.invoiceToLink!=="";return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingRecordPaymentPage,isReady:D}),s.jsx(Bn,{customers:j,fieldHelp:d.fieldHelp,errorMessage:l.fetchState==="Error"?l.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:d.gatewayOptions,invoiceContext:b,invoiceOptions:k,isSubmitting:l.fetchState==="In-Progress",localData:d.localData,mode:o?"invoice":"customer",paymentMethodOptions:d.paymentMethodOptions,onBack:()=>{e(I)},onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingRecordPaymentCancelled),e(I)},onChange:h=>{n(it({localData:h}))},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingPaymentRecorded,{customerId:d.localData.customerId,invoiceId:o?t:d.localData.invoiceToLink,paymentMethod:d.localData.paymentMethod}),n(no(o?t??void 0:void 0))}})]})}const tn=(n,e,t)=>{const i=`/${n}/invoicing/subscriptions/`;return t!=null?`${i}${encodeURIComponent(t)}/${e}/`:`${i}new/${e}/`},Ra=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},nn=(n,e,t)=>{const i=[n,Ra(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},mt=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Ta=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:nn(n.productCode,n.price,n.periodUnit),value:n.priceCode}),Oa=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),_a=T((function(n,e){const{editView:t}=e,i=t.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:t.cancelReasonCodeOptions,fieldHelp:t.fieldHelp,addons:t.products.filter((c=>c.itemType==="addon")).filter(mt).map((c=>({label:c.name??c.id,subtitle:nn(c.productCode,c.price,c.periodUnit),value:c.priceCode}))),canEditCommercial:o,coupons:t.coupons.map(Oa),isLoading:!e.hasLoadedRecord&&(t.pageFetchState.fetchState==="Not-Started"||t.pageFetchState.fetchState==="In-Progress"),isRunningAction:t.actionState.fetchState==="In-Progress",isSaving:t.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:t.localData,plans:t.plans.filter(mt).map(Ta),shippingAddressLabel:t.shippingAddressLabel,subscription:i}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(c,d)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:c,subscriptionId:i}),n(qt({action:c,id:i,body:d}))};return{onBack:()=>e.navigate(`${t}/subscriptions`),onChange:c=>{n(re({id:i,localData:c}))},onChangeTermEnd:a?c=>{const d=c?.trim()??"";d!==""&&o("change_term_end",{term_ends_at:d})}:void 0,onCustomerClick:c=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:c,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${t}/customers/${encodeURIComponent(c)}`,"_blank","noopener,noreferrer")},onOpenAddress:()=>{const c=tn(e.tenantEmailDomain??"",be,i),d=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(c,{state:{pathnameStackToGoBack:d}})},onViewInvoices:()=>e.navigate(`${t}/invoices`),onSaveEdit:c=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionEdited,{subscriptionId:i}),n(re({id:i,localData:c})),n(Ht({id:i}))},onCancelSubscription:a?c=>{o("cancel",{cancel_reason_code:c.cancelReasonCode,end_of_term:!1,...c.cancelReason!=null&&c.cancelReason.trim()!==""?{cancel_reason:c.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(c,d)=>{c!=="pause"?o(c):o(c,d!=null&&d.trim()!==""?{resume_date:d.trim()}:void 0)}:void 0}}))(Vn);function Ma(){const n=P(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),c=E((k=>Ue(k,i))),{subscriptionCommercialEditAllowedFromStatuses:d,subscriptionLifecycleActionOptions:l,subscriptionMetadataEditAllowedFromStatuses:v}=c,u=c.pageFetchState.fetchState,m=u==="Completed",[S,f]=r.useState(m?i:void 0);r.useEffect((()=>{i!=null&&m&&f(i)}),[i,m]);const C=S===i;ge(o),r.useEffect((()=>{o&&i!=null&&n(ot({id:i}))}),[o,i,n]);const[j,y]=r.useState(0);return r.useEffect((()=>{c.fetchState==="Completed"&&(n(Be()),n(ot({cacheOverride:!0,id:i})),y((k=>k+1)))}),[c.fetchState,n,i]),U(u)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionDetailPage,isReady:m}),s.jsx(_a,{hasLoadedRecord:C,commercialEditAllowedFromStatuses:d,editView:c,lifecycleActionOptions:l,location:t,metadataEditAllowedFromStatuses:v,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},j)]})}const Na=n=>{const e=[n.firstName,n.lastName].filter((t=>t!=null&&t.trim()!=="")).join(" ").trim();return(n.company!=null&&n.company.trim()!==""?n.company.trim():"")||e||(n.email!=null&&n.email.trim()!==""?n.email.trim():"")||n.id},Ua=(n,e)=>{if(n==null)return;const t=new Intl.NumberFormat("en-US",{currency:n.currencyCode??"USD",maximumFractionDigits:0,style:"currency"}).format(n.amount);return e!=null?`${t}/${e}`:t},De=(n,e,t)=>{const i=[n,Ua(e,t)].filter((a=>a!=null&&a!=="")).join(" · ");return i!==""?i:void 0},Ba=n=>({label:Na(n),value:n.id}),he=n=>n.priceCode!=null&&n.priceCode.trim()!=="",Va=n=>({billingCycles:n.billingCycles,billingPeriod:n.period,billingPeriodUnit:n.periodUnit,label:n.name??n.id,subtitle:De(n.productCode,n.price,n.periodUnit),trialPeriod:n.trialPeriod,trialPeriodUnit:n.trialPeriodUnit,value:n.priceCode}),Za=n=>({label:n.name??n.couponCode??n.id,value:n.couponCode??n.id}),Ha=T((function(n,e){const t=Ue(n,e.subscriptionId);return{fieldHelp:t.fieldHelp,addons:t.products.filter((i=>i.itemType==="addon")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,i.periodUnit),value:i.priceCode}))),charges:t.products.filter((i=>i.itemType==="charge")).filter(he).map((i=>({label:i.name??i.id,subtitle:De(i.productCode,i.price,void 0),value:i.priceCode}))),coupons:t.coupons.map(Za),customers:t.customers.map(Ba),errorMessage:t.fetchState==="Error"?t.error?.message??"Failed to save subscription.":void 0,isSubmitting:t.fetchState==="In-Progress",localData:t.localData,mode:t.mode,plans:t.plans.filter(he).map(Va),shippingAddressLabel:t.shippingAddressLabel}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=null?"edit":"create";return{onCancel:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionFormCancelled),n(Be()),n(Fe(be)),i==null?e.navigate(`${t}/subscriptions`):e.navigate(`${t}/subscriptions/${encodeURIComponent(i)}`)},onChange:o=>{n(re({id:i,localData:o}))},onOpenAddress:()=>{const o=tn(e.tenantEmailDomain??"",be,i),c=Y(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:c}})},onSubmit:()=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionSaved,{mode:a}),n(Ht({id:i}))}}}))(Zn);function qa(){const n=P(),e=L(),t=J(),{subscription_id:i,tenantEmailDomain:a}=w(),[o]=W(),{areTenantIdsInSync:c}=F(),d=o.get("customerId"),{fetchState:l,savedSubscriptionId:v}=E((S=>io(S,i))),u=E((S=>Ue(S,i).localData));ge(c),r.useEffect((()=>{c&&(n(Re({filters:{},keepExistingListItems:!1})),n(Ce({filters:{type:"plan"},keepExistingListItems:!1})),n(Rt({filters:{},keepExistingListItems:!1})),i!=null&&n(oo({id:i})))}),[c,i,n]);const m=r.useRef(!1);return r.useEffect((()=>{m.current||i!=null||d==null||d===""||u.customerId!==""||(m.current=!0,n(re({id:i,localData:{...u,customerId:d}})))}),[d,i,u,n]),r.useEffect((()=>{if(l==="Completed"){const S=v??i,f=S!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(S)}`:`/${a}/invoicing/subscriptions`;e(f),n(Be())}}),[l,v,i,n,e,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionFormPage}),s.jsx(Ha,{location:t,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Ka=T((function(n){const e=Kt(n),{fetchState:t}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:t==="Not-Started"||t==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:t==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,c)=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionLifecycleAction,{action:o,subscriptionId:a}),n(qt({action:o,id:a,body:c}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{p.trackInvoicingActionClick(g.Event.invoicingAddSubscriptionClicked),e.navigate(`${t}/subscriptions/new`)},onImportCsv:()=>{p.trackInvoicingActionClick(g.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${t}/data_import`)},onChangeTermEnd:(a,o)=>{const c=o?.trim()??"";c!==""&&i(a,"change_term_end",{term_ends_at:c})},onSubscriptionAction:(a,o,c)=>{o!=="pause"?i(a,o):i(a,o,c!=null&&c.trim()!==""?{resume_date:c.trim()}:void 0)},onCancelSubscription:(a,o)=>{i(a,"cancel",{cancel_reason_code:o.cancelReasonCode,end_of_term:!1,...o.cancelReason!=null&&o.cancelReason.trim()!==""?{cancel_reason:o.cancelReason.trim()}:{}})},onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${t}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&n(co({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort}))}}}))(Hn);function Qa(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[c,d]=r.useState(""),[l,v]=r.useState(null),u=r.useMemo((()=>l!=null?{dir:l.direction,field:l.columnKey}:void 0),[l]),m=r.useMemo((()=>({search:c.trim()!==""?c.trim():void 0})),[c]),{activeStatus:S,appliedSearch:f,appliedSort:C,nextCursor:j,subscriptionListFetchState:y,runningActionSubscriptionId:k}=E((D=>{const h=Kt(D);return{activeStatus:h.activeTab,appliedSearch:h.filters.search,appliedSort:h.sort,nextCursor:h.nextCursor,subscriptionListFetchState:h.fetchState,runningActionSubscriptionId:h.runningActionId??null}}),Z),b=y==="Completed";r.useEffect((()=>{const D=setTimeout((()=>d(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&n(at({cacheOverride:!1}))}),[i,n]),r.useEffect((()=>{i&&(m.search!==f||u?.field!==C?.field||u?.dir!==C?.dir)&&n(at({cacheOverride:!0,filters:m,sort:u}))}),[i,n,m,u,f,C]);const I=r.useRef(k);return r.useEffect((()=>{const D=I.current!=null&&k==null;I.current=k,D&&i&&n(ao())}),[k,i,n]),U(y)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSubscriptionsListPage,isReady:b}),s.jsx(Ka,{navigate:e,tenantEmailDomain:t,activeStatus:S,searchValue:a,sortState:l,filters:m,sort:u,nextCursor:j,runningActionSubscriptionId:k,onSearchChange:o,onStatusChange:D=>n(so(D)),onSortChange:v})]})}const za=T((function(n,e){const{readView:t}=e;return{isLoading:t.fetchState==="Not-Started"||t.fetchState==="In-Progress",isRunningAction:t.actionState.fetchState==="In-Progress",transaction:t.transaction,transactionId:e.transactionId}}),(function(n,e){const t=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${t}/payments`),onCustomerClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${t}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${t}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{p.trackInvoicingActionClick(g.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${t}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{p.trackInvoicingActionClick(g.Event.invoicingTransactionCaptured,{transactionId:i}),n(uo({action:"capture",id:i}))}:void 0}}))(qn);function Ga(){const n=P(),e=L(),{tenantEmailDomain:t,transaction_id:i}=w(),{areTenantIdsInSync:a}=F(),o=E((d=>ro(d,i??""))),c=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&n(lo({id:i}))}),[a,i,n]),U(o.fetchState)?s.jsx(N,{}):s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingTransactionDetailPage,isReady:c}),s.jsx(za,{navigate:e,tenantEmailDomain:t,transactionId:i??"",readView:o})]})}const Wa={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function X(n){const e=P(),{areTenantIdsInSync:t}=F(),{tenantEmailDomain:i}=w(),{fetchState:a,fieldHelp:o,saveState:c,settings:d,stripeConnectState:l}=E(go),{configError:v,configFetchState:u,dunningScheduleActionOptions:m,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:C}=E(Qt),j=E(Ae);Ve({enabled:n==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=E(_e),k=n==="dunning"||n==="quickbooks",b=y.companyId??Ie.getSignedInUserTenant(i??"")?.companyId,I=E((A=>$t(A,b))),D=mo(y.userRole??[]),h=y.tenantId??"",_=Ie.getSignedInUser(),O={userId:_?.userId??"",sessionId:_?.zeniSessionId??"",tenantId:h},R=d?.logo_file_id,M=E((A=>R!=null&&R!==""?A.fileState.fileByFileId[R]:void 0)),ee=E((A=>R!=null&&R!==""?vo(A,R):void 0)),Ze=E((A=>R!=null&&R!==""?po(A,R):void 0)),on=R!=null&&R!==""&&ee!=null?{[R]:ee}:{},an=R!=null&&R!==""&&Ze!=null?{[R]:Ze}:{};r.useEffect((()=>(e(st()),()=>{e(st())})),[e]),r.useEffect((()=>{t&&(a!=="Not-Started"&&a!=="Error"||e(Me()))}),[t,e,a]),r.useEffect((()=>{t&&k&&u==="Not-Started"&&e(le())}),[t,e,u,k]),r.useEffect((()=>{if(!t)return;const A=_?.userId;A!=null&&A!==""&&h!==""&&Ke.shouldFetchActiveTenant(h)&&(Ke.markActiveTenantFetchStarted(h),e(fo(A,h,_?.zeniSessionId)))}),[t,e,_?.userId,_?.zeniSessionId,h]),r.useEffect((()=>{t&&R!=null&&R!==""&&h!==""&&M==null&&e(So(R,h))}),[t,e,M,R,h]);const sn=m.length>0||S.length>0,cn=a==="Not-Started"||a==="In-Progress"&&d==null||k&&!sn&&(u==="Not-Started"||u==="In-Progress"),rn=a==="Completed"&&(!k||u==="Completed"),He=I.externalConnections?.revenue?.find((A=>A.connectionName==="chargebee"))?.connectionId,me=se?.invoicingMicroServiceBaseUrl,qe=me!=null&&me.length>0?`${me}/1.0/webhooks/stripe`:"",ve={deleteConnectionError:I.externalConnections?.deleteConnectionError?.message,deleteConnectionState:I.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:I,isAdmin:D,isStripeBusy:l.fetchState==="In-Progress",onConnectStripe:A=>e(rt(A)),onDisconnect:(A,q)=>{h!==""&&e(xo(h,A,lt(q)))},onDisconnectStripe:()=>e(ct()),onReconnectQBO:()=>{const A=y.tenantEmailDomain??i??"";de.init("/connection/auth",A),de.handleClick()},onRefreshQBO:()=>{I.integrations.refreshQBO.fetchState!=="In-Progress"&&e(Wt())},onSaveChargeBeeCredentials:(A,q)=>{He!=null&&h!==""&&e(ko(h,He,lt("revenue"),yo("chargebee"),{api_key:A,site:q}))},saveChargeBeeError:I.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:I.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe};return{authParams:O,deleteFileStatusById:on,fieldHelp:o,dunningScheduleActionOptions:m,filesEndPoint:se?.fileMicroServiceBaseUrl??"",integrationsSectionProps:ve,isInvoicingPageReady:rn,isLoading:cn,isSaving:c.fetchState==="In-Progress",isStripeBusy:l.fetchState==="In-Progress",logoFile:M,qboAccountMappingKindOptions:S,qboCustomerMatchingOptions:f,qboSyncStatusOptions:C,qboView:j,saveErrorMessage:c.fetchState==="Error"?c.error?.message??"Failed to save settings.":k&&u==="Error"?v?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:l.fetchState==="Error"?l.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:qe,updateFileStatusById:an,onConnectStripe:A=>e(rt(A)),onDeleteFile:A=>e(Eo(A)),onDisconnectStripe:()=>e(ct()),onEditFileName:(A,q)=>e(Co(A,q)),onReconnectQBO:ve.onReconnectQBO,onRefreshQBO:ve.onRefreshQBO,onRetryQboSyncTask:A=>e(Gt(A)),onSave:A=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:n??"hub"}),e(Io({settings:A,snackbarSection:Wa[n??""]}))},onStartQboBackfill:A=>e(zt(A)),updateFilesEntity:A=>{p.trackInvoicingActionClick(g.Event.invoicingLogoUploaded),e(ho({files:A}))}}}function vt({appContent:n}){const e=L(),t=J(),i=P(),{tenantEmailDomain:a}=w(),o=X("branding"),c=E((v=>bo(v))),d=E((v=>jo(Se,v)?.addressToCreate));r.useEffect((()=>{c.saveState.fetchState==="Completed"&&(i(Do()),i(Fe(Se)))}),[c.saveState.fetchState,i]);const l=St(c.saveState.fetchState);return r.useEffect((()=>{l==="In-Progress"&&c.saveState.fetchState==="Completed"&&e("..")}),[l,c.saveState.fetchState,e]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Kn,{address:d,fieldHelp:c.fieldHelp,addressLabel:c.addressLabel,appContent:n,authParams:o.authParams,dateFormatOptions:c.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:c.localData,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:v=>{i(Lo({localData:v}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{const v=`/${a}/invoicing/settings/branding/${Se}/`,u=Y(t.state?.pathnameStackToGoBack,t.pathname);e(v,{state:{pathnameStackToGoBack:u}})},onSubmit:()=>i(Po()),updateFilesEntity:o.updateFilesEntity})]})}function Ja(){const n=L(),e=X("dunning");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Qn,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>n(".."),onSave:e.onSave})]})}function Ya(){const n=L(),e=X("integrations");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(zn,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>n("../quickbooks"),onOpenPaymentDestination:()=>n("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>n("..")})]})}function Xa(){const n=L(),e=X("payment-destination");return s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:e.isInvoicingPageReady}),s.jsx(Gn,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>n(".."),onConnectStripe:e.onConnectStripe})]})}const es=T((function(n){const e=Jt(n);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(n){return{onChange:e=>{n(wo({localData:e}))},onReset:()=>{n($o())},onRetryTask:e=>{n(Gt(e))},onSave:()=>{p.trackInvoicingActionClick(g.Event.invoicingSettingsSaved,{tab:"quickbooks"}),n(Ao())},onStartBackfill:e=>{n(zt(e))}}}))(Wn);function ts(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),i=E(_e),{configFetchState:a,settingsFetchState:o}=E(Jt);return r.useEffect((()=>{o!=="Not-Started"&&o!=="Error"||n(Me())}),[n,o]),r.useEffect((()=>{a==="Not-Started"&&n(le())}),[a,n]),Ve({fetchSyncHealth:!0,loadAccountingPickers:!0}),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage}),s.jsx(es,{onBackClick:()=>e(".."),onReconnect:()=>{de.init("/connection/auth",i.tenantEmailDomain??t??""),de.handleClick()},onRefresh:()=>n(Wt())})]})}const ns={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function is(){const n=ft(),e=P(),t=L(),[i,a]=W(),o=X(),{canEnableInvoicing:c,isEnablingInvoicing:d,isInvoicingEnabled:l,isQboConfigured:v,isStripeConnected:u}=E(Qt),m=i.get("tab");return r.useEffect((()=>{if(m==null)return;const S=ns[m];a({},{replace:!0}),S!=null&&t(S,{replace:!0})}),[m,t,a]),s.jsxs(s.Fragment,{children:[s.jsx($,{event:g.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),s.jsx(Jn,{analytics:p,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>t("quickbooks"),onOpenPaymentDestination:()=>t("payment-destination")},isEnablingInvoicing:d,isLoading:o.isLoading,meetingUrl:n("invoicing_settings"),settings:o.settings,onBrandingClick:()=>t("branding"),onDunningClick:()=>t("dunning"),canEnableInvoicing:c,isQboConfigured:v,isStripePaymentsReady:u,onEnableInvoicingClick:l?void 0:()=>{e(Fo())}})]})}function pt(){return s.jsxs(ie,{children:[s.jsx(x,{index:!0,element:s.jsx(is,{})}),s.jsx(x,{path:"payment-destination",element:s.jsx(Xa,{})}),s.jsx(x,{path:"branding",element:s.jsx(vt,{})}),s.jsx(x,{path:"branding/:addressType",element:s.jsx(vt,{appContent:s.jsx(K,{isSubPage:!0,hideAddressBackButton:!0})})}),s.jsx(x,{path:"integrations",element:s.jsx(Ya,{})}),s.jsx(x,{path:"dunning",element:s.jsx(Ja,{})}),s.jsx(x,{path:"quickbooks",element:s.jsx(ts,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:"..",replace:!0})})]})}function $s(){const n=P(),e=L(),{tenantEmailDomain:t}=w(),{areTenantIdsInSync:i}=F(),{enableState:a,fetchState:o,status:c}=E(Nt),d=St(a.fetchState),l=`/${t}/invoicing`,v=r.useRef(!1),u=E((m=>Ae(m).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||v.current||(v.current=!0,n(le({cacheOverride:!1}))):n(le({cacheOverride:!1})))}),[i,n,o]),r.useEffect((()=>{i&&u==="Not-Started"&&n(Et())}),[i,n,u]),r.useEffect((()=>{d==="In-Progress"&&a.fetchState==="Completed"&&(e(`${l}/catalog`),n(Ro()))}),[d,a.fetchState,l,n,e]),c==null&&o!=="Error"?s.jsx(Yn,{fetchState:"In-Progress"}):c==="not_started"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/promo`,replace:!0})})]}):c==="settings"?s.jsxs(ie,{children:[s.jsx(x,{path:"promo",element:s.jsx(dt,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"*",element:s.jsx(B,{to:`${l}/settings`,replace:!0})})]}):s.jsxs(ie,{children:[s.jsx(x,{path:"/",element:s.jsx(B,{to:"overview",replace:!0})}),s.jsx(x,{path:"overview",element:s.jsx(Aa,{})}),s.jsx(x,{path:"promo",element:s.jsx(B,{to:`${l}/overview`,replace:!0})}),s.jsx(x,{path:"customers",element:s.jsx(ra,{})}),s.jsx(x,{path:"customers/new",element:s.jsx(sa,{})}),s.jsx(x,{path:"customers/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"customers/:customer_id",element:s.jsx(oa,{})}),s.jsx(x,{path:"customers/:customer_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions",element:s.jsx(Qa,{})}),s.jsx(x,{path:"subscriptions/new",element:s.jsx(qa,{})}),s.jsx(x,{path:"subscriptions/new/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"subscriptions/:subscription_id",element:s.jsx(Ma,{})}),s.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:s.jsx(K,{})}),s.jsx(x,{path:"invoices",element:s.jsx(ja,{})}),s.jsx(x,{path:"invoices/create",element:s.jsx(Yo,{})}),s.jsx(x,{path:"invoices/:invoice_id",element:s.jsx(xa,{})}),s.jsx(x,{path:"invoices/:invoice_id/record-payment",element:s.jsx(gt,{})}),s.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:s.jsx(Pa,{})}),s.jsx(x,{path:"payments",element:s.jsx(wa,{})}),s.jsx(x,{path:"payments/record",element:s.jsx(gt,{})}),s.jsx(x,{path:"payments/:transaction_id",element:s.jsx(Ga,{})}),s.jsx(x,{path:"credits",element:s.jsx(na,{})}),s.jsx(x,{path:"credits/:credit_note_id",element:s.jsx(ea,{})}),s.jsx(x,{path:"discounts",element:s.jsx(ha,{})}),s.jsx(x,{path:"discounts/new",element:s.jsx(Wo,{})}),s.jsx(x,{path:"discounts/:coupon_id",element:s.jsx(fa,{})}),s.jsx(x,{path:"dunning",element:s.jsx(ka,{})}),s.jsx(x,{path:"dunning/:case_id",element:s.jsx(Ca,{})}),s.jsx(x,{path:"catalog",element:s.jsx(zo,{})}),s.jsx(x,{path:"catalog/new",element:s.jsx(qo,{})}),s.jsx(x,{path:"catalog/:item_id",element:s.jsx(Bo,{})}),s.jsx(x,{path:"settings/*",element:s.jsx(pt,{})}),s.jsx(x,{path:"audit_log",element:s.jsx(Oo,{})}),s.jsx(x,{path:"data_import",element:s.jsx(ga,{})}),s.jsx(x,{path:"data_import/migrate",element:s.jsx(va,{})}),s.jsx(x,{path:"data_import/:sessionId",element:s.jsx(da,{})}),s.jsx(x,{path:"*",element:s.jsx(N,{})})]})}export{$s as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{j as u}from"./liveblocks-CCDNnA6G.js";import{a as g}from"./sentry-BjDPgsoW.js";import{u as O,g as _,h as w,t as A,j as l,N as L}from"./core-C_niDoeS.js";import{z as r,E as M,G as P,T as V,j as N,U as G,_ as $,$ as R,X as W}from"./index-BdTIsd0C.js";import{fE as X,Tb as q,TE as B,Tv as H,gh as J,gj as K,TA as Q,gT as Y,di as Z,TF as ee,TG as te}from"./zeni-epic-state-B-J-Dqbg.js";import{n as ne}from"./mui-CG0oORSs.js";import{u as se}from"./useDeviceId-C5uH2VJL.js";import{f as ae}from"./analyticsHelper-B-a7Fayn.js";import{t as ie}from"./getLocaleForTenant-DPltcijU.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.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]="65b70adf-085a-40bd-b578-86b08276d133",t._sentryDebugIdIdentifier="sentry-dbid-65b70adf-085a-40bd-b578-86b08276d133")}catch{}})();const E=(t,a)=>t!=null&&t.length>0&&a==="magic_links";function Ee(){const t=O(),a=_(),f=w(),[k]=A(),n=k.get("token"),p=k.get("stytch_token_type"),m=r.getMagicLinkCodeVerifier(),i=se(),{otpChallenge:d,twoFAPhoneNumber:x,magicLinkEmail:c,verifyDeviceFetchState:z,resendVerifyDeviceOTPFetchState:C}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),y=l((e=>e.tenantState.activeTenantFetchState.fetchState)),b=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>X(e))),I=l((e=>q(e))),D=r.getSignedInUser(),T=M().mode;g.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&E(n,p)&&i!=null&&m!=null&&(r.saveMagicLinkTriggered(n),t(B(n,i,m)))}),[n,p,t,i,m,s?.zeniSessionId]),g.useEffect((()=>{b!=="In-Progress"||S!=="Completed"&&y!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(H(I.tenantsInOrder),s.zeniSessionId),J(s.userId,s.zeniSessionId,o.tenantId),t(K(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(Q("Completed")),P.updateAppLocaleID(ie(o)),ae(s,o,T,void 0,I.tenantsInOrder),Y().then((()=>{const e=W();e!=null&&V(e)})),setTimeout((()=>{N.trackLogin(G.Event.loginSuccess,"email",Z(o.productSettings))}),2e3))}),[b,S,y,s,o,I,T,a.state,t]);const j=g.useCallback((()=>{f("/signin/auth")}),[f]),F=g.useCallback((()=>{i!=null&&d!=null&&c!=null&&t(ee(i,c,d))}),[i,d,t,c]),U=g.useCallback((e=>{i!=null&&n!=null&&c!=null&&d!=null&&t(te(e,i,c,d))}),[i,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx($,{phoneNumber:x,verifyOtpFetchState:z.fetchState,resendVerifyDeviceOTPFetchState:C,onResendOtp:F,onVerifyOtp:U,onCancelVerifyDevice:j});if(b==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=a.state?.origin??"/";return u.jsx(L,{to:e,state:{...a.state,origin:""}})}if(!E(n,p)||m==null||h==="Error"){const e=a.state?.origin??"/",v=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...a.state,origin:"",magicLinkAlreadyUsed:v,magicLinkExpired:!v&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(R,{size:"ExtraLarge",start:!0})})}const oe=ne.div`
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
right: 0;
|
|
6
|
-
bottom: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
z-index: 9999;
|
|
11
|
-
background-color: ${t=>t.theme.colors.background};
|
|
12
|
-
`;export{Ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./liveblocks-CCDNnA6G.js";import{h as r,l as i}from"./core-C_niDoeS.js";import{am as n}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import"./sentry-BjDPgsoW.js";import"./zeni-epic-state-B-J-Dqbg.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.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,22 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-CCDNnA6G.js";import{UF as re,fE as Q,l_ as G,dY as J,dX as le,Rx as X,U2 as de,Cf as Pe,UG as N,C4 as je,Cp as Le,Cj as ce,C8 as pe,Cn as ve,Ck as Te,UH as ue,rL as Ae,g5 as Re,gC as Fe,UI as H,Cc as me,Cb as ge,Cs as Ve,c8 as Oe}from"./zeni-epic-state-B-J-Dqbg.js";import{a1 as fe,M as Y,y as _,z as K,f as Ce,Q as he,af as be,az as ye,aA as Ue,ab as Se,N as V,ag as we,G as M,aB as Ze,aq as Be,as as $e,a8 as ze,j as xe,U as He,k as _e,aC as Ge,V as Ke}from"./index-BdTIsd0C.js";import{D as De,n as W,S as Ie}from"./mui-CG0oORSs.js";import ae from"./NotFoundScreen-D5e2DgC8.js";import{a as d}from"./sentry-BjDPgsoW.js";import{u as ee,i as Me,j as g,h as We,g as qe,l as Ne,n as se,o as z}from"./core-C_niDoeS.js";import{u as Qe}from"./useAskAiCfoHostNavButtonProps-CHt7UN_l.js";import{M as Je}from"./MobileAppDrawer-vlvV1xit.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.js";import"./InboxNotificationsProvider-ChJcQEgX.js";import"./useTaskManagerAccess-DbCLyiws.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]="fb65c18e-0df1-4029-859e-d88b6b4f9658",e._sentryDebugIdIdentifier="sentry-dbid-fb65c18e-0df1-4029-859e-d88b6b4f9658")}catch{}})();const Xe={overlayWidth:new Se(100,100,48)},te=M.getLocalizedStrings().peoplePage.invitePage,ne=M.getLocalizedStrings().common,Ye=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isEditPeopleDrawerOpen:i,closeDrawerHandler:y})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),{userId:w}=Me(),r=g((l=>re(l))),p=g((l=>Q(l))),E=g((l=>G(l))),{useFeatureGate:D}=Y(),{isFeatureEnabled:I}=D(_.isDebitCardFeatureEnabled),P=J(I,p),v=le(p),T=X(p),Z=de(p),B=!!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(N()),y()},A=()=>{O===!0?S(!0):h()},$=c.companyView?.controllers?.map((l=>l.user)),u=!!p.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:j}=D(_.isChargeCardFeatureEnabled),L=Ce(p,j,I),{isCardsHidden:R}=he(p?.tenantId),b=!L||R,F=p.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={peopleDetails:r,classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:T,isAccountingClassesEnabled:E,isReimbursementDisabled:B===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:b,isTreasuryDisabled:F===!1,isLiteRoleDisabled:Z===!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(f==="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:Xe.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:be.overlayDark,cursor:"pointer"}}},onClose:A,children:a.jsxs(ea,{onClick:l=>l.stopPropagation(),children:[k===!0?a.jsx(ye,{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=W(Ie)`
|
|
2
|
-
display: flex;
|
|
3
|
-
min-height: 100%;
|
|
4
|
-
flex-direction: column;
|
|
5
|
-
`,ke=W(we.H6Regular)`
|
|
6
|
-
margin-top: ${V.sp7};
|
|
7
|
-
padding-left: ${V.sp8};
|
|
8
|
-
padding-right: ${V.sp8};
|
|
9
|
-
color: ${e=>e.theme.colors.primary};
|
|
10
|
-
word-break: break-word;
|
|
11
|
-
`,Ee=W(we.LargeRegularSp)`
|
|
12
|
-
color: ${e=>e.theme.colors.hero};
|
|
13
|
-
padding-left: ${V.sp8};
|
|
14
|
-
padding-right: ${V.sp8};
|
|
15
|
-
margin-bottom: 30px;
|
|
16
|
-
margin-top: ${V.sp4};
|
|
17
|
-
white-space: pre-line;
|
|
18
|
-
`,aa={overlayWidth:new Se(100,100,48)},oe=M.getLocalizedStrings().peoplePage.invitePage,ie=M.getLocalizedStrings().common,sa=({companyId:e,managersListView:t,companyPassportView:c,classListView:n,mode:f,isInvitePeopleDrawerOpen:i,closeDrawerHandler:y})=>{const C=fe(),m=ee(),[O,U]=d.useState(!1),[k,S]=d.useState(!1),w=g((o=>re(o))),r=g((o=>Q(o))),p=g((o=>G(o))),{useFeatureGate:E}=Y(),{isFeatureEnabled:D}=E(_.isDebitCardFeatureEnabled),I=J(D,r),P=le(r),v=X(r),T=de(r),Z=!!r.company?.featuresActivationInfo?.isReimbursementFeatureEnabled,B=!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=()=>{y(),m(N())},h=()=>{O===!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(_.isChargeCardFeatureEnabled),L=Ce(r,j,D),{isCardsHidden:R}=he(r?.tenantId),b=!L||R,F=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",s={classList:n.classes,managersList:t.users,controllersList:$,mode:f,isZeniTenant:v,onPeopleLocalDataUpdated:o=>{m(ce({peopleLocalData:o})),U(!0)},onResetClick:x,onSaveClick:()=>{m(f==="zeni_only"?ve(e):Te())},onCloseClick:h,peopleDetails:w,isAccountingClassesEnabled:p,isReimbursementDisabled:Z===!1,isLiteRoleDisabled:T===!1,isZeniAccountsDisabled:u===!1,isChargeCardDisabled:b,isTreasuryDisabled:F===!1,isBankingOnlyTenant:I,isCardsOnlyTenant:P,isLoading:B};return d.useEffect((()=>{w.invitePersonState.fetchState==="Completed"&&(y(),m(N()))}),[w.invitePersonState.fetchState]),a.jsx(De,{anchor:"right",open:i,PaperProps:{style:{width:aa.overlayWidth.valuePercentage(C),boxShadow:"none"}},slotProps:{backdrop:{style:{backgroundColor:be.overlayDark,cursor:"pointer"}}},onClose:h,children:a.jsxs(ta,{onClick:o=>o.stopPropagation(),children:[k===!0?a.jsx(ye,{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(Ze,{...s})]})})},ta=W(Ie)`
|
|
19
|
-
display: flex;
|
|
20
|
-
min-height: 100%;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
`,na=Ne((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:G(e),analytics:xe}}),(function(e,t){const{navigate:c,companyId:n,shouldFetchClasses:f}=t;return{personAction:{onPersonDelete:(i,y)=>{e(pe(i,y))},onResendInvite:i=>{e(Ve(i))},onReloadPeople:()=>{e(me()),e(ge(n,f))},onBackClick:()=>{c("../../")},onModeChange:i=>{e(H({mode:i,searchText:"",sortKey:"name",sortOrder:"ascending"}))},onSearchTextChanged:i=>{e(H({searchText:i}))}}}}))(Ge);function q({isInvitePeopleDrawerOpen:e,isEditPeopleDrawerOpen:t}){const c=We(),n=ee(),f=qe(),{areTenantIdsInSync:i}=Be(),y=K.getSignedInUser(),C=g((s=>Q(s))),{useFeatureGate:m}=Y(),{isFeatureEnabled:O}=m(_.isDebitCardFeatureEnabled),U=g((s=>G(s))),k=!J(O,C)&&U,S=X(C),w=C?.tenantId,{tenantEmailDomain:r}=C,[p,E]=d.useState(!1),[D,I]=d.useState(!1),[P,v]=d.useState(!1),[T,Z]=d.useState("off"),[B,x]=d.useState(!1),h=s=>{x(s)},{isAiCfoAccessEnabled:A,onAskAiCfoClick:$}=Qe({mobileExploreReferrer:"People"}),u=g((s=>ue(s)));$e({isDataReady:u.fetchState==="Completed"});const j=g((s=>Ae(s.classState,s.classListState))),L=g((s=>Re(s.userState,s.userRoleState,s.userListViewState,"manager"))),R=g((s=>Fe(s))),b=C?.companyId;d.useEffect((()=>{p&&T===u.uiState.mode||!i||(n(H({searchText:"",sortKey:"name",sortOrder:"ascending"})),Z(u.uiState.mode),E(!0),n(me()))}),[p,y,w,n,u.uiState.mode,i]),d.useEffect((()=>{b!=null&&i&&n(ge(b,k))}),[b,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 F=()=>{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:F,isInvitePeopleDrawerOpen:D,managersListView:L,companyPassportView:R,classListView:j,companyId:b,mode:u.uiState.mode}):null,P===!0?a.jsx(Ye,{closeDrawerHandler:F,isEditPeopleDrawerOpen:P,managersListView:L,companyPassportView:R,classListView:j,companyId:b,mode:u.uiState.mode}):null,a.jsx(Je,{isAppContentDrawerOpen:B,handleDrawerToggle:h}),a.jsx(na,{navigate:c,signedInUser:y,isZeni:C.isZeni,isZeniTenant:S,peopleUIState:u.uiState,companyId:b,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=_e(f.state?.pathnameStackToGoBack,f.pathname);c(o,{state:{pathnameStackToGoBack:l}})},onClickMenuIcon:()=>{h(!0)},isAiCfoAccessEnabled:A,onAskAiCfoClick:$})]})}function ka(){const e=Ke();return Oe(e?.loggedInUserRole??[])?a.jsxs(se,{children:[a.jsx(z,{path:"/",element:a.jsx(q,{})}),a.jsx(z,{path:"new",element:a.jsx(q,{isInvitePeopleDrawerOpen:!0})}),a.jsx(z,{path:":userId/edit",element:a.jsx(q,{isEditPeopleDrawerOpen:!0})}),a.jsx(z,{path:"*",element:a.jsx(ae,{})})]}):a.jsx(se,{children:a.jsx(z,{path:"*",element:a.jsx(ae,{})})})}export{ka as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CCDNnA6G.js";import T from"./NotFoundScreen-D5e2DgC8.js";import{a as r}from"./sentry-BjDPgsoW.js";import{h as _,g as v,j as p,i as M,u as U,N as P,l as z,n as N,o as h}from"./core-C_niDoeS.js";import{fE as O,a0h as b,bo as B,bn as F,iK as K,gg as V}from"./zeni-epic-state-B-J-Dqbg.js";import{K as $,z as I,as as q,dN as G}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import{u as H}from"./useAskAiCfoHostNavButtonProps-CHt7UN_l.js";import{M as J}from"./MobileAppDrawer-vlvV1xit.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.js";import"./InboxNotificationsProvider-ChJcQEgX.js";import"./useTaskManagerAccess-DbCLyiws.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]="18e3059a-cf1d-4b23-859d-a9f66e7fa5df",e._sentryDebugIdIdentifier="sentry-dbid-18e3059a-cf1d-4b23-859d-a9f66e7fa5df")}catch{}})();const L=z((function(e){const t=I.getSignedInUser(),d=e.tenantState.currentTenantId,o={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:d??""},{aggregatedReportViewState:n}=b(e);return{authParams:o,isDisabled:!1,loggedInUser:t,aggregatedReport:n}}),(function(e,t){return{onBackClick:()=>{t.navigate("../../")},onClickMenuIcon:()=>{t.handleDrawerToggle(!0)}}}))(G),Q=()=>{const e=_(),t=v(),d=$(),o=p((a=>O(a))),{aggregatedReportViewState:n}=p((a=>b(a))),{tenantEmailDomain:m}=M(),g=U(),l=I.getSignedInUser();if(l==null)throw new Error("Can't access this page without signing in...");const f=r.useRef(!1),[w,S]=r.useState(!1),C=B(o?.userRole??[]),k=o?.userRole?.includes("bookkeeping_admin")??!1,x=F(l),y=C||k||x,c=r.useCallback(((a,i,E)=>{g(K({fromMonth:a,toMonth:i,cacheOverride:E}))}),[]);r.useEffect((()=>{n?.fetchState==="Completed"&&f.current&&(g(V({messageSection:"data_refresh_update",messageText:"success",type:"success",showStatusIcon:!0})),f.current=!1)}),[n?.fetchState]);const D=r.useCallback(((a,i)=>{n!=null&&n?.fetchState==="In-Progress"||c(a,i,!0),f.current=!0}),[n?.fetchState,c]),j=r.useCallback(((a,i)=>{c(a,i,!1)}),[c]),u=a=>{S(a)},{isAiCfoAccessEnabled:R,onAskAiCfoClick:A}=H({mobileExploreReferrer:"Performance"});return q({isDataReady:n?.fetchState==="Completed"}),y?s.jsxs(s.Fragment,{children:[s.jsx(J,{isAppContentDrawerOpen:w,handleDrawerToggle:u}),s.jsx(L,{navigate:e,location:t,themeState:d,currentTenant:o,signedInUser:l,tenantEmailDomain:m,onReload:D,onTimeRangeSelect:j,handleDrawerToggle:u,isAiCfoAccessEnabled:R,onAskAiCfoClick:A})]}):s.jsx(P,{to:`/${m}/dashboard`,replace:!0})};function he(){return s.jsxs(N,{children:[s.jsx(h,{path:"*",element:s.jsx(Q,{})}),s.jsx(h,{path:"*",element:s.jsx(T,{})})]})}export{he as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./liveblocks-CCDNnA6G.js";import W from"./NotFoundScreen-D5e2DgC8.js";import{a as p}from"./sentry-BjDPgsoW.js";import{h as C,g as D,u as V,j as c,N as k,l as U,n as Y,o as g}from"./core-C_niDoeS.js";import{fE as I,Yl as h,YC as R,MY as N,MU as L,MX as m,MN as $,Y$ as B,MR as z,M_ as K}from"./zeni-epic-state-B-J-Dqbg.js";import{z as M,w as T,c9 as X,r as _,bS as q,ca as F}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import{u as G,R as x}from"./ReimbursementApprovalRuleDetailScreen-B4mlHv4v.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]="5ba6517f-cf0c-4088-a7cb-7c70ad6bdcff",e._sentryDebugIdIdentifier="sentry-dbid-5ba6517f-cf0c-4088-a7cb-7c70ad6bdcff")}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(B(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e($(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=c((o=>o.remiSetupApproverViewState.fetchState)),u=c((o=>I(o))),d=c((o=>h(o))),b=c((o=>R(o).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{b?.updateStatus.fetchState==="Completed"&&a(N())}),[b]),p.useEffect((()=>{t||S!=="Not-Started"||e||(l(!0),a(L(!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:u.companyId!=null?[`private-encrypted-${u.companyId}.${A}`]:[],eventCallback:(o,y,j)=>{o.endsWith(A)&&j.onApprovalRulesEventReceived(o)}};return u?.companyReimbursementInfo?.info?.isReimbursementTOSAccepted===!1?r.jsx(k,{to:"../../promo"}):r.jsx(H,{currentTenant:u,location:n,navigate:s,...f})},E="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(E)&&e(B(!1))},onBackClick:()=>{_(a)?n("../../"):n("../../../reimbursements/setup")},onDeleteRuleClick:t=>{e($(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=c((a=>I(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,u]=p.useState(!1),d=c((i=>i.remiSetupApproverViewState.fetchState)),b=c((i=>i.remiSetupApproverViewState.approverListState.fetchStatus.fetchState)),f=c((i=>I(i))),o=c((i=>h(i)));G();const y=c((i=>R(i).remiSetupApproverViewUpdateData));if(p.useEffect((()=>{y?.updateStatus.fetchState==="Completed"&&a(N())}),[y]),p.useEffect((()=>{t||d!=="Not-Started"||e||(l(!0),a(L(!0,!1,!1,!0)))}),[t,d,e,a]),p.useEffect((()=>{v||b!=="Not-Started"||e||(w(!0),a(z(!1,!0)))}),[v,b,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||(u(!0),a(m())),s("./new"))}),[S,o,a]);const j={events:f.companyId!=null?[`private-encrypted-${f.companyId}.${E}`]:[],eventCallback:(i,ee,O)=>{i.endsWith(E)&&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(g,{path:"/",element:r.jsx(Q,{})}),r.jsx(g,{path:"/new",element:r.jsx(x,{})}),r.jsx(g,{path:"/:approvalRuleId/edit",element:r.jsx(x,{})}),r.jsx(g,{path:"*",element:r.jsx(W,{})})]})}export{le as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-CCDNnA6G.js";import{z as b,a8 as E,j as d,U as N,e1 as S,M as k,y as C}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import g from"./NotFoundScreen-D5e2DgC8.js";import{a as c}from"./sentry-BjDPgsoW.js";import{u as I,j as y,h as F,g as L,l as U,n as _,o as f,N as h}from"./core-C_niDoeS.js";import{fE as T,a17 as j,a18 as p,D8 as P,p_ as V,a19 as z,D6 as G}from"./zeni-epic-state-B-J-Dqbg.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.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]="27ab2337-8595-4038-b918-d33fcb7e5a33",e._sentryDebugIdIdentifier="sentry-dbid-27ab2337-8595-4038-b918-d33fcb7e5a33")}catch{}})();const M=U((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=b.getSignedInUser();return{onDismissClick:()=>{e(p()),n("/")},onSendClick:()=>{if(i!=null){const s=[],r=[];t.inviteFormCompayData.forEach((l=>{s.push(l.companyName),r.push(l.emailIds[0])})),d.trackInviteEmailClicked("send",s,r,s.length)}e(G())},onUpdateInviteFormLocalData:s=>{e(z({localData:s}))},onSubmitSuccess:()=>{e(p())},onCancelClick:()=>{i!=null&&d.trackInviteEmailClicked("cancel")}}}))(S),R=()=>{const e=I(),[t,n]=c.useState(!1),[i,s]=c.useState(!1),r=y((o=>T(o))),l=F(),w=L(),u=b.getSignedInUser();if(u==null)throw Error("Can't access invite referral screen without signing in...");const m=y((o=>j(o))),x=u?.firstName!=null?u.firstName:"User";c.useEffect((()=>{e(p()),r?.rewardsLastViewedTime==null&&i===!1&&(e(P()),s(!0))}),[]),c.useEffect((()=>{t||m.fetchState!=="Not-Started"||(n(!0),e(V(!0)))}),[m.fetchState,e]);const D=r.company?.companyInfo.companyLegalName??r.companyName;return a.jsxs(a.Fragment,{children:[m.fetchState==="Completed"?a.jsx(E,{analytics:d,onLoad:o=>(v=>v.trackPageLoaded(N.Event.inviteEmailViewed))(o)}):null,a.jsx(M,{navigate:l,location:w,currentTenant:r,companyName:D,userName:x,inviteFormCompayData:m.localData})]})};function ne(){const{useFeatureGate:e}=k(),{isFeatureEnabled:t}=e(C.isReferralFeatureEnabled);return a.jsxs(_,{children:[a.jsx(f,{path:"/",element:a.jsx(h,{to:"refer",replace:!0})}),a.jsx(f,{path:"how-it-works",element:a.jsx(h,{to:"refer",replace:!0})}),a.jsx(f,{path:"refer/*",element:t?a.jsx(R,{}):a.jsx(g,{})}),a.jsx(f,{path:"*",element:a.jsx(g,{})})]})}export{ne as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/NotFoundScreen-D5e2DgC8.js","assets/sentry-BjDPgsoW.js","assets/core-C_niDoeS.js","assets/zeni-epic-state-B-J-Dqbg.js","assets/index-BdTIsd0C.js","assets/mui-CG0oORSs.js","assets/analytics-D7uefUiL.js","assets/utils-D17QWGSb.js","assets/index-BhC2LNQw.css","assets/DashboardRoutes-DhTtyJA8.js","assets/withTransactionSidePanel-DkNsltpW.js","assets/useAskAiCfoHostNavButtonProps-CHt7UN_l.js","assets/TransactionDetailScreen-Cb5yfs3f.js","assets/decodeURIComponentSafe-DRmjOSrJ.js","assets/useInitialThreadRequest-rxOpZrgz.js","assets/routePaths-Bhwno7et.js","assets/expenseAutomationHelper-KeB0Y2So.js","assets/analyticsHelper-B-a7Fayn.js","assets/CompanyPassportScreen-B7AZ6muL.js","assets/MobileAppDrawer-vlvV1xit.js","assets/InboxNotificationsProvider-ChJcQEgX.js","assets/useTaskManagerAccess-DbCLyiws.js","assets/useAiCfoDashboardSuggestedQuestionsChips-CQRJq0ZV.js","assets/FeaturePreviewScreen-BLAUJ7pd.js","assets/BillPayRoutes-HEjZO-kj.js","assets/AddressScreen-CE2tz7A0.js","assets/DomesticWireDetailScreen-Yv6wkPjU.js","assets/BusinessVerificationPageScreen-DhS4fDp-.js","assets/DrawerScreen-CQsaXCgG.js","assets/SetupPagesScreen-CaMzRKH4.js","assets/BillPayApprovalRoutes-DGoaGoSS.js","assets/ReimbursementApprovalRuleDetailScreen-B4mlHv4v.js","assets/getLocaleForTenant-DPltcijU.js","assets/ReimbursementRoutes-Cmi5XSLV.js","assets/ReimbursementApprovalRoutes-4hrtdQB2.js","assets/TransactionListRoutes-ChMw7wyY.js","assets/ZeniAccountStatementScreen-Bpw3ybwZ.js","assets/SettingsRoutes-CIQIbtA4.js","assets/AccountMappingScreen-BAU-qRLp.js","assets/QBOConnectionScreen-B0L_AclK.js","assets/empty-plTjK7bM.js","assets/index-Bd0MxrbX.js","assets/url-C475xLhj.js","assets/index-yYSNW2wj.js","assets/accountMappingHelper-C4bJZjrw.js","assets/useEmailConnectResultRefresh-DKKrSHiH.js","assets/ReportsRoutes-Ca9z0dzs.js","assets/ChargeCardRoutes-D6hDp1gd.js","assets/useChargeCardPusherEvents-CPwkVP5N.js","assets/PeopleRoutes-DCZg6uXB.js","assets/ExpenseAutomationRoutes-DTV4TgBw.js","assets/ScheduleDetailsPrepaidExpensesScreen-CVl3oEan.js","assets/pathToGoBack-Cbtxs9kR.js","assets/TreasuryRoutes-SVHz5bxI.js","assets/VendorsRoutes-DB7RgtWf.js","assets/ZeniAccountRoutes-B2j4f9z0.js","assets/AddressRoutes-Dv524oDL.js","assets/PandLWithForecastRoutes-BiFB7431.js","assets/CustomerOnboardingRoutes-BPlSTemN.js","assets/TransactionDetailRoutes-lbbanXrr.js","assets/EntityDetailRoutes-DUPgSWiB.js","assets/InvoicingRoutes-CC22gTlb.js","assets/NotificationRoutes-CvNrjMdZ.js","assets/PerformanceRoutes-DR8cl8Ny.js","assets/RewardsRoutes-hIB4j24u.js","assets/TaskRoutes-BfExYi8s.js","assets/TaskListScreen-4UaZwa55.js","assets/AiCfoScreen-BBf4eJEu.js","assets/CardsAiCfoScreen-bSLoVBaQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{_ as s,bn as ms,fE as _s,dY as Es,dX as hs,Al as ps,dh as Rs,c8 as gs,gI as xs,g8 as js,de as pe,cG as Is,gm as Ts,cy as As,bE as fs,br as ys,Ts as Ds,v as bs,Tv as Cs,bq as vs,Tw as Os,bK as Ps,bJ as ws,bt as Us,cu as Fs,Tx as Ls,Ty as ks,d9 as Vs,dc as Hs,db as Ss,cF as Bs,cM as Ns,pR as Re,gh as ge,gX as Ms,gj as xe,gK as je,gL as Ie,gk as Zs}from"./zeni-epic-state-B-J-Dqbg.js";import{j as e}from"./liveblocks-CCDNnA6G.js";import{a as w}from"./sentry-BjDPgsoW.js";import{N as u,u as Gs,h as $s,i as zs,g as Ys,j as $,q as Te,n as qs,o as t}from"./core-C_niDoeS.js";import{P as l,E as Ws,u as Xs,z as D,M as Ks,d as Qs,p as Js,y as M,f as en,Q as sn,V as nn,L as F,G as Ae,t as _,R as tn,S as an,j as ne}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import{f as fe}from"./analyticsHelper-B-a7Fayn.js";import{t as on}from"./getLocaleForTenant-DPltcijU.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},A=new a.Error().stack;A&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[A]="fc2f7c5f-8653-4282-9265-d64c6c7e2a90",a._sentryDebugIdIdentifier="sentry-dbid-fc2f7c5f-8653-4282-9265-d64c6c7e2a90")}catch{}})();const rn=l((()=>s((()=>import("./NotFoundScreen-D5e2DgC8.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),ln=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/reimbursements`}),un=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/bills`}),ye=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/treasury`}),De=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/checking`}),be=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/cards`}),b=({showZeniAccountRoute:a,isUserHasBillPayAccess:A,isUserHasReimbursementAccess:S,showTreasuryRoute:i,isTenantBankingOnly:k,showChargeCardRoute:O,tenantEmailDomain:v})=>{if(k===!0){if(a)return e.jsx(De,{tenantEmailDomain:v});if(i)return e.jsx(ye,{tenantEmailDomain:v});if(O)return e.jsx(be,{tenantEmailDomain:v})}return a?e.jsx(De,{tenantEmailDomain:v}):i?e.jsx(ye,{tenantEmailDomain:v}):O?e.jsx(be,{tenantEmailDomain:v}):A?e.jsx(un,{tenantEmailDomain:v}):S?e.jsx(ln,{tenantEmailDomain:v}):e.jsx(rn,{})},dn={dashboard:()=>s((()=>import("./DashboardRoutes-DhTtyJA8.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,0,17,18,19,20,21,22,23,8])),bills:()=>s((()=>import("./BillPayRoutes-HEjZO-kj.js")),__vite__mapDeps([24,1,2,3,4,5,6,7,25,0,26,11,14,27,15,19,20,21,28,23,29,17,30,31,32,8])),reimbursement:()=>s((()=>import("./ReimbursementRoutes-Cmi5XSLV.js")),__vite__mapDeps([33,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,11,14,28,34,31,32,8])),transactions:()=>s((()=>import("./TransactionListRoutes-ChMw7wyY.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])),settings:()=>s((()=>import("./SettingsRoutes-CIQIbtA4.js")),__vite__mapDeps([37,1,2,3,4,5,6,7,21,38,19,20,39,40,41,42,43,13,44,25,0,17,27,15,18,45,30,31,34,8])),reports:()=>s((()=>import("./ReportsRoutes-Ca9z0dzs.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])),chargeCards:()=>s((()=>import("./ChargeCardRoutes-D6hDp1gd.js")),__vite__mapDeps([47,1,2,3,4,5,6,7,11,19,20,21,29,27,15,0,17,14,48,25,8])),people:()=>s((()=>import("./PeopleRoutes-DCZg6uXB.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])),expenseAutomation:()=>s((()=>import("./ExpenseAutomationRoutes-DTV4TgBw.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,51,52,10,44,28,8])),treasury:()=>s((()=>import("./TreasuryRoutes-SVHz5bxI.js")),__vite__mapDeps([53,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])),vendors:()=>s((()=>import("./VendorsRoutes-DB7RgtWf.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,25,0,23,51,52,15,11,19,20,21,28,44,8])),zeniAccounts:()=>s((()=>import("./ZeniAccountRoutes-B2j4f9z0.js")),__vite__mapDeps([55,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8]))},cn=["bills","transactions","settings","reimbursement","reports","chargeCards","people"],te=a=>{"requestIdleCallback"in window?requestIdleCallback(a):setTimeout(a,100)},mn=l((()=>s((()=>import("./ReportsRoutes-Ca9z0dzs.js")),__vite__mapDeps([46,1,2,3,4,5,6,7,0,23,14,15,19,20,21,8])))),_n=l((()=>s((()=>import("./AddressRoutes-Dv524oDL.js")),__vite__mapDeps([56,1,2,3,25,4,5,6,7,0,8])))),En=l((()=>s((()=>import("./PeopleRoutes-DCZg6uXB.js")),__vite__mapDeps([49,1,2,3,4,5,6,7,0,11,19,20,21,8])))),hn=l((()=>s((()=>import("./PandLWithForecastRoutes-BiFB7431.js")),__vite__mapDeps([57,1,2,3,4,5,6,7,0,23,11,14,15,19,20,21,8])))),pn=l((()=>s((()=>import("./CustomerOnboardingRoutes-BPlSTemN.js")),__vite__mapDeps([58,1,2,3,25,4,5,6,7,0,39,40,41,42,43,13,45,48,8])))),Rn=l((()=>s((()=>import("./VendorsRoutes-DB7RgtWf.js")),__vite__mapDeps([54,1,2,3,4,5,6,7,25,0,23,51,52,15,11,19,20,21,28,44,8])))),gn=l((()=>s((()=>import("./TransactionDetailRoutes-lbbanXrr.js")),__vite__mapDeps([59,1,2,3,0,4,5,6,7,12,11,13,14,15,16,8])))),Ce=l((()=>s((()=>import("./EntityDetailRoutes-DUPgSWiB.js")),__vite__mapDeps([60,1,2,3,4,5,6,7,13,10,11,12,14,15,16,8])))),xn=l((()=>s((()=>import("./DashboardRoutes-DhTtyJA8.js")),__vite__mapDeps([9,1,2,3,4,5,6,7,10,11,12,13,14,15,16,0,17,18,19,20,21,22,23,8])))),ve=l((()=>s((()=>import("./BillPayRoutes-HEjZO-kj.js")),__vite__mapDeps([24,1,2,3,4,5,6,7,25,0,26,11,14,27,15,19,20,21,28,23,29,17,30,31,32,8])))),jn=l((()=>s((()=>import("./SettingsRoutes-CIQIbtA4.js")),__vite__mapDeps([37,1,2,3,4,5,6,7,21,38,19,20,39,40,41,42,43,13,44,25,0,17,27,15,18,45,30,31,34,8])))),In=l((()=>s((()=>import("./InvoicingRoutes-CC22gTlb.js")),__vite__mapDeps([61,1,2,3,4,5,6,7,25,0,19,20,21,39,40,41,42,43,13,8])))),Oe=l((()=>s((()=>import("./ReimbursementRoutes-Cmi5XSLV.js")),__vite__mapDeps([33,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,11,14,28,34,31,32,8])))),Tn=l((()=>s((()=>import("./ZeniAccountRoutes-B2j4f9z0.js")),__vite__mapDeps([55,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,23,26,25,11,36,8])))),An=l((()=>s((()=>import("./TreasuryRoutes-SVHz5bxI.js")),__vite__mapDeps([53,1,2,3,4,5,6,7,0,29,27,15,19,20,21,17,11,14,23,8])))),fn=l((()=>s((()=>import("./TransactionListRoutes-ChMw7wyY.js")),__vite__mapDeps([35,1,2,3,4,5,6,7,10,11,12,13,14,15,16,36,8])))),yn=l((()=>s((()=>import("./ChargeCardRoutes-D6hDp1gd.js")),__vite__mapDeps([47,1,2,3,4,5,6,7,11,19,20,21,29,27,15,0,17,14,48,25,8])))),Dn=l((()=>s((()=>import("./NotificationRoutes-CvNrjMdZ.js")),__vite__mapDeps([62,1,2,3,0,4,5,6,7,11,21,8])))),bn=l((()=>s((()=>import("./PerformanceRoutes-DR8cl8Ny.js")),__vite__mapDeps([63,1,2,3,0,4,5,6,7,11,19,20,21,8])))),Cn=l((()=>s((()=>import("./ExpenseAutomationRoutes-DTV4TgBw.js")),__vite__mapDeps([50,1,2,3,0,4,5,6,7,11,12,13,14,15,16,51,52,10,44,28,8])))),vn=l((()=>s((()=>import("./RewardsRoutes-hIB4j24u.js")),__vite__mapDeps([64,1,2,3,4,5,6,7,0,8])))),On=l((()=>s((()=>import("./TaskRoutes-BfExYi8s.js")),__vite__mapDeps([65,1,2,3,0,4,5,6,7,14,19,20,21,66,11,8])))),Pn=l((()=>s((()=>import("./AiCfoScreen-BBf4eJEu.js")),__vite__mapDeps([67,1,2,3,4,5,6,7,22,52,15,8])))),Pe=l((()=>s((()=>import("./CardsAiCfoScreen-bSLoVBaQ.js")),__vite__mapDeps([68,1,2,3,4,5,6,7,8])))),C=l((()=>s((()=>import("./NotFoundScreen-D5e2DgC8.js")),__vite__mapDeps([0,1,2,3,4,5,6,7,8])))),wn=l((()=>s((()=>import("./TaskListScreen-4UaZwa55.js").then((a=>a.f))),__vite__mapDeps([66,1,2,3,4,5,6,7,11,19,20,21,8])))),Un=({isDashboardAccess:a,showZeniAccountRoute:A,isUserHasBillPayAccess:S,isUserHasReimbursementAccess:i,showTreasuryRoute:k,isTenantBankingOnly:O,isTenantCardsOnly:v,showChargeCardRoute:V})=>{if(O===!0){if(A)return e.jsx(u,{to:"checking"});if(k)return e.jsx(u,{to:"treasury"});if(V)return e.jsx(u,{to:"cards"})}return v===!0&&V?e.jsx(u,{to:"cards"}):a?e.jsx(u,{to:"dashboard"}):A?e.jsx(u,{to:"checking"}):k?e.jsx(u,{to:"treasury"}):V?e.jsx(u,{to:"cards"}):S?e.jsx(u,{to:"bills"}):i?e.jsx(u,{to:"reimbursements"}):e.jsx(u,{to:"dashboard"})},we=({tenantEmailDomain:a})=>e.jsx(u,{to:`/${a}/dashboard`}),Mn=Object.freeze(Object.defineProperty({__proto__:null,default:function({setTenantEmailDomain:a}){const A=Gs(),S=$s(),{tenantEmailDomain:i}=zs(),k=Ws().mode,{setLoading:O,clearAllLoading:v,clearLoading:V}=Xs(),f=D.getSignedInUserTenant(i)?.tenantId,I=D.getSignedInUser(),X=ms(I),z=Ys(),[L,Ue]=w.useState(!1),r=$((o=>_s(o))),{useFeatureGate:B}=Ks(),Z=Qs(),ae=Js(),Fe=!!r.company?.companyZeniAccountInfo?.isZeniAccountEnabled,Le=r.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",{isFeatureEnabled:ke}=B(M.isChargeCardFeatureEnabled),{isFeatureEnabled:oe}=B(M.isDebitCardFeatureEnabled),T=$((o=>o.tenantState.fetchState)),p=$((o=>o.tenantState.activeTenantFetchState.fetchState)),E=p==="Completed"||T==="Completed"?Es(oe,r):void 0,K=p==="Completed"||T==="Completed"?hs(r):void 0,re=p==="Completed"||T==="Completed"?ps(r)&&!Rs(r):void 0,Ve=en(r,ke,oe),{isCardsHidden:He}=sn(r?.tenantId),Se=!Ve||!!He,{isFeatureEnabled:Be}=B(M.isSettingsFeatureEnabled),{isFeatureEnabled:Q}=B(M.isAiCfoFileUploadEnabled),{isFeatureEnabled:Ne}=B(M.isInvoicingFeatureEnabled??"is_invoicing_feature_enabled"),Me=Ne||an==="DEV",Ze=r?.userRole!=null&&gs(r.userRole),Y=$((o=>xs(o)));if(i!=null){const o=D.getSignedInUserTenant(i);I!=null&&o!=null&&fe(I,r,k)}const G={tenantId:f,userId:I?.userId,sessionId:I?.zeniSessionId},ie=js(),h=nn(),Ge=r.company==null||h?.loggedInUserRoleMap!=null&&pe(h.loggedInUserRole),$e=Is(h?.loggedInUserRoleMap),J=Te("/:tenantEmailDomain/onboarding/*")!==null,ee=Te("/:tenantEmailDomain/month_end_close_checks/review/:selectedTab/:selectedPeriod/*"),ze=$((o=>G.tenantId!=null?Ts(o,G.tenantId):void 0));w.useEffect((()=>{O(F.TENANT_FETCHING),a(i)}),[i]),w.useEffect((()=>{if(ee!=null&&f!=null){const o=ee.params.selectedPeriod;if(o!=null){const y=o.split("-");if(y.length===2){const d=As(Number(y[0])),n=Number(y[1]),c=fs(`01-${d<10?`0${d}`:d}-${n}`,Ae.getLocalizedStrings().dateFormat.analytics.DDDashMMDashYYYY),N=ys();c.isAfter(N,"month")===!1?A(Ds(f,{month:d,year:n})):S(`/${i}/month_end_close_checks/review`)}}}}),[ee,f]),w.useEffect((()=>{L||(Ue(!0),O(F.TENANT_FETCHING))}),[L,G,ie,I,A,D]),w.useLayoutEffect((()=>{!bs(ie,G)&&D.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,y,d,n){if(ge(y?.userId,y?.zeniSessionId,o.tenantId),d(Ms(!0)),d(xe(o.tenantId)),o.tenantId!=null&&_.clearTenant(o.tenantId),o.tenantId!=null){const c=D.getSignedInUserTenantWithId(o.tenantId);n&&Ae.updateAppLocaleID(on(n)),c?.tenantEmailDomain!=null&&D.saveActiveTenantDomainForUser(c?.tenantEmailDomain)}o.userId!=null?ne.identify(o.userId,{tenant_id:o.tenantId}):ne.resetUserIdentity()})(G,I,A,ze))}),[f]),w.useEffect((()=>{D.isSignedIn()&&(O(F.TENANT_FETCHING),(function(o,y,d,n,c,N,H){if(d==null&&n==null)return void console.warn("There is no current tenant selected!!");const q=n!=null&&c?.zeniSessionId!=null,us=d==null||d.tenantId!==n,ds=d!=null&&d.excludedResources==null,cs=d!=null&&d.externalConnections==null;if(q&&us){H(xe(n));const W=D.getSignedInUserTenantWithId(n);W?.tenantEmailDomain!=null&&D.saveActiveTenantDomainForUser(W?.tenantEmailDomain),ge(c?.userId,c?.zeniSessionId,n),_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),H(je(c.userId,n))),_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),H(Ie(c.userId,n)))}else q&&ds&&_.shouldFetchExcludedResources(n)&&(_.markExcludedResourcesFetchStarted(n),H(je(c.userId,n))),q&&cs&&_.shouldFetchConnections(n)&&(_.markConnectionsFetchStarted(n),H(Ie(c.userId,n)));if(q){ne.identify(c.userId,{tenant_id:n});const W=n==null||n!=null&&(y==="Completed"||y==="Error");o==="Completed"||y!=="Not-Started"&&y!=="Error"||n==null||!_.shouldFetchActiveTenant(n)||(_.markActiveTenantFetchStarted(n),N(F.TENANT_FETCHING),H(Zs(c.userId,n,c.zeniSessionId))),W&&(o==="Not-Started"||o==="Error")&&_.shouldFetchAllTenants()&&(_.markAllTenantsFetchStarted(),H(Re(c.userId,c.zeniSessionId)))}})(T,p,r,f,I,O,A))}),[f,p]),w.useEffect((()=>{D.isSignedIn()&&T==="Completed"&&Y.tenantsBaseInOrder.length>0&&(V(F.TENANT_FETCHING),D.saveSignedInUserTenants(Cs(Y.tenantsBaseInOrder)),I!=null&&fe(I,r,k,void 0,Y.tenantsBaseInOrder))}),[Y,T,r,I]),w.useEffect((()=>{p==="In-Progress"&&O(F.TENANT_FETCHING),p!=="Completed"&&p!=="Error"||(p==="Completed"&&f!=null?(v(),_.markActiveTenantFetchCompleted(f)):p==="Error"&&f!=null&&(_.markActiveTenantFetchFailed(f),V(F.TENANT_FETCHING),V(F.TENANT_SWITCHING))),T!=="Completed"&&T!=="Error"||(T==="Completed"?_.markAllTenantsFetchCompleted():T==="Error"&&_.markAllTenantsFetchFailed())}),[p,T,f,L]);const le=w.useRef(!1);w.useEffect((()=>{!le.current&&p==="Completed"&&L&&(le.current=!0,(function(o=cn,y=3e3){setTimeout((()=>{const d=n=>{if(n>=o.length)return;const c=o[n],N=dn[c];N!=null?N().then((()=>te((()=>d(n+1))))).catch((()=>te((()=>d(n+1))))):d(n+1)};te((()=>d(0)))}),y)})())}),[p,L]);const P=r?.userRole!=null&&vs(r?.userRole),{isFeatureEnabled:Ye}=B(M.isReferralFeatureEnabled),qe=r?.userRole!=null&&r.userRole.includes("charge_card_user"),We=r?.userRole!=null&&r.userRole.includes("charge_card_admin"),U=r?.userRole!=null&&pe(r.userRole),ue=r?.company==null||r.company.featuresActivationInfo?.isBillPayFeatureEnabled&&!P,de=!Se&&!P,Xe=Os(h?.loggedInUserRoleMap),Ke=r.externalConnections?.accounting[0]?.isValid,Qe=r.externalConnections?.fetchState==="Completed",se=r.company?.companyOnboardingInfo.isOnboardingCompleted,ce=r?.company==null||r.company.featuresActivationInfo?.isReimbursementFeatureEnabled&&!P,me=ce&&Ps(h?.loggedInUserRoleMap),_e=Fe&&!P,Je=Le&&!P,es=ue&&ws(h?.loggedInUserRoleMap),ss=de&&Us(h?.loggedInUserRoleMap),ns=_e&&Fs(h?.loggedInUserRoleMap),ts=Ls(h?.loggedInUserRoleMap),as=ks(h?.loggedInUserRoleMap),os=Vs(h?.loggedInUserRoleMap),rs=Hs(h?.loggedInUserRoleMap),is=Ss(h?.loggedInUserRoleMap),R=Bs(h?.loggedInUserRoleMap),g=Ns(h?.loggedInUserRoleMap),Ee=ue&&R,he=ce&&g,x=_e&&os,j=Je&&rs,m=de&&is,ls=r.excludedResources?.resources?.find((o=>o.resource==="/invites"))!=null||$e===!0||Xe===!0||ts===!0||as===!0;return D.isSignedIn()?f==null?T==="Completed"?e.jsx(u,{to:"/",replace:!0,state:{...z.state,message:"...",origin:z.pathname}}):(I!=null&&T!=="In-Progress"&&A(Re(I.userId,I.zeniSessionId)),null):p!=="In-Progress"&&p!=="Not-Started"||T==="Completed"?(se===!0||X&&!J)&&Qe&&Ke!==!0&&E===!1&&K===!1&&re===!1?(a(void 0),e.jsx(u,{to:"/connection/auth",replace:!0})):!L||re!==!0||se!==!0||J||X?!L||se!==!1||J||X?L&&r?.userRole&&E!=null&&K!=null&&i!=null&&Object.keys(h.loggedInUserRoleMap).length>0?e.jsx(qs,{children:e.jsxs(t,{element:e.jsx(tn,{}),children:[e.jsx(t,{path:"/",element:e.jsx(Un,{isDashboardAccess:U,showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,isTenantCardsOnly:K,showChargeCardRoute:m})}),e.jsx(t,{path:"dashboard/*",element:U?e.jsx(xn,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"reports/*",element:U?e.jsx(mn,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"people/*",element:ls||U?e.jsx(En,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"forecast/*",element:U?e.jsx(hn,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"onboarding/*",element:e.jsx(pn,{})}),e.jsx(t,{path:"transaction/*",element:U&&P===!1||qe||We?e.jsx(gn,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"transactions/*",element:U&&P===!1?e.jsx(fn,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"customer/*",element:U&&P===!1?e.jsx(Ce,{entityType:"customer"}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,isTenantBankingOnly:E,showTreasuryRoute:j,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"vendor/*",element:U&&P===!1?e.jsx(Ce,{entityType:"vendor"}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"tasks",element:e.jsx(wn,{})}),e.jsx(t,{path:"tasks/*",element:e.jsx(On,{})}),e.jsx(t,{path:"address/*",element:es||me||ns||ss?e.jsx(_n,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"checking/*",element:x?e.jsx(Tn,{}):e.jsx(C,{})}),e.jsx(t,{path:"treasury/*",element:j?e.jsx(An,{}):e.jsx(C,{})}),e.jsx(t,{path:"performance",element:ae===!0?e.jsx(bn,{}):e.jsx(we,{tenantEmailDomain:i})}),e.jsx(t,{path:"month_end_close_checks/review/*",element:ae===!0&&P===!1?e.jsx(Cn,{}):e.jsx(we,{tenantEmailDomain:i})}),e.jsx(t,{path:"notifications/*",element:e.jsx(Dn,{})}),e.jsx(t,{path:"vendors/*",element:Ge?e.jsx(Rn,{}):e.jsx(C,{})}),e.jsx(t,{path:"bill/*",element:Ee?e.jsx(ve,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"bills/*",element:Ee?e.jsx(ve,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"reimbursement/*",element:he?e.jsx(Oe,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"reimbursements/*",element:he?e.jsx(Oe,{}):e.jsx(b,{showZeniAccountRoute:x,isUserHasBillPayAccess:R,isUserHasReimbursementAccess:g,showTreasuryRoute:j,isTenantBankingOnly:E,showChargeCardRoute:m,tenantEmailDomain:i})}),e.jsx(t,{path:"settings/*",element:Be?e.jsx(jn,{hasAdminLevelAccess:me}):e.jsx(C,{})}),e.jsx(t,{path:"invoicing/*",element:Me&&Ze?e.jsx(In,{}):e.jsx(C,{})}),e.jsx(t,{path:"cards/ask",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:Q}):e.jsx(C,{})}),e.jsx(t,{path:"cards/ask/:session_id",element:m&&Z?e.jsx(Pe,{isFileUploadEnabled:Q}):e.jsx(C,{})}),e.jsx(t,{path:"cards/*",element:m?e.jsx(yn,{}):e.jsx(C,{})}),e.jsx(t,{path:"rewards/*",element:Ye?e.jsx(vn,{}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo/",element:Z?e.jsx(u,{to:"explore"}):e.jsx(C,{})}),e.jsx(t,{path:"/ai-cfo/:session_id",element:Z?e.jsx(Pn,{isFileUploadEnabled:Q}):e.jsx(C,{})}),e.jsx(t,{path:"*",element:e.jsx(C,{})})]})}):null:(a(void 0),e.jsx(u,{to:`/${i}/onboarding`,replace:!0})):(a(void 0),e.jsx(u,{to:`/${i}/onboarding/thankyou`,replace:!0})):null:(console.warn("User logged out!!"),a(void 0),e.jsx(u,{to:"/signin/auth",replace:!0,state:{...z.state,message:"...",origin:z.pathname}}))}},Symbol.toStringTag,{value:"Module"}));export{b as F,Mn as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as f}from"./liveblocks-CCDNnA6G.js";import{a as u,R as x,q as A}from"./sentry-BjDPgsoW.js";import{u as D,h as j,j as l,g as z,N as M,l as O}from"./core-C_niDoeS.js";import{u as P,z as s,E as B,j as w,G as F,T as _,U as N,W as $,X as V,Y as W,Z as v}from"./index-BdTIsd0C.js";import{fE as q,Tb as J,Tv as R,gh as X,gj as Y,TA as G,gT as H,di as Z,TB as T,TC as K,TD as Q,b$ as y}from"./zeni-epic-state-B-J-Dqbg.js";import"./mui-CG0oORSs.js";import{u as ee}from"./useDeviceId-C5uH2VJL.js";import{f as te}from"./analyticsHelper-B-a7Fayn.js";import{t as ne}from"./getLocaleForTenant-DPltcijU.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new t.Error().stack;i&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[i]="082854f3-b32f-4a80-9992-8f7a26dbffd7",t._sentryDebugIdIdentifier="sentry-dbid-082854f3-b32f-4a80-9992-8f7a26dbffd7")}catch{}})();const ie=O((function(t,i){const d=t.tenantState.fetchState,g=t.tenantState.sendEmailMagicLinkFetchState,{magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}=i;return{googleClientId:v.googleClientId,microsoftClientId:v.microsoftClientId,signInError:t.tenantState.error?.error,fetchState:d,sendMagicLinkStatus:g,magicLinkExpired:n,magicLinkAlreadyUsed:a,magicLinkExpiredEmail:c}}),(function(t,i){const{location:d,navigate:g}=i;return console.warn(JSON.stringify(window.location)),{onOAuthError:(n,a)=>{A({message:`OAuth error from provider ${a} with error ${n}`,level:"error",tags:{authProvider:a,errorType:"zeni.login.error"},extra:{error:n,windowLocation:window.location.href}})},onOAuthSuccess:(n,a)=>{const c=a==="google"?window.location.origin:window.location.origin+window.location.pathname;t(Q({authCode:n,oauthProvider:a,appType:"web",redirectUri:y(c),sourceUri:y(d.state!=null?d.state.origin:"")}))},getSignedInUser:()=>s.getSignedInUser(),onSignedInCallback:()=>{const n=d.state?.origin;n&&n!=="/"?g(n,{replace:!0}):window.open(window.location.origin,"_self")},sendMagicLink:n=>{const{deviceId:a}=i;a!=null&&(s.saveMagicLinkEmail(n),t(K(n,a)))},clearSignInError:()=>{t(T())}}}))(W),ae=x.memo(ie);function ve({setTenantEmailDomain:t}){const i=D(),d=j(),{clearAllLoading:g}=P(),n=s.getSignedInUser();u.useLayoutEffect((()=>{g()}),[g]);const a=ee(),c=l((e=>e.tenantState.magicLinkCodeVerifier)),{sendEmailMagicLinkFetchState:h,accountLocked:b,accountUnlockTime:E}=l((e=>e.tenantState)),p=l((e=>e.tenantState.fetchState)),L=l((e=>e.tenantState.activeTenantFetchState.fetchState)),S=l((e=>e.tenantState.signInState)),o=l((e=>e.tenantState.loggedInUser)),r=l((e=>q(e))),I=l((e=>J(e))),m=z(),k=B().mode,C=m.state?.magicLinkExpired,U=m.state?.magicLinkAlreadyUsed;if(u.useEffect((()=>{h.fetchState==="Completed"&&c!=null&&(w.trackSignInLinkSent(),s.saveMagicLinkCodeVerifier(c))}),[h.fetchState,c]),u.useEffect((()=>{t(void 0)}),[]),u.useEffect((()=>{S!=="In-Progress"||p!=="Completed"&&L!=="Completed"||o?.zeniSessionId==null||r==null||(s.savePayNowInfoTooltip(!0,o.zeniSessionId),s.saveSignedInUserWithSession(o,o.zeniSessionId),s.saveSignedInUserTenants(R(I.tenantsInOrder),o.zeniSessionId),X(o.userId,o.zeniSessionId,r.tenantId),i(Y(r.tenantId)),s.saveActiveTenantDomainForUser(r.tenantEmailDomain),i(G("Completed")),F.updateAppLocaleID(ne(r)),te(o,r,k,void 0,I.tenantsInOrder),H().then((()=>{const e=V();e!=null&&_(e)})),setTimeout((()=>{w.trackLogin(N.Event.loginSuccess,o.authProvider??"google",Z(r.productSettings))}),2e3))}),[S,p,L,o,r,I,k,m.state,i]),S==="In-Progress"&&p==="Completed"&&o?.zeniSessionId!=null&&r!=null||n!=null){const e=m.state?.origin??"/";return f.jsx(M,{to:e,state:{...m.state,origin:""}})}return f.jsxs(f.Fragment,{children:[f.jsx(ae,{magicLinkExpired:!!C,magicLinkAlreadyUsed:!!U,magicLinkExpiredEmail:s.getMagicLinkEmail()??void 0,location:m,navigate:d,deviceId:a??void 0,showEmailLogin:!0}),b===!0&&E!=null?f.jsx($,{onClose:()=>i(T()),unlockDate:E}):null]})}export{ve as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./liveblocks-CCDNnA6G.js";import{a as i}from"./sentry-BjDPgsoW.js";import{u as c,g as l,N as u}from"./core-C_niDoeS.js";import{z as n,j as a,U as m,a7 as p}from"./index-BdTIsd0C.js";import{gW as g,TR as y}from"./zeni-epic-state-B-J-Dqbg.js";import{n as b}from"./mui-CG0oORSs.js";import"./recharts-7qGQ-5hE.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.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]="d371f67f-90dd-4652-9abd-36cda4edc325",e._sentryDebugIdIdentifier="sentry-dbid-d371f67f-90dd-4652-9abd-36cda4edc325")}catch{}})();function L(){const e=c(),t=l(),r=i.useRef(!1),d=n.isSignedIn(),o=t.state?.message==="logout"||d;return i.useEffect((()=>{if(o&&!r.current){r.current=!0;try{e(g()),y(),a.trackLogout(m.Event.logoutSuccess),a.resetUserIdentity(),n.clearAll()}catch(f){console.error("Error during sign out:",f)}finally{window.location.replace("/signin/auth")}}}),[o,e]),o?s.jsx(h,{children:s.jsx(p,{fetchState:"In-Progress"})}):s.jsx(u,{to:"../",replace:!0})}const h=b.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100vh;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex: 1 1 auto;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
align-items: center;
|
|
8
|
-
background-color: ${e=>e.theme.colors.grey4};
|
|
9
|
-
`;export{L as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./liveblocks-CCDNnA6G.js";import i from"./NotFoundScreen-D5e2DgC8.js";import{T as r}from"./TransactionDetailScreen-Cb5yfs3f.js";import"./sentry-BjDPgsoW.js";import{n as d,o}from"./core-C_niDoeS.js";import"./zeni-epic-state-B-J-Dqbg.js";import"./recharts-7qGQ-5hE.js";import"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";import"./analytics-D7uefUiL.js";import"./plaid-b9MOUNjK.js";import"./dnd-D1zQ4XOY.js";import"./stripe-cKAAJElX.js";import"./lottie-Cik7Vc5G.js";import"./lexical-DIbwTPqX.js";import"./pdf-B5xhf5T3.js";import"./utils-D17QWGSb.js";import"./useAskAiCfoHostNavButtonProps-CHt7UN_l.js";import"./decodeURIComponentSafe-DRmjOSrJ.js";import"./useInitialThreadRequest-rxOpZrgz.js";import"./routePaths-Bhwno7et.js";import"./expenseAutomationHelper-KeB0Y2So.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="07c2895c-270d-414b-a4ec-49ceb0cdd05a",e._sentryDebugIdIdentifier="sentry-dbid-07c2895c-270d-414b-a4ec-49ceb0cdd05a")}catch{}})();function z(){return t.jsxs(d,{children:[t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId",element:t.jsx(r,{})}),t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId/page-not-found",element:t.jsx(i,{})}),t.jsx(o,{path:"/:transactionTypeEncoded/:transactionId/vendor/create",element:t.jsx(r,{})}),t.jsx(o,{path:"/*",element:t.jsx(r,{})})]})}export{z as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as u}from"./sentry-BjDPgsoW.js";import{h as b,g,i as h,j as S}from"./core-C_niDoeS.js";import{fE as k}from"./zeni-epic-state-B-J-Dqbg.js";import{a as y,a1 as C,d as A,ar as T,B as I,k as E,au as w}from"./index-BdTIsd0C.js";import"./mui-CG0oORSs.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new e.Error().stack;a&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[a]="b8515230-7659-4a3a-a705-46c9553ae134",e._sentryDebugIdIdentifier="sentry-dbid-b8515230-7659-4a3a-a705-46c9553ae134")}catch{}})();function B(e){const{mobileExploreReferrer:a}=e,{isAiCfoOpen:r,setIsAiCfoOpen:i}=y(),s=b(),o=g(),{tenantEmailDomain:n}=h(),l=C(),f=w(l),d=A(),p=T(),m=S((t=>t.tenantState.fetchState==="Completed"||t.tenantState.activeTenantFetchState.fetchState==="Completed"?k(t):void 0)),c=m?.masterTOSInfo?.isMasterTOSAccepted??!1;return{isAiCfoAccessEnabled:p&&d&&!r,onAskAiCfoClick:u.useCallback((()=>{if(n!=null)if(c)if(f){const t=E(o.state?.pathnameStackToGoBack,o.pathname);s(`/${n}/ai-cfo/explore`,{state:{pathnameStackToGoBack:t,referrer:a}})}else i(!0);else I({location:o,navigate:s,mergeState:{referrer:a}})}),[c,f,o,a,s,i,n])}}export{B as u};
|