@zeniai/web-app-ui 5.3.86-dev → 5.3.87-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-BXvURRvs.js → AccountMappingScreen-9MHulU9s.js} +2 -2
- package/dist/assets/{ActualMatchingMatchDetailScreen-CkPu1Iyz.js → ActualMatchingMatchDetailScreen-Db6bbB6u.js} +1 -1
- package/dist/assets/AddressRoutes-DHraPu2z.js +1 -0
- package/dist/assets/AddressScreen-BOTH_mRu.js +9 -0
- package/dist/assets/{AiCfoScreen-Akbbu7OO.js → AiCfoScreen-bjaeBeb9.js} +1 -1
- package/dist/assets/{AppDrawer-B4rZP8Bn.js → AppDrawer-UbqqLXJe.js} +1 -1
- package/dist/assets/{BillPayApprovalRoutes-BG_fZlTC.js → BillPayApprovalRoutes-CYDv31qk.js} +1 -1
- package/dist/assets/{BillPayRoutes-pg5PH9Oh.js → BillPayRoutes-C4GXOC5A.js} +6 -6
- package/dist/assets/BusinessVerificationPageScreen-CqSHzLo6.js +9 -0
- package/dist/assets/{CardsAiCfoScreen-hMGqj2aq.js → CardsAiCfoScreen-DZorjbaf.js} +1 -1
- package/dist/assets/{ChargeCardRoutes-STh2Wp7w.js → ChargeCardRoutes-C7tzEoGV.js} +6 -6
- package/dist/assets/CompanyPassportScreen-DViAGsze.js +1 -0
- package/dist/assets/{ConnectionAuthScreen-BKVwXbSh.js → ConnectionAuthScreen-yW3T26AI.js} +3 -3
- package/dist/assets/CustomerOnboardingAuthScreen-CEs020qJ.js +1 -0
- package/dist/assets/{CustomerOnboardingRoutes-CNIJctLU.js → CustomerOnboardingRoutes-B2flxgjR.js} +5 -5
- package/dist/assets/{DashboardRoutes-Cq-Lxh3h.js → DashboardRoutes-D6igUQ_c.js} +3 -3
- package/dist/assets/{DefaultTenantHome-CshmDcap.js → DefaultTenantHome-CMpQllfi.js} +1 -1
- package/dist/assets/DomesticWireDetailScreen-D-XdJZt2.js +18 -0
- package/dist/assets/{DrawerScreen-CBAh6dJa.js → DrawerScreen-DquM7PdJ.js} +1 -1
- package/dist/assets/EntityDetailRoutes-B7vzEsHl.js +1 -0
- package/dist/assets/{ExpenseAutomationRoutes-FZqTLeVo.js → ExpenseAutomationRoutes-o1rALTgt.js} +6 -6
- package/dist/assets/{FeaturePreviewScreen-CZR8YW-L.js → FeaturePreviewScreen-B0SxkBd3.js} +1 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CYGRU6le.js +1 -0
- package/dist/assets/{InboxNotificationsProvider-T1CjerOs.js → InboxNotificationsProvider-DPgK9Ai7.js} +1 -1
- package/dist/assets/{InvoicingRoutes-Ys89tvz2.js → InvoicingRoutes-BroIFZYm.js} +1 -1
- package/dist/assets/{MagicLinkRoutes-DR9AEDCZ.js → MagicLinkRoutes-BYZevXyH.js} +5 -5
- package/dist/assets/MagicLinkSignInScreen-DqgSvyNq.js +12 -0
- package/dist/assets/{MobileAppDrawer-CtIgBgQ-.js → MobileAppDrawer-C6gfQS8M.js} +1 -1
- package/dist/assets/NotFoundScreen-0hF8kIyY.js +1 -0
- package/dist/assets/NotificationRoutes-BRYauJLR.js +1 -0
- package/dist/assets/OAuthConsentScreen-B_ncopNh.js +1 -0
- package/dist/assets/PandLWithForecastRoutes-BU_XWD0n.js +1 -0
- package/dist/assets/{PaymentLinkScreen-EXZ3ZrN9.js → PaymentLinkScreen-6qwvkVJe.js} +1 -1
- package/dist/assets/{PeopleRoutes-CCoQcfmM.js → PeopleRoutes-BT10_5ZZ.js} +5 -5
- package/dist/assets/{PerformanceRoutes-Bx8pszb9.js → PerformanceRoutes-DEM0F09k.js} +1 -1
- package/dist/assets/{Preview-C3KwiSeU.js → Preview-xYIpXmh0.js} +1 -1
- package/dist/assets/{QBOConnectionScreen-B_IVukb7.js → QBOConnectionScreen-CPdRdNFp.js} +1 -1
- package/dist/assets/{ReimbursementApprovalRoutes-Dm2Et1-C.js → ReimbursementApprovalRoutes-kSFV0KaQ.js} +1 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-CD8m8c7W.js +1 -0
- package/dist/assets/{ReimbursementRoutes-D1jTtRL_.js → ReimbursementRoutes-B7HRPmdv.js} +4 -4
- package/dist/assets/{ReportsRoutes-DwdL-iuL.js → ReportsRoutes-CkYyyTje.js} +1 -1
- package/dist/assets/{RewardsRoutes-CKpKVKBM.js → RewardsRoutes-kEA_DefW.js} +1 -1
- package/dist/assets/{ScheduleDetailsPrepaidExpensesScreen-BTUJ8zwC.js → ScheduleDetailsPrepaidExpensesScreen-DH-G2ABB.js} +4 -4
- package/dist/assets/{ScreenRoutes-_NAgJfqV.js → ScreenRoutes-C72NzSAe.js} +2 -2
- package/dist/assets/{SettingsRoutes-BK2pVuXm.js → SettingsRoutes-gBgMK1MW.js} +5 -5
- package/dist/assets/{SetupPagesScreen-CUiMxOyt.js → SetupPagesScreen-CIrP22mo.js} +4 -4
- package/dist/assets/{SignInScreen-B16ytfH2.js → SignInScreen-DAl9_AVs.js} +1 -1
- package/dist/assets/SignOutScreen-CvQRUG30.js +9 -0
- package/dist/assets/TaskListScreen-DI37lN7R.js +9 -0
- package/dist/assets/TaskRoutes-Sr-eq5Xy.js +9 -0
- package/dist/assets/TransactionDetailRoutes-DHOAhb5X.js +1 -0
- package/dist/assets/{TransactionDetailScreen-DFFAXF6x.js → TransactionDetailScreen-BfwmFu4d.js} +2 -2
- package/dist/assets/{TransactionListRoutes-bvLvzle-.js → TransactionListRoutes-CcqGcmw0.js} +1 -1
- package/dist/assets/{TreasuryRoutes-DYIO-YgE.js → TreasuryRoutes-S1BfnYGO.js} +5 -5
- package/dist/assets/{VendorsRoutes-DxWng3tY.js → VendorsRoutes-D9wt7kTI.js} +1 -1
- package/dist/assets/WiseConfirmationScreen-CBCiP645.js +12 -0
- package/dist/assets/{ZeniAccountRoutes-bTRWcMAn.js → ZeniAccountRoutes-CgUN5fCf.js} +9 -9
- package/dist/assets/ZeniAccountStatementScreen-jmmjZcA9.js +9 -0
- package/dist/assets/{accountMappingHelper-Cl-vw8fd.js → accountMappingHelper-BYw-4sqP.js} +1 -1
- package/dist/assets/{analytics-bcpq8FmH.js → analytics-UPQyZr49.js} +1 -1
- package/dist/assets/{analyticsHelper-DTKAaOR4.js → analyticsHelper-nRPDDcpi.js} +1 -1
- package/dist/assets/{core-CLbwxogo.js → core-D4EC26kf.js} +1 -1
- package/dist/assets/{decodeURIComponentSafe-CTII6a9j.js → decodeURIComponentSafe-CDB32jt8.js} +1 -1
- package/dist/assets/{dnd-D7kr6gj3.js → dnd-CQ9igkkh.js} +1 -1
- package/dist/assets/{empty-BdckjUGv.js → empty-CI6RvMsS.js} +1 -1
- package/dist/assets/{empty-BIuVl5i4.js → empty-D2f6MViE.js} +1 -1
- package/dist/assets/{emptyVideoElement-CsPLODSh.js → emptyVideoElement-DMQKfl7Z.js} +1 -1
- package/dist/assets/epic-pH_zo6MR.js +2 -0
- package/dist/assets/expenseAutomationHelper-DLTA8kBq.js +1 -0
- package/dist/assets/{getLocaleForTenant-BdgPeU-B.js → getLocaleForTenant-B07LkoV2.js} +1 -1
- package/dist/assets/{index-COZnX9q1.js → index-B_bOZ9_a.js} +1 -1
- package/dist/assets/{index-C31Y0QTF.js → index-CEVAJ-IM.js} +1 -1
- package/dist/assets/{index-DPWxOeVp.js → index-CWHRX-bO.js} +1 -1
- package/dist/assets/{index-BWTXRZ02.js → index-Ch-ATQTq.js} +12598 -12590
- package/dist/assets/{index-CFqdtjWk.js → index-Cjagh0U7.js} +2 -2
- package/dist/assets/{index-CtHN3MJR.js → index-CllzBMQZ.js} +1 -1
- package/dist/assets/{index-CGtk3Boq.js → index-D7USIDVj.js} +1 -1
- package/dist/assets/{index-BGZGT2EB.js → index-DIih7oGD.js} +1 -1
- package/dist/assets/{lexical-DBQnrckW.js → lexical-DvwBeJWJ.js} +1 -1
- package/dist/assets/{liveblocks-B8NMVuJ_.js → liveblocks-DcDE-V-o.js} +1 -1
- package/dist/assets/{lottie-DZboDKA6.js → lottie-DBrmrNFb.js} +1 -1
- package/dist/assets/{mui-DB2eP-4H.js → mui-BCH_ILdb.js} +1 -1
- package/dist/assets/{pathToGoBack-kLAH7lQZ.js → pathToGoBack-rzbozB31.js} +1 -1
- package/dist/assets/{pdf-lib-B2sKhaXv.js → pdf-lib-CbTEittW.js} +1 -1
- package/dist/assets/{pdf-ByO6Vz9p.js → pdf-zGCHYG6q.js} +4 -4
- package/dist/assets/{plaid-BjkLQcpb.js → plaid-a-pmhWdo.js} +1 -1
- package/dist/assets/{pusher-DLAXsv5D.js → pusher-DTPJtuD1.js} +1 -1
- package/dist/assets/{react-Bnoavnug.js → react-BxMK-s19.js} +1 -1
- package/dist/assets/{react-CSeNOqFc.js → react-C83CKqL4.js} +1 -1
- package/dist/assets/{react-DnFO_FFm.js → react-CW0JS27q.js} +1 -1
- package/dist/assets/{react-6e8jc3Wj.js → react-Cc6y9hJ0.js} +1 -1
- package/dist/assets/{react-Bdnz9ur-.js → react-DEi14qD-.js} +1 -1
- package/dist/assets/{react-3YBksWOJ.js → react-Dom5mok4.js} +1 -1
- package/dist/assets/{recharts-DLaK4yUy.js → recharts-BRIJ8RH5.js} +1 -1
- package/dist/assets/{routePaths-D7Q4znoA.js → routePaths-D0-Tropc.js} +1 -1
- package/dist/assets/{sentry-Di8VmQH9.js → sentry-DB4rU-NW.js} +1 -1
- package/dist/assets/{stripSplatSuffix-vknm6I0a.js → stripSplatSuffix-DDkMarxH.js} +1 -1
- package/dist/assets/{url-DQtqpgyq.js → url-B6fk1MD4.js} +1 -1
- package/dist/assets/{url-D-LhAzLP.js → url-C0P0ff3A.js} +1 -1
- package/dist/assets/useActualMatchingMatchDetail-BNN20aCx.js +1 -0
- package/dist/assets/{useAiCfoDashboardSuggestedQuestionsChips-CoIOeMrO.js → useAiCfoDashboardSuggestedQuestionsChips-DOmg3jmM.js} +1 -1
- package/dist/assets/{useAskAiCfoHostNavButtonProps-2NTBRuLk.js → useAskAiCfoHostNavButtonProps-CBSVhkeG.js} +1 -1
- package/dist/assets/{useChargeCardPusherEvents-CyCKOPqT.js → useChargeCardPusherEvents-WOovjOqT.js} +1 -1
- package/dist/assets/{useDeviceId-D9wKXTe6.js → useDeviceId-Dy35NfBh.js} +1 -1
- package/dist/assets/useEmailConnectResultRefresh-27P04Izm.js +1 -0
- package/dist/assets/{useInitialThreadRequest-_cR9E-my.js → useInitialThreadRequest-Da3K5Ksw.js} +1 -1
- package/dist/assets/{useTaskManagerAccess-DYYDLTVZ.js → useTaskManagerAccess-CX5toJpg.js} +1 -1
- package/dist/assets/{useTaskManagerPusherEvents-DaFacbHX.js → useTaskManagerPusherEvents-BiZinOaM.js} +1 -1
- package/dist/assets/{utils-cD9C-nwV.js → utils-CU_Pr3K6.js} +1 -1
- package/dist/assets/{withTransactionSidePanel-BOBG-nk3.js → withTransactionSidePanel-CCvid0cv.js} +1 -1
- package/dist/assets/{zeni-epic-state-DuYWeJse.js → zeni-epic-state-Bl3gAQPi.js} +5 -5
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/AddressRoutes-CRV9O3fJ.js +0 -1
- package/dist/assets/AddressScreen-CbqqBPeg.js +0 -9
- package/dist/assets/BusinessVerificationPageScreen-B81g6W18.js +0 -9
- package/dist/assets/CompanyPassportScreen-LxcAg-6u.js +0 -1
- package/dist/assets/CustomerOnboardingAuthScreen-yvp5XDgC.js +0 -1
- package/dist/assets/DomesticWireDetailScreen-BSEUD6C3.js +0 -18
- package/dist/assets/EntityDetailRoutes-CKxj6mH-.js +0 -1
- package/dist/assets/HubSpotOAuthCallbackScreen-CUlI7cbh.js +0 -1
- package/dist/assets/MagicLinkSignInScreen-2HP7A3da.js +0 -12
- package/dist/assets/NotFoundScreen-oJupr3pq.js +0 -1
- package/dist/assets/NotificationRoutes-DPQX5f6K.js +0 -1
- package/dist/assets/OAuthConsentScreen-BFDI6eC9.js +0 -1
- package/dist/assets/PandLWithForecastRoutes-DyZHHb1Z.js +0 -1
- package/dist/assets/ReimbursementApprovalRuleDetailScreen-CKOH-HzU.js +0 -1
- package/dist/assets/SignOutScreen-CYY1dAbn.js +0 -9
- package/dist/assets/TaskListScreen-DHzPd6H5.js +0 -9
- package/dist/assets/TaskRoutes-hldsrW8n.js +0 -9
- package/dist/assets/TransactionDetailRoutes-Cii1a7bV.js +0 -1
- package/dist/assets/WiseConfirmationScreen-3GfsXfj0.js +0 -12
- package/dist/assets/ZeniAccountStatementScreen-ulCu2kq_.js +0 -9
- package/dist/assets/epic-AKFDmlZB.js +0 -2
- package/dist/assets/expenseAutomationHelper-C40iB_7D.js +0 -1
- package/dist/assets/useActualMatchingMatchDetail-BtihcKgk.js +0 -1
- package/dist/assets/useEmailConnectResultRefresh-CLDF1mnr.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as c}from"./liveblocks-B8NMVuJ_.js";import{a as r}from"./sentry-Di8VmQH9.js";import{u as L,h as P,i as w,j as k,t as Z,l as T,s as Q,g as X,N as H,n as ce,o as x}from"./core-CLbwxogo.js";import{a6 as ct,h as g,ao as F,N as l,ca as st,cb as rt,cc as dt,cd as lt,ce as ut,cf as gt,cg as mt,ch as vt,ci as pt,cj as St,ck as ft,cl as It,p as ee,cm as ht,cn as Ct,z as J,ac as de,co as kt,cp as Et,cq as yt,cr as bt,cs as xt,ct as At,cu as Dt,cv as jt,cw as Lt,cx as Pt,V as _t,ag as un,cy as $t,cz as wt,cA as Rt,cB as Ft,cC as Ot,cD as Tt,cE as Mt,cF as Nt,cG as Ut,cH as Bt,cI as Vt,t as Je,g as Me,cJ as Ht,cK as qt,cL as Qt,cM as zt,cN as Kt,cO as Gt,cP as Wt}from"./index-BWTXRZ02.js";import"./mui-DB2eP-4H.js";import{A as G}from"./AddressScreen-CbqqBPeg.js";import M from"./NotFoundScreen-oJupr3pq.js";import{_f as Yt,_g as Jt,vw as Ze,v as Zt,_h as W,w6 as le,_i as Ne,_j as ue,wJ as Pe,wQ as Xt,dX as gn,wU as mn,_k as Ue,wN as ei,yr as Xe,w5 as en,_l as vn,x3 as _e,_m as ge,x7 as ni,_n as ti,xh as ii,_o as pn,xa as Sn,y$ as oi,_p as fe,_q as nn,_r as fn,w2 as ai,_s as ci,vW as si,_t as ri,yE as di,_u as In,yN as ye,_v as li,yK as ui,_w as Be,gk as Ve,_x as oe,_y as ae,xp as gi,wb as tn,wg as hn,we as mi,w8 as vi,xi as pi,wi as Si,xr as fi,c_ as Cn,_z as $e,xA as kn,xy as Ie,xw as me,xv as Ii,_A as En,yU as be,_B as hi,w4 as yn,_C as He,fI as he,wr as we,wo as Re,wB as bn,wA as qe,wl as Ci,wu as xn,wD as se,W0 as An,w7 as Qe,wy as ki,wz as Ei,wx as yi,_D as bi,x8 as xi,x4 as Dn,_E as jn,vN as xe,_F as Ai,vG as Di,_G as ji,y_ as Li,z3 as z,yZ as Pi,y5 as Ce,_H as _i,_I as Ln,zc as Ae,_J as $i,z9 as wi,_K as Pn,y8 as Ri,y9 as q,yc as Fi,_L as _n,ym as De,_M as Oi,xq as $n,Uy as wn,_N as Ti,yw as Mi,_O as Rn,_P as Ni,_Q as Ui,_R as Bi,z$ as Vi,_S as Hi,_T as Fn,zj as On,_U as Tn,zZ as je,_V as qi,zW as Qi,_W as zi,_X as Ki,_Y as Gi,_Z as Wi,__ as Yi,_$ as on,$0 as Ji,ei as Zi,A3 as Xi,$1 as ze,xK as eo,xF as no,d0 as Fe,$2 as Y,xO as Mn,xU as Nn,$3 as Un,xP as ve,xZ as to,y0 as Bn,$4 as io,xY as oo,$5 as Vn,$6 as Hn,zO as Le,zJ as ao,$7 as co,zo as so,$8 as ro,zP as lo,zT as uo,$9 as Ke,wL as qn,zA as go,wM as mo,$a as vo,$b as Qn,c9 as po,mw as So,mx as fo,$c as an,wK as pe,go as Io,mD as ho,zG as zn,Af as Co,zD as Kn,v2 as ko,uS as Eo,hW as yo,U$ as cn,V0 as bo,GB as Gn,Ac as xo,hO as Ao,A9 as Do,$d as jo,$e as Lo,Al as Po,Ak as _o,$f as $o,$g as Wn,Ai as wo,$h as Ro,$i as Fo,yA as Oo,$j as To}from"./zeni-epic-state-DuYWeJse.js";import{M as Mo}from"./MobileAppDrawer-CtIgBgQ-.js";import{q as Se}from"./QBOConnectionScreen-B_IVukb7.js";import"./recharts-DLaK4yUy.js";import"./analytics-bcpq8FmH.js";import"./plaid-BjkLQcpb.js";import"./dnd-D7kr6gj3.js";import"./stripe-cKAAJElX.js";import"./lottie-DZboDKA6.js";import"./lexical-DBQnrckW.js";import"./pdf-ByO6Vz9p.js";import"./utils-cD9C-nwV.js";import"./InboxNotificationsProvider-T1CjerOs.js";import"./useTaskManagerAccess-DYYDLTVZ.js";import"./empty-BdckjUGv.js";import"./pdf-lib-B2sKhaXv.js";import"./index-C31Y0QTF.js";import"./url-D-LhAzLP.js";import"./index-CtHN3MJR.js";import"./decodeURIComponentSafe-CTII6a9j.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="2b3d38d3-3cf1-4933-a520-738872a5a899",t._sentryDebugIdIdentifier="sentry-dbid-2b3d38d3-3cf1-4933-a520-738872a5a899")}catch{}})();const $=({event:t,isReady:e=!0})=>e?c.jsx(ct,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function No(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:v,hasMore:p,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(Yt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((R,U)=>{const O=Jt(D,R,U,E);O!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:R,entityId:U,fromScreen:"audit_log",toScreen:R}),e(O))}),[E,e,D]);r.useEffect((()=>{const R=setTimeout((()=>u(a)),300);return()=>clearTimeout(R)}),[a]),r.useEffect((()=>{i&&t(Ze({filters:y,keepExistingListItems:!1,sort:m}))}),[i,y,m,t]);const A=v==="Not-Started"||v==="In-Progress"&&f.length===0,C=v==="In-Progress"&&f.length>0,j=v==="Completed";return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(st,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:p,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{p&&I!=null&&t(Ze({cursor:I,filters:y,keepExistingListItems:!0,sort:m}))},onSearchChange:o,onSortChange:S})]})}const Yn=["company","email","firstName","invoiceNotes","lastName","notes","phone","vatNumber"],Oe=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(Oe):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).map((([e,n])=>[e,Oe(n)]))):null;function B(t,e,n=[]){const i=t,a=e,o=[...new Set([...Object.keys(i),...Object.keys(a??{})])].filter((u=>{if(a==null)return(d=i[u])!=null&&d!==""&&(Array.isArray(d)?d.length>0:typeof d!="object"||Object.keys(d).length>0);var d;return!(i[u]==null&&a[u]==null)&&!Zt(i[u],a[u])})).sort(),s=Object.fromEntries(o.filter((u=>!n.includes(u))).map((u=>[u,Oe(i[u])])));return{fieldsChanged:o,formValues:s}}function ke(t,e=!1){const n=L(),i=k((s=>W(s).productNextCursor!=null)),a=k((s=>W(s).productNextCursor)),o=k((s=>W(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ne(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const S=d.current==="In-Progress";d.current=t,t==="Completed"&&S&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((S=>S+1)))}),[s,e]),a}const Uo=new Set(["plan"]),Bo=T((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(ei({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(Ue({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i,mode:"edit",...B(e.view.localData,gn(e.view.plan))}),t(mn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(Xt({action:o,id:a,parentItemId:i}))}}}))(rt);function Vo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=w(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=(u=a.get("kind"))!=null&&Uo.has(u)?u:"plan";var u;const d=k((y=>Ne(y,n))),{pageFetchState:S}=d,m=S.fetchState;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(Pe({id:n,kind:s}))}),[o,n,s,t]);const v=r.useCallback((y=>t(Pe({cacheOverride:!0,id:y,kind:s}))),[t,s]),p=ne(d.fetchState,d.isFormLoading,n,v),f=m==="Completed"&&!d.isFormLoading;ke(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(m==="Not-Started"||m==="In-Progress"||d.isFormLoading);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(Bo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},p)]})}const Ho=new Set(["addon","charge","plan"]),qo=new Set(["plan"]),Qo=T((function(t,e){const n=Ne(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedItem:n.plan,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e,a=i!=null?`${n}/catalog/${encodeURIComponent(i)}`:`${n}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(ue({id:i})),e.navigate(`${n}/catalog`)},onChange:o=>{t(Ue({id:i,localData:o}))},onSubmit:()=>{t(mn({id:i}))}}}),(function({savedItem:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{itemId:i.itemId,mode:e.mode,...B(e.localData,t!=null?gn(t):void 0)}),n.onSubmit()}}}))(dt);function zo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=w(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=n!=null,u=a.get("type"),d=u!=null&&Ho.has(u)?u:void 0,S=(m=a.get("kind"))!=null&&qo.has(m)?m:"plan";var m;const v=k((p=>Ne(p,n)));return ke(o,!0),r.useEffect((()=>{o&&t(Pe({id:n,kind:S}))}),[o,n,S,t]),r.useEffect((()=>{s||d==null||v.localData.catalogType===d||t(Ue({localData:{...v.localData,catalogType:d}}))}),[s,d,v.localData?.catalogType,t]),r.useEffect((()=>{if(v.fetchState==="Completed"){const p=v.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(ue({id:n}))}}),[v.fetchState,v.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Qo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Go=T((function(t,e){const n=W(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="In-Progress"&&o.length>0,planRows:n.planRows,productRows:n.productRows}}),(function(t,e){const n=`/${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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Ko[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(en({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?en({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(lt);function Wo(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,S]=r.useState(""),[m,v]=r.useState(null),p=r.useMemo((()=>m!=null?{dir:m.direction,field:m.columnKey}:void 0),[m]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((j=>W(j))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed";return r.useEffect((()=>{const j=setTimeout((()=>S(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[i,t,I,E,p]),r.useEffect((()=>{i&&(f!==y||p?.field!==D?.field||p?.dir!==D?.dir)&&t(Xe({cacheOverride:!0,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[y,D,i,t,I,E,f,p]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:m,planFilters:I,productFilters:E,sort:p,planNextCursor:b,productNextCursor:A,onSearchChange:o,onTabChange:u,onSortChange:v})]})}const Yo=T((function(t,e){const n=vn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCoupon:n.coupon,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ge({id:i})),e.navigate(`${n}/discounts`)},onChange:o=>{t(ti({id:i,localData:o}))},onSubmit:()=>{t(ni({id:i}))}}}),(function({savedCoupon:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{couponId:i.couponId,mode:e.mode,...B(e.localData,t!=null?ii(t):void 0)}),n.onSubmit()}}}))(ut);function Jo(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,savedCouponId:s}=k((u=>vn(u,n)));return r.useEffect((()=>{a&&t(_e({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ge({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCouponFormPage}),c.jsx(Yo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Zo=T((function(t){const e=pn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(fn(a))},onSubmit:()=>{const a=ci(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length,mode:"create",...B(t.localData,void 0,["memo"])}),e(si(a))}}}))(mt);function Xo(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),[i]=Z(),{areTenantIdsInSync:a}=F(),o=i.get("customerId"),s=k((b=>pn(b))),u=s.fetchState,d=s.localData,S=s.savedInvoiceId,m=k(Sn),v=k((b=>oi(b))),p=k(fe),f=v.fetchState==="Not-Started"||v.fetchState==="In-Progress"&&m==null,I=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,E=f||I,h=v.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(nn()),()=>{t(nn())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(fn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(ai({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=S!=null?`/${n}/invoicing/invoices/${encodeURIComponent(S)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,S,e,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(gt,{}):c.jsx(Zo,{navigate:e,tenantEmailDomain:n})]})}const ea=T((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(vt);function na(){const t=L(),e=P(),{credit_note_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((u=>ri(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(di({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(ea,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const ta=T((function(t){const e=In(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ui({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(pt);function ia(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=In(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),Q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(ta,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>{t(li(D)),t(ye({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Jn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},oa=T((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t($e({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`)},onDiscardEdit:()=>{t(Ie(me)),t(Ii({id:i}))},onOpenAddress:()=>{const a=Jn(e.tenantEmailDomain??"",me,i),o=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i,mode:"edit",...B(a,e.editView.record.invoicingCustomer!=null?Cn(e.editView.record.invoicingCustomer):void 0,Yn)}),t($e({id:i,localData:a})),t(kn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(fi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(Si({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(It);function aa(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),s=k((O=>Be(O,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[S,m]=r.useState(!1),[v,p]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const O=s.record.sendLinkState.fetchState;C.current!=="Error"&&O==="Error"&&t(Ve({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=O}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(oe()),t(ae()),()=>{t(oe()),t(ae())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(p(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(gi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(tn({customerId:i}))}),[o,i,t,A]);const R=r.useCallback((O=>t(hn({id:O}))),[t]),U=ne(s.fetchState,s.isFormLoading,i,R);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(oa,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(oe()),i!=null&&A&&t(tn({customerId:i})),m(!0)},onCreatePromotionalCredits:()=>{t(ae()),p(!0)}},U),c.jsx(St,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:S,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(vi({customerId:i}))},onClose:()=>{m(!1),t(oe())},onSavePaymentMethod:O=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(mi({customerId:i,data:O})))}}),c.jsx(ft,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:v,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ae())},onSubmit:({amount:O,description:ie})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:O,customerId:i,fromScreen:"customer_detail"}),t(pi({amount:O,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:ie})))}})]})}const ca=T((function(t,e){const n=Be(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCustomer:n.record.invoicingCustomer}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(En({id:i})),t(Ie(me)),e.navigate(`${n}/customers`)},onChange:o=>{t($e({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const o=Jn(e.tenantEmailDomain??"",me,i),s=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{t(kn({id:i}))}}}),(function({savedCustomer:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{customerId:i.customerId,mode:e.mode,...B(e.localData,t!=null?Cn(t):void 0,Yn)}),n.onSubmit()}}}))(ht);function sa(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),{fetchState:s,savedCustomerId:u}=k((d=>Be(d,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,S=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(S),t(En({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerFormPage}),c.jsx(ca,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ra=T((function(t){const e=fe(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(yn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ct);function da(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),Q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(be({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(be({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ra,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>{t(hi(D)),t(be({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Te=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),la=T((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:Te(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=Te(s,a),S=s.actionStateByKind.retry?.fetchState==="In-Progress",m=s.actionStateByKind.rollback?.fetchState==="In-Progress",v=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Ve({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Re({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||S?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(qe(a)))},onRollback:v?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(bn(a)))}:void 0}}))(kt);function ua(){const t=L(),e=P(),{sessionId:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),[o,s]=r.useState({}),u=k(He),d=k(he),S=r.useMemo((()=>{const E=J.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),m=Te(u,n),v=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(we(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Re({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const p=m?.status==="scanning"||m?.status==="importing";r.useEffect((()=>{if(!a||n==null||!p)return;const E=setInterval((()=>{t(we(n)),t(Re({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,p,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=v?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportDetailPage,isReady:m!=null&&I!=="Not-Started"}),c.jsx(la,{authParams:S,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const Zn=t=>`invoicing_active_migration:${t}`,re=(t,e)=>{if(t!=null&&t!=="")try{const n=Zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ga=T((function(t,e){const{sessions:n,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:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const s=o??null;t(se(s)),re(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(qe(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(bn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Et);function ma(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),a=k(He);r.useEffect((()=>{i&&(t(Ci()),t(xn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ga,{navigate:e,tenantEmailDomain:n,view:a})]})}const va=T((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:S,sessions:m}=u,v=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),p=n!=null?S[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:p??m.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Ve({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(yi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(qe(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(Ei(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(ki({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(yt);function pa(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),a=k(Sn),o=k(he),s=r.useMemo((()=>{const h=J.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??J.getSignedInUserTenant(n??"")?.companyId,S=k((h=>An(h,d))),m=k(He),{activeMigrationSessionId:v}=m,p=v??void 0,f=p!=null?m.sessionDetail[p]??m.sessions.find((h=>h.id===p)):void 0;r.useEffect((()=>{i&&(t(Qe()),t(xn()))}),[i,t]),r.useEffect((()=>{if(v!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Zn(y))}catch{return null}})(n);h!=null&&t(se(h))}),[v,t,n]),r.useEffect((()=>{re(n,v)}),[v,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||p==null||!E)return;const h=setInterval((()=>{t(we(p))}),3e3);return()=>clearInterval(h)}),[i,p,E,t]),r.useEffect((()=>{I==="done"&&(t(se(null)),re(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(va,{activeId:p,authParams:s,integrationsView:S,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:m,onBack:()=>{t(se(null)),re(n,null),e(`/${n}/invoicing/data_import`)}})]})}const Sa=T((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(Dn({action:a,id:i}))},onSaveEdit:a=>{const{coupon:o}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i,mode:"edit",...B(a,{invoice_name:o?.invoiceName,invoice_notes:o?.invoiceNotes,max_redemptions:o?.maxRedemptions,name:o?.name},["invoice_notes"])}),t(xi({data:a,id:i}))}}}))(bt);function fa(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((I=>bi(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[S,m]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&m(n)}),[n,d]);const v=S===n;r.useEffect((()=>(t(ge({id:n})),()=>{t(ge({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(_e({id:n}))}),[a,n,t]);const p=r.useCallback((I=>t(_e({cacheOverride:!0,id:I}))),[t]),f=ne(o.fetchState,o.isFormLoading,n,p);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(Sa,{hasLoadedRecord:v,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const Ia=T((function(t){const e=jn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(Dn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(xt);function ha(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=jn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),Q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(xe({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>{t(Ai(b)),t(xe({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Ca=T((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",step:n.step}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(z({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(z({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(z({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(z({action:"retry",id:i}))}:void 0}}))(Dt);function ka(){const t=L(),e=P(),{case_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((C=>ji(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,S]=r.useState("idle"),[m,v]=r.useState(!1),[p,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(Li({id:n})),S("idle"),v(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(v(!1),S("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(z({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=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&&n!=null&&t(Pi({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(Ce({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(S("idle"),v(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&p==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,p,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?m&&o.actionState.fetchState==="Completed"?(n!=null&&t(_i({id:n})),h()):m&&o.actionState.fetchState==="Error"&&S("failed"):v(!0))}),[n,h,t,d,m,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(At,{initialDraft:p,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const Ea=T((function(t){const e=Ln(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,stepById:e.stepById,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(z({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(wi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(jt);function ya(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=Ln(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),Q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ae({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ae({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>{t($i(b)),t(Ae({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const ba=T((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(q({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail",mode:"edit",...B(s,{due_date:a?.dueDate?.format("YYYY-MM-DD")??"",notes:(a?.notes??[]).map((u=>u.note)).filter((u=>u!=null&&u!=="")).join(`
|
|
1
|
+
import{j as c}from"./liveblocks-DcDE-V-o.js";import{a as r}from"./sentry-DB4rU-NW.js";import{u as L,h as P,i as w,j as k,t as Z,l as T,s as Q,g as X,N as H,n as ce,o as x}from"./core-D4EC26kf.js";import{a6 as ct,j as g,ao as F,N as l,ca as st,cb as rt,cc as dt,cd as lt,ce as ut,cf as gt,cg as mt,ch as vt,ci as pt,cj as St,ck as ft,cl as It,p as ee,cm as ht,cn as Ct,z as J,ac as de,co as kt,cp as Et,cq as yt,cr as bt,cs as xt,ct as At,cu as Dt,cv as jt,cw as Lt,cx as Pt,V as _t,ag as un,cy as $t,cz as wt,cA as Rt,cB as Ft,cC as Ot,cD as Tt,cE as Mt,cF as Nt,cG as Ut,cH as Bt,cI as Vt,t as Je,h as Me,cJ as Ht,cK as qt,cL as Qt,cM as zt,cN as Kt,cO as Gt,cP as Wt}from"./index-Ch-ATQTq.js";import"./mui-BCH_ILdb.js";import{A as G}from"./AddressScreen-BOTH_mRu.js";import M from"./NotFoundScreen-0hF8kIyY.js";import{_g as Yt,_h as Jt,vw as Ze,v as Zt,_i as W,w6 as le,_j as Ne,_k as ue,wJ as Pe,wQ as Xt,dX as gn,wU as mn,_l as Ue,wN as ei,yr as Xe,w5 as en,_m as vn,x3 as _e,_n as ge,x7 as ni,_o as ti,xh as ii,_p as pn,xa as Sn,y$ as oi,_q as fe,_r as nn,_s as fn,w2 as ai,_t as ci,vW as si,_u as ri,yE as di,_v as In,yN as ye,_w as li,yK as ui,_x as Be,gk as Ve,_y as oe,_z as ae,xp as gi,wb as tn,wg as hn,we as mi,w8 as vi,xi as pi,wi as Si,xr as fi,c_ as Cn,_A as $e,xA as kn,xy as Ie,xw as me,xv as Ii,_B as En,yU as be,_C as hi,w4 as yn,_D as He,fI as he,wr as we,wo as Re,wB as bn,wA as qe,wl as Ci,wu as xn,wD as se,W1 as An,w7 as Qe,wy as ki,wz as Ei,wx as yi,_E as bi,x8 as xi,x4 as Dn,_F as jn,vN as xe,_G as Ai,vG as Di,_H as ji,y_ as Li,z3 as z,yZ as Pi,y5 as Ce,_I as _i,_J as Ln,zc as Ae,_K as $i,z9 as wi,_L as Pn,y8 as Ri,y9 as q,yc as Fi,_M as _n,ym as De,_N as Oi,xq as $n,Uz as wn,_O as Ti,yw as Mi,_P as Rn,_Q as Ni,_R as Ui,_S as Bi,z$ as Vi,_T as Hi,_U as Fn,zj as On,_V as Tn,zZ as je,_W as qi,zW as Qi,_X as zi,_Y as Ki,_Z as Gi,__ as Wi,_$ as Yi,$0 as on,$1 as Ji,ei as Zi,A3 as Xi,$2 as ze,xK as eo,xF as no,d0 as Fe,$3 as Y,xO as Mn,xU as Nn,$4 as Un,xP as ve,xZ as to,y0 as Bn,$5 as io,xY as oo,$6 as Vn,$7 as Hn,zO as Le,zJ as ao,$8 as co,zo as so,$9 as ro,zP as lo,zT as uo,$a as Ke,wL as qn,zA as go,wM as mo,$b as vo,$c as Qn,c9 as po,mw as So,mx as fo,$d as an,wK as pe,go as Io,mD as ho,zG as zn,Af as Co,zD as Kn,v2 as ko,uS as Eo,hW as yo,V0 as cn,V1 as bo,GB as Gn,Ac as xo,hO as Ao,A9 as Do,$e as jo,$f as Lo,Al as Po,Ak as _o,$g as $o,$h as Wn,Ai as wo,$i as Ro,$j as Fo,yA as Oo,$k as To}from"./zeni-epic-state-Bl3gAQPi.js";import{M as Mo}from"./MobileAppDrawer-C6gfQS8M.js";import{q as Se}from"./QBOConnectionScreen-CPdRdNFp.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.js";import"./InboxNotificationsProvider-DPgK9Ai7.js";import"./useTaskManagerAccess-CX5toJpg.js";import"./empty-CI6RvMsS.js";import"./pdf-lib-CbTEittW.js";import"./index-CEVAJ-IM.js";import"./url-C0P0ff3A.js";import"./index-CllzBMQZ.js";import"./decodeURIComponentSafe-CDB32jt8.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new t.Error().stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="13129495-891a-410e-9c2f-7c0914051e61",t._sentryDebugIdIdentifier="sentry-dbid-13129495-891a-410e-9c2f-7c0914051e61")}catch{}})();const $=({event:t,isReady:e=!0})=>e?c.jsx(ct,{analytics:g,onLoad:n=>n.trackPageLoaded(t)}):null;function N(...t){return t.some((e=>e==="Error"))}function No(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),{fetchState:v,hasMore:p,items:f,nextCursor:I,auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h}=k(Yt),y=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),D=`/${n??""}/invoicing`,b=r.useCallback(((R,U)=>{const O=Jt(D,R,U,E);O!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{entity:R,entityId:U,fromScreen:"audit_log",toScreen:R}),e(O))}),[E,e,D]);r.useEffect((()=>{const R=setTimeout((()=>u(a)),300);return()=>clearTimeout(R)}),[a]),r.useEffect((()=>{i&&t(Ze({filters:y,keepExistingListItems:!1,sort:m}))}),[i,y,m,t]);const A=v==="Not-Started"||v==="In-Progress"&&f.length===0,C=v==="In-Progress"&&f.length>0,j=v==="Completed";return N(v)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingAuditLogPage,isReady:j}),c.jsx(st,{auditLogEntityRouteOptions:E,auditLogListSortFieldOptions:h,entries:f,hasMore:p,isLoading:A,isLoadingMore:C,searchValue:a,sortState:d,onEntityLinkClick:b,onLoadMore:()=>{p&&I!=null&&t(Ze({cursor:I,filters:y,keepExistingListItems:!0,sort:m}))},onSearchChange:o,onSortChange:S})]})}const Yn=["company","email","firstName","invoiceNotes","lastName","notes","phone","vatNumber"],Oe=t=>typeof t=="string"||typeof t=="number"||typeof t=="boolean"?t:Array.isArray(t)?t.map(Oe):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).map((([e,n])=>[e,Oe(n)]))):null;function B(t,e,n=[]){const i=t,a=e,o=[...new Set([...Object.keys(i),...Object.keys(a??{})])].filter((u=>{if(a==null)return(d=i[u])!=null&&d!==""&&(Array.isArray(d)?d.length>0:typeof d!="object"||Object.keys(d).length>0);var d;return!(i[u]==null&&a[u]==null)&&!Zt(i[u],a[u])})).sort(),s=Object.fromEntries(o.filter((u=>!n.includes(u))).map((u=>[u,Oe(i[u])])));return{fieldsChanged:o,formValues:s}}function ke(t,e=!1){const n=L(),i=k((s=>W(s).productNextCursor!=null)),a=k((s=>W(s).productNextCursor)),o=k((s=>W(s).productFetchState.fetchState));r.useEffect((()=>{t&&(e&&o!=="Not-Started"||n(le({filters:{type:"addon|charge"},keepExistingListItems:!1})))}),[t,n,e]),r.useEffect((()=>{t&&o!=="In-Progress"&&i&&a!=null&&n(le({cursor:a,filters:{type:"addon|charge"},keepExistingListItems:!0}))}),[t,n,o,i,a])}function ne(t,e,n,i){const[a,o]=r.useState(0),[s,u]=r.useState(!1),d=r.useRef(t);return r.useEffect((()=>{const S=d.current==="In-Progress";d.current=t,t==="Completed"&&S&&n!=null&&(u(!0),i(n))}),[t,n,i]),r.useEffect((()=>{s&&!e&&(u(!1),o((S=>S+1)))}),[s,e]),a}const Uo=new Set(["plan"]),Bo=T((function(t,e){const{view:n}=e;return{applicableItemOptions:n.applicableItemOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboClassHierarchy:n.qboClassHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,catalogItemLifecycleActionOptions:n.catalogItemLifecycleActionOptions,catalogProductLifecycleActionOptions:n.catalogProductLifecycleActionOptions,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,isLoading:e.isLoading,isRunningLifecycleAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",itemId:e.itemId,localData:n.localData,plan:n.plan}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e;return{onBack:()=>e.navigate(`${n}/catalog`),onLifecycleAction:i!==""?a=>{i!==""&&(g.trackInvoicingActionClick(l.Event.invoicingCatalogItemLifecycleAction,{action:a,fromScreen:"catalog_item_detail",itemId:i}),t(ei({action:a,id:i})))}:void 0,onEditChange:a=>{i!==""&&t(Ue({id:i,localData:a}))},onSaveEdit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemEdited,{itemId:i,mode:"edit",...B(e.view.localData,gn(e.view.plan))}),t(mn({id:i}))},onSubFamilyLifecycleAction:(a,o)=>{i!==""&&t(Xt({action:o,id:a,parentItemId:i}))}}}))(rt);function Vo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=w(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=(u=a.get("kind"))!=null&&Uo.has(u)?u:"plan";var u;const d=k((y=>Ne(y,n))),{pageFetchState:S}=d,m=S.fetchState;r.useEffect((()=>(t(ue({id:n})),()=>{t(ue({id:n}))})),[t,n]),r.useEffect((()=>{o&&t(Pe({id:n,kind:s}))}),[o,n,s,t]);const v=r.useCallback((y=>t(Pe({cacheOverride:!0,id:y,kind:s}))),[t,s]),p=ne(d.fetchState,d.isFormLoading,n,v),f=m==="Completed"&&!d.isFormLoading;ke(o,!0);const[I,E]=r.useState(f?n:void 0);r.useEffect((()=>{n!=null&&f&&E(n)}),[n,f]);const h=I!==n&&(m==="Not-Started"||m==="In-Progress"||d.isFormLoading);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemDetailPage,isReady:f}),c.jsx(Bo,{navigate:e,tenantEmailDomain:i,itemId:n??"",kind:s,isLoading:h,view:d},p)]})}const Ho=new Set(["addon","charge","plan"]),qo=new Set(["plan"]),Qo=T((function(t,e){const n=Ne(t,e.itemId);return{fieldHelp:n.fieldHelp,qboClassHierarchy:n.qboClassHierarchy,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds,applicabilityValues:n.applicabilityValues,periodUnitOptions:n.periodUnitOptions,trialEndActionOptions:n.trialEndActionOptions,trialUnitOptions:n.trialUnitOptions,typeOptions:n.typeOptions,applicableItemOptions:n.applicableItemOptions,defaultType:e.isEdit?void 0:e.defaultType,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save catalog item.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedItem:n.plan,pricingModelValues:n.pricingModelValues,prorationValues:n.prorationValues,tierTypeOptionsByPricingModel:n.catalogTierTypeOptionsByPricingModel,tierTypeValues:n.tierTypeValues}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{itemId:i}=e,a=i!=null?`${n}/catalog/${encodeURIComponent(i)}`:`${n}/catalog`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemFormCancelled),t(ue({id:i})),e.navigate(`${n}/catalog`)},onChange:o=>{t(Ue({id:i,localData:o}))},onSubmit:()=>{t(mn({id:i}))}}}),(function({savedItem:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemSaved,{itemId:i.itemId,mode:e.mode,...B(e.localData,t!=null?gn(t):void 0)}),n.onSubmit()}}}))(dt);function zo(){const t=L(),e=P(),{item_id:n,tenantEmailDomain:i}=w(),[a]=Z(),{areTenantIdsInSync:o}=F(),s=n!=null,u=a.get("type"),d=u!=null&&Ho.has(u)?u:void 0,S=(m=a.get("kind"))!=null&&qo.has(m)?m:"plan";var m;const v=k((p=>Ne(p,n)));return ke(o,!0),r.useEffect((()=>{o&&t(Pe({id:n,kind:S}))}),[o,n,S,t]),r.useEffect((()=>{s||d==null||v.localData.catalogType===d||t(Ue({localData:{...v.localData,catalogType:d}}))}),[s,d,v.localData?.catalogType,t]),r.useEffect((()=>{if(v.fetchState==="Completed"){const p=v.savedItemId??n,f=p!=null?`/${i}/invoicing/catalog/${encodeURIComponent(p)}`:`/${i}/invoicing/catalog`;e(f),t(ue({id:n}))}}),[v.fetchState,v.savedItemId,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogItemFormPage}),c.jsx(Qo,{navigate:e,tenantEmailDomain:i,defaultType:d,isEdit:s,itemId:n})]})}const Ko={addons:"addon",all:"item",charges:"charge",plans:"plan"},Go=T((function(t,e){const n=W(t),i=e.activeTab==="plans",a=e.activeTab==="all",o=i?n.plans:a?[...n.plans,...n.products]:n.products,s=i||a&&n.fetchState==="In-Progress"?n.fetchState:n.productFetchState.fetchState;return{counts:n.count,countsLoading:n.countsFetchState.fetchState==="Not-Started"||n.countsFetchState.fetchState==="In-Progress",hasMore:i?n.planNextCursor!=null:a&&n.planNextCursor!=null||n.productNextCursor!=null,isLoading:s==="Not-Started"||s==="In-Progress"&&o.length===0,isLoadingMore:s==="In-Progress"&&o.length>0,planRows:n.planRows,productRows:n.productRows}}),(function(t,e){const n=`/${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:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"catalog"}),e.navigate(`${n}/data_import`)},onAddItem:()=>{const s=Ko[e.activeTab];g.trackInvoicingActionClick(l.Event.invoicingAddCatalogItemClicked,{itemType:s}),e.navigate(`${n}/catalog/new?type=${s}`)},onItemClick:(s,u)=>{g.trackInvoicingActionClick(l.Event.invoicingCatalogItemRowClicked,{itemId:u}),e.navigate(`${n}/catalog/${encodeURIComponent(u)}`)},onLoadMore:()=>{if(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"catalog",tab:e.activeTab}),a)return e.planNextCursor!=null&&t(en({cursor:e.planNextCursor,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort})),void(e.productNextCursor!=null&&t(le({cursor:e.productNextCursor,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort})));o!=null&&t(i?en({cursor:o,filters:e.planFilters,keepExistingListItems:!0,sort:e.sort}):le({cursor:o,filters:e.productFilters,keepExistingListItems:!0,sort:e.sort}))}}}))(lt);function Wo(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState("plans"),[d,S]=r.useState(""),[m,v]=r.useState(null),p=r.useMemo((()=>m!=null?{dir:m.direction,field:m.columnKey}:void 0),[m]),f=d.trim()!==""?d.trim():void 0,I=r.useMemo((()=>({search:f,type:"plan"})),[f]),E=r.useMemo((()=>({search:f,type:"addon|charge"})),[f]),h=k((j=>W(j))),y=h.planFilters.search,D=h.planSort,b=h.planNextCursor,A=h.productNextCursor,C=h.fetchState==="Completed";return r.useEffect((()=>{const j=setTimeout((()=>S(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(Xe({cacheOverride:!1,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[i,t,I,E,p]),r.useEffect((()=>{i&&(f!==y||p?.field!==D?.field||p?.dir!==D?.dir)&&t(Xe({cacheOverride:!0,planFilters:I,productFilters:E,planSort:p,productSort:p}))}),[y,D,i,t,I,E,f,p]),N(h.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCatalogPage,isReady:C}),c.jsx(Go,{navigate:e,tenantEmailDomain:n,activeTab:s,searchValue:a,sortState:m,planFilters:I,productFilters:E,sort:p,planNextCursor:b,productNextCursor:A,onSearchChange:o,onTabChange:u,onSortChange:v})]})}const Yo=T((function(t,e){const n=vn(t,e.couponId);return{fieldHelp:n.fieldHelp,applyOnOptions:n.applyOnOptions,discountTypeOptions:n.discountTypeOptions,durationTypeOptions:n.durationTypeOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save coupon.":void 0,isQboConnected:n.isQboConnected,isQboPickerDataLoading:n.isQboPickerDataLoading,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCoupon:n.coupon,periodUnitOptions:n.periodUnitOptions,qboAccountHierarchy:n.qboAccountHierarchy,qboIncomeAccountIds:n.qboIncomeAccountIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e,a=i!=null?`${n}/discounts/${encodeURIComponent(i)}`:`${n}/discounts`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponFormCancelled),t(ge({id:i})),e.navigate(`${n}/discounts`)},onChange:o=>{t(ti({id:i,localData:o}))},onSubmit:()=>{t(ni({id:i}))}}}),(function({savedCoupon:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCouponSaved,{couponId:i.couponId,mode:e.mode,...B(e.localData,t!=null?ii(t):void 0)}),n.onSubmit()}}}))(ut);function Jo(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,savedCouponId:s}=k((u=>vn(u,n)));return r.useEffect((()=>{a&&t(_e({id:n}))}),[a,n,t]),r.useEffect((()=>{if(o==="Completed"){const u=s??n,d=u!=null?`/${i}/invoicing/discounts/${encodeURIComponent(u)}`:`/${i}/invoicing/discounts`;e(d),t(ge({id:n}))}}),[o,s,n,t,e,i]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCouponFormPage}),c.jsx(Yo,{couponId:n,navigate:e,tenantEmailDomain:i})]})}const Zo=T((function(t){const e=pn(t);return{fieldHelp:e.fieldHelp,customers:e.customers,planNames:e.planNames,errorMessage:e.fetchState==="Error"?e.error?.message??"Failed to create invoice. Please try again.":void 0,isSubmitting:e.fetchState==="In-Progress",localData:e.localData,settings:e.settings}}),(function(t){return{dispatch:t}}),(function(t,{dispatch:e},n){const i=`/${n.tenantEmailDomain}/invoicing`;return{...t,onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceCancelled),n.navigate(`${i}/invoices`)},onChange:a=>{e(fn(a))},onSubmit:()=>{const a=ci(t.localData);g.trackInvoicingActionClick(l.Event.invoicingInvoiceCreated,{customerId:a.customer_id,lineItemCount:a.line_items?.length,mode:"create",...B(t.localData,void 0,["memo"])}),e(si(a))}}}))(mt);function Xo(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),[i]=Z(),{areTenantIdsInSync:a}=F(),o=i.get("customerId"),s=k((b=>pn(b))),u=s.fetchState,d=s.localData,S=s.savedInvoiceId,m=k(Sn),v=k((b=>oi(b))),p=k(fe),f=v.fetchState==="Not-Started"||v.fetchState==="In-Progress"&&m==null,I=p.fetchState==="Not-Started"||p.fetchState==="In-Progress"&&p.customers.length===0,E=f||I,h=v.fetchState==="Completed"&&p.fetchState==="Completed";r.useEffect((()=>(t(nn()),()=>{t(nn())})),[t]);const y=r.useRef(!1);r.useEffect((()=>{y.current||o==null||o===""||d.customerId!==""||(y.current=!0,t(fn({...d,customerId:o})))}),[o,d,t]),r.useEffect((()=>{a&&t(ai({cacheOverride:!1}))}),[a,t]);const D=r.useRef(u);return r.useEffect((()=>{const b=D.current;if(D.current=u,b!=="Completed"&&u==="Completed"){const A=S!=null?`/${n}/invoicing/invoices/${encodeURIComponent(S)}`:`/${n}/invoicing/invoices`;e(A)}}),[u,S,e,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreateInvoicePage,isReady:h}),E?c.jsx(gt,{}):c.jsx(Zo,{navigate:e,tenantEmailDomain:n})]})}const ea=T((function(t,e){const{detailView:n}=e;return{fieldHelp:e.detailView.fieldHelp,creditNote:n.creditNote,creditNoteId:e.creditNoteId,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onBack:()=>e.navigate(`${n}/credits`),onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:i,fromScreen:"credit_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onInvoiceClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",invoiceId:i,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}`)},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"credit_detail",subscriptionId:i,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)}}}))(vt);function na(){const t=L(),e=P(),{credit_note_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((u=>ri(u,n??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&n!=null&&t(di({id:n}))}),[a,n,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditDetailPage,isReady:s}),c.jsx(ea,{navigate:e,tenantEmailDomain:i,creditNoteId:n??"",detailView:o})]})}const ta=T((function(t){const e=In(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",creditNotes:e.creditNotes,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.creditNotes.length===0,isLoadingMore:n==="In-Progress"&&e.creditNotes.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"credits"}),e.navigate(`${n}/data_import`)},onCreditNoteClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteRowClicked,{creditNoteId:i}),e.navigate(`${n}/credits/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"credits",status:e.activeStatus}),t(ui({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(pt);function ia(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,creditNoteListFetchState:h}=k((D=>{const b=In(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,creditNoteListFetchState:b.fetchState}}),Q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(ye({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(ye({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCreditsListPage,isReady:y}),c.jsx(ta,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>{t(li(D)),t(ye({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Jn=(t,e,n)=>{const i=`/${t}/invoicing/customers/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},oa=T((function(t,e){const{editView:n,hasLoadedRecord:i}=e;return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,hasUnsavedBillingAddress:n.hasUnsavedBillingAddress,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,customer:n.record.invoicingCustomer,invoices:n.record.invoices.slice(0,5),isLoading:!i&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),hasPaymentLinkEmailPreviewFailed:n.emailPreviewFetchState.fetchState==="Error",isPaymentLinkEmailPreviewLoading:n.emailPreviewFetchState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",paymentLinkEmailPreview:n.emailPreview,isSendingPaymentLink:n.record.sendLinkState.fetchState==="In-Progress",localData:n.localData,paymentMethods:n.record.paymentMethods,sendPaymentLinkErrorMessage:n.record.sendLinkState.fetchState==="Error"?n.record.sendLinkState.error?.message??"Failed to send payment link.":void 0,sentPaymentLinkEmail:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkEmail:void 0,sentPaymentLinkMagicUrl:n.record.sendLinkState.fetchState==="Completed"?n.record.sentPaymentLinkMagicUrl:void 0,stripeConnected:n.record.stripeConnected}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e;return{onBack:()=>e.navigate(`${n}/customers`),onChange:a=>{t($e({id:i,localData:a}))},onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onCreatePromotionalCredits:()=>{g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customer_detail"}),e.onCreatePromotionalCredits()},onNewSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customer_detail"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`)},onDiscardEdit:()=>{t(Ie(me)),t(Ii({id:i}))},onOpenAddress:()=>{const a=Jn(e.tenantEmailDomain??"",me,i),o=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onOpenPaymentSettings:()=>e.navigate(`${n}/settings/payment-destination`),onSaveEdit:a=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerEdited,{customerId:i,mode:"edit",...B(a,e.editView.record.invoicingCustomer!=null?Cn(e.editView.record.invoicingCustomer):void 0,Yn)}),t($e({id:i,localData:a})),t(kn({id:i}))},onFetchPaymentLinkEmailPreview:a=>t(fi({cacheOverride:a,customerId:i})),onSendPaymentLink:(a,o,s)=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentLinkSent,{customerId:i,fromScreen:"customer_detail"}),t(Si({body:s,customerId:i,email:a,subject:o}))},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"customer_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)}}}))(It);function aa(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),s=k((O=>Be(O,i))),u=s.pageFetchState.fetchState,d=u==="Completed"&&!s.isFormLoading,[S,m]=r.useState(!1),[v,p]=r.useState(!1),[f,I]=r.useState(d?i:void 0);r.useEffect((()=>{i!=null&&d&&I(i)}),[i,d]);const E=f===i,{plaidTokenFetchState:h,promotionalCreditSubmitState:y}=s,{paymentMethodSaveState:D,setupIntentFetchState:b,stripeConnected:A}=s.record,C=r.useRef(s.record.sendLinkState.fetchState);r.useEffect((()=>{const O=s.record.sendLinkState.fetchState;C.current!=="Error"&&O==="Error"&&t(Ve({messageSection:"common",messageText:"failed",showStatusIcon:!0,type:"error"})),C.current=O}),[t,s.record.sendLinkState.fetchState]);const j=b.fetchState==="Error"?b.error?.message??"Failed to start card setup.":D.fetchState==="Error"?D.error?.message??"Failed to save payment method.":h.fetchState==="Error"?h.error?.message??"Failed to connect bank account.":void 0;r.useEffect((()=>(t(oe()),t(ae()),()=>{t(oe()),t(ae())})),[t]),r.useEffect((()=>{n.state?.openPromotionalCreditsDialog===!0&&(p(!0),e(n.pathname,{replace:!0,state:null}))}),[n.pathname,n.state,e]),r.useEffect((()=>{o&&i!=null&&t(gi({id:i}))}),[o,i,t]),r.useEffect((()=>{o&&i!=null&&A&&t(tn({customerId:i}))}),[o,i,t,A]);const R=r.useCallback((O=>t(hn({id:O}))),[t]),U=ne(s.fetchState,s.isFormLoading,i,R);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerDetailPage,isReady:d}),c.jsx(oa,{customerId:i??"",editView:s,hasLoadedRecord:E,location:n,navigate:e,tenantEmailDomain:a,onAddPaymentMethod:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodAddClicked,{customerId:i??"",fromScreen:"customer_detail"}),t(oe()),i!=null&&A&&t(tn({customerId:i})),m(!0)},onCreatePromotionalCredits:()=>{t(ae()),p(!0)}},U),c.jsx(St,{errorMessage:j,isCreatingSetupIntent:b.fetchState==="In-Progress",isSaving:D.fetchState==="In-Progress",open:S,plaidLinkToken:s.record.plaidLinkToken,saveSucceeded:D.fetchState==="Completed",setupIntent:s.record.setupIntent,stripeConnected:A,onChooseCard:()=>{i!=null&&t(vi({customerId:i}))},onClose:()=>{m(!1),t(oe())},onSavePaymentMethod:O=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPaymentMethodSaved,{customerId:i,fromScreen:"customer_detail"}),t(mi({customerId:i,data:O})))}}),c.jsx(ft,{currentBalance:s.record.invoicingCustomer?.promotionalCredits,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,errorMessage:y.fetchState==="Error"?y.error?.message??"Failed to add promotional credits.":void 0,isSubmitting:y.fetchState==="In-Progress",open:v,submitSucceeded:y.fetchState==="Completed",onClose:()=>{p(!1),t(ae())},onSubmit:({amount:O,description:ie})=>{i!=null&&(g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsAdded,{amount:O,customerId:i,fromScreen:"customer_detail"}),t(pi({amount:O,customerId:i,currencyCode:s.record.invoicingCustomer?.preferredCurrencyCode,description:ie})))}})]})}const ca=T((function(t,e){const n=Be(t,e.customerId);return{fieldHelp:n.fieldHelp,billingAddressLabel:n.billingAddressLabel,customerTypeOptions:n.customerTypeOptions,netTermDayOptions:n.netTermDayOptions,taxabilityOptions:n.taxabilityOptions,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save customer.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,savedCustomer:n.record.invoicingCustomer}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{customerId:i}=e,a=i!=null?`${n}/customers/${encodeURIComponent(i)}`:`${n}/customers`;return{onBack:()=>e.navigate(a),onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerFormCancelled),t(En({id:i})),t(Ie(me)),e.navigate(`${n}/customers`)},onChange:o=>{t($e({id:i,localData:o}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"customer",fromScreen:"customer_form"});const o=Jn(e.tenantEmailDomain??"",me,i),s=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(o,{state:{pathnameStackToGoBack:s}})},onSubmit:()=>{t(kn({id:i}))}}}),(function({savedCustomer:t,...e},n,i){return{...i,...e,...n,onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerSaved,{customerId:i.customerId,mode:e.mode,...B(e.localData,t!=null?Cn(t):void 0,Yn)}),n.onSubmit()}}}))(ht);function sa(){const t=L(),e=P(),n=X(),{customer_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),{fetchState:s,savedCustomerId:u}=k((d=>Be(d,i)));return r.useEffect((()=>{o&&i!=null&&t(hn({id:i}))}),[o,i,t]),r.useEffect((()=>{if(s==="Completed"){const d=u??i,S=d!=null?`/${a}/invoicing/customers/${encodeURIComponent(d)}`:`/${a}/invoicing/customers`;e(S),t(En({id:i}))}}),[s,u,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomerFormPage}),c.jsx(ca,{customerId:i,location:n,navigate:e,tenantEmailDomain:a})]})}const ra=T((function(t){const e=fe(t),{fetchState:n}=e;return{addressesById:t.addressState.addressesById,columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",customers:e.customers,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.customers.length===0,isLoadingMore:n==="In-Progress"&&e.customers.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onAddCustomer:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddCustomerClicked),e.navigate(`${n}/customers/new`)},onCustomerClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingCustomerRowClicked,{customerId:i}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"customers"}),e.navigate(`${n}/data_import`)},onRowAction:(i,a)=>{switch(a){case"createInvoice":g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/invoices/create?customerId=${encodeURIComponent(i)}`);break;case"newSubscription":g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/subscriptions/new?customerId=${encodeURIComponent(i)}`);break;case"createPromotionalCredits":g.trackInvoicingActionClick(l.Event.invoicingPromotionalCreditsClicked,{customerId:i,fromScreen:"customers_list"}),e.navigate(`${n}/customers/${encodeURIComponent(i)}`,{state:{openPromotionalCreditsDialog:!0}})}},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"customers",status:e.activeStatus}),t(yn({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ct);function da(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,customerListFetchState:h}=k((D=>{const b=fe(D);return{activeStatus:b.activeTab,appliedSearch:b.filters.search,appliedSort:b.sort,nextCursor:b.nextCursor,customerListFetchState:b.fetchState}}),Q),y=h==="Completed";return r.useEffect((()=>{const D=setTimeout((()=>u(a)),300);return()=>clearTimeout(D)}),[a]),r.useEffect((()=>{i&&t(be({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(be({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingCustomersListPage,isReady:y}),c.jsx(ra,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onStatusChange:D=>{t(hi(D)),t(be({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Te=(t,e)=>e==null?void 0:t.sessionDetail[e]??t.sessions.find((n=>n.id===e)),la=T((function(t,e){const{authParams:n,csvDownloadUrl:i,filters:a,sessionId:o,view:s}=e,u=o==null?void 0:s.diagnosticsBySession[o],d=u?.fetch.fetchState??"Not-Started";return{authParams:n,csvDownloadUrl:i,diagnostics:u?.items??[],errorMessage:d==="Error"?u?.fetch.error?.message:void 0,expired:u?.expired??!1,filters:a,hasMore:u?.nextCursor!=null,isLoading:d==="Not-Started"||d==="In-Progress",isLoadingMore:d==="In-Progress"&&(u?.items.length??0)>0,session:Te(s,o)}}),(function(t,e){const{filters:n,navigate:i,sessionId:a,tenantEmailDomain:o,view:s}=e,u=a==null?void 0:s.diagnosticsBySession[a],d=Te(s,a),S=s.actionStateByKind.retry?.fetchState==="In-Progress",m=s.actionStateByKind.rollback?.fetchState==="In-Progress",v=d?.status==="done"&&d.rollback_available_until!=null&&new Date(d.rollback_available_until).getTime()>Date.now()&&!m;return{onBack:()=>i(`/${o}/invoicing/data_import`),onDownloadCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"download_csv",fromScreen:"data_import_detail",sessionId:a})},onDownloadError:()=>{t(Ve({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onFiltersChange:e.onFiltersChange,onLoadMore:()=>{a!=null&&u?.nextCursor!=null&&t(Re({...n,cursor:u.nextCursor,sessionId:a}))},onRetry:d?.status!=="failed"||S?void 0:()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_detail",sessionId:a}),t(qe(a)))},onRollback:v?()=>{a!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",fromScreen:"data_import_detail",sessionId:a}),t(bn(a)))}:void 0}}))(kt);function ua(){const t=L(),e=P(),{sessionId:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),[o,s]=r.useState({}),u=k(He),d=k(he),S=r.useMemo((()=>{const E=J.getSignedInUser();return{userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:d.tenantId}}),[d.tenantId]),m=Te(u,n),v=n==null?void 0:u.diagnosticsBySession[n];r.useEffect((()=>{a&&n!=null&&t(we(n))}),[a,t,n]),r.useEffect((()=>{if(!a||n==null)return;const E=setTimeout((()=>{t(Re({...o,sessionId:n}))}),300);return()=>clearTimeout(E)}),[a,t,o,n]);const p=m?.status==="scanning"||m?.status==="importing";r.useEffect((()=>{if(!a||n==null||!p)return;const E=setInterval((()=>{t(we(n)),t(Re({...o,sessionId:n}))}),3e3);return()=>clearInterval(E)}),[a,t,o,p,n]);const f=r.useMemo((()=>{if(n==null)return"";const E=new URLSearchParams;o.moduleId!=null&&E.set("module_id",o.moduleId),o.level!=null&&E.set("level",o.level),o.outcome!=null&&E.set("outcome",o.outcome),o.search!=null&&o.search.trim()!==""&&E.set("search",o.search.trim());const h=E.toString();return`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/${encodeURIComponent(n)}/issues.csv${h===""?"":`?${h}`}`}),[o,n]),I=v?.fetch.fetchState??"Not-Started";return N(I)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportDetailPage,isReady:m!=null&&I!=="Not-Started"}),c.jsx(la,{authParams:S,csvDownloadUrl:f,filters:o,navigate:e,sessionId:n,tenantEmailDomain:i,view:u,onFiltersChange:s})]})}const Zn=t=>`invoicing_active_migration:${t}`,re=(t,e)=>{if(t!=null&&t!=="")try{const n=Zn(t);e==null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},ga=T((function(t,e){const{sessions:n,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:n,statusRows:o}}),(function(t,e){const{navigate:n,tenantEmailDomain:i}=e,a=o=>{const s=o??null;t(se(s)),re(i,s),n(`/${i}/invoicing/data_import/migrate`)};return{onContinueSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"continue",sessionId:o}),a(o)},onNewImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingNewImportClicked),a()},onRetrySession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",sessionId:o}),t(qe(o)),a(o)},onRollbackSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"rollback",sessionId:o}),t(bn(o))},onViewSession:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"view_details",sessionId:o}),n(`/${i}/invoicing/data_import/${encodeURIComponent(o)}`)}}}))(Et);function ma(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),a=k(He);r.useEffect((()=>{i&&(t(Ci()),t(xn()))}),[i,t]);const o=a.statusFetch.fetchState==="Completed"&&a.sessionsFetch.fetchState==="Completed";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportHubPage,isReady:o}),c.jsx(ga,{navigate:e,tenantEmailDomain:n,view:a})]})}const va=T((function(t,e){const{activeId:n,authParams:i,integrationsView:a,settings:o,templatesDownloadUrl:s,view:u}=e,{actionStateByKind:d,sessionDetail:S,sessions:m}=u,v=a.externalConnections?.revenue?.find((f=>f.connectionName==="chargebee")),p=n!=null?S[n]:void 0;return{authParams:i,templatesDownloadUrl:s,chargebeeConnected:o?.chargebee_connected===!0||(v?.isValid??!1),chargebeeConnectorAvailable:v!=null,chargebeeSite:o?.chargebee_site,connectError:d.connect?.error?.message,connecting:d.connect?.fetchState==="In-Progress",retrying:d.retry?.fetchState==="In-Progress",session:p??m.find((f=>f.id===n)),starting:d.start?.fetchState==="In-Progress",uploading:d.upload?.fetchState==="In-Progress"}}),(function(t,e){const{activeId:n,navigate:i,tenantEmailDomain:a}=e;return{onBack:e.onBack,onDownloadError:()=>{t(Ve({messageSection:"invoicing_data_import_download",messageText:"failed",showStatusIcon:!0,type:"error"}))},onDownloadTemplates:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportTemplatesDownloaded)},onFetchFromChargebee:()=>{g.trackInvoicingActionClick(l.Event.invoicingChargebeeConnectClicked),t(yi())},onGoToIntegrations:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"settings_integrations"}),i(`/${a}/invoicing/settings`)},onGoToOverview:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"data_import_migrate",toScreen:"overview"}),i(`/${a}/invoicing/overview`)},onRetry:()=>{n!=null&&(g.trackInvoicingActionClick(l.Event.invoicingImportSessionAction,{action:"retry",fromScreen:"data_import_migrate",sessionId:n}),t(qe(n)))},onSaveLater:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportSavedForLater),e.onBack()},onStartImport:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportStarted),n!=null&&t(Ei(n))},onUpload:o=>{g.trackInvoicingActionClick(l.Event.invoicingImportFileUploaded),t(ki({files:o}))},onViewDetails:n==null?void 0:()=>i(`/${a}/invoicing/data_import/${encodeURIComponent(n)}`)}}))(yt);function pa(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),a=k(Sn),o=k(he),s=r.useMemo((()=>{const h=J.getSignedInUser();return{userId:h?.userId??"",sessionId:h?.zeniSessionId??"",tenantId:o.tenantId}}),[o.tenantId]),u=`${de?.invoicingMicroServiceBaseUrl??""}/1.0/data-import/templates`,d=o.companyId??J.getSignedInUserTenant(n??"")?.companyId,S=k((h=>An(h,d))),m=k(He),{activeMigrationSessionId:v}=m,p=v??void 0,f=p!=null?m.sessionDetail[p]??m.sessions.find((h=>h.id===p)):void 0;r.useEffect((()=>{i&&(t(Qe()),t(xn()))}),[i,t]),r.useEffect((()=>{if(v!=null)return;const h=(y=>{if(y==null||y==="")return null;try{return sessionStorage.getItem(Zn(y))}catch{return null}})(n);h!=null&&t(se(h))}),[v,t,n]),r.useEffect((()=>{re(n,v)}),[v,n]);const I=f?.status,E=I==="scanning"||I==="importing";return r.useEffect((()=>{if(!i||p==null||!E)return;const h=setInterval((()=>{t(we(p))}),3e3);return()=>clearInterval(h)}),[i,p,E,t]),r.useEffect((()=>{I==="done"&&(t(se(null)),re(n,null))}),[t,I,n]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDataImportMigratePage}),c.jsx(va,{activeId:p,authParams:s,integrationsView:S,navigate:e,settings:a,templatesDownloadUrl:u,tenantEmailDomain:n,view:m,onBack:()=>{t(se(null)),re(n,null),e(`/${n}/invoicing/data_import`)}})]})}const Sa=T((function(t,e){const{editView:n}=e;return{fieldHelp:n.fieldHelp,coupon:n.coupon,discountLifecycleActionOptions:e.discountLifecycleActionOptions,discountsAccountName:n.discountsAccountName,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isRunningLifecycleAction:e.isRunningLifecycleAction,isSaving:n.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{couponId:i}=e;return{onBack:()=>e.navigate(`${n}/discounts`),onLifecycleAction:a=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discount_detail",status:e.editView.coupon?.status}),t(Dn({action:a,id:i}))},onSaveEdit:a=>{const{coupon:o}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingCouponEdited,{couponId:i,mode:"edit",...B(a,{invoice_name:o?.invoiceName,invoice_notes:o?.invoiceNotes,max_redemptions:o?.maxRedemptions,name:o?.name},["invoice_notes"])}),t(xi({data:a,id:i}))}}}))(bt);function fa(){const t=L(),e=P(),{coupon_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((I=>bi(I,n))),s=o.actionState.fetchState==="In-Progress",u=o.pageFetchState.fetchState,d=u==="Completed",[S,m]=r.useState(d?n:void 0);r.useEffect((()=>{n!=null&&d&&m(n)}),[n,d]);const v=S===n;r.useEffect((()=>(t(ge({id:n})),()=>{t(ge({id:n}))})),[n,t]),r.useEffect((()=>{a&&t(_e({id:n}))}),[a,n,t]);const p=r.useCallback((I=>t(_e({cacheOverride:!0,id:I}))),[t]),f=ne(o.fetchState,o.isFormLoading,n,p);return N(u)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountDetailPage,isReady:d}),c.jsx(Sa,{hasLoadedRecord:v,couponId:n??"",discountLifecycleActionOptions:o.discountLifecycleActionOptions,editView:o,isRunningLifecycleAction:s,navigate:e,tenantEmailDomain:i},f)]})}const Ia=T((function(t){const e=jn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,discountLifecycleActionOptions:e.discountLifecycleActionOptions,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",coupons:e.coupons,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.coupons.length===0,isLoadingMore:n==="In-Progress"&&e.coupons.length>0,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onStatusChange:e.onStatusChange,onSortChange:e.onSortChange,onCouponClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingDiscountRowClicked,{couponId:i}),e.navigate(`${n}/discounts/${encodeURIComponent(i)}`)},onCreateCoupon:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateCouponClicked),e.navigate(`${n}/discounts/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"discounts"}),e.navigate(`${n}/data_import`)},onDiscountLifecycleAction:(i,a)=>{g.trackInvoicingActionClick(l.Event.invoicingCouponLifecycleAction,{action:a,couponId:i,fromScreen:"discounts_list"}),t(Dn({action:a,id:i}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"discounts",status:e.activeStatus}),t(Di({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(xt);function ha(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,couponListFetchState:h,runningDiscountActionId:y}=k((b=>{const A=jn(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,couponListFetchState:A.fetchState,runningDiscountActionId:A.runningActionId??null}}),Q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(xe({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(xe({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDiscountsListPage,isReady:D}),c.jsx(Ia,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningDiscountActionId:y,onSearchChange:o,onStatusChange:b=>{t(Ai(b)),t(xe({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Ca=T((function(t,e){const{readView:n}=e;return{fieldHelp:e.readView.fieldHelp,caseId:e.caseId,dunningAttempts:e.dunningAttempts,dunningCase:n.dunningCase,isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",step:n.step}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{caseId:i}=e,a=i!=="",{dunningCase:o}=e.readView,s={amount:o?.amount?.amount,caseId:i,customerId:o?.customerID,invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID};return{onBack:()=>e.navigate(`${n}/dunning`),onInvoiceClick:u=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{caseId:i,fromScreen:"dunning_detail",invoiceId:u,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(u)}`)},onCancel:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"cancel",fromScreen:"dunning_detail"}),t(z({action:"cancel",id:i}))}:void 0,onResolve:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resolve",fromScreen:"dunning_detail"}),t(z({action:"resolve",id:i}))}:void 0,onResume:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"resume",fromScreen:"dunning_detail"}),t(z({action:"resume",id:i}))}:void 0,onRetry:a?()=>{g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...s,action:"retry",fromScreen:"dunning_detail"}),t(z({action:"retry",id:i}))}:void 0}}))(Dt);function ka(){const t=L(),e=P(),{case_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((C=>ji(C,n??""))),s=o.fetchState==="Completed",u=o.dunningCase?.invoiceID,[d,S]=r.useState("idle"),[m,v]=r.useState(!1),[p,f]=r.useState(),[I,E]=r.useState(!1),h=r.useCallback((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[]),y=r.useCallback((()=>{if(n==null)return;t(Li({id:n})),S("idle"),v(!1);const C=o.emailPreview.preview;f(C==null?void 0:{body:C.body,cc:C.cc,subject:C.subject,to:C.to}),E(!0)}),[n,t,o.emailPreview.preview]),D=r.useCallback((C=>{n!=null&&d!=="pending"&&(v(!1),S("pending"),g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{action:"send-email",amount:o.dunningCase?.amount?.amount,caseId:n,customerId:o.dunningCase?.customerID,fromScreen:"dunning_detail",invoiceId:o.dunningCase?.invoiceID,status:o.dunningCase?.status,subscriptionId:o.dunningCase?.subscriptionID}),t(z({action:"send-email",body:C,id:n})))}),[n,t,d,o.dunningCase]),b=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&&n!=null&&t(Pi({id:n}))}),[a,n,t]),r.useEffect((()=>{a&&u!=null&&t(Ce({invoiceId:u}))}),[a,u,t]),r.useEffect((()=>{S("idle"),v(!1),f(void 0),E(!1)}),[n]),r.useEffect((()=>{a||(S("idle"),v(!1),f(void 0),E(!1))}),[a]),r.useEffect((()=>{I&&p==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,p,I]),r.useEffect((()=>{d==="pending"&&(o.actionState.fetchState!=="In-Progress"?m&&o.actionState.fetchState==="Completed"?(n!=null&&t(_i({id:n})),h()):m&&o.actionState.fetchState==="Error"&&S("failed"):v(!0))}),[n,h,t,d,m,o.actionState.fetchState]);const A=u!=null&&o.linkedInvoice?.id===u?o.linkedInvoice.dunningAttempts:void 0;return N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningDetailPage,isReady:s}),c.jsx(Ca,{navigate:e,tenantEmailDomain:i,caseId:n??"",readView:o,dunningAttempts:A,onSendEmail:y}),c.jsx(At,{initialDraft:p,isPreviewLoading:o.emailPreview.fetchState==="Not-Started"||o.emailPreview.fetchState==="In-Progress",isSending:d==="pending",onClose:h,onSend:D,open:I,preview:b,previewErrorMessage:o.emailPreview.fetchState==="Error"?o.emailPreview.error?.message:void 0,sendErrorMessage:d==="failed"?o.actionState.error?.message:void 0})]})}const Ea=T((function(t){const e=Ln(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",dunningCases:e.dunningCases,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.dunningCases.length===0,isLoadingMore:n==="In-Progress"&&e.dunningCases.length>0,stepById:e.stepById,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.dunningCases.find((s=>s.id===a));return{amount:o?.amount?.amount,caseId:a,customerId:o?.customerID,fromScreen:"dunning_list",invoiceId:o?.invoiceID,status:o?.status,subscriptionId:o?.subscriptionID}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onImportCsv:()=>e.navigate(`${n}/data_import`),onDunningCaseClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingDunningCaseRowClicked,i(a)),e.navigate(`${n}/dunning/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{o!=="retry"&&o!=="resume"&&o!=="resolve"&&o!=="cancel"||(g.trackInvoicingActionClick(l.Event.invoicingDunningAction,{...i(a),action:o}),t(z({action:o,id:a})))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"dunning",status:e.activeStatus}),t(wi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(jt);function ya(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,dunningCaseListFetchState:h,dunningCases:y}=k((b=>{const A=Ln(b);return{activeStatus:A.activeTab,appliedSearch:A.filters.search,appliedSort:A.sort,nextCursor:A.nextCursor,dunningCaseListFetchState:A.fetchState,dunningCases:A.dunningCases}}),Q),D=h==="Completed";return r.useEffect((()=>{const b=setTimeout((()=>u(a)),300);return()=>clearTimeout(b)}),[a]),r.useEffect((()=>{i&&t(Ae({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Ae({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningListPage,isReady:D}),c.jsx(Ea,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,dunningCases:y,nextCursor:E,onSearchChange:o,onStatusChange:b=>{t($i(b)),t(Ae({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const ba=T((function(t,e){const{view:n}=e;return{fieldHelp:e.view.fieldHelp,billingAddress:n.billingAddress,invoice:n.invoice,invoiceId:e.invoiceId,shippingAddress:n.shippingAddress,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"),isSaving:n.actionState.fetchState==="In-Progress",isVoiding:n.actionState.fetchState==="In-Progress"}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{invoiceId:i}=e,{invoice:a}=e.view,o={amount:a?.total?.amount,customerId:a?.customerID,invoiceId:i,status:a?.status};return{onBack:()=>e.navigate(`${n}/invoices`),onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"invoice_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(s)}`)},onIssueCreditNote:()=>{g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/issue-credit-note`)},onRecordPayment:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,{...o,fromScreen:"invoice_detail"}),e.navigate(`${n}/invoices/${encodeURIComponent(i)}/record-payment`)},onRegenerate:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,{...o,fromScreen:"invoice_detail"}),t(q({action:"regenerate",invoiceId:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceEdited,{...o,fromScreen:"invoice_detail",mode:"edit",...B(s,{due_date:a?.dueDate?.format("YYYY-MM-DD")??"",notes:(a?.notes??[]).map((u=>u.note)).filter((u=>u!=null&&u!=="")).join(`
|
|
2
2
|
`),po_number:a?.poNumber??""},["notes"])}),t(Fi({data:{due_date:s.due_date!==""?s.due_date:void 0,notes:s.notes.trim()!==""?s.notes.split(`
|
|
3
3
|
`).map((u=>u.trim())).filter((u=>u!=="")).map((u=>({note:u}))):void 0,po_number:s.po_number!==""?s.po_number:null},invoiceId:i}))},onSendReminder:()=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,{...o,fromScreen:"invoice_detail"}),t(q({action:"send-reminder",invoiceId:i}))},onSubscriptionClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"invoice_detail",subscriptionId:s,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(s)}`)},onVoid:s=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,{...o,fromScreen:"invoice_detail"}),t(q({action:"void",invoiceId:i,body:s}))}}}))(Lt);function xa(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=k((f=>Pn(f,n??""))),s=o.pageFetchState.fetchState,u=s==="Completed",[d,S]=r.useState(u?n:void 0);r.useEffect((()=>{n!=null&&u&&S(n)}),[n,u]);const m=d===n;r.useEffect((()=>{a&&n!=null&&t(Ri({invoiceId:n}))}),[a,n,t]);const v=r.useCallback((f=>t(Ce({invoiceId:f}))),[t]),p=ne(o.actionState.fetchState,o.fetchState==="In-Progress",n,v);return N(s)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingInvoiceDetailPage,isReady:u}),c.jsx(ba,{invoiceId:n??"",hasLoadedRecord:m,navigate:e,tenantEmailDomain:i,view:o},p)]})}const Aa=T((function(t){const e=_n(t),{fetchState:n}=e;return{counts:e.counts,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,invoices:e.invoices,statusOptions:e.statusOptions,isLoading:n==="Not-Started"||n==="In-Progress"&&e.invoices.length===0,isLoadingMore:n==="In-Progress"&&e.invoices.length>0,kpis:e.kpis,kpisLoading:e.kpisFetchState.fetchState==="Not-Started"||e.kpisFetchState.fetchState==="In-Progress"&&e.kpis==null,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=a=>{const o=e.invoices.find((s=>s.id===a));return{amount:o?.total?.amount,customerId:o?.customerID,fromScreen:"invoices_list",invoiceId:a,status:o?.status}};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onCreateInvoice:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreateInvoiceClicked),e.navigate(`${n}/invoices/create`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"invoices"}),e.navigate(`${n}/data_import`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceRowClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onRowAction:(a,o)=>{switch(o){case"recordPayment":g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/record-payment`);break;case"issueCreditNote":g.trackInvoicingActionClick(l.Event.invoicingIssueCreditNoteClicked,i(a)),e.navigate(`${n}/invoices/${encodeURIComponent(a)}/issue-credit-note`);break;case"sendReminder":g.trackInvoicingActionClick(l.Event.invoicingInvoiceReminderSent,i(a)),t(q({action:"send-reminder",invoiceId:a}));break;case"regenerate":g.trackInvoicingActionClick(l.Event.invoicingInvoiceRegenerated,i(a)),t(q({action:"regenerate",invoiceId:a}));break;case"void":g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a}))}},onVoidInvoice:(a,o)=>{g.trackInvoicingActionClick(l.Event.invoicingInvoiceVoided,i(a)),t(q({action:"void",invoiceId:a,body:o}))},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"invoices",status:e.activeStatus}),t($n({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Pt);function Da(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,invoiceListFetchState:h,voidingInvoiceId:y,invoices:D}=k((A=>{const C=_n(A);return{activeStatus:C.activeTab,appliedSearch:C.filters.search,appliedSort:A.invoicingInvoiceListState.sort,nextCursor:C.nextCursor,invoiceListFetchState:C.fetchState,voidingInvoiceId:C.runningActionId,invoices:C.invoices}}),Q),b=h==="Completed";return r.useEffect((()=>{const A=setTimeout((()=>u(a)),300);return()=>clearTimeout(A)}),[a]),r.useEffect((()=>{i&&t(De({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(De({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingInvoicesListPage,isReady:b}),c.jsx(Aa,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,invoices:D,nextCursor:E,voidingInvoiceId:y,onSearchChange:o,onStatusChange:A=>{t(Oi(A)),t(De({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}function sn(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),i=_t(),a=un(),[o,s]=r.useState(!1),{acceptTermsState:u,status:d}=k(wn),S=Ti(i?.loggedInUserRoleMap),m=`/${n}/invoicing`,v=p=>{s(p)};return d==="completed"?c.jsx(H,{to:`${m}/overview`,replace:!0}):d==="settings"&&S?c.jsx(H,{to:`${m}/settings`,replace:!0}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPromoPage}),c.jsx(Mo,{isAppContentDrawerOpen:o,handleDrawerToggle:v}),c.jsx($t,{analytics:g,isAccepting:u.fetchState==="In-Progress",isReadOnlyUser:!S,meetingUrl:a("invoicing_promo"),onAcceptClick:()=>{g.trackInvoicingActionClick(l.Event.invoicingTermsAccepted),t(Mi())},onBackClick:()=>{e(`/${n}`)},onClickMenuIcon:()=>{v(!0)}})]})}const ja=T((function(t,e){const n=Rn(t,e.invoiceId),{invoice:i,localData:a,reasonCodeOptions:o,submitState:s,typeOptions:u}=n;return{fieldHelp:n.fieldHelp,amountDue:i?.amountDue,currencyCode:i?.currencyCode??"USD",customerName:i?.customerName??"",errorMessage:s.fetchState==="Error"?s.error?.message??"Failed to issue credit note. Please try again.":void 0,invoiceNumber:i?.invoiceNumber??e.invoiceId,isSubmitting:s.fetchState==="In-Progress",localData:a,reasonCodeOptions:o,typeOptions:u}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing/invoices/${encodeURIComponent(e.invoiceId)}`,i=()=>e.navigate(n);return{onBack:i,onCancel:i,onChange:a=>{t(Hi({localData:a}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingCreditNoteIssued,{invoiceId:e.invoiceId}),t(Vi())}}}))(wt);function La(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),{fetchState:o,invoice:s,isPageReady:u,issuedCreditNoteId:d,submitState:S}=k((f=>Rn(f,n??""))),m=`/${i}/invoicing`,v=r.useRef(null);r.useEffect((()=>{t(Ni()),v.current=null}),[t,n]),r.useEffect((()=>{a&&n!=null&&t(Ce({invoiceId:n}))}),[a,t,n]),r.useEffect((()=>{s!=null&&n!=null&&o==="Completed"&&v.current!==n&&(v.current=n,t(Ui({localData:Bi(s)})))}),[t,o,s,n]);const p=r.useRef(S.fetchState);return r.useEffect((()=>{const f=p.current;p.current=S.fetchState,f!=="Completed"&&S.fetchState==="Completed"&&d!=null&&e(`${m}/credits/${encodeURIComponent(d)}`)}),[d,e,S.fetchState,m]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingIssueCreditNotePage,isReady:u}),c.jsx(ja,{invoiceId:n??"",navigate:e,tenantEmailDomain:i})]})}const Pa=T((function(t){return{invoicingOverview:Fn(t)}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingOverviewRefreshed),t(On(e.selectedPeriod,!0))},onSubscriptionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionTileClicked,{subscriptionId:i}),e.navigate(`${n}/subscriptions/${i}`)},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewInvoicesClicked),e.navigate(`${n}/invoices`)},onViewPayments:()=>{g.trackInvoicingActionClick(l.Event.invoicingViewPaymentsClicked),e.navigate(`${n}/payments`)}}}))(Rt);function _a(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a]=r.useState((()=>{const s=new Date;return{month:s.getMonth()+1,year:s.getFullYear()}})),o=k((s=>Fn(s).fetchState))==="Completed";return r.useEffect((()=>{i&&t(On(a))}),[i,t,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingOverviewPage,isReady:o}),c.jsx(Pa,{navigate:e,selectedPeriod:a,tenantEmailDomain:n})]})}const $a=T((function(t){const e=Tn(t),{fetchState:n}=e;return{columns:e.columns,hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.transactions.length===0,isLoadingMore:n==="In-Progress"&&e.transactions.length>0,tabIds:e.tabIds,transactions:e.transactions}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`;return{activeType:e.activeType,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onTypeChange:e.onTypeChange,onViewTransactionCustomer:e.onViewTransactionCustomer,onViewTransactionInvoice:e.onViewTransactionInvoice,onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"payments"}),e.navigate(`${n}/data_import`)},onTransactionClick:i=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRowClicked,{transactionId:i}),e.navigate(`${n}/payments/${encodeURIComponent(i)}`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"payments",tab:e.activeType}),t(Qi({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Ft);function wa(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeType:p,appliedSearch:f,appliedSort:I,nextCursor:E,transactionListFetchState:h,transactions:y}=k((j=>{const R=Tn(j);return{activeType:R.activeTab,appliedSearch:R.filters.search,appliedSort:R.sort,nextCursor:R.nextCursor,transactionListFetchState:R.fetchState,transactions:R.transactions}}),Q),D=h==="Completed",b=`/${n}/invoicing`,A=r.useCallback((j=>{const R=y.find((O=>O.id===j)),U=R?.linkedInvoices?.[0]?.invoiceID??R?.invoiceID;U!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"payments_list",invoiceId:U,toScreen:"invoice"}),e(`${b}/invoices/${encodeURIComponent(U)}`))}),[e,b,y]),C=r.useCallback((j=>{const R=y.find((U=>U.id===j))?.customerID;R!=null&&(g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:R,fromScreen:"payments_list",toScreen:"customer"}),e(`${b}/customers/${encodeURIComponent(R)}`))}),[e,b,y]);return r.useEffect((()=>{const j=setTimeout((()=>u(a)),300);return()=>clearTimeout(j)}),[a]),r.useEffect((()=>{i&&t(je({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(je({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPaymentsListPage,isReady:D}),c.jsx($a,{navigate:e,tenantEmailDomain:n,activeType:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,onSearchChange:o,onTypeChange:j=>{t(qi(j)),t(je({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S,onViewTransactionCustomer:C,onViewTransactionInvoice:A})]})}const Ra=t=>{const e=[t.firstName,t.lastName].filter((n=>n!=null&&n.trim()!=="")).join(" ").trim();return(t.company!=null&&t.company.trim()!==""?t.company.trim():"")||e||(t.email!=null&&t.email.trim()!==""?t.email.trim():"")||t.id};function rn(){const t=L(),e=P(),{invoice_id:n,tenantEmailDomain:i}=w(),{areTenantIdsInSync:a}=F(),o=n!=null&&n!=="",s=k(fe),u=k((C=>zi(C))),d=k(Ki),S=k((C=>Pn(C,n??""))),m=S.invoice,v=`/${i}/invoicing`,p=r.useRef(null),f=r.useRef("");r.useEffect((()=>{t(Gi()),p.current=null,f.current=""}),[t,n]),r.useEffect((()=>{a&&t(o&&n!=null?Ce({invoiceId:n}):yn({filters:{},keepExistingListItems:!1}))}),[a,t,n,o]),r.useEffect((()=>{o&&m!=null&&n!=null&&S.fetchState==="Completed"&&p.current!==n&&(p.current=n,t(Wi({contextInvoiceId:n,localData:Yi(m)})))}),[t,m,n,S.fetchState,o]),r.useEffect((()=>{if(o)return;const C=u.localData.customerId;C!==""&&C!==f.current&&(f.current=C,t($n({filters:{customerId:C},keepExistingListItems:!1})),u.localData.invoiceToLink!==""&&t(on({localData:{...u.localData,customerId:C,invoiceToLink:""}})))}),[t,u.localData,o]);const I=r.useRef(d.fetchState);r.useEffect((()=>{const C=I.current;if(I.current=d.fetchState,C!=="Completed"&&d.fetchState==="Completed"){if(d.recordedInvoiceId!=null)return void e(`${v}/invoices/${encodeURIComponent(d.recordedInvoiceId)}`);e(`${v}/payments`)}}),[e,d.fetchState,d.recordedInvoiceId,v]);const E=r.useMemo((()=>s.customers.map((C=>({id:C.id,name:Ra(C)})))),[s.customers]),h=k((C=>Ji(C,u.localData.customerId))),y=r.useMemo((()=>h.map((C=>{return{amountDue:(j=C.amountDue,R=Zi.currencySymbol,Mt("0,0.00",j,R)),amountDueValue:C.amountDue,id:C.id,label:C.invoiceNumber};var j,R}))),[h]),D=r.useMemo((()=>{if(!o||m==null)return;const C=m.currencyCode??"USD",j=m.amountDue?.amount??0;return{amountDue:Ot("0,0.00",m.amountDue),amountDueValue:j,currencyCode:C,customerName:m.customerName??m.customerID,invoiceId:m.id,invoiceNumber:m.invoiceNumber??m.id}}),[m,o]),b=o?`${v}/invoices/${encodeURIComponent(n??"")}`:`${v}/payments`,A=!o||S.fetchState==="Completed"&&u.localData.invoiceToLink!=="";return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingRecordPaymentPage,isReady:A}),c.jsx(Tt,{customers:E,fieldHelp:u.fieldHelp,errorMessage:d.fetchState==="Error"?d.error?.message??"Failed to record payment. Please try again.":void 0,gatewayOptions:u.gatewayOptions,invoiceContext:D,invoiceOptions:y,isSubmitting:d.fetchState==="In-Progress",localData:u.localData,mode:o?"invoice":"customer",paymentMethodOptions:u.paymentMethodOptions,onBack:()=>{e(b)},onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingRecordPaymentCancelled),e(b)},onChange:C=>{t(on({localData:C}))},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingPaymentRecorded,{customerId:u.localData.customerId,invoiceId:o?n:u.localData.invoiceToLink,paymentMethod:u.localData.paymentMethod}),t(Xi(o?n??void 0:void 0))}})]})}const Xn=(t,e,n)=>{const i=`/${t}/invoicing/subscriptions/`;return n!=null?`${i}${encodeURIComponent(n)}/${e}/`:`${i}new/${e}/`},Fa=T((function(t,e){const{editView:n}=e,i=n.subscription,a=i?.status,o=a!=null&&e.commercialEditAllowedFromStatuses.includes(a);return{cancelReasonCodeOptions:n.cancelReasonCodeOptions,fieldHelp:n.fieldHelp,addons:n.addons,canEditCommercial:o,charges:n.charges,coupons:n.coupons,estimate:n.estimate,isLoading:!e.hasLoadedRecord&&(n.pageFetchState.fetchState==="Not-Started"||n.pageFetchState.fetchState==="In-Progress"||n.isFormLoading),isRunningAction:n.actionState.fetchState==="In-Progress",isSaving:n.fetchState==="In-Progress",lifecycleActionOptions:e.lifecycleActionOptions,localData:n.localData,plans:n.plans,shippingAddressLabel:n.shippingAddressLabel,hasUnsavedShippingAddress:n.hasUnsavedShippingAddress,subscription:i}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e,a=i!=="",o=(s,u)=>{const{subscription:d}=e.editView;g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:s,amount:d?.mrr?.amount,customerId:d?.customerID,fromScreen:"subscription_detail",status:d?.status,subscriptionId:i}),t(Bn({action:s,id:i,body:u}))};return{onBack:()=>e.navigate(`${n}/subscriptions`),onChange:s=>{t(Y({id:i,localData:s}))},onChangeTermEnd:a?s=>{const u=s?.trim()??"";u!==""&&o("change_term_end",{term_ends_at:u})}:void 0,onCustomerClick:s=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:s,fromScreen:"subscription_detail",toScreen:"customer"}),window.open(`${n}/customers/${encodeURIComponent(s)}`,"_blank","noopener,noreferrer")},onDiscardEdit:()=>{t(Ie(ve)),t(to({id:i}))},onOpenAddress:()=>{const s=Xn(e.tenantEmailDomain??"",ve,i),u=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(s,{state:{pathnameStackToGoBack:u}})},onViewInvoices:()=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"subscription_detail",subscriptionId:i,toScreen:"invoices"}),e.navigate(`${n}/invoices`)},onCloseEstimate:()=>{t(Un())},onRequestEstimate:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,{mode:"edit",subscriptionId:i,...B(s,Fe(e.editView.subscription))}),t(Y({id:i,localData:s})),t(Nn({id:i}))},onSaveEdit:s=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEdited,{mode:"edit",subscriptionId:i,...B(s,Fe(e.editView.subscription))}),t(Y({id:i,localData:s})),t(Mn({id:i}))},onCancelSubscription:a?s=>{o("cancel",{cancel_reason_code:s.cancelReasonCode,end_of_term:!1,...s.cancelReason!=null&&s.cancelReason.trim()!==""?{cancel_reason:s.cancelReason.trim()}:{}})}:void 0,onLifecycleAction:a?(s,u)=>{s!=="pause"?o(s):o(s,u!=null&&u.trim()!==""?{resume_date:u.trim()}:void 0)}:void 0}}))(Nt);function Oa(){const t=L(),e=P(),n=X(),{subscription_id:i,tenantEmailDomain:a}=w(),{areTenantIdsInSync:o}=F(),s=k((y=>ze(y,i))),{subscriptionCommercialEditAllowedFromStatuses:u,subscriptionLifecycleActionOptions:d,subscriptionMetadataEditAllowedFromStatuses:S}=s,m=s.pageFetchState.fetchState,v=m==="Completed"&&!s.isFormLoading,[p,f]=r.useState(v?i:void 0);r.useEffect((()=>{i!=null&&v&&f(i)}),[i,v]);const I=p===i;ke(o),r.useEffect((()=>{o&&i!=null&&t(eo({id:i}))}),[o,i,t]);const E=r.useCallback((y=>t(no({id:y}))),[t]),h=ne(s.fetchState,s.isFormLoading,i,E);return N(m)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionDetailPage,isReady:v}),c.jsx(Fa,{hasLoadedRecord:I,commercialEditAllowedFromStatuses:u,editView:s,lifecycleActionOptions:d,location:n,metadataEditAllowedFromStatuses:S,navigate:e,subscriptionId:i??"",tenantEmailDomain:a},h)]})}const Ta=T((function(t,e){const n=ze(t,e.subscriptionId);return{fieldHelp:n.fieldHelp,addons:n.addons,charges:n.charges,coupons:n.coupons,customers:n.customers,estimate:n.estimate,errorMessage:n.fetchState==="Error"?n.error?.message??"Failed to save subscription.":void 0,isSubmitting:n.fetchState==="In-Progress",isLoading:n.isFormLoading,localData:n.localData,mode:n.mode,plans:n.plans,savedSubscription:n.subscription,shippingAddressLabel:n.shippingAddressLabel}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{subscriptionId:i}=e;return{onCancel:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionFormCancelled),t(Vn({id:i})),t(Ie(ve)),i==null?e.navigate(`${n}/subscriptions`):e.navigate(`${n}/subscriptions/${encodeURIComponent(i)}`)},onChange:a=>{t(Y({id:i,localData:a}))},onCloseEstimate:()=>{t(Un())},onRequestEstimate:()=>{t(Nn({id:i}))},onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"subscription",fromScreen:"subscription_form"});const a=Xn(e.tenantEmailDomain??"",ve,i),o=ee(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(a,{state:{pathnameStackToGoBack:o}})},onSubmit:()=>{t(Mn({id:i}))}}}),(function({savedSubscription:t,...e},n,i){const a=()=>({mode:e.mode,subscriptionId:i.subscriptionId,...B(e.localData,t!=null?Fe(t):void 0)});return{...i,...e,...n,onRequestEstimate:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionEstimateCalculation,a()),n.onRequestEstimate()},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionSaved,a()),n.onSubmit()}}}))(Ut);function Ma(){const t=L(),e=P(),n=X(),{subscription_id:i,tenantEmailDomain:a}=w(),[o]=Z(),{areTenantIdsInSync:s}=F(),u=o.get("customerId"),{fetchState:d,savedSubscriptionId:S}=k((p=>io(p,i))),m=k((p=>ze(p,i).localData));ke(s),r.useEffect((()=>{s&&t(oo({subscriptionId:i}))}),[s,i,t]);const v=r.useRef(!1);return r.useEffect((()=>{v.current||i!=null||u==null||u===""||m.customerId!==""||(v.current=!0,t(Y({id:i,localData:{...m,customerId:u}})))}),[u,i,m,t]),r.useEffect((()=>{if(d==="Completed"){const p=S??i,f=p!=null?`/${a}/invoicing/subscriptions/${encodeURIComponent(p)}`:`/${a}/invoicing/subscriptions`;e(f),t(Vn({id:i}))}}),[d,S,i,t,e,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionFormPage}),c.jsx(Ta,{location:n,navigate:e,subscriptionId:i,tenantEmailDomain:a})]})}const Na=T((function(t){const e=Hn(t),{fetchState:n}=e;return{columns:e.columns,counts:e.count,countsLoading:e.countsFetchState.fetchState==="Not-Started"||e.countsFetchState.fetchState==="In-Progress",hasMore:e.nextCursor!=null,isLoading:n==="Not-Started"||n==="In-Progress"&&e.subscriptions.length===0,isLoadingMore:n==="In-Progress"&&e.subscriptions.length>0,cancelReasonCodeOptions:e.cancelReasonCodeOptions,lifecycleActionOptions:e.subscriptionLifecycleActionOptions,subscriptions:e.subscriptions,tabIds:e.tabIds}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,i=(a,o,s)=>{const u=e.subscriptions.find((d=>d.id===a));g.trackInvoicingActionClick(l.Event.invoicingSubscriptionLifecycleAction,{action:o,amount:u?.mrr?.amount,customerId:u?.customerID,fromScreen:"subscriptions_list",status:u?.status,subscriptionId:a}),t(Bn({action:o,id:a,body:s}))};return{activeStatus:e.activeStatus,searchValue:e.searchValue,sortState:e.sortState,onSearchChange:e.onSearchChange,onSortChange:e.onSortChange,onStatusChange:e.onStatusChange,onAddSubscription:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddSubscriptionClicked),e.navigate(`${n}/subscriptions/new`)},onImportCsv:()=>{g.trackInvoicingActionClick(l.Event.invoicingImportCsvClicked,{entity:"subscriptions"}),e.navigate(`${n}/data_import`)},onChangeTermEnd:(a,o)=>{const s=o?.trim()??"";s!==""&&i(a,"change_term_end",{term_ends_at:s})},onSubscriptionAction:(a,o,s)=>{o!=="pause"?i(a,o):i(a,o,s!=null&&s.trim()!==""?{resume_date:s.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=>{g.trackInvoicingActionClick(l.Event.invoicingSubscriptionRowClicked,{subscriptionId:a}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onViewSubscriptionInvoices:()=>{e.navigate(`${n}/invoices`)},onLoadMore:()=>{e.nextCursor!=null&&(g.trackInvoicingActionClick(l.Event.invoicingListLoadMore,{entity:"subscriptions",status:e.activeStatus}),t(so({cursor:e.nextCursor,filters:e.filters,keepExistingListItems:!0,sort:e.sort})))}}}))(Bt);function Ua(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),[a,o]=r.useState(""),[s,u]=r.useState(""),[d,S]=r.useState(null),m=r.useMemo((()=>d!=null?{dir:d.direction,field:d.columnKey}:void 0),[d]),v=r.useMemo((()=>({search:s.trim()!==""?s.trim():void 0})),[s]),{activeStatus:p,appliedSearch:f,appliedSort:I,nextCursor:E,subscriptionListFetchState:h,runningActionSubscriptionId:y,subscriptions:D}=k((C=>{const j=Hn(C);return{activeStatus:j.activeTab,appliedSearch:j.filters.search,appliedSort:j.sort,nextCursor:j.nextCursor,subscriptionListFetchState:j.fetchState,runningActionSubscriptionId:j.runningActionId??null,subscriptions:j.subscriptions}}),Q),b=h==="Completed";r.useEffect((()=>{const C=setTimeout((()=>u(a)),300);return()=>clearTimeout(C)}),[a]),r.useEffect((()=>{i&&t(Le({cacheOverride:!1}))}),[i,t]),r.useEffect((()=>{i&&(v.search!==f||m?.field!==I?.field||m?.dir!==I?.dir)&&t(Le({cacheOverride:!0,filters:v,sort:m}))}),[i,t,v,m,f,I]);const A=r.useRef(y);return r.useEffect((()=>{const C=A.current!=null&&y==null;A.current=y,C&&i&&t(ao())}),[y,i,t]),N(h)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSubscriptionsListPage,isReady:b}),c.jsx(Na,{navigate:e,tenantEmailDomain:n,activeStatus:p,searchValue:a,sortState:d,filters:v,sort:m,nextCursor:E,runningActionSubscriptionId:y,subscriptions:D,onSearchChange:o,onStatusChange:C=>{t(co(C)),t(Le({cacheOverride:!1,filters:v,sort:m}))},onSortChange:S})]})}const Ba=T((function(t,e){const{readView:n}=e;return{isLoading:n.fetchState==="Not-Started"||n.fetchState==="In-Progress",isRunningAction:n.actionState.fetchState==="In-Progress",transaction:n.transaction,transactionId:e.transactionId}}),(function(t,e){const n=`/${e.tenantEmailDomain}/invoicing`,{transactionId:i}=e;return{onBack:()=>e.navigate(`${n}/payments`),onCustomerClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{customerId:a,fromScreen:"transaction_detail",toScreen:"customer"}),e.navigate(`${n}/customers/${encodeURIComponent(a)}`)},onInvoiceClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",invoiceId:a,toScreen:"invoice"}),e.navigate(`${n}/invoices/${encodeURIComponent(a)}`)},onSubscriptionClick:a=>{g.trackInvoicingActionClick(l.Event.invoicingEntityLinkClicked,{fromScreen:"transaction_detail",subscriptionId:a,toScreen:"subscription"}),e.navigate(`${n}/subscriptions/${encodeURIComponent(a)}`)},onCapture:i!==""?()=>{g.trackInvoicingActionClick(l.Event.invoicingTransactionCaptured,{transactionId:i}),t(uo({action:"capture",id:i}))}:void 0}}))(Vt);function Va(){const t=L(),e=P(),{tenantEmailDomain:n,transaction_id:i}=w(),{areTenantIdsInSync:a}=F(),o=k((u=>ro(u,i??""))),s=o.fetchState==="Completed";return r.useEffect((()=>{a&&i!=null&&t(lo({id:i}))}),[a,i,t]),N(o.fetchState)?c.jsx(M,{}):c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingTransactionDetailPage,isReady:s}),c.jsx(Ba,{navigate:e,tenantEmailDomain:n,transactionId:i??"",readView:o})]})}function et(t={}){const{enabled:e=!0,fetchSyncHealth:n=!1,loadAccountingPickers:i=!1,reuseCached:a=!1}=t,o=L(),{areTenantIdsInSync:s}=F(),u=k(Ke),d=u.connection?.connected===!0,S=u.connectionFetchState.fetchState;return r.useEffect((()=>{e&&s&&(a&&S!=="Not-Started"||o(qn()),n&&o(go()))}),[s,o,e,n,a]),r.useEffect((()=>{e&&s&&d&&i&&o(mo())}),[s,o,e,d,i]),{isQboConnected:d,qboView:u}}const Ha={branding:"invoicing_branding_save",dunning:"invoicing_dunning_settings_save",quickbooks:"invoicing_qbo_settings_save"};function te(t){const e=L(),{areTenantIdsInSync:n}=F(),{tenantEmailDomain:i}=w(),{fetchState:a,fieldHelp:o,logoFile:s,saveState:u,settings:d,stripeConnectState:S}=k(vo),{configError:m,configFetchState:v,dunningScheduleActionOptions:p,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E}=k(Qn),h=k(Ke);et({enabled:t==="quickbooks",fetchSyncHealth:!0,loadAccountingPickers:!0});const y=k(he),D=t==="dunning"||t==="quickbooks",b=y.companyId??J.getSignedInUserTenant(i??"")?.companyId,A=k((_=>An(_,b))),C=po(y.userRole??[]),j=y.tenantId??"",R=J.getSignedInUser(),U={userId:R?.userId??"",sessionId:R?.zeniSessionId??"",tenantId:j},O=s?.fileId,ie=k((_=>O!=null&&O!==""?So(_,O):void 0)),Ge=k((_=>O!=null&&O!==""?fo(_,O):void 0)),nt=O!=null&&O!==""&&ie!=null?{[O]:ie}:{},tt=O!=null&&O!==""&&Ge!=null?{[O]:Ge}:{};r.useEffect((()=>(e(an()),()=>{e(an())})),[e]),r.useEffect((()=>{n&&(a!=="Not-Started"&&a!=="Error"||e(Qe()))}),[n,e,a]),r.useEffect((()=>{n&&D&&v==="Not-Started"&&e(pe())}),[n,e,v,D]),r.useEffect((()=>{if(!n)return;const _=R?.userId;_!=null&&_!==""&&j!==""&&Je.shouldFetchActiveTenant(j)&&(Je.markActiveTenantFetchStarted(j),e(Io(_,j,R?.zeniSessionId)))}),[n,e,R?.userId,R?.zeniSessionId,j]);const it=p.length>0||f.length>0,ot=a==="Not-Started"||a==="In-Progress"&&d==null||D&&!it&&(v==="Not-Started"||v==="In-Progress"),at=a==="Completed"&&(!D||v==="Completed"),We=A.externalConnections?.revenue?.find((_=>_.connectionName==="chargebee"))?.connectionId,Ee=de?.invoicingMicroServiceBaseUrl,Ye=Ee!=null&&Ee.length>0?`${Ee}/1.0/webhooks/stripe`:"",K={deleteConnectionError:A.externalConnections?.deleteConnectionError?.message,deleteConnectionState:A.externalConnections?.deleteConnectionState??"Not-Started",integrationsView:A,isAdmin:C,isStripeBusy:S.fetchState==="In-Progress",onConnectStripe:_=>{g.trackInvoicingActionClick(l.Event.invoicingStripeConnectClicked,{fromScreen:t??"hub"}),e(Do(_))},onDisconnect:(_,V)=>{j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingIntegrationDisconnected,{entity:V,entityId:_,fromScreen:t??"hub"}),e(Ao(j,_,cn(V))))},onDisconnectStripe:()=>{g.trackInvoicingActionClick(l.Event.invoicingStripeDisconnected,{fromScreen:t??"hub"}),e(xo())},onReconnectQBO:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:t??"hub"});const _=y.tenantEmailDomain??i??"";Se.init("/connection/auth",_),Se.handleClick()},onRefreshQBO:()=>{A.integrations.refreshQBO.fetchState!=="In-Progress"&&(g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:t??"hub"}),e(Gn()))},onSaveChargeBeeCredentials:(_,V)=>{We!=null&&j!==""&&(g.trackInvoicingActionClick(l.Event.invoicingChargebeeCredentialsSaved,{fromScreen:t??"hub"}),e(yo(j,We,cn("revenue"),bo("chargebee"),{api_key:_,site:V})))},saveChargeBeeError:A.externalConnections?.saveAPIKeyConnectionError?.message,saveChargeBeeState:A.externalConnections?.saveAPIKeyConnectionState??"Not-Started",settings:d,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ye};return{authParams:U,deleteFileStatusById:nt,fieldHelp:o,dunningScheduleActionOptions:p,filesEndPoint:de?.fileMicroServiceBaseUrl??"",integrationsSectionProps:K,isInvoicingPageReady:at,isLoading:ot,isSaving:u.fetchState==="In-Progress",isStripeBusy:S.fetchState==="In-Progress",logoFile:s,qboAccountMappingKindOptions:f,qboCustomerMatchingOptions:I,qboSyncStatusOptions:E,qboView:h,saveErrorMessage:u.fetchState==="Error"?u.error?.message??"Failed to save settings.":D&&v==="Error"?m?.message??"Failed to load invoicing configuration.":void 0,settings:d,stripeError:S.fetchState==="Error"?S.error?.message??"Failed to connect Stripe. Check your keys and try again.":void 0,stripeWebhookUrl:Ye,updateFileStatusById:tt,onConnectStripe:K.onConnectStripe,onDeleteFile:_=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRemoved,{fromScreen:t??"hub"}),e(Eo(_,j))},onDisconnectStripe:K.onDisconnectStripe,onEditFileName:(_,V)=>{g.trackInvoicingActionClick(l.Event.invoicingLogoRenamed,{fromScreen:t??"hub"}),e(ko(_,V.split(".")[0],j))},onReconnectQBO:K.onReconnectQBO,onRefreshQBO:K.onRefreshQBO,onRetryQboSyncTask:_=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:_,fromScreen:t??"hub"}),e(Kn(_))},onSave:_=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:Object.keys(_).filter((V=>JSON.stringify(_[V])!==JSON.stringify(d?.[V]))),tab:t??"hub"}),e(Co({settings:_,snackbarSection:Ha[t??""]}))},onStartQboBackfill:_=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:t??"hub"}),e(zn(_))},updateFilesEntity:_=>{g.trackInvoicingActionClick(l.Event.invoicingLogoUploaded,{fromScreen:t??"hub"}),e(ho({files:_}))}}}function dn({appContent:t}){const e=P(),n=X(),i=L(),{tenantEmailDomain:a}=w(),o=te("branding"),s=k((d=>jo(d)));r.useEffect((()=>{s.saveState.fetchState==="Completed"&&i(Lo())}),[s.saveState.fetchState,i]);const u=Me(s.saveState.fetchState);return r.useEffect((()=>{u==="In-Progress"&&s.saveState.fetchState==="Completed"&&e("..")}),[u,s.saveState.fetchState,e]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingBrandingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Ht,{address:s.address,fieldHelp:s.fieldHelp,addressLabel:s.addressLabel,appContent:t,authParams:o.authParams,dateFormatOptions:s.dateFormatOptions,deleteFileStatusById:o.deleteFileStatusById,filesEndPoint:o.filesEndPoint,isLoading:o.isLoading,isSaving:o.isSaving,localData:s.localData,logoFile:o.logoFile,saveErrorMessage:o.saveErrorMessage,settings:o.settings,updateFileStatusById:o.updateFileStatusById,onBackClick:()=>e(".."),onChange:d=>{i($o({localData:d}))},onDeleteFile:o.onDeleteFile,onEditFileName:o.onEditFileName,onOpenAddress:()=>{g.trackInvoicingActionClick(l.Event.invoicingAddressOpened,{entity:"branding",fromScreen:"settings_branding"});const d=`/${a}/invoicing/settings/branding/${_o}/`,S=ee(n.state?.pathnameStackToGoBack,n.pathname);e(d,{state:{pathnameStackToGoBack:S}})},onSubmit:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{tab:"branding"}),i(Po())},updateFilesEntity:o.updateFilesEntity})]})}function qa(){const t=P(),e=te("dunning");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingDunningSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(qt,{dunningScheduleActionOptions:e.dunningScheduleActionOptions,isLoading:e.isLoading,isSaving:e.isSaving,saveErrorMessage:e.saveErrorMessage,settings:e.settings,onBackClick:()=>t(".."),onSave:e.onSave})]})}function Qa(){const t=P(),e=te("integrations");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingIntegrationsSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(Qt,{integrationsSectionProps:{...e.integrationsSectionProps,onConfigureQBO:()=>t("../quickbooks"),onOpenPaymentDestination:()=>t("../payment-destination")},isLoading:e.isLoading,onBackClick:()=>t("..")})]})}function za(){const t=P(),e=te("payment-destination");return c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingPaymentDestinationSettingsPage,isReady:e.isInvoicingPageReady}),c.jsx(zt,{fieldHelp:e.fieldHelp,isLoading:e.isLoading,isStripeBusy:e.isStripeBusy,saveErrorMessage:e.saveErrorMessage,settings:e.settings,stripeError:e.stripeError,stripeWebhookUrl:e.stripeWebhookUrl,onBackClick:()=>t(".."),onConnectStripe:e.onConnectStripe})]})}const Ka=["autoCreateItems","closedPeriodVoidAsCreditMemo","customerMatching","isSyncEnabled","syncStartDate","trackingCategoriesEnabled"],Ga=T((function(t){const e=Wn(t);return{accountMappingKindOptions:e.accountMappingKindOptions,fieldHelp:e.fieldHelp,accounts:e.accounts,connection:e.connection,customerMatchingOptions:e.customerMatchingOptions,isBackfilling:e.backfillState.fetchState==="In-Progress",isLoading:e.isLoading,isSaving:e.saveState.fetchState==="In-Progress",isSyncEnabledSaved:e.isSyncEnabledSaved,localData:e.localData,nestedAccountHierarchy:e.nestedAccountHierarchy,retryFetchStateByTaskId:e.retryFetchStateByTaskId,saveErrorMessage:e.saveState.fetchState==="Error"?e.saveState.error?.message:void 0,syncHealth:e.syncHealth,syncStatusOptions:e.syncStatusOptions}}),(function(t){return{onChange:e=>{t(Fo({localData:e}))},onReset:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsReset,{tab:"quickbooks"}),t(Ro())},onRetryTask:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"retry_task",entityId:e,fromScreen:"settings_qbo"}),t(Kn(e))},onStartBackfill:e=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"backfill",fromScreen:"settings_qbo"}),t(zn(e))}}}))(Kt);function Wa(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),i=k(he),{configFetchState:a,localData:o,savedLocalData:s,saveState:u,settingsFetchState:d}=k(Wn),S=r.useMemo((()=>{return v=o,p=s,[...[...new Set([...Object.keys(v.accountIdByMappingCode),...Object.keys(p.accountIdByMappingCode)])].some((f=>(v.accountIdByMappingCode[f]??"")!==(p.accountIdByMappingCode[f]??"")))?["account_mappings"]:[],...Ka.filter((f=>v[f]!==p[f]))];var v,p}),[o,s]),m=Me(u.fetchState);return r.useEffect((()=>{m==="In-Progress"&&u.fetchState==="Completed"&&e("..")}),[e,m,u.fetchState]),r.useEffect((()=>{d!=="Not-Started"&&d!=="Error"||t(Qe())}),[t,d]),r.useEffect((()=>{a==="Not-Started"&&t(pe())}),[a,t]),et({fetchSyncHealth:!0,loadAccountingPickers:!0}),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingQboSettingsPage}),c.jsx(Ga,{onBackClick:()=>e(".."),onReconnect:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"reconnect",fromScreen:"settings_qbo"}),Se.init("/connection/auth",i.tenantEmailDomain??n??""),Se.handleClick()},onRefresh:()=>{g.trackInvoicingActionClick(l.Event.invoicingQboAction,{action:"refresh",fromScreen:"settings_qbo"}),t(Gn())},onSave:()=>{g.trackInvoicingActionClick(l.Event.invoicingSettingsSaved,{fieldsChanged:S,tab:"quickbooks"}),t(wo())}})]})}const Ya={"payment-destination":"payment-destination",general:"branding",integrations:null,dunning:"dunning"};function Ja(){const t=un(),e=L(),n=P(),[i,a]=Z(),o=te(),{canEnableInvoicing:s,isEnablingInvoicing:u,isInvoicingEnabled:d,isQboConfigured:S,isStripeConnected:m}=k(Qn),v=i.get("tab");return r.useEffect((()=>{if(v==null)return;const p=Ya[v];a({},{replace:!0}),p!=null&&n(p,{replace:!0})}),[v,n,a]),c.jsxs(c.Fragment,{children:[c.jsx($,{event:l.Event.invoicingSettingsPage,isReady:o.isInvoicingPageReady}),c.jsx(Gt,{analytics:g,integrationsSectionProps:{...o.integrationsSectionProps,onConfigureQBO:()=>n("quickbooks"),onOpenPaymentDestination:()=>n("payment-destination")},isEnablingInvoicing:u,isLoading:o.isLoading,meetingUrl:t("invoicing_settings"),settings:o.settings,onBrandingClick:()=>n("branding"),onDunningClick:()=>n("dunning"),canEnableInvoicing:s,isQboConfigured:S,isStripePaymentsReady:m,onEnableInvoicingClick:d?void 0:()=>{g.trackInvoicingActionClick(l.Event.invoicingEnableClicked),e(Oo())}})]})}function ln(){return c.jsxs(ce,{children:[c.jsx(x,{index:!0,element:c.jsx(Ja,{})}),c.jsx(x,{path:"payment-destination",element:c.jsx(za,{})}),c.jsx(x,{path:"branding",element:c.jsx(dn,{})}),c.jsx(x,{path:"branding/:addressType",element:c.jsx(dn,{appContent:c.jsx(G,{isSubPage:!0,hideAddressBackButton:!0})})}),c.jsx(x,{path:"integrations",element:c.jsx(Qa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(qa,{})}),c.jsx(x,{path:"quickbooks",element:c.jsx(Wa,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:"..",replace:!0})})]})}function xc(){const t=L(),e=P(),{tenantEmailDomain:n}=w(),{areTenantIdsInSync:i}=F(),{enableState:a,fetchState:o,status:s}=k(wn),u=Me(a.fetchState),d=`/${n}/invoicing`,S=r.useRef(!1),m=k((v=>Ke(v).connectionFetchState.fetchState));return r.useEffect((()=>{i&&(o!=="Not-Started"?o!=="Error"||S.current||(S.current=!0,t(pe({cacheOverride:!1}))):t(pe({cacheOverride:!1})))}),[i,t,o]),r.useEffect((()=>{i&&m==="Not-Started"&&t(qn())}),[i,t,m]),r.useEffect((()=>{u==="In-Progress"&&a.fetchState==="Completed"&&(e(`${d}/catalog`),t(To()))}),[u,a.fetchState,d,t,e]),s==null&&o!=="Error"?c.jsx(Wt,{fetchState:"In-Progress"}):s==="not_started"?c.jsxs(ce,{children:[c.jsx(x,{path:"promo",element:c.jsx(sn,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/promo`,replace:!0})})]}):s==="settings"?c.jsxs(ce,{children:[c.jsx(x,{path:"promo",element:c.jsx(sn,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(ln,{})}),c.jsx(x,{path:"*",element:c.jsx(H,{to:`${d}/settings`,replace:!0})})]}):c.jsxs(ce,{children:[c.jsx(x,{path:"/",element:c.jsx(H,{to:"overview",replace:!0})}),c.jsx(x,{path:"overview",element:c.jsx(_a,{})}),c.jsx(x,{path:"promo",element:c.jsx(H,{to:`${d}/overview`,replace:!0})}),c.jsx(x,{path:"customers",element:c.jsx(da,{})}),c.jsx(x,{path:"customers/new",element:c.jsx(sa,{})}),c.jsx(x,{path:"customers/new/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"customers/:customer_id",element:c.jsx(aa,{})}),c.jsx(x,{path:"customers/:customer_id/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"subscriptions",element:c.jsx(Ua,{})}),c.jsx(x,{path:"subscriptions/new",element:c.jsx(Ma,{})}),c.jsx(x,{path:"subscriptions/new/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"subscriptions/:subscription_id",element:c.jsx(Oa,{})}),c.jsx(x,{path:"subscriptions/:subscription_id/:addressType",element:c.jsx(G,{})}),c.jsx(x,{path:"invoices",element:c.jsx(Da,{})}),c.jsx(x,{path:"invoices/create",element:c.jsx(Xo,{})}),c.jsx(x,{path:"invoices/:invoice_id",element:c.jsx(xa,{})}),c.jsx(x,{path:"invoices/:invoice_id/record-payment",element:c.jsx(rn,{})}),c.jsx(x,{path:"invoices/:invoice_id/issue-credit-note",element:c.jsx(La,{})}),c.jsx(x,{path:"payments",element:c.jsx(wa,{})}),c.jsx(x,{path:"payments/record",element:c.jsx(rn,{})}),c.jsx(x,{path:"payments/:transaction_id",element:c.jsx(Va,{})}),c.jsx(x,{path:"credits",element:c.jsx(ia,{})}),c.jsx(x,{path:"credits/:credit_note_id",element:c.jsx(na,{})}),c.jsx(x,{path:"discounts",element:c.jsx(ha,{})}),c.jsx(x,{path:"discounts/new",element:c.jsx(Jo,{})}),c.jsx(x,{path:"discounts/:coupon_id",element:c.jsx(fa,{})}),c.jsx(x,{path:"dunning",element:c.jsx(ya,{})}),c.jsx(x,{path:"dunning/:case_id",element:c.jsx(ka,{})}),c.jsx(x,{path:"catalog",element:c.jsx(Wo,{})}),c.jsx(x,{path:"catalog/new",element:c.jsx(zo,{})}),c.jsx(x,{path:"catalog/:item_id",element:c.jsx(Vo,{})}),c.jsx(x,{path:"settings/*",element:c.jsx(ln,{})}),c.jsx(x,{path:"audit_log",element:c.jsx(No,{})}),c.jsx(x,{path:"data_import",element:c.jsx(ma,{})}),c.jsx(x,{path:"data_import/migrate",element:c.jsx(pa,{})}),c.jsx(x,{path:"data_import/:sessionId",element:c.jsx(ua,{})}),c.jsx(x,{path:"*",element:c.jsx(M,{})})]})}export{xc as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./liveblocks-
|
|
1
|
+
import{j as a}from"./liveblocks-DcDE-V-o.js";import{i as S,l as g,h as C,g as y,u as ee,t as ae,j as L,N as te,n as ne,o as p}from"./core-D4EC26kf.js";import{UV as k,UW as j,UX as T,JS as D,JE as U,UY as A,UZ as oe,U_ as ie,JI as se,gl as $,JP as le,JM as re}from"./zeni-epic-state-Bl3gAQPi.js";import{$ as x,E as r,a0 as de,j as v,T as M,a1 as ce,a2 as me,a3 as pe,p as G,W as ue,A as he,a4 as ge,e as xe,f as fe,a5 as be,a6 as we,Y as Se,a7 as ye,a8 as ke,a9 as je,aa as ve}from"./index-Ch-ATQTq.js";import{n as m,u as $e}from"./mui-BCH_ILdb.js";import f from"./NotFoundScreen-0hF8kIyY.js";import{a as I}from"./sentry-DB4rU-NW.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.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]="6bf93135-a9c2-4dad-895e-8b7073f2b01b",e._sentryDebugIdIdentifier="sentry-dbid-6bf93135-a9c2-4dad-895e-8b7073f2b01b")}catch{}})();const Ie=m.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
height: 100%;
|
|
4
4
|
width: 100%;
|
|
@@ -7,7 +7,7 @@ import{j as a}from"./liveblocks-B8NMVuJ_.js";import{i as S,l as g,h as C,g as y,
|
|
|
7
7
|
align-items: center;
|
|
8
8
|
background-color: ${e=>e.theme.colors.grey4};
|
|
9
9
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
10
|
-
`,Ce=g((function(e){const t=k(e),n=
|
|
10
|
+
`,Ce=g((function(e){const t=k(e),n=j(e),{companyName:o}=t;return{companyName:o,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,magicLinkViewState:t}}),(function(e,t){const{vendorId:n,billId:o}=t;return{onFetchBankName:i=>{e(U(i))},onSaveHandler:i=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(o),e(D(i,"standard",n,o))},onACHDetailsUpdated:i=>{const{bankAccountSection:l}=i;e(T({data:l}))}}}))(de);function F(){const e=x(),{vendorId:t,billId:n}=S();return t==null||n==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Ie,{windowSize:e,children:a.jsx(Ce,{vendorId:t,billId:n})})})}const De=m.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
height: 100vh;
|
|
13
13
|
width: 100%;
|
|
@@ -25,7 +25,7 @@ import{j as a}from"./liveblocks-B8NMVuJ_.js";import{i as S,l as g,h as C,g as y,
|
|
|
25
25
|
align-items: center;
|
|
26
26
|
background-color: ${e=>e.theme.colors.grey4};
|
|
27
27
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
28
|
-
`,Ne=g((function(e){const t=k(e),n=
|
|
28
|
+
`,Ne=g((function(e){const t=k(e),n=j(e),o=A(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankName:s=>{e(U(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"us-domestic",i,l))},onWireDetailsUpdated:s=>{const{bankAccountSection:d}=s;e(T({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("us-domestic","address"),d=G(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(pe);function Le(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S();return o==null||i==null?a.jsx(f,{}):a.jsx(a.Fragment,{children:a.jsx(Ee,{windowSize:n,children:a.jsx(Ne,{location:t,navigate:e,vendorId:o,billId:i})})})}const Fe=m.div`
|
|
29
29
|
display: flex;
|
|
30
30
|
height: 100%;
|
|
31
31
|
width: 100%;
|
|
@@ -34,7 +34,7 @@ import{j as a}from"./liveblocks-B8NMVuJ_.js";import{i as S,l as g,h as C,g as y,
|
|
|
34
34
|
align-items: center;
|
|
35
35
|
background-color: ${e=>e.theme.colors.grey4};
|
|
36
36
|
box-shadow: ${e=>`0px 2px ${r.sp1} ${e.theme.colors.dropShadowNormal}`};
|
|
37
|
-
`,Te=g((function(e){const t=k(e),n=
|
|
37
|
+
`,Te=g((function(e){const t=k(e),n=j(e),o=A(e),{companyName:i}=t;return{companyName:i,isDisabled:t.fetchState!=="Completed"?"disabled":void 0,magicLinkBankAccountDetails:n,mailingAddressDetails:o,magicLinkViewState:t}}),(function(e,t){const{navigate:n,location:o,vendorId:i,billId:l}=t;return{onFetchBankNameBySwift:s=>{e(se(s))},onSaveHandler:s=>{v.trackBillPayMagicLinkSubmitBankAccountDetails(l),e(D(s,"international",i,l,t.isLocalCurrencyEnabled))},onBankDetailsUpdated:s=>{const{internationalWireSwiftAccountSection:d}=s;e(ie({data:d}))},onAddressClick:()=>{const s=o.pathname.replace("international","address"),d=G(o.state?.pathnameStackToGoBack,o.pathname);n(s,{state:{pathnameStackToGoBack:d}})}}}))(ge);function Ue(){const e=C(),t=y(),n=x(),{vendorId:o,billId:i}=S(),{useFeatureGate:l}=ue(),{isFeatureEnabled:s}=l(he.isBillPayLocalCurrencyFeatureEnabled);return o==null||i==null?a.jsx(f,{}):a.jsx(Fe,{windowSize:n,children:a.jsx(Te,{location:t,navigate:e,vendorId:o,billId:i,isLocalCurrencyEnabled:s})})}const Me={containerWidth:new je(100,58)},Ge=m(ye)`
|
|
38
38
|
width: ${r.sp4};
|
|
39
39
|
height: ${r.sp4};
|
|
40
40
|
margin-bottom: ${r.sp3};
|
|
@@ -69,4 +69,4 @@ import{j as a}from"./liveblocks-B8NMVuJ_.js";import{i as S,l as g,h as C,g as y,
|
|
|
69
69
|
width: ${e=>e.windowSize=="small"?"auto":"42%"};
|
|
70
70
|
background-color: ${e=>e.windowSize==="small"?e.theme.colors.grey4:e.theme.colors.background};
|
|
71
71
|
margin-top: ${e=>e.windowSize==="small"?e.isAddressPage?"0px":"186px":"unset"};
|
|
72
|
-
`,He=g((function(e,t){return{file:t.file,type:t.type}}))(ke);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),J=n.pathname.includes("address"),b=x(),V=xe(),B=$e(),w=fe(),W=()=>{V.toggle()},H=L((u=>k(u))),_=L((u=>
|
|
72
|
+
`,He=g((function(e,t){return{file:t.file,type:t.type}}))(ke);function h({appContent:e}){const t=ee(),n=y(),{tenantEmailDomain:o,vendorId:i,billId:l}=S(),[s]=ae(),d=s.get("token"),J=n.pathname.includes("address"),b=x(),V=xe(),B=$e(),w=fe(),W=()=>{V.toggle()},H=L((u=>k(u))),_=L((u=>j(u))),{authParams:K,fetchState:c,billAttachment:O,billFetchState:P,companyName:X,currencySymbol:Y,amount:Z}=H,{tenantId:z,userId:E,sessionId:N}=K,{fetchState:q,internationalBankAccountCreateStatus:Q}=_;return I.useEffect((()=>{$()}),[]),I.useEffect((()=>{w&&c==="Not-Started"&&i!=null&&o!=null&&d!=null&&t(le(i,o,d))}),[w,c,i,o,d,t]),I.useEffect((()=>{w&&c==="Completed"&&($(E,N,z),l!=null&&t(re(l)))}),[c,w,E,N,z,l,t]),c==="Error"?a.jsx(f,{}):q==="Completed"||Q.fetchState==="Completed"?($(),a.jsx(te,{to:"../../../../../../../bank/account/save/success",replace:!0,relative:"path"})):c==="In-Progress"?a.jsx(be,{fetchState:c,style:{height:"100vh",backgroundColor:B.colors.grey5,boxShadow:`0px 2px ${r.sp1} ${B.colors.dropShadowNormal}`}}):a.jsxs(a.Fragment,{children:[c==="Completed"&&P==="Completed"&&a.jsx(we,{analytics:v,onLoad:u=>(R=>R.trackBillPayMagicLinkPageLoad(o??"",i??"",X,l??"",_e(n.pathname),Y,Z))(u)}),a.jsxs(Je,{windowSize:b,children:[b!=="small"?a.jsx(Ge,{onClick:W}):null,a.jsx(We,{windowSize:b,isAddressPage:J,children:P==="In-Progress"?a.jsx(Se,{size:"ExtraLarge",start:!0}):a.jsx(He,{file:O,type:"bill"})}),a.jsx(Ve,{windowSize:b,children:e})]})]})}const _e=e=>`${e.split("/").at(-2)}_${e.split("/").at(-1)}`;function Ke(){return a.jsx(ve,{})}function da(){return a.jsxs(ne,{children:[a.jsx(p,{path:"bank/account/save/success",element:a.jsx(Ke,{})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/standard",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/ach/same-day",element:a.jsx(h,{appContent:a.jsx(F,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/address",element:a.jsx(h,{appContent:a.jsx(Be,{isSubPage:!0})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/us-domestic",element:a.jsx(h,{appContent:a.jsx(Le,{})})}),a.jsx(p,{path:":tenantEmailDomain/vendor/:vendorId/bill/:billId/wire/international",element:a.jsx(h,{appContent:a.jsx(Ue,{})})}),a.jsx(p,{path:"*",element:a.jsx(f,{})})]})}export{da as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{j as u}from"./liveblocks-DcDE-V-o.js";import{a as f}from"./sentry-DB4rU-NW.js";import{u as O,g as _,h as w,t as M,j as l,N as L}from"./core-D4EC26kf.js";import{z as r,G as N,M as P,j as V,N as A,U as R,Y,R as G}from"./index-Ch-ATQTq.js";import{fI as W,Uo as $,UR as q,UI as B,gl as H,gn as J,UN as K,gY as Q,dk as X,US as Z,UT as ee}from"./zeni-epic-state-Bl3gAQPi.js";import{u as te,n as ne}from"./mui-BCH_ILdb.js";import{u as se}from"./useDeviceId-Dy35NfBh.js";import{f as ie}from"./analyticsHelper-nRPDDcpi.js";import{t as ae}from"./getLocaleForTenant-B07LkoV2.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.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]="868f5148-877f-4ff0-8359-3ee96ed3e864",t._sentryDebugIdIdentifier="sentry-dbid-868f5148-877f-4ff0-8359-3ee96ed3e864")}catch{}})();const T=(t,i)=>t!=null&&t.length>0&&i==="magic_links";function Te(){const t=O(),i=_(),m=w(),[y]=M(),n=y.get("token"),p=y.get("stytch_token_type"),g=r.getMagicLinkCodeVerifier(),a=se(),{otpChallenge:d,twoFAPhoneNumber:C,magicLinkEmail:c,verifyDeviceFetchState:x,resendVerifyDeviceOTPFetchState:z}=l((e=>e.tenantState)),S=l((e=>e.tenantState.fetchState)),b=l((e=>e.tenantState.activeTenantFetchState.fetchState)),I=l((e=>e.tenantState.signInState)),h=l((e=>e.tenantState.magicLinkSignInFetchState.fetchState)),s=l((e=>e.tenantState.loggedInUser)),o=l((e=>W(e))),k=l((e=>$(e))),D=r.getSignedInUser(),v=te().mode;f.useEffect((()=>{s?.zeniSessionId==null&&n!=null&&T(n,p)&&a!=null&&g!=null&&(r.saveMagicLinkTriggered(n),t(q(n,a,g)))}),[n,p,t,a,g,s?.zeniSessionId]),f.useEffect((()=>{I!=="In-Progress"||S!=="Completed"&&b!=="Completed"||s?.zeniSessionId==null||o==null||(n!=null&&r.saveLastUsedMagicLinkToken(n),r.saveSignedInUserWithSession(s,s.zeniSessionId),r.saveSignedInUserTenants(B(k.tenantsInOrder),s.zeniSessionId),H(s.userId,s.zeniSessionId,o.tenantId),t(J(o.tenantId)),r.saveActiveTenantDomainForUser(o.tenantEmailDomain),t(K("Completed")),N.updateAppLocaleID(ae(o)),ie(s,o,v,void 0,k.tenantsInOrder),Q().then((()=>{const e=G();e!=null&&P(e)})),setTimeout((()=>{V.trackLogin(A.Event.loginSuccess,"email",X(o.productSettings))}),2e3))}),[I,S,b,s,o,k,v,i.state,t]);const E=f.useCallback((()=>{m("/signin/auth")}),[m]),j=f.useCallback((()=>{a!=null&&d!=null&&c!=null&&t(Z(a,c,d))}),[a,d,t,c]),F=f.useCallback((e=>{a!=null&&n!=null&&c!=null&&d!=null&&t(ee(e,a,c,d))}),[a,n,t,c,d]);if(h==="Completed"&&d!=null)return u.jsx(R,{phoneNumber:C,verifyOtpFetchState:x.fetchState,resendVerifyDeviceOTPFetchState:z,onResendOtp:j,onVerifyOtp:F,onCancelVerifyDevice:E});if(I==="In-Progress"&&S==="Completed"&&s?.zeniSessionId!=null&&o!=null||D!=null){const e=i.state?.origin??"/";return u.jsx(L,{to:e,state:{...i.state,origin:""}})}if(!T(n,p)||g==null||h==="Error"){const e=i.state?.origin??"/",U=n!=null&&r.getLastUsedMagicLinkToken()===n;return u.jsx(L,{to:e,state:{...i.state,origin:"",magicLinkAlreadyUsed:U,magicLinkExpired:!U&&(r.isMagicLinkTriggered(n??"")||h==="Error"&&s?.zeniSessionId==null)}})}return u.jsx(oe,{"data-testid":"smooth-loader",children:u.jsx(Y,{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{Te as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as B}from"./liveblocks-
|
|
1
|
+
import{j as B}from"./liveblocks-DcDE-V-o.js";import{a as m}from"./sentry-DB4rU-NW.js";import{u as te,j as t,i as $e,g as Ge,h as Ue,q as F}from"./core-D4EC26kf.js";import{fI as ne,Up as Me,Uq as se,gc as xe,fH as Ne,Uz as Pe,Us as Re,Ut as Ve,q3 as je,gp as Le,Uw as h,UB as Oe,UC as K,gq as qe,UD as ze,Ev as Ze,h5 as He,cW as We,UE as Ye,gb as Xe,gr as Je}from"./zeni-epic-state-Bl3gAQPi.js";import{w as Ke,i as Qe,e as ea,W as aa,c as ta,f as na,u as sa,A as c,g as oa,X as ia,z as ra,d as da,k as ca,q as la,o as ua,l as ma,n as Q,L as fa,C as ba,D as ha,p as S,j as ee,v as pa,F as ae,y as ga,B as Sa}from"./index-Ch-ATQTq.js";import{D as Ea}from"./mui-BCH_ILdb.js";import{u as ka}from"./InboxNotificationsProvider-DPgK9Ai7.js";import{u as Ca}from"./useTaskManagerAccess-CX5toJpg.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},i=new l.Error().stack;i&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[i]="9c0ab9dd-4c2b-44e5-aa66-0c1b41b4f47a",l._sentryDebugIdIdentifier="sentry-dbid-9c0ab9dd-4c2b-44e5-aa66-0c1b41b4f47a")}catch{}})();const Ta=Ke((({isAppContentDrawerOpen:l,handleDrawerToggle:i})=>{const{tenantEmailDomain:s}=$e(),a=Ge(),E=ea(),n=Ue(),D=xe(),r=te(),{useFeatureGate:d}=aa(),p=ta(),{isTaskManagerAccessEnabled:k}=Ca(p),o=t((e=>ne(e))),oe=o.masterTOSInfo?.isMasterTOSAccepted??!1,$=t((e=>Ne(e))),{status:ie}=t(Pe),G=$.uiState.currentChatSessionId,C=na(),{setLoading:re}=sa(),[w,U]=m.useState(void 0),v=F("/:tenantEmailDomain/dashboard")!==null,M=F("/:tenantEmailDomain/reports")!==null,f=F("/:tenantEmailDomain/onboarding/*")!==null,de=!!o.company?.companyZeniAccountInfo?.isZeniAccountEnabled,{isFeatureEnabled:ce}=d(c.isChargeCardFeatureEnabled),{isFeatureEnabled:x}=d(c.isDebitCardFeatureEnabled),le=oa(o,ce,x),{isFeatureEnabled:ue}=d(c.isSettingsFeatureEnabled),N=t((e=>Re(e))),{isFeatureEnabled:T}=d(c.isReferralFeatureEnabled),A=t((e=>Ve(e)));m.useEffect((()=>{C&&T&&!f&&A.fetchState==="Not-Started"&&r(je(!0))}),[C,T,A.fetchState,f]);const _=t((e=>e.tenantState)),me=t((e=>_.fetchState==="Completed"?Le(e):[])),g=t((e=>e.expenseAutomationViewState.selectedPeriodByTenantId)),{isFeatureEnabled:fe}=d(c.isApAgingFeatureEnabled),{isFeatureEnabled:be}=d(c.isArAgingFeatureEnabled),P=ia(),{isFeatureEnabled:he}=d(c.isDashboardSidebarHalloweenAnimationEnabled),{isFeatureEnabled:pe}=d(c.isDashboardSidebarThanksGivingAnimationEnabled),{isFeatureEnabled:ge}=d(c.isDashboardSidebarChristmasAnimationEnabled),{isFeatureEnabled:Se}=d(c.isDashboardSidebarNewYearAnimationEnabled),Ee=o.companyTreasuryInfo?.info?.businessVerificationStatus?.code==="verified",ke=t((e=>h(e).totalUnreadCount)),Ce=t((e=>h(e).reducedFetchCountState)),R=t((e=>h(e).notificationDetailsByTab.tasks.uiState.unreadCount)),V=t((e=>h(e).notificationDetailsByTab.comments.uiState.unreadCount)),j=t((e=>h(e).notificationDetailsByTab.tasks.fetchCountState)),I=t((e=>h(e).notificationDetailsByTab.comments.fetchCountState)),{inboxNotifications:L,isLoading:O,isFetchingMore:q,hasFetchedAll:z,fetchMore:Te}=ka();m.useEffect((()=>{const e=setTimeout((()=>Te?.()),0);return()=>clearTimeout(e)})),m.useEffect((()=>{if(O===!1&&q===!1&&z===!0)if(o?.companyId!=null&&L!=null){const e=`dashboard_${o.companyId}`;U(L.filter((u=>u.roomId===e&&u.readAt==null)).length)}else U(0)}),[O,q,z]),m.useEffect((()=>{C&&k&&!f&&j.fetchState==="Not-Started"&&D.tenantId!=null&&r(Oe("task_manager","dashboard"))}),[C,k,f,j.fetchState,D.tenantId,r]),m.useEffect((()=>{f||I.fetchState!=="Not-Started"||r(K({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[f,I.fetchState,r]),m.useEffect((()=>{w!=null&&I.fetchState==="In-Progress"&&(r(K({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),r(se({unreadCount:w},"comments")))}),[w,I.fetchState]);const Ie={fetchStatus:Ce,count:ke},Z=s!=null?ra.getSignedInUserTenant(s):null,H=t((e=>Z?.tenantId!=null?qe(e,Z.tenantId):void 0)),b=[];fe===!1&&b.push("accounts_payable_aging"),be===!1&&b.push("accounts_receivable_aging"),b.push("zeni_accounts_promo_card","treasury_promo_card"),T===!1&&b.push("rewards_card"),P===!1&&b.push("expense_automation_card");const W=t((e=>ze(e,b).fetchState)),Y=t((e=>Ze(e).fetchState)),ye=v&&(W==="Completed"||W==="Error")||M&&(Y==="Completed"||Y==="Error")||!v&&!M?void 0:"disabled",we=m.useMemo((()=>He(o.userRole)),[o.userRole]),ve=We(we),Ae=o?.rewardsLastViewedTime==null,_e=p?.userEmail!=null&&N.fetchState==="Completed"&&Ye(N.notificationSettings,p.userEmail,x,o,k),X=da(),Fe=X&&ca(a);return B.jsx(Ea,{container:window.document.body,variant:"temporary",open:l,onClose:()=>i(!1),PaperProps:{sx:{width:240,zIndex:8,borderRight:"none",backgroundImage:"none"}},ModalProps:{keepMounted:!0},children:B.jsx(la,{signedInUser:p,currentTenantId:_.currentTenantId??"",tenants:_.fetchState==="Completed"?me:H!=null?[H]:[],currentTenant:o,isTenantDropdownDisabled:ye,isSettings:Q(a),isInvoicing:ma(a)&&ie==="completed",isSettingsFeatureEnabled:ue,isVendorsTabVisible:ve,isZeniAccountEnabled:de,isChargeCardEnabled:le,isTreasuryEnabled:Ee,isNotificationsTabVisible:_e,notificationCountDetails:Ie,isExpenseAutomationEnabledForUser:P,selectedMenu:ua(a),rewardsConfiguration:{isRewardsTabVisible:T,isRewardsAnimated:Ae,rewardsPlan:A.rewardsPlan},isAiCfoAccessEnabled:X,onNotificationIconClick:()=>{i(!1);let e=R===0&&V>0?"notifications/comments":"notifications/tasks";Q(a)&&(e=R===0&&V>0?"../../notifications/comments":"../../notifications/tasks");const u=S(a.state?.pathnameStackToGoBack,a.pathname);n(e,{state:{pathnameStackToGoBack:u}})},handleCockpitClick:()=>{window.open("/cockpit")},handleLogOutClick:()=>{i(!1);const e=S(a.state?.pathnameStackToGoBack,a.pathname);n("/signout",{replace:!0,state:{pathnameStackToGoBack:e,message:"logout"}})},handleMenuChange:e=>{if(i(!1),s==null)return;if(e.type==="invoicing")return void n(`../${s}/invoicing/overview`,{state:{pathnameStackToGoBack:S(a.state?.pathnameStackToGoBack,a.pathname),referrer:"Sidebar"}});if(e.type==="ai_cfo"){if(ee.trackAICFOChatScreenStateChanged("viewed","left_menu",G??null,null),!oe)return void pa({location:a,navigate:n,mergeState:{referrer:"Sidebar"}});const y=S(a.state?.pathnameStackToGoBack,a.pathname);return void n(`/${s}/ai-cfo/explore`,{state:{pathnameStackToGoBack:y,referrer:"Sidebar"}})}const u=S(a.state?.pathnameStackToGoBack,a.pathname),J=e.type,Be=ae(J)&&J!=="command_center";if(ae(e.type)&&g[o.tenantId]!=null&&ee.trackMonthEndCloseClicked(g[o.tenantId].month,g[o.tenantId].year,"Sidebar"),Be&&g[o.tenantId]!=null){const y=g[o.tenantId];return void n(`/${s}/month_end_close_checks/review/${e.type}/${y.month}-${y.year}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})}const De=ga(e.type);Sa(e.type)?(G!=null&&r(Je()),n(`/${s}/ai-cfo/${e.type}`,{state:{pathnameStackToGoBack:u.slice(0,-1),referrer:"Sidebar"}})):n(`/${s}/${De}`,{state:{pathnameStackToGoBack:u,referrer:"Sidebar"}})},handleMyProfileClick:()=>{i(!1),n(`/${s}/settings/my_profile`)},handleReferralsClick:()=>{i(!1),n(`/${s}/rewards`)},handleBackClick:()=>{n(`/${s}/dashboard`)},handleTenantSelect:e=>{re(fa.TENANT_SWITCHING),i(!1),ba({dispatch:r,navigate:n,pathToNavigate:ha(e.tenantEmailDomain,a),selectedTenant:e,signedInUser:p})},onZeniLogoClick:()=>{E.toggle()},isAiCfo:Fe,aiCfoView:$,isOnDashboard:v,updateCurrentChatSessionId:e=>{r(Xe({sessionId:e,agentId:"controller"})),n(`/${s}/ai-cfo/${e}`,{state:{...a.state}})},halloweenAnimationEnabled:he,isTaskManagerAccessEnabled:k,thanksGivingAnimationEnabled:pe,christmasAnimationEnabled:ge,newYearAnimationEnabled:Se})})})),Da=l=>{const i=te(),s=t((E=>ne(E))),a={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(E,n)=>{Qe(n)&&Me(n.mode)==="dashboard"&&i(se({unreadCount:n.data.unread},"tasks"))}};return B.jsx(Ta,{...l,...a})};export{Da as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./liveblocks-DcDE-V-o.js";import{h as r,l as i}from"./core-D4EC26kf.js";import{ak as n}from"./index-Ch-ATQTq.js";import"./mui-BCH_ILdb.js";import"./sentry-DB4rU-NW.js";import"./zeni-epic-state-Bl3gAQPi.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.js";(function(){try{var o=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new o.Error().stack;t&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[t]="e1fe4b0b-a509-4443-892f-577d1dfd5036",o._sentryDebugIdIdentifier="sentry-dbid-e1fe4b0b-a509-4443-892f-577d1dfd5036")}catch{}})();const a=i(null,(function(o,t){return{onGoBack:()=>{t.navigate(-1)},onGoHome:()=>{t.navigate("/")}}}))(n);function _(){const o=r();return e.jsx(a,{navigate:o})}export{_ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as mt,b as lt,o as ft,j as N}from"./liveblocks-DcDE-V-o.js";import ut from"./NotFoundScreen-0hF8kIyY.js";import{a as k}from"./sentry-DB4rU-NW.js";import{h as ht,g as pt,i as kt,u as gt,j as b,l as bt,n as St,o as K}from"./core-D4EC26kf.js";import{cB as It,Us as Y,fI as z,h5 as Ct,Uw as S,a1s as O,UC as m,Uq as E,AL as F,Gs as Tt,a1t as At,Up as Et,UE as yt,AQ as _t,a1u as $,br as j,gk as x,AU as X,a1v as Nt,cN as Bt,cG as wt}from"./zeni-epic-state-Bl3gAQPi.js";import{ao as xt,c as Ut,W as vt,A as Gt,aq as Dt,dI as Rt,p as B,dJ as Pt,w as Mt,dK as $t,i as jt,a2 as Ft}from"./index-Ch-ATQTq.js";import"./mui-BCH_ILdb.js";import{u as Vt}from"./useAskAiCfoHostNavButtonProps-CBSVhkeG.js";import{u as Lt}from"./useTaskManagerAccess-CX5toJpg.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},l=new t.Error().stack;l&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[l]="6601915d-09b4-4730-b1b9-b1b807748240",t._sentryDebugIdIdentifier="sentry-dbid-6601915d-09b4-4730-b1b9-b1b807748240")}catch{}})();const Wt=(t,l)=>new Promise(((n,h)=>{const g=t.map((c=>new Promise((o=>{l(c),o()}))));Promise.all(g).then((()=>{setTimeout((()=>{n()}),2e3)})).catch((c=>{h(c)}))})),qt=bt((function(t,l){const n=Y(t),{signedInUser:h,isDebitCardFeatureEnabled:g,isTaskManagerAccessEnabled:c}=l,o=S(t),f=z(t),{currentTab:I}=o;return{notificationView:o,isNotificationSettingsVisible:h.userEmail!=null&&yt(n.notificationSettings,h.userEmail,g,f,c),isDisabled:o.notificationDetailsByTab[I].fetchState==="In-Progress"?"disabled":void 0}}),(function(t,l){const{location:n,tenantEmailDomain:h,loggedInUserRoleMap:g,externalNotificationsUnreadCount:c,allUnreadCommentsNotificationIds:o,navigate:f,markInboxNotificationAsRead:I,fetchMoreCommentsNotifications:v}=l;return{onNotificationClick:(a,s,d,r)=>{if(r==="task_deleted"){const i=`/${h}/tasks`,C=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}else{const i=`/${h}/tasks/${s}`,C=B(n.state?.pathnameStackToGoBack,n.pathname);f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}d==="unread"&&t(X("task_manager","read",[a],!1))},onCommentNotificationClick:(a,s,d)=>{const r=s.toString().split(`/${h}/`);if(r[1]!=null){d==="unread"&&(I(a),t($([a],j())));let i=`/${h}/${r[1]}`;const C=B(n.state?.pathnameStackToGoBack,n.pathname);r[1].startsWith("reimbursement")&&!Bt(g)&&(i="not-found"),r[1].startsWith("bill")&&!wt(g)&&(i="not-found"),f(i,{state:{pathnameStackToGoBack:C,message:"triggerBackClick"}})}},onUpdateNotificationViewUIState:(a,s)=>{t(E(a,s))},onUpdateNotificationTabState:(a,s)=>{t(m(a,s))},onUpdateNotificationViewCurrentTabAndSubTab:(a,s)=>{t(O(a,s));const d=`../${a}`,r=B(n.state?.pathnameStackToGoBack,n.pathname);f(d,{state:{pathnameStackToGoBack:r}})},onUpdateNotificationViewSubTab:a=>{t(Nt(a))},onFetchMoreNotifications:(a,s)=>{if(a==="tasks"){const d=[];s==="all"?d.push("read","unread"):s!=="mentions"&&d.push(s),t(F("task_manager","dashboard",d))}else v?.()},onUpdateNotificationStatus:(a,s,d,r)=>{a==="tasks"?t(X("task_manager",d,r)):(t(m({markAsReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Promise.all(r.map((i=>{d==="read"&&(I(i),t($([i],j())))}))).then((()=>{t(m({markAsReadState:{fetchState:"Completed",error:void 0},selectedNotificationIds:[]},"comments")),t(E({unreadCount:c-r.length>0?c-r.length:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))}),(i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})).catch((i=>{t(m({markAsReadState:{fetchState:"Error",error:i}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onMarkAllNotificationsAsRead:a=>{a==="tasks"?t(_t("task_manager","read")):(t(m({markAsAllReadState:{fetchState:"In-Progress",error:void 0}},"comments")),Wt(o,I).then((()=>{t($(o,j())),t(m({markAsAllReadState:{fetchState:"Completed",error:void 0}},"comments")),t(E({unreadCount:0},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"success",type:"success",showStatusIcon:!0}))})).catch((s=>{t(m({markAsAllReadState:{fetchState:"Error",error:s}},"comments")),t(x({messageSection:"notification_mark_as_read",messageText:"failed",type:"error",showStatusIcon:!0}))})))},onBackClick:()=>{const a=Ft(n.state?.pathnameStackToGoBack),s=a.poppedPathname??"../../dashboard";f(s,{state:{pathnameStackToGoBack:a.newStack}})},onSettingsClick:()=>{const a=B(n.state?.pathnameStackToGoBack,n.pathname);f("../../settings/notifications",{state:{pathnameStackToGoBack:a}})}}}))(Mt($t)),Qt=()=>{const t=ht(),l=pt(),{tenantEmailDomain:n,selectedTab:h}=kt(),{areTenantIdsInSync:g}=xt(),c=It(h??""),o=gt(),f=Ut(),[I,v]=k.useState(!1),a=b((e=>Y(e))),s=b((e=>z(e))),{useFeatureGate:d}=vt(),{isFeatureEnabled:r}=d(Gt.isDebitCardFeatureEnabled),{isAiCfoAccessEnabled:i,onAskAiCfoClick:C}=Vt({mobileExploreReferrer:"Notifications"});Dt({isDataReady:!0});const Z=Ct(s.userRole);if(s==null||n==null||s.companyId==null)throw Error("Can't access notifications page without current tenant...");if(f==null)throw Error("Can't access notifications page without signed in...");const V=b((e=>S(e).notificationDetailsByTab.tasks.fetchState)),L=b((e=>S(e).currentTab)),G=b((e=>S(e).currentSubTab)),tt=b((e=>S(e).notificationDetailsByTab.comments.fetchCountState)),D=b((e=>S(e).notificationDetailsByTab.comments.fetchState)),et=b((e=>S(e).notificationDetailsByTab.comments.uiState.unreadCount)),at=b((e=>S(e).allExternalNotifications)).filter((e=>e.inboxNotification.readAt==null)).map((e=>e.inboxNotification.id)),st=Rt().allUsers,{inboxNotifications:w,isLoading:y,hasFetchedAll:T,isFetchingMore:R,fetchMore:ot}=mt(),{threads:W,isLoading:q,fetchMore:Q,isFetchingMore:H,hasFetchedAll:J}=lt({query:{metadata:{companyId:s.companyId,application:"dashboard"}}});k.useEffect((()=>{if(L!==c&&c!=null&&o(O(c)),c==null){const e=`../${L}`,p=B(l.state?.pathnameStackToGoBack,l.pathname);t(e,{state:{pathnameStackToGoBack:p}})}}),[c]),k.useEffect((()=>{tt.fetchState==="Not-Started"&&o(m({fetchCountState:{fetchState:"In-Progress",error:void 0}},"comments"))}),[]),k.useEffect((()=>{if(y===!1&&T===!0&&s?.companyId!=null&&w!=null){const e=`dashboard_${s.companyId}`,p=w.filter((A=>A.roomId===e&&A.readAt==null)).length;o(m({fetchCountState:{fetchState:"Completed",error:void 0}},"comments")),o(E({unreadCount:p},"comments"))}}),[y,T]),k.useEffect((()=>{V!=="In-Progress"&&g&&o(F("task_manager","dashboard",["read","unread"]))}),[g]),k.useEffect((()=>{const e=setTimeout((()=>ot?.()),0);return()=>clearTimeout(e)}));const P=y||R===!0||T!==!0||y||R===!0||T!==!0;k.useEffect((()=>{P&&D!=="In-Progress"?o(m({fetchState:"In-Progress",error:void 0},"comments")):P||D!=="In-Progress"||o(m({fetchState:"Completed",error:void 0},"comments"))}),[P,D]),k.useEffect((()=>{o(E({hasMore:T!==!0},"comments"))}),[T]),k.useEffect((()=>{a.fetchState!=="In-Progress"&&a.fetchState!=="Completed"&&I===!1&&(v(!0),o(Tt()))}),[a.fetchState]),k.useEffect((()=>{if(y===!1&&q===!1&&w!=null&&W!=null){const e=`dashboard_${s.companyId}`,p=w.filter((u=>u.roomId===e)).filter((u=>Pt(u.kind))),A=p.filter((u=>u.readAt==null)),_=p.map((u=>u.id)),ct=p.map((u=>{const M=W.find((dt=>{return dt.id===((U=u).kind==="thread"?U.threadId:"subjectId"in U?U.subjectId:void 0);var U}));return M!=null?{inboxNotification:{...u,threadId:M.id},thread:M}:(H||J===!0||Q==null||Q(),null)})).filter((u=>u!=null));o(m({allNotificationsIds:_},"comments")),o(E({totalCount:_.length,unreadCount:A.length},"comments")),o(At(ct))}}),[y,R,H,T,J,q,w?.length]);const nt={events:s.userRoleId!=null?[`private-encrypted-${s.userRoleId}.dashboard-user-notification`]:[],eventCallback:(e,p)=>{if(jt(p)){const A=Et(p.mode);if(A==="dashboard"&&o(E({unreadCount:p.data.unread},"tasks")),V!=="In-Progress"){const _=[];G==="all"?_.push("read","unread"):G!=="mentions"&&_.push(G),o(F("task_manager",A,_,!0))}}}},it=ft(),{isTaskManagerAccessEnabled:rt}=Lt(f);return N.jsx(qt,{tenantEmailDomain:n,loggedInUserRoleMap:Z,signedInUser:f,externalNotificationsUnreadCount:et,location:l,navigate:t,isDebitCardFeatureEnabled:r,isTaskManagerAccessEnabled:rt,users:st,markInboxNotificationAsRead:it,allUnreadCommentsNotificationIds:at,isAiCfoAccessEnabled:i,onAskAiCfoClick:C,...nt})};function me(){return N.jsxs(St,{children:[N.jsx(K,{path:"/:selectedTab",element:N.jsx(Qt,{})}),N.jsx(K,{path:"*",element:N.jsx(ut,{})})]})}export{me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as m}from"./liveblocks-DcDE-V-o.js";import{a as r}from"./sentry-DB4rU-NW.js";import{u as A,g as j,j as o,N as C}from"./core-D4EC26kf.js";import{V3 as P,fI as V,gp as x,V4 as z,V5 as D,V6 as M,V7 as R,pW as k,TK as L}from"./zeni-epic-state-Bl3gAQPi.js";import{z as h,af as I}from"./index-Ch-ATQTq.js";import"./mui-BCH_ILdb.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new n.Error().stack;a&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[a]="d9a51ca8-2af9-4ae3-95b4-dfedd8f57b66",n._sentryDebugIdIdentifier="sentry-dbid-d9a51ca8-2af9-4ae3-95b4-dfedd8f57b66")}catch{}})();function ee(){const n=A(),a=j(),{params:t,error:i}=r.useMemo((()=>P(a.search)),[a.search]),w=r.useMemo((()=>new URLSearchParams(a.search).get("client_name")??t?.clientId??"Unknown Application"),[a.search,t]),f=h.isSignedIn(),s=h.getSignedInUser(),p=o((e=>V(e))),l=o((e=>x(e))),d=o((e=>e.tenantState.fetchState)),y=o(z),b=o(D),u=o(M),[v,S]=r.useState(null),[E,_]=r.useState(null);r.useEffect((()=>{document.querySelector("#app-shell-loader")?.remove()}),[]),r.useEffect((()=>()=>{n(R())}),[n,a.search]),r.useEffect((()=>{i!=null&&console.warn("[OAuthConsent] invalid params:",i)}),[i]);const g=r.useRef(!1);r.useEffect((()=>{f&&s!=null&&!g.current&&(d!=="Not-Started"&&d!=="Error"||(g.current=!0,n(k(s.userId,s.zeniSessionId??void 0))))}),[f,s,d,n]),r.useEffect((()=>{u!=null&&u!==""&&(window.location.href=u)}),[u]);const U=r.useMemo((()=>{if(p?.tenantId!=null)return p.tenantId;const e=h.getActiveTenantForUser()?.tenantId;return e!=null&&l.some((T=>T.tenantId===e))?e:l.length===1?l[0].tenantId:null}),[p?.tenantId,l]),c=v??U;return i!=null?m.jsx(I,{variant:"invalid_params",paramsError:i}):f?m.jsx(I,{variant:"signed_in",clientName:w,userEmail:s?.userEmail,isInitializing:d!=="Completed",tenants:l,selectedTenantId:c,onSelectTenant:S,approveError:E??b,isApproving:y==="In-Progress",showAllowButton:c!=null,onApprove:()=>{t!=null&&s!=null&&c!=null&&n(L(s.userId,s.zeniSessionId??void 0,c,t.clientId,t.redirectUri,t.codeChallenge,t.codeChallengeMethod,t.state,t.responseType))},onDeny:()=>{if(t!=null)try{const e=new URL(t.redirectUri);e.searchParams.set("error","access_denied"),e.searchParams.set("error_description","The user denied the request"),e.searchParams.set("state",t.state),window.location.href=e.toString()}catch{_("Unable to deny: redirect_uri is not a valid URL. Close this window or contact support.")}}}):m.jsx(C,{to:"/signin/auth",state:{origin:a.pathname+a.search},replace:!0})}export{ee as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./liveblocks-DcDE-V-o.js";import{h as W,u as Y,g as z,i as X,j as d,l as Z,n as H,o as S}from"./core-D4EC26kf.js";import{fI as v,Aw as R,vc as J,VX as w,v7 as T,bq as K,c0 as Q,v8 as ee,VY as ae,VF as C,ek as te,Ek as se,VZ as oe,EI as re,e0 as ne,d$ as ce}from"./zeni-epic-state-Bl3gAQPi.js";import{ag as ie,z as le,ao as de,aq as fe,V as me,a6 as pe,j as M,aB as ue,p as he,W as Fe,A as ge}from"./index-Ch-ATQTq.js";import"./mui-BCH_ILdb.js";import Ie from"./NotFoundScreen-0hF8kIyY.js";import{F as be}from"./FeaturePreviewScreen-B0SxkBd3.js";import{a as F}from"./sentry-DB4rU-NW.js";import{u as Se}from"./useAskAiCfoHostNavButtonProps-CBSVhkeG.js";import{u as Ce}from"./useInitialThreadRequest-Da3K5Ksw.js";import{t as Te}from"./routePaths-D0-Tropc.js";import{M as ye}from"./MobileAppDrawer-C6gfQS8M.js";import"./recharts-BRIJ8RH5.js";import"./analytics-UPQyZr49.js";import"./plaid-a-pmhWdo.js";import"./dnd-CQ9igkkh.js";import"./stripe-cKAAJElX.js";import"./lottie-DBrmrNFb.js";import"./lexical-DvwBeJWJ.js";import"./pdf-zGCHYG6q.js";import"./utils-CU_Pr3K6.js";import"./InboxNotificationsProvider-DPgK9Ai7.js";import"./useTaskManagerAccess-CX5toJpg.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new s.Error().stack;e&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[e]="5ffc30b6-efa1-46c6-8783-31ccf3313c79",s._sentryDebugIdIdentifier="sentry-dbid-5ffc30b6-efa1-46c6-8783-31ccf3313c79")}catch{}})();const y=(s,e,a,o)=>{if(s!=e){const r=o??"";s!=null&&s.length>0?a(`../${e}${r}`,{replace:!0}):a(`${e}${r}`,{replace:!0})}},Ae=Z((function(s){const e=ae(s),a={},o=e.pandLReportWithForecast.uiState.nodeCollapseState;return Object.keys(o).forEach((r=>{a[r]=o[r]===!1})),{selectedTimeframe:e.selectedTimeframe,isForecastVsActualOn:e.isForecastVsActualOn,compareMode:e.compareMode,forecastList:e.forecastList,selectedForecast:e.selectedForecast,pandLreport:e.pandLReportWithForecast,scrollPosition:e.pandLReportWithForecast.uiState.scrollPosition,nodeOpenStatus:a,type:"name+balances_forecast",analytics:M}}),(function(s,e){return{onForecastSelectionChanged:(a,o)=>{s(w(a,o)),e.isPandLReportFetched(a)||s(T(a)),y(e.forecastIdFromUrlPath,a,e.navigate)},onTimeframeChanged:a=>{s(re(a))},onForecastVsActualsCompareToggle:a=>{s(oe(a)),s(C({forecastId:e.forecastIdFromUrlPath,scrollPosition:{scrollLeft:0,scrollTop:0}}))},onCompareModeChanged:a=>{s(se(e.firstMonthOfFY,a,0,[]))},onAccountBalanceClick:e.hasTransactionAccess!==!0?void 0:(a,o)=>{let r,c;const p=a.accountName===""?a.accountDescription:a.accountName;if(o.balanceTimeFrame==="month"||o.balanceTimeFrame==="quarter"?(r=o.balanceTimeFrame,c=te(o)):o.balanceTimeFrame==="year"?(r="quarter",c={startDate:o.endDate.startOf("quarter"),endDate:o.endDate}):console.error(`timeframe ${o.balanceTimeFrame} is not supported`),c!=null&&r!=null){const u=Te(e.tenantEmailDomain,a.accountId,a.accountType,p,r,c),f=he(e.location.state?.pathnameStackToGoBack,e.location.pathname);e.navigate(u,{state:{pathnameStackToGoBack:f,referrer:"Forecast"}})}},onNodeCollapseToggled:(a,o)=>{s(C({forecastId:e.forecastIdFromUrlPath,nodeCollapseState:{nodeId:a,isCollapsed:o===!1}}))},onTableScroll:a=>{s(C({forecastId:e.forecastIdFromUrlPath,scrollPosition:a}))},onBackClick:()=>{e.navigate("../../")}}}))(ue);function U(){const s=ie(),e=W(),a=Y(),o=z(),{forecastId:r,tenantEmailDomain:c}=X(),[p,u]=F.useState(!1),[f,A]=F.useState(!1),g=le.getSignedInUser(),k=d((t=>v(t))),V=k.company?.companyInfo.firstMonthOfFY??1,i=d((t=>R(t.forecastState,t.forecastListState))),l=d((t=>t.forecastListState.fetchState==="Completed")),x=d((t=>t.profitAndLossState)),D=d((t=>t.reportUIOptionsState.selectedForecast)),j=t=>x.pandLByForecastID[t]!=null&&ee(t,x).reducedAllFetchState.fetchState==="Completed",{areTenantIdsInSync:I}=de();fe({isDataReady:l});const{isAiCfoAccessEnabled:q,onAskAiCfoClick:B}=Se({mobileExploreReferrer:"Forecast"});F.useEffect((()=>{if(!p&&I)u(!0),l||a(J());else if(l&&!f){A(!0);const t=((m,P,O)=>P!=null?m.forecasts.findIndex((b=>b.id===P)):O!=null?m.forecasts.findIndex((b=>b.id===O)):m.forecasts.length>0?0:-1)(i,r,D?.id);t===-1&&r!=null?e("page-not-found",{replace:!0}):t!==-1&&t!=D?.index?(a(w(i.forecasts[t].id,t)),y(r,i.forecasts[t].id,e,o.search)):r==null&&t!==-1&&y(void 0,i.forecasts[t].id,e,o.search),t!==-1&&!j(i.forecasts[t].id)&&I&&a(T(i.forecasts[t].id))}}),[p,u,a,l,i,f,A,R,T,I]);const E=me(),_=E?.loggedInUserRole!=null&&K(E.loggedInUserRole),$=Ce(k?.companyId,{clearParams:l&&f}),[N,G]=F.useState(!1),h=new URL(s("forecast_pandl"));h.searchParams.set("firstname",g?.firstName??""),h.searchParams.set("lastname",g?.lastName??""),h.searchParams.set("email",g?.userEmail??"");const L=t=>{G(t)};return n.jsxs(n.Fragment,{children:[l?n.jsx(pe,{analytics:M,onLoad:t=>(m=>m.trackForecast())(t)}):null,n.jsx(ye,{isAppContentDrawerOpen:N,handleDrawerToggle:L}),n.jsx(Ae,{firstMonthOfFY:V,tenantEmailDomain:c,forecastIdFromUrlPath:r,navigate:e,location:o,isPandLReportFetched:j,meetingUrl:Q(h.toString()),hasTransactionAccess:_,isAiCfoAccessEnabled:q,onAskAiCfoClick:B,initialOpenThreadRequest:$,onClickMenuIcon:()=>{L(!0)}})]})}function Xe(){const s=d((c=>v(c))),{useFeatureGate:e}=Fe(),{isFeatureEnabled:a}=e(ge.isDebitCardFeatureEnabled),o=ne(a,s),r=ce(s);return o===!0||r===!0?n.jsx(be,{}):n.jsxs(H,{children:[n.jsx(S,{path:"/",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId",element:n.jsx(U,{})}),n.jsx(S,{path:"/:forecastId/*",element:n.jsx(Ie,{})})]})}export{Xe as default};
|